1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
/*
* SPDX-FileCopyrightText: 2014 Kevin Ottens <ervin@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "akonadidebug.h"
#include <KCalendarCore/Todo>
#include "akonadi/akonadicollectionfetchjobinterface.h"
#include "akonadi/akonadiitemfetchjobinterface.h"
void TestLib::AkonadiDebug::dumpTree(const Akonadi::StorageInterface::Ptr &storage)
{
auto colJob = storage->fetchCollections(Akonadi::Collection::root(),
Akonadi::StorageInterface::Recursive,
nullptr);
colJob->kjob()->exec();
foreach (const auto &col, colJob->collections()) {
qDebug() << "COL:" << col.id() << col.name() << col.remoteId();
auto itemJob = storage->fetchItems(col, nullptr);
itemJob->kjob()->exec();
foreach (const auto &item, itemJob->items()) {
QString summary;
if (item.hasPayload<KCalendarCore::Todo::Ptr>())
summary = item.payload<KCalendarCore::Todo::Ptr>()->summary();
qDebug() << "\tITEM:" << item.id() << item.remoteId() << summary;
}
}
}
|