summaryrefslogtreecommitdiffstats
path: root/common/clientapi.cpp
blob: 190bb5785024b5f58d989100a5307e1fded50eba (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
#include "clientapi.h"
#include "resourceaccess.h"
#include "commands.h"

namespace async
{
    void run(const std::function<void()> &runner) {
        //TODO use a job that runs in a thread?
        QtConcurrent::run(runner);
    };
} // 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