2008/10/28 Michael Tansella <[EMAIL PROTECTED]>

> > Are you extracting the data out of the
> > struct with the ">>" operators
>
> Thank you again for that hint:
>
> For interested the way I implemented it:
>

Here my snippet to read Phonebooks from sim:

struct PhonebookEntry
{
    int index;
    QString name;
    QString number;
};

Q_DECLARE_METATYPE ( PhonebookEntry );
Q_DECLARE_METATYPE ( QList<PhonebookEntry> );

const QDBusArgument &operator>>(const QDBusArgument &argument,
PhonebookEntry &pe) {
    argument.beginStructure();
    argument >> pe.index >> pe.name >> pe.number;
    argument.endStructure();
    return argument;
}

const QDBusArgument &operator<<(QDBusArgument &argument, const
PhonebookEntry &pe) {
    argument.beginStructure();
    argument << pe.index << pe.name << pe.number;
    argument.endStructure();
    return argument;
}

qDBusRegisterMetaType<PhonebookEntry>();  //somewhere in the code

QDBusMessage m=gsm_sim->call ( "RetrievePhonebook","received" );
QList<PhonebookEntry> lpe=qdbus_cast<QList<PhonebookEntry>
>(m.arguments()[0]);
qDebug() <<lpe;

You may be interested to the following too:

const QDebug operator<<(QDebug debug, const PhonebookEntry &pe) {
    debug << pe.index <<pe.number<< pe.name;
    return debug;
}

const QDebug operator<<(QDebug debug, const QList<PhonebookEntry> &lpe) {
    foreach(PhonebookEntry pe, lpe) debug << pe;
    return debug;
}

Where to put this? fso/wiki? om/wiki?

Regards

    Nicola
_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community

Reply via email to