accounts-qt
1.11
|
Manager of accounts, services and providers. More...
#include <Accounts/Manager>
Inherits QObject.
Signals | |
void | accountCreated (Accounts::AccountId id) |
The signal is emitted when new account is created. More... | |
void | accountRemoved (Accounts::AccountId id) |
The signal is emitted when existing account is removed. More... | |
void | accountUpdated (Accounts::AccountId id) |
The signal is emitted when any account property for a particular service is updated. More... | |
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. More... | |
Public Member Functions | |
Manager (QObject *parent=0) | |
Constructor. More... | |
Manager (const QString &serviceType, QObject *parent=0) | |
Constructs a manager initialized with service type. More... | |
~Manager () | |
Destructor. | |
Account * | account (const AccountId &id) const |
Loads an account from the database. More... | |
AccountIdList | accountList (const QString &serviceType=QString::null) const |
Lists the accounts which support the requested service. More... | |
AccountIdList | accountListEnabled (const QString &serviceType=QString::null) const |
Lists the enabled accounts which support the requested service that also must be enabled. More... | |
Account * | createAccount (const QString &providerName) |
Creates a new account. More... | |
Service | service (const QString &serviceName) const |
Gets an object representing a service. More... | |
ServiceList | serviceList (const QString &serviceType=QString::null) const |
Gets the service list. More... | |
Provider | provider (const QString &providerName) const |
Gets an object representing a provider. More... | |
ProviderList | providerList () const |
Gets a provider list. More... | |
ServiceType | serviceType (const QString &name) const |
Gets an object representing a service type. More... | |
Application | application (const QString &applicationName) const |
Get an object representing an application. More... | |
ApplicationList | applicationList (const Service &service) const |
List the registered applications which support the given service. More... | |
QString | serviceType () const |
Gets the service type if given in manager constructor. More... | |
void | setTimeout (quint32 timeout) |
Sets the timeout for database operations. More... | |
quint32 | timeout () |
Gets the database timeout. More... | |
void | setAbortOnTimeout (bool abort) |
Sets whether to abort the application when a database timeout occurs. More... | |
bool | abortOnTimeout () const |
Error | lastError () const |
Gets the last error. More... | |
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 | ( | QObject * | parent = 0 | ) |
Constructor.
Users should check for manager->lastError() to check if manager construction was fully succesful.
Definition at line 146 of file manager.cpp.
References Error::DatabaseLocked.
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. Users should check for manager->lastError() to check if manager construction was fully succesful.
Definition at line 173 of file manager.cpp.
References Error::DatabaseLocked.
bool abortOnTimeout | ( | ) | const |
Definition at line 498 of file manager.cpp.
Account * account | ( | const AccountId & | id | ) | const |
Loads an account from the database.
id | Id of the account to be retrieved. |
Definition at line 220 of file manager.cpp.
References Account::fromId(), and Account::value().
|
signal |
The signal is emitted when new account is created.
id | Identifier of the Account |
AccountIdList 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 241 of file manager.cpp.
AccountIdList 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 276 of file manager.cpp.
|
signal |
The signal is emitted when existing account is removed.
id | Identifier of the Account |
|
signal |
The signal is emitted when any account property for a particular service is updated.
To receive this notification user has to create accounts manager using Manager(const QString &serviceType, QObject *parent) constructor. Update notification is only emitted when manager is created for particular type of service.
id | Identifier of the Account |
Application application | ( | const QString & | applicationName | ) | const |
Get an object representing an application.
applicationName | Name of the application to load. |
Definition at line 423 of file manager.cpp.
Referenced by Manager::applicationList().
ApplicationList applicationList | ( | const Service & | service | ) | const |
List the registered applications which support the given service.
service | The service to be supported. |
Definition at line 437 of file manager.cpp.
References Manager::application().
Account * createAccount | ( | const QString & | providerName | ) |
Creates a new account.
providerName | Name of account provider. |
Definition at line 306 of file manager.cpp.
|
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.
id | identifier of the Account |
Error lastError | ( | ) | const |
Gets the last error.
Not all operations set/reset the error; see the individual methods' documentation to see if they set the last error or not. Call this method right after an account operation has failed; if no error occurred, the result of this method are undefined.
Definition at line 512 of file manager.cpp.
Referenced by Account::fromId().
Provider provider | ( | const QString & | providerName | ) | const |
Gets an object representing a provider.
providerName | Name of provider to get. |
Definition at line 367 of file manager.cpp.
Referenced by Account::provider(), and Manager::providerList().
ProviderList providerList | ( | ) | const |
Gets a provider list.
Definition at line 381 of file manager.cpp.
References Manager::provider().
Service service | ( | const QString & | serviceName | ) | const |
Gets an object representing a service.
serviceName | Name of service to get. |
Definition at line 317 of file manager.cpp.
Referenced by Manager::serviceList().
ServiceList serviceList | ( | const QString & | serviceType = QString::null | ) | const |
Gets the 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 335 of file manager.cpp.
References Manager::service().
ServiceType serviceType | ( | const QString & | name | ) | const |
Gets an object representing a service type.
name | Name of service type to load. |
Definition at line 408 of file manager.cpp.
QString serviceType | ( | ) | const |
Gets the service type if given in manager constructor.
Definition at line 457 of file manager.cpp.
void setAbortOnTimeout | ( | bool | abort | ) |
Sets whether to abort the application when a database timeout occurs.
By default the library does not abort the application.
Definition at line 489 of file manager.cpp.
void 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 471 of file manager.cpp.
quint32 timeout | ( | ) |
Gets the database timeout.
Definition at line 480 of file manager.cpp.