SyncClientInterface.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 SYNCCLIENTINTERFACE_H
#define SYNCCLIENTINTERFACE_H
#include <QObject>
#include <QString>
#include <QSharedPointer>
#include <Profile.h>
#include <SyncProfile.h>
#include <SyncResults.h>
#include <SyncSchedule.h>
class QDBusPendingCallWatcher;
namespace Buteo {
class SyncClientInterfacePrivate;
class SyncClientInterface: public QObject
{
Q_OBJECT
public:
SyncClientInterface();
~SyncClientInterface();
bool startSync(const QString &aProfileId) const;
QDBusPendingCallWatcher* requestSync(const QString &aProfileId, QObject *aParent = nullptr) const;
void abortSync(const QString &aProfileId) const;
QStringList getRunningSyncList() const;
QDBusPendingCallWatcher* requestRunningSyncList(QObject *aParent = nullptr) const;
bool setSyncSchedule(const QString &aProfileId, const SyncSchedule &aSchedule);
bool saveSyncResults(const QString &aProfileId, const Buteo::SyncResults &aSyncResults);
bool removeProfile(const QString &aProfileId) const;
bool updateProfile(const Buteo::SyncProfile &aSyncProfile);
bool getBackUpRestoreState();
bool isValid() const;
Buteo::SyncResults getLastSyncResult(const QString &aProfileId);
QList<QString /*profileAsXml*/> allVisibleSyncProfiles();
QDBusPendingCallWatcher* requestAllVisibleSyncProfiles(QObject *aParent = nullptr) const;
QString syncProfile(const QString &aProfileId);
QStringList syncProfilesByKey(const QString &aKey, const QString &aValue);
QDBusPendingCallWatcher* requestSyncProfilesByKey(const QString &aKey, const QString &aValue, QObject *aParent = nullptr) const;
QStringList profilesByType(const QString &aType);
QDBusPendingCallWatcher* requestProfilesByType(const QString &aProfileId, QObject *aParent = nullptr) const;
QStringList syncProfilesByType(const QString &aType);
static QSharedPointer<SyncClientInterface> sharedInstance();
signals:
void isValidChanged();
void backupInProgress ();
void backupDone();
void restoreInProgress();
void restoreDone();
void profileChanged(QString aProfileId, int aChangeType, QString aChangedProfile);
void resultsAvailable(QString aProfileId, Buteo::SyncResults aResults);
void syncStatus(QString aProfileId, int aStatus,
QString aMessage, int aStatusDetails);
void transferProgress(QString aProfileId, int aTransferDatabase,
int aTransferType, QString aMimeType, int aCommittedItems);
private:
SyncClientInterfacePrivate *d_ptr;
};
}
#endif
Buteo::SyncClientInterfacePrivate
Private implementation class for SyncClientInterface.
Definition SyncClientInterfacePrivate.h:42
Buteo::SyncClientInterface::requestSyncProfilesByKey
QDBusPendingCallWatcher * requestSyncProfilesByKey(const QString &aKey, const QString &aValue, QObject *aParent=nullptr) const
asynchronous version of syncProfilesByKey().
Definition SyncClientInterface.cpp:136
Buteo::SyncClientInterface::transferProgress
void transferProgress(QString aProfileId, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
Notifies about progress in transferring items.
Buteo::SyncClientInterface::requestAllVisibleSyncProfiles
QDBusPendingCallWatcher * requestAllVisibleSyncProfiles(QObject *aParent=nullptr) const
asynchronous version of allVisibleSyncProfiles()
Definition SyncClientInterface.cpp:120
Buteo::SyncClientInterface::profileChanged
void profileChanged(QString aProfileId, int aChangeType, QString aChangedProfile)
Notifies about a change in profile.
Buteo::SyncClientInterface::syncStatus
void syncStatus(QString aProfileId, int aStatus, QString aMessage, int aStatusDetails)
Notifies about a change in synchronization status.
Buteo::SyncClientInterface::profilesByType
QStringList profilesByType(const QString &aType)
Gets profiles matching the profile type.
Definition SyncClientInterface.cpp:147
Buteo::SyncClientInterface::syncProfile
QString syncProfile(const QString &aProfileId)
Gets a sync profile.
Definition SyncClientInterface.cpp:126
Buteo::SyncClientInterface::syncProfilesByKey
QStringList syncProfilesByKey(const QString &aKey, const QString &aValue)
Gets a sync profiles which matches the key-value.
Definition SyncClientInterface.cpp:131
Buteo::SyncClientInterface::updateProfile
bool updateProfile(const Buteo::SyncProfile &aSyncProfile)
This function should be called when sync profile information has been changed by the client.
Definition SyncClientInterface.cpp:84
Buteo::SyncClientInterface::SyncClientInterface
SyncClientInterface()
Constructor.
Definition SyncClientInterface.cpp:43
Buteo::SyncClientInterface::removeProfile
bool removeProfile(const QString &aProfileId) const
This function should be called when sync profile has to be deleted.
Definition SyncClientInterface.cpp:79
Buteo::SyncClientInterface::allVisibleSyncProfiles
QList< QString > allVisibleSyncProfiles()
Gets all visible sync profiles.
Definition SyncClientInterface.cpp:115
Buteo::SyncClientInterface::requestSync
QDBusPendingCallWatcher * requestSync(const QString &aProfileId, QObject *aParent=nullptr) const
asynchronous version of startSync()
Definition SyncClientInterface.cpp:59
Buteo::SyncClientInterface::isValidChanged
void isValidChanged()
Notifies when the synchronisation service is available or not.
Buteo::SyncClientInterface::requestRunningSyncList
QDBusPendingCallWatcher * requestRunningSyncList(QObject *aParent=nullptr) const
asynchronous version of getRunningSyncList()
Definition SyncClientInterface.cpp:74
Buteo::SyncClientInterface::getLastSyncResult
Buteo::SyncResults getLastSyncResult(const QString &aProfileId)
To get lastSyncResult.
Definition SyncClientInterface.cpp:109
Buteo::SyncClientInterface::setSyncSchedule
bool setSyncSchedule(const QString &aProfileId, const SyncSchedule &aSchedule)
Sets Sync Schedule to the profile.
Definition SyncClientInterface.cpp:89
Buteo::SyncClientInterface::syncProfilesByType
QStringList syncProfilesByType(const QString &aType)
Gets a profiles matching the profile type.
Definition SyncClientInterface.cpp:142
Buteo::SyncClientInterface::requestProfilesByType
QDBusPendingCallWatcher * requestProfilesByType(const QString &aProfileId, QObject *aParent=nullptr) const
asynchronous version of profilesByType()
Definition SyncClientInterface.cpp:152
Buteo::SyncClientInterface::getBackUpRestoreState
bool getBackUpRestoreState()
This function returns true if backup/restore in progress else false.
Definition SyncClientInterface.cpp:99
Buteo::SyncClientInterface::~SyncClientInterface
~SyncClientInterface()
Destructor.
Definition SyncClientInterface.cpp:48
Buteo::SyncClientInterface::restoreDone
void restoreDone()
Notifies about Restore Done.
Buteo::SyncClientInterface::abortSync
void abortSync(const QString &aProfileId) const
Stops synchronizing the profile with the given Id.
Definition SyncClientInterface.cpp:64
Buteo::SyncClientInterface::backupDone
void backupDone()
Notifies about Backup done.
Buteo::SyncClientInterface::sharedInstance
static QSharedPointer< SyncClientInterface > sharedInstance()
creates a process singleton
Definition SyncClientInterface.cpp:31
Buteo::SyncClientInterface::isValid
bool isValid() const
Use this function to understand if the dbus connection to msyncd is working or not.
Definition SyncClientInterface.cpp:104
Buteo::SyncClientInterface::backupInProgress
void backupInProgress()
Notifies about Backup start.
Buteo::SyncClientInterface::saveSyncResults
bool saveSyncResults(const QString &aProfileId, const Buteo::SyncResults &aSyncResults)
Save SyncResults to log.xml file.
Definition SyncClientInterface.cpp:94
Buteo::SyncClientInterface::getRunningSyncList
QStringList getRunningSyncList() const
Gets the list of profile names of currently running syncs.
Definition SyncClientInterface.cpp:69
Buteo::SyncClientInterface::restoreInProgress
void restoreInProgress()
Notifies about Restore start.
Buteo::SyncClientInterface::startSync
bool startSync(const QString &aProfileId) const
Requests to starts synchronizing using a profile Id.
Definition SyncClientInterface.cpp:54
Buteo::SyncClientInterface::resultsAvailable
void resultsAvailable(QString aProfileId, Buteo::SyncResults aResults)
Notifies about the results of a recent sync for a profile.
Buteo::SyncProfile
A top level synchronization profile.
Definition SyncProfile.h:49
Buteo::SyncResults
Contains information about a completed synchronization session.
Definition SyncResults.h:67
Buteo::SyncSchedule
Class for handling sync schedule settings.
Definition SyncSchedule.h:53
QList
Definition SyncBackupAdaptor.h:40