accounts-qt
1.13
|
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 * Copyright (C) 2012 Canonical Ltd. 00007 * 00008 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public License 00012 * version 2.1 as published by the Free Software Foundation. 00013 * 00014 * This library is distributed in the hope that it will be useful, but 00015 * WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00022 * 02110-1301 USA 00023 */ 00024 00025 #ifndef ACCOUNTS_MANAGER_H 00026 #define ACCOUNTS_MANAGER_H 00027 00028 #include <QObject> 00029 #include <QSettings> 00030 #include <QString> 00031 #include <QStringList> 00032 00033 #include "Accounts/accountscommon.h" 00034 #include "Accounts/account.h" 00035 #include "Accounts/error.h" 00036 #include "Accounts/provider.h" 00037 #include "Accounts/service.h" 00038 #include "Accounts/service-type.h" 00039 00043 namespace Accounts 00044 { 00045 00046 class AccountService; 00047 class Application; 00048 00049 typedef QList<Application> ApplicationList; 00050 00051 class ACCOUNTS_EXPORT Manager: public QObject 00052 { 00053 Q_OBJECT 00054 00055 public: 00060 enum Option { 00061 DisableNotifications = 0x1, 00062 }; 00063 Q_DECLARE_FLAGS(Options, Option) 00064 00065 Manager(QObject *parent = 0); 00066 Manager(const QString &serviceType, QObject *parent = 0); 00067 Manager(Options options, QObject *parent = 0); 00068 ~Manager(); 00069 00070 Account *account(const AccountId &id) const; 00071 00072 AccountIdList accountList(const QString &serviceType = QString::null) const; 00073 AccountIdList accountListEnabled(const QString &serviceType = QString::null) const; 00074 00075 Account *createAccount(const QString &providerName); 00076 00077 Service service(const QString &serviceName) const; 00078 ServiceList serviceList(const QString &serviceType = QString::null) const; 00079 00080 Provider provider(const QString &providerName) const; 00081 ProviderList providerList() const; 00082 00083 ServiceType serviceType(const QString &name) const; 00084 00085 Application application(const QString &applicationName) const; 00086 ApplicationList applicationList(const Service &service) const; 00087 00088 QString serviceType() const; 00089 00090 void setTimeout(quint32 timeout); 00091 quint32 timeout(); 00092 00093 void setAbortOnTimeout(bool abort); 00094 bool abortOnTimeout() const; 00095 00096 Options options() const; 00097 00098 Error lastError() const; 00099 00100 Q_SIGNALS: 00101 void accountCreated(Accounts::AccountId id); 00102 void accountRemoved(Accounts::AccountId id); 00103 void accountUpdated(Accounts::AccountId id); 00104 void enabledEvent(Accounts::AccountId id); 00105 00106 private: 00107 00108 // \cond 00109 class Private; 00110 friend class Private; 00111 Private *d; // Owned. 00112 00113 friend class Account; 00114 friend class AccountService; 00115 // \endcond 00116 }; // Manager 00117 00118 } //namespace Accounts 00119 00120 Q_DECLARE_OPERATORS_FOR_FLAGS(Accounts::Manager::Options) 00121 00122 #endif // ACCOUNTS_MANAGER_H