summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-05 22:01:03 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-05 22:01:03 -0500
commit0d6bebc5f5bacd360dcee8f58b93ae3c99028c75 (patch)
treeb3936440d248b4f628b9e6c42f0f2b0deaacf793
parent3a36b8dd807011ce65b758c7ea18226324565f59 (diff)
downloadtdebase-0d6bebc5f5bacd360dcee8f58b93ae3c99028c75.tar.gz
tdebase-0d6bebc5f5bacd360dcee8f58b93ae3c99028c75.zip
Add rudimentary device manager to kcontrol
-rw-r--r--kcontrol/CMakeLists.txt1
-rw-r--r--kcontrol/hwmanager/CMakeLists.txt39
-rw-r--r--kcontrol/hwmanager/deviceiconview.cpp108
-rw-r--r--kcontrol/hwmanager/deviceiconview.h82
-rw-r--r--kcontrol/hwmanager/devicepropsdlg.cpp111
-rw-r--r--kcontrol/hwmanager/devicepropsdlg.h57
-rw-r--r--kcontrol/hwmanager/hwmanager.cpp175
-rw-r--r--kcontrol/hwmanager/hwmanager.desktop23
-rw-r--r--kcontrol/hwmanager/hwmanager.h71
-rw-r--r--kcontrol/hwmanager/hwmanagerbase.ui97
10 files changed, 764 insertions, 0 deletions
diff --git a/kcontrol/CMakeLists.txt b/kcontrol/CMakeLists.txt
index b6fe70f40..92a032463 100644
--- a/kcontrol/CMakeLists.txt
+++ b/kcontrol/CMakeLists.txt
@@ -65,6 +65,7 @@ if( BUILD_KCONTROL )
add_subdirectory( kthememanager )
add_subdirectory( kfontinst )
add_subdirectory( access )
+ add_subdirectory( hwmanager )
tde_conditional_add_subdirectory( WITH_XRANDR displayconfig )
tde_conditional_add_subdirectory( WITH_SAMBA samba )
diff --git a/kcontrol/hwmanager/CMakeLists.txt b/kcontrol/hwmanager/CMakeLists.txt
new file mode 100644
index 000000000..dc1265e49
--- /dev/null
+++ b/kcontrol/hwmanager/CMakeLists.txt
@@ -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}
+)
diff --git a/kcontrol/hwmanager/deviceiconview.cpp b/kcontrol/hwmanager/deviceiconview.cpp
new file mode 100644
index 000000000..f38f35460
--- /dev/null
+++ b/kcontrol/hwmanager/deviceiconview.cpp
@@ -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;
+} \ No newline at end of file
diff --git a/kcontrol/hwmanager/deviceiconview.h b/kcontrol/hwmanager/deviceiconview.h
new file mode 100644
index 000000000..76c18e93f
--- /dev/null
+++ b/kcontrol/hwmanager/deviceiconview.h
@@ -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
diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp
new file mode 100644
index 000000000..16b01adc9
--- /dev/null
+++ b/kcontrol/hwmanager/devicepropsdlg.cpp
@@ -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"
diff --git a/kcontrol/hwmanager/devicepropsdlg.h b/kcontrol/hwmanager/devicepropsdlg.h
new file mode 100644
index 000000000..30c69b1a7
--- /dev/null
+++ b/kcontrol/hwmanager/devicepropsdlg.h
@@ -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
diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp
new file mode 100644
index 000000000..049460d17
--- /dev/null
+++ b/kcontrol/hwmanager/hwmanager.cpp
@@ -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"
diff --git a/kcontrol/hwmanager/hwmanager.desktop b/kcontrol/hwmanager/hwmanager.desktop
new file mode 100644
index 000000000..534a3c0c9
--- /dev/null
+++ b/kcontrol/hwmanager/hwmanager.desktop
@@ -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 \ No newline at end of file
diff --git a/kcontrol/hwmanager/hwmanager.h b/kcontrol/hwmanager/hwmanager.h
new file mode 100644
index 000000000..c8b7053df
--- /dev/null
+++ b/kcontrol/hwmanager/hwmanager.h
@@ -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
+
diff --git a/kcontrol/hwmanager/hwmanagerbase.ui b/kcontrol/hwmanager/hwmanagerbase.ui
new file mode 100644
index 000000000..355799e56
--- /dev/null
+++ b/kcontrol/hwmanager/hwmanagerbase.ui
@@ -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>&amp;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>