Esempio n. 1
0
void RetrieveItemsJob::Private::akonadiFetchResult(KJob *job)
{
    if (job->error() != 0) {
        return;    // handled by base class
    }

    ItemFetchJob *itemFetch = qobject_cast<ItemFetchJob *>(job);
    Q_ASSERT(itemFetch != 0);

    Item::List items = itemFetch->items();
    itemFetch->clearItems(); // save memory
    qCDebug(MIXEDMAILDIR_LOG) << "Akonadi fetch got" << items.count() << "items";

    mServerItemsByRemoteId.reserve(items.size());
    for (int i = 0; i < items.count(); ++i) {
        Item &item = items[i];
        // items without remoteId have not been written to the resource yet
        if (!item.remoteId().isEmpty()) {
            // set the parent collection (with all ancestors) in every item
            item.setParentCollection(mCollection);
            mServerItemsByRemoteId.insert(item.remoteId(), item);
        }
    }

    qCDebug(MIXEDMAILDIR_LOG) << "of which" << mServerItemsByRemoteId.count() << "have remoteId";

    FileStore::ItemFetchJob *storeFetch = mStore->fetchItems(mCollection);
    // just basic items, no data

    connect(storeFetch, SIGNAL(result(KJob*)), q, SLOT(storeListResult(KJob*)));
}
LiteralSequence::LiteralSequence(const Item::List &list) : m_list(list)
{
    Q_ASSERT(list.size() >= 2);
}