New Prosal [was Re: policy change related to kdelibs snapshots]

Simon Hausmann hausmann at kde.org
Fri Jul 14 09:25:10 BST 2006


On Thursday 13 July 2006 08:54, Aaron J. Seigo wrote:
[...]
> in any case, i'll talk to our trolltacts (play on "trolltech contacts" ..
> weee) about the possibility of a middle mouse button addition.

Aaron calls, little Trolls obey ;-). Here's the patch that will also be in 
tomorrow's snapshot. It also includes a little API change (for the better), 
so I'm not committing it straight to qt-copy but leave it to the systemtray 
porter(s).


Simon
-------------- next part --------------
--- //depot/qt/4.2/examples/desktop/systray/mainwindow.cpp	Fri Jul 14 10:13:36 CEST 2006
+++ //depot/qt/4.2/examples/desktop/systray/mainwindow.cpp	Fri Jul 14 10:13:36 CEST 2006

@@ -34,8 +34,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
@@ -67,7 +67,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);
@@ -105,7 +105,7 @@
     info->append(tr("Balloon message was clicked"));
 }
 
-void MainWindow::activated(int reason)
+void MainWindow::activated(QSystemTrayIcon::ActivationReason reason)
 {
     QString r;
     switch (reason) {
@@ -121,6 +121,9 @@
         case QSystemTrayIcon::Trigger:
             r = tr("Trigger");
             break;
+        case QSystemTrayIcon::MiddleClick:
+            r = tr("MiddleClick");
+            break;
     }
     info->append(QString("Activated - Reason %1").arg(r));
 }

--- //depot/qt/4.2/examples/desktop/systray/mainwindow.h	Fri Jul 14 10:13:36 CEST 2006
+++ //depot/qt/4.2/examples/desktop/systray/mainwindow.h	Fri Jul 14 10:13:36 CEST 2006

@@ -29,7 +29,7 @@
     void toggleVisibility();
     void showMessage();
     void balloonClicked();
-    void activated(int);
+    void activated(QSystemTrayIcon::ActivationReason);
     void changeIcon(int);
 
 private:

--- //depot/qt/4.2/src/gui/util/qsystemtrayicon.cpp	Fri Jul 14 10:13:36 CEST 2006
+++ //depot/qt/4.2/src/gui/util/qsystemtrayicon.cpp	Fri Jul 14 10:13:36 CEST 2006

@@ -243,6 +243,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()
 */
@@ -517,6 +518,9 @@
     QWidget::timerEvent(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

--- //depot/qt/4.2/src/gui/util/qsystemtrayicon.h	Fri Jul 14 10:13:36 CEST 2006
+++ //depot/qt/4.2/src/gui/util/qsystemtrayicon.h	Fri Jul 14 10:13:36 CEST 2006

@@ -48,7 +48,8 @@
         Unknown,
         Context,
         DoubleClick,
-        Trigger
+        Trigger,
+        MiddleClick
     };
 
 #ifndef QT_NO_MENU
@@ -76,7 +77,7 @@
     inline void hide() { setVisible(false); }
 
 Q_SIGNALS:
-    void activated(int reason);
+    void activated(QSystemTrayIcon::ActivationReason reason);
     void messageClicked();
 
 protected:
--- //depot/qt/4.2/src/gui/util/qsystemtrayicon_x11.cpp	Fri Jul 14 10:14:33 CEST 2006
+++ //depot/qt/4.2/src/gui/util/qsystemtrayicon_x11.cpp	Fri Jul 14 10:14:33 CEST 2006

@@ -216,6 +216,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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060714/215a8542/attachment.sig>


More information about the kde-core-devel mailing list