AccountsHelper.h
/*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef ACCOUNTSHELPER_H
#define ACCOUNTSHELPER_H
#include <QObject>
#include <Accounts/manager.h>
#include <Accounts/account.h>
namespace Buteo {
class Profile;
class AccountsHelperTest;
class ProfileManager;
class SyncProfile;
class AccountsHelper : public QObject
{
Q_OBJECT
public:
AccountsHelper(ProfileManager &aProfileManager, QObject *aParent = nullptr);
virtual ~AccountsHelper();
QList<SyncProfile *> getProfilesByAccountId(Accounts::AccountId id);
public Q_SLOTS:
void createProfileForAccount(Accounts::AccountId id);
void slotAccountRemoved(Accounts::AccountId id);
void slotSchedulerSettingsChanged(const char *aKey);
Q_SIGNALS:
void enableSOC(const QString &aProfileName);
void scheduleUpdated(const QString &aProfileName);
void removeProfile(QString profileId);
void removeScheduledSync(const QString &profileId);
private Q_SLOTS:
void registerAccountListeners();
private:
void syncEnableWithAccount(Accounts::Account *account);
void syncEnableWithService(Accounts::Account *account, const QString &serviceName, bool enabled);
bool addProfileForAccount(Accounts::Account *account,
const QString &serviceName,
bool serviceEnabled,
const QString &label = QString());
void setSyncSchedule(SyncProfile *syncProfile, Accounts::AccountId id, bool aCreateNew = false);
void registerAccountListener(Accounts::AccountId id);
Accounts::Manager *iAccountManager;
ProfileManager &iProfileManager;
QList<Accounts::Account *> iAccountList;
QMap <Accounts::Watch *, Accounts::AccountId> iAcctWatchMap;
#ifdef SYNCFW_UNIT_TESTS
friend class AccountsHelperTest;
#endif
};
}
#endif // ACCOUNTSHELPER_H
Buteo::AccountsHelper::AccountsHelper
AccountsHelper(ProfileManager &aProfileManager, QObject *aParent=nullptr)
Constructor.
Definition AccountsHelper.cpp:37
Buteo::AccountsHelper::slotAccountRemoved
void slotAccountRemoved(Accounts::AccountId id)
slot for Accounts::Manager accountRemoved signal
Definition AccountsHelper.cpp:97
Buteo::AccountsHelper::~AccountsHelper
virtual ~AccountsHelper()
Destructor.
Definition AccountsHelper.cpp:54
Buteo::AccountsHelper::createProfileForAccount
void createProfileForAccount(Accounts::AccountId id)
This method is used to create profiles for a specified account.
Definition AccountsHelper.cpp:63
Buteo::AccountsHelper::getProfilesByAccountId
QList< SyncProfile * > getProfilesByAccountId(Accounts::AccountId id)
Returns sync profiles that correspond to a given account ID.
Definition AccountsHelper.cpp:273
Buteo::ProfileManager
ProfileManager is responsible for storing and retrieving the profiles.
Definition ProfileManager.h:47
Buteo::Profile
This class represents a single profile, a collection of settings or data releated to some entity.
Definition Profile.h:53
Buteo::SyncProfile
A top level synchronization profile.
Definition SyncProfile.h:49
QList
Definition SyncBackupAdaptor.h:40