accounts-qt  0.31
manager.h
Go to the documentation of this file.
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /*
3  * This file is part of libaccounts-qt
4  *
5  * Copyright (C) 2009-2010 Nokia Corporation.
6  *
7  * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * version 2.1 as published by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 
24 #ifndef ACCOUNTMANAGER_H
25 #define ACCOUNTMANAGER_H
26 
27 #include <QObject>
28 #include <QSettings>
29 #include <QString>
30 #include <QStringList>
31 
33 #include "Accounts/account.h"
34 #include "Accounts/provider.h"
35 #include "Accounts/service.h"
36 #include "Accounts/service-type.h"
37 
41 namespace Accounts
42 {
43 
52 class ACCOUNTS_EXPORT Manager : public QObject
53 {
54  Q_OBJECT
55 
56 public:
57 
61  Manager(QObject *parent = 0);
62 
73  Manager(const QString &serviceType, QObject *parent = 0);
74 
75  ~Manager();
76 
83  Account *account(const AccountId &id) const;
84 
94  AccountIdList accountList(const QString &serviceType = QString::null) const;
95 
106  AccountIdList accountListEnabled(const QString &serviceType = QString::null) const;
107 
114  Account *createAccount(const QString &providerName);
115 
122  Service *service(const QString &serviceName) const;
123 
134  ServiceList serviceList(const QString &serviceType = QString::null) const;
135 
142  Provider *provider(const QString &providerName) const;
143 
149  ProviderList providerList() const;
150 
157  ServiceType *serviceType(const QString &name) const;
158 
164  QString serviceType() const;
165 
175  void setTimeout(quint32 timeout);
176 
181  quint32 timeout();
182 
183 signals:
189  void accountCreated(Accounts::AccountId id);
190 
196  void accountRemoved(Accounts::AccountId id);
197 
208  void accountUpdated(Accounts::AccountId id);
209 
221  void enabledEvent(Accounts::AccountId id);
222 
223 private:
224 
225  // \cond
226  class Private;
227  friend class Private;
228  Private *d; // Owned.
229 
230  Provider *providerInstance(AgProvider *provider) const;
231  Service *serviceInstance(AgService *service) const;
232  friend class Account;
233  // \endcond
234 }; // Manager
235 
236 } //namespace Accounts
237 
238 #endif // ACCOUNTMANAGER_H