diff options
Diffstat (limited to 'kcontrol/hwmanager/hwmanager.cpp')
-rw-r--r-- | kcontrol/hwmanager/hwmanager.cpp | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp index 265901003..662844ec3 100644 --- a/kcontrol/hwmanager/hwmanager.cpp +++ b/kcontrol/hwmanager/hwmanager.cpp @@ -44,7 +44,7 @@ #include <unistd.h> #include <kpassdlg.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <string> #include <stdio.h> #include <tqstring.h> @@ -59,8 +59,8 @@ using namespace std; typedef KGenericFactory<TDEHWManager, TQWidget> TDEHWManagerFactory; K_EXPORT_COMPONENT_FACTORY( kcm_hwmanager, TDEHWManagerFactory("kcmhwmanager") ) -KSimpleConfig *config; -KSimpleConfig *systemconfig; +TDESimpleConfig *config; +TDESimpleConfig *systemconfig; /**** TDEHWManager ****/ @@ -68,8 +68,8 @@ TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringLis : TDECModule(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" )); + config = new TDESimpleConfig( TQString::fromLatin1( "hwmanagerrc" )); + systemconfig = new TDESimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdehw/hwmanagerrc" )); TDEAboutData *about = new TDEAboutData(I18N_NOOP("kcmhwmanager"), I18N_NOOP("TDE Device Manager"), 0, @@ -87,18 +87,19 @@ TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringLis base->deviceFilter->setListView(base->deviceTree); + deviceUpdateScheduled = false; + setRootOnlyMsg(i18n("<b>Device settings are system wide, and therefore require administrator access</b><br>To alter the system's device settings, click on the \"Administrator Mode\" button below.")); setUseRootOnlyMsg(true); TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); hwdevices->setTriggerlessHardwareUpdatesEnabled(true); - connect(base->showByConnection, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); - connect(base->showByConnection, TQT_SIGNAL(clicked()), TQT_SLOT(populateTreeView())); + connect(base->showByConnection, TQ_SIGNAL(clicked()), TQ_SLOT(changed())); + connect(base->showByConnection, TQ_SIGNAL(clicked()), TQ_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(deviceChanged(TDEGenericDevice*))); + connect(hwdevices, TQ_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQ_SLOT(scheduleDeviceUpdate())); + connect(hwdevices, TQ_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQ_SLOT(scheduleDeviceUpdate())); load(); @@ -132,8 +133,19 @@ void TDEHWManager::defaults() load( true ); } +void TDEHWManager::scheduleDeviceUpdate() +{ + if (!deviceUpdateScheduled) + { + deviceUpdateScheduled = true; + TQTimer::singleShot(1000, this, TQ_SLOT(populateTreeView())); + } +} + void TDEHWManager::populateTreeView() { + deviceUpdateScheduled = false; + bool show_by_connection = base->showByConnection->isChecked(); // Figure out which device, if any, was selected @@ -154,7 +166,7 @@ void TDEHWManager::populateTreeView() for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) { TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice); - connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); + connect(cdevice, TQ_SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); cdevice->enablePINEntryCallbacks(true); } @@ -176,7 +188,7 @@ void TDEHWManager::populateTreeView() for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) { TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice); - connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); + connect(cdevice, TQ_SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); cdevice->enablePINEntryCallbacks(true); } @@ -199,7 +211,7 @@ void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_con for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) { TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice); - connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); + connect(cdevice, TQ_SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); cdevice->enablePINEntryCallbacks(true); } @@ -215,24 +227,6 @@ void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_con } } -void TDEHWManager::deviceChanged(TDEGenericDevice* device) { - TQListViewItemIterator it(base->deviceTree); - while (it.current()) { - DeviceIconItem* item = dynamic_cast<DeviceIconItem*>(it.current()); - if (item) { - TDEGenericDevice* candidate = item->device(); - if (candidate) { - if (candidate->systemPath() == device->systemPath()) { - if (item->text(0) != device->detailedFriendlyName()) { - item->setText(0, device->detailedFriendlyName()); - } - } - } - } - ++it; - } -} - void TDEHWManager::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) { TQString password; int result = KPasswordDialog::getPassword(password, prompt); |