Skip to content

Commit

Permalink
Merge branch 'jb52916-buteo-plugin-api' into 'master'
Browse files Browse the repository at this point in the history
[buteo-sync-plugin-caldav] Adapt to changes in Buteo plugin API. JB#52916

See merge request mer-core/buteo-sync-plugin-caldav!80
  • Loading branch information
blam committed Apr 2, 2021
2 parents 315d710 + 02e39af commit 7284d38
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 55 deletions.
9 changes: 3 additions & 6 deletions rpm/buteo-sync-plugin-caldav.spec
Expand Up @@ -12,7 +12,7 @@ BuildRequires: pkgconfig(libsignon-qt5)
BuildRequires: pkgconfig(libsailfishkeyprovider)
BuildRequires: pkgconfig(libmkcal-qt5) >= 0.5.20
BuildRequires: pkgconfig(KF5CalendarCore) >= 5.79
BuildRequires: pkgconfig(buteosyncfw5) >= 0.9.16
BuildRequires: pkgconfig(buteosyncfw5) >= 0.10.0
BuildRequires: pkgconfig(accounts-qt5)
BuildRequires: pkgconfig(signon-oauth2plugin)
BuildRequires: pkgconfig(QmfClient)
Expand All @@ -32,10 +32,7 @@ This package contains unit tests for the CalDAV Buteo sync plugin.
%defattr(-,root,root,-)
%config %{_sysconfdir}/buteo/profiles/client/caldav.xml
%config %{_sysconfdir}/buteo/profiles/sync/caldav-sync.xml
#out-of-process-plugin
%{_libdir}/buteo-plugins-qt5/oopp/caldav-client
#in-process-plugin
#%{_libdir}/buteo-plugins-qt5/libcaldav-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libcaldav-client.so
#mkcal invitation plugin
%{_libdir}/mkcalplugins/libcaldavinvitationplugin.so

Expand Down Expand Up @@ -74,7 +71,7 @@ This package contains unit tests for the CalDAV Buteo sync plugin.
%setup -q -n %{name}-%{version}

%build
%qmake5 "DEFINES+=BUTEO_OUT_OF_PROCESS_SUPPORT"
%qmake5
make %{?_smp_mflags}

%pre
Expand Down
16 changes: 6 additions & 10 deletions src/caldavclient.cpp
@@ -1,7 +1,7 @@
/*
* This file is part of buteo-sync-plugin-caldav package
*
* Copyright (c) 2013 - 2020 Jolla Ltd. and/or its subsidiary(-ies).
* Copyright (c) 2013 - 2021 Jolla Ltd. and/or its subsidiary(-ies).
* Copyright (c) 2020 Open Mobile Platform LLC.
*
* Contributors: Mani Chandrasekar <maninc@gmail.com>
Expand Down Expand Up @@ -56,16 +56,12 @@ const char * const SYNC_NEXT_PERIOD_KEY = "Sync Next Months Span";

}

extern "C" CalDavClient* createPlugin(const QString& aPluginName,
const Buteo::SyncProfile& aProfile,
Buteo::PluginCbInterface *aCbInterface)
Buteo::ClientPlugin* CalDavClientLoader::createClientPlugin(
const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface* cbInterface)
{
return new CalDavClient(aPluginName, aProfile, aCbInterface);
}

extern "C" void destroyPlugin(CalDavClient *aClient)
{
delete aClient;
return new CalDavClient(pluginName, profile, cbInterface);
}

CalDavClient::CalDavClient(const QString& aPluginName,
Expand Down
36 changes: 20 additions & 16 deletions src/caldavclient.h
@@ -1,7 +1,7 @@
/*
* This file is part of buteo-sync-plugin-caldav package
*
* Copyright (C) 2013 Jolla Ltd. and/or its subsidiary(-ies).
* Copyright (C) 2013 - 2021 Jolla Ltd. and/or its subsidiary(-ies).
*
* Contributors: Mani Chandrasekar <maninc@gmail.com>
*
Expand Down Expand Up @@ -39,6 +39,7 @@
#include <ClientPlugin.h>
#include <SyncResults.h>
#include <SyncCommonDefs.h>
#include <SyncPluginLoader.h>

#include <Accounts/Manager>

Expand Down Expand Up @@ -179,21 +180,24 @@ private Q_SLOTS:
friend class tst_CalDavClient;
};

/*! \brief Creates CalDav client plugin
*
* @param aPluginName Name of this client plugin
* @param aProfile Profile to use
* @param aCbInterface Pointer to the callback interface
* @return Client plugin on success, otherwise NULL
*/
extern "C" CalDavClient* createPlugin(const QString &aPluginName,
const Buteo::SyncProfile &aProfile,
Buteo::PluginCbInterface *aCbInterface);

/*! \brief Destroys CalDav client plugin
*
* @param aClient CalDav client plugin instance to destroy
*/
extern "C" void destroyPlugin(CalDavClient *aClient);
class CalDavClientLoader : public Buteo::SyncPluginLoader
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.sailfishos.plugins.sync.CalDavClientLoader")
Q_INTERFACES(Buteo::SyncPluginLoader)

public:
/*! \brief Creates CalDav client plugin
*
* @param aPluginName Name of this client plugin
* @param aProfile Profile to use
* @param aCbInterface Pointer to the callback interface
* @return Client plugin on success, otherwise NULL
*/
Buteo::ClientPlugin* createClientPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface* cbInterface) override;
};

#endif // CALDAVCLIENT_H
26 changes: 3 additions & 23 deletions src/src.pro
Expand Up @@ -13,29 +13,9 @@ QMAKE_CXXFLAGS += -Wall \

DEFINES += BUTEOCALDAVPLUGIN_LIBRARY

!contains (DEFINES, BUTEO_OUT_OF_PROCESS_SUPPORT) {
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5
}

contains (DEFINES, BUTEO_OUT_OF_PROCESS_SUPPORT) {
TEMPLATE = app
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp
DEFINES += CLIENT_PLUGIN
DEFINES += "CLASSNAME=CalDavClient"
DEFINES += CLASSNAME_H=\\\"caldavclient.h\\\"
INCLUDE_DIR = $$system(pkg-config --cflags buteosyncfw5|cut -f2 -d'I')

HEADERS += $$INCLUDE_DIR/ButeoPluginIfaceAdaptor.h \
$$INCLUDE_DIR/PluginCbImpl.h \
$$INCLUDE_DIR/PluginServiceObj.h

SOURCES += $$INCLUDE_DIR/ButeoPluginIfaceAdaptor.cpp \
$$INCLUDE_DIR/PluginCbImpl.cpp \
$$INCLUDE_DIR/PluginServiceObj.cpp \
$$INCLUDE_DIR/plugin_main.cpp
}
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp

sync.path = /etc/buteo/profiles/sync
sync.files = xmls/sync/*
Expand Down

0 comments on commit 7284d38

Please sign in to comment.