SyncPluginBase.h
/*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This 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 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SYNCPLUGINBASE_H
#define SYNCPLUGINBASE_H
#include "SyncCommonDefs.h"
#include "SyncResults.h"
#include "ButeoPluginIface.h"
#include <QString>
#include <QMetaType>
#include <QObject>
#include <QMap>
#define DBUS_SERVICE_NAME_PREFIX "com.buteo.msyncd.plugin."
#define DBUS_SERVICE_OBJ_PATH "/"
namespace Buteo {
class PluginCbInterface;
class SyncPluginBase : public QObject
{
Q_OBJECT
public:
SyncPluginBase(const QString &aPluginName,
const QString &aProfileName,
PluginCbInterface *aCbInterface);
QString getPluginName() const;
QString getProfileName() const;
virtual bool init() = 0;
virtual bool uninit() = 0;
virtual void abortSync(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED)
{
Q_UNUSED(aStatus);
}
virtual bool cleanUp() = 0;
virtual SyncResults getSyncResults() const;
signals:
void transferProgress(const QString &aProfileName, Sync::TransferDatabase aDatabase,
Sync::TransferType aType, const QString &aMimeType, int aCommittedItems);
void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode);
void success(const QString &aProfileName, const QString &aMessage);
void accquiredStorage(const QString &aMimeType);
void syncProgressDetail(const QString &aProfileName, int aProgressDetail);
public slots:
virtual void connectivityStateChanged(Sync::ConnectivityType aType, bool aState) = 0;
protected:
PluginCbInterface *iCbInterface;
struct ReceivedItemDetails {
int added;
int deleted;
int modified;
int error;
QString mime;
};
QMap<QString, ReceivedItemDetails> receivedItems;
ButeoPluginIface *iOopPluginIface;
private:
QString iPluginName;
QString iProfileName;
};
}
#endif // SYNCPLUGINBASE_H
ButeoPluginIface
Definition ButeoPluginIface.h:29
Buteo::PluginCbInterface
Interface which client and server plugins can use to communicate with synchronization daemon.
Definition PluginCbInterface.h:39
Buteo::SyncPluginBase::transferProgress
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...
Buteo::SyncPluginBase::syncProgressDetail
void syncProgressDetail(const QString &aProfileName, int aProgressDetail)
Emitted during Sync Progress to indicate the detail of the current ongoing sync.
Buteo::SyncPluginBase::getPluginName
QString getPluginName() const
Returns the name of this plugin.
Definition SyncPluginBase.cpp:47
Buteo::SyncPluginBase::success
void success(const QString &aProfileName, const QString &aMessage)
Emitted when synchronization has been finished successfully.
Buteo::SyncPluginBase::getProfileName
QString getProfileName() const
Returns profile name.
Definition SyncPluginBase.cpp:52
Buteo::SyncPluginBase::connectivityStateChanged
virtual void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)=0
Slot that is invoked by sync framework when changes occur in connectivity domains.
Buteo::SyncPluginBase::SyncPluginBase
SyncPluginBase(const QString &aPluginName, const QString &aProfileName, PluginCbInterface *aCbInterface)
Constructor.
Definition SyncPluginBase.cpp:30
Buteo::SyncPluginBase::init
virtual bool init()=0
Initializes the plugin.
Buteo::SyncPluginBase::error
void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Emitted when error has occurred in synchronization and it cannot be continued.
Buteo::SyncPluginBase::accquiredStorage
void accquiredStorage(const QString &aMimeType)
Emitted when a storage is requested and accquired.
Buteo::SyncPluginBase::abortSync
virtual void abortSync(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
Aborts synchronization.
Definition SyncPluginBase.h:95
Buteo::SyncPluginBase::getSyncResults
virtual SyncResults getSyncResults() const
Gets the results of the last completed sync session.
Definition SyncPluginBase.cpp:57
Buteo::SyncPluginBase::uninit
virtual bool uninit()=0
Uninitializes the plugin.
Buteo::SyncPluginBase::cleanUp
virtual bool cleanUp()=0
Cleans up any sync related stuff (e.g sync anchors etc) when the profile is deleted.
Buteo::SyncPluginBase::iCbInterface
PluginCbInterface * iCbInterface
Pointer to synchronizer.
Definition SyncPluginBase.h:171
Buteo::SyncResults
Contains information about a completed synchronization session.
Definition SyncResults.h:67
Buteo::SyncResults::MinorCode
MinorCode
enum value
Definition SyncResults.h:93
QMap
Definition SyncBackupAdaptor.h:41
Buteo::SyncPluginBase::ReceivedItemDetails
Definition SyncPluginBase.h:173