Changeset 561 for trunk/src/dbus
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 60 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/dbus/dbus.pro
r2 r561 1 TARGET = QtDBus 2 QPRO_PWD = $$PWD 3 QT = core xml 4 CONFIG += link_pkgconfig 5 DEFINES += QDBUS_MAKEDLL DBUS_API_SUBJECT_TO_CHANGE 1 TARGET = QtDBus 2 QPRO_PWD = $$PWD 3 QT = core \ 4 xml 5 CONFIG += link_pkgconfig 6 DEFINES += QDBUS_MAKEDLL \ 7 DBUS_API_SUBJECT_TO_CHANGE 6 8 QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS 7 8 contains(QT_CONFIG, dbus-linked) { 9 LIBS += $$QT_LIBS_DBUS 10 DEFINES += QT_LINKED_LIBDBUS 9 contains(QT_CONFIG, dbus-linked) { 10 LIBS_PRIVATE += $$QT_LIBS_DBUS 11 DEFINES += QT_LINKED_LIBDBUS 11 12 } 12 13 13 #INCLUDEPATH += . 14 15 unix { 16 QMAKE_PKGCONFIG_DESCRIPTION = Qt DBus module 17 QMAKE_PKGCONFIG_REQUIRES = QtCore QtXml 14 # INCLUDEPATH += . 15 unix { 16 QMAKE_PKGCONFIG_DESCRIPTION = Qt \ 17 DBus \ 18 module 19 QMAKE_PKGCONFIG_REQUIRES = QtCore \ 20 QtXml 18 21 } 19 20 win32 { 21 LIBS += -lws2_32 -ladvapi32 -lnetapi32 -luser32 22 CONFIG(debug, debug|release):LIBS += -ldbus-1d 23 else:LIBS += -ldbus-1 22 win32 { 23 LIBS_PRIVATE += -lws2_32 \ 24 -ladvapi32 \ 25 -lnetapi32 \ 26 -luser32 27 CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d 28 else:LIBS_PRIVATE += -ldbus-1 24 29 } 25 26 30 include(../qbase.pri) 27 28 PUB_HEADERS = qdbusargument.h \ 29 qdbusconnectioninterface.h \ 30 qdbusmacros.h \ 31 qdbuserror.h \ 32 qdbusextratypes.h \ 33 qdbusmessage.h \ 34 qdbusserver.h \ 35 qdbusconnection.h \ 36 qdbusabstractinterface.h \ 37 qdbusinterface.h \ 38 qdbusabstractadaptor.h \ 39 qdbusreply.h \ 40 qdbusmetatype.h \ 41 qdbuspendingcall.h \ 42 qdbuspendingreply.h \ 43 qdbuscontext.h 44 31 PUB_HEADERS = qdbusargument.h \ 32 qdbusconnectioninterface.h \ 33 qdbusmacros.h \ 34 qdbuserror.h \ 35 qdbusextratypes.h \ 36 qdbusmessage.h \ 37 qdbusserver.h \ 38 qdbusconnection.h \ 39 qdbusabstractinterface.h \ 40 qdbusinterface.h \ 41 qdbusabstractadaptor.h \ 42 qdbusreply.h \ 43 qdbusmetatype.h \ 44 qdbuspendingcall.h \ 45 qdbuspendingreply.h \ 46 qdbuscontext.h 45 47 HEADERS += $$PUB_HEADERS \ 46 qdbusconnection_p.h qdbusmessage_p.h \ 47 qdbusinterface_p.h qdbusxmlparser_p.h qdbusabstractadaptor_p.h \ 48 qdbusargument_p.h qdbusutil_p.h qdbusabstractinterface_p.h \ 49 qdbuscontext_p.h qdbusthreaddebug_p.h qdbusintegrator_p.h \ 50 qdbuspendingcall_p.h qdbus_symbols_p.h 51 52 SOURCES += qdbusconnection.cpp \ 53 qdbusconnectioninterface.cpp \ 54 qdbuserror.cpp \ 55 qdbusintegrator.cpp \ 56 qdbusmessage.cpp \ 57 qdbusserver.cpp \ 58 qdbusabstractinterface.cpp \ 59 qdbusinterface.cpp \ 60 qdbusxmlparser.cpp \ 61 qdbusutil.cpp \ 62 qdbusintrospection.cpp \ 63 qdbusabstractadaptor.cpp \ 64 qdbusthread.cpp \ 65 qdbusinternalfilters.cpp \ 66 qdbusmetaobject.cpp \ 67 qdbusxmlgenerator.cpp \ 68 qdbusmisc.cpp \ 69 qdbusargument.cpp \ 70 qdbusreply.cpp \ 71 qdbusmetatype.cpp \ 72 qdbusextratypes.cpp \ 73 qdbusmarshaller.cpp \ 74 qdbuscontext.cpp \ 75 qdbuspendingcall.cpp \ 76 qdbuspendingreply.cpp \ 77 qdbus_symbols.cpp 78 48 qdbusconnection_p.h \ 49 qdbusmessage_p.h \ 50 qdbusinterface_p.h \ 51 qdbusxmlparser_p.h \ 52 qdbusabstractadaptor_p.h \ 53 qdbusargument_p.h \ 54 qdbusutil_p.h \ 55 qdbusabstractinterface_p.h \ 56 qdbuscontext_p.h \ 57 qdbusthreaddebug_p.h \ 58 qdbusintegrator_p.h \ 59 qdbuspendingcall_p.h \ 60 qdbus_symbols_p.h \ 61 qdbusservicewatcher.h 62 SOURCES += qdbusconnection.cpp \ 63 qdbusconnectioninterface.cpp \ 64 qdbuserror.cpp \ 65 qdbusintegrator.cpp \ 66 qdbusmessage.cpp \ 67 qdbusserver.cpp \ 68 qdbusabstractinterface.cpp \ 69 qdbusinterface.cpp \ 70 qdbusxmlparser.cpp \ 71 qdbusutil.cpp \ 72 qdbusintrospection.cpp \ 73 qdbusabstractadaptor.cpp \ 74 qdbusinternalfilters.cpp \ 75 qdbusmetaobject.cpp \ 76 qdbusxmlgenerator.cpp \ 77 qdbusmisc.cpp \ 78 qdbusargument.cpp \ 79 qdbusreply.cpp \ 80 qdbusmetatype.cpp \ 81 qdbusextratypes.cpp \ 82 qdbusmarshaller.cpp \ 83 qdbuscontext.cpp \ 84 qdbuspendingcall.cpp \ 85 qdbuspendingreply.cpp \ 86 qdbus_symbols.cpp \ 87 qdbusservicewatcher.cpp -
trunk/src/dbus/qdbus_symbols.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbus_symbols_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 354 354 (signature, error), return) 355 355 DEFINEFUNC(dbus_bool_t , dbus_type_is_basic, (int typecode), 356 (typecode), return) ;356 (typecode), return) 357 357 DEFINEFUNC(dbus_bool_t , dbus_type_is_fixed, (int typecode), 358 358 (typecode), return) 359 359 360 361 362 360 363 QT_END_NAMESPACE 361 364 -
trunk/src/dbus/qdbusabstractadaptor.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 265 265 void QDBusAdaptorConnector::relaySlot(void **argv) 266 266 { 267 QObjectPrivate *d = static_cast<QObjectPrivate *>(d_ptr );267 QObjectPrivate *d = static_cast<QObjectPrivate *>(d_ptr); 268 268 relay(d->currentSender->sender, d->currentSender->signal, argv); 269 269 } -
trunk/src/dbus/qdbusabstractadaptor.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusabstractadaptor_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusabstractinterface.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 #include "qdbusargument.h" 46 46 #include "qdbuspendingcall.h" 47 47 48 #include "qdbusmetaobject_p.h" 48 49 #include "qdbusmetatype_p.h" … … 52 53 53 54 QT_BEGIN_NAMESPACE 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 54 78 55 79 QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv, … … 58 82 const QDBusConnection& con, 59 83 bool isDynamic) 60 : connection(con), service(serv), path(p), interface(iface), isValid(true) 61 { 62 if (isDynamic) { 63 // QDBusInterface: service and object path can't be empty, but interface can 64 #if 0 65 Q_ASSERT_X(QDBusUtil::isValidBusName(service), 66 "QDBusInterface::QDBusInterface", "Invalid service name"); 67 Q_ASSERT_X(QDBusUtil::isValidObjectPath(path), 68 "QDBusInterface::QDBusInterface", "Invalid object path given"); 69 Q_ASSERT_X(interface.isEmpty() || QDBusUtil::isValidInterfaceName(interface), 70 "QDBusInterface::QDBusInterface", "Invalid interface name"); 71 #else 72 if (!QDBusUtil::isValidBusName(service)) { 73 lastError = QDBusError(QDBusError::Disconnected, 74 QLatin1String("Invalid service name")); 75 isValid = false; 76 } else if (!QDBusUtil::isValidObjectPath(path)) { 77 lastError = QDBusError(QDBusError::Disconnected, 78 QLatin1String("Invalid object name given")); 79 isValid = false; 80 } else if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) { 81 lastError = QDBusError(QDBusError::Disconnected, 82 QLatin1String("Invalid interface name")); 83 isValid = false; 84 } 85 #endif 86 } else { 87 // all others: service and path can be empty here, but interface can't 88 #if 0 89 Q_ASSERT_X(service.isEmpty() || QDBusUtil::isValidBusName(service), 90 "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid service name"); 91 Q_ASSERT_X(path.isEmpty() || QDBusUtil::isValidObjectPath(path), 92 "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid object path given"); 93 Q_ASSERT_X(QDBusUtil::isValidInterfaceName(interface), 94 "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid interface class!"); 95 #else 96 if (!service.isEmpty() && !QDBusUtil::isValidBusName(service)) { 97 lastError = QDBusError(QDBusError::Disconnected, 98 QLatin1String("Invalid service name")); 99 isValid = false; 100 } else if (!path.isEmpty() && !QDBusUtil::isValidObjectPath(path)) { 101 lastError = QDBusError(QDBusError::Disconnected, 102 QLatin1String("Invalid object path given")); 103 isValid = false; 104 } else if (!QDBusUtil::isValidInterfaceName(interface)) { 105 lastError = QDBusError(QDBusError::Disconnected, 106 QLatin1String("Invalid interface class")); 107 isValid = false; 108 } 109 #endif 110 } 111 84 : connection(con), service(serv), path(p), interface(iface), 85 lastError(checkIfValid(serv, p, iface, isDynamic)), 86 isValid(!lastError.isValid()) 87 { 112 88 if (!isValid) 113 89 return; … … 116 92 lastError = QDBusError(QDBusError::Disconnected, 117 93 QLatin1String("Not connected to D-Bus server")); 118 isValid = false;119 94 } else if (!service.isEmpty()) { 120 95 currentOwner = connectionPrivate()->getNameOwner(service); // verify the name owner 121 96 if (currentOwner.isEmpty()) { 122 isValid = false;123 97 lastError = connectionPrivate()->lastError; 124 98 } … … 126 100 } 127 101 128 QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const 129 { 130 if (!connection.isConnected()) // not connected 131 return QVariant(); 102 bool QDBusAbstractInterfacePrivate::canMakeCalls() const 103 { 104 // recheck only if we have a wildcard (i.e. empty) service or path 105 // if any are empty, set the error message according to QDBusUtil 106 if (service.isEmpty()) 107 return QDBusUtil::checkBusName(service, QDBusUtil::EmptyNotAllowed, &lastError); 108 if (path.isEmpty()) 109 return QDBusUtil::checkObjectPath(path, QDBusUtil::EmptyNotAllowed, &lastError); 110 return true; 111 } 112 113 void QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, QVariant &where) const 114 { 115 if (!isValid || !canMakeCalls()) { // can't make calls 116 where.clear(); 117 return; 118 } 132 119 133 120 // is this metatype registered? 134 int mid; 135 const char *expectedSignature; 136 if (mp.type() == QVariant::LastType) { 137 // We're asking to read a QVariant 138 mid = qMetaTypeId<QDBusVariant>(); 139 expectedSignature = "v"; 140 } else { 141 mid = QMetaType::type(mp.typeName()); 142 expectedSignature = QDBusMetaType::typeToSignature(mid); 121 const char *expectedSignature = ""; 122 if (mp.type() != 0xff) { 123 expectedSignature = QDBusMetaType::typeToSignature(where.userType()); 143 124 if (expectedSignature == 0) { 144 125 qWarning("QDBusAbstractInterface: type %s must be registered with QtDBus before it can be " 145 126 "used to read property %s.%s", 146 127 mp.typeName(), qPrintable(interface), mp.name()); 147 return QVariant(); 128 lastError = QDBusError(QDBusError::Failed, 129 QString::fromLatin1("Unregistered type %1 cannot be handled") 130 .arg(QLatin1String(mp.typeName()))); 131 where.clear(); 132 return; 148 133 } 149 134 } … … 153 138 QLatin1String(DBUS_INTERFACE_PROPERTIES), 154 139 QLatin1String("Get")); 140 155 141 msg << interface << QString::fromUtf8(mp.name()); 156 142 QDBusMessage reply = connection.call(msg, QDBus::Block); … … 158 144 if (reply.type() != QDBusMessage::ReplyMessage) { 159 145 lastError = reply; 160 return QVariant(); 146 where.clear(); 147 return; 161 148 } 162 149 if (reply.signature() != QLatin1String("v")) { … … 164 151 DBUS_INTERFACE_PROPERTIES); 165 152 lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature())); 166 return QVariant(); 153 where.clear(); 154 return; 167 155 } 168 156 … … 171 159 QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant(); 172 160 173 if (value.userType() == mid) 174 return value; // simple match 161 if (value.userType() == where.userType() || mp.type() == 0xff 162 || (expectedSignature[0] == 'v' && expectedSignature[1] == '\0')) { 163 // simple match 164 where = value; 165 return; 166 } 175 167 176 168 if (value.userType() == qMetaTypeId<QDBusArgument>()) { … … 180 172 foundSignature = arg.currentSignature().toLatin1(); 181 173 if (foundSignature == expectedSignature) { 182 void *null = 0; 183 QVariant result(mid, null); 184 QDBusMetaType::demarshall(arg, mid, result.data()); 185 186 if (mp.type() == QVariant::LastType) 187 // special case: QVariant 188 return qvariant_cast<QDBusVariant>(result).variant(); 189 return result; 174 // signatures match, we can demarshall 175 QDBusMetaType::demarshall(arg, where.userType(), where.data()); 176 return; 190 177 } 191 178 } else { … … 204 191 QString::fromLatin1(mp.typeName()), 205 192 QString::fromLatin1(expectedSignature))); 206 return QVariant(); 207 } 208 209 void QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value) 210 { 211 if (!connection.isConnected()) // not connected 212 return; 193 where.clear(); 194 return; 195 } 196 197 bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value) 198 { 199 if (!isValid || !canMakeCalls()) // can't make calls 200 return false; 213 201 214 202 // send the value … … 216 204 QLatin1String(DBUS_INTERFACE_PROPERTIES), 217 205 QLatin1String("Set")); 206 218 207 msg << interface << QString::fromUtf8(mp.name()) << qVariantFromValue(QDBusVariant(value)); 219 208 QDBusMessage reply = connection.call(msg, QDBus::Block); 220 209 221 if (reply.type() != QDBusMessage::ReplyMessage) 210 if (reply.type() != QDBusMessage::ReplyMessage) 222 211 lastError = reply; 212 213 214 223 215 } 224 216 … … 231 223 if (name == service) { 232 224 currentOwner = newOwner; 233 isValid = !newOwner.isEmpty(); 234 } 235 } 236 225 } 226 } 227 228 QDBusAbstractInterfaceBase::QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &d, QObject *parent) 229 : QObject(d, parent) 230 { 231 } 232 233 int QDBusAbstractInterfaceBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 234 { 235 int saved_id = _id; 236 _id = QObject::qt_metacall(_c, _id, _a); 237 if (_id < 0) 238 return _id; 239 240 if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty) { 241 QMetaProperty mp = metaObject()->property(saved_id); 242 int &status = *reinterpret_cast<int *>(_a[2]); 243 QVariant &variant = *reinterpret_cast<QVariant *>(_a[1]); 244 245 if (_c == QMetaObject::WriteProperty) { 246 status = d_func()->setProperty(mp, variant) ? 1 : 0; 247 } else { 248 d_func()->property(mp, variant); 249 status = variant.isValid() ? 1 : 0; 250 } 251 _id = -1; 252 } 253 return _id; 254 } 237 255 238 256 /*! … … 259 277 */ 260 278 QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, QObject *parent) 261 : Q Object(d, parent)279 : Q(d, parent) 262 280 { 263 281 // keep track of the service owner 264 if (d_func()->isValid) 265 QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), 266 this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); 282 if (d.isValid && 283 d.connection.isConnected() 284 && !d.service.isEmpty() 285 && !d.service.startsWith(QLatin1Char(':'))) 286 d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service 287 QString(), // path 288 QLatin1String(DBUS_INTERFACE_DBUS), // interface 289 QLatin1String("NameOwnerChanged"), 290 QStringList() << d.service, 291 QString(), // signature 292 this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); 267 293 } 268 294 … … 275 301 const char *interface, const QDBusConnection &con, 276 302 QObject *parent) 277 : Q Object(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface),303 : Q(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface), 278 304 con, false), parent) 279 305 { 280 306 // keep track of the service owner 281 if (d_func()->connection.isConnected()) 282 QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), 283 this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); 307 if (d_func()->isValid && 308 d_func()->connection.isConnected() 309 && !service.isEmpty() 310 && !service.startsWith(QLatin1Char(':'))) 311 d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service 312 QString(), // path 313 QLatin1String(DBUS_INTERFACE_DBUS), // interface 314 QLatin1String("NameOwnerChanged"), 315 QStringList() << service, 316 QString(), //signature 317 this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); 284 318 } 285 319 … … 301 335 bool QDBusAbstractInterface::isValid() const 302 336 { 303 return d_func()->isValid;337 return ; 304 338 } 305 339 … … 367 401 { 368 402 Q_D(QDBusAbstractInterface); 403 404 405 369 406 370 407 QString m = method; … … 398 435 // qDebug() << "QDBusAbstractInterface" << "Service" << service() << "Path:" << path(); 399 436 QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), m); 437 400 438 msg.setArguments(args); 401 439 … … 426 464 Q_D(QDBusAbstractInterface); 427 465 466 467 468 428 469 QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method); 470 429 471 msg.setArguments(args); 430 472 return d->connection.asyncCall(msg); … … 441 483 This function returns true if the queueing succeeds. It does 442 484 not indicate that the executed call succeeded. If it fails, 443 the \a errorMethod is called. 485 the \a errorMethod is called. If the queueing failed, this 486 function returns false and no slot will be called. 444 487 445 488 The \a returnMethod must have as its parameters the types returned … … 454 497 const QList<QVariant> &args, 455 498 QObject *receiver, 456 499 const char *returnMethod, 457 500 const char *errorMethod) 458 501 { 459 502 Q_D(QDBusAbstractInterface); 460 503 504 505 506 461 507 QDBusMessage msg = QDBusMessage::createMethodCall(service(), 462 path(), 463 interface(), 464 method); 508 path(), 509 interface(), 510 method); 511 QDBusMessagePrivate::setParametersValidated(msg, true); 465 512 msg.setArguments(args); 466 513 467 514 d->lastError = 0; 468 515 return d->connection.callWithCallback(msg, 469 470 471 516 receiver, 517 returnMethod, 518 errorMethod); 472 519 } 473 520 … … 493 540 const QList<QVariant> &args, 494 541 QObject *receiver, 495 542 const char *slot) 496 543 { 497 544 return callWithCallback(method, args, receiver, slot, 0); … … 504 551 void QDBusAbstractInterface::connectNotify(const char *signal) 505 552 { 553 554 555 556 557 506 558 // we end up recursing here, so optimise away 507 559 if (qstrcmp(signal + 1, "destroyed(QObject*)") == 0) 508 560 return; 509 561 510 // someone connecting to one of our signals 562 QDBusConnectionPrivate *conn = d->connectionPrivate(); 563 if (conn) { 564 conn->connectRelay(d->service, d->path, d->interface, 565 this, signal); 566 } 567 } 568 569 /*! 570 \internal 571 Catch signal disconnections. 572 */ 573 void QDBusAbstractInterface::disconnectNotify(const char *signal) 574 { 575 // someone disconnecting from one of our signals 511 576 Q_D(QDBusAbstractInterface); 577 578 512 579 513 580 QDBusConnectionPrivate *conn = d->connectionPrivate(); 514 581 if (conn) 515 conn->connectRelay(d->service, d->currentOwner, d->path, d->interface, 516 this, signal); 517 } 518 519 /*! 520 \internal 521 Catch signal disconnections. 522 */ 523 void QDBusAbstractInterface::disconnectNotify(const char *signal) 524 { 525 // someone disconnecting from one of our signals 526 Q_D(QDBusAbstractInterface); 527 528 QDBusConnectionPrivate *conn = d->connectionPrivate(); 529 if (conn) 530 conn->disconnectRelay(d->service, d->currentOwner, d->path, d->interface, 582 conn->disconnectRelay(d->service, d->path, d->interface, 531 583 this, signal); 532 584 } … … 541 593 // we're only called from generated code anyways 542 594 543 int idx = metaObject()->indexOfProperty(propname); 544 if (idx != -1) 545 return d_func()->property(metaObject()->property(idx)); 546 qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname); 547 return QVariant(); // error 595 return property(propname); 548 596 } 549 597 … … 554 602 void QDBusAbstractInterface::internalPropSet(const char *propname, const QVariant &value) 555 603 { 556 Q_D(QDBusAbstractInterface); 557 558 // assume this property exists and is writeable 559 // we're only called from generated code anyways 560 561 int idx = metaObject()->indexOfProperty(propname); 562 if (idx != -1) 563 d->setProperty(metaObject()->property(idx), value); 564 else 565 qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname); 604 setProperty(propname, value); 566 605 } 567 606 -
trunk/src/dbus/qdbusabstractinterface.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 62 62 63 63 class QDBusAbstractInterfacePrivate; 64 class QDBUS_EXPORT QDBusAbstractInterface: public QObject 64 65 class QDBUS_EXPORT QDBusAbstractInterfaceBase: public QObject 66 { 67 public: 68 int qt_metacall(QMetaObject::Call, int, void**); 69 protected: 70 QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent); 71 private: 72 Q_DECLARE_PRIVATE(QDBusAbstractInterface) 73 }; 74 75 class QDBUS_EXPORT QDBusAbstractInterface: 76 #ifdef Q_QDOC 77 public QObject 78 #else 79 public QDBusAbstractInterfaceBase 80 #endif 65 81 { 66 82 Q_OBJECT -
trunk/src/dbus/qdbusabstractinterface_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 76 76 QString interface; 77 77 mutable QDBusError lastError; 78 79 80 78 81 bool isValid; 79 82 … … 81 84 const QString &iface, const QDBusConnection& con, bool dynamic); 82 85 virtual ~QDBusAbstractInterfacePrivate() { } 86 83 87 84 88 // these functions do not check if the property is valid 85 QVariant property(const QMetaProperty &mp) const;86 voidsetProperty(const QMetaProperty &mp, const QVariant &value);89 ) const; 90 setProperty(const QMetaProperty &mp, const QVariant &value); 87 91 88 92 // return conn's d pointer -
trunk/src/dbus/qdbusargument.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusargument.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusargument_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 55 55 56 56 #include <qdbusargument.h> 57 #include <qdbus_symbols_p.h>57 #include 58 58 59 59 QT_BEGIN_NAMESPACE … … 131 131 void open(QDBusMarshaller &sub, int code, const char *signature); 132 132 void close(); 133 void error( );133 void error(); 134 134 135 135 bool appendVariantInternal(const QVariant &arg); … … 141 141 QDBusMarshaller *parent; 142 142 QByteArray *ba; 143 143 144 char closeCode; 144 145 bool ok; -
trunk/src/dbus/qdbusconnection.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 558 558 const QString &name, QObject *receiver, const char *slot) 559 559 { 560 return connect(service, path, interface, name, QString(), receiver, slot); 561 } 562 563 /*! 564 Disconnects the signal specified by the \a service, \a path, \a interface and \a name parameters from 565 the slot \a slot in object \a receiver. The arguments \a service and \a path can be empty, 566 denoting a disconnection from all signals of the (\a interface, \a name) pair, from all remote 567 applications. 568 569 Returns true if the disconnection was successful. 570 */ 571 bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface, 572 const QString &name, QObject *receiver, const char *slot) 573 { 574 return disconnect(service, path, interface, name, QString(), receiver, slot); 560 return connect(service, path, interface, name, QStringList(), QString(), receiver, slot); 575 561 } 576 562 … … 579 565 580 566 Connects the signal to the slot \a slot in object \a 581 receiver. Unlike the otherconnect() overload, this function567 receiver. Unlike the connect() overload, this function 582 568 allows one to specify the parameter signature to be connected 583 569 using the \a signature variable. The function will then verify … … 585 571 slot and return false otherwise. 586 572 573 574 587 575 \note This function verifies that the signal signature matches the 588 576 slot's parameters, but it does not verify that the actual … … 594 582 QObject *receiver, const char *slot) 595 583 { 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 596 615 if (!receiver || !slot || !d || !d->connection) 597 616 return false; … … 601 620 return false; 602 621 603 // check the slot604 QDBusConnectionPrivate::SignalHook hook;605 QString key;606 QString name2 = name;607 if (name2.isNull())608 name2.detach();609 610 QString owner = d->getNameOwner(service); // we don't care if the owner is empty611 hook.signature = signature; // it might get started later612 if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false))613 return false; // don't connect614 615 // avoid duplicating:616 622 QDBusWriteLocker locker(ConnectAction, d); 617 QDBusConnectionPrivate::SignalHookHash::ConstIterator it = d->signalHooks.find(key); 618 QDBusConnectionPrivate::SignalHookHash::ConstIterator end = d->signalHooks.constEnd(); 619 for ( ; it != end && it.key() == key; ++it) { 620 const QDBusConnectionPrivate::SignalHook &entry = it.value(); 621 if (entry.service == hook.service && 622 entry.owner == hook.owner && 623 entry.path == hook.path && 624 entry.signature == hook.signature && 625 entry.obj == hook.obj && 626 entry.midx == hook.midx) { 627 // no need to compare the parameters if it's the same slot 628 return true; // already there 629 } 630 } 631 632 d->connectSignal(key, hook); 633 return true; 623 return d->connectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot); 624 } 625 626 /*! 627 Disconnects the signal specified by the \a service, \a path, \a interface 628 and \a name parameters from the slot \a slot in object \a receiver. The 629 arguments must be the same as passed to the connect() function. 630 631 Returns true if the disconnection was successful. 632 */ 633 bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface, 634 const QString &name, QObject *receiver, const char *slot) 635 { 636 return disconnect(service, path, interface, name, QStringList(), QString(), receiver, slot); 634 637 } 635 638 … … 637 640 \overload 638 641 639 Disconnects the signal from the slot \a slot in object\a640 receiver. Unlike the other disconnect() overload, this function641 allows one to specify the parameter signature to be disconnected642 using the \a signature variable. The function will then verify643 that this signature is connected to the slot specified by \a slot 644 and return false otherwise.642 Disconnects the signal \a 643 n 644 645 646 647 . 645 648 */ 646 649 bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString& interface, 647 650 const QString &name, const QString &signature, 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 648 669 QObject *receiver, const char *slot) 649 670 { … … 655 676 return false; 656 677 657 // check the slot658 QDBusConnectionPrivate::SignalHook hook;659 QString key;660 QString name2 = name;661 if (name2.isNull())662 name2.detach();663 664 QString owner = d->getNameOwner(service); // we don't care of owner is empty665 hook.signature = signature;666 if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false))667 return false; // don't disconnect668 669 // avoid duplicating:670 678 QDBusWriteLocker locker(DisconnectAction, d); 671 QDBusConnectionPrivate::SignalHookHash::Iterator it = d->signalHooks.find(key); 672 QDBusConnectionPrivate::SignalHookHash::Iterator end = d->signalHooks.end(); 673 for ( ; it != end && it.key() == key; ++it) { 674 const QDBusConnectionPrivate::SignalHook &entry = it.value(); 675 if (entry.service == hook.service && 676 entry.owner == hook.owner && 677 entry.path == hook.path && 678 entry.signature == hook.signature && 679 entry.obj == hook.obj && 680 entry.midx == hook.midx) { 681 // no need to compare the parameters if it's the same slot 682 d->disconnectSignal(it); 683 return true; // it was there 684 } 685 } 686 687 // the slot was not found 688 return false; 679 return d->disconnectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot); 689 680 } 690 681 … … 974 965 975 966 /*! 967 968 976 969 Returns the connection that sent the signal, if called in a slot activated 977 970 by QDBus; otherwise it returns 0. 971 972 973 974 975 978 976 */ 979 977 QDBusConnection QDBusConnection::sender() … … 1006 1004 ref.deref(); // busService has increased the refcounting to us 1007 1005 // avoid cyclic refcounting 1008 // if (mode != PeerMode)1009 QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)),1010 this, SIGNAL(serviceOwnerChanged(QString,QString,QString)));1011 1006 1012 1007 QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), 1013 1008 busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), 1014 1009 Qt::QueuedConnection); 1015 1016 1010 } 1017 1011 -
trunk/src/dbus/qdbusconnection.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 133 133 bool connect(const QString &service, const QString &path, const QString &interface, 134 134 const QString &name, QObject *receiver, const char *slot); 135 bool disconnect(const QString &service, const QString &path, const QString &interface,136 const QString &name, QObject *receiver, const char *slot);137 138 135 bool connect(const QString &service, const QString &path, const QString &interface, 139 136 const QString &name, const QString& signature, 140 137 QObject *receiver, const char *slot); 138 139 140 141 142 143 141 144 bool disconnect(const QString &service, const QString &path, const QString &interface, 142 145 const QString &name, const QString& signature, 146 147 148 143 149 QObject *receiver, const char *slot); 144 150 -
trunk/src/dbus/qdbusconnection_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 68 68 #include <QtCore/qvector.h> 69 69 70 #include <qdbus_symbols_p.h>70 #include 71 71 72 72 #include <qdbusmessage.h> … … 120 120 { 121 121 inline SignalHook() : obj(0), midx(-1) { } 122 QString owner,service, path, signature;122 QString service, path, signature; 123 123 QObject* obj; 124 124 int midx; 125 125 QList<int> params; 126 126 127 QByteArray matchRule; 127 128 }; … … 156 157 typedef QHash<QByteArray, int> MatchRefCountHash; 157 158 159 160 161 162 163 164 165 158 166 public: 159 167 // public methods are entry points from other objects … … 176 184 int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, 177 185 const char *returnMethod, const char *errorMethod, int timeout = -1); 186 187 188 178 189 void connectSignal(const QString &key, const SignalHook &hook); 179 190 SignalHookHash::Iterator disconnectSignal(SignalHookHash::Iterator &it); 191 192 193 180 194 void registerObject(const ObjectTreeNode *node); 181 void connectRelay(const QString &service, const QString ¤tOwner,195 void connectRelay(const QString &service, 182 196 const QString &path, const QString &interface, 183 197 QDBusAbstractInterface *receiver, const char *signal); 184 void disconnectRelay(const QString &service, const QString ¤tOwner,198 void disconnectRelay(const QString &service, 185 199 const QString &path, const QString &interface, 186 200 QDBusAbstractInterface *receiver, const char *signal); … … 191 205 QDBusMetaObject *findMetaObject(const QString &service, const QString &path, 192 206 const QString &interface, QDBusError &error); 193 194 void registerService(const QString &serviceName);195 void unregisterService(const QString &serviceName);196 207 197 208 void postEventToThread(int action, QObject *target, QEvent *event); … … 218 229 219 230 bool isServiceRegisteredByThread(const QString &serviceName) const; 231 232 220 233 221 234 protected: … … 231 244 void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args); 232 245 void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); 246 247 233 248 234 249 signals: … … 265 280 266 281 QStringList serviceNames; 282 267 283 SignalHookHash signalHooks; 268 284 MatchRefCountHash matchRefCounts; … … 277 293 static int findSlot(QObject *obj, const QByteArray &normalizedName, QList<int>& params); 278 294 static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, 279 const QString &service, const QString &owner,295 const QString &service, 280 296 const QString &path, const QString &interface, const QString &name, 297 281 298 QObject *receiver, const char *signal, int minMIdx, 282 299 bool buildSignature); … … 301 318 extern int qDBusNameToTypeId(const char *name); 302 319 extern bool qDBusCheckAsyncTag(const char *tag); 320 321 303 322 304 323 // in qdbusinternalfilters.cpp … … 311 330 const QDBusMessage &msg); 312 331 313 // in qdbusxmlgenerator.cpp314 extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);315 316 332 QT_END_NAMESPACE 317 333 -
trunk/src/dbus/qdbusconnectioninterface.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 50 50 #include <QtCore/QDebug> 51 51 52 #include <qdbus_symbols_p.h>// for the DBUS_* constants52 #include // for the DBUS_* constants 53 53 54 54 QT_BEGIN_NAMESPACE … … 337 337 QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString))); 338 338 339 else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) 339 else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) { 340 static bool warningPrinted = false; 341 if (!warningPrinted) { 342 qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"); 343 warningPrinted = true; 344 } 340 345 QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString))); 346 341 347 } 342 348 … … 389 395 \a newOwner is empty, the name \a name has no current owner and is 390 396 no longer available. 397 398 399 400 401 402 391 403 */ 392 404 -
trunk/src/dbus/qdbusconnectioninterface.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbuscontext.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbuscontext.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 75 75 private: 76 76 QDBusContextPrivate *d_ptr; 77 Q_DECLARE_PRIVATE(QDBusContext)77 78 78 }; 79 79 -
trunk/src/dbus/qdbuscontext_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusdemarshaller.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbuserror.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 #include <qvarlengtharray.h> 46 46 47 #include <qdbus_symbols_p.h>47 #include 48 48 #include "qdbusmessage.h" 49 49 #include "qdbusmessage_p.h" … … 92 92 com.trolltech.QtDBus.Error.InternalError 93 93 org.freedesktop.DBus.Error.UnknownObject 94 95 96 97 94 98 */ 95 99 … … 117 121 "com.trolltech.QtDBus.Error.InternalError\0" 118 122 "org.freedesktop.DBus.Error.UnknownObject\0" 123 124 125 126 119 127 "\0"; 120 128 … … 122 130 0, 6, 40, 76, 118, 153, 191, 231, 123 131 273, 313, 349, 384, 421, 461, 501, 540, 124 581, 617, 661, 705, 746, 0 132 581, 617, 661, 705, 746, 787, 829, 874, 133 918, 0 125 134 }; 126 135 … … 217 226 \value InternalError An internal error occurred 218 227 (\c com.trolltech.QtDBus.Error.InternalError) 228 229 230 231 232 233 234 235 236 219 237 \value UnknownObject The remote object could not be found. 220 221 238 */ 222 239 … … 340 357 QDebug operator<<(QDebug dbg, const QDBusError &msg) 341 358 { 342 dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ")";359 dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ; 343 360 return dbg.space(); 344 361 } -
trunk/src/dbus/qdbuserror.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 82 82 InternalError, 83 83 UnknownObject, 84 85 86 87 84 88 85 89 #ifndef Q_QDOC 86 90 // don't use this one! 87 LastErrorType = UnknownObject91 LastErrorType = 88 92 #endif 89 93 }; -
trunk/src/dbus/qdbusextratypes.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusextratypes.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 175 175 { QVariant::operator=(dBusVariant); } 176 176 177 178 179 177 180 QT_END_NAMESPACE 178 181 -
trunk/src/dbus/qdbusintegrator.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 75 75 if (th && !th->objectName().isEmpty()) 76 76 dbg.nospace() << ", name=" << th->objectName(); 77 dbg.nospace() << ")";77 dbg.nospace() << ; 78 78 return dbg.space(); 79 79 } … … 91 91 else 92 92 dbg.nospace() << conn->thread(); 93 dbg.nospace() << ")";93 dbg.nospace() << ; 94 94 return dbg.space(); 95 95 } … … 391 391 } // extern "C" 392 392 393 static QByteArray buildMatchRule(const QString &service, const QString & /*owner*/,393 static QByteArray buildMatchRule(const QString &service, 394 394 const QString &objectPath, const QString &interface, 395 const QString &member, const QString & /*signature*/)395 const QString &member, const QString & /*signature*/) 396 396 { 397 397 QString result = QLatin1String("type='signal',"); … … 406 406 if (!member.isEmpty()) 407 407 result += keyValue.arg(QLatin1String("member"), member); 408 409 410 411 412 413 414 415 408 416 409 417 result.chop(1); // remove ending comma … … 492 500 // object not found 493 501 return 0; 502 503 504 505 506 494 507 } 495 508 … … 566 579 QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = haystack.children.constEnd(); 567 580 for ( ; it != end; ++it) 568 huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1 String("/") + it->name);581 huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1) + it->name); 569 582 570 583 if (needle == haystack.obj) { … … 921 934 rootNode(QString(QLatin1Char('/'))) 922 935 { 923 static const bool threads = qDBusInitThreads(); 924 static const int debugging = ::isDebugging = qgetenv("QDBUS_DEBUG").toInt(); 936 static const bool threads = q_dbus_threads_init_default(); 937 static const int debugging = qgetenv("QDBUS_DEBUG").toInt(); 938 ::isDebugging = debugging; 925 939 Q_UNUSED(threads) 940 926 941 927 942 #ifdef QDBUS_THREAD_DEBUG … … 933 948 934 949 rootNode.flags = 0; 935 936 connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)),937 this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));938 950 } 939 951 … … 1103 1115 1104 1116 for (int i = 0; i < pendingWatches.size(); ++i) 1105 if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_ READABLE))1117 if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_ABLE)) 1106 1118 qDebug("OUT OF MEM"); 1107 1119 } … … 1126 1138 const QVariantList &args) 1127 1139 { 1128 int mciid = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE); 1129 Q_ASSERT(mciid != -1); 1130 1131 QMetaClassInfo mci = mo->classInfo(mciid); 1132 Q_ASSERT(mci.value()); 1133 const char *interface = mci.value(); 1140 QString interface = qDBusInterfaceFromMetaObject(mo); 1134 1141 1135 1142 QMetaMethod mm = mo->method(signalId); … … 1147 1154 1148 1155 QDBusReadLocker locker(RelaySignalAction, this); 1149 QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), QLatin1String(interface),1156 QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), , 1150 1157 QLatin1String(memberName)); 1158 1151 1159 message.setArguments(args); 1152 DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); 1160 QDBusError error; 1161 DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error); 1153 1162 if (!msg) { 1154 qWarning("QDBusConnection: Could not emit signal %s.%s", interface, memberName.constData()); 1163 qWarning("QDBusConnection: Could not emit signal %s.%s: %s", qPrintable(interface), memberName.constData(), 1164 qPrintable(error.message())); 1165 lastError = error; 1155 1166 return; 1156 1167 } … … 1166 1177 const QString &oldOwner, const QString &newOwner) 1167 1178 { 1168 if (oldOwner == baseService) 1169 unregisterService(name); 1170 if (newOwner == baseService) 1171 registerService(name); 1172 1179 Q_UNUSED(oldOwner); 1173 1180 QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this); 1174 QMutableHashIterator<QString, SignalHook> it(signalHooks); 1175 it.toFront(); 1176 while (it.hasNext()) 1177 if (it.next().value().service == name) 1178 it.value().owner = newOwner; 1181 WatchedServicesHash::Iterator it = watchedServices.find(name); 1182 if (it == watchedServices.end()) 1183 return; 1184 if (oldOwner != it->owner) 1185 qWarning("QDBusConnection: name '%s' had owner '%s' but we thought it was '%s'", 1186 qPrintable(name), qPrintable(oldOwner), qPrintable(it->owner)); 1187 1188 qDBusDebug() << this << "Updating name" << name << "from" << oldOwner << "to" << newOwner; 1189 it->owner = newOwner; 1179 1190 } 1180 1191 … … 1194 1205 1195 1206 bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, 1196 const QString &service, const QString &owner,1207 const QString &service, 1197 1208 const QString &path, const QString &interface, const QString &name, 1209 1198 1210 QObject *receiver, const char *signal, int minMIdx, 1199 1211 bool buildSignature) … … 1212 1224 1213 1225 hook.service = service; 1214 hook.owner = owner; // we don't care if the service has an owner yet1215 1226 hook.path = path; 1216 1227 hook.obj = receiver; 1228 1217 1229 1218 1230 // build the D-Bus signal name and signature … … 1236 1248 } 1237 1249 1238 hook.matchRule = buildMatchRule(service, owner, path, interface, mname, hook.signature);1250 hook.matchRule = buildMatchRule(service, , hook.signature); 1239 1251 return true; // connect to this signal 1240 1252 } … … 1365 1377 if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots)) { 1366 1378 bool interfaceFound = true; 1367 if (!msg.interface().isEmpty()) { 1368 // check if the interface name matches anything in the class hierarchy 1369 const QMetaObject *mo = node.obj->metaObject(); 1370 for ( ; !interfaceFound && mo != &QObject::staticMetaObject; mo = mo->superClass()) 1371 interfaceFound = msg.interface() == qDBusInterfaceFromMetaObject(mo); 1372 } 1379 if (!msg.interface().isEmpty()) 1380 interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface()); 1373 1381 1374 1382 if (interfaceFound) { … … 1483 1491 for ( ; it != end && it.key() == key; ++it) { 1484 1492 const SignalHook &hook = it.value(); 1485 if (!hook.owner.isEmpty() && hook.owner != msg.service()) 1486 continue; 1493 if (!hook.service.isEmpty()) { 1494 const QString owner = 1495 shouldWatchService(hook.service) ? 1496 watchedServices.value(hook.service).owner : 1497 hook.service; 1498 if (owner != msg.service()) 1499 continue; 1500 } 1487 1501 if (!hook.path.isEmpty() && hook.path != msg.path()) 1488 1502 continue; … … 1491 1505 if (hook.signature.isEmpty() && !hook.signature.isNull() && !msg.signature().isEmpty()) 1492 1506 continue; 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1493 1525 1494 1526 activateSignal(hook, msg); … … 1625 1657 baseService = QString::fromUtf8(service); 1626 1658 } else { 1627 qWarning("QDBusConnectionPrivate::SetConnection: Unable to get base service"); 1628 } 1659 qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service"); 1660 } 1661 1662 QString busService = QLatin1String(DBUS_SERVICE_DBUS); 1663 WatchedServicesHash::mapped_type &bus = watchedServices[busService]; 1664 bus.refcount = 1; 1665 bus.owner = getNameOwnerNoCache(busService); 1666 connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), 1667 this, SLOT(registerService(QString))); 1668 connectSignal(busService, QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(), 1669 this, SLOT(unregisterService(QString))); 1670 1629 1671 1630 1672 q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); … … 1708 1750 // through the d_ptr->localReply link 1709 1751 1710 DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); 1752 QDBusError error; 1753 DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error); 1711 1754 if (!msg) { 1712 1755 if (message.type() == QDBusMessage::MethodCallMessage) 1713 qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\" ",1756 qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"", 1714 1757 qPrintable(message.service()), qPrintable(message.path()), 1715 qPrintable(message.interface()), qPrintable(message.member())); 1758 qPrintable(message.interface()), qPrintable(message.member()), 1759 qPrintable(error.message())); 1716 1760 else if (message.type() == QDBusMessage::SignalMessage) 1717 qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\" ",1761 qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\"", 1718 1762 qPrintable(message.path()), qPrintable(message.interface()), 1719 qPrintable(message.member())); 1763 qPrintable(message.member()), 1764 qPrintable(error.message())); 1720 1765 else 1721 qWarning("QDBusConnection: error: could not send %s message to service \"%s\" ",1766 qWarning("QDBusConnection: error: could not send %s message to service \"%s\"", 1722 1767 message.type() == QDBusMessage::ReplyMessage ? "reply" : 1723 1768 message.type() == QDBusMessage::ErrorMessage ? "error" : 1724 "invalid", qPrintable(message.service())); 1769 "invalid", qPrintable(message.service()), 1770 qPrintable(error.message())); 1771 lastError = error; 1725 1772 return 0; 1726 1773 } … … 1749 1796 1750 1797 if (!QCoreApplication::instance() || sendMode == QDBus::Block) { 1751 DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); 1798 QDBusError err; 1799 DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &err); 1752 1800 if (!msg) { 1753 qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\" ",1801 qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"", 1754 1802 qPrintable(message.service()), qPrintable(message.path()), 1755 qPrintable(message.interface()), qPrintable(message.member())); 1756 return QDBusMessage(); 1803 qPrintable(message.interface()), qPrintable(message.member()), 1804 qPrintable(err.message())); 1805 lastError = err; 1806 return QDBusMessage::createError(err); 1757 1807 } 1758 1808 … … 1764 1814 1765 1815 if (!!error) { 1766 QDBusError qe = error; 1767 lastError = qe; 1768 return QDBusMessage::createError(qe); 1816 lastError = err = error; 1817 return QDBusMessage::createError(err); 1769 1818 } 1770 1819 … … 1776 1825 } else { // use the event loop 1777 1826 QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); 1778 if (!pcall) 1779 return QDBusMessage(); 1780 1781 pcall->watcherHelper = new QDBusPendingCallWatcherHelper; 1782 QEventLoop loop; 1783 loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit())); 1784 loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit())); 1785 1786 // enter the event loop and wait for a reply 1787 loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); 1827 Q_ASSERT(pcall); 1828 1829 if (pcall->replyMessage.type() != QDBusMessage::InvalidMessage) { 1830 pcall->watcherHelper = new QDBusPendingCallWatcherHelper; 1831 QEventLoop loop; 1832 loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit())); 1833 loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit())); 1834 1835 // enter the event loop and wait for a reply 1836 loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); 1837 } 1788 1838 1789 1839 QDBusMessage reply = pcall->replyMessage; … … 1841 1891 } 1842 1892 1843 DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);1844 if (!msg) {1845 qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",1846 qPrintable(message.service()), qPrintable(message.path()),1847 qPrintable(message.interface()), qPrintable(message.member()));1848 return 0;1849 }1850 1851 1893 checkThread(); 1852 qDBusDebug() << QThread::currentThread() << "sending message (async):" << message;1853 DBusPendingCall *pending = 0;1854 1894 QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate; 1855 1895 pcall->sentMessage = message; 1856 1896 pcall->ref = 0; 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1857 1912 1858 1913 QDBusDispatchLocker locker(SendWithReplyAsyncAction, this); … … 1868 1923 } else { 1869 1924 // we're probably disconnected at this point 1870 lastError = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server"));1925 lastError = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server")); 1871 1926 } 1872 1927 } else { 1873 lastError = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory"));1928 lastError = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory")); 1874 1929 } 1875 1930 1876 1931 q_dbus_message_unref(msg); 1877 pcall->replyMessage = QDBusMessage::createError( lastError);1932 pcall->replyMessage = QDBusMessage::createError(rror); 1878 1933 return pcall; 1879 1934 } … … 1884 1939 { 1885 1940 QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); 1886 if (!pcall) 1887 return 0; 1941 Q_ASSERT(pcall); 1888 1942 1889 1943 // has it already finished (dispatched locally)? … … 1926 1980 } 1927 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 1928 2017 void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook &hook) 1929 2018 { 1930 2019 signalHooks.insertMulti(key, hook); 1931 2020 connect(hook.obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)), 1932 Qt:: DirectConnection);2021 Qt::); 1933 2022 1934 2023 MatchRefCountHash::iterator it = matchRefCounts.find(hook.matchRule); … … 1953 2042 qPrintable(qerror.name()), qPrintable(qerror.message())); 1954 2043 Q_ASSERT(false); 1955 } 1956 } 2044 } else { 2045 // Successfully connected the signal 2046 // Do we need to watch for this name? 2047 if (shouldWatchService(hook.service)) { 2048 WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; 2049 if (data.refcount) { 2050 // already watching 2051 ++data.refcount; 2052 } else { 2053 // we need to watch for this service changing 2054 QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); 2055 connectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), 2056 QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), 2057 this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); 2058 data.owner = getNameOwnerNoCache(hook.service); 2059 qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" 2060 << data.owner << ")"; 2061 } 2062 } 2063 } 2064 } 2065 } 2066 2067 bool QDBusConnectionPrivate::disconnectSignal(const QString &service, 2068 const QString &path, const QString &interface, const QString &name, 2069 const QStringList &argumentMatch, const QString &signature, 2070 QObject *receiver, const char *slot) 2071 { 2072 // check the slot 2073 QDBusConnectionPrivate::SignalHook hook; 2074 QString key; 2075 QString name2 = name; 2076 if (name2.isNull()) 2077 name2.detach(); 2078 2079 hook.signature = signature; 2080 if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false)) 2081 return false; // don't disconnect 2082 2083 // avoid duplicating: 2084 QDBusConnectionPrivate::SignalHookHash::Iterator it = signalHooks.find(key); 2085 QDBusConnectionPrivate::SignalHookHash::Iterator end = signalHooks.end(); 2086 for ( ; it != end && it.key() == key; ++it) { 2087 const QDBusConnectionPrivate::SignalHook &entry = it.value(); 2088 if (entry.service == hook.service && 2089 entry.path == hook.path && 2090 entry.signature == hook.signature && 2091 entry.obj == hook.obj && 2092 entry.midx == hook.midx) { 2093 // no need to compare the parameters if it's the same slot 2094 disconnectSignal(it); 2095 return true; // it was there 2096 } 2097 } 2098 2099 // the slot was not found 2100 return false; 1957 2101 } 1958 2102 … … 1961 2105 { 1962 2106 const SignalHook &hook = it.value(); 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 1963 2120 1964 2121 bool erase = false; … … 2010 2167 } 2011 2168 2012 void QDBusConnectionPrivate::connectRelay(const QString &service, const QString &owner,2169 void QDBusConnectionPrivate::connectRelay(const QString &service, 2013 2170 const QString &path, const QString &interface, 2014 2171 QDBusAbstractInterface *receiver, … … 2020 2177 QString key; 2021 2178 2022 if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal,2179 if (!prepareHook(hook, key, service, (), receiver, signal, 2023 2180 QDBusAbstractInterface::staticMetaObject.methodCount(), true)) 2024 2181 return; // don't connect … … 2031 2188 const SignalHook &entry = it.value(); 2032 2189 if (entry.service == hook.service && 2033 entry.owner == hook.owner &&2034 2190 entry.path == hook.path && 2035 2191 entry.signature == hook.signature && … … 2042 2198 } 2043 2199 2044 void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QString &owner,2200 void QDBusConnectionPrivate::disconnectRelay(const QString &service, 2045 2201 const QString &path, const QString &interface, 2046 2202 QDBusAbstractInterface *receiver, … … 2052 2208 QString key; 2053 2209 2054 if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal,2210 if (!prepareHook(hook, key, service, (), receiver, signal, 2055 2211 QDBusAbstractInterface::staticMetaObject.methodCount(), true)) 2056 2212 return; // don't connect … … 2063 2219 const SignalHook &entry = it.value(); 2064 2220 if (entry.service == hook.service && 2065 entry.owner == hook.owner &&2066 2221 entry.path == hook.path && 2067 2222 entry.signature == hook.signature && … … 2081 2236 if (QDBusUtil::isValidUniqueConnectionName(serviceName)) 2082 2237 return serviceName; 2083 if (!connection || !QDBusUtil::isValidBusName(serviceName))2238 if (!connection) 2084 2239 return QString(); 2085 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2086 2255 QDBusMessage msg = QDBusMessage::createMethodCall(QLatin1String(DBUS_SERVICE_DBUS), 2087 2256 QLatin1String(DBUS_PATH_DBUS), QLatin1String(DBUS_INTERFACE_DBUS), 2088 2257 QLatin1String("GetNameOwner")); 2258 2089 2259 msg << serviceName; 2090 2260 QDBusMessage reply = sendWithReply(msg, QDBus::Block); … … 2110 2280 QLatin1String(DBUS_INTERFACE_INTROSPECTABLE), 2111 2281 QLatin1String("Introspect")); 2282 2112 2283 2113 2284 QDBusMessage reply = sendWithReply(msg, QDBus::Block); -
trunk/src/dbus/qdbusintegrator_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 55 55 #define QDBUSINTEGRATOR_P_H 56 56 57 #include <qdbus_symbols_p.h>57 #include 58 58 59 59 #include "qcoreevent.h" -
trunk/src/dbus/qdbusinterface.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include "qdbusinterface.h" 43 43 44 #include <qdbus_symbols_p.h>44 #include 45 45 #include <QtCore/qpointer.h> 46 46 #include <QtCore/qstringlist.h> … … 52 52 QT_BEGIN_NAMESPACE 53 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 54 150 QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p, 55 151 const QString &iface, const QDBusConnection &con) … … 62 158 if (!metaObject) { 63 159 // creation failed, somehow 64 isValid = false; 160 // most common causes are that the service doesn't exist or doesn't support introspection 161 // those are not fatal errors, so we continue working 162 65 163 if (!lastError.isValid()) 66 164 lastError = QDBusError(QDBusError::InternalError, QLatin1String("Unknown error")); … … 137 235 const QMetaObject *QDBusInterface::metaObject() const 138 236 { 139 return d_func()-> isValid? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject;237 return d_func()-> ? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject; 140 238 } 141 239 … … 187 285 // we will assume that the input arguments were passed correctly 188 286 QVariantList args; 189 for (int i = 1; i <= inputTypesCount; ++i) 287 int i = 1; 288 for ( ; i <= inputTypesCount; ++i) 190 289 args << QVariant(inputTypes[i], argv[i]); 191 290 192 291 // make the call 193 QPointer<QDBusInterface> qq = q;194 292 QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args); 195 args.clear(); 196 197 // we ignore return values 198 199 // access to "this" or to "q" below this point must check for "qq" 200 // we may have been deleted! 201 202 if (!qq.isNull()) 203 lastError = reply; 293 294 if (reply.type() == QDBusMessage::ReplyMessage) { 295 // attempt to demarshall the return values 296 args = reply.arguments(); 297 QVariantList::ConstIterator it = args.constBegin(); 298 const int *outputTypes = metaObject->outputTypesForMethod(id); 299 int outputTypesCount = *outputTypes++; 300 301 if (*mm.typeName()) { 302 // this method has a return type 303 if (argv[0] && it != args.constEnd()) 304 copyArgument(argv[0], *outputTypes++, *it); 305 306 // skip this argument even if we didn't copy it 307 --outputTypesCount; 308 ++it; 309 } 310 311 for (int j = 0; j < outputTypesCount && it != args.constEnd(); ++i, ++j, ++it) { 312 copyArgument(argv[i], outputTypes[j], *it); 313 } 314 } 204 315 205 316 // done 317 206 318 return -1; 207 319 } 208 } else if (c == QMetaObject::ReadProperty) {209 // Qt doesn't support non-readable properties210 // we have to re-check211 QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset());212 if (!mp.isReadable())213 return -1; // don't read214 215 QVariant *value = reinterpret_cast<QVariant*>(argv[1]);216 argv[1] = 0;217 *value = property(mp);218 219 return -1; // handled, error or not220 } else if (c == QMetaObject::WriteProperty) {221 // QMetaProperty::write has already checked that we're writable222 // it has also checked that the type is right223 QVariant *value = reinterpret_cast<QVariant *>(argv[1]);224 QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset());225 226 setProperty(mp, *value);227 return -1;228 320 } 229 321 return id; -
trunk/src/dbus/qdbusinterface.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusinterface_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 55 55 #define QDBUSINTERFACEPRIVATE_H 56 56 57 #include <qdbusabstractinterface_p.h>58 #include <qdbusmetaobject_p.h>57 #include 58 #include 59 59 #include <qdbusinterface.h> 60 60 -
trunk/src/dbus/qdbusinternalfilters.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include "qdbusconnection_p.h" 43 43 44 #include <qdbus_symbols_p.h>44 #include 45 45 #include <QtCore/qcoreapplication.h> 46 46 #include <QtCore/qmetaobject.h> … … 54 54 #include "qdbusmessage.h" 55 55 #include "qdbusmetatype.h" 56 56 57 #include "qdbusmessage_p.h" 57 58 #include "qdbusutil_p.h" … … 178 179 // implement the D-Bus interface org.freedesktop.DBus.Properties 179 180 180 static QDBusMessage qDBusPropertyError(const QDBusMessage &msg, const QString &interface_name)181 { 182 return msg.createErrorReply(Q Latin1String(DBUS_ERROR_INVALID_ARGS),181 static Error(const QDBusMessage &msg, const QString &interface_name) 182 { 183 return msg.createErrorReply(Q, 183 184 QString::fromLatin1("Interface %1 was not found in object %2") 184 185 .arg(interface_name) 185 186 .arg(msg.path())); 187 188 189 190 191 192 193 194 195 196 197 186 198 } 187 199 … … 199 211 QDBusAdaptorConnector *connector; 200 212 QVariant value; 213 201 214 if (node.flags & QDBusConnection::ExportAdaptors && 202 215 (connector = qDBusFindAdaptorConnector(node.obj))) { … … 218 231 it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), 219 232 interface_name); 220 if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) 233 if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { 234 interfaceFound = true; 221 235 value = it->adaptor->property(property_name); 222 } 223 } 224 225 if (!value.isValid() && node.flags & (QDBusConnection::ExportAllProperties | 226 QDBusConnection::ExportNonScriptableProperties)) { 236 } 237 } 238 } 239 240 if (!interfaceFound && !value.isValid() 241 && node.flags & (QDBusConnection::ExportAllProperties | 242 QDBusConnection::ExportNonScriptableProperties)) { 227 243 // try the object itself 228 int pidx = node.obj->metaObject()->indexOfProperty(property_name); 229 if (pidx != -1) { 230 QMetaProperty mp = node.obj->metaObject()->property(pidx); 231 if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || 232 (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) 233 value = mp.read(node.obj); 244 if (!interface_name.isEmpty()) 245 interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); 246 247 if (interfaceFound) { 248 int pidx = node.obj->metaObject()->indexOfProperty(property_name); 249 if (pidx != -1) { 250 QMetaProperty mp = node.obj->metaObject()->property(pidx); 251 if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || 252 (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) 253 value = mp.read(node.obj); 254 } 234 255 } 235 256 } … … 237 258 if (!value.isValid()) { 238 259 // the property was not found 239 return qDBusPropertyError(msg, interface_name); 260 if (!interfaceFound) 261 return interfaceNotFoundError(msg, interface_name); 262 return propertyNotFoundError(msg, interface_name, property_name); 240 263 } 241 264 242 265 return msg.createReply(qVariantFromValue(QDBusVariant(value))); 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 243 347 } 244 348 … … 264 368 for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), 265 369 end = connector->adaptors.constEnd(); it != end; ++it) { 266 const QMetaObject *mo = it->adaptor->metaObject(); 267 int pidx = mo->indexOfProperty(property_name); 268 if (pidx != -1) { 269 mo->property(pidx).write(it->adaptor, value); 270 return msg.createReply(); 271 } 370 int status = writeProperty(it->adaptor, property_name, value); 371 if (status == PropertyNotFound) 372 continue; 373 return propertyWriteReply(msg, interface_name, property_name, status); 272 374 } 273 375 } else { … … 275 377 it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), 276 378 interface_name); 277 if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) 278 if (it->adaptor->setProperty(property_name, value)) 279 return msg.createReply(); 379 if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) { 380 return propertyWriteReply(msg, interface_name, property_name, 381 writeProperty(it->adaptor, property_name, value)); 382 } 280 383 } 281 384 } … … 284 387 QDBusConnection::ExportNonScriptableProperties)) { 285 388 // try the object itself 286 int pidx = node.obj->metaObject()->indexOfProperty(property_name); 287 if (pidx != -1) { 288 QMetaProperty mp = node.obj->metaObject()->property(pidx); 289 if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || 290 (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) 291 if (mp.write(node.obj, value)) 292 return msg.createReply(); 293 } 294 } 295 296 // the property was not found or not written to 297 return qDBusPropertyError(msg, interface_name); 389 bool interfaceFound = true; 390 if (!interface_name.isEmpty()) 391 interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); 392 393 if (interfaceFound) { 394 return propertyWriteReply(msg, interface_name, property_name, 395 writeProperty(node.obj, property_name, value, node.flags)); 396 } 397 } 398 399 // the property was not found 400 if (!interface_name.isEmpty()) 401 return interfaceNotFoundError(msg, interface_name); 402 return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); 298 403 } 299 404 … … 386 491 if (!interfaceFound && !interface_name.isEmpty()) { 387 492 // the interface was not found 388 return qDBusPropertyError(msg, interface_name);493 return Error(msg, interface_name); 389 494 } 390 495 -
trunk/src/dbus/qdbusintrospection.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusintrospection_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusmacros.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusmarshaller.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 122 122 QByteArray data = arg.path().toUtf8(); 123 123 if (!ba && data.isEmpty()) 124 error( );124 error(); 125 125 const char *cdata = data.constData(); 126 126 qIterAppend(&iterator, ba, DBUS_TYPE_OBJECT_PATH, &cdata); … … 131 131 QByteArray data = arg.signature().toUtf8(); 132 132 if (!ba && data.isEmpty()) 133 error( );133 error(); 134 134 const char *cdata = data.constData(); 135 135 qIterAppend(&iterator, ba, DBUS_TYPE_SIGNATURE, &cdata); … … 162 162 if (id == QVariant::Invalid) { 163 163 qWarning("QDBusMarshaller: cannot add a null QDBusVariant"); 164 error( );164 error(); 165 165 return false; 166 166 } … … 181 181 "Use qDBusRegisterMetaType to register it", 182 182 QVariant::typeToName( id ), id); 183 error(); 183 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 184 .arg(QLatin1String(QVariant::typeToName(id)))); 184 185 return false; 185 186 } … … 221 222 "Use qDBusRegisterMetaType to register it", 222 223 QVariant::typeToName( QVariant::Type(id) ), id); 223 error(); 224 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 225 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id))))); 224 226 return this; 225 227 } … … 235 237 "Use qDBusRegisterMetaType to register it", 236 238 QVariant::typeToName( QVariant::Type(kid) ), kid); 237 error(); 239 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 240 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid))))); 238 241 return this; 239 242 } … … 241 244 qWarning("QDBusMarshaller: type '%s' (%d) cannot be used as the key type in a D-BUS map.", 242 245 QVariant::typeToName( QVariant::Type(kid) ), kid); 243 error(); 246 error(QString::fromLatin1("Type %1 passed in arguments cannot be used as a key in a map") 247 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid))))); 244 248 return this; 245 249 } … … 247 251 const char *vsignature = QDBusMetaType::typeToSignature( QVariant::Type(vid) ); 248 252 if (!vsignature) { 253 249 254 qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. " 250 255 "Use qDBusRegisterMetaType to register it", 251 QVariant::typeToName( QVariant::Type(vid) ), vid); 252 error(); 256 typeName, vid); 257 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 258 .arg(QLatin1String(typeName))); 253 259 return this; 254 260 } … … 329 335 } 330 336 331 void QDBusMarshaller::error( )337 void QDBusMarshaller::error() 332 338 { 333 339 ok = false; 334 340 if (parent) 335 parent->error(); 341 parent->error(msg); 342 else 343 errorString = msg; 336 344 } 337 345 … … 341 349 if (id == QVariant::Invalid) { 342 350 qWarning("QDBusMarshaller: cannot add an invalid QVariant"); 343 error( );351 error(); 344 352 return false; 345 353 } … … 372 380 "Use qDBusRegisterMetaType to register it", 373 381 QVariant::typeToName( QVariant::Type(id) ), id); 374 error(); 382 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 383 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id))))); 375 384 return false; 376 385 } … … 379 388 #ifdef __OPTIMIZE__ 380 389 case DBUS_TYPE_BYTE: 381 case DBUS_TYPE_BOOLEAN:382 390 case DBUS_TYPE_INT16: 383 391 case DBUS_TYPE_UINT16: … … 389 397 qIterAppend(&iterator, ba, *signature, arg.constData()); 390 398 return true; 391 392 case DBUS_TYPE_STRING: 393 case DBUS_TYPE_OBJECT_PATH: 394 case DBUS_TYPE_SIGNATURE: { 395 const QByteArray data = 396 reinterpret_cast<const QString *>(arg.constData())->toUtf8(); 397 const char *rawData = data.constData(); 398 qIterAppend(&iterator, ba, *signature, &rawData); 399 return true; 400 } 399 case DBUS_TYPE_BOOLEAN: 400 append( arg.toBool() ); 401 return true; 401 402 #else 402 403 case DBUS_TYPE_BYTE: … … 427 428 append( arg.toDouble() ); 428 429 return true; 430 431 429 432 case DBUS_TYPE_STRING: 430 433 append( arg.toString() ); … … 436 439 append( qvariant_cast<QDBusSignature>(arg) ); 437 440 return true; 438 #endif439 441 440 442 // compound types: -
trunk/src/dbus/qdbusmessage.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 #include <qstringlist.h> 46 46 47 #include <qdbus_symbols_p.h>47 #include 48 48 49 49 #include "qdbusargument_p.h" … … 63 63 QDBusMessagePrivate::QDBusMessagePrivate() 64 64 : msg(0), reply(0), type(DBUS_MESSAGE_TYPE_INVALID), 65 timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false) 65 timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false), 66 parametersValidated(false) 66 67 { 67 68 } … … 95 96 Constructs a DBusMessage object from this object. The returned value must be de-referenced 96 97 with q_dbus_message_unref. 97 */ 98 DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) 99 { 100 if (!qdbus_loadLibDBus()) 98 99 The \a error object is set to indicate the error if anything went wrong with the 100 marshalling. Usually, this error message will be placed in the reply, as if the call failed. 101 The \a error pointer must not be null. 102 */ 103 DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDBusError *error) 104 { 105 if (!qdbus_loadLibDBus()) { 106 *error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library")); 101 107 return 0; 108 102 109 103 110 DBusMessage *msg = 0; … … 109 116 break; 110 117 case DBUS_MESSAGE_TYPE_METHOD_CALL: 111 msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), data(d_ptr->path.toUtf8()), 112 data(d_ptr->interface.toUtf8()), data(d_ptr->name.toUtf8())); 118 // only service and interface can be empty -> path and name must not be empty 119 if (!d_ptr->parametersValidated) { 120 if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) 121 return 0; 122 if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) 123 return 0; 124 if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) 125 return 0; 126 if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) 127 return 0; 128 } 129 130 msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(), 131 data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8()); 113 132 break; 114 133 case DBUS_MESSAGE_TYPE_METHOD_RETURN: … … 120 139 break; 121 140 case DBUS_MESSAGE_TYPE_ERROR: 141 142 143 144 145 122 146 msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR); 123 q_dbus_message_set_error_name(msg, d ata(d_ptr->name.toUtf8()));147 q_dbus_message_set_error_name(msg, d)); 124 148 if (!d_ptr->localMessage) { 125 149 q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->reply)); … … 128 152 break; 129 153 case DBUS_MESSAGE_TYPE_SIGNAL: 130 msg = q_dbus_message_new_signal(data(d_ptr->path.toUtf8()), data(d_ptr->interface.toUtf8()), 131 data(d_ptr->name.toUtf8())); 154 // nothing can be empty here 155 if (!d_ptr->parametersValidated) { 156 if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) 157 return 0; 158 if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) 159 return 0; 160 if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) 161 return 0; 162 } 163 164 msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(), 165 d_ptr->name.toUtf8()); 132 166 break; 133 167 default: … … 135 169 break; 136 170 } 137 #if 0 138 DBusError err; 139 q_dbus_error_init(&err); 140 if (q_dbus_error_is_set(&err)) { 141 QDBusError qe(&err); 142 qDebug() << "QDBusMessagePrivate::toDBusMessage" << qe; 143 } 144 #endif 145 if (!msg) 146 return 0; 171 172 // if we got here, the parameters validated 173 // and since the message parameters cannot be changed once the message is created 174 // we can record this fact 175 d_ptr->parametersValidated = true; 147 176 148 177 QDBusMarshaller marshaller; … … 162 191 // not ok; 163 192 q_dbus_message_unref(msg); 164 Q_ASSERT(false);193 ); 165 194 return 0; 166 195 } … … 240 269 // we must marshall and demarshall again so as to create QDBusArgument 241 270 // entries for the complex types 242 DBusMessage *message = toDBusMessage(asSent); 271 QDBusError error; 272 DBusMessage *message = toDBusMessage(asSent, &error); 273 if (!message) { 274 // failed to marshall, so it's a call error 275 return QDBusMessage::createError(error); 276 } 277 243 278 q_dbus_message_set_sender(message, conn.baseService.toUtf8()); 244 279 … … 459 494 the message \a msg. Returns the DBus message. 460 495 */ 496 497 498 499 500 501 502 461 503 462 504 /*! … … 666 708 */ 667 709 #ifndef QT_NO_DEBUG_STREAM 668 QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t)710 QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t) 669 711 { 670 712 switch (t) -
trunk/src/dbus/qdbusmessage.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 88 88 inline QDBusMessage createErrorReply(const QDBusError &err) const 89 89 { return createErrorReply(err.name(), err.message()); } 90 inlineQDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const;90 QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const; 91 91 92 92 93 QString service() const; 93 94 QString path() const; … … 114 115 }; 115 116 116 inline QDBusMessage QDBusMessage::createErrorReply(QDBusError::ErrorType atype, const QString &amsg) const117 { return createErrorReply(QDBusError::errorString(atype), amsg); }118 119 117 #ifndef QT_NO_DEBUG_STREAM 120 118 QDBUS_EXPORT QDebug operator<<(QDebug, const QDBusMessage &); -
trunk/src/dbus/qdbusmessage_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 56 56 #include <qatomic.h> 57 57 #include <qstring.h> 58 58 59 59 60 struct DBusMessage; … … 70 71 71 72 QList<QVariant> arguments; 73 74 75 72 76 QString service, path, interface, name, message, signature; 77 73 78 DBusMessage *msg; 74 79 DBusMessage *reply; … … 80 85 mutable uint delayedReply : 1; 81 86 uint localMessage : 1; 87 82 88 83 static DBusMessage *toDBusMessage(const QDBusMessage &message); 89 static void setParametersValidated(QDBusMessage &msg, bool enable) 90 { msg.d_ptr->parametersValidated = enable; } 91 92 static DBusMessage *toDBusMessage(const QDBusMessage &message, QDBusError *error); 84 93 static QDBusMessage fromDBusMessage(DBusMessage *dmsg); 85 94 -
trunk/src/dbus/qdbusmetaobject.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 602 602 // mark as an error 603 603 error = QDBusError(QDBusError::UnknownInterface, 604 QString( QLatin1String("Interface '%1' was not found"))604 ) 605 605 .arg(interface)); 606 606 return 0; -
trunk/src/dbus/qdbusmetaobject_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusmetatype.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 43 43 44 44 #include <string.h> 45 #include <qdbus_symbols_p.h>45 #include 46 46 47 47 #include <qbytearray.h> -
trunk/src/dbus/qdbusmetatype.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusmetatype_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusmisc.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include <string.h> 43 43 44 44 45 #include <QtCore/qvariant.h> 45 46 #include <QtCore/qmetaobject.h> … … 48 49 #include "qdbusconnection_p.h" 49 50 #include "qdbusmetatype_p.h" 51 50 52 51 53 QT_BEGIN_NAMESPACE … … 72 74 id = QMetaType::type(name); 73 75 return id; 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 74 121 } 75 122 -
trunk/src/dbus/qdbuspendingcall.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 311 311 bool QDBusPendingCall::isFinished() const 312 312 { 313 return d &&(d->replyMessage.type() != QDBusMessage::InvalidMessage);313 return (d->replyMessage.type() != QDBusMessage::InvalidMessage); 314 314 } 315 315 … … 410 410 #endif 411 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 412 450 413 451 class QDBusPendingCallWatcherPrivate: public QObjectPrivate … … 433 471 : QObject(*new QDBusPendingCallWatcherPrivate, parent), QDBusPendingCall(call) 434 472 { 435 if (d) { 436 if (!d->watcherHelper) 473 if (d) { 474 if (!d->watcherHelper) 437 475 d->watcherHelper = new QDBusPendingCallWatcherHelper; 476 477 478 479 480 438 481 d->watcherHelper->add(this); 439 482 } … … 465 508 466 509 // our signals were queued, so deliver them 510 467 511 QCoreApplication::sendPostedEvents(this, QEvent::MetaCall); 468 512 } -
trunk/src/dbus/qdbuspendingcall.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 79 79 #endif 80 80 81 82 83 81 84 protected: 82 85 QExplicitlySharedDataPointer<QDBusPendingCallPrivate> d; -
trunk/src/dbus/qdbuspendingcall_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 64 64 QT_BEGIN_NAMESPACE 65 65 66 66 67 class QDBusPendingCallWatcher; 67 68 class QDBusPendingCallWatcherHelper; … … 95 96 void setMetaTypes(int count, const int *types); 96 97 void checkReceivedSignature(); 98 99 97 100 }; 98 101 -
trunk/src/dbus/qdbuspendingreply.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbuspendingreply.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 189 189 inline void calculateMetaTypes() 190 190 { 191 191 192 int typeIds[Count > 0 ? Count : 1]; // use at least one since zero-sized arrays aren't valid 192 193 ForEach::fillMetaTypes(typeIds); -
trunk/src/dbus/qdbusreply.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusreply.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusserver.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 70 70 return; 71 71 72 QObject::connect(d, SIGNAL(newServerConnection( const QDBusConnection &)),73 this, SIGNAL(newConnection( const QDBusConnection &)));72 QObject::connect(d, SIGNAL(newServerConnection()), 73 this, SIGNAL(newConnection())); 74 74 75 75 // server = q_dbus_server_listen( "unix:tmpdir=/tmp", &error); -
trunk/src/dbus/qdbusserver.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusthreaddebug_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 101 101 ToggleWatchAction = 62, 102 102 SocketReadAction = 63, 103 SocketWriteAction = 64 ,103 SocketWriteAction = 64 104 104 }; 105 105 -
trunk/src/dbus/qdbusutil.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include "qdbusutil_p.h" 43 43 44 #include <qdbus_symbols_p.h>44 #include 45 45 46 46 #include <QtCore/qstringlist.h> … … 81 81 82 82 if (argType == QVariant::StringList) { 83 out += QLatin1 String("{");83 out += QLatin1); 84 84 QStringList list = arg.toStringList(); 85 85 foreach (QString item, list) … … 87 87 if (!list.isEmpty()) 88 88 out.chop(2); 89 out += QLatin1 String("}");89 out += QLatin1); 90 90 } else if (argType == QVariant::ByteArray) { 91 out += QLatin1 String("{");91 out += QLatin1); 92 92 QByteArray list = arg.toByteArray(); 93 93 for (int i = 0; i < list.count(); ++i) { … … 97 97 if (!list.isEmpty()) 98 98 out.chop(2); 99 out += QLatin1 String("}");99 out += QLatin1); 100 100 } else if (argType == QVariant::List) { 101 out += QLatin1 String("{");101 out += QLatin1); 102 102 QList<QVariant> list = arg.toList(); 103 103 foreach (QVariant item, list) { … … 108 108 if (!list.isEmpty()) 109 109 out.chop(2); 110 out += QLatin1 String("}");110 out += QLatin1); 111 111 } else if (argType == QMetaType::Char || argType == QMetaType::Short || argType == QMetaType::Int 112 112 || argType == QMetaType::Long || argType == QMetaType::LongLong) { … … 143 143 out += QLatin1Char(']'); 144 144 } else if (arg.canConvert(QVariant::String)) { 145 out += QLatin1 String("\"") + arg.toString() + QLatin1String("\"");145 out += QLatin1); 146 146 } else { 147 147 out += QLatin1Char('['); … … 227 227 if (elementType != QDBusArgument::BasicType && elementType != QDBusArgument::VariantType 228 228 && elementType != QDBusArgument::MapEntryType) 229 out += QLatin1 String("]");229 out += QLatin1); 230 230 231 231 return true; -
trunk/src/dbus/qdbusutil_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 58 58 59 59 #include <QtDBus/qdbusmacros.h> 60 60 61 61 62 QT_BEGIN_HEADER … … 84 85 85 86 QDBUS_EXPORT QString argumentToString(const QVariant &variant); 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 86 154 } 87 155 -
trunk/src/dbus/qdbusxmlgenerator.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** 40 40 ****************************************************************************/ 41 41 42 #include <QtCore/qcoreapplication.h>43 42 #include <QtCore/qmetaobject.h> 44 43 #include <QtCore/qstringlist.h> … … 205 204 xml += QString::fromLatin1(" <annotation name=\"com.trolltech.QtDBus.QtTypeName.%1%2\" value=\"%3\"/>\n") 206 205 .arg(isOutput ? QLatin1String("Out") : QLatin1String("In")) 207 .arg(isOutput ? j - inputCount : j - 1)206 .arg(isOutput ? j - inputCount : j - 1) 208 207 .arg(typeNameToXml(typeName)); 209 208 } … … 232 231 return retval; 233 232 } 234 235 QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)236 {237 QString interface;238 239 int idx = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE);240 if (idx >= mo->classInfoOffset()) {241 interface = QLatin1String(mo->classInfo(idx).value());242 } else {243 interface = QLatin1String(mo->className());244 interface.replace(QLatin1String("::"), QLatin1String("."));245 246 if (interface.startsWith(QLatin1String("QDBus"))) {247 interface.prepend(QLatin1String("com.trolltech.QtDBus."));248 } else if (interface.startsWith(QLatin1Char('Q')) &&249 interface.length() >= 2 && interface.at(1).isUpper()) {250 // assume it's Qt251 interface.prepend(QLatin1String("com.trolltech.Qt."));252 } else if (!QCoreApplication::instance()||253 QCoreApplication::instance()->applicationName().isEmpty()) {254 interface.prepend(QLatin1String("local."));255 } else {256 interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName());257 QStringList domainName =258 QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'),259 QString::SkipEmptyParts);260 if (domainName.isEmpty())261 interface.prepend(QLatin1String("local."));262 else263 for (int i = 0; i < domainName.count(); ++i)264 interface.prepend(QLatin1Char('.')).prepend(domainName.at(i));265 }266 }267 268 return interface;269 }270 233 271 234 QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, -
trunk/src/dbus/qdbusxmlparser.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/dbus/qdbusxmlparser_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 57 57 #include <QtXml/qdom.h> 58 58 #include <qdbusmacros.h> 59 #include <qdbusintrospection_p.h>59 #include 60 60 61 61 QT_BEGIN_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.