| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusconnectioninterface.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | const char *QDBusConnectionInterface::staticInterfaceName() | - | ||||||
| 8 | { return never executed: "org.freedesktop.DBus";return "org.freedesktop.DBus";never executed: }return "org.freedesktop.DBus"; | 0 | ||||||
| 9 | - | |||||||
| 10 | - | |||||||
| 11 | - | |||||||
| 12 | - | |||||||
| 13 | QDBusConnectionInterface::QDBusConnectionInterface(const QDBusConnection &connection, | - | ||||||
| 14 | QObject *parent) | - | ||||||
| 15 | : QDBusAbstractInterface(QDBusUtil::dbusService(), | - | ||||||
| 16 | QDBusUtil::dbusPath(), | - | ||||||
| 17 | "org.freedesktop.DBus", connection, parent) | - | ||||||
| 18 | { | - | ||||||
| 19 | connect(this, &QDBusConnectionInterface::NameAcquired, this, &QDBusConnectionInterface::serviceRegistered); | - | ||||||
| 20 | connect(this, &QDBusConnectionInterface::NameLost, this, &QDBusConnectionInterface::serviceUnregistered); | - | ||||||
| 21 | connect(this, &QDBusConnectionInterface::NameOwnerChanged, | - | ||||||
| 22 | this, &QDBusConnectionInterface::serviceOwnerChanged); | - | ||||||
| 23 | } executed 326 times by 160 tests: end of blockExecuted by:
| 326 | ||||||
| 24 | - | |||||||
| 25 | - | |||||||
| 26 | - | |||||||
| 27 | - | |||||||
| 28 | QDBusConnectionInterface::~QDBusConnectionInterface() | - | ||||||
| 29 | { | - | ||||||
| 30 | } | - | ||||||
| 31 | - | |||||||
| 32 | - | |||||||
| 33 | - | |||||||
| 34 | - | |||||||
| 35 | - | |||||||
| 36 | - | |||||||
| 37 | QDBusReply<QString> QDBusConnectionInterface::serviceOwner(const QString &name) const | - | ||||||
| 38 | { | - | ||||||
| 39 | return never executed: internalConstCall(QDBus::AutoDetect, QLatin1String("GetNameOwner"), QList<QVariant>() << name);return internalConstCall(QDBus::AutoDetect, QLatin1String("GetNameOwner"), QList<QVariant>() << name);never executed: return internalConstCall(QDBus::AutoDetect, QLatin1String("GetNameOwner"), QList<QVariant>() << name); | 0 | ||||||
| 40 | } | - | ||||||
| 41 | - | |||||||
| 42 | - | |||||||
| 43 | - | |||||||
| 44 | - | |||||||
| 45 | - | |||||||
| 46 | - | |||||||
| 47 | - | |||||||
| 48 | QDBusReply<QStringList> QDBusConnectionInterface::registeredServiceNames() const | - | ||||||
| 49 | { | - | ||||||
| 50 | return executed 3 times by 1 test: internalConstCall(QDBus::AutoDetect, QLatin1String("ListNames"));return internalConstCall(QDBus::AutoDetect, QLatin1String("ListNames"));Executed by:
executed 3 times by 1 test: return internalConstCall(QDBus::AutoDetect, QLatin1String("ListNames"));Executed by:
| 3 | ||||||
| 51 | } | - | ||||||
| 52 | - | |||||||
| 53 | - | |||||||
| 54 | - | |||||||
| 55 | - | |||||||
| 56 | - | |||||||
| 57 | QDBusReply<bool> QDBusConnectionInterface::isServiceRegistered(const QString &serviceName) const | - | ||||||
| 58 | { | - | ||||||
| 59 | return executed 239 times by 149 tests: internalConstCall(QDBus::AutoDetect, QLatin1String("NameHasOwner"),return internalConstCall(QDBus::AutoDetect, QLatin1String("NameHasOwner"), QList<QVariant>() << serviceName);Executed by:
executed 239 times by 149 tests: return internalConstCall(QDBus::AutoDetect, QLatin1String("NameHasOwner"), QList<QVariant>() << serviceName);Executed by:
| 239 | ||||||
| 60 | QList<QVariant>() << serviceName); executed 239 times by 149 tests: return internalConstCall(QDBus::AutoDetect, QLatin1String("NameHasOwner"), QList<QVariant>() << serviceName);Executed by:
| 239 | ||||||
| 61 | } | - | ||||||
| 62 | - | |||||||
| 63 | - | |||||||
| 64 | - | |||||||
| 65 | - | |||||||
| 66 | - | |||||||
| 67 | QDBusReply<uint> QDBusConnectionInterface::servicePid(const QString &serviceName) const | - | ||||||
| 68 | { | - | ||||||
| 69 | return never executed: internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixProcessID"),return internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixProcessID"), QList<QVariant>() << serviceName);never executed: return internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixProcessID"), QList<QVariant>() << serviceName); | 0 | ||||||
| 70 | QList<QVariant>() << serviceName); never executed: return internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixProcessID"), QList<QVariant>() << serviceName); | 0 | ||||||
| 71 | } | - | ||||||
| 72 | - | |||||||
| 73 | - | |||||||
| 74 | - | |||||||
| 75 | - | |||||||
| 76 | - | |||||||
| 77 | QDBusReply<uint> QDBusConnectionInterface::serviceUid(const QString &serviceName) const | - | ||||||
| 78 | { | - | ||||||
| 79 | return never executed: internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixUser"),return internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixUser"), QList<QVariant>() << serviceName);never executed: return internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixUser"), QList<QVariant>() << serviceName); | 0 | ||||||
| 80 | QList<QVariant>() << serviceName); never executed: return internalConstCall(QDBus::AutoDetect, QLatin1String("GetConnectionUnixUser"), QList<QVariant>() << serviceName); | 0 | ||||||
| 81 | } | - | ||||||
| 82 | - | |||||||
| 83 | - | |||||||
| 84 | - | |||||||
| 85 | - | |||||||
| 86 | QDBusReply<void> QDBusConnectionInterface::startService(const QString &name) | - | ||||||
| 87 | { | - | ||||||
| 88 | return never executed: call(QLatin1String("StartServiceByName"), name, uint(0));return call(QLatin1String("StartServiceByName"), name, uint(0));never executed: return call(QLatin1String("StartServiceByName"), name, uint(0)); | 0 | ||||||
| 89 | } | - | ||||||
| 90 | QDBusReply<QDBusConnectionInterface::RegisterServiceReply> | - | ||||||
| 91 | QDBusConnectionInterface::registerService(const QString &serviceName, | - | ||||||
| 92 | ServiceQueueOptions qoption, | - | ||||||
| 93 | ServiceReplacementOptions roption) | - | ||||||
| 94 | { | - | ||||||
| 95 | - | |||||||
| 96 | uint flags = 0; | - | ||||||
| 97 | switch (qoption) { | - | ||||||
| 98 | case executed 31 times by 9 tests: DontQueueService:case DontQueueService:Executed by:
executed 31 times by 9 tests: case DontQueueService:Executed by:
| 31 | ||||||
| 99 | flags = 0x4; | - | ||||||
| 100 | break; executed 31 times by 9 tests: break;Executed by:
| 31 | ||||||
| 101 | case never executed: QueueService:case QueueService:never executed: case QueueService: | 0 | ||||||
| 102 | flags = 0; | - | ||||||
| 103 | break; never executed: break; | 0 | ||||||
| 104 | case never executed: ReplaceExistingService:case ReplaceExistingService:never executed: case ReplaceExistingService: | 0 | ||||||
| 105 | flags = 0x4 | 0x2; | - | ||||||
| 106 | break; never executed: break; | 0 | ||||||
| 107 | } | - | ||||||
| 108 | - | |||||||
| 109 | switch (roption) { | - | ||||||
| 110 | case executed 31 times by 9 tests: DontAllowReplacement:case DontAllowReplacement:Executed by:
executed 31 times by 9 tests: case DontAllowReplacement:Executed by:
| 31 | ||||||
| 111 | break; executed 31 times by 9 tests: break;Executed by:
| 31 | ||||||
| 112 | case never executed: AllowReplacement:case AllowReplacement:never executed: case AllowReplacement: | 0 | ||||||
| 113 | flags |= 0x1; | - | ||||||
| 114 | break; never executed: break; | 0 | ||||||
| 115 | } | - | ||||||
| 116 | - | |||||||
| 117 | QDBusMessage reply = call(QLatin1String("RequestName"), serviceName, flags); | - | ||||||
| 118 | - | |||||||
| 119 | - | |||||||
| 120 | - | |||||||
| 121 | if (reply.type() == QDBusMessage::ReplyMessage
| 0-31 | ||||||
| 122 | uint code = 0; | - | ||||||
| 123 | - | |||||||
| 124 | switch (reply.arguments().at(0).toUInt()) { | - | ||||||
| 125 | case executed 25 times by 9 tests: 1:case 1:Executed by:
executed 25 times by 9 tests: case 1:Executed by:
| 25 | ||||||
| 126 | case executed 6 times by 1 test: 4:case 4:Executed by:
executed 6 times by 1 test: case 4:Executed by:
| 6 | ||||||
| 127 | code = uint(ServiceRegistered); | - | ||||||
| 128 | break; executed 31 times by 9 tests: break;Executed by:
| 31 | ||||||
| 129 | - | |||||||
| 130 | case never executed: 3:case 3:never executed: case 3: | 0 | ||||||
| 131 | code = uint(ServiceNotRegistered); | - | ||||||
| 132 | break; never executed: break; | 0 | ||||||
| 133 | - | |||||||
| 134 | case never executed: 2:case 2:never executed: case 2: | 0 | ||||||
| 135 | code = uint(ServiceQueued); | - | ||||||
| 136 | break; never executed: break; | 0 | ||||||
| 137 | } | - | ||||||
| 138 | - | |||||||
| 139 | reply.setArguments(QVariantList() << code); | - | ||||||
| 140 | } executed 31 times by 9 tests: end of blockExecuted by:
| 31 | ||||||
| 141 | - | |||||||
| 142 | return executed 31 times by 9 tests: reply;return reply;Executed by:
executed 31 times by 9 tests: return reply;Executed by:
| 31 | ||||||
| 143 | } | - | ||||||
| 144 | QDBusReply<bool> | - | ||||||
| 145 | QDBusConnectionInterface::unregisterService(const QString &serviceName) | - | ||||||
| 146 | { | - | ||||||
| 147 | QDBusMessage reply = call(QLatin1String("ReleaseName"), serviceName); | - | ||||||
| 148 | if (reply.type() == QDBusMessage::ReplyMessage
| 0-11 | ||||||
| 149 | bool success = reply.arguments().at(0).toUInt() == 1; | - | ||||||
| 150 | reply.setArguments(QVariantList() << success); | - | ||||||
| 151 | } executed 11 times by 4 tests: end of blockExecuted by:
| 11 | ||||||
| 152 | return executed 11 times by 4 tests: reply;return reply;Executed by:
executed 11 times by 4 tests: return reply;Executed by:
| 11 | ||||||
| 153 | } | - | ||||||
| 154 | - | |||||||
| 155 | - | |||||||
| 156 | - | |||||||
| 157 | - | |||||||
| 158 | void QDBusConnectionInterface::connectNotify(const QMetaMethod &signal) | - | ||||||
| 159 | { | - | ||||||
| 160 | - | |||||||
| 161 | - | |||||||
| 162 | static const QMetaMethod serviceRegisteredSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::serviceRegistered); | - | ||||||
| 163 | static const QMetaMethod serviceUnregisteredSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::serviceUnregistered); | - | ||||||
| 164 | static const QMetaMethod serviceOwnerChangedSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::serviceOwnerChanged); | - | ||||||
| 165 | static const QMetaMethod NameAcquiredSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::NameAcquired); | - | ||||||
| 166 | static const QMetaMethod NameLostSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::NameLost); | - | ||||||
| 167 | static const QMetaMethod NameOwnerChangedSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::NameOwnerChanged); | - | ||||||
| 168 | if (signal == serviceRegisteredSignal
| 0-980 | ||||||
| 169 | QDBusAbstractInterface::connectNotify(NameAcquiredSignal); never executed: QDBusAbstractInterface::connectNotify(NameAcquiredSignal); | 0 | ||||||
| 170 | - | |||||||
| 171 | else if (signal == serviceUnregisteredSignal
| 0-980 | ||||||
| 172 | QDBusAbstractInterface::connectNotify(NameLostSignal); never executed: QDBusAbstractInterface::connectNotify(NameLostSignal); | 0 | ||||||
| 173 | - | |||||||
| 174 | else if (signal == serviceOwnerChangedSignal
| 1-979 | ||||||
| 175 | static bool warningPrinted = false; | - | ||||||
| 176 | if (!warningPrinted
| 0-1 | ||||||
| 177 | QMessageLogger(__FILE__, 349, __PRETTY_FUNCTION__).warning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"); | - | ||||||
| 178 | warningPrinted = true; | - | ||||||
| 179 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||
| 180 | QDBusAbstractInterface::connectNotify(NameOwnerChangedSignal); | - | ||||||
| 181 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||
| 182 | } executed 980 times by 160 tests: end of blockExecuted by:
| 980 | ||||||
| 183 | - | |||||||
| 184 | - | |||||||
| 185 | - | |||||||
| 186 | - | |||||||
| 187 | void QDBusConnectionInterface::disconnectNotify(const QMetaMethod &signal) | - | ||||||
| 188 | { | - | ||||||
| 189 | - | |||||||
| 190 | - | |||||||
| 191 | static const QMetaMethod serviceRegisteredSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::serviceRegistered); | - | ||||||
| 192 | static const QMetaMethod serviceUnregisteredSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::serviceUnregistered); | - | ||||||
| 193 | static const QMetaMethod serviceOwnerChangedSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::serviceOwnerChanged); | - | ||||||
| 194 | static const QMetaMethod NameAcquiredSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::NameAcquired); | - | ||||||
| 195 | static const QMetaMethod NameLostSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::NameLost); | - | ||||||
| 196 | static const QMetaMethod NameOwnerChangedSignal = QMetaMethod::fromSignal(&QDBusConnectionInterface::NameOwnerChanged); | - | ||||||
| 197 | if (signal == serviceRegisteredSignal
| 0-2 | ||||||
| 198 | QDBusAbstractInterface::disconnectNotify(NameAcquiredSignal); never executed: QDBusAbstractInterface::disconnectNotify(NameAcquiredSignal); | 0 | ||||||
| 199 | - | |||||||
| 200 | else if (signal == serviceUnregisteredSignal
| 0-2 | ||||||
| 201 | QDBusAbstractInterface::disconnectNotify(NameLostSignal); never executed: QDBusAbstractInterface::disconnectNotify(NameLostSignal); | 0 | ||||||
| 202 | - | |||||||
| 203 | else if (signal == serviceOwnerChangedSignal
| 1 | ||||||
| 204 | QDBusAbstractInterface::disconnectNotify(NameOwnerChangedSignal); executed 1 time by 1 test: QDBusAbstractInterface::disconnectNotify(NameOwnerChangedSignal);Executed by:
| 1 | ||||||
| 205 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 206 | - | |||||||
| Switch to Source code | Preprocessed file |