| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusinternalfilters.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 QtDBus 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 | #include "qdbusconnection_p.h" | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | #include "qdbus_symbols_p.h" | - | ||||||||||||
| 37 | #include <QtCore/qcoreapplication.h> | - | ||||||||||||
| 38 | #include <QtCore/qmetaobject.h> | - | ||||||||||||
| 39 | #include <QtCore/qstringlist.h> | - | ||||||||||||
| 40 | #include <QtCore/qthread.h> | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | #include "qdbusabstractadaptor.h" | - | ||||||||||||
| 43 | #include "qdbusabstractadaptor_p.h" | - | ||||||||||||
| 44 | #include "qdbusconnection.h" | - | ||||||||||||
| 45 | #include "qdbusextratypes.h" | - | ||||||||||||
| 46 | #include "qdbusmessage.h" | - | ||||||||||||
| 47 | #include "qdbusmetatype.h" | - | ||||||||||||
| 48 | #include "qdbusmetatype_p.h" | - | ||||||||||||
| 49 | #include "qdbusmessage_p.h" | - | ||||||||||||
| 50 | #include "qdbusutil_p.h" | - | ||||||||||||
| 51 | #include "qdbusvirtualobject.h" | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | #include <algorithm> | - | ||||||||||||
| 54 | - | |||||||||||||
| 55 | #ifndef QT_NO_DBUS | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | // defined in qdbusxmlgenerator.cpp | - | ||||||||||||
| 60 | extern QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, | - | ||||||||||||
| 61 | const QMetaObject *base, int flags); | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | static const char introspectableInterfaceXml[] = | - | ||||||||||||
| 64 | " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" | - | ||||||||||||
| 65 | " <method name=\"Introspect\">\n" | - | ||||||||||||
| 66 | " <arg name=\"xml_data\" type=\"s\" direction=\"out\"/>\n" | - | ||||||||||||
| 67 | " </method>\n" | - | ||||||||||||
| 68 | " </interface>\n"; | - | ||||||||||||
| 69 | - | |||||||||||||
| 70 | static const char propertiesInterfaceXml[] = | - | ||||||||||||
| 71 | " <interface name=\"org.freedesktop.DBus.Properties\">\n" | - | ||||||||||||
| 72 | " <method name=\"Get\">\n" | - | ||||||||||||
| 73 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - | ||||||||||||
| 74 | " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" | - | ||||||||||||
| 75 | " <arg name=\"value\" type=\"v\" direction=\"out\"/>\n" | - | ||||||||||||
| 76 | " </method>\n" | - | ||||||||||||
| 77 | " <method name=\"Set\">\n" | - | ||||||||||||
| 78 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - | ||||||||||||
| 79 | " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" | - | ||||||||||||
| 80 | " <arg name=\"value\" type=\"v\" direction=\"in\"/>\n" | - | ||||||||||||
| 81 | " </method>\n" | - | ||||||||||||
| 82 | " <method name=\"GetAll\">\n" | - | ||||||||||||
| 83 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - | ||||||||||||
| 84 | " <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n" | - | ||||||||||||
| 85 | " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n" | - | ||||||||||||
| 86 | " </method>\n" | - | ||||||||||||
| 87 | " <signal name=\"PropertiesChanged\">\n" | - | ||||||||||||
| 88 | " <arg name=\"interface_name\" type=\"s\" direction=\"out\"/>\n" | - | ||||||||||||
| 89 | " <arg name=\"changed_properties\" type=\"a{sv}\" direction=\"out\"/>\n" | - | ||||||||||||
| 90 | " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out1\" value=\"QVariantMap\"/>\n" | - | ||||||||||||
| 91 | " <arg name=\"invalidated_properties\" type=\"as\" direction=\"out\"/>\n" | - | ||||||||||||
| 92 | " </signal>\n" | - | ||||||||||||
| 93 | " </interface>\n"; | - | ||||||||||||
| 94 | - | |||||||||||||
| 95 | static const char peerInterfaceXml[] = | - | ||||||||||||
| 96 | " <interface name=\"org.freedesktop.DBus.Peer\">\n" | - | ||||||||||||
| 97 | " <method name=\"Ping\"/>\n" | - | ||||||||||||
| 98 | " <method name=\"GetMachineId\">\n" | - | ||||||||||||
| 99 | " <arg name=\"machine_uuid\" type=\"s\" direction=\"out\"/>\n" | - | ||||||||||||
| 100 | " </method>\n" | - | ||||||||||||
| 101 | " </interface>\n"; | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | static QString generateSubObjectXml(QObject *object) | - | ||||||||||||
| 104 | { | - | ||||||||||||
| 105 | QString retval; | - | ||||||||||||
| 106 | const QObjectList &objs = object->children(); | - | ||||||||||||
| 107 | QObjectList::ConstIterator it = objs.constBegin(); | - | ||||||||||||
| 108 | QObjectList::ConstIterator end = objs.constEnd(); | - | ||||||||||||
| 109 | for ( ; it != end; ++it) {
| 0 | ||||||||||||
| 110 | QString name = (*it)->objectName(); | - | ||||||||||||
| 111 | if (!name.isEmpty() && QDBusUtil::isValidPartOfObjectPath(name))
| 0 | ||||||||||||
| 112 | retval += QString::fromLatin1(" <node name=\"%1\"/>\n") never executed: retval += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(name); | 0 | ||||||||||||
| 113 | .arg(name); never executed: retval += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(name); | 0 | ||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||
| 115 | return retval; never executed: return retval; | 0 | ||||||||||||
| 116 | } | - | ||||||||||||
| 117 | - | |||||||||||||
| 118 | // declared as extern in qdbusconnection_p.h | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path) | - | ||||||||||||
| 121 | { | - | ||||||||||||
| 122 | // object may be null | - | ||||||||||||
| 123 | - | |||||||||||||
| 124 | QString xml_data(QLatin1String(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE)); | - | ||||||||||||
| 125 | xml_data += QLatin1String("<node>\n"); | - | ||||||||||||
| 126 | - | |||||||||||||
| 127 | if (node.obj) {
| 1-85 | ||||||||||||
| 128 | Q_ASSERT_X(QThread::currentThread() == node.obj->thread(), | - | ||||||||||||
| 129 | "QDBusConnection: internal threading error", | - | ||||||||||||
| 130 | "function called for an object that is in another thread!!"); | - | ||||||||||||
| 131 | - | |||||||||||||
| 132 | if (node.flags & (QDBusConnection::ExportScriptableContents
| 12-73 | ||||||||||||
| 133 | | QDBusConnection::ExportNonScriptableContents)) {
| 12-73 | ||||||||||||
| 134 | // create XML for the object itself | - | ||||||||||||
| 135 | const QMetaObject *mo = node.obj->metaObject(); | - | ||||||||||||
| 136 | for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass())
| 12 | ||||||||||||
| 137 | xml_data += qDBusGenerateMetaObjectXml(node.interfaceName, mo, mo->superClass(), executed 12 times by 7 tests: xml_data += qDBusGenerateMetaObjectXml(node.interfaceName, mo, mo->superClass(), node.flags);Executed by:
| 12 | ||||||||||||
| 138 | node.flags); executed 12 times by 7 tests: xml_data += qDBusGenerateMetaObjectXml(node.interfaceName, mo, mo->superClass(), node.flags);Executed by:
| 12 | ||||||||||||
| 139 | } executed 12 times by 7 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 140 | - | |||||||||||||
| 141 | // does this object have adaptors? | - | ||||||||||||
| 142 | QDBusAdaptorConnector *connector; | - | ||||||||||||
| 143 | if (node.flags & QDBusConnection::ExportAdaptors &&
| 10-75 | ||||||||||||
| 144 | (connector = qDBusFindAdaptorConnector(node.obj))) {
| 0-75 | ||||||||||||
| 145 | - | |||||||||||||
| 146 | // trasverse every adaptor in this object | - | ||||||||||||
| 147 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(); | - | ||||||||||||
| 148 | QDBusAdaptorConnector::AdaptorMap::ConstIterator end = connector->adaptors.constEnd(); | - | ||||||||||||
| 149 | for ( ; it != end; ++it) {
| 75-129 | ||||||||||||
| 150 | // add the interface: | - | ||||||||||||
| 151 | QString ifaceXml = QDBusAbstractAdaptorPrivate::retrieveIntrospectionXml(it->adaptor); | - | ||||||||||||
| 152 | if (ifaceXml.isEmpty()) {
| 40-89 | ||||||||||||
| 153 | // add the interface's contents: | - | ||||||||||||
| 154 | ifaceXml += qDBusGenerateMetaObjectXml(QString::fromLatin1(it->interface), | - | ||||||||||||
| 155 | it->adaptor->metaObject(), | - | ||||||||||||
| 156 | &QDBusAbstractAdaptor::staticMetaObject, | - | ||||||||||||
| 157 | QDBusConnection::ExportScriptableContents | - | ||||||||||||
| 158 | | QDBusConnection::ExportNonScriptableContents); | - | ||||||||||||
| 159 | - | |||||||||||||
| 160 | QDBusAbstractAdaptorPrivate::saveIntrospectionXml(it->adaptor, ifaceXml); | - | ||||||||||||
| 161 | } executed 89 times by 5 tests: end of blockExecuted by:
| 89 | ||||||||||||
| 162 | - | |||||||||||||
| 163 | xml_data += ifaceXml; | - | ||||||||||||
| 164 | } executed 129 times by 5 tests: end of blockExecuted by:
| 129 | ||||||||||||
| 165 | } executed 75 times by 6 tests: end of blockExecuted by:
| 75 | ||||||||||||
| 166 | - | |||||||||||||
| 167 | // is it a virtual node that handles introspection itself? | - | ||||||||||||
| 168 | if (node.flags & QDBusConnectionPrivate::VirtualObject) {
| 2-83 | ||||||||||||
| 169 | xml_data += node.treeNode->introspect(path); | - | ||||||||||||
| 170 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 171 | - | |||||||||||||
| 172 | xml_data += QLatin1String( propertiesInterfaceXml ); | - | ||||||||||||
| 173 | } executed 85 times by 11 tests: end of blockExecuted by:
| 85 | ||||||||||||
| 174 | - | |||||||||||||
| 175 | xml_data += QLatin1String( introspectableInterfaceXml ); | - | ||||||||||||
| 176 | xml_data += QLatin1String( peerInterfaceXml ); | - | ||||||||||||
| 177 | - | |||||||||||||
| 178 | if (node.flags & QDBusConnection::ExportChildObjects) {
| 0-86 | ||||||||||||
| 179 | xml_data += generateSubObjectXml(node.obj); | - | ||||||||||||
| 180 | } else { never executed: end of block | 0 | ||||||||||||
| 181 | // generate from the object tree | - | ||||||||||||
| 182 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = | - | ||||||||||||
| 183 | node.children.constBegin(); | - | ||||||||||||
| 184 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = | - | ||||||||||||
| 185 | node.children.constEnd(); | - | ||||||||||||
| 186 | for ( ; it != end; ++it)
| 28-86 | ||||||||||||
| 187 | if (it->obj || !it->children.isEmpty())
| 0-28 | ||||||||||||
| 188 | xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") executed 28 times by 1 test: xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(it->name);Executed by:
| 28 | ||||||||||||
| 189 | .arg(it->name); executed 28 times by 1 test: xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(it->name);Executed by:
| 28 | ||||||||||||
| 190 | } executed 86 times by 11 tests: end of blockExecuted by:
| 86 | ||||||||||||
| 191 | - | |||||||||||||
| 192 | xml_data += QLatin1String("</node>\n"); | - | ||||||||||||
| 193 | return xml_data; executed 86 times by 11 tests: return xml_data;Executed by:
| 86 | ||||||||||||
| 194 | } | - | ||||||||||||
| 195 | - | |||||||||||||
| 196 | // implement the D-Bus interface org.freedesktop.DBus.Properties | - | ||||||||||||
| 197 | - | |||||||||||||
| 198 | static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name) | - | ||||||||||||
| 199 | { | - | ||||||||||||
| 200 | return msg.createErrorReply(QDBusError::UnknownInterface, executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Executed by:
| 8 | ||||||||||||
| 201 | QString::fromLatin1("Interface %1 was not found in object %2") executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Executed by:
| 8 | ||||||||||||
| 202 | .arg(interface_name) executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Executed by:
| 8 | ||||||||||||
| 203 | .arg(msg.path())); executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Executed by:
| 8 | ||||||||||||
| 204 | } | - | ||||||||||||
| 205 | - | |||||||||||||
| 206 | static inline QDBusMessage | - | ||||||||||||
| 207 | propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name) | - | ||||||||||||
| 208 | { | - | ||||||||||||
| 209 | return msg.createErrorReply(QDBusError::UnknownProperty, never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path())); | 0 | ||||||||||||
| 210 | QString::fromLatin1("Property %1%2%3 was not found in object %4") never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path())); | 0 | ||||||||||||
| 211 | .arg(interface_name, never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path())); | 0 | ||||||||||||
| 212 | QString::fromLatin1(interface_name.isEmpty() ? "" : "."), never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path())); | 0 | ||||||||||||
| 213 | QString::fromLatin1(property_name), never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path())); | 0 | ||||||||||||
| 214 | msg.path())); never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path())); | 0 | ||||||||||||
| 215 | } | - | ||||||||||||
| 216 | - | |||||||||||||
| 217 | QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, | - | ||||||||||||
| 218 | const QDBusMessage &msg) | - | ||||||||||||
| 219 | { | - | ||||||||||||
| 220 | Q_ASSERT(msg.arguments().count() == 2); | - | ||||||||||||
| 221 | Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(), | - | ||||||||||||
| 222 | "QDBusConnection: internal threading error", | - | ||||||||||||
| 223 | "function called for an object that is in another thread!!"); | - | ||||||||||||
| 224 | - | |||||||||||||
| 225 | QString interface_name = msg.arguments().at(0).toString(); | - | ||||||||||||
| 226 | QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); | - | ||||||||||||
| 227 | - | |||||||||||||
| 228 | QDBusAdaptorConnector *connector; | - | ||||||||||||
| 229 | QVariant value; | - | ||||||||||||
| 230 | bool interfaceFound = false; | - | ||||||||||||
| 231 | if (node.flags & QDBusConnection::ExportAdaptors &&
| 16-26 | ||||||||||||
| 232 | (connector = qDBusFindAdaptorConnector(node.obj))) {
| 0-26 | ||||||||||||
| 233 | - | |||||||||||||
| 234 | // find the class that implements interface_name or try until we've found the property | - | ||||||||||||
| 235 | // in case of an empty interface | - | ||||||||||||
| 236 | if (interface_name.isEmpty()) {
| 12-14 | ||||||||||||
| 237 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - | ||||||||||||
| 238 | end = connector->adaptors.constEnd(); it != end; ++it) {
| 4-38 | ||||||||||||
| 239 | const QMetaObject *mo = it->adaptor->metaObject(); | - | ||||||||||||
| 240 | int pidx = mo->indexOfProperty(property_name); | - | ||||||||||||
| 241 | if (pidx != -1) {
| 8-30 | ||||||||||||
| 242 | value = mo->property(pidx).read(it->adaptor); | - | ||||||||||||
| 243 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||
| 244 | } | - | ||||||||||||
| 245 | } executed 30 times by 1 test: end of blockExecuted by:
| 30 | ||||||||||||
| 246 | } else { executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||
| 247 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - | ||||||||||||
| 248 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - | ||||||||||||
| 249 | interface_name); | - | ||||||||||||
| 250 | if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
| 0-14 | ||||||||||||
| 251 | interfaceFound = true; | - | ||||||||||||
| 252 | value = it->adaptor->property(property_name); | - | ||||||||||||
| 253 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||
| 254 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||
| 255 | } | - | ||||||||||||
| 256 | - | |||||||||||||
| 257 | if (!interfaceFound && !value.isValid()
| 8-30 | ||||||||||||
| 258 | && node.flags & (QDBusConnection::ExportAllProperties |
| 6-16 | ||||||||||||
| 259 | QDBusConnection::ExportNonScriptableProperties)) {
| 6-16 | ||||||||||||
| 260 | // try the object itself | - | ||||||||||||
| 261 | if (!interface_name.isEmpty())
| 0-16 | ||||||||||||
| 262 | interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); executed 16 times by 2 tests: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);Executed by:
| 16 | ||||||||||||
| 263 | - | |||||||||||||
| 264 | if (interfaceFound) {
| 0-16 | ||||||||||||
| 265 | int pidx = node.obj->metaObject()->indexOfProperty(property_name); | - | ||||||||||||
| 266 | if (pidx != -1) {
| 0-16 | ||||||||||||
| 267 | QMetaProperty mp = node.obj->metaObject()->property(pidx); | - | ||||||||||||
| 268 | if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
| 0-16 | ||||||||||||
| 269 | (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
| 0 | ||||||||||||
| 270 | value = mp.read(node.obj); executed 16 times by 2 tests: value = mp.read(node.obj);Executed by:
| 16 | ||||||||||||
| 271 | } executed 16 times by 2 tests: end of blockExecuted by:
| 16 | ||||||||||||
| 272 | } executed 16 times by 2 tests: end of blockExecuted by:
| 16 | ||||||||||||
| 273 | } executed 16 times by 2 tests: end of blockExecuted by:
| 16 | ||||||||||||
| 274 | - | |||||||||||||
| 275 | if (!value.isValid()) {
| 6-36 | ||||||||||||
| 276 | // the property was not found | - | ||||||||||||
| 277 | if (!interfaceFound)
| 0-6 | ||||||||||||
| 278 | return interfaceNotFoundError(msg, interface_name); executed 6 times by 1 test: return interfaceNotFoundError(msg, interface_name);Executed by:
| 6 | ||||||||||||
| 279 | return propertyNotFoundError(msg, interface_name, property_name); never executed: return propertyNotFoundError(msg, interface_name, property_name); | 0 | ||||||||||||
| 280 | } | - | ||||||||||||
| 281 | - | |||||||||||||
| 282 | return msg.createReply(QVariant::fromValue(QDBusVariant(value))); executed 36 times by 3 tests: return msg.createReply(QVariant::fromValue(QDBusVariant(value)));Executed by:
| 36 | ||||||||||||
| 283 | } | - | ||||||||||||
| 284 | - | |||||||||||||
| 285 | enum PropertyWriteResult { | - | ||||||||||||
| 286 | PropertyWriteSuccess = 0, | - | ||||||||||||
| 287 | PropertyNotFound, | - | ||||||||||||
| 288 | PropertyTypeMismatch, | - | ||||||||||||
| 289 | PropertyReadOnly, | - | ||||||||||||
| 290 | PropertyWriteFailed | - | ||||||||||||
| 291 | }; | - | ||||||||||||
| 292 | - | |||||||||||||
| 293 | static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name, | - | ||||||||||||
| 294 | const QByteArray &property_name, int status) | - | ||||||||||||
| 295 | { | - | ||||||||||||
| 296 | switch (status) { | - | ||||||||||||
| 297 | case PropertyNotFound: never executed: case PropertyNotFound: | 0 | ||||||||||||
| 298 | return propertyNotFoundError(msg, interface_name, property_name); never executed: return propertyNotFoundError(msg, interface_name, property_name); | 0 | ||||||||||||
| 299 | case PropertyTypeMismatch: never executed: case PropertyTypeMismatch: | 0 | ||||||||||||
| 300 | return msg.createErrorReply(QDBusError::InvalidArgs, never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name))); | 0 | ||||||||||||
| 301 | QString::fromLatin1("Invalid arguments for writing to property %1%2%3") never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name))); | 0 | ||||||||||||
| 302 | .arg(interface_name, never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name))); | 0 | ||||||||||||
| 303 | QString::fromLatin1(interface_name.isEmpty() ? "" : "."), never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name))); | 0 | ||||||||||||
| 304 | QString::fromLatin1(property_name))); never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name))); | 0 | ||||||||||||
| 305 | case PropertyReadOnly: executed 6 times by 1 test: case PropertyReadOnly:Executed by:
| 6 | ||||||||||||
| 306 | return msg.createErrorReply(QDBusError::PropertyReadOnly, executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));Executed by:
| 6 | ||||||||||||
| 307 | QString::fromLatin1("Property %1%2%3 is read-only") executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));Executed by:
| 6 | ||||||||||||
| 308 | .arg(interface_name, executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));Executed by:
| 6 | ||||||||||||
| 309 | QString::fromLatin1(interface_name.isEmpty() ? "" : "."), executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));Executed by:
| 6 | ||||||||||||
| 310 | QString::fromLatin1(property_name))); executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));Executed by:
| 6 | ||||||||||||
| 311 | case PropertyWriteFailed: never executed: case PropertyWriteFailed: | 0 | ||||||||||||
| 312 | return msg.createErrorReply(QDBusError::InternalError, never executed: return msg.createErrorReply(QDBusError::InternalError, QString::fromLatin1("Internal error")); | 0 | ||||||||||||
| 313 | QString::fromLatin1("Internal error")); never executed: return msg.createErrorReply(QDBusError::InternalError, QString::fromLatin1("Internal error")); | 0 | ||||||||||||
| 314 | - | |||||||||||||
| 315 | case PropertyWriteSuccess: executed 22 times by 3 tests: case PropertyWriteSuccess:Executed by:
| 22 | ||||||||||||
| 316 | return msg.createReply(); executed 22 times by 3 tests: return msg.createReply();Executed by:
| 22 | ||||||||||||
| 317 | } | - | ||||||||||||
| 318 | Q_ASSERT_X(false, "", "Should not be reached"); | - | ||||||||||||
| 319 | return QDBusMessage(); never executed: return QDBusMessage(); | 0 | ||||||||||||
| 320 | } | - | ||||||||||||
| 321 | - | |||||||||||||
| 322 | static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value, | - | ||||||||||||
| 323 | int propFlags = QDBusConnection::ExportAllProperties) | - | ||||||||||||
| 324 | { | - | ||||||||||||
| 325 | const QMetaObject *mo = obj->metaObject(); | - | ||||||||||||
| 326 | int pidx = mo->indexOfProperty(property_name); | - | ||||||||||||
| 327 | if (pidx == -1) {
| 0-28 | ||||||||||||
| 328 | // this object has no property by that name | - | ||||||||||||
| 329 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 | ||||||||||||
| 330 | } | - | ||||||||||||
| 331 | - | |||||||||||||
| 332 | QMetaProperty mp = mo->property(pidx); | - | ||||||||||||
| 333 | - | |||||||||||||
| 334 | // check if this property is writable | - | ||||||||||||
| 335 | if (!mp.isWritable())
| 6-22 | ||||||||||||
| 336 | return PropertyReadOnly; executed 6 times by 1 test: return PropertyReadOnly;Executed by:
| 6 | ||||||||||||
| 337 | - | |||||||||||||
| 338 | // check if this property is exported | - | ||||||||||||
| 339 | bool isScriptable = mp.isScriptable(); | - | ||||||||||||
| 340 | if (!(propFlags & QDBusConnection::ExportScriptableProperties) && isScriptable)
| 0-22 | ||||||||||||
| 341 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 | ||||||||||||
| 342 | if (!(propFlags & QDBusConnection::ExportNonScriptableProperties) && !isScriptable)
| 0-12 | ||||||||||||
| 343 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 | ||||||||||||
| 344 | - | |||||||||||||
| 345 | // we found our property | - | ||||||||||||
| 346 | // do we have the right type? | - | ||||||||||||
| 347 | int id = mp.userType(); | - | ||||||||||||
| 348 | if (!id){
| 0-22 | ||||||||||||
| 349 | // type not registered or invalid / void? | - | ||||||||||||
| 350 | qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'", | - | ||||||||||||
| 351 | mp.typeName(), mo->className(), property_name.constData()); | - | ||||||||||||
| 352 | return PropertyWriteFailed; never executed: return PropertyWriteFailed; | 0 | ||||||||||||
| 353 | } | - | ||||||||||||
| 354 | - | |||||||||||||
| 355 | if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) {
| 0-22 | ||||||||||||
| 356 | // we have to demarshall before writing | - | ||||||||||||
| 357 | void *null = 0; | - | ||||||||||||
| 358 | QVariant other(id, null); | - | ||||||||||||
| 359 | if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) {
| 0-6 | ||||||||||||
| 360 | qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " | - | ||||||||||||
| 361 | "Use qDBusRegisterMetaType to register it", | - | ||||||||||||
| 362 | mp.typeName(), id); | - | ||||||||||||
| 363 | return PropertyWriteFailed; never executed: return PropertyWriteFailed; | 0 | ||||||||||||
| 364 | } | - | ||||||||||||
| 365 | - | |||||||||||||
| 366 | value = other; | - | ||||||||||||
| 367 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 368 | - | |||||||||||||
| 369 | if (mp.userType() == qMetaTypeId<QDBusVariant>())
| 4-18 | ||||||||||||
| 370 | value = QVariant::fromValue(QDBusVariant(value)); executed 4 times by 1 test: value = QVariant::fromValue(QDBusVariant(value));Executed by:
| 4 | ||||||||||||
| 371 | - | |||||||||||||
| 372 | // the property type here should match | - | ||||||||||||
| 373 | return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed; executed 22 times by 3 tests: return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;Executed by:
| 0-22 | ||||||||||||
| 374 | } | - | ||||||||||||
| 375 | - | |||||||||||||
| 376 | QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, | - | ||||||||||||
| 377 | const QDBusMessage &msg) | - | ||||||||||||
| 378 | { | - | ||||||||||||
| 379 | Q_ASSERT(msg.arguments().count() == 3); | - | ||||||||||||
| 380 | Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(), | - | ||||||||||||
| 381 | "QDBusConnection: internal threading error", | - | ||||||||||||
| 382 | "function called for an object that is in another thread!!"); | - | ||||||||||||
| 383 | - | |||||||||||||
| 384 | QString interface_name = msg.arguments().at(0).toString(); | - | ||||||||||||
| 385 | QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); | - | ||||||||||||
| 386 | QVariant value = qvariant_cast<QDBusVariant>(msg.arguments().at(2)).variant(); | - | ||||||||||||
| 387 | - | |||||||||||||
| 388 | QDBusAdaptorConnector *connector; | - | ||||||||||||
| 389 | if (node.flags & QDBusConnection::ExportAdaptors &&
| 12-16 | ||||||||||||
| 390 | (connector = qDBusFindAdaptorConnector(node.obj))) {
| 0-12 | ||||||||||||
| 391 | - | |||||||||||||
| 392 | // find the class that implements interface_name or try until we've found the property | - | ||||||||||||
| 393 | // in case of an empty interface | - | ||||||||||||
| 394 | if (interface_name.isEmpty()) {
| 0-12 | ||||||||||||
| 395 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - | ||||||||||||
| 396 | end = connector->adaptors.constEnd(); it != end; ++it) {
| 0 | ||||||||||||
| 397 | int status = writeProperty(it->adaptor, property_name, value); | - | ||||||||||||
| 398 | if (status == PropertyNotFound)
| 0 | ||||||||||||
| 399 | continue; never executed: continue; | 0 | ||||||||||||
| 400 | return propertyWriteReply(msg, interface_name, property_name, status); never executed: return propertyWriteReply(msg, interface_name, property_name, status); | 0 | ||||||||||||
| 401 | } | - | ||||||||||||
| 402 | } else { never executed: end of block | 0 | ||||||||||||
| 403 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - | ||||||||||||
| 404 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - | ||||||||||||
| 405 | interface_name); | - | ||||||||||||
| 406 | if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) {
| 0-12 | ||||||||||||
| 407 | return propertyWriteReply(msg, interface_name, property_name, executed 12 times by 1 test: return propertyWriteReply(msg, interface_name, property_name, writeProperty(it->adaptor, property_name, value));Executed by:
| 12 | ||||||||||||
| 408 | writeProperty(it->adaptor, property_name, value)); executed 12 times by 1 test: return propertyWriteReply(msg, interface_name, property_name, writeProperty(it->adaptor, property_name, value));Executed by:
| 12 | ||||||||||||
| 409 | } | - | ||||||||||||
| 410 | } never executed: end of block | 0 | ||||||||||||
| 411 | } | - | ||||||||||||
| 412 | - | |||||||||||||
| 413 | if (node.flags & (QDBusConnection::ExportScriptableProperties |
| 0-16 | ||||||||||||
| 414 | QDBusConnection::ExportNonScriptableProperties)) {
| 0-16 | ||||||||||||
| 415 | // try the object itself | - | ||||||||||||
| 416 | bool interfaceFound = true; | - | ||||||||||||
| 417 | if (!interface_name.isEmpty())
| 0-16 | ||||||||||||
| 418 | interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); executed 16 times by 2 tests: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);Executed by:
| 16 | ||||||||||||
| 419 | - | |||||||||||||
| 420 | if (interfaceFound) {
| 0-16 | ||||||||||||
| 421 | return propertyWriteReply(msg, interface_name, property_name, executed 16 times by 2 tests: return propertyWriteReply(msg, interface_name, property_name, writeProperty(node.obj, property_name, value, node.flags));Executed by:
| 16 | ||||||||||||
| 422 | writeProperty(node.obj, property_name, value, node.flags)); executed 16 times by 2 tests: return propertyWriteReply(msg, interface_name, property_name, writeProperty(node.obj, property_name, value, node.flags));Executed by:
| 16 | ||||||||||||
| 423 | } | - | ||||||||||||
| 424 | } never executed: end of block | 0 | ||||||||||||
| 425 | - | |||||||||||||
| 426 | // the property was not found | - | ||||||||||||
| 427 | if (!interface_name.isEmpty())
| 0 | ||||||||||||
| 428 | return interfaceNotFoundError(msg, interface_name); never executed: return interfaceNotFoundError(msg, interface_name); | 0 | ||||||||||||
| 429 | return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); never executed: return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); | 0 | ||||||||||||
| 430 | } | - | ||||||||||||
| 431 | - | |||||||||||||
| 432 | // unite two QVariantMaps, but don't generate duplicate keys | - | ||||||||||||
| 433 | static QVariantMap &operator+=(QVariantMap &lhs, const QVariantMap &rhs) | - | ||||||||||||
| 434 | { | - | ||||||||||||
| 435 | QVariantMap::ConstIterator it = rhs.constBegin(), | - | ||||||||||||
| 436 | end = rhs.constEnd(); | - | ||||||||||||
| 437 | for ( ; it != end; ++it)
| 16-32 | ||||||||||||
| 438 | lhs.insert(it.key(), it.value()); executed 32 times by 1 test: lhs.insert(it.key(), it.value());Executed by:
| 32 | ||||||||||||
| 439 | return lhs; executed 16 times by 1 test: return lhs;Executed by:
| 16 | ||||||||||||
| 440 | } | - | ||||||||||||
| 441 | - | |||||||||||||
| 442 | static QVariantMap readAllProperties(QObject *object, int flags) | - | ||||||||||||
| 443 | { | - | ||||||||||||
| 444 | QVariantMap result; | - | ||||||||||||
| 445 | const QMetaObject *mo = object->metaObject(); | - | ||||||||||||
| 446 | - | |||||||||||||
| 447 | // QObject has properties, so don't start from 0 | - | ||||||||||||
| 448 | for (int i = QObject::staticMetaObject.propertyCount(); i < mo->propertyCount(); ++i) {
| 22-54 | ||||||||||||
| 449 | QMetaProperty mp = mo->property(i); | - | ||||||||||||
| 450 | - | |||||||||||||
| 451 | // is it readable? | - | ||||||||||||
| 452 | if (!mp.isReadable())
| 0-54 | ||||||||||||
| 453 | continue; never executed: continue; | 0 | ||||||||||||
| 454 | - | |||||||||||||
| 455 | // is it a registered property? | - | ||||||||||||
| 456 | int typeId = mp.userType(); | - | ||||||||||||
| 457 | if (!typeId)
| 0-54 | ||||||||||||
| 458 | continue; never executed: continue; | 0 | ||||||||||||
| 459 | const char *signature = QDBusMetaType::typeToSignature(typeId); | - | ||||||||||||
| 460 | if (!signature)
| 6-48 | ||||||||||||
| 461 | continue; executed 6 times by 1 test: continue;Executed by:
| 6 | ||||||||||||
| 462 | - | |||||||||||||
| 463 | // is this property visible from the outside? | - | ||||||||||||
| 464 | if ((mp.isScriptable() && flags & QDBusConnection::ExportScriptableProperties) ||
| 0-48 | ||||||||||||
| 465 | (!mp.isScriptable() && flags & QDBusConnection::ExportNonScriptableProperties)) {
| 0 | ||||||||||||
| 466 | // yes, it's visible | - | ||||||||||||
| 467 | QVariant value = mp.read(object); | - | ||||||||||||
| 468 | if (value.isValid())
| 0-48 | ||||||||||||
| 469 | result.insert(QString::fromLatin1(mp.name()), value); executed 48 times by 1 test: result.insert(QString::fromLatin1(mp.name()), value);Executed by:
| 48 | ||||||||||||
| 470 | } executed 48 times by 1 test: end of blockExecuted by:
| 48 | ||||||||||||
| 471 | } executed 48 times by 1 test: end of blockExecuted by:
| 48 | ||||||||||||
| 472 | - | |||||||||||||
| 473 | return result; executed 22 times by 1 test: return result;Executed by:
| 22 | ||||||||||||
| 474 | } | - | ||||||||||||
| 475 | - | |||||||||||||
| 476 | QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node, | - | ||||||||||||
| 477 | const QDBusMessage &msg) | - | ||||||||||||
| 478 | { | - | ||||||||||||
| 479 | Q_ASSERT(msg.arguments().count() == 1); | - | ||||||||||||
| 480 | Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(), | - | ||||||||||||
| 481 | "QDBusConnection: internal threading error", | - | ||||||||||||
| 482 | "function called for an object that is in another thread!!"); | - | ||||||||||||
| 483 | - | |||||||||||||
| 484 | QString interface_name = msg.arguments().at(0).toString(); | - | ||||||||||||
| 485 | - | |||||||||||||
| 486 | bool interfaceFound = false; | - | ||||||||||||
| 487 | QVariantMap result; | - | ||||||||||||
| 488 | - | |||||||||||||
| 489 | QDBusAdaptorConnector *connector; | - | ||||||||||||
| 490 | if (node.flags & QDBusConnection::ExportAdaptors &&
| 0-12 | ||||||||||||
| 491 | (connector = qDBusFindAdaptorConnector(node.obj))) {
| 0-12 | ||||||||||||
| 492 | - | |||||||||||||
| 493 | if (interface_name.isEmpty()) {
| 4-8 | ||||||||||||
| 494 | // iterate over all interfaces | - | ||||||||||||
| 495 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - | ||||||||||||
| 496 | end = connector->adaptors.constEnd(); it != end; ++it) {
| 4-16 | ||||||||||||
| 497 | result += readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); | - | ||||||||||||
| 498 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||
| 499 | } else { executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 500 | // find the class that implements interface_name | - | ||||||||||||
| 501 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - | ||||||||||||
| 502 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - | ||||||||||||
| 503 | interface_name); | - | ||||||||||||
| 504 | if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
| 0-8 | ||||||||||||
| 505 | interfaceFound = true; | - | ||||||||||||
| 506 | result = readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); | - | ||||||||||||
| 507 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||
| 508 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||
| 509 | } | - | ||||||||||||
| 510 | - | |||||||||||||
| 511 | if (node.flags & QDBusConnection::ExportAllProperties &&
| 0-12 | ||||||||||||
| 512 | (!interfaceFound || interface_name.isEmpty())) {
| 0 | ||||||||||||
| 513 | // try the object itself | - | ||||||||||||
| 514 | result += readAllProperties(node.obj, node.flags); | - | ||||||||||||
| 515 | interfaceFound = true; | - | ||||||||||||
| 516 | } never executed: end of block | 0 | ||||||||||||
| 517 | - | |||||||||||||
| 518 | if (!interfaceFound && !interface_name.isEmpty()) {
| 2-6 | ||||||||||||
| 519 | // the interface was not found | - | ||||||||||||
| 520 | return interfaceNotFoundError(msg, interface_name); executed 2 times by 1 test: return interfaceNotFoundError(msg, interface_name);Executed by:
| 2 | ||||||||||||
| 521 | } | - | ||||||||||||
| 522 | - | |||||||||||||
| 523 | return msg.createReply(QVariant::fromValue(result)); executed 10 times by 1 test: return msg.createReply(QVariant::fromValue(result));Executed by:
| 10 | ||||||||||||
| 524 | } | - | ||||||||||||
| 525 | - | |||||||||||||
| 526 | QT_END_NAMESPACE | - | ||||||||||||
| 527 | - | |||||||||||||
| 528 | #endif // QT_NO_DBUS | - | ||||||||||||
| Source code | Switch to Preprocessed file |