Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qstatusnotifieritemadaptor.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4/*
5 This file was originally created by qdbusxml2cpp version 0.8
6 Command line was:
7 qdbusxml2cpp -a statusnotifieritem ../../3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml
8
9 However it is maintained manually, because this adapter needs to do
10 significant interface adaptation, and can do it more efficiently using the
11 QDBusTrayIcon API directly rather than via QObject::property() and
12 QMetaObject::invokeMethod().
13*/
14
16
17#ifndef QT_NO_SYSTEMTRAYICON
18
19#include <QtCore/QLoggingCategory>
20#include <QtCore/QCoreApplication>
21
22#include "qdbustrayicon_p.h"
23
25
28
29QStatusNotifierItemAdaptor::QStatusNotifierItemAdaptor(QDBusTrayIcon *parent)
30 : QDBusAbstractAdaptor(parent), m_trayIcon(parent)
31{
32 setAutoRelaySignals(true);
33}
34
38
43
48
53
55{
56 return m_trayIcon->category();
57}
58
60{
61 return m_trayIcon->iconName();
62}
63
68
70{
71 // from the API docs: "a name that should be unique for this application and
72 // consistent between sessions, such as the application name itself"
74}
75
77{
78 // From KDE docs: if this is true, the item only supports the context menu,
79 // so the visualization should prefer sending ContextMenu() instead of Activate().
80 // But QSystemTrayIcon doesn't have such a setting: it will emit activated()
81 // and the application is free to use it or ignore it; we don't know whether it will.
82 return false;
83}
84
86{
87 return QDBusObjectPath(m_trayIcon->menu() ? "/MenuBar" : "/NO_DBUSMENU");
88}
89
94
100
102{
103 return m_trayIcon->status();
104}
105
107{
108 // Shown e.g. when the icon is hidden, in the popup showing all hidden items.
109 // Since QSystemTrayIcon doesn't have this property, the application name
110 // is the best information we have available.
112}
113
115{
117 if (m_trayIcon->isRequestingAttention()) {
118 ret.title = m_trayIcon->attentionTitle();
119 ret.subTitle = m_trayIcon->attentionMessage();
120 ret.icon = m_trayIcon->attentionIconName();
121 } else {
122 ret.title = m_trayIcon->tooltip();
123 }
124 return ret;
125}
126
128{
129 qCDebug(qLcTray) << x << y;
131}
132
134{
135 qCDebug(qLcTray) << x << y;
137}
138
140{
141 qCDebug(qLcTray) << token;
142 qputenv("XDG_ACTIVATION_TOKEN", token.toUtf8());
143}
144
146{
147 qCDebug(qLcTray) << w << s;
148 // unsupported
149}
150
156
158
159#include "moc_qstatusnotifieritemadaptor_p.cpp"
160
161#endif // QT_NO_SYSTEMTRAYICON
QString applicationName
the name of this application
\inmodule QtDBus
QString attentionMessage
QDBusPlatformMenu * menu
QString attentionTitle
QString attentionIconName
void activated(QPlatformSystemTrayIcon::ActivationReason reason)
This signal is emitted when the user activates the system tray icon.
QXdgDBusImageVector attentionIconPixmap() const
QXdgDBusImageVector iconPixmap() const
QXdgDBusToolTipStruct toolTip() const
virtual Q_CLASSINFO("D-Bus Introspection", "" " <interface name=\"org.kde.StatusNotifierItem\">\n" " <property access=\"read\" type=\"s\" name=\"Category\"/>\n" " <property access=\"read\" type=\"s\" name=\"Id\"/>\n" " <property access=\"read\" type=\"s\" name=\"Title\"/>\n" " <property access=\"read\" type=\"s\" name=\"Status\"/>\n" " <property access=\"read\" type=\"i\" name=\"WindowId\"/>\n" " <property access=\"read\" type=\"s\" name=\"IconThemePath\"/>\n" " <property access=\"read\" type=\"o\" name=\"Menu\"/>\n" " <property access=\"read\" type=\"b\" name=\"ItemIsMenu\"/>\n" " <property access=\"read\" type=\"s\" name=\"IconName\"/>\n" " <property access=\"read\" type=\"a(iiay)\" name=\"IconPixmap\">\n" " <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n" " </property>\n" " <property access=\"read\" type=\"s\" name=\"OverlayIconName\"/>\n" " <property access=\"read\" type=\"a(iiay)\" name=\"OverlayIconPixmap\">\n" " <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n" " </property>\n" " <property access=\"read\" type=\"s\" name=\"AttentionIconName\"/>\n" " <property access=\"read\" type=\"a(iiay)\" name=\"AttentionIconPixmap\">\n" " <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n" " </property>\n" " <property access=\"read\" type=\"s\" name=\"AttentionMovieName\"/>\n" " <property access=\"read\" type=\"(sa(iiay)ss)\" name=\"ToolTip\">\n" " <annotation value=\"QXdgDBusToolTipStruct\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n" " </property>\n" " <method name=\"ProvideXdgActivationToken\">\n" " <arg name=\"token\" type=\"s\" direction=\"in\"/>\n" " </method>\n" " <method name=\"ContextMenu\">\n" " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" " </method>\n" " <method name=\"Activate\">\n" " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" " </method>\n" " <method name=\"SecondaryActivate\">\n" " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n" " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n" " </method>\n" " <method name=\"Scroll\">\n" " <arg direction=\"in\" type=\"i\" name=\"delta\"/>\n" " <arg direction=\"in\" type=\"s\" name=\"orientation\"/>\n" " </method>\n" " <signal name=\"NewTitle\"/>\n" " <signal name=\"NewIcon\"/>\n" " <signal name=\"NewAttentionIcon\"/>\n" " <signal name=\"NewOverlayIcon\"/>\n" " <signal name=\"NewMenu\"/>\n" " <signal name=\"NewToolTip\"/>\n" " <signal name=\"NewStatus\">\n" " <arg type=\"s\" name=\"status\"/>\n" " </signal>\n" " </interface>\n" "") public ~QStatusNotifierItemAdaptor()
QXdgDBusImageVector overlayIconPixmap() const
void ProvideXdgActivationToken(const QString &token)
void Scroll(int delta, const QString &orientation)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Token token
Definition keywords.cpp:444
Combined button and popup list for selecting options.
QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
return ret
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint y
GLdouble s
[6]
Definition qopenglext.h:235
bool qputenv(const char *varName, QByteArrayView raw)
#define emit