OpenCoverage

qdbusmenuadaptor.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/platformsupport/dbusmenu/qdbusmenuadaptor.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 dbusmenu ../../3rdparty/dbus-ifaces/dbus-menu.xml-
44-
45 However it is maintained manually.-
46*/-
47-
48#include "qdbusmenuadaptor_p.h"-
49#include "qdbusplatformmenu_p.h"-
50#include <QtCore/QMetaObject>-
51#include <QtCore/QByteArray>-
52#include <QtCore/QList>-
53#include <QtCore/QMap>-
54#include <QtCore/QString>-
55#include <QtCore/QStringList>-
56#include <QtCore/QVariant>-
57-
58QT_BEGIN_NAMESPACE-
59-
60QDBusMenuAdaptor::QDBusMenuAdaptor(QDBusPlatformMenu *topLevelMenu)-
61 : QDBusAbstractAdaptor(topLevelMenu)-
62 , m_topLevelMenu(topLevelMenu)-
63{-
64 setAutoRelaySignals(true);-
65}
never executed: end of block
0
66-
67QDBusMenuAdaptor::~QDBusMenuAdaptor()-
68{-
69}-
70-
71QString QDBusMenuAdaptor::status() const-
72{-
73 qCDebug(qLcMenu);
never executed: QMessageLogger(__FILE__, 73, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug();
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
74 return QLatin1String("normal");
never executed: return QLatin1String("normal");
0
75}-
76-
77QString QDBusMenuAdaptor::textDirection() const-
78{-
79 return QLocale().textDirection() == Qt::RightToLeft ? QLatin1String("rtl") : QLatin1String("ltr");
never executed: return QLocale().textDirection() == Qt::RightToLeft ? QLatin1String("rtl") : QLatin1String("ltr");
0
80}-
81-
82uint QDBusMenuAdaptor::version() const-
83{-
84 return 4;
never executed: return 4;
0
85}-
86-
87bool QDBusMenuAdaptor::AboutToShow(int id)-
88{-
89 qCDebug(qLcMenu) << id;
never executed: QMessageLogger(__FILE__, 89, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << id;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
90 if (id == 0) {
id == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
91 emit m_topLevelMenu->aboutToShow();-
92 } else {
never executed: end of block
0
93 QDBusPlatformMenuItem *item = QDBusPlatformMenuItem::byId(id);-
94 if (item) {
itemDescription
TRUEnever evaluated
FALSEnever evaluated
0
95 const QDBusPlatformMenu *menu = static_cast<const QDBusPlatformMenu *>(item->menu());-
96 if (menu)
menuDescription
TRUEnever evaluated
FALSEnever evaluated
0
97 emit const_cast<QDBusPlatformMenu *>(menu)->aboutToShow();
never executed: const_cast<QDBusPlatformMenu *>(menu)->aboutToShow();
0
98 }
never executed: end of block
0
99 }
never executed: end of block
0
100 return false; // updateNeeded (we don't know that, so false)
never executed: return false;
0
101}-
102-
103QList<int> QDBusMenuAdaptor::AboutToShowGroup(const QList<int> &ids, QList<int> &idErrors)-
104{-
105 qCDebug(qLcMenu) << ids;
never executed: QMessageLogger(__FILE__, 105, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << ids;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
106 Q_UNUSED(idErrors)-
107 idErrors.clear();-
108 Q_FOREACH (int id, ids)-
109 AboutToShow(id);
never executed: AboutToShow(id);
0
110 return QList<int>(); // updatesNeeded
never executed: return QList<int>();
0
111}-
112-
113void QDBusMenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp)-
114{-
115 Q_UNUSED(data)-
116 Q_UNUSED(timestamp)-
117 QDBusPlatformMenuItem *item = QDBusPlatformMenuItem::byId(id);-
118 qCDebug(qLcMenu) << id << (item ? item->text() : QLatin1String("")) << eventId;
never executed: QMessageLogger(__FILE__, 118, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << id << (item ? item->text() : QLatin1String("")) << eventId;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
119 if (item && eventId == QLatin1String("clicked"))
itemDescription
TRUEnever evaluated
FALSEnever evaluated
eventId == QLa...ing("clicked")Description
TRUEnever evaluated
FALSEnever evaluated
0
120 item->trigger();
never executed: item->trigger();
0
121 if (item && eventId == QLatin1String("hovered"))
itemDescription
TRUEnever evaluated
FALSEnever evaluated
eventId == QLa...ing("hovered")Description
TRUEnever evaluated
FALSEnever evaluated
0
122 emit item->hovered();
never executed: item->hovered();
0
123 if (eventId == QLatin1String("closed")) {
eventId == QLa...ring("closed")Description
TRUEnever evaluated
FALSEnever evaluated
0
124 // There is no explicit AboutToHide method, so map closed event to aboutToHide method-
125 const QDBusPlatformMenu *menu = Q_NULLPTR;-
126 if (item)
itemDescription
TRUEnever evaluated
FALSEnever evaluated
0
127 menu = static_cast<const QDBusPlatformMenu *>(item->menu());
never executed: menu = static_cast<const QDBusPlatformMenu *>(item->menu());
0
128 else if (id == 0)
id == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
129 menu = m_topLevelMenu;
never executed: menu = m_topLevelMenu;
0
130 if (menu)
menuDescription
TRUEnever evaluated
FALSEnever evaluated
0
131 emit const_cast<QDBusPlatformMenu *>(menu)->aboutToHide();
never executed: const_cast<QDBusPlatformMenu *>(menu)->aboutToHide();
0
132 }
never executed: end of block
0
133}
never executed: end of block
0
134-
135QList<int> QDBusMenuAdaptor::EventGroup(const QDBusMenuEventList &events)-
136{-
137 Q_FOREACH (const QDBusMenuEvent &ev, events)-
138 Event(ev.m_id, ev.m_eventId, ev.m_data, ev.m_timestamp);
never executed: Event(ev.m_id, ev.m_eventId, ev.m_data, ev.m_timestamp);
0
139 return QList<int>(); // idErrors
never executed: return QList<int>();
0
140}-
141-
142QDBusMenuItemList QDBusMenuAdaptor::GetGroupProperties(const QList<int> &ids, const QStringList &propertyNames)-
143{-
144 qCDebug(qLcMenu) << ids << propertyNames << "=>" << QDBusMenuItem::items(ids, propertyNames);
never executed: QMessageLogger(__FILE__, 144, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << ids << propertyNames << "=>" << QDBusMenuItem::items(ids, propertyNames);
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
145 return QDBusMenuItem::items(ids, propertyNames);
never executed: return QDBusMenuItem::items(ids, propertyNames);
0
146}-
147-
148uint QDBusMenuAdaptor::GetLayout(int parentId, int recursionDepth, const QStringList &propertyNames, QDBusMenuLayoutItem &layout)-
149{-
150 uint ret = layout.populate(parentId, recursionDepth, propertyNames, m_topLevelMenu);-
151 qCDebug(qLcMenu) << parentId << "depth" << recursionDepth << propertyNames << layout.m_id << layout.m_properties << "revision" << ret << layout;
never executed: QMessageLogger(__FILE__, 151, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << parentId << "depth" << recursionDepth << propertyNames << layout.m_id << layout.m_properties << "revision" << ret << layout;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
152 return ret;
never executed: return ret;
0
153}-
154-
155QDBusVariant QDBusMenuAdaptor::GetProperty(int id, const QString &name)-
156{-
157 qCDebug(qLcMenu) << id << name;
never executed: QMessageLogger(__FILE__, 157, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << id << name;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
158 // handle method call com.canonical.dbusmenu.GetProperty-
159 QDBusVariant value;-
160 return value;
never executed: return value;
0
161}-
162-
163QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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