Buteo Synchronization Framework
AccountsHelper.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 ACCOUNTSHELPER_H
24#define ACCOUNTSHELPER_H
25
26#include <QObject>
27
28#include <Accounts/manager.h>
29#include <Accounts/account.h>
30
31namespace Buteo {
32
33class Profile;
34class AccountsHelperTest;
35class ProfileManager;
36class SyncProfile;
37
41class AccountsHelper : public QObject
42{
43 Q_OBJECT
44
45public:
46
52 AccountsHelper(ProfileManager &aProfileManager, QObject *aParent = NULL);
53
57 virtual ~AccountsHelper();
58
65 QList<SyncProfile *> getProfilesByAccountId(Accounts::AccountId id);
66
67public Q_SLOTS:
68
73 void createProfileForAccount(Accounts::AccountId id);
74
79 void slotAccountRemoved(Accounts::AccountId id);
80
81 void slotSchedulerSettingsChanged(const char *aKey);
82Q_SIGNALS:
83
84 void enableSOC(const QString &aProfileName);
85 void scheduleUpdated(const QString &aProfileName);
86 void removeProfile(QString profileId);
87 void removeScheduledSync(const QString &profileId);
88
89private Q_SLOTS:
90
91 void registerAccountListeners();
92
93private:
94 void syncEnableWithAccount(Accounts::Account *account);
95 bool addProfileForAccount(Accounts::Account *account,
96 const QString &serviceName,
97 bool serviceEnabled,
98 const QString &label = QString());
99
100 void setSyncSchedule(SyncProfile *syncProfile, Accounts::AccountId id, bool aCreateNew = false);
101
102 void registerAccountListener(Accounts::AccountId id);
103
104 Accounts::Manager *iAccountManager;
105
106 ProfileManager &iProfileManager;
107
108 QList<Accounts::Account *> iAccountList;
109 QMap <Accounts::Watch *, Accounts::AccountId> iAcctWatchMap;
110
111#ifdef SYNCFW_UNIT_TESTS
112 friend class AccountsHelperTest;
113#endif
114};
115
116}
117
118#endif // ACCOUNTSHELPER_H
Helper Class towards Accounts::Manager and various SSO related operations.
Definition AccountsHelper.h:42
AccountsHelper(ProfileManager &aProfileManager, QObject *aParent=NULL)
Constructor.
Definition AccountsHelper.cpp:36
void slotAccountRemoved(Accounts::AccountId id)
slot for Accounts::Manager accountRemoved signal
Definition AccountsHelper.cpp:95
virtual ~AccountsHelper()
Destructor.
Definition AccountsHelper.cpp:52
void createProfileForAccount(Accounts::AccountId id)
This method is used to create profiles for a specified account.
Definition AccountsHelper.cpp:61
QList< SyncProfile * > getProfilesByAccountId(Accounts::AccountId id)
Returns sync profiles that correspond to a given account ID.
Definition AccountsHelper.cpp:233
ProfileManager is responsible for storing and retrieving the profiles.
Definition ProfileManager.h:46
A top level synchronization profile.
Definition SyncProfile.h:54
Definition SyncBackupAdaptor.h:40