Buteo Synchronization Framework
ServerThread.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 SERVERTHREAD_H
24#define SERVERTHREAD_H
25
26#include <QThread>
27#include <QMutex>
28
29#include <SyncResults.h>
30
31namespace Buteo {
32
33class ServerPlugin;
34
38class ServerThread : public QThread
39{
40 Q_OBJECT
41
42public:
47
51 virtual ~ServerThread();
52
57 QString getProfileName() const;
58
63 ServerPlugin *getPlugin() const;
64
71 bool startThread( ServerPlugin *aServerPlugin);
72
76 void stopThread();
77
78signals:
86 void initError(const QString &aProfileName, const QString &aMessage,
87 SyncResults::MinorCode aErrorCode);
88
89protected:
91 virtual void run();
92
93private:
94 ServerPlugin *iServerPlugin;
95 bool iRunning;
96 mutable QMutex iMutex;
97
98#ifdef SYNCFW_UNIT_TESTS
99 friend class ServerThreadTest;
100#endif
101
102};
103
104}
105
106#endif // SERVERTHREAD_H
Base class for server plugins.
Definition ServerPlugin.h:37
QString getProfileName() const
Returns profile that this thread is running.
Definition ServerThread.cpp:44
void stopThread()
Stops server thread.
Definition ServerThread.cpp:90
void initError(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Emitted when synchronization cannot be started due to an error in plugin initialization.
bool startThread(ServerPlugin *aServerPlugin)
Starts server thread.
Definition ServerThread.cpp:63
virtual ~ServerThread()
Destructor.
Definition ServerThread.cpp:39
virtual void run()
overriding method of QThread::run
Definition ServerThread.cpp:96
ServerThread()
Constructor.
Definition ServerThread.cpp:32
ServerPlugin * getPlugin() const
Returns plugin that this thread is running.
Definition ServerThread.cpp:56
MinorCode
enum value
Definition SyncResults.h:93