Skip to content

Commit

Permalink
[buteo-sync-plugins-social] Implemented OneDrive images sync plugin. …
Browse files Browse the repository at this point in the history
…Fixes MER#1332

Note that we start with a zero image count in OneDrive albums

Otherwise, if album doesn't contain images but contains other items,
the count will be wrong.

Fixes MER#1332
  • Loading branch information
Antti Seppälä authored and Chris Adams committed Oct 9, 2015
1 parent cf9a56b commit c80097e
Show file tree
Hide file tree
Showing 12 changed files with 909 additions and 2 deletions.
26 changes: 26 additions & 0 deletions rpm/sociald.spec
Expand Up @@ -344,6 +344,32 @@ systemctl-user try-restart msyncd.service || :



%package onedrive-images
Summary: Provides image synchronisation with OneDrive
License: LGPLv2.1
Group: System/Libraries
Requires: %{name} = %{version}-%{release}

%description onedrive-images
Provides image synchronisation with OneDrive

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

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

%post onedrive-images
systemctl-user try-restart msyncd.service || :




%package ts-devel
Summary: Translation source for sociald
Expand Down
4 changes: 4 additions & 0 deletions src/onedrive/onedrive-images/onedrive-images.pri
@@ -0,0 +1,4 @@
SOURCES += $$PWD/onedriveimagesyncadaptor.cpp
HEADERS += $$PWD/onedriveimagesyncadaptor.h
INCLUDEPATH += $$PWD

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

DEFINES += "CLASSNAME=OneDriveImagesPlugin"
DEFINES += CLASSNAME_H=\\\"onedriveimagesplugin.h\\\"
include($$PWD/../../common.pri)
include($$PWD/../onedrive-common.pri)
include($$PWD/onedrive-images.pri)

CONFIG += link_pkgconfig
PKGCONFIG += mlite5

onedrive_images_sync_profile.path = /etc/buteo/profiles/sync
onedrive_images_sync_profile.files = $$PWD/onedrive.Images.xml
onedrive_images_client_plugin_xml.path = /etc/buteo/profiles/client
onedrive_images_client_plugin_xml.files = $$PWD/onedrive-images.xml

HEADERS += onedriveimagesplugin.h
SOURCES += onedriveimagesplugin.cpp

OTHER_FILES += \
onedrive_images_sync_profile.files \
onedrive_images_client_plugin_xml.files

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

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

<profile name="onedrive-images" type="client" >
<key name="Sync Direction" value="from-remote" />
</profile>
</profile>
54 changes: 54 additions & 0 deletions src/onedrive/onedrive-images/onedriveimagesplugin.cpp
@@ -0,0 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2015 Jolla Ltd.
** Contact: Antti Seppälä <antti.seppala@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 "onedriveimagesplugin.h"
#include "onedriveimagesyncadaptor.h"
#include "socialnetworksyncadaptor.h"

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

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

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

OneDriveImagesPlugin::~OneDriveImagesPlugin()
{
}

SocialNetworkSyncAdaptor *OneDriveImagesPlugin::createSocialNetworkSyncAdaptor()
{
return new OneDriveImageSyncAdaptor(this);
}
47 changes: 47 additions & 0 deletions src/onedrive/onedrive-images/onedriveimagesplugin.h
@@ -0,0 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2015 Jolla Ltd.
** Contact: Antti Seppälä <antti.seppala@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 ONEDRIVEIMAGESPLUGIN_H
#define ONEDRIVEIMAGESPLUGIN_H

#include "socialdbuteoplugin.h"

class SOCIALDBUTEOPLUGIN_EXPORT OneDriveImagesPlugin : public SocialdButeoPlugin
{
Q_OBJECT

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

protected:
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor();
};

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

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

#endif // ONEDRIVEIMAGESPLUGIN_H

0 comments on commit c80097e

Please sign in to comment.