OpenCoverage

qstatusnotifieritemadaptor.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9