Buteo Synchronization Framework
ClientThread.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#ifndef CLIENTTHREAD_H
24#define CLIENTTHREAD_H
25
26#include <QThread>
27#include <QMutex>
28#include <SyncResults.h>
29
30#include "SignOn/AuthService"
31#include "SignOn/Identity"
32
33namespace Buteo {
34
35class ClientPlugin;
36
40class ClientThread : public QThread
41{
42 Q_OBJECT
43public:
44
49
53 virtual ~ClientThread();
54
59 QString getProfileName() const;
60
65 ClientPlugin *getPlugin() const;
66
73 bool startThread(ClientPlugin *aClientPlugin);
74
78 void stopThread();
79
84
85signals:
86
94 void initError(const QString &aProfileName, const QString &aMessage,
95 SyncResults::MinorCode aErrorCode);
96
97protected:
100 virtual void run();
101
102private:
103 ClientPlugin *iClientPlugin;
104
105 SyncResults iSyncResults;
106
107 SignOn::Identity *iIdentity;
108 SignOn::AuthService *iService;
109 SignOn::AuthSession *iSession;
110 QString iProvider;
111
112 bool iRunning;
113
114 mutable QMutex iMutex;
115
116#ifdef SYNCFW_UNIT_TESTS
117 friend class ClientThreadTest;
118#endif
119
133 bool startSync();
134
135private slots:
136 void identities(const QList<SignOn::IdentityInfo> &identityList);
137 void identityResponse(const SignOn::SessionData &session);
138 void identityError(SignOn::Error error);
139};
140
141}
142
143#endif // CLIENTTHREAD_H
Base class for client plugins.
Definition ClientPlugin.h:38
Thread for client plugins.
Definition ClientThread.h:41
bool startThread(ClientPlugin *aClientPlugin)
Starts client thread.
Definition ClientThread.cpp:68
ClientThread()
Constructor.
Definition ClientThread.cpp:30
void initError(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Emitted when synchronization cannot be started due to an error in plugin initialization.
Definition moc_ClientThread.cpp:185
SyncResults getSyncResults()
Returns the results for this particular thread.
Definition ClientThread.cpp:151
void stopThread()
Stops client thread.
Definition ClientThread.cpp:113
virtual ~ClientThread()
Destructor.
Definition ClientThread.cpp:40
virtual void run()
overriding method for QThread::run
Definition ClientThread.cpp:119
ClientPlugin * getPlugin() const
Returns plugin that this thread is running.
Definition ClientThread.cpp:61
QString getProfileName() const
Returns profile that this thread is running.
Definition ClientThread.cpp:49
Contains information about a completed synchronization session.
Definition SyncResults.h:62
MinorCode
enum value
Definition SyncResults.h:89
Definition SyncBackupAdaptor.h:40