accounts-qt  0.31
manager.h
Go to the documentation of this file.
00001 /* vi: set et sw=4 ts=4 cino=t0,(0: */
00002 /*
00003  * This file is part of libaccounts-qt
00004  *
00005  * Copyright (C) 2009-2010 Nokia Corporation.
00006  *
00007  * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * version 2.1 as published by the Free Software Foundation.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  */
00023 
00024 #ifndef ACCOUNTMANAGER_H
00025 #define ACCOUNTMANAGER_H
00026 
00027 #include <QObject>
00028 #include <QSettings>
00029 #include <QString>
00030 #include <QStringList>
00031 
00032 #include "Accounts/accountscommon.h"
00033 #include "Accounts/account.h"
00034 #include "Accounts/provider.h"
00035 #include "Accounts/service.h"
00036 #include "Accounts/service-type.h"
00037 
00041 namespace Accounts
00042 {
00043 
00052 class ACCOUNTS_EXPORT Manager : public QObject
00053 {
00054     Q_OBJECT
00055 
00056 public:
00057 
00061     Manager(QObject *parent = 0);
00062 
00073     Manager(const QString &serviceType, QObject *parent = 0);
00074 
00075     ~Manager();
00076 
00083     Account *account(const AccountId &id) const;
00084 
00094     AccountIdList accountList(const QString &serviceType = QString::null) const;
00095 
00106     AccountIdList accountListEnabled(const QString &serviceType = QString::null) const;
00107 
00114     Account *createAccount(const QString &providerName);
00115 
00122     Service *service(const QString &serviceName) const;
00123 
00134     ServiceList serviceList(const QString &serviceType = QString::null) const;
00135 
00142     Provider *provider(const QString &providerName) const;
00143 
00149     ProviderList providerList() const;
00150 
00157     ServiceType *serviceType(const QString &name) const;
00158 
00164     QString serviceType() const;
00165 
00175     void setTimeout(quint32 timeout);
00176 
00181     quint32 timeout();
00182 
00183 signals:
00189     void accountCreated(Accounts::AccountId id);
00190 
00196     void accountRemoved(Accounts::AccountId id);
00197 
00208     void accountUpdated(Accounts::AccountId id);
00209 
00221     void enabledEvent(Accounts::AccountId id);
00222 
00223 private:
00224 
00225     // \cond
00226     class Private;
00227     friend class Private;
00228     Private *d; // Owned.
00229 
00230     Provider *providerInstance(AgProvider *provider) const;
00231     Service *serviceInstance(AgService *service) const;
00232     friend class Account;
00233     // \endcond
00234 }; // Manager
00235 
00236 } //namespace Accounts
00237 
00238 #endif // ACCOUNTMANAGER_H