ClientThread.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 CLIENTTHREAD_H
#define CLIENTTHREAD_H
#include <QThread>
#include <QMutex>
#include <SyncResults.h>
#include "SignOn/AuthService"
#include "SignOn/Identity"
namespace Buteo {
class ClientPlugin;
class ClientThread : public QThread
{
Q_OBJECT
public:
ClientThread();
virtual ~ClientThread();
QString getProfileName() const;
ClientPlugin *getPlugin() const;
bool startThread(ClientPlugin *aClientPlugin);
void stopThread();
SyncResults getSyncResults();
signals:
void initError(const QString &aProfileName, const QString &aMessage,
SyncResults::MinorCode aErrorCode);
protected:
virtual void run();
private:
ClientPlugin *iClientPlugin;
SyncResults iSyncResults;
SignOn::Identity *iIdentity;
SignOn::AuthService *iService;
SignOn::AuthSession *iSession;
QString iProvider;
bool iRunning;
mutable QMutex iMutex;
#ifdef SYNCFW_UNIT_TESTS
friend class ClientThreadTest;
#endif
bool startSync();
private slots:
void identities(const QList<SignOn::IdentityInfo> &identityList);
void identityResponse(const SignOn::SessionData &session);
void identityError(SignOn::Error error);
};
}
#endif // CLIENTTHREAD_H
Buteo::ClientPlugin
Base class for client plugins.
Definition ClientPlugin.h:38
Buteo::ClientThread::startThread
bool startThread(ClientPlugin *aClientPlugin)
Starts client thread.
Definition ClientThread.cpp:68
Buteo::ClientThread::ClientThread
ClientThread()
Constructor.
Definition ClientThread.cpp:30
Buteo::ClientThread::initError
void initError(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Emitted when synchronization cannot be started due to an error in plugin initialization.
Buteo::ClientThread::getSyncResults
SyncResults getSyncResults()
Returns the results for this particular thread.
Definition ClientThread.cpp:152
Buteo::ClientThread::stopThread
void stopThread()
Stops client thread.
Definition ClientThread.cpp:115
Buteo::ClientThread::~ClientThread
virtual ~ClientThread()
Destructor.
Definition ClientThread.cpp:40
Buteo::ClientThread::run
virtual void run()
overriding method for QThread::run
Definition ClientThread.cpp:121
Buteo::ClientThread::getPlugin
ClientPlugin * getPlugin() const
Returns plugin that this thread is running.
Definition ClientThread.cpp:61
Buteo::ClientThread::getProfileName
QString getProfileName() const
Returns profile that this thread is running.
Definition ClientThread.cpp:49
Buteo::SyncResults
Contains information about a completed synchronization session.
Definition SyncResults.h:67
Buteo::SyncResults::MinorCode
MinorCode
enum value
Definition SyncResults.h:93
QList
Definition SyncBackupAdaptor.h:40