summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2014-12-16 08:25:14 +0100
committerAaron Seigo <aseigo@kde.org>2014-12-16 08:25:14 +0100
commited7fdbcf6beb40960cf91555ae1d506278b852d8 (patch)
tree466b262e1d9c2efd63acb44170bdd1add1b98469
parent52787e9469cc1892e9e221b877d0ffd81d7a817a (diff)
downloadsink-ed7fdbcf6beb40960cf91555ae1d506278b852d8.tar.gz
sink-ed7fdbcf6beb40960cf91555ae1d506278b852d8.zip
move client classes into akonadi2common and add the base class for resource plugins
we can divide up libakonadi2common later once we have a full collection of classes this makes writing code a bit simpler now as we don't have to figuer out which libraries to link against or how class dependencies should look. when we have more infrastructure in place this will mostly become self-evident
-rw-r--r--client/CMakeLists.txt18
-rw-r--r--client/main.cpp2
-rw-r--r--common/CMakeLists.txt6
-rw-r--r--common/clientapi.cpp45
-rw-r--r--common/clientapi.h (renamed from client/clientapi.h)46
-rw-r--r--common/resourceaccess.cpp (renamed from client/resourceaccess.cpp)0
-rw-r--r--common/resourceaccess.h (renamed from client/resourceaccess.h)0
-rw-r--r--common/test/CMakeLists.txt (renamed from client/test/CMakeLists.txt)2
-rw-r--r--common/test/clientapitest.cpp (renamed from client/test/clientapitest.cpp)0
-rw-r--r--common/threadboundary.cpp (renamed from client/threadboundary.cpp)0
-rw-r--r--common/threadboundary.h (renamed from client/threadboundary.h)0
-rw-r--r--dummyresource/CMakeLists.txt2
-rw-r--r--dummyresource/facade.cpp3
-rw-r--r--dummyresource/facade.h2
14 files changed, 104 insertions, 22 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index f85839d..c4f857b 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -2,20 +2,6 @@ project(akonadi2_client)
2 2
3include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 3include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
4 4
5set(akonadi2client_SRCS 5add_executable(${PROJECT_NAME} main.cpp)
6 resourceaccess.cpp
7 threadboundary.cpp
8)
9
10add_library(${PROJECT_NAME} SHARED ${akonadi2client_SRCS})
11target_link_libraries(${PROJECT_NAME} akonadi2common) 6target_link_libraries(${PROJECT_NAME} akonadi2common)
12qt5_use_modules(${PROJECT_NAME} Widgets Network) 7install(TARGETS ${PROJECT_NAME} DESTINATION bin)
13install(TARGETS ${PROJECT_NAME} DESTINATION lib)
14
15add_executable(${PROJECT_NAME}_bin main.cpp)
16set_target_properties(${PROJECT_NAME}_bin PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
17target_link_libraries(${PROJECT_NAME}_bin ${PROJECT_NAME} akonadi2common)
18qt5_use_modules(${PROJECT_NAME}_bin Widgets Network)
19install(TARGETS ${PROJECT_NAME}_bin DESTINATION bin)
20
21add_subdirectory(test)
diff --git a/client/main.cpp b/client/main.cpp
index 77c93d2..c219f47 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -21,7 +21,7 @@
21#include <QCommandLineParser> 21#include <QCommandLineParser>
22 22
23#include "common/console.h" 23#include "common/console.h"
24#include "resourceaccess.h" 24#include "common/resourceaccess.h"
25 25
26int main(int argc, char *argv[]) 26int main(int argc, char *argv[])
27{ 27{
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index d200635..fab7708 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -13,12 +13,16 @@ endif (STORAGE_unqlite)
13set(command_SRCS 13set(command_SRCS
14 commands.cpp 14 commands.cpp
15 console.cpp 15 console.cpp
16 resourceaccess.cpp
16 storage_common.cpp 17 storage_common.cpp
18 threadboundary.cpp
17 ${storage_SRCS}) 19 ${storage_SRCS})
18 20
19add_library(${PROJECT_NAME} SHARED ${command_SRCS}) 21add_library(${PROJECT_NAME} SHARED ${command_SRCS})
20generate_export_header(${PROJECT_NAME} BASE_NAME Akonadi2Common EXPORT_FILE_NAME akonadi2common_export.h) 22generate_export_header(${PROJECT_NAME} BASE_NAME Akonadi2Common EXPORT_FILE_NAME akonadi2common_export.h)
21SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) 23SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
22qt5_use_modules(${PROJECT_NAME} Widgets) 24qt5_use_modules(${PROJECT_NAME} Widgets Network)
23target_link_libraries(${PROJECT_NAME} ${storage_LIBS}) 25target_link_libraries(${PROJECT_NAME} ${storage_LIBS})
24install(TARGETS ${PROJECT_NAME} DESTINATION lib) 26install(TARGETS ${PROJECT_NAME} DESTINATION lib)
27
28add_subdirectory(test)
diff --git a/common/clientapi.cpp b/common/clientapi.cpp
new file mode 100644
index 0000000..88797cc
--- /dev/null
+++ b/common/clientapi.cpp
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) version 3, or any
8 * later version accepted by the membership of KDE e.V. (or its
9 * successor approved by the membership of KDE e.V.), which shall
10 * act as a proxy defined in Section 6 of version 3 of the license.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include "clientapi.h"
22
23Resource::Resource()
24 : d(0)
25{
26
27}
28
29Resource::~Resource()
30{
31 //delete d;
32}
33
34ResourceFactory::ResourceFactory(QObject *parent)
35 : QObject(parent),
36 d(0)
37{
38
39}
40
41ResourceFactory::~ResourceFactory()
42{
43 //delete d;
44}
45
diff --git a/client/clientapi.h b/common/clientapi.h
index f74e76a..3531462 100644
--- a/client/clientapi.h
+++ b/common/clientapi.h
@@ -1,3 +1,23 @@
1/*
2 * Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) version 3, or any
8 * later version accepted by the membership of KDE e.V. (or its
9 * successor approved by the membership of KDE e.V.), which shall
10 * act as a proxy defined in Section 6 of version 3 of the license.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
1#pragma once 21#pragma once
2 22
3#include <QString> 23#include <QString>
@@ -415,5 +435,31 @@ public:
415 } 435 }
416}; 436};
417 437
438class Resource
439{
440public:
441 Resource();
442 virtual ~Resource();
443
444private:
445 class Private;
446 Private * const d;
447};
448
449class ResourceFactory : public QObject
450{
451public:
452 ResourceFactory(QObject *parent);
453 virtual ~ResourceFactory();
454
455 virtual Resource *createResource() = 0;
456 virtual void registerFacade(FacadeFactory &factory) = 0;
457
458private:
459 class Private;
460 Private * const d;
461};
418} 462}
419 463
464Q_DECLARE_INTERFACE(Akonadi2::ResourceFactory, "org.kde.akonadi2.resourcefactory")
465
diff --git a/client/resourceaccess.cpp b/common/resourceaccess.cpp
index 2b58545..2b58545 100644
--- a/client/resourceaccess.cpp
+++ b/common/resourceaccess.cpp
diff --git a/client/resourceaccess.h b/common/resourceaccess.h
index f381af1..f381af1 100644
--- a/client/resourceaccess.h
+++ b/common/resourceaccess.h
diff --git a/client/test/CMakeLists.txt b/common/test/CMakeLists.txt
index 601899a..98d4ecc 100644
--- a/client/test/CMakeLists.txt
+++ b/common/test/CMakeLists.txt
@@ -5,7 +5,7 @@ macro(auto_tests)
5 foreach(_testname ${ARGN}) 5 foreach(_testname ${ARGN})
6 add_executable(${_testname} ${_testname}.cpp ${store_SRCS}) 6 add_executable(${_testname} ${_testname}.cpp ${store_SRCS})
7 qt5_use_modules(${_testname} Core Test) 7 qt5_use_modules(${_testname} Core Test)
8 target_link_libraries(${_testname} lmdb akonadi2_client) 8 target_link_libraries(${_testname} akonadi2common)
9 add_test(NAME ${_testname} COMMAND ${_testname}) 9 add_test(NAME ${_testname} COMMAND ${_testname})
10 endforeach(_testname) 10 endforeach(_testname)
11endmacro(auto_tests) 11endmacro(auto_tests)
diff --git a/client/test/clientapitest.cpp b/common/test/clientapitest.cpp
index 2d1c238..2d1c238 100644
--- a/client/test/clientapitest.cpp
+++ b/common/test/clientapitest.cpp
diff --git a/client/threadboundary.cpp b/common/threadboundary.cpp
index 47ec508..47ec508 100644
--- a/client/threadboundary.cpp
+++ b/common/threadboundary.cpp
diff --git a/client/threadboundary.h b/common/threadboundary.h
index 9881afa..9881afa 100644
--- a/client/threadboundary.h
+++ b/common/threadboundary.h
diff --git a/dummyresource/CMakeLists.txt b/dummyresource/CMakeLists.txt
index e4a7ce2..e03fd4c 100644
--- a/dummyresource/CMakeLists.txt
+++ b/dummyresource/CMakeLists.txt
@@ -6,7 +6,7 @@ generate_flatbuffers(dummycalendar)
6 6
7#Client plugin 7#Client plugin
8add_library(${PROJECT_NAME} SHARED facade.cpp) 8add_library(${PROJECT_NAME} SHARED facade.cpp)
9target_link_libraries(${PROJECT_NAME} akonadi2common akonadi2_client) 9target_link_libraries(${PROJECT_NAME} akonadi2common)
10qt5_use_modules(${PROJECT_NAME} Core) 10qt5_use_modules(${PROJECT_NAME} Core)
11#install(TARGETS ${PROJECT_NAME} DESTINATION lib) 11#install(TARGETS ${PROJECT_NAME} DESTINATION lib)
12 12
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp
index 45e891c..0d47010 100644
--- a/dummyresource/facade.cpp
+++ b/dummyresource/facade.cpp
@@ -21,7 +21,8 @@
21 21
22#include <QDebug> 22#include <QDebug>
23#include <functional> 23#include <functional>
24#include "client/resourceaccess.h" 24
25#include "common/resourceaccess.h"
25#include "dummycalendar_generated.h" 26#include "dummycalendar_generated.h"
26 27
27using namespace DummyCalendar; 28using namespace DummyCalendar;
diff --git a/dummyresource/facade.h b/dummyresource/facade.h
index 11b1de0..f179c06 100644
--- a/dummyresource/facade.h
+++ b/dummyresource/facade.h
@@ -19,7 +19,7 @@
19 19
20#pragma once 20#pragma once
21 21
22#include "client/clientapi.h" 22#include "common/clientapi.h"
23#include "common/storage.h" 23#include "common/storage.h"
24 24
25class ResourceAccess; 25class ResourceAccess;