Buteo Synchronization Framework
SyncClientInterface.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 SYNCCLIENTINTERFACE_H
25#define SYNCCLIENTINTERFACE_H
26
27#include <QObject>
28#include <QString>
29#include <QSharedPointer>
30#include <Profile.h>
31#include <SyncProfile.h>
32#include <SyncResults.h>
33#include <SyncSchedule.h>
34
35class QDBusPendingCallWatcher;
36
37namespace Buteo {
38
39class SyncClientInterfacePrivate;
40
51class SyncClientInterface: public QObject
52{
53 Q_OBJECT
54
55public:
60
65
79 bool startSync(const QString &aProfileId) const;
80
88 QDBusPendingCallWatcher* requestSync(const QString &aProfileId, QObject *aParent = nullptr) const;
89
98 void abortSync(const QString &aProfileId) const;
99
105 QStringList getRunningSyncList() const;
106
113 QDBusPendingCallWatcher* requestRunningSyncList(QObject *aParent = nullptr) const;
114
126 bool setSyncSchedule(const QString &aProfileId, const SyncSchedule &aSchedule);
127
134 bool saveSyncResults(const QString &aProfileId, const Buteo::SyncResults &aSyncResults);
135
142 bool removeProfile(const QString &aProfileId) const;
143
153 bool updateProfile(const Buteo::SyncProfile &aSyncProfile);
154
160
166 bool isValid() const;
167
172 Buteo::SyncResults getLastSyncResult(const QString &aProfileId);
173
180 QList<QString /*profileAsXml*/> allVisibleSyncProfiles();
181
188 QDBusPendingCallWatcher* requestAllVisibleSyncProfiles(QObject *aParent = nullptr) const;
189
198 QString syncProfile(const QString &aProfileId);
199
209 QStringList syncProfilesByKey(const QString &aKey, const QString &aValue);
210
218 QDBusPendingCallWatcher* requestSyncProfilesByKey(const QString &aKey, const QString &aValue, QObject *aParent = nullptr) const;
219
225 QStringList profilesByType(const QString &aType);
226
234 QDBusPendingCallWatcher* requestProfilesByType(const QString &aProfileId, QObject *aParent = nullptr) const;
235
241 QStringList syncProfilesByType(const QString &aType);
242
250 static QSharedPointer<SyncClientInterface> sharedInstance();
251
252signals:
257 void isValidChanged();
258
264 void backupInProgress ();
265
271 void backupDone();
272
278 void restoreInProgress();
279
285 void restoreDone();
286
299 void profileChanged(QString aProfileId, int aChangeType, QString aChangedProfile);
300
308 void resultsAvailable(QString aProfileId, Buteo::SyncResults aResults);
309
333 void syncStatus(QString aProfileId, int aStatus,
334 QString aMessage, int aStatusDetails);
335
350 void transferProgress(QString aProfileId, int aTransferDatabase,
351 int aTransferType, QString aMimeType, int aCommittedItems);
352
353private:
355};
356
357};
358
359#endif
Private implementation class for SyncClientInterface.
Definition SyncClientInterfacePrivate.h:42
SyncInterface Class - Main Entry Point for SyncFW Clients.
Definition SyncClientInterface.h:52
QDBusPendingCallWatcher * requestSyncProfilesByKey(const QString &aKey, const QString &aValue, QObject *aParent=nullptr) const
asynchronous version of syncProfilesByKey().
Definition SyncClientInterface.cpp:137
void transferProgress(QString aProfileId, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
Notifies about progress in transferring items.
Definition moc_SyncClientInterface.cpp:298
QDBusPendingCallWatcher * requestAllVisibleSyncProfiles(QObject *aParent=nullptr) const
asynchronous version of allVisibleSyncProfiles()
Definition SyncClientInterface.cpp:121
void profileChanged(QString aProfileId, int aChangeType, QString aChangedProfile)
Notifies about a change in profile.
Definition moc_SyncClientInterface.cpp:277
void syncStatus(QString aProfileId, int aStatus, QString aMessage, int aStatusDetails)
Notifies about a change in synchronization status.
Definition moc_SyncClientInterface.cpp:291
QStringList profilesByType(const QString &aType)
Gets profiles matching the profile type.
Definition SyncClientInterface.cpp:147
QString syncProfile(const QString &aProfileId)
Gets a sync profile.
Definition SyncClientInterface.cpp:127
QStringList syncProfilesByKey(const QString &aKey, const QString &aValue)
Gets a sync profiles which matches the key-value.
Definition SyncClientInterface.cpp:132
bool updateProfile(const Buteo::SyncProfile &aSyncProfile)
This function should be called when sync profile information has been changed by the client.
Definition SyncClientInterface.cpp:85
SyncClientInterface()
Constructor.
Definition SyncClientInterface.cpp:43
bool removeProfile(const QString &aProfileId) const
This function should be called when sync profile has to be deleted.
Definition SyncClientInterface.cpp:80
QList< QString > allVisibleSyncProfiles()
Gets all visible sync profiles.
Definition SyncClientInterface.cpp:116
QDBusPendingCallWatcher * requestSync(const QString &aProfileId, QObject *aParent=nullptr) const
asynchronous version of startSync()
Definition SyncClientInterface.cpp:60
void isValidChanged()
Notifies when the synchronisation service is available or not.
Definition moc_SyncClientInterface.cpp:247
QDBusPendingCallWatcher * requestRunningSyncList(QObject *aParent=nullptr) const
asynchronous version of getRunningSyncList()
Definition SyncClientInterface.cpp:75
Buteo::SyncResults getLastSyncResult(const QString &aProfileId)
To get lastSyncResult.
Definition SyncClientInterface.cpp:110
bool setSyncSchedule(const QString &aProfileId, const SyncSchedule &aSchedule)
Sets Sync Schedule to the profile.
Definition SyncClientInterface.cpp:90
QStringList syncProfilesByType(const QString &aType)
Gets a profiles matching the profile type.
Definition SyncClientInterface.cpp:142
QDBusPendingCallWatcher * requestProfilesByType(const QString &aProfileId, QObject *aParent=nullptr) const
asynchronous version of profilesByType()
Definition SyncClientInterface.cpp:152
bool getBackUpRestoreState()
This function returns true if backup/restore in progress else false.
Definition SyncClientInterface.cpp:100
~SyncClientInterface()
Destructor.
Definition SyncClientInterface.cpp:49
void restoreDone()
Notifies about Restore Done.
Definition moc_SyncClientInterface.cpp:271
void abortSync(const QString &aProfileId) const
Stops synchronizing the profile with the given Id.
Definition SyncClientInterface.cpp:65
void backupDone()
Notifies about Backup done.
Definition moc_SyncClientInterface.cpp:259
static QSharedPointer< SyncClientInterface > sharedInstance()
creates a process singleton
Definition SyncClientInterface.cpp:31
bool isValid() const
Use this function to understand if the dbus connection to msyncd is working or not.
Definition SyncClientInterface.cpp:105
void backupInProgress()
Notifies about Backup start.
Definition moc_SyncClientInterface.cpp:253
bool saveSyncResults(const QString &aProfileId, const Buteo::SyncResults &aSyncResults)
Save SyncResults to log.xml file.
Definition SyncClientInterface.cpp:95
QStringList getRunningSyncList() const
Gets the list of profile names of currently running syncs.
Definition SyncClientInterface.cpp:70
void restoreInProgress()
Notifies about Restore start.
Definition moc_SyncClientInterface.cpp:265
bool startSync(const QString &aProfileId) const
Requests to starts synchronizing using a profile Id.
Definition SyncClientInterface.cpp:55
void resultsAvailable(QString aProfileId, Buteo::SyncResults aResults)
Notifies about the results of a recent sync for a profile.
Definition moc_SyncClientInterface.cpp:284
A top level synchronization profile.
Definition SyncProfile.h:49
Contains information about a completed synchronization session.
Definition SyncResults.h:62
Class for handling sync schedule settings.
Definition SyncSchedule.h:53
Definition SyncBackupAdaptor.h:40