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