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-2011 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/error.h"
00035 #include "Accounts/provider.h"
00036 #include "Accounts/service.h"
00037 #include "Accounts/service-type.h"
00038 
00042 namespace Accounts
00043 {
00044 
00053 class ACCOUNTS_EXPORT Manager : public QObject
00054 {
00055     Q_OBJECT
00056 
00057 public:
00058 
00064     Manager(QObject *parent = 0);
00065 
00078     Manager(const QString &serviceType, QObject *parent = 0);
00079 
00083     ~Manager();
00084 
00092     Account *account(const AccountId &id) const;
00093 
00103     AccountIdList accountList(const QString &serviceType = QString::null) const;
00104 
00115     AccountIdList accountListEnabled(const QString &serviceType = QString::null) const;
00116 
00123     Account *createAccount(const QString &providerName);
00124 
00131     Service *service(const QString &serviceName) const;
00132 
00143     ServiceList serviceList(const QString &serviceType = QString::null) const;
00144 
00151     Provider *provider(const QString &providerName) const;
00152 
00158     ProviderList providerList() const;
00159 
00166     ServiceType *serviceType(const QString &name) const;
00167 
00173     QString serviceType() const;
00174 
00184     void setTimeout(quint32 timeout);
00185 
00190     quint32 timeout();
00191 
00196     void setAbortOnTimeout(bool abort);
00197 
00202     bool abortOnTimeout() const;
00203 
00213     Error lastError() const;
00214 
00215 signals:
00221     void accountCreated(Accounts::AccountId id);
00222 
00228     void accountRemoved(Accounts::AccountId id);
00229 
00240     void accountUpdated(Accounts::AccountId id);
00241 
00253     void enabledEvent(Accounts::AccountId id);
00254 
00255 private:
00256 
00257     // \cond
00258     class Private;
00259     friend class Private;
00260     Private *d; // Owned.
00261 
00262     Provider *providerInstance(AgProvider *provider) const;
00263     Service *serviceInstance(AgService *service) const;
00264     friend class Account;
00265     // \endcond
00266 }; // Manager
00267 
00268 } //namespace Accounts
00269 
00270 #endif // ACCOUNTMANAGER_H