[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/klipper
From:       Esben Mose Hansen <kde () mosehansen ! dk>
Date:       2005-02-06 22:20:22
Message-ID: 20050206222022.1391B1D018 () office ! kde ! org
[Download RAW message or body]

CVS commit by esben: 

Ignore Quit-selection if within 0.3s of opening menu, to avoid accidental closing of \
menu due to a mishandled click. Fix regression: It should now be possible to close \
the menu by pressing the Klipper icon


  M +22 -5     toplevel.cpp   1.171
  M +4 -2      toplevel.h   1.60


--- kdebase/klipper/toplevel.cpp  #1.170:1.171
@@ -160,5 +160,6 @@ KlipperWidget::KlipperWidget( QWidget *p
     setURLGrabberEnabled( bURLGrabber );
 
-    menuTimer = new QTime();
+    hideTimer = new QTime();
+    showTimer = new QTime();
 
     readProperties(m_config);
@@ -188,4 +189,7 @@ KlipperWidget::KlipperWidget( QWidget *p
     KlipperPopup* popup = history()->popup();
     connect ( history(),  SIGNAL( topChanged() ), SLOT( slotHistoryTopChanged() ) );
+    connect( popup, SIGNAL( aboutToHide() ), SLOT( slotStartHideTimer() ) );
+    connect( popup, SIGNAL( aboutToShow() ), SLOT( slotStartShowTimer() ) );
+
     popup->plugAction( toggleURLGrabAction );
     popup->plugAction( clearHistoryAction );
@@ -200,5 +204,6 @@ KlipperWidget::KlipperWidget( QWidget *p
 KlipperWidget::~KlipperWidget()
 {
-    delete menuTimer;
+    delete showTimer;
+    delete hideTimer;
     delete myURLGrabber;
     if( m_config != kapp->config())
@@ -253,5 +258,5 @@ void KlipperWidget::mousePressEvent(QMou
     // it's probably because the user clicked on the klipper icon
     // to hide it, and therefore won't want it shown again.
-    if ( menuTimer->elapsed() > 300 ) {
+    if ( hideTimer->elapsed() > 300 ) {
         slotPopupMenu();
     }
@@ -269,7 +274,12 @@ void KlipperWidget::paintEvent(QPaintEve
 }
 
-void KlipperWidget::slotAboutToHideMenu()
+void KlipperWidget::slotStartHideTimer()
 {
-    menuTimer->start();
+    hideTimer->start();
+}
+
+void KlipperWidget::slotStartShowTimer()
+{
+    showTimer->start();
 }
 
@@ -513,4 +523,11 @@ void KlipperWidget::slotConfigure()
 void KlipperWidget::slotQuit()
 {
+    // If the menu was just opened, likely the user
+    // selected quit by accident while attempting to
+    // click the Klipper icon.
+    if ( showTimer->elapsed() < 300 ) {
+        return;
+    }
+
     saveSession();
     int autoStart = KMessageBox::questionYesNoCancel( 0L, i18n("Should Klipper start \
automatically\nwhen you login?"), i18n("Automatically Start Klipper?") );

--- kdebase/klipper/toplevel.h  #1.59:1.60
@@ -150,5 +150,6 @@ private slots:
 
     void slotQuit();
-    void slotAboutToHideMenu();
+    void slotStartHideTimer();
+    void slotStartShowTimer();
 
     void slotClearOverflow();
@@ -159,5 +160,6 @@ private:
     QClipboard *clip;
 
-    QTime *menuTimer;
+    QTime *hideTimer;
+    QTime *showTimer;
 
     QMimeSource* m_lastClipdata;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic