Buteo Synchronization Framework
PluginRunner.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
24#ifndef PLUGINRUNNER_H
25#define PLUGINRUNNER_H
26
27#include <SyncResults.h>
28#include "SyncCommonDefs.h"
29#include "SyncPluginBase.h"
30#include <QObject>
31#include <QString>
32
33namespace Buteo {
34
35class PluginManager;
36class PluginCbInterface;
37
44class PluginRunner : public QObject
45{
46 Q_OBJECT
47
48public:
51 PLUGIN_CLIENT,
52 PLUGIN_SERVER
53 };
54
64 PluginRunner(PluginType aPluginType, const QString &aPluginName,
65 PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf,
66 QObject *aParent = 0);
67
74 virtual bool init() = 0;
75
80 virtual bool start() = 0;
81
86 virtual void stop() = 0;
87
94 virtual void abort(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED) = 0;
95
103
108 virtual bool cleanUp() = 0;
109
114 PluginType pluginType() const;
115
120 QString pluginName() const;
121
126 virtual SyncPluginBase *plugin() = 0;
127
128signals:
130 void transferProgress(const QString &aProfileName,
131 Sync::TransferDatabase aDatabase, Sync::TransferType aType,
132 const QString &aMimeType, int aCommittedItems);
133
135 void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode);
136
138 void success(const QString &aProfileName, const QString &aMessage);
139
141 void storageAccquired (const QString &aMimeType);
142
144 void syncProgressDetail(const QString &aProfileName, int aProgressDetail);
145
150 void done();
151
153 void newSession(const QString &aDestination);
154
156 void connectivityStateChanged(Sync::ConnectivityType aType, bool aState);
157
158protected:
161
164
167
170
172 QString iPluginName;
173
174private:
175#ifdef SYNCFW_UNIT_TESTS
176 friend class PluginRunnerTest;
177#endif
178};
179
180}
181
182#endif // PLUGINRUNNER_H
Interface which client and server plugins can use to communicate with synchronization daemon.
Definition PluginCbInterface.h:39
Manages plugins.
Definition PluginManager.h:56
Base class for running sync plug-ins.
Definition PluginRunner.h:45
PluginType
Plug-in type: client or server.
Definition PluginRunner.h:50
virtual bool start()=0
Starts running the plug-in.
PluginType iType
type of the plugin
Definition PluginRunner.h:169
QString iPluginName
name of the plugin
Definition PluginRunner.h:172
PluginManager * iPluginMgr
pointer to an instance of plugin manager
Definition PluginRunner.h:163
void success(const QString &aProfileName, const QString &aMessage)
Definition moc_PluginRunner.cpp:262
void storageAccquired(const QString &aMimeType)
Definition moc_PluginRunner.cpp:269
void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)
Definition moc_PluginRunner.cpp:296
virtual bool cleanUp()=0
Calls the cleanup for the plugin.
void syncProgressDetail(const QString &aProfileName, int aProgressDetail)
Definition moc_PluginRunner.cpp:276
void done()
Signal sent when the plug-in runner has finished.
Definition moc_PluginRunner.cpp:283
virtual void abort(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)=0
Aborts running the plug-in.
virtual SyncResults syncResults()=0
Gets the sync results from the plug-in.
PluginType pluginType() const
Gets the plug-in type.
Definition PluginRunner.cpp:51
QString pluginName() const
Gets the plug-in name.
Definition PluginRunner.cpp:58
virtual SyncPluginBase * plugin()=0
Gets the plug-in associated with this plug-in runner.
void transferProgress(const QString &aProfileName, Sync::TransferDatabase aDatabase, Sync::TransferType aType, const QString &aMimeType, int aCommittedItems)
Definition moc_PluginRunner.cpp:248
void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Definition moc_PluginRunner.cpp:255
virtual void stop()=0
Stops running the plug-in.
PluginCbInterface * iPluginCbIf
pointer to an instance of synchronizer
Definition PluginRunner.h:166
void newSession(const QString &aDestination)
Definition moc_PluginRunner.cpp:289
virtual bool init()=0
Initializes the plug-in runner.
bool iInitialized
Initialization status of the plugin.
Definition PluginRunner.h:160
Base class for client and server plugins.
Definition SyncPluginBase.h:46
Contains information about a completed synchronization session.
Definition SyncResults.h:62
MinorCode
enum value
Definition SyncResults.h:89