From d16e1d88434e321d23257b18abcd572587a35efb Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Tue, 16 Dec 2014 10:02:48 +0100 Subject: dummy resource factory plugin --- dummyresource/CMakeLists.txt | 11 ++++------ dummyresource/resourcefactory.cpp | 44 ++++++++++++++++++++++++++++++++++++++ dummyresource/resourcefactory.h | 45 +++++++++++++++++++++++++++++++++++++++ dummyresource/syncronizer.cpp | 0 4 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 dummyresource/resourcefactory.cpp create mode 100644 dummyresource/resourcefactory.h delete mode 100644 dummyresource/syncronizer.cpp diff --git a/dummyresource/CMakeLists.txt b/dummyresource/CMakeLists.txt index e03fd4c..2729466 100644 --- a/dummyresource/CMakeLists.txt +++ b/dummyresource/CMakeLists.txt @@ -1,15 +1,12 @@ project(akonadi2_resource_dummy) +add_definitions(-DQT_PLUGIN) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) generate_flatbuffers(dummycalendar) -#Client plugin -add_library(${PROJECT_NAME} SHARED facade.cpp) -target_link_libraries(${PROJECT_NAME} akonadi2common) +add_library(${PROJECT_NAME} SHARED facade.cpp resourcefactory.cpp) qt5_use_modules(${PROJECT_NAME} Core) -#install(TARGETS ${PROJECT_NAME} DESTINATION lib) - -#Syncronizer +target_link_libraries(${PROJECT_NAME} akonadi2common) -#add_subdirectory(test) +install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${AKONADI2_RESOURCE_PLUGINS_PATH}) diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp new file mode 100644 index 0000000..2d89c77 --- /dev/null +++ b/dummyresource/resourcefactory.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2014 Aaron Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "resourcefactory.h" +#include "facade.h" + +DummyResource::DummyResource() + : Akonadi2::Resource() +{ + +} + +DummyResourceFactory::DummyResourceFactory(QObject *parent) + : Akonadi2::ResourceFactory(parent) +{ + +} + +Akonadi2::Resource *DummyResourceFactory::createResource() +{ + return new DummyResource(); +} + +void DummyResourceFactory::registerFacades(Akonadi2::FacadeFactory &factory) +{ + factory.registerFacade(PLUGIN_NAME); +} + diff --git a/dummyresource/resourcefactory.h b/dummyresource/resourcefactory.h new file mode 100644 index 0000000..2e5708e --- /dev/null +++ b/dummyresource/resourcefactory.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2014 Aaron Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#pragma once + +#include "common/resource.h" + +//TODO: a little ugly to have this in two places, once here and once in Q_PLUGIN_METADATA +#define PLUGIN_NAME "org.kde.dummy" + +class DummyResource : public Akonadi2::Resource +{ +public: + DummyResource(); +}; + +class DummyResourceFactory : public Akonadi2::ResourceFactory +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.kde.dummy") + Q_INTERFACES(Akonadi2::ResourceFactory) + +public: + DummyResourceFactory(QObject *parent = 0); + + Akonadi2::Resource *createResource(); + void registerFacades(Akonadi2::FacadeFactory &factory); +}; + diff --git a/dummyresource/syncronizer.cpp b/dummyresource/syncronizer.cpp deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3