diff options
author | Thiago Macieira <thiago@kde.org> | 2006-05-02 14:00:27 +0000 |
---|---|---|
committer | Thiago Macieira <thiago@kde.org> | 2006-05-02 14:00:27 +0000 |
commit | 838a740ea6f25108b2bca922a1f1ea9d90b64ec2 (patch) | |
tree | 495e99f08481911adefd1fd048d02597f74ccdbe /qt/qdbusinterface.cpp | |
parent | 86bb5584d353e336aeaac5ddad3b5d51b359836e (diff) |
* qt/dbusidl2cpp.cpp: There's no callAsync. Use the correct
call (r535506)
* qt/dbusidl2cpp.cpp:
* qt/qdbusabstractadaptor.cpp:
* qt/qdbusabstractadaptor.h: Make QDBusAdaptorConnector be a
sibling of the QDBusAbstractAdaptor objects instead of the
parent. (r535848)
* qt/dbusidl2cpp.cpp:
* qt/qdbusabstractinterface.cpp:
* qt/qdbusabstractinterface.h:
* qt/qdbusabstractinterface_p.h:
* qt/qdbusinterface.cpp: Make properties in interfaces
actually work. The code that was generated would not compile,
due to moc calls to functions that did not exist. They now
shall. (r536571)
Diffstat (limited to 'qt/qdbusinterface.cpp')
-rw-r--r-- | qt/qdbusinterface.cpp | 70 |
1 files changed, 11 insertions, 59 deletions
diff --git a/qt/qdbusinterface.cpp b/qt/qdbusinterface.cpp index 48b1011c..0afa452b 100644 --- a/qt/qdbusinterface.cpp +++ b/qt/qdbusinterface.cpp @@ -180,72 +180,24 @@ int QDBusInterfacePrivate::metacall(QMetaObject::Call c, int id, void **argv) if (!mp.isReadable()) return -1; // don't read - // try to read this property - QDBusMessage msg = QDBusMessage::methodCall(service, path, DBUS_INTERFACE_PROPERTIES, - QLatin1String("Get")); - msg << interface << QString::fromUtf8(mp.name()); - - QPointer<QDBusAbstractInterface> qq = q; - QDBusMessage reply = connp->sendWithReply(msg, QDBusConnection::UseEventLoop); - - // access to "this" or to "q" below this point must check for "qq" - // we may have been deleted! - - if (reply.type() == QDBusMessage::ReplyMessage && reply.count() == 1 && - reply.signature() == QLatin1String("v")) { - QVariant value = QDBusTypeHelper<QVariant>::fromVariant(reply.at(0)); - - // make sure the type is right - if (strcmp(mp.typeName(), value.typeName()) == 0) { - if (mp.type() == QVariant::LastType) - // QVariant is special in this context - *reinterpret_cast<QVariant *>(argv[0]) = value; - else - QDBusMetaObject::assign(argv[0], value); - return -1; - } - } - - // got an error - if (qq.isNull()) - return -1; // bail out + QVariant value = property(mp); + if (value.type() == QVariant::Invalid) + // an error occurred -- property already set lastError + return -1; + else if (mp.type() == QVariant::LastType) + // QVariant is special in this context + *reinterpret_cast<QVariant *>(argv[0]) = value; + else + QDBusMetaObject::assign(argv[0], value); - if (reply.type() == QDBusMessage::ErrorMessage) - lastError = reply; - else if (reply.signature() != QLatin1String("v")) { - QString errmsg = QLatin1String("Invalid signature `%1' in return from call to " - DBUS_INTERFACE_PROPERTIES); - lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature())); - } else { - QString errmsg = QLatin1String("Unexpected type `%1' when retrieving property " - "`%2 %3.%4'"); - lastError = QDBusError(QDBusError::InvalidSignature, - errmsg.arg(QLatin1String(reply.at(0).typeName()), - QLatin1String(mp.typeName()), - interface, QString::fromUtf8(mp.name()))); - } - return -1; + return -1; // handled } else if (c == QMetaObject::WriteProperty) { // QMetaProperty::write has already checked that we're writable // it has also checked that the type is right QVariant value(metaObject->propertyMetaType(id), argv[0]); QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset()); - // send the value - QDBusMessage msg = QDBusMessage::methodCall(service, path, DBUS_INTERFACE_PROPERTIES, - QLatin1String("Set")); - msg.setSignature(QLatin1String("ssv")); - msg << interface << QString::fromUtf8(mp.name()) << value; - - QPointer<QDBusAbstractInterface> qq = q; - QDBusMessage reply = connp->sendWithReply(msg, QDBusConnection::UseEventLoop); - - // access to "this" or to "q" below this point must check for "qq" - // we may have been deleted! - - if (!qq.isNull() && reply.type() != QDBusMessage::ReplyMessage) - lastError = reply; - + setProperty(mp, value); return -1; } return id; |