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

List:       kde-commits
Subject:    kdebase/klipper
From:       James Ots <kde () jamesots ! com>
Date:       2004-06-18 22:13:06
Message-ID: 20040618221306.8809F9970 () office ! kde ! org
[Download RAW message or body]

CVS commit by jamesots: 

If the klipper menu is showing, make it disappear when you click on its icon.


  M +15 -3     toplevel.cpp   1.154
  M +5 -0      toplevel.h   1.52


--- kdebase/klipper/toplevel.cpp  #1.153:1.154
@@ -14,4 +14,5 @@
 #include <qclipboard.h>
 #include <qcursor.h>
+#include <qdatetime.h>
 #include <qfile.h>
 #include <qintdict.h>
@@ -86,7 +87,10 @@ KlipperWidget::KlipperWidget( QWidget *p
     setURLGrabberEnabled( bURLGrabber );
 
+    menuTimer = new QTime();
+
     m_lastString = "";
     m_popup = new KPopupMenu(0L, "main_menu");
     connect(m_popup, SIGNAL(activated(int)), SLOT(clickedMenu(int)));
+    connect(m_popup, SIGNAL(aboutToHide()), SLOT(slotAboutToHideMenu()));
 
     readProperties(m_config);
@@ -166,4 +170,8 @@ void KlipperWidget::mousePressEvent(QMou
         return;
 
+    // if we only hid the menu less than a third of a second ago,
+    // 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 )
     showPopupMenu( m_popup );
 }
@@ -249,4 +257,8 @@ void KlipperWidget::clickedMenu(int id)
 }
 
+void KlipperWidget::slotAboutToHideMenu()
+{
+    menuTimer->start();
+}
 
 void KlipperWidget::showPopupMenu( QPopupMenu *menu )
@@ -262,6 +274,6 @@ void KlipperWidget::showPopupMenu( QPopu
             menu->popup(QPoint(g.x(), g.y()));
     } else {
-        KWin::Info i = KWin::info( winId() );
-        QRect g = i.geometry;
+        KWin::WindowInfo i = KWin::windowInfo( winId(), NET::WMGeometry );
+        QRect g = i.geometry();
         QRect screen = KGlobalSettings::desktopGeometry(g.center());
 

--- kdebase/klipper/toplevel.h  #1.51:1.52
@@ -27,4 +27,5 @@ class KAboutData;
 class URLGrabber;
 class ClipboardPoll;
+class QTime;
 
 class KlipperWidget : public QWidget, public DCOPObject
@@ -107,4 +108,6 @@ private slots:
     }
 
+    void slotAboutToHideMenu();
+
 
 private:
@@ -113,4 +116,6 @@ private:
     QClipboard *clip;
 
+    QTime *menuTimer;
+
     QString m_lastString;
     QString m_lastClipboard, m_lastSelection;


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

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