/usr/include/buteosyncfw5/SyncPluginBase.h is in libbuteosyncfw5-dev 0.7.21+16.04.20151216.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /*
* 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;
/*! \brief Base class for client and server plugins.
*
*/
class SyncPluginBase : public QObject
{
Q_OBJECT;
public:
/*! \brief Constructor
*
* @param aPluginName Name of this plugin
* @param aProfileName Profile name
* @param aCbInterface Pointer to the callback interface
*/
SyncPluginBase( const QString &aPluginName,
const QString &aProfileName,
PluginCbInterface *aCbInterface );
/*! \brief Returns the name of this plugin
*
* @return Name of the plugin
*/
QString getPluginName() const;
/*! \brief Returns profile name
*
* @return Profile
*/
QString getProfileName() const;
/*! \brief Initializes the plugin.
*
* It is recommended that the plugin should do not do any thread insecure
* initializations inside constructor, instead it should be done inside
* this method.
*
* @return True on success, otherwise false
*/
virtual bool init() = 0;
/*! \brief Uninitializes the plugin
*
* @return True on success, otherwise false
*/
virtual bool uninit() = 0;
/*! \brief Aborts synchronization
*
* Derived plug-in should implement this function and abort the sync
* session that is in progress when this function is called. A final signal
* (success or error) is still expected from the aborted session before
* it terminates.
*/
virtual void abortSync(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED) { Q_UNUSED(aStatus); }
/*! \brief Cleans up any sync related stuff (e.g sync anchors etc) when the
* profile is deleted
*
* Derived plug-in should implement this function and perform any cleanup
* operations if required when the profile is deleted
*/
virtual bool cleanUp() = 0;
/*! \brief Gets the results of the last completed sync session.
*
* This function should be called only after the sync session has finished,
* after an error or success signal has been emitted.
* The default implementation returns empty results, so derived plug-in
* should implement this function.
* @returns Sync results.
*/
virtual SyncResults getSyncResults() const;
signals:
/*! \brief Emitted when progress has been made in synchronization in
* transferring items between local and remote database.
*
* @param aProfileName Name of the profile being synchronized
* @param aDatabase Indicates if progress has been made to local or remote database
* @param aType Type of progress made (item added, modified or deleted)
* @param aMimeType Mime type of the processed item
* @param aCommittedItems No. of items committed for this operation
*/
void transferProgress( const QString &aProfileName, Sync::TransferDatabase aDatabase,
Sync::TransferType aType, const QString &aMimeType, int aCommittedItems );
/*! \brief Emitted when error has occurred in synchronization and it
* cannot be continued.
*
* @param aProfileName Name of the profile being synchronized
* @param aMessage Message data related to error event
* @param aErrorCode Error code
*/
void error( const QString &aProfileName, const QString &aMessage, int aErrorCode );
/*! \brief Emitted when synchronization has been finished successfully.
*
* @param aProfileName Name of the profile being synchronized
* @param aMessage Message data related to finish event
*/
void success( const QString &aProfileName, const QString &aMessage );
/*! \brief Emitted when a storage is requested and accquired.
*
* @param aMimeType Mime type of the processed item
*/
void accquiredStorage( const QString &aMimeType );
/*! \brief Emitted during Sync Progress to indicate the detail of the current ongoing sync
*
* @param aProfileName Profile Name
* @param aProgressDetail Progress in Detail \see Sync::SyncProgressDetail
*/
void syncProgressDetail( const QString &aProfileName, int aProgressDetail);
public slots:
/*! \brief Slot that is invoked by sync framework when changes occur in
* connectivity domains
*
* @param aType Connectivity domain
* @param aState True if connectivity domain is now available, otherwise false
*/
virtual void connectivityStateChanged( Sync::ConnectivityType aType, bool aState ) = 0;
protected:
//! Pointer to synchronizer
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
|