Buteo Synchronization Framework
SyncPluginBase.h
1/*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23#ifndef SYNCPLUGINBASE_H
24#define SYNCPLUGINBASE_H
25
26#include "SyncCommonDefs.h"
27#include "SyncResults.h"
28#include "ButeoPluginIface.h"
29
30#include <QString>
31#include <QMetaType>
32#include <QObject>
33#include <QMap>
34
35#define DBUS_SERVICE_NAME_PREFIX "com.buteo.msyncd.plugin."
36#define DBUS_SERVICE_OBJ_PATH "/"
37
38namespace Buteo {
39
40class PluginCbInterface;
41
45class SyncPluginBase : public QObject
46{
47 Q_OBJECT
48
49public:
56 SyncPluginBase(const QString &aPluginName,
57 const QString &aProfileName,
58 PluginCbInterface *aCbInterface);
59
64 QString getPluginName() const;
65
70 QString getProfileName() const;
71
80 virtual bool init() = 0;
81
86 virtual bool uninit() = 0;
87
95 virtual void abortSync(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED)
96 {
97 Q_UNUSED(aStatus);
98 }
99
106 virtual bool cleanUp() = 0;
107
116 virtual SyncResults getSyncResults() const;
117
118signals:
119
129 void transferProgress(const QString &aProfileName, Sync::TransferDatabase aDatabase,
130 Sync::TransferType aType, const QString &aMimeType, int aCommittedItems);
131
139 void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode);
140
146 void success(const QString &aProfileName, const QString &aMessage);
147
152 void accquiredStorage(const QString &aMimeType);
153
159 void syncProgressDetail(const QString &aProfileName, int aProgressDetail);
160
161public slots:
162
169 virtual void connectivityStateChanged(Sync::ConnectivityType aType, bool aState) = 0;
170
171protected:
174
176 int added;
177 int deleted;
178 int modified;
179 int error;
180 QString mime;
181 };
182
184
185 ButeoPluginIface *iOopPluginIface;
186
187private:
188 QString iPluginName;
189 QString iProfileName;
190};
191
192}
193
194#endif // SYNCPLUGINBASE_H
Definition: ButeoPluginIface.h:29
Interface which client and server plugins can use to communicate with synchronization daemon.
Definition: PluginCbInterface.h:39
Base class for client and server plugins.
Definition: SyncPluginBase.h:46
void transferProgress(const QString &aProfileName, Sync::TransferDatabase aDatabase, Sync::TransferType aType, const QString &aMimeType, int aCommittedItems)
Emitted when progress has been made in synchronization in transferring items between local and remote...
Definition: moc_SyncPluginBase.cpp:221
void syncProgressDetail(const QString &aProfileName, int aProgressDetail)
Emitted during Sync Progress to indicate the detail of the current ongoing sync.
Definition: moc_SyncPluginBase.cpp:249
QString getPluginName() const
Returns the name of this plugin.
Definition: SyncPluginBase.cpp:46
void success(const QString &aProfileName, const QString &aMessage)
Emitted when synchronization has been finished successfully.
Definition: moc_SyncPluginBase.cpp:235
QString getProfileName() const
Returns profile name.
Definition: SyncPluginBase.cpp:51
virtual void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)=0
Slot that is invoked by sync framework when changes occur in connectivity domains.
SyncPluginBase(const QString &aPluginName, const QString &aProfileName, PluginCbInterface *aCbInterface)
Constructor.
Definition: SyncPluginBase.cpp:29
virtual bool init()=0
Initializes the plugin.
void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Emitted when error has occurred in synchronization and it cannot be continued.
Definition: moc_SyncPluginBase.cpp:228
void accquiredStorage(const QString &aMimeType)
Emitted when a storage is requested and accquired.
Definition: moc_SyncPluginBase.cpp:242
virtual void abortSync(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
Aborts synchronization.
Definition: SyncPluginBase.h:95
virtual SyncResults getSyncResults() const
Gets the results of the last completed sync session.
Definition: SyncPluginBase.cpp:56
virtual bool uninit()=0
Uninitializes the plugin.
virtual bool cleanUp()=0
Cleans up any sync related stuff (e.g sync anchors etc) when the profile is deleted.
PluginCbInterface * iCbInterface
Pointer to synchronizer.
Definition: SyncPluginBase.h:173
Contains information about a completed synchronization session.
Definition: SyncResults.h:62
MinorCode
enum value
Definition: SyncResults.h:89
Definition: SyncBackupAdaptor.h:41
Definition: SyncPluginBase.h:175