| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
| 25 | ** | - | ||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
| 29 | ** | - | ||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||
| 31 | ** | - | ||||||
| 32 | ****************************************************************************/ | - | ||||||
| 33 | - | |||||||
| 34 | /* | - | ||||||
| 35 | This file was originally created by qdbusxml2cpp version 0.8 | - | ||||||
| 36 | Command line was: | - | ||||||
| 37 | qdbusxml2cpp -a statusnotifieritem ../../3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml | - | ||||||
| 38 | - | |||||||
| 39 | However it is maintained manually, because this adapter needs to do | - | ||||||
| 40 | significant interface adaptation, and can do it more efficiently using the | - | ||||||
| 41 | QDBusTrayIcon API directly rather than via QObject::property() and | - | ||||||
| 42 | QMetaObject::invokeMethod(). | - | ||||||
| 43 | */ | - | ||||||
| 44 | - | |||||||
| 45 | #ifndef QT_NO_SYSTEMTRAYICON | - | ||||||
| 46 | - | |||||||
| 47 | #include "qstatusnotifieritemadaptor_p.h" | - | ||||||
| 48 | #include "qdbustrayicon_p.h" | - | ||||||
| 49 | - | |||||||
| 50 | QT_BEGIN_NAMESPACE | - | ||||||
| 51 | - | |||||||
| 52 | Q_DECLARE_LOGGING_CATEGORY(qLcMenu) | - | ||||||
| 53 | Q_DECLARE_LOGGING_CATEGORY(qLcTray) | - | ||||||
| 54 | - | |||||||
| 55 | QStatusNotifierItemAdaptor::QStatusNotifierItemAdaptor(QDBusTrayIcon *parent) | - | ||||||
| 56 | : QDBusAbstractAdaptor(parent), m_trayIcon(parent) | - | ||||||
| 57 | { | - | ||||||
| 58 | setAutoRelaySignals(true); | - | ||||||
| 59 | } never executed: end of block | 0 | ||||||
| 60 | - | |||||||
| 61 | QStatusNotifierItemAdaptor::~QStatusNotifierItemAdaptor() | - | ||||||
| 62 | { | - | ||||||
| 63 | } | - | ||||||
| 64 | - | |||||||
| 65 | QString QStatusNotifierItemAdaptor::attentionIconName() const | - | ||||||
| 66 | { | - | ||||||
| 67 | return m_trayIcon->attentionIconName(); never executed: return m_trayIcon->attentionIconName(); | 0 | ||||||
| 68 | } | - | ||||||
| 69 | - | |||||||
| 70 | QXdgDBusImageVector QStatusNotifierItemAdaptor::attentionIconPixmap() const | - | ||||||
| 71 | { | - | ||||||
| 72 | return iconToQXdgDBusImageVector(m_trayIcon->attentionIcon()); never executed: return iconToQXdgDBusImageVector(m_trayIcon->attentionIcon()); | 0 | ||||||
| 73 | } | - | ||||||
| 74 | - | |||||||
| 75 | QString QStatusNotifierItemAdaptor::attentionMovieName() const | - | ||||||
| 76 | { | - | ||||||
| 77 | return QString(); never executed: return QString(); | 0 | ||||||
| 78 | } | - | ||||||
| 79 | - | |||||||
| 80 | QString QStatusNotifierItemAdaptor::category() const | - | ||||||
| 81 | { | - | ||||||
| 82 | return m_trayIcon->category(); never executed: return m_trayIcon->category(); | 0 | ||||||
| 83 | } | - | ||||||
| 84 | - | |||||||
| 85 | QString QStatusNotifierItemAdaptor::iconName() const | - | ||||||
| 86 | { | - | ||||||
| 87 | return m_trayIcon->iconName(); never executed: return m_trayIcon->iconName(); | 0 | ||||||
| 88 | } | - | ||||||
| 89 | - | |||||||
| 90 | QXdgDBusImageVector QStatusNotifierItemAdaptor::iconPixmap() const | - | ||||||
| 91 | { | - | ||||||
| 92 | return iconToQXdgDBusImageVector(m_trayIcon->icon()); never executed: return iconToQXdgDBusImageVector(m_trayIcon->icon()); | 0 | ||||||
| 93 | } | - | ||||||
| 94 | - | |||||||
| 95 | QString QStatusNotifierItemAdaptor::id() const | - | ||||||
| 96 | { | - | ||||||
| 97 | // from the API docs: "a name that should be unique for this application and | - | ||||||
| 98 | // consistent between sessions, such as the application name itself" | - | ||||||
| 99 | return QCoreApplication::applicationName(); never executed: return QCoreApplication::applicationName(); | 0 | ||||||
| 100 | } | - | ||||||
| 101 | - | |||||||
| 102 | bool QStatusNotifierItemAdaptor::itemIsMenu() const | - | ||||||
| 103 | { | - | ||||||
| 104 | // From KDE docs: if this is true, the item only supports the context menu, | - | ||||||
| 105 | // so the visualization should prefer sending ContextMenu() instead of Activate(). | - | ||||||
| 106 | // But QSystemTrayIcon doesn't have such a setting: it will emit activated() | - | ||||||
| 107 | // and the application is free to use it or ignore it; we don't know whether it will. | - | ||||||
| 108 | return false; never executed: return false; | 0 | ||||||
| 109 | } | - | ||||||
| 110 | - | |||||||
| 111 | QDBusObjectPath QStatusNotifierItemAdaptor::menu() const | - | ||||||
| 112 | { | - | ||||||
| 113 | return QDBusObjectPath(m_trayIcon->menu() ? "/MenuBar" : "/NO_DBUSMENU"); never executed: return QDBusObjectPath(m_trayIcon->menu() ? "/MenuBar" : "/NO_DBUSMENU"); | 0 | ||||||
| 114 | } | - | ||||||
| 115 | - | |||||||
| 116 | QString QStatusNotifierItemAdaptor::overlayIconName() const | - | ||||||
| 117 | { | - | ||||||
| 118 | return QString(); never executed: return QString(); | 0 | ||||||
| 119 | } | - | ||||||
| 120 | - | |||||||
| 121 | QXdgDBusImageVector QStatusNotifierItemAdaptor::overlayIconPixmap() const | - | ||||||
| 122 | { | - | ||||||
| 123 | QXdgDBusImageVector ret; // empty vector | - | ||||||
| 124 | return ret; never executed: return ret; | 0 | ||||||
| 125 | } | - | ||||||
| 126 | - | |||||||
| 127 | QString QStatusNotifierItemAdaptor::status() const | - | ||||||
| 128 | { | - | ||||||
| 129 | return m_trayIcon->status(); never executed: return m_trayIcon->status(); | 0 | ||||||
| 130 | } | - | ||||||
| 131 | - | |||||||
| 132 | QString QStatusNotifierItemAdaptor::title() const | - | ||||||
| 133 | { | - | ||||||
| 134 | // Shown e.g. when the icon is hidden, in the popup showing all hidden items. | - | ||||||
| 135 | // Since QSystemTrayIcon doesn't have this property, the application name | - | ||||||
| 136 | // is the best information we have available. | - | ||||||
| 137 | return QCoreApplication::applicationName(); never executed: return QCoreApplication::applicationName(); | 0 | ||||||
| 138 | } | - | ||||||
| 139 | - | |||||||
| 140 | QXdgDBusToolTipStruct QStatusNotifierItemAdaptor::toolTip() const | - | ||||||
| 141 | { | - | ||||||
| 142 | QXdgDBusToolTipStruct ret; | - | ||||||
| 143 | if (m_trayIcon->isRequestingAttention()) {
| 0 | ||||||
| 144 | ret.title = m_trayIcon->attentionTitle(); | - | ||||||
| 145 | ret.subTitle = m_trayIcon->attentionMessage(); | - | ||||||
| 146 | ret.icon = m_trayIcon->attentionIconName(); | - | ||||||
| 147 | } else { never executed: end of block | 0 | ||||||
| 148 | ret.title = m_trayIcon->tooltip(); | - | ||||||
| 149 | } never executed: end of block | 0 | ||||||
| 150 | return ret; never executed: return ret; | 0 | ||||||
| 151 | } | - | ||||||
| 152 | - | |||||||
| 153 | void QStatusNotifierItemAdaptor::Activate(int x, int y) | - | ||||||
| 154 | { | - | ||||||
| 155 | qCDebug(qLcTray) << x << y; never executed: QMessageLogger(__FILE__, 155, __PRETTY_FUNCTION__, qLcTray().categoryName()).debug() << x << y;
| 0 | ||||||
| 156 | emit m_trayIcon->activated(QPlatformSystemTrayIcon::Trigger); | - | ||||||
| 157 | } never executed: end of block | 0 | ||||||
| 158 | - | |||||||
| 159 | void QStatusNotifierItemAdaptor::ContextMenu(int x, int y) | - | ||||||
| 160 | { | - | ||||||
| 161 | qCDebug(qLcTray) << x << y; never executed: QMessageLogger(__FILE__, 161, __PRETTY_FUNCTION__, qLcTray().categoryName()).debug() << x << y;
| 0 | ||||||
| 162 | emit m_trayIcon->activated(QPlatformSystemTrayIcon::Context); | - | ||||||
| 163 | } never executed: end of block | 0 | ||||||
| 164 | - | |||||||
| 165 | void QStatusNotifierItemAdaptor::Scroll(int w, const QString &s) | - | ||||||
| 166 | { | - | ||||||
| 167 | qCDebug(qLcTray) << w << s; never executed: QMessageLogger(__FILE__, 167, __PRETTY_FUNCTION__, qLcTray().categoryName()).debug() << w << s;
| 0 | ||||||
| 168 | // unsupported | - | ||||||
| 169 | } never executed: end of block | 0 | ||||||
| 170 | - | |||||||
| 171 | void QStatusNotifierItemAdaptor::SecondaryActivate(int x, int y) | - | ||||||
| 172 | { | - | ||||||
| 173 | qCDebug(qLcTray) << x << y; never executed: QMessageLogger(__FILE__, 173, __PRETTY_FUNCTION__, qLcTray().categoryName()).debug() << x << y;
| 0 | ||||||
| 174 | emit m_trayIcon->activated(QPlatformSystemTrayIcon::MiddleClick); | - | ||||||
| 175 | } never executed: end of block | 0 | ||||||
| 176 | - | |||||||
| 177 | QT_END_NAMESPACE | - | ||||||
| 178 | - | |||||||
| 179 | #endif // QT_NO_SYSTEMTRAYICON | - | ||||||
| Source code | Switch to Preprocessed file |