summaryrefslogtreecommitdiffstats
path: root/kxkb
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-11-13 14:08:55 +0200
committerMavridis Philippe <mavridisf@gmail.com>2024-11-13 14:09:30 +0200
commitbc7cc4032801642c5ce675c9a78db949eb8982a7 (patch)
tree783d2c83e8fe74571405f7b15040b2c4ab3a9fd0 /kxkb
parentce8f215f883b7ca7301eb37b5a02d416b82dc52e (diff)
downloadtdebase-bc7cc4032801642c5ce675c9a78db949eb8982a7.tar.gz
tdebase-bc7cc4032801642c5ce675c9a78db949eb8982a7.zip
Kxkb: Add delay to applying settings after keyboard hardware somehow changesfix/kxkb/547
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kxkb')
-rw-r--r--kxkb/kxkb.cpp29
-rw-r--r--kxkb/kxkb.h4
2 files changed, 7 insertions, 26 deletions
diff --git a/kxkb/kxkb.cpp b/kxkb/kxkb.cpp
index 320b55f40..01df09add 100644
--- a/kxkb/kxkb.cpp
+++ b/kxkb/kxkb.cpp
@@ -31,6 +31,7 @@ DESCRIPTION
#include <tqfile.h>
#include <tqstringlist.h>
#include <tqimage.h>
+#include <tqtimer.h>
#include <tdeaboutdata.h>
#include <tdecmdlineargs.h>
@@ -87,9 +88,9 @@ KXKBApp::KXKBApp(bool allowStyles, bool GUIenabled)
addKipcEventMask( KIPC::SettingsChanged );
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
- connect(hwdevices, TQ_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQ_SLOT(hardwareAdded(TDEGenericDevice*)));
- connect(hwdevices, TQ_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQ_SLOT(hardwareRemoved(TDEGenericDevice*)));
- connect(hwdevices, TQ_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQ_SLOT(hardwareUpdated(TDEGenericDevice*)));
+ connect(hwdevices, TQ_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQ_SLOT(hardwareChanged(TDEGenericDevice*)));
+ connect(hwdevices, TQ_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQ_SLOT(hardwareChanged(TDEGenericDevice*)));
+ connect(hwdevices, TQ_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQ_SLOT(hardwareChanged(TDEGenericDevice*)));
}
KXKBApp::~KXKBApp()
@@ -190,29 +191,11 @@ void KXKBApp::initTray()
m_tray->show();
}
-void KXKBApp::hardwareAdded(TDEGenericDevice *dev)
+void KXKBApp::hardwareChanged(TDEGenericDevice *dev)
{
if (dev->type() == TDEGenericDeviceType::Keyboard)
{
- kdDebug() << "keyboard attached: " << dev->friendlyName() << endl;
- applySettings();
- }
-}
-void KXKBApp::hardwareRemoved(TDEGenericDevice *dev)
-{
- if (dev->type() == TDEGenericDeviceType::Keyboard)
- {
- kdDebug() << "keyboard removed: " << dev->friendlyName() << endl;
- applySettings();
- }
-}
-
-void KXKBApp::hardwareUpdated(TDEGenericDevice *dev)
-{
- if (dev->type() == TDEGenericDeviceType::Keyboard)
- {
- kdDebug() << "keyboard updated: " << dev->friendlyName() << endl;
- applySettings();
+ TQTimer::singleShot(500, this, TQ_SLOT(applySettings()));
}
}
diff --git a/kxkb/kxkb.h b/kxkb/kxkb.h
index 5708efd48..fe07f049e 100644
--- a/kxkb/kxkb.h
+++ b/kxkb/kxkb.h
@@ -79,9 +79,7 @@ protected slots:
void showLayoutNotification();
void showErrorNotification(TQString layout);
- void hardwareAdded(TDEGenericDevice *dev);
- void hardwareRemoved(TDEGenericDevice *dev);
- void hardwareUpdated(TDEGenericDevice *dev);
+ void hardwareChanged(TDEGenericDevice *dev);
void applySettings();