summaryrefslogtreecommitdiffstats
path: root/kcontrol/input/mouse.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2013-11-21 01:24:32 +0100
committerSlávek Banko <slavek.banko@axis.cz>2013-11-21 01:24:32 +0100
commitc4083c1d476f6dfd575599ffce4434e534251fd2 (patch)
treed4b1d6a3fc854da48e24e11d3dc69c0b0e971a60 /kcontrol/input/mouse.cpp
parent7d6186b592682b2a14c39b40a071f77d29fc8c7a (diff)
downloadtdebase-c4083c1d476f6dfd575599ffce4434e534251fd2.tar.gz
tdebase-c4083c1d476f6dfd575599ffce4434e534251fd2.zip
Add GUI control to test kcontrol mouse double-click setting
This resolves Bug 1324
Diffstat (limited to 'kcontrol/input/mouse.cpp')
-rw-r--r--kcontrol/input/mouse.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/kcontrol/input/mouse.cpp b/kcontrol/input/mouse.cpp
index 8957c6f87..4ec79c24c 100644
--- a/kcontrol/input/mouse.cpp
+++ b/kcontrol/input/mouse.cpp
@@ -256,6 +256,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name)
" The goal is to select a comfortable interval that you find"
" is not too fast or slow.");
TQWhatsThis::add( doubleClickLabel, wtstr );
+ doubleClickStatus = false; // First image will be displayed
doubleClickButton = new TQPushButton( tab2 );
doubleClickButton->setAcceptDrops( false );
// The images are 32x32.
@@ -266,6 +267,9 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name)
lay->addWidget(doubleClickButton);
// Use the same What's This help for the pushbutton.
TQWhatsThis::add( doubleClickButton, wtstr );
+ connect(doubleClickButton, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotDoubleClickButtonPressed()));
+ doubleClickTimer=new TQTimer();
+ connect(doubleClickTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotDoubleClickTimerDone()) );
lay->addSpacing(10);
@@ -641,6 +645,31 @@ void MouseConfig::slotClick()
}
+void MouseConfig::slotDoubleClickButtonPressed()
+{
+ if (!doubleClickTimer->isActive())
+ {
+ // First click or click after the timer has expired -> start the timer
+ doubleClickTimer->start(doubleClickInterval->value(), true);
+ }
+ else
+ {
+ // Double click event: stop the timer and change the picture
+ doubleClickTimer->stop();
+ if (!doubleClickStatus)
+ doubleClickButton->setPixmap(locate("data", "kcminput/pics/doubleclick_2.png"));
+ else
+ doubleClickButton->setPixmap(locate("data", "kcminput/pics/doubleclick_1.png"));
+ doubleClickStatus= !doubleClickStatus;
+ }
+}
+
+void MouseConfig::slotDoubleClickTimerDone()
+{
+ // Stop the timer, even though not strictly needed since it is a single shot timer
+ doubleClickTimer->stop();
+}
+
/** No descriptions */
void MouseConfig::slotHandedChanged(int val){
if(val==RIGHT_HANDED)