PluginRunner.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 PLUGINRUNNER_H
#define PLUGINRUNNER_H
#include <SyncResults.h>
#include "SyncCommonDefs.h"
#include "SyncPluginBase.h"
#include <QObject>
#include <QString>
namespace Buteo {
class PluginManager;
class PluginCbInterface;
class PluginRunner : public QObject
{
Q_OBJECT
public:
enum PluginType {
PLUGIN_CLIENT,
PLUGIN_SERVER
};
PluginRunner(PluginType aPluginType, const QString &aPluginName,
PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf,
QObject *aParent = 0);
virtual bool init() = 0;
virtual bool start() = 0;
virtual void stop() = 0;
virtual void abort(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED) = 0;
virtual SyncResults syncResults() = 0;
virtual bool cleanUp() = 0;
PluginType pluginType() const;
QString pluginName() const;
virtual SyncPluginBase *plugin() = 0;
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 storageAccquired (const QString &aMimeType);
void syncProgressDetail(const QString &aProfileName, int aProgressDetail);
void done();
void newSession(const QString &aDestination);
void connectivityStateChanged(Sync::ConnectivityType aType, bool aState);
protected:
bool iInitialized;
PluginManager *iPluginMgr;
PluginCbInterface *iPluginCbIf;
PluginType iType;
QString iPluginName;
private:
#ifdef SYNCFW_UNIT_TESTS
friend class PluginRunnerTest;
#endif
};
}
#endif // PLUGINRUNNER_H
Buteo::PluginCbInterface
Interface which client and server plugins can use to communicate with synchronization daemon.
Definition PluginCbInterface.h:39
Buteo::PluginManager
Manages plugins.
Definition PluginManager.h:56
Buteo::PluginRunner::PluginType
PluginType
Plug-in type: client or server.
Definition PluginRunner.h:50
Buteo::PluginRunner::start
virtual bool start()=0
Starts running the plug-in.
Buteo::PluginRunner::iType
PluginType iType
type of the plugin
Definition PluginRunner.h:169
Buteo::PluginRunner::iPluginName
QString iPluginName
name of the plugin
Definition PluginRunner.h:172
Buteo::PluginRunner::iPluginMgr
PluginManager * iPluginMgr
pointer to an instance of plugin manager
Definition PluginRunner.h:163
Buteo::PluginRunner::success
void success(const QString &aProfileName, const QString &aMessage)
Buteo::PluginRunner::storageAccquired
void storageAccquired(const QString &aMimeType)
Buteo::PluginRunner::connectivityStateChanged
void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)
Buteo::PluginRunner::cleanUp
virtual bool cleanUp()=0
Calls the cleanup for the plugin.
Buteo::PluginRunner::syncProgressDetail
void syncProgressDetail(const QString &aProfileName, int aProgressDetail)
Buteo::PluginRunner::done
void done()
Signal sent when the plug-in runner has finished.
Buteo::PluginRunner::abort
virtual void abort(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)=0
Aborts running the plug-in.
Buteo::PluginRunner::syncResults
virtual SyncResults syncResults()=0
Gets the sync results from the plug-in.
Buteo::PluginRunner::pluginType
PluginType pluginType() const
Gets the plug-in type.
Definition PluginRunner.cpp:51
Buteo::PluginRunner::pluginName
QString pluginName() const
Gets the plug-in name.
Definition PluginRunner.cpp:58
Buteo::PluginRunner::plugin
virtual SyncPluginBase * plugin()=0
Gets the plug-in associated with this plug-in runner.
Buteo::PluginRunner::transferProgress
void transferProgress(const QString &aProfileName, Sync::TransferDatabase aDatabase, Sync::TransferType aType, const QString &aMimeType, int aCommittedItems)
Buteo::PluginRunner::error
void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Buteo::PluginRunner::stop
virtual void stop()=0
Stops running the plug-in.
Buteo::PluginRunner::iPluginCbIf
PluginCbInterface * iPluginCbIf
pointer to an instance of synchronizer
Definition PluginRunner.h:166
Buteo::PluginRunner::newSession
void newSession(const QString &aDestination)
Buteo::PluginRunner::init
virtual bool init()=0
Initializes the plug-in runner.
Buteo::PluginRunner::iInitialized
bool iInitialized
Initialization status of the plugin.
Definition PluginRunner.h:160
Buteo::PluginRunner::PluginRunner
PluginRunner(PluginType aPluginType, const QString &aPluginName, PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf, QObject *aParent=0)
Constructor.
Definition PluginRunner.cpp:30
Buteo::SyncPluginBase
Base class for client and server plugins.
Definition SyncPluginBase.h:46
Buteo::SyncResults
Contains information about a completed synchronization session.
Definition SyncResults.h:67
Buteo::SyncResults::MinorCode
MinorCode
enum value
Definition SyncResults.h:93