|
|
2011-05-26
, 19:56
|
|
|
Posts: 533 |
Thanked: 1,341 times |
Joined on Dec 2010
@ Italy
|
#2
|

void MafwHelper::GetCatalog(QString aggregate, int index, int count)
{
#ifdef Q_WS_MAEMO_5
QDBusInterface device(QLatin1String("org.freedesktop.Tracker"),
QLatin1String("/org/freedesktop/Tracker/Metadata"),
QLatin1String("org.freedesktop.Tracker.Metadata"),
QDBusConnection::sessionBus());
QStringList par1 = QStringList() << aggregate;
QStringList par2 = QStringList() << "SUM" << "COUNT" << "COUNT" << "CONCAT";
QStringList par3 = QStringList() << "Audio:Duration" << "Audio:Album" << "*" << "Audio:Album";
qDebug() << "DBusMessage: org.freedesktop.Tracker.Metadata::GetUniqueValuesWithAggregates";
QList<QVariant> args = QList<QVariant>() << "Music" << par1 << "" << par2 << par3 << false << index << count;
device.callWithCallback(QLatin1String("GetUniqueValuesWithAggregates"), args,
this, SLOT(GetCatalogFinishedSlot(QDBusMessage)));
#endif
}
#ifdef Q_WS_MAEMO_5
void MafwHelper::GetCatalogFinishedSlot(QDBusMessage msg)
{
QVariant val = msg.arguments()[0];
QDBusArgument arg = qvariant_cast<QDBusArgument>(val);
arg.beginArray();
while (!arg.atEnd()) {
QList<QString> element;
arg >> element;
qDebug() << element;
}
arg.endArray();
}
#endif
| The Following User Says Thank You to sakya For This Useful Post: | ||
|
|
2011-05-26
, 21:57
|
|
|
Posts: 2,473 |
Thanked: 12,265 times |
Joined on Oct 2009
@ Jerusalem, PS/IL
|
#3
|
| The Following User Says Thank You to MohammadAG For This Useful Post: | ||
I tried to call this method with Qt using QDBusPendingCall, but I always receive an error in the reply.
The message I'm trying to call is this:
method call sender=:1.50 -> dest=org.freedesktop.Tracker serial=5264 path=/org/freedesktop/Tracker/Metadata; interface=org.freedesktop.Tracker.Metadata; member=GetUniqueValuesWithAggregates string "Music" array [ string "Audio:Artist" ] string "" array [ string "SUM" string "COUNT" string "COUNT" string "CONCAT" ] array [ string "Audio:Duration" string "Audio:Album" string "*" string "Audio:Album" ] boolean false int32 0 int32 10method return sender=:1.1317 -> dest=:1.50 reply_serial=5264 array [ array [ string "Affinity" string "4307" string "1" string "15" string "Affinity" ] array [ string "Alanis Morissette" string "3645" string "1" string "13" string "Jagged Little Pill" ] array [ string "Al Di Meola" string "2312" string "1" string "6" string "Casino" ] ... ]void MafwHelper::GetCatalog(QString aggregate, int index, int count) { #ifdef Q_WS_MAEMO_5 QDBusConnection conn = QDBusConnection::sessionBus(); QDBusInterface device("org.freedesktop.Tracker", "/org/freedesktop/Tracker/Metadata", "org.freedesktop.Tracker.Metadata", conn); QStringList par1 = QStringList() << aggregate; QStringList par2 = QStringList() << "SUM" << "COUNT" << "COUNT" << "CONCAT"; QStringList par3 = QStringList() << "Audio:Duration" << "Audio:Album" << "*" << "Audio:Album"; qDebug() << "DBusMessage: GetUniqueValuesWithAggregates"; QDBusPendingCall pcall = device.asyncCall("GetUniqueValuesWithAggregates", "Music", par1, "", par2, par3, false, index, count); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this); connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(GetCatalogFinishedSlot(QDBusPendingCallWatcher*))); #endif } #ifdef Q_WS_MAEMO_5 void MafwHelper::GetCatalogFinishedSlot(QDBusPendingCallWatcher* call) { QDBusPendingReply<QDBusVariant> reply = *call; if (reply.isError()) { qWarning() << "QDBusPendingReply error"; } else { for(int i=0; i<reply.count(); i++){ QVariant val = qvariant_cast<QDBusVariant>(reply.argumentAt(i)).variant(); qDebug() << val; } } call->deleteLater(); } #endifI'm not even sure that a QStringList parameter is correct for the array in dbusmessage...
Many thanks
My projects: smssend, groupsms, volumecontroldaemon, vodafone190, vodafone190 desktop widget, QtBatteryWidget, QtLockscreen, Lone Wolf
Donations are welcome
Last edited by sakya; 2011-05-26 at 12:28.