accounts-qt 0.31

Accounts::Manager Class Reference

Manager of accounts, services and providers. More...

#include <manager.h>

List of all members.

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 ()
Accountaccount (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.
AccountcreateAccount (const QString &providerName)
 Creates a new account.
Serviceservice (const QString &serviceName) const
 Get an object representing a service.
ServiceList serviceList (const QString &serviceType=QString::null) const
 Get service list.
Providerprovider (const QString &providerName) const
 Get an object representing a provider.
ProviderList providerList () const
 Get provider list.
ServiceTypeserviceType (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

Detailed Description

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.

Definition at line 52 of file manager.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

Account * Manager::account ( const AccountId id) const

Loads an account from the database.

Parameters:
idId of the account to be retrieved.
Returns:
Requested account or NULL if not found.

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.

Parameters:
ididentifier of the Account
AccountIdList Manager::accountList ( const QString &  serviceType = QString::null) const

Lists the accounts which support the requested service.

Parameters:
serviceTypeType of service that returned accounts must support. If not given and the manager is not constructed with service type, all accounts are returned.
Returns:
List of account IDs.

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.

Parameters:
serviceTypeType of service that returned accounts must support. If not given and the manager is not constructed with service type, all enabled accounts are returned.
Returns:
List of account IDs.

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.

Parameters:
ididentifier 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.

Parameters:
ididentifier of the Account
Account * Manager::createAccount ( const QString &  providerName)

Creates a new account.

Parameters:
providerNameName of account provider.
Returns:
Created account or NULL if some error occurs.

Definition at line 244 of file manager.cpp.

References Account, and account().

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.

Parameters:
ididentifier of the Account
Provider * Manager::provider ( const QString &  providerName) const

Get an object representing a provider.

Parameters:
providerNameName of provider to get.
Returns:
Requested provider or NULL if not found.

Definition at line 330 of file manager.cpp.

ProviderList Manager::providerList ( ) const

Get provider list.

Returns:
List of registered providers.

Definition at line 345 of file manager.cpp.

Service * Manager::service ( const QString &  serviceName) const

Get an object representing a service.

Parameters:
serviceNameName of service to get.
Returns:
Requested service or NULL if not found.

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.

Parameters:
serviceTypeType of services to be listed. If not given and the manager is not constructed with service type, all services are listed.
Returns:
List of Service objects.

Definition at line 289 of file manager.cpp.

References serviceType().

QString Manager::serviceType ( ) const

Get the service type if given in manager constructor.

Returns:
service type or NULL if not given.

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.

Parameters:
nameName of service type to load.
Returns:
Requested service type or NULL if not found.

Definition at line 366 of file manager.cpp.

References serviceType().

void Manager::setTimeout ( quint32  timeout)

Sets the timeout for database operations.

Parameters:
timeoutThe 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.

Returns:
the timeout (in milliseconds) for database operations.

Definition at line 393 of file manager.cpp.


Friends And Related Function Documentation

friend class Account [friend]

Definition at line 231 of file manager.h.

Referenced by account(), and createAccount().

friend class Private [friend]

Definition at line 226 of file manager.h.


The documentation for this class was generated from the following files: