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

List:       kde-commits
Subject:    qt-copy
From:       Simon Hausmann <hausmann () kde ! org>
Date:       2006-07-14 9:03:06
Message-ID: 1152867786.297429.18672.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 562185 by hausmann:

- support for middle click as activation reason, as requested by
  Aaron/kde-core-devel. Done with Girish.


 M  +7 -4      examples/desktop/systray/mainwindow.cpp  
 M  +1 -1      examples/desktop/systray/mainwindow.h  
 M  +5 -1      src/gui/util/qsystemtrayicon.cpp  
 M  +3 -2      src/gui/util/qsystemtrayicon.h  
 M  +2 -0      src/gui/util/qsystemtrayicon_x11.cpp  


--- trunk/qt-copy/examples/desktop/systray/mainwindow.cpp #562184:562185
@@ -44,8 +44,8 @@
     trayIcon = new QSystemTrayIcon(this);
     trayIcon->setToolTip("System trayIcon example");
     trayIcon->setContextMenu(menu);
-    QObject::connect(trayIcon, SIGNAL(activated(int)),
-                     this, SLOT(activated(int)));
+    QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+                     this, SLOT(activated(QSystemTrayIcon::ActivationReason)));
     QObject::connect(trayIcon, SIGNAL(messageClicked()), 
                      this, SLOT(balloonClicked()));
     changeIcon(0); // set the first icon
@@ -81,7 +81,7 @@
     icons << "16x16 icon" << "22x22 icon" << "32x32 icon";
     iconPicker->addItems(icons);
     QObject::connect(iconPicker, SIGNAL(activated(int)),
-		     this, SLOT(changeIcon(int)));
+                     this, SLOT(changeIcon(int)));
 
     QGridLayout *layout = new QGridLayout;
     layout->addWidget(titleLabel, 0, 0); layout->addWidget(titleEdit, 0, 1);
@@ -120,7 +120,7 @@
     info->append(tr("Balloon message was clicked"));
 }
 
-void MainWindow::activated(int reason)
+void MainWindow::activated(QSystemTrayIcon::ActivationReason reason)
 {
     QString r;
     switch (reason) {
@@ -136,6 +136,9 @@
         case QSystemTrayIcon::Trigger:
             r = tr("Trigger");
             break;
+        case QSystemTrayIcon::MiddleClick:
+            r = tr("MiddleClick");
+            break;
     }
     info->append(QString("Activated - Reason %1").arg(r));
 }
--- trunk/qt-copy/examples/desktop/systray/mainwindow.h #562184:562185
@@ -39,7 +39,7 @@
     void toggleVisibility();
     void showMessage();
     void balloonClicked();
-    void activated(int);
+    void activated(QSystemTrayIcon::ActivationReason);
     void changeIcon(int);
 
 private:
--- trunk/qt-copy/src/gui/util/qsystemtrayicon.cpp #562184:562185
@@ -250,6 +250,7 @@
      \value Context     The context menu for the system tray entry was requested
      \value DoubleClick The system tray entry was double clicked
      \value Trigger     The system tray entray was clicked
+     \value MiddleClick The system tray entray was clicked with the middle mouse button
 
      \sa activated()
 */
@@ -525,6 +526,9 @@
     return QWidget::eventFilter(o, e);
 }
 
-void qtsystray_sendActivated(QSystemTrayIcon *i, int r) { emit i->activated(r); }
+void qtsystray_sendActivated(QSystemTrayIcon *i, int r) 
+{ 
+    emit i->activated((QSystemTrayIcon::ActivationReason)r);
+}
 
 #endif // QT_NO_SYSTEMTRAYICON
--- trunk/qt-copy/src/gui/util/qsystemtrayicon.h #562184:562185
@@ -58,7 +58,8 @@
         Unknown,
         Context,
         DoubleClick,
-        Trigger
+        Trigger,
+        MiddleClick
     };
 
     void setContextMenu(QMenu *menu);
@@ -84,7 +85,7 @@
     inline void hide() { setVisible(false); }
 
 Q_SIGNALS:
-    void activated(int reason);
+    void activated(QSystemTrayIcon::ActivationReason reason);
     void messageClicked();
 
 protected:
--- trunk/qt-copy/src/gui/util/qsystemtrayicon_x11.cpp #562184:562185
@@ -226,6 +226,8 @@
         emit q->activated(QSystemTrayIcon::Trigger);
     else if (ev->button() == Qt::RightButton)
         emit q->activated(QSystemTrayIcon::Context);
+    else if (ev->button() == Qt::MidButton)
+        emit q->activated(QSystemTrayIcon::MiddleClick);
 }
 
 void QSystemTrayIconSys::mouseDoubleClickEvent(QMouseEvent *ev)
[prev in list] [next in list] [prev in thread] [next in thread] 

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