summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2015-03-30 15:28:26 +0200
committerShawn Rutledge <shawn.rutledge@digia.com>2015-03-31 06:14:53 +0000
commitbe242ed09479616c0f47aa76cc6329cfc5d52b37 (patch)
tree82cf2d192d76c4e2eb49412e224243342a08ad2b /src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
parent0e55d8dfad40adfc1e2d9c6246b1f680ef4f2285 (diff)
D-Bus system tray: emit activated on middle and right click
The ActivationReason provides the type of click. If the icon has a D-Bus menu, then QStatusNotifierItemAdaptor::ContextMenu will not be called: the tray is responsible for opening the context menu. But an application can alternatively do something different with a right-click by not providing a menu, and instead handling the QSystemTrayIcon::activated signal with the Context reason. Simplified the code by emitting the signal directly in QStatusNotifierItemAdaptor. Task-number: QTBUG-44929 Change-Id: Ia062a9a2fd99554418d58a1ff6ecd4e862035198 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp')
-rw-r--r--src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp b/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
index 540e2f011d..36212e9b61 100644
--- a/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
+++ b/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
@@ -50,6 +50,7 @@
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcMenu)
+Q_DECLARE_LOGGING_CATEGORY(qLcTray)
QStatusNotifierItemAdaptor::QStatusNotifierItemAdaptor(QDBusTrayIcon *parent)
: QDBusAbstractAdaptor(parent), m_trayIcon(parent)
@@ -151,22 +152,26 @@ QXdgDBusToolTipStruct QStatusNotifierItemAdaptor::toolTip() const
void QStatusNotifierItemAdaptor::Activate(int x, int y)
{
- m_trayIcon->activate(x, y);
+ qCDebug(qLcTray) << x << y;
+ emit m_trayIcon->activated(QPlatformSystemTrayIcon::Trigger);
}
void QStatusNotifierItemAdaptor::ContextMenu(int x, int y)
{
- m_trayIcon->contextMenu(x, y);
+ qCDebug(qLcTray) << x << y;
+ emit m_trayIcon->activated(QPlatformSystemTrayIcon::Context);
}
-void QStatusNotifierItemAdaptor::Scroll(int, const QString &)
+void QStatusNotifierItemAdaptor::Scroll(int w, const QString &s)
{
+ qCDebug(qLcTray) << w << s;
// unsupported
}
-void QStatusNotifierItemAdaptor::SecondaryActivate(int, int)
+void QStatusNotifierItemAdaptor::SecondaryActivate(int x, int y)
{
- // unsupported
+ qCDebug(qLcTray) << x << y;
+ emit m_trayIcon->activated(QPlatformSystemTrayIcon::MiddleClick);
}
QT_END_NAMESPACE