summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/CMakeLists.txt1
-rw-r--r--common/clientapi.cpp38
-rw-r--r--common/clientapi.h21
3 files changed, 42 insertions, 18 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 3431756..ceec69c 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -11,6 +11,7 @@ else (STORAGE_unqlite)
11endif (STORAGE_unqlite) 11endif (STORAGE_unqlite)
12 12
13set(command_SRCS 13set(command_SRCS
14 clientapi.cpp
14 commands.cpp 15 commands.cpp
15 console.cpp 16 console.cpp
16 resource.cpp 17 resource.cpp
diff --git a/common/clientapi.cpp b/common/clientapi.cpp
new file mode 100644
index 0000000..2a4b603
--- /dev/null
+++ b/common/clientapi.cpp
@@ -0,0 +1,38 @@
1
2#include "clientapi.h"
3
4namespace async
5{
6 void run(const std::function<void()> &runner) {
7 QtConcurrent::run(runner);
8
9 // //FIXME we should be using a Job instead of a timer
10 // auto timer = new QTimer;
11 // timer->setSingleShot(true);
12 // QObject::connect(timer, &QTimer::timeout, runner);
13 // QObject::connect(timer, &QTimer::timeout, timer, &QObject::deleteLater);
14 // timer->start(0);
15 };
16} // namespace async
17
18namespace Akonadi2
19{
20
21namespace Domain
22{
23
24template<>
25QString getTypeName<Event>()
26{
27 return "event";
28}
29
30template<>
31QString getTypeName<Todo>()
32{
33 return "todo";
34}
35
36} // namespace Domain
37
38} // namespace Akonadi2
diff --git a/common/clientapi.h b/common/clientapi.h
index 7f01587..2188123 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -34,16 +34,7 @@
34namespace async { 34namespace async {
35 //This should abstract if we execute from eventloop or in thread. 35 //This should abstract if we execute from eventloop or in thread.
36 //It supposed to allow the caller to finish the current method before executing the runner. 36 //It supposed to allow the caller to finish the current method before executing the runner.
37 void run(const std::function<void()> &runner) { 37 void run(const std::function<void()> &runner);
38 QtConcurrent::run(runner);
39
40 // //FIXME we should be using a Job instead of a timer
41 // auto timer = new QTimer;
42 // timer->setSingleShot(true);
43 // QObject::connect(timer, &QTimer::timeout, runner);
44 // QObject::connect(timer, &QTimer::timeout, timer, &QObject::deleteLater);
45 // timer->start(0);
46 };
47 38
48 /** 39 /**
49 * Query result set 40 * Query result set
@@ -232,16 +223,10 @@ template<class DomainType>
232QString getTypeName(); 223QString getTypeName();
233 224
234template<> 225template<>
235QString getTypeName<Event>() 226QString getTypeName<Event>();
236{
237 return "event";
238}
239 227
240template<> 228template<>
241QString getTypeName<Todo>() 229QString getTypeName<Todo>();
242{
243 return "todo";
244}
245 230
246} 231}
247 232