Skip to content

Commit

Permalink
[sociald] Add VK calendar event integration. Contributes to JB#19273
Browse files Browse the repository at this point in the history
This commit adds a sync adaptor which loads event data from VK and
caches it in the local device database.

Contributes to JB#19273
  • Loading branch information
Chris Adams authored and Antti Seppälä committed Oct 12, 2015
1 parent db201ab commit 87b907f
Show file tree
Hide file tree
Showing 11 changed files with 515 additions and 1 deletion.
28 changes: 28 additions & 0 deletions rpm/sociald.spec
Expand Up @@ -502,6 +502,34 @@ rm -f /home/nemo/.cache/msyncd/sync/vk.Notifications.xml
systemctl-user restart msyncd.service || :


%package vk-calendars
Summary: Provides calendar synchronisation with VK
License: TBD
Group: System/Libraries
BuildRequires: pkgconfig(libmkcal-qt5)
BuildRequires: pkgconfig(libkcalcoren-qt5)
Requires: %{name} = %{version}-%{release}

%description vk-calendars
Provides calendar synchronisation with VK

%files vk-calendars
#out-of-proces-plugin form:
/usr/lib/buteo-plugins-qt5/oopp/vk-calendars-client
#in-process-plugin form:
#/usr/lib/buteo-plugins-qt5/libvk-calendars-client.so
%config %{_sysconfdir}/buteo/profiles/client/vk-calendars.xml
%config %{_sysconfdir}/buteo/profiles/sync/vk.Calendars.xml

%pre vk-calendars
rm -f /home/nemo/.cache/msyncd/sync/client/vk-calendars.xml
rm -f /home/nemo/.cache/msyncd/sync/vk.Calendars.xml

%post vk-calendars
systemctl-user restart msyncd.service || :



%package ts-devel
Summary: Translation source for sociald
License: LGPLv2.1
Expand Down
1 change: 1 addition & 0 deletions src/sociald/socialdplugin.cpp
Expand Up @@ -101,6 +101,7 @@ bool SocialdPlugin::startSync()
startSyncParams << "twitter.Posts";
startSyncParams << "vk.Posts";
startSyncParams << "vk.Notifications";
startSyncParams << "vk.Calendars";
}

foreach (const QString &param, startSyncParams) {
Expand Down
6 changes: 6 additions & 0 deletions src/vk/vk-calendars/vk-calendars.pri
@@ -0,0 +1,6 @@
CONFIG += link_pkgconfig
PKGCONFIG += libmkcal-qt5 libkcalcoren-qt5
SOURCES += $$PWD/vkcalendarsyncadaptor.cpp
HEADERS += $$PWD/vkcalendarsyncadaptor.h
INCLUDEPATH += $$PWD

25 changes: 25 additions & 0 deletions src/vk/vk-calendars/vk-calendars.pro
@@ -0,0 +1,25 @@
TARGET = vk-calendars-client
VERSION = 0.0.1

DEFINES += "CLASSNAME=VKCalendarsPlugin"
DEFINES += CLASSNAME_H=\\\"vkcalendarsplugin.h\\\"
include($$PWD/../../common.pri)
include($$PWD/../vk-common.pri)
include($$PWD/vk-calendars.pri)

vk_calendars_sync_profile.path = /etc/buteo/profiles/sync
vk_calendars_sync_profile.files = $$PWD/vk.Calendars.xml
vk_calendars_client_plugin_xml.path = /etc/buteo/profiles/client
vk_calendars_client_plugin_xml.files = $$PWD/vk-calendars.xml

HEADERS += vkcalendarsplugin.h
SOURCES += vkcalendarsplugin.cpp

OTHER_FILES += \
vk.Calendars.xml \
vk-calendars.xml

INSTALLS += \
target \
vk_calendars_sync_profile \
vk_calendars_client_plugin_xml
4 changes: 4 additions & 0 deletions src/vk/vk-calendars/vk-calendars.xml
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="vk-calendars" type="client" >
<field name="Sync Direction" />
</profile>
15 changes: 15 additions & 0 deletions src/vk/vk-calendars/vk.Calendars.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="vk.Calendars" type="sync" >
<key name="category" value="vk.Calendars" />
<key name="enabled" value="false" />
<key name="use_accounts" value="false" />
<key name="destinationtype" value="online" />
<key name="hidden" value="true" />
<key name="displayname" value="VK Calendars"/>

<schedule enabled="false" interval="" days="1,2,3,4,5,6,7" syncconfiguredtime="" time="05:00:00" />

<profile name="vk-calendars" type="client" >
<key name="Sync Direction" value="from-remote" />
</profile>
</profile>
40 changes: 40 additions & 0 deletions src/vk/vk-calendars/vkcalendarsplugin.cpp
@@ -0,0 +1,40 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Chris Adams <chris.adams@jolla.com>
**
****************************************************************************/

#include "vkcalendarsplugin.h"
#include "vkcalendarsyncadaptor.h"
#include "socialnetworksyncadaptor.h"

extern "C" VKCalendarsPlugin* createPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
{
return new VKCalendarsPlugin(pluginName, profile, callbackInterface);
}

extern "C" void destroyPlugin(VKCalendarsPlugin* plugin)
{
delete plugin;
}

VKCalendarsPlugin::VKCalendarsPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
: SocialdButeoPlugin(pluginName, profile, callbackInterface,
QStringLiteral("vk"),
SocialNetworkSyncAdaptor::dataTypeName(SocialNetworkSyncAdaptor::Calendars))
{
}

VKCalendarsPlugin::~VKCalendarsPlugin()
{
}

SocialNetworkSyncAdaptor *VKCalendarsPlugin::createSocialNetworkSyncAdaptor()
{
return new VKCalendarSyncAdaptor(this);
}
33 changes: 33 additions & 0 deletions src/vk/vk-calendars/vkcalendarsplugin.h
@@ -0,0 +1,33 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Chris Adams <chris.adams@jolla.com>
**
****************************************************************************/

#ifndef VKCALENDARSPLUGIN_H
#define VKCALENDARSPLUGIN_H

#include "socialdbuteoplugin.h"

class VKCalendarsPlugin : public SocialdButeoPlugin
{
Q_OBJECT

public:
VKCalendarsPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *cbInterface);
~VKCalendarsPlugin();

protected:
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor();
};

extern "C" VKCalendarsPlugin* createPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *cbInterface);

extern "C" void destroyPlugin(VKCalendarsPlugin* client);

#endif // VKCALENDARSPLUGIN_H

0 comments on commit 87b907f

Please sign in to comment.