[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [Semi-OT] How to get a dbus array of dbus_object_path from a
From:       Thiago Macieira <thiago () kde ! org>
Date:       2007-02-19 19:12:49
Message-ID: 200702192012.59948.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Iván Forcada Atienza wrote:
>Hmmm... I must be missing something because I keep getting
>"InvalidSignature" error, no matter if I use QVariantMap or
>QMap<QString,QVariant>, and even if I use qDBusRegisterMetaType and
>Q_DECLARE_METATYPE.

The attached example works just fine.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["main.cpp" (text/x-c++src)]

#include <QtDBus>
#include <QDebug>
#include <QCoreApplication>

int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    QDBusConnection system = QDBusConnection::systemBus();
    if (!system.isConnected())
        return 1;

    QDBusInterface computer("org.freedesktop.Hal",
                            "/org/freedesktop/Hal/devices/computer",
                            "org.freedesktop.Hal.Device",
                            system);
    if (!computer.isValid())
        return 1;

    QDBusMessage reply = computer.call("GetAllProperties");
    if (reply.type() != QDBusMessage::ReplyMessage)
        return 1;

    qDebug() << "Got a message reply with signature" << reply.signature();

    qDBusRegisterMetaType<QVariantMap>();
    QDBusReply<QVariantMap> properties = reply;
    if (properties.isValid())
        qDebug() << "Properties are:" << properties.value();
    else
        qDebug() << "Error is:" << properties.error();
    return 0;
}

[Attachment #8 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic