void AkonadiSlave::stat(const QUrl &url) { qCDebug(AKONADISLAVE_LOG) << url; // Stats for a collection if (Collection::fromUrl(url).isValid()) { Collection collection = Collection::fromUrl(url); if (collection != Collection::root()) { // Check that the collection exists. CollectionFetchJob *job = new CollectionFetchJob(collection, CollectionFetchJob::Base); if (!job->exec()) { error(KIO::ERR_INTERNAL, job->errorString()); return; } if (job->collections().count() != 1) { error(KIO::ERR_DOES_NOT_EXIST, i18n("No such item.")); return; } collection = job->collections().at(0); } statEntry(entryForCollection(collection)); finished(); } // Stats for an item else if (Item::fromUrl(url).isValid()) { ItemFetchJob *job = new ItemFetchJob(Item::fromUrl(url)); if (!job->exec()) { error(KIO::ERR_INTERNAL, job->errorString()); return; } if (job->items().count() != 1) { error(KIO::ERR_DOES_NOT_EXIST, i18n("No such item.")); return; } const Item item = job->items().at(0); statEntry(entryForItem(item)); finished(); } }
void AkonadiSlave::get(const QUrl &url) { const Item item = Item::fromUrl(url); ItemFetchJob *job = new ItemFetchJob(item); job->fetchScope().fetchFullPayload(); if (!job->exec()) { error(KIO::ERR_INTERNAL, job->errorString()); return; } if (job->items().count() != 1) { error(KIO::ERR_DOES_NOT_EXIST, i18n("No such item.")); } else { const Item item = job->items().at(0); QByteArray tmp = item.payloadData(); data(tmp); data(QByteArray()); finished(); } finished(); }