Changeset 561 for trunk/src/dbus/qdbusinterface.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
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/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;
Note:
See TracChangeset
for help on using the changeset viewer.