parent
3a36b8dd80
commit
0d6bebc5f5
@ -0,0 +1,39 @@
|
|||||||
|
#################################################
|
||||||
|
#
|
||||||
|
# (C) 2012 Timothy Pearson
|
||||||
|
# kb9vqf (AT) pearsoncomputing.net
|
||||||
|
#
|
||||||
|
# Improvements and feedback are welcome
|
||||||
|
#
|
||||||
|
# This file is released under GPL >= 2
|
||||||
|
#
|
||||||
|
#################################################
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${TDE_INCLUDE_DIR}
|
||||||
|
${TQT_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
link_directories(
|
||||||
|
${TQT_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
##### other data ################################
|
||||||
|
|
||||||
|
install( FILES hwmanager.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
|
||||||
|
|
||||||
|
|
||||||
|
##### kcm_iccconfig (module) ####################
|
||||||
|
|
||||||
|
set_source_files_properties( hwmanager.cpp PROPERTIES COMPILE_FLAGS -DKDE_CONFDIR=\\"${TDE_CONFIG_DIR}\\" )
|
||||||
|
|
||||||
|
tde_add_kpart( kcm_hwmanager AUTOMOC
|
||||||
|
SOURCES
|
||||||
|
hwmanager.cpp deviceiconview.cpp devicepropsdlg.cpp hwmanagerbase.ui hwmanager.skel
|
||||||
|
LINK kio-shared
|
||||||
|
DESTINATION ${PLUGIN_INSTALL_DIR}
|
||||||
|
)
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2000 Matthias Elter <elter@kde.org>
|
||||||
|
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <tqheader.h>
|
||||||
|
#include <tqcursor.h>
|
||||||
|
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <kstandarddirs.h>
|
||||||
|
#include <kservicegroup.h>
|
||||||
|
#include <kiconloader.h>
|
||||||
|
#include <kmessagebox.h>
|
||||||
|
|
||||||
|
#include <kdebug.h>
|
||||||
|
|
||||||
|
#include "deviceiconview.h"
|
||||||
|
#include "deviceiconview.moc"
|
||||||
|
|
||||||
|
DeviceIconView::DeviceIconView(TQWidget * parent, const char * name)
|
||||||
|
: KListView(parent, name)
|
||||||
|
{
|
||||||
|
setSorting(0, true);
|
||||||
|
addColumn(TQString::null);
|
||||||
|
|
||||||
|
// Show expand/collapse widgets on root items
|
||||||
|
setRootIsDecorated(true);
|
||||||
|
|
||||||
|
header()->hide();
|
||||||
|
|
||||||
|
connect(this, TQT_SIGNAL(clicked(TQListViewItem*)), this, TQT_SLOT(slotItemSelected(TQListViewItem*)));
|
||||||
|
connect(this, TQT_SIGNAL(executed(TQListViewItem*)), this, TQT_SLOT(slotItemDoubleClicked(TQListViewItem*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceIconView::slotItemSelected(TQListViewItem* item)
|
||||||
|
{
|
||||||
|
TQApplication::restoreOverrideCursor();
|
||||||
|
if (!item) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceIconView::slotItemDoubleClicked(TQListViewItem* item)
|
||||||
|
{
|
||||||
|
TQApplication::restoreOverrideCursor();
|
||||||
|
if (!item) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceIconItem* divi = dynamic_cast<DeviceIconItem*>(item);
|
||||||
|
if (!divi) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (divi->device()) {
|
||||||
|
DevicePropertiesDialog* propsDlg = new DevicePropertiesDialog(divi->device(), this);
|
||||||
|
propsDlg->exec();
|
||||||
|
delete propsDlg;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
KMessageBox::sorry(this, "Detailed information is not available for this device", "Information Unavailable");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceIconView::keyPressEvent(TQKeyEvent *e)
|
||||||
|
{
|
||||||
|
if (e->key() == Key_Return
|
||||||
|
|| e->key() == Key_Enter
|
||||||
|
|| e->key() == Key_Space)
|
||||||
|
{
|
||||||
|
if (currentItem()) {
|
||||||
|
slotItemSelected(currentItem());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
KListView::keyPressEvent(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TQPixmap DeviceIconView::loadIcon( const TQString &name )
|
||||||
|
{
|
||||||
|
TQPixmap icon = DesktopIcon( name, iconSize() );
|
||||||
|
|
||||||
|
if(icon.isNull()) {
|
||||||
|
icon = DesktopIcon( "misc", iconSize() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
KIcon::StdSizes DeviceIconView::iconSize() {
|
||||||
|
return KIcon::SizeSmall;
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __deviceiconview_h__
|
||||||
|
#define __deviceiconview_h__
|
||||||
|
|
||||||
|
#include <klistview.h>
|
||||||
|
#include <kiconloader.h>
|
||||||
|
#include <tdehardwaredevices.h>
|
||||||
|
|
||||||
|
#include "devicepropsdlg.h"
|
||||||
|
|
||||||
|
class ConfigModule;
|
||||||
|
class ConfigModuleList;
|
||||||
|
|
||||||
|
class DeviceIconItem : public KListViewItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DeviceIconItem(TQListViewItem *parent, const TQString& text, const TQPixmap& pm, TDEGenericDevice *d = 0)
|
||||||
|
: KListViewItem(parent, text)
|
||||||
|
, _tag(TQString::null)
|
||||||
|
, _device(d)
|
||||||
|
{
|
||||||
|
setPixmap(0, pm);
|
||||||
|
}
|
||||||
|
DeviceIconItem(TQListView *parent, const TQString& text, const TQPixmap& pm, TDEGenericDevice *d = 0)
|
||||||
|
: KListViewItem(parent, text)
|
||||||
|
, _tag(TQString::null)
|
||||||
|
, _device(d)
|
||||||
|
{
|
||||||
|
setPixmap(0, pm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDevice(TDEGenericDevice* d) { _device = d; }
|
||||||
|
void setTag(const TQString& t) { _tag = t; }
|
||||||
|
|
||||||
|
TDEGenericDevice* device() { return _device; }
|
||||||
|
TQString tag() { return _tag; }
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
TQString _tag;
|
||||||
|
TDEGenericDevice *_device;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DeviceIconView : public KListView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DeviceIconView(TQWidget * parent = 0, const char * name = 0);
|
||||||
|
KIcon::StdSizes iconSize();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void deviceSelected(TDEGenericDevice*);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void slotItemSelected(TQListViewItem*);
|
||||||
|
void slotItemDoubleClicked(TQListViewItem*);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void keyPressEvent(TQKeyEvent *);
|
||||||
|
TQPixmap loadIcon( const TQString &name );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,111 @@
|
|||||||
|
/* This file is part of TDE
|
||||||
|
Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public License
|
||||||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <tqvalidator.h>
|
||||||
|
#include <tqpushbutton.h>
|
||||||
|
#include <tqlineedit.h>
|
||||||
|
#include <tqlabel.h>
|
||||||
|
#include <tqtabwidget.h>
|
||||||
|
#include <tqlayout.h>
|
||||||
|
#undef Unsorted // Required for --enable-final (tqdir.h)
|
||||||
|
#include <tqfiledialog.h>
|
||||||
|
|
||||||
|
#include <kbuttonbox.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <kapplication.h>
|
||||||
|
#include <klineedit.h>
|
||||||
|
#include <kstdguiitem.h>
|
||||||
|
|
||||||
|
#include "devicepropsdlg.h"
|
||||||
|
|
||||||
|
DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidget *parent)
|
||||||
|
: KDialogBase(Plain, TQString::null, Ok|Cancel, Ok, parent, 0L, true, true)
|
||||||
|
{
|
||||||
|
m_device = device;
|
||||||
|
enableButtonOK( false );
|
||||||
|
|
||||||
|
if (m_device) {
|
||||||
|
TQGridLayout *mainGrid = new TQGridLayout(plainPage(), 1, 1, 0, spacingHint());
|
||||||
|
mainGrid->setRowStretch(1, 1);
|
||||||
|
mainGrid->setRowStretch(1, 1);
|
||||||
|
|
||||||
|
TQTabWidget *mainTabs = new TQTabWidget(plainPage());
|
||||||
|
|
||||||
|
TQWidget *genericPropertiesTab = new TQWidget(this);
|
||||||
|
|
||||||
|
TQGridLayout *generalTabLayout = new TQGridLayout(genericPropertiesTab, 4, 2, 0, spacingHint() );
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
TQLabel *label;
|
||||||
|
label = new TQLabel(i18n("Device Name:"), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 0);
|
||||||
|
label = new TQLabel(m_device->friendlyName(), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 1);
|
||||||
|
row++;
|
||||||
|
label = new TQLabel(i18n("Device Node:"), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 0);
|
||||||
|
label = new TQLabel(m_device->deviceNode(), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 1);
|
||||||
|
row++;
|
||||||
|
label = new TQLabel(i18n("System Path:"), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 0);
|
||||||
|
label = new TQLabel(m_device->systemPath(), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 1);
|
||||||
|
row++;
|
||||||
|
label = new TQLabel(i18n("Subsystem Type:"), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 0);
|
||||||
|
label = new TQLabel(m_device->subsystem(), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 1);
|
||||||
|
row++;
|
||||||
|
label = new TQLabel(i18n("Device Driver:"), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 0);
|
||||||
|
label = new TQLabel((m_device->deviceDriver().isNull())?i18n("<none>"):m_device->deviceDriver(), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 1);
|
||||||
|
row++;
|
||||||
|
label = new TQLabel(i18n("Device Class:"), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 0);
|
||||||
|
label = new TQLabel((m_device->PCIClass().isNull())?i18n("<n/a>"):m_device->PCIClass(), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 1);
|
||||||
|
row++;
|
||||||
|
if (m_device->subsystem() == "pci") {
|
||||||
|
TQString busid = m_device->systemPath();
|
||||||
|
busid = busid.remove(0, busid.findRev("/")+1);
|
||||||
|
busid = busid.remove(0, busid.find(":")+1);
|
||||||
|
label = new TQLabel(i18n("Bus ID:"), genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 0);
|
||||||
|
label = new TQLabel(busid, genericPropertiesTab);
|
||||||
|
generalTabLayout->addWidget(label, row, 1);
|
||||||
|
row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainTabs->addTab(genericPropertiesTab, i18n("&General"));
|
||||||
|
|
||||||
|
mainGrid->addWidget(mainTabs, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DevicePropertiesDialog::~DevicePropertiesDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DevicePropertiesDialog::virtual_hook( int id, void* data )
|
||||||
|
{ KDialogBase::virtual_hook( id, data ); }
|
||||||
|
|
||||||
|
#include "devicepropsdlg.moc"
|
@ -0,0 +1,57 @@
|
|||||||
|
/* This file is part of TDE
|
||||||
|
Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public License
|
||||||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
#ifndef __devicepropsdlg_h__
|
||||||
|
#define __devicepropsdlg_h__
|
||||||
|
|
||||||
|
// #include <tqt.h>
|
||||||
|
|
||||||
|
#include <kdialogbase.h>
|
||||||
|
|
||||||
|
#include <tdehardwaredevices.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Dialog to view and edit hardware device properties
|
||||||
|
*
|
||||||
|
* @version 0.1
|
||||||
|
* @author Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||||||
|
*/
|
||||||
|
|
||||||
|
class TDEUI_EXPORT DevicePropertiesDialog : public KDialogBase
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Create a dialog that allows a user to view and edit hardware device properties
|
||||||
|
* @param parent Parent widget for the line edit dialog
|
||||||
|
*/
|
||||||
|
DevicePropertiesDialog(TDEGenericDevice* device, TQWidget *parent);
|
||||||
|
virtual ~DevicePropertiesDialog();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void virtual_hook( int id, void* data );
|
||||||
|
|
||||||
|
private:
|
||||||
|
TDEGenericDevice* m_device;
|
||||||
|
|
||||||
|
class DevicePropertiesDialogPrivate;
|
||||||
|
DevicePropertiesDialogPrivate* d;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,175 @@
|
|||||||
|
/**
|
||||||
|
* hwmanager.cpp
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2010 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <tqcheckbox.h>
|
||||||
|
#include <tqlabel.h>
|
||||||
|
#include <tqlayout.h>
|
||||||
|
#include <tqlineedit.h>
|
||||||
|
#include <tqpushbutton.h>
|
||||||
|
|
||||||
|
#include <dcopclient.h>
|
||||||
|
|
||||||
|
#include <kaboutdata.h>
|
||||||
|
#include <kapplication.h>
|
||||||
|
#include <kconfig.h>
|
||||||
|
#include <kcombobox.h>
|
||||||
|
#include <kdebug.h>
|
||||||
|
#include <kdialog.h>
|
||||||
|
#include <kglobal.h>
|
||||||
|
#include <klistview.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <kmessagebox.h>
|
||||||
|
#include <kpopupmenu.h>
|
||||||
|
#include <kinputdialog.h>
|
||||||
|
#include <kurlrequester.h>
|
||||||
|
#include <kgenericfactory.h>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ksimpleconfig.h>
|
||||||
|
#include <string>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <tqstring.h>
|
||||||
|
|
||||||
|
#include "hwmanager.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
/**** DLL Interface ****/
|
||||||
|
typedef KGenericFactory<TDEHWManager, TQWidget> TDEHWManagerFactory;
|
||||||
|
K_EXPORT_COMPONENT_FACTORY( kcm_hwmanager, TDEHWManagerFactory("kcmhwmanager") )
|
||||||
|
|
||||||
|
KSimpleConfig *config;
|
||||||
|
KSimpleConfig *systemconfig;
|
||||||
|
|
||||||
|
/**** TDEHWManager ****/
|
||||||
|
|
||||||
|
TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringList &)
|
||||||
|
: KCModule(TDEHWManagerFactory::instance(), parent, name)
|
||||||
|
{
|
||||||
|
TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
|
||||||
|
config = new KSimpleConfig( TQString::fromLatin1( "hwmanagerrc" ));
|
||||||
|
systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdehw/hwmanagerrc" ));
|
||||||
|
|
||||||
|
KAboutData *about =
|
||||||
|
new KAboutData(I18N_NOOP("kcmhwmanager"), I18N_NOOP("TDE Hardware Device Manager"),
|
||||||
|
0, 0, KAboutData::License_GPL,
|
||||||
|
I18N_NOOP("(c) 2012 Timothy Pearson"));
|
||||||
|
|
||||||
|
about->addAuthor("Timothy Pearson", 0, "kb9vqf@pearsoncomputing.net");
|
||||||
|
setAboutData( about );
|
||||||
|
|
||||||
|
base = new TDEHWManagerBase(this);
|
||||||
|
layout->add(base);
|
||||||
|
|
||||||
|
setRootOnlyMsg(i18n("<b>Hardware settings are system wide, and requires administrator access</b><br>To alter the system's hardware settings, click on the \"Administrator Mode\" button below."));
|
||||||
|
setUseRootOnlyMsg(true);
|
||||||
|
|
||||||
|
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
|
||||||
|
|
||||||
|
connect(base->showByConnection, TQT_SIGNAL(clicked()), TQT_SLOT(changed()));
|
||||||
|
connect(base->showByConnection, TQT_SIGNAL(clicked()), TQT_SLOT(populateTreeView()));
|
||||||
|
|
||||||
|
connect(hwdevices, TQT_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView()));
|
||||||
|
connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView()));
|
||||||
|
connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView()));
|
||||||
|
|
||||||
|
load();
|
||||||
|
|
||||||
|
populateTreeView();
|
||||||
|
}
|
||||||
|
|
||||||
|
TDEHWManager::~TDEHWManager()
|
||||||
|
{
|
||||||
|
delete config;
|
||||||
|
delete systemconfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDEHWManager::load()
|
||||||
|
{
|
||||||
|
load( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDEHWManager::load(bool useDefaults )
|
||||||
|
{
|
||||||
|
emit changed(useDefaults);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDEHWManager::save()
|
||||||
|
{
|
||||||
|
emit changed(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDEHWManager::defaults()
|
||||||
|
{
|
||||||
|
load( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDEHWManager::populateTreeView()
|
||||||
|
{
|
||||||
|
bool show_by_connection = base->showByConnection->isChecked();
|
||||||
|
|
||||||
|
base->deviceTree->clear();
|
||||||
|
|
||||||
|
if (show_by_connection) {
|
||||||
|
DeviceIconItem* rootitem = new DeviceIconItem(base->deviceTree, "Linux System", DesktopIcon("misc", base->deviceTree->iconSize()), 0);
|
||||||
|
|
||||||
|
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
|
||||||
|
TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass(TDEGenericDeviceType::Root);
|
||||||
|
TDEGenericDevice *hwdevice;
|
||||||
|
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
|
||||||
|
DeviceIconItem* item = new DeviceIconItem(rootitem, hwdevice->friendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice);
|
||||||
|
populateTreeViewLeaf(item, show_by_connection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
|
||||||
|
for (int i=0;i<=TDEGenericDeviceType::Last;i++) {
|
||||||
|
if (i != TDEGenericDeviceType::Root) {
|
||||||
|
DeviceIconItem* item = new DeviceIconItem(base->deviceTree, hwdevices->getFriendlyDeviceTypeStringFromType((TDEGenericDeviceType::TDEGenericDeviceType)i), hwdevices->getDeviceTypeIconFromType((TDEGenericDeviceType::TDEGenericDeviceType)i, base->deviceTree->iconSize()), 0);
|
||||||
|
TDEGenericDevice *hwdevice;
|
||||||
|
TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass((TDEGenericDeviceType::TDEGenericDeviceType)i);
|
||||||
|
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
|
||||||
|
new DeviceIconItem(item, hwdevice->friendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection) {
|
||||||
|
if (show_by_connection) {
|
||||||
|
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
|
||||||
|
TDEGenericHardwareList hwlist = hwdevices->listAllPhysicalDevices();
|
||||||
|
TDEGenericDevice *hwdevice;
|
||||||
|
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
|
||||||
|
if (hwdevice->parentDevice() == parent->device()) {
|
||||||
|
DeviceIconItem* item = new DeviceIconItem(parent, hwdevice->friendlyName(), hwdevices->getDeviceTypeIconFromType(hwdevice->type(), base->deviceTree->iconSize()), hwdevice);
|
||||||
|
populateTreeViewLeaf(item, show_by_connection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TQString TDEHWManager::quickHelp() const
|
||||||
|
{
|
||||||
|
return i18n("<h1>TDE Hardware Device Manager</h1> This module allows you to configure hardware devices on your system");
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "hwmanager.moc"
|
@ -0,0 +1,23 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Exec=kcmshell kwmanager
|
||||||
|
Icon=background
|
||||||
|
Type=Application
|
||||||
|
DocPath=kcontrol/hwmanager/index.html
|
||||||
|
|
||||||
|
X-KDE-Library=hwmanager
|
||||||
|
X-KDE-ParentApp=kcontrol
|
||||||
|
X-KDE-RootOnly=true
|
||||||
|
X-KDE-SubstituteUID=true
|
||||||
|
|
||||||
|
Categories=Qt;KDE;X-KDE-settings-hardware;
|
||||||
|
Comment=Configure hardware devices
|
||||||
|
Comment[en_US]=Configure hardware devices
|
||||||
|
DocPath=kcontrol/hwmanager.html
|
||||||
|
GenericName=
|
||||||
|
GenericName[en_US]=
|
||||||
|
Keywords=hardware
|
||||||
|
MimeType=
|
||||||
|
Name=Hardware Device Manager
|
||||||
|
Name[en_US]=Hardware Device Manager
|
||||||
|
|
||||||
|
NoDisplay=false
|
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* hwmanager.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _KCM_HWMANAGER_H
|
||||||
|
#define _KCM_HWMANAGER_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <kcmodule.h>
|
||||||
|
|
||||||
|
#include <dcopobject.h>
|
||||||
|
|
||||||
|
#include "hwmanagerbase.h"
|
||||||
|
#include "devicepropsdlg.h"
|
||||||
|
#include "deviceiconview.h"
|
||||||
|
|
||||||
|
class KConfig;
|
||||||
|
class KPopupMenu;
|
||||||
|
class KListViewItem;
|
||||||
|
|
||||||
|
class TDEHWManager : public KCModule, public DCOPObject
|
||||||
|
{
|
||||||
|
K_DCOP
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//TDEHWManager(TQWidget *parent = 0L, const char *name = 0L);
|
||||||
|
TDEHWManager(TQWidget *parent, const char *name, const TQStringList &);
|
||||||
|
virtual ~TDEHWManager();
|
||||||
|
|
||||||
|
TDEHWManagerBase *base;
|
||||||
|
|
||||||
|
void load();
|
||||||
|
void load( bool useDefaults);
|
||||||
|
void save();
|
||||||
|
void defaults();
|
||||||
|
|
||||||
|
int buttons();
|
||||||
|
TQString quickHelp() const;
|
||||||
|
|
||||||
|
k_dcop:
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void populateTreeView();
|
||||||
|
void populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection);
|
||||||
|
|
||||||
|
private:
|
||||||
|
KConfig *config;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,97 @@
|
|||||||
|
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
|
||||||
|
<class>TDEHWManagerBase</class>
|
||||||
|
<widget class="TQWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>TDEHWManagerBase</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>519</width>
|
||||||
|
<height>356</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="TQTabWidget" row="0" column="0">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>TabWidget2</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="TQWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>tab</cstring>
|
||||||
|
</property>
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Hardware Devices</string>
|
||||||
|
</attribute>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="TQGroupBox" row="0" column="0">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>groupSystemSettings</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>System Settings</string>
|
||||||
|
</property>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="TQCheckBox" row="0" column="0" colspan="2">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>showByConnection</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&List devices by connection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="DeviceIconView" row="1" column="1" colspan="4">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>deviceTree</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
<spacer row="4" column="0">
|
||||||
|
<property name="name" stdset="0">
|
||||||
|
<cstring>Spacer4</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
<includes>
|
||||||
|
<include location="local" impldecl="in implementation">TDEHWManagerBase.ui.h</include>
|
||||||
|
<include location="local" impldecl="in implementation">deviceiconview.h</include>
|
||||||
|
</includes>
|
||||||
|
<Q_SLOTS>
|
||||||
|
<slot>enableSupport_toggled(bool)</slot>
|
||||||
|
</Q_SLOTS>
|
||||||
|
<includes>
|
||||||
|
<include location="local" impldecl="in implementation">kdialog.h</include>
|
||||||
|
</includes>
|
||||||
|
<layoutdefaults spacing="3" margin="6"/>
|
||||||
|
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
|
||||||
|
</UI>
|
Loading…
Reference in new issue