accounts-qt 0.31
|
Manager of accounts, services and providers. More...
#include <manager.h>
Signals | |
void | accountCreated (Accounts::AccountId id) |
The signal is emitted when new account is created. | |
void | accountRemoved (Accounts::AccountId id) |
The signal is emitted when existing account is removed. | |
void | accountUpdated (Accounts::AccountId id) |
The signal is emitted when any account property for a particular service is updated. | |
void | enabledEvent (Accounts::AccountId id) |
If the manager has been created with serviceType, this signal will be emitted when an account (identified by AccountId) has been modified in such a way that the application might be interested to start/stop using it: the "enabled" flag on the account or in some service supported by the account and matching the AgManager::serviceType have changed. | |
Public Member Functions | |
Manager (QObject *parent=0) | |
Constructor. | |
Manager (const QString &serviceType, QObject *parent=0) | |
Constructs a manager initialized with service type. | |
~Manager () | |
Account * | account (const AccountId &id) const |
Loads an account from the database. | |
AccountIdList | accountList (const QString &serviceType=QString::null) const |
Lists the accounts which support the requested service. | |
AccountIdList | accountListEnabled (const QString &serviceType=QString::null) const |
Lists the enabled accounts which support the requested service that also must be enabled. | |
Account * | createAccount (const QString &providerName) |
Creates a new account. | |
Service * | service (const QString &serviceName) const |
Get an object representing a service. | |
ServiceList | serviceList (const QString &serviceType=QString::null) const |
Get service list. | |
Provider * | provider (const QString &providerName) const |
Get an object representing a provider. | |
ProviderList | providerList () const |
Get provider list. | |
ServiceType * | serviceType (const QString &name) const |
Get an object representing a service type. | |
QString | serviceType () const |
Get the service type if given in manager constructor. | |
void | setTimeout (quint32 timeout) |
Sets the timeout for database operations. | |
quint32 | timeout () |
Gets the database tiemout. | |
Friends | |
class | Private |
class | Account |
Manager of accounts, services and providers.
The Manager offers ways to create accounts, list accounts, services and providers. It also emits signals when accounts are created and removed.
Manager::Manager | ( | QObject * | parent = 0 | ) |
Constructor.
Definition at line 143 of file manager.cpp.
Manager::Manager | ( | const QString & | serviceType, |
QObject * | parent = 0 |
||
) |
Constructs a manager initialized with service type.
This constructor should be used when there is an interest for just one service type. Such a manager has influence on some class methods. When listing the accounts and services only the ones supporting the given service type will be returned. Also the creating account with this manager will affect the acccount class method for listing services in same manner. The signal enabledEvent() will be emitted only when manager is created with this constructor.
Definition at line 153 of file manager.cpp.
Manager::~Manager | ( | ) |
Definition at line 164 of file manager.cpp.
Loads an account from the database.
id | Id of the account to be retrieved. |
Definition at line 182 of file manager.cpp.
References Account.
Referenced by createAccount(), and main().
void Accounts::Manager::accountCreated | ( | Accounts::AccountId | id | ) | [signal] |
The signal is emitted when new account is created.
id | identifier of the Account |
AccountIdList Manager::accountList | ( | const QString & | serviceType = QString::null | ) | const |
Lists the accounts which support the requested service.
serviceType | Type of service that returned accounts must support. If not given and the manager is not constructed with service type, all accounts are returned. |
Definition at line 196 of file manager.cpp.
Referenced by main().
AccountIdList Manager::accountListEnabled | ( | const QString & | serviceType = QString::null | ) | const |
Lists the enabled accounts which support the requested service that also must be enabled.
serviceType | Type of service that returned accounts must support. If not given and the manager is not constructed with service type, all enabled accounts are returned. |
Definition at line 220 of file manager.cpp.
void Accounts::Manager::accountRemoved | ( | Accounts::AccountId | id | ) | [signal] |
The signal is emitted when existing account is removed.
id | identifier of the Account |
void Accounts::Manager::accountUpdated | ( | Accounts::AccountId | id | ) | [signal] |
The signal is emitted when any account property for a particular service is updated.
To receive this notification user should create accounts manager using Manager(const QString &serviceType, QObject *parent) constructor. Update notification is only emited when manager is created for particular type of service.
id | identifier of the Account |
Account * Manager::createAccount | ( | const QString & | providerName | ) |
Creates a new account.
providerName | Name of account provider. |
Definition at line 244 of file manager.cpp.
void Accounts::Manager::enabledEvent | ( | Accounts::AccountId | id | ) | [signal] |
If the manager has been created with serviceType, this signal will be emitted when an account (identified by AccountId) has been modified in such a way that the application might be interested to start/stop using it: the "enabled" flag on the account or in some service supported by the account and matching the AgManager::serviceType have changed.
In practice, this signal might be emitted more often than when strictly needed; applications must call Account::enabledServices() to get the current state.
id | identifier of the Account |
Provider * Manager::provider | ( | const QString & | providerName | ) | const |
Get an object representing a provider.
providerName | Name of provider to get. |
Definition at line 330 of file manager.cpp.
ProviderList Manager::providerList | ( | ) | const |
Get provider list.
Definition at line 345 of file manager.cpp.
Service * Manager::service | ( | const QString & | serviceName | ) | const |
Get an object representing a service.
serviceName | Name of service to get. |
Definition at line 275 of file manager.cpp.
ServiceList Manager::serviceList | ( | const QString & | serviceType = QString::null | ) | const |
Get service list.
If the manager is constructed with given service type only the services which supports the service type will be returned.
serviceType | Type of services to be listed. If not given and the manager is not constructed with service type, all services are listed. |
Definition at line 289 of file manager.cpp.
References serviceType().
QString Manager::serviceType | ( | ) | const |
Get the service type if given in manager constructor.
Definition at line 383 of file manager.cpp.
Referenced by serviceList(), and serviceType().
ServiceType * Manager::serviceType | ( | const QString & | name | ) | const |
Get an object representing a service type.
name | Name of service type to load. |
Definition at line 366 of file manager.cpp.
References serviceType().
void Manager::setTimeout | ( | quint32 | timeout | ) |
Sets the timeout for database operations.
timeout | The new timeout, in milliseconds. |
This tells the library how long it is allowed to block while waiting for a locked DB to become accessible. Higher values mean a higher chance of successful reads, but also mean that the execution might be blocked for a longer time. The default is 5 seconds.
Definition at line 388 of file manager.cpp.
quint32 Manager::timeout | ( | ) |
Gets the database tiemout.
Definition at line 393 of file manager.cpp.
friend class Account [friend] |
Definition at line 231 of file manager.h.
Referenced by account(), and createAccount().