summaryrefslogtreecommitdiffstats
path: root/kcontrol/hwmanager/hwmanager.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-02-17 11:30:31 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-02-17 11:32:54 +0900
commit2ffa44200eba513d4e3332917511b40250b416a7 (patch)
tree3b21bd86c0789fb47eca0a41950633ef6983b0f6 /kcontrol/hwmanager/hwmanager.cpp
parent68c1810b9ee1f895e3129ca1629bc6b47f3946aa (diff)
downloadtdebase-2ffa44200eba513d4e3332917511b40250b416a7.tar.gz
tdebase-2ffa44200eba513d4e3332917511b40250b416a7.zip
hwmanager: avoid unnecessary update of device names on status change. This relates to issue TDE/tde#110.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kcontrol/hwmanager/hwmanager.cpp')
-rw-r--r--kcontrol/hwmanager/hwmanager.cpp36
1 files changed, 15 insertions, 21 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);