summaryrefslogtreecommitdiffstats
path: root/common/clientapi.cpp
blob: 260b6b8a2d2e29897323c40136b0a00fbf396bf7 (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "clientapi.h"
#include "resourceaccess.h"
#include "commands.h"

namespace async
{
    void run(const std::function<void()> &runner) {
        QtConcurrent::run(runner);

        // //FIXME we should be using a Job instead of a timer
        // auto timer = new QTimer;
        // timer->setSingleShot(true);
        // QObject::connect(timer, &QTimer::timeout, runner);
        // QObject::connect(timer, &QTimer::timeout, timer, &QObject::deleteLater);
        // timer->start(0);
    };
} // namespace async

namespace Akonadi2
{

namespace Domain
{

template<>
QString getTypeName<Event>()
{
    return "event";
}

template<>
QString getTypeName<Todo>()
{
    return "todo";
}

} // namespace Domain

void Store::shutdown(const QString &identifier)
{
    Akonadi2::ResourceAccess resourceAccess(identifier);
    resourceAccess.open();
    resourceAccess.sendCommand(Akonadi2::Commands::ShutdownCommand).then<void>([](Async::Future<void> &f){
        //TODO wait for disconnect
        f.setFinished();
    }).exec().waitForFinished();
}

} // namespace Akonadi2