Skip to content

Commit

Permalink
[sociald] Add VK images sync adaptor. Contributes to JB#19274
Browse files Browse the repository at this point in the history
This commit adds a sync adapter to retrieve photo metadata from VK
for the user.  This data is added to the libsocialcache vk images
database, to be displayed in the gallery application.

Contributes to JB#19274
  • Loading branch information
Chris Adams authored and Antti Seppälä committed Oct 12, 2015
1 parent 83cd9f2 commit 291e6ca
Show file tree
Hide file tree
Showing 11 changed files with 748 additions and 1 deletion.
25 changes: 25 additions & 0 deletions rpm/sociald.spec
Expand Up @@ -556,6 +556,31 @@ rm -f /home/nemo/.cache/msyncd/sync/vk.Contacts.xml
systemctl-user restart msyncd.service || :


%package vk-images
Summary: Provides image synchronisation with VK
License: TBD
Group: System/Libraries
Requires: %{name} = %{version}-%{release}

%description vk-images
Provides image synchronisation with VK

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

%pre vk-images
rm -f /home/nemo/.cache/msyncd/sync/client/vk-images.xml
rm -f /home/nemo/.cache/msyncd/sync/vk.Images.xml

%post vk-images
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 @@ -103,6 +103,7 @@ bool SocialdPlugin::startSync()
startSyncParams << "vk.Notifications";
startSyncParams << "vk.Calendars";
startSyncParams << "vk.Contacts";
startSyncParams << "vk.Images";
}

foreach (const QString &param, startSyncParams) {
Expand Down
4 changes: 4 additions & 0 deletions src/vk/vk-images/vk-images.pri
@@ -0,0 +1,4 @@
SOURCES += $$PWD/vkimagesyncadaptor.cpp
HEADERS += $$PWD/vkimagesyncadaptor.h
INCLUDEPATH += $$PWD

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

DEFINES += "CLASSNAME=VKImagesPlugin"
DEFINES += CLASSNAME_H=\\\"vkimagesplugin.h\\\"
include($$PWD/../../common.pri)
include($$PWD/../vk-common.pri)
include($$PWD/vk-images.pri)

vk_images_sync_profile.path = /etc/buteo/profiles/sync
vk_images_sync_profile.files = $$PWD/vk.Images.xml
vk_images_client_plugin_xml.path = /etc/buteo/profiles/client
vk_images_client_plugin_xml.files = $$PWD/vk-images.xml

HEADERS += vkimagesplugin.h
SOURCES += vkimagesplugin.cpp

OTHER_FILES += \
vk_images_sync_profile.files \
vk_images_client_plugin_xml.files

INSTALLS += \
target \
vk_images_sync_profile \
vk_images_client_plugin_xml
4 changes: 4 additions & 0 deletions src/vk/vk-images/vk-images.xml
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="vk-images" type="client" >
<field name="Sync Direction" />
</profile>
15 changes: 15 additions & 0 deletions src/vk/vk-images/vk.Images.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="vk.Images" type="sync" >
<key name="category" value="vk.Images" />
<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="VKontakte Images"/>

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

<profile name="vk-images" type="client" >
<key name="Sync Direction" value="from-remote" />
</profile>
</profile>
54 changes: 54 additions & 0 deletions src/vk/vk-images/vkimagesplugin.cpp
@@ -0,0 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2015 Jolla Ltd.
** Contact: Chris Adams <chris.adams@jolla.com>
**
** This program/library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public License
** version 2.1 as published by the Free Software Foundation.
**
** This program/library 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
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this program/library; if not, write to the Free
** Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
** 02110-1301 USA
**
****************************************************************************/

#include "vkimagesplugin.h"
#include "vkimagesyncadaptor.h"
#include "socialnetworksyncadaptor.h"

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

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

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

VKImagesPlugin::~VKImagesPlugin()
{
}

SocialNetworkSyncAdaptor *VKImagesPlugin::createSocialNetworkSyncAdaptor()
{
return new VKImageSyncAdaptor(this);
}
47 changes: 47 additions & 0 deletions src/vk/vk-images/vkimagesplugin.h
@@ -0,0 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2015 Jolla Ltd.
** Contact: Chris Adams <chris.adams@jolla.com>
**
** This program/library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public License
** version 2.1 as published by the Free Software Foundation.
**
** This program/library 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
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this program/library; if not, write to the Free
** Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
** 02110-1301 USA
**
****************************************************************************/

#ifndef VKIMAGESPLUGIN_H
#define VKIMAGESPLUGIN_H

#include "socialdbuteoplugin.h"

class SOCIALDBUTEOPLUGIN_EXPORT VKImagesPlugin : public SocialdButeoPlugin
{
Q_OBJECT

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

protected:
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor();
};

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

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

#endif // VKIMAGESPLUGIN_H

0 comments on commit 291e6ca

Please sign in to comment.