2
* This file is part of buteo-syncfw package
4
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
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.
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.
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
25
#ifndef SYNCDBUSINTERFACE_H
26
#define SYNCDBUSINTERFACE_H
35
* \brief Defines a D-Bus interface for the sync daemon.
37
* A XML file describing the interface can be generated from this class using
38
* qdbuscpp2xml tool. This XML file can then be used to generate interface
39
* adaptor and proxy classes using qdbusxml2cpp tool.
41
class SyncDBusInterface : public QObject
44
Q_CLASSINFO("D-Bus Interface", "com.nokia.msyncd")
51
* \brief Notifies about a change in synchronization status.
53
* \param aProfileName Name of the profile used in the sync session whose
55
* \param aStatus The new status. One of the following:
56
* 0 (QUEUED): Sync request has been queued or was already in the
57
* queue when sync start was requested.
58
* 1 (STARTED): Sync session has been started.
59
* 2 (PROGRESS): Sync session is progressing.
60
* 3 (ERROR): Sync session has encountered an error and has been stopped,
61
* or the session could not be started at all.
62
* 4 (DONE): Sync session was successfully completed.
63
* 5 (ABORTED): Sync session was aborted.
64
* Statuses 3-5 are final, no more status changes will be sent from the
66
* \param aMessage A message describing the status change in detail. This
67
* can for example be shown to the user or written to a log
68
* \param aErrorCode When aStatus is ERROR, this parameter contains a
69
* specific error code.
71
void syncStatus(QString aProfileName, int aStatus,
72
QString aMessage, int aErrorCode);
74
/*! \brief Notifies about progress in transferring items
76
* \param aProfileName Name of the profile where progress has occurred
77
* \param aTransferDatabase Database to which transfer was made. One of the following:
78
* 0 (LOCAL_DATABASE): Transfer was made from remote database to local database
79
* 1 (REMOTE_DATABASE): Transfer was made from local database to remote database
80
* \param aTransferType Type of transfer that was made. One of the following:
81
* 0 (ADDITION): Addition was made to database
82
* 1 (MODIFICATION): Modification was made to database
83
* 2 (DELETION): Deletion was made to database
84
* 3 (ERROR): Addition/Modification/Deletion was attempted, but it failed
85
* \param aMimeType Mime type of the processed item
87
void transferProgress(QString aProfileName, int aTransferDatabase,
88
int aTransferType , QString aMimeType);
90
/*! \brief Notifies about a change in profile.
92
* This signal is sent when the profile data is modified or when a profile
93
* is added or deleted in msyncd.
94
* \param aProfileName Name of the changed profile.
96
* 0 (ADDITION): Profile was added.
97
* 1 (MODIFICATION): Profile was modified.
98
* 2 (DELETION): Profile was deleted.
100
void signalProfileChanged(QString aProfileName, int aChangeType);
105
* \brief Requests to starts synchronizing using a profile with the given
108
* A status change signal (QUEUED, STARTED or ERROR) will be sent by the
109
* daemon when the request is processed. If there is a sync already in
110
* progress using the same resources that are needed by the given profile,
111
* adds the sync request to a sync queue. Otherwise a sync session is
112
* started immediately.
114
* \param aProfileName Name of the profile to use in sync.
115
* \return True if a profile with the given name was found. Otherwise
116
* false and no status change signals will follow from this request.
118
virtual bool startSync(QString aProfileName) = 0;
121
* \brief Stops synchronizing the profile with the given name.
123
* If the sync request is still in queue and not yet started, the queue
126
* \param aProfileName Name of the profile to stop syncing.
128
virtual Q_NOREPLY void abortSync(QString aProfileName) = 0;
131
* \brief This function should be called when sync profile information has
132
* been changed by someone else than the sync daemon.
134
* This way the daemon knows to update its information and for example
135
* verify if automatic synchronization settings have changed and take
136
* appropriate actions. Call this function also if a profile is deleted or
137
* a new profile is added.
139
* \param aProfileName Name of the modified profile. If this is empty, sync
140
* daemon should refresh information of all profiles.
142
virtual Q_NOREPLY void profileChanged(QString aProfileName) = 0;
145
* \brief Requests sync daemon to reserve storages for the caller.
147
* This function must be called if an external sync entity (like Active
148
* Sync engine) wants to use the same storages that the sync daemon uses,
149
* because concurrent access might lead to data corruption. If none of the
150
* requested storages is currently used by the sync daemon, they are all
151
* marked as reserved and can not be used by the daemon until the storages
152
* are freed by calling releaseStorages. If one or more of the requested
153
* storages is already in use, none of them is reserved.
155
* \param aStorageNames Names of the storages to reserve.
156
* \return Success indicator. True if all requested storages were
157
* successfully reserved. False if request failed and no storages were
160
virtual bool requestStorages(QStringList aStorageNames) = 0;
163
* \brief Releases the given storages so that sync daemon can again use
166
* This function must be called after a successful requestStorages call,
167
* when the reserved storages are not used by the caller any more.
169
virtual Q_NOREPLY void releaseStorages(QStringList aStorageNames) = 0;
172
* \brief Gets the list of profile names of currently running syncs.
174
* \return Profile name list.
176
virtual QStringList runningSyncs() = 0;
182
#endif // SYNCDBUSINTERFACE_H