Buteo Synchronization Framework: AccountsHelper.h Source File

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
38const QString REMOTE_SERVICE_NAME("remote_service_name");
39
43 class AccountsHelper : public QObject
44{
45 Q_OBJECT
46
47public:
48
54 AccountsHelper(ProfileManager &aProfileManager, QObject *aParent = NULL);
55
59 virtual ~AccountsHelper();
60
67 QList<SyncProfile *> getProfilesByAccountId(Accounts::AccountId id);
68
69public Q_SLOTS:
70
75 void createProfileForAccount(Accounts::AccountId id);
76
81 void slotAccountRemoved(Accounts::AccountId id);
82
83 void slotSchedulerSettingsChanged(const char *aKey);
84Q_SIGNALS:
85
86 void enableSOC(const QString &aProfileName);
87 void scheduleUpdated(const QString &aProfileName);
88 void removeProfile(QString profileId);
89 void removeScheduledSync(const QString &profileId);
90
91private Q_SLOTS:
92
93 void registerAccountListeners();
94
95private:
96 void syncEnableWithAccount(Accounts::Account *account);
97 bool addProfileForAccount(Accounts::Account *account,
98 const QString &serviceName,
99 bool serviceEnabled,
100 const QString &label = QString());
101
102 void setSyncSchedule(SyncProfile *syncProfile, Accounts::AccountId id, bool aCreateNew = false);
103
104 void registerAccountListener(Accounts::AccountId id);
105
106 Accounts::Manager *iAccountManager;
107
108 ProfileManager &iProfileManager;
109
110 QList<Accounts::Account *> iAccountList;
111 QMap <Accounts::Watch *, Accounts::AccountId> iAcctWatchMap;
112
113#ifdef SYNCFW_UNIT_TESTS
114 friend class AccountsHelperTest;
115#endif
116};
117
118}
119
120#endif // ACCOUNTSHELPER_H
Buteo::AccountsHelper
Helper Class towards Accounts::Manager and various SSO related operations.
Definition: AccountsHelper.h:44
Buteo::AccountsHelper::AccountsHelper
AccountsHelper(ProfileManager &aProfileManager, QObject *aParent=NULL)
Constructor.
Definition: AccountsHelper.cpp:35
Buteo::AccountsHelper::slotAccountRemoved
void slotAccountRemoved(Accounts::AccountId id)
slot for Accounts::Manager accountRemoved signal
Definition: AccountsHelper.cpp:94
Buteo::AccountsHelper::~AccountsHelper
virtual ~AccountsHelper()
Destructor.
Definition: AccountsHelper.cpp:51
Buteo::AccountsHelper::createProfileForAccount
void createProfileForAccount(Accounts::AccountId id)
This method is used to create profiles for a specified account.
Definition: AccountsHelper.cpp:60
Buteo::AccountsHelper::getProfilesByAccountId
QList< SyncProfile * > getProfilesByAccountId(Accounts::AccountId id)
Returns sync profiles that correspond to a given account ID.
Definition: AccountsHelper.cpp:232
Buteo::ProfileManager
ProfileManager is responsible for storing and retrieving the profiles.
Definition: ProfileManager.h:46
Buteo::SyncProfile
A top level synchronization profile.
Definition: SyncProfile.h:49
QList
Definition: SyncBackupAdaptor.h:40
QMap< Accounts::Watch *, Accounts::AccountId >