Buteo Synchronization Framework
ServerActivator.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 SERVERACTIVATOR_H_
25#define SERVERACTIVATOR_H_
26
27#include "TransportTracker.h"
28#include "ProfileManager.h"
29#include <QObject>
30#include <QMap>
31#include <QString>
32
33namespace Buteo {
34
47class ServerActivator : public QObject
48{
49 Q_OBJECT
50
51public:
58 ServerActivator(ProfileManager &aProfileManager,
59 TransportTracker &aTransportTracker, QObject *aParent = 0);
60
62 virtual ~ServerActivator();
63
72 int addRef(const QString &aServerName, bool emitSignal = true);
73
82 int removeRef(const QString &aServerName, bool emitSignal = true);
83
88 QStringList enabledServers() const;
89
90signals:
95 void serverEnabled(const QString &aServerName);
96
101 void serverDisabled(const QString &aServerName);
102
103public slots:
109 void onConnectivityStateChanged(Sync::ConnectivityType aType, bool aState);
110
111private:
112 QList<Sync::ConnectivityType> transportsFromProfile(const Profile *aProfile);
113 ProfileManager &iProfileManager;
114 TransportTracker &iTransportTracker;
115
116 struct ServerData {
117 ServerData() : iRefCount(0) { }
119 int iRefCount;
120 };
121
123
124#ifdef SYNCFW_UNIT_TESTS
125 friend class ServerActivatorTest;
126#endif
127
128};
129
130}
131
132#endif /* SERVERACTIVATOR_H_ */
ProfileManager is responsible for storing and retrieving the profiles.
Definition ProfileManager.h:46
This class represents a single profile, a collection of settings or data releated to some entity.
Definition Profile.h:53
Keeps track of which server plug-ins should be enabled.
Definition ServerActivator.h:48
int addRef(const QString &aServerName, bool emitSignal=true)
Adds a reference to the given server.
Definition ServerActivator.cpp:90
virtual ~ServerActivator()
Destructor.
Definition ServerActivator.cpp:85
void serverDisabled(const QString &aServerName)
Signal emitted when a server should be disabled.
Definition moc_ServerActivator.cpp:172
QStringList enabledServers() const
Gets the list of enabled server.
Definition ServerActivator.cpp:128
void onConnectivityStateChanged(Sync::ConnectivityType aType, bool aState)
Called when transport state changes.
Definition ServerActivator.cpp:142
int removeRef(const QString &aServerName, bool emitSignal=true)
Removes a reference from the given server.
Definition ServerActivator.cpp:107
void serverEnabled(const QString &aServerName)
Signal emitted when a server should be enabled.
Definition moc_ServerActivator.cpp:165
Class for tracking transport states.
Definition TransportTracker.h:50
Definition SyncBackupAdaptor.h:40
Definition SyncBackupAdaptor.h:41