File: akonadidebug.cpp

package info (click to toggle)
zanshin 25.12.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,668 kB
  • sloc: cpp: 35,501; xml: 1,405; sh: 16; makefile: 5
file content (32 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download | duplicates (2)
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;
        }
    }
}