summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kcontrol/hwmanager/hwmanager.cpp36
-rw-r--r--kcontrol/hwmanager/hwmanager.h6
2 files changed, 18 insertions, 24 deletions
diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp
index 265901003..f5b0206c3 100644
--- a/kcontrol/hwmanager/hwmanager.cpp
+++ b/kcontrol/hwmanager/hwmanager.cpp
@@ -87,6 +87,8 @@ 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);
@@ -96,9 +98,8 @@ TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringLis
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(deviceChanged(TDEGenericDevice*)));
+ connect(hwdevices, TQT_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQT_SLOT(scheduleDeviceUpdate()));
+ connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(scheduleDeviceUpdate()));
load();
@@ -132,8 +133,19 @@ void TDEHWManager::defaults()
load( true );
}
+void TDEHWManager::scheduleDeviceUpdate()
+{
+ if (!deviceUpdateScheduled)
+ {
+ deviceUpdateScheduled = true;
+ TQTimer::singleShot(1000, this, TQT_SLOT(populateTreeView()));
+ }
+}
+
void TDEHWManager::populateTreeView()
{
+ deviceUpdateScheduled = false;
+
bool show_by_connection = base->showByConnection->isChecked();
// Figure out which device, if any, was selected
@@ -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);
diff --git a/kcontrol/hwmanager/hwmanager.h b/kcontrol/hwmanager/hwmanager.h
index abc05fa54..6d8105d07 100644
--- a/kcontrol/hwmanager/hwmanager.h
+++ b/kcontrol/hwmanager/hwmanager.h
@@ -58,15 +58,15 @@ public:
k_dcop:
private slots:
+ void cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice);
void populateTreeView();
void populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection, TQString selected_syspath);
- void deviceChanged(TDEGenericDevice*);
- void cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice);
+ void scheduleDeviceUpdate();
private:
TDEHWManagerBase *base;
-
TDEConfig *config;
+ bool deviceUpdateScheduled;
};
#endif