Skip to content

Commit

Permalink
[buteo-sync-plugins-social] Implement Dropbox backup/restore sync plu…
Browse files Browse the repository at this point in the history
…gin. Contributes to MER#1323

This commit implements a backup sync plugin for Dropbox.

Contributes to MER#1323
  • Loading branch information
Chris Adams committed Oct 9, 2015
1 parent 63beb7a commit e8f4b7e
Show file tree
Hide file tree
Showing 16 changed files with 1,017 additions and 2 deletions.
28 changes: 28 additions & 0 deletions rpm/sociald.spec
Expand Up @@ -396,6 +396,34 @@ rm -f /home/nemo/.cache/msyncd/sync/onedrive.Backup.xml
systemctl-user try-restart msyncd.service || :



%package dropbox-backup
Summary: Provides backup-blob synchronization for Dropbox
License: LGPLv2.1
Group: System/Libraries
BuildRequires: qt5-qttools-linguist
Requires: %{name} = %{version}-%{release}

%description dropbox-backup
Provides backup-blob synchronization for Dropbox

%files dropbox-backup
#out-of-process-plugin form:
/usr/lib/buteo-plugins-qt5/oopp/dropbox-backup-client
#in-process-plugin form:
#/usr/lib/buteo-plugins-qt5/libdropbox-backup-client.so
%config %{_sysconfdir}/buteo/profiles/client/dropbox-backup.xml
%config %{_sysconfdir}/buteo/profiles/sync/dropbox.Backup.xml

%pre dropbox-backup
rm -f /home/nemo/.cache/msyncd/sync/client/dropbox-backup.xml
rm -f /home/nemo/.cache/msyncd/sync/dropbox.Backup.xml

%post dropbox-backup
systemctl-user try-restart msyncd.service || :



%package ts-devel
Summary: Translation source for sociald
License: LGPLv2.1
Expand Down
1 change: 1 addition & 0 deletions src/common/socialnetworksyncadaptor.cpp
Expand Up @@ -423,6 +423,7 @@ QString SocialNetworkSyncAdaptor::dataTypeName(SocialNetworkSyncAdaptor::DataTyp
case SocialNetworkSyncAdaptor::Messages: return QStringLiteral("Messages");
case SocialNetworkSyncAdaptor::Emails: return QStringLiteral("Emails");
case SocialNetworkSyncAdaptor::Signon: return QStringLiteral("Signon");
case SocialNetworkSyncAdaptor::Backup: return QStringLiteral("Backup");
default: break;
}

Expand Down
3 changes: 2 additions & 1 deletion src/common/socialnetworksyncadaptor.h
Expand Up @@ -73,7 +73,8 @@ class SocialNetworkSyncAdaptor : public QObject
Posts, // "Posts"
Messages, // "Messages"
Emails, // "Emails"
Signon // "Signon" -- for refreshing AccessTokens etc.
Signon, // "Signon" -- for refreshing AccessTokens etc.
Backup // "Backup" -- for storing backup/restore blobs
};
static QStringList validDataTypes();
static QString dataTypeName(DataType t);
Expand Down
7 changes: 7 additions & 0 deletions src/dropbox/dropbox-backup/dropbox-backup.pri
@@ -0,0 +1,7 @@
CONFIG += link_pkgconfig
PKGCONFIG += mlite5

SOURCES += $$PWD/dropboxbackupsyncadaptor.cpp
HEADERS += $$PWD/dropboxbackupsyncadaptor.h
INCLUDEPATH += $$PWD

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

DEFINES += "CLASSNAME=DropboxBackupPlugin"
DEFINES += CLASSNAME_H=\\\"dropboxbackupplugin.h\\\"
include($$PWD/../../common.pri)
include($$PWD/../dropbox-common.pri)
include($$PWD/dropbox-backup.pri)

dropbox_backup_sync_profile.path = /etc/buteo/profiles/sync
dropbox_backup_sync_profile.files = $$PWD/dropbox.Backup.xml
dropbox_backup_client_plugin_xml.path = /etc/buteo/profiles/client
dropbox_backup_client_plugin_xml.files = $$PWD/dropbox-backup.xml

HEADERS += dropboxbackupplugin.h
SOURCES += dropboxbackupplugin.cpp

OTHER_FILES += \
dropbox_backup_sync_profile.files \
dropbox_backup_client_plugin_xml.files

INSTALLS += \
target \
dropbox_backup_sync_profile \
dropbox_backup_client_plugin_xml
4 changes: 4 additions & 0 deletions src/dropbox/dropbox-backup/dropbox-backup.xml
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="dropbox-backup" type="client" >
<field name="Sync Direction" />
</profile>
15 changes: 15 additions & 0 deletions src/dropbox/dropbox-backup/dropbox.Backup.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<profile name="dropbox.Backup" type="sync" >
<key name="category" value="dropbox.Backup" />
<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="Dropbox Backup"/>

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

<profile name="dropbox-backup" type="client" >
<key name="Sync Direction" value="two-way" />
</profile>
</profile>
54 changes: 54 additions & 0 deletions src/dropbox/dropbox-backup/dropboxbackupplugin.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 "dropboxbackupplugin.h"
#include "dropboxbackupsyncadaptor.h"
#include "socialnetworksyncadaptor.h"

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

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

DropboxBackupPlugin::DropboxBackupPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
: SocialdButeoPlugin(pluginName, profile, callbackInterface,
QStringLiteral("dropbox"),
SocialNetworkSyncAdaptor::dataTypeName(SocialNetworkSyncAdaptor::Backup))
{
}

DropboxBackupPlugin::~DropboxBackupPlugin()
{
}

SocialNetworkSyncAdaptor *DropboxBackupPlugin::createSocialNetworkSyncAdaptor()
{
return new DropboxBackupSyncAdaptor(this);
}
47 changes: 47 additions & 0 deletions src/dropbox/dropbox-backup/dropboxbackupplugin.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 DROPBOXBACKUPPLUGIN_H
#define DROPBOXBACKUPPLUGIN_H

#include "socialdbuteoplugin.h"

class SOCIALDBUTEOPLUGIN_EXPORT DropboxBackupPlugin : public SocialdButeoPlugin
{
Q_OBJECT

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

protected:
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor();
};

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

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

#endif // DROPBOXBACKUPPLUGIN_H

0 comments on commit e8f4b7e

Please sign in to comment.