Account

Since: BlackBerry 10.0.0

#include <bb/pim/account/Account>

To link against this class, add the following line to your .pro file: LIBS += -lbbpim

An Account.

This class represents an Account record.


Overview

Public Types Index

enum KeyValue

InvalidKey -1

Public Functions Index

Account ()
Account (const Provider &provider)
Account (const Provider &provider, const QString &owner)
Account (const Account &other)
~Account ()
QVariantcapabilitiesProperty (const QString &key, Property::Field property=Property::Value) const
QStringdisplayName () const
QStringexternalProviderInvokeTarget () const
QStringexternalSetupInvokeTarget () const
AccountKeyid () const
Property::EnterpriseTypeisEnterprise () const
boolisExternalData () const
ResultisReadyForCreation () const
boolisServiceAccessReadOnly (Service::Type service) const
boolisServiceSupported (Service::Type service) const
boolisSocial () const
boolisValid () const
boolisValidSet () const
Account &operator= (const Account &other)
QStringowner () const
Providerprovider () const
QVariantMaprawData () const
voidsetCapabilitiesValue (const QString &key, const QVariant &fvalue)
voidsetDisplayName (const QString &displayName)
voidsetExternalData (bool externalData)
voidsetExternalEnterprise (Property::EnterpriseType enterprise)
voidsetExternalProviderInvokeTarget (QString const &target)
voidsetExternalSetupInvokeTarget (QString const &target)
voidsetServiceSupported (Service::Type service, bool serviceSupported)
voidsetSettingsValue (const QString &key, const QVariant &fvalue)
QVariantsettingsProperty (const QString &key, Property::Field property=Property::Value) const
QStringvalidSetError () const

Protected Functions Index

voidsetEnterprise (Property::EnterpriseType enterprise)
voidsetId (AccountKey id)
voidsetProvider (const Provider &provider)
voidsetRawData (const QVariantMap &rawData)
voidsetServiceAccessReadOnly (Service::Type service, bool serviceAccessReadOnly)
voidsetSocial (bool social)
voidsetValid (bool valid)

Public Types

KeyValue

Predefined AccountKey value.

Since:

BlackBerry 10.0.0

InvalidKey -1

Specifies an invalid AccountKey.

Public Functions

Account ()

Default constructor meant to be used as a utility constructor for assignment operations.

Using this constructor to build an Account object will result in an Account object that is invalid. In other words, calling isValid() on the created object will return false. This constructor is used to create an empty Account object for the purposes of assigning another valid Account object to it.

Since:

BlackBerry 10.0.0

Account (

Creates a new Account object.

Using this constructor to build an Account object will result in an Account object with all properties set to the defaults, as defined by the provider. This Account object can be used directly in a call to the AccountService::createAccount() function.

Note:

A call to the isValid() function for the Account object will still return false as this account is not created until a call to the AccountService::createAccount() function is made.

Parameters
provider

The provider whose default properties are used to create the object.

Since:

BlackBerry 10.0.0

Account (

Creates a new Account object, assigning an owner of the account.

Using this constructor to build an Account object will result in an Account object with all properties set to the defaults, as defined by the provider, and assign an owning application. This Account object can be used directly in a call to the AccountService::createAccount() function.

Note:

A call to the isValid() function for the Account object will still return false as this account is not created until a call to the AccountService::createAccount() function is made.

Parameters
provider

The provider whose default properties are used to create the object.

owner

The owner of the account, which is the bar package name of the application or service who owns the account. The owner MUST be the same as the bar package name as seen in the /apps directory on the device.

Since:

BlackBerry 10.3.0

Account (

Creates a copy of an existing Account object.

Parameters
other

The Account object to be copied.

Since:

BlackBerry 10.0.0

~Account ()

Destructor.

Since:

BlackBerry 10.0.0

QVariant capabilitiesProperty (

Accessor for the Account object's capabilities map.

Provides access to the capabilities map field contained in the entry key. If the field is not found, it checks in the provider's map. If the field is not found in the provider's map, it will return QVariant::Invalid.

Parameters
key

The key used to search the capabilities map in order to obtain the capabilities map entry. The keys that are considered valid depend on the associated provider. Use the Provider::capabilitiesKeys() function to obtain a list of keys.

property

The key used to search the capabilities map entry in order to obtain the field to be returned.

Return:

Returns the Account object's capabilities field requested. If the capabilities field is not found, it will return QVariant::Invalid.

Since:

BlackBerry 10.0.0

QString displayName ()

Represents the Account object's displayName property.

Provides access to the Account object's displayName property.

Return:

Returns a QString containing the Account object's displayName property.

Since:

BlackBerry 10.0.0

QString externalProviderInvokeTarget ()

For external Provider accounts, returns the invocation target for the external provider.

Return:

Returns a QString containing the invocation target for the Account's external provider bar package for external Provider accounts. For normal accounts, this method returns an empty QString. This value can be used to issue invokes to the external provider.

Since:

BlackBerry 10.3.0

QString externalSetupInvokeTarget ()

For external Provider accounts, returns the invocation target for the setup card of the Account.

Return:

Returns a QString containing the invocation target for the setup card of the Account for external Provider accounts. For normal accounts, returns an empty QString.

Since:

BlackBerry 10.2.0

AccountKey id ()

Represents the Account object's id property.

Provides access to the Account object's id property.

Return:

Returns the value of the Account object's id property.

Since:

BlackBerry 10.0.0

Property::EnterpriseType isEnterprise ()

Determines the Account object's enterprise account type.

Returns whether this is an enterprise account.

Note:

The value of Property::EnterpriseUnknown for Property::EnterpriseType is not currently used and, as such, applications should not need to add any code to check for this case.

Return:

Returns the Property::EnterpriseType of the Account object.

Since:

BlackBerry 10.0.0

bool isExternalData ()

Determines if the Account object stores its data externally.

Return:

True if the Account object stores its data externally, false otherwise.

Since:

BlackBerry 10.2.0

Result isReadyForCreation ()

Object correctness with regards to account creation.

Determines whether or not creating an account with the current Account object is possible. In other words, if all required fields are present and valid.

Note:

This function is called by the function AccountService::createAccount.

Return:

A Result object with its success property set to true, when enough information is available in the Account object to successfully create an account. When enough information to successfully create an account is not available in the Account object or the information available is not properly set, this function returns a Result object with its success property set to false, and its message property set to the issues that need to be resolved in the Account object so that account creation is possible with this Account object.

Since:

BlackBerry 10.0.0

bool isServiceAccessReadOnly (

Accessor for read-only capability of service.

Returns whether the service is read-only for the account. If it's not, it implies the service is read-write.

Note:

The result of this function is not valid if the service is not supported. You can determine whether the service is supported or not by calling the Account::isServiceSupported() function with service as argument.

Parameters
service

The service for which we seek the read-only capability from for this Account object. Possible values are listed in the Service::Type enumeration.

Return:

Returns true if service is read-only for the Account object, and false otherwise.

Since:

BlackBerry 10.0.0

bool isServiceSupported (

Accessor for support capability of service.

Returns whether the service is supported for the account. A supported service implies the account will continuously synchronize all data for that service.

Parameters
service

The service for which we seek the supported capability from for this Account object. Possible values are listed in the Service::Type enumeration.

Return:

True if the service is supported for the Account object, false otherwise.

Since:

BlackBerry 10.0.0

bool isSocial ()

Determines if the Account object is a social account.

Return:

True if the Account object is a social account, false otherwise.

Since:

BlackBerry 10.0.0

bool isValid ()

Object correctness.

Determines whether or not the Account object returned from AccountService function calls has acceptable attribute values.

Return:

True if the Account object is valid, false otherwise.

Since:

BlackBerry 10.0.0

bool isValidSet ()

Setter correctness.

Determines whether or not the previous Account object set operation succeeded or failed.

Note:

If the previous set operation failed, the Account object will not incorporate the result for that previous set operation, leaving the Account object in the same state as before the previous set operation was called.

Return:

True if the previous set operation succeeded, false otherwise.

Since:

BlackBerry 10.0.0

Account & operator= (

Copies the data of an existing Account object to this object.

Parameters
other

The Account object to be copied.

Return:

The Account instance.

Since:

BlackBerry 10.0.0

QString owner ()

Represents the Account object's owner property.

Provides access to the Account object's owner property.

Return:

Returns a QString containing the Account object's owner property.

Since:

BlackBerry 10.3.0

Provider provider ()

Represents the Account object's Provider object.

Provides access to the Account object's Provider object.

Return:

Returns the Provider object associated with the Account object.

Since:

BlackBerry 10.0.0

QVariantMap rawData ()

Represents the Account object's raw data.

Provides access to the Account object's raw data.

Return:

Returns a QVariantMap containing the Account object's raw data.

Since:

BlackBerry 10.0.0

void setCapabilitiesValue (

Set function for the Account object's capabilities map.

Assigns the value of the fvalue parameter to the Account object's capabilities map using a key value pair, if and only if the following conditions are met: (1) The key must exist in the associated provider. (2) The data type of fvalue must match the data type of the account field where it is being assigned.

If one of the above conditions is not met, the value of the capabilities map will not be changed. In this case, a call to the isValidSet() function will return false and a call to the validSetError() function will indicate this particular error.

Parameters
key

The key used to search the capabilities map in order to obtain the capabilities map entry to be changed. The key types that are considered valid depend on the associated provider. Use the Provider::capabilitiesKeys() function to obtain a list of keys.

fvalue

The value to set into the capabilities map entry.

Since:

BlackBerry 10.0.0

void setDisplayName (

Set function for the Account object's displayName property.

Assigns the value displayName to the Account object's displayName property.

Parameters
displayName

The value to assign to Account object's displayName property.

Since:

BlackBerry 10.0.0

void setExternalData (
  • boolexternalData)

Set function for the Account object's externalData property.

Assigns the value externalData to the Account object's externalData property. This is set to true if PIM data (beyond account metadata) should not be stored within the PIM database store for the account. This can occur if the account has no data or it's stored and managed externally. Calling this method is only allowed when the Provider is "external"; for other Providers, isValidSet() returns false with an appropriate validSetError() message.

Parameters
externalData

The value to assign to the Account object's externalData property. The default value is False for this property.

Since:

BlackBerry 10.2.0

void setExternalEnterprise (

Set function for the Account object's externalEnterprise value.

Assigns the value enterprise to the Account object's externalEnterprise value. A caller would set this if the account is external and it's an enterprise-only account. Calling this method is only allowed when the Provider is "external"; for other Providers, isValidSet() returns false with an appropriate validSetError() message. Also, an AccountPermissionError exception is raised when this method is called by a caller who does not have enterprise permissions.

Parameters
enterprise

The value to assign to the Account object's externalEnterprise value. The default value is NonEnterprise for external accounts.

Since:

BlackBerry 10.2.0

void setExternalProviderInvokeTarget (

Set function for an Account object's external Provider invoke target property.

Assigns the value target to the Account object's external invoke target property. An Account would set this if the account is external, and it has an external provider in the bar package that is invoked when handling crucial account events (creation, deletion, etc).

Calling this method is only allowed when Provider is "external". For other Provider objects, the isValidSet() method returns false with an appropriate validSetError() message.

Parameters
target

The value to assign to the Account object's external Provider invoke target property. The default value is empty for this property.

Since:

BlackBerry 10.3.0

void setExternalSetupInvokeTarget (

Set function for the Account object's externalSetupInvokeTarget property.

Assigns the value target to the Account object's externalSetupInvokeTarget property. An Account would set this if the account is external and has an Account Setup Card that is invoked upon account creation or editing. Calling this method is only allowed when the Provider is "external"; for other Providers, isValidSet() returns false with an appropriate validSetError() message.

Parameters
target

The value to assign to the Account object's externalSetupInvokeTarget property. The default value is empty for this property.

Since:

BlackBerry 10.2.0

void setServiceSupported (

Set function for support capability of service.

Assigns the value of serviceSupported to the account's support capability for service. If serviceSupported is true, it implies service is supported. A supported service implies the account will continuously synchronize all data for that service. To turn on synchronization for a specific service, you need to set the support capability of the service to true by calling this function and then by calling the AccountService::updateAccount() function (or the AccountService::createAccount() function for initial creation).

Note:

Attempting to set the support capability of a service for an account whose provider does not support the service will result in a failed set operation. In this case, a call to the isValidSet() function will return false and a call to validSetError() will indicate this particular error.

Parameters
service

The service for which we are setting the support capability.

serviceSupported

The value to set.

Since:

BlackBerry 10.0.0

void setSettingsValue (

Set function for the Account object's settings map.

Assigns the value of the fvalue parameter to the Account object's settings map using a key value pair, if and only if the following conditions are met: (1) The key must exist in the associated provider. (2) The data type of fvalue must match the data type of the account field where it is being assigned.

If one of the above conditions is not met, the value of the settings map will not be changed. In this case, a call to the isValidSet() function will return false and a call to the validSetError() function will indicate this particular error.

Parameters
key

The key used to search the settings map in order to obtain the settings map entry to be changed. The keys that are considered valid depend on the associated provider. Use the Provider::settingsKeys() function to obtain a list of keys.

fvalue

The value to set into the settings map entry.

Since:

BlackBerry 10.0.0

QVariant settingsProperty (

Accessor for the Account object's settings map.

Provides access to the settings map field contained in the entry key. If the field is not found, it checks in the provider's map. If the field is not found in the provider's map, it will return QVariant::Invalid.

Parameters
key

The key used to search the settings map in order to obtain the settings map entry. The keys that are considered valid depend on the associated provider. Use the Provider::settingsKeys() function to obtain a list of keys.

property

The key used to search the settings map entry in order to obtain the field to be returned.

Return:

Returns the Account object's settings field requested. If the settings field is not found, it will return QVariant::Invalid.

Since:

BlackBerry 10.0.0

QString validSetError ()

Accessor for the setter correctness error.

Provides access to the error message corresponding to the previous setter operation. Error messages are only generated from failed set operations. Calling this function when the set operation succeeds will result in an empty string being returned.

Return:

Returns the error message corresponding to the previous setter operation if that operation failed, and an empty string otherwise.

Since:

BlackBerry 10.0.0

Protected Functions

void setEnterprise (

Set function for Account object's enterprise property.

Assigns the value of enterprise to the Account object's enterprise property.

Parameters
enterprise

The value to set.

Since:

BlackBerry 10.0.0

void setId (
  • AccountKeyid)

Set function for Account object's id property.

Assigns the value id to the Account object's id property.

Parameters
id

The value to assign to Account object's id property.

Since:

BlackBerry 10.0.0

void setProvider (

Set function for Account object's associated Provider object.

Assigns the value of provider to the Account object's associated Provider object. By doing this, the Account object inherits all its properties from the associated Provider object.

Parameters
provider

The value to set.

Since:

BlackBerry 10.0.0

void setRawData (

Set function for Account object's raw data.

Assigns the value of rawData to the Account object's raw data.

Parameters
rawData

The value to set.

Since:

BlackBerry 10.0.0

void setServiceAccessReadOnly (

Set function for read-only capability of service.

Assigns the value of serviceAccessReadOnly to the account's read-only capability for service. If serviceAccessReadOnly is true, it implies service is read-only.

Parameters
service

The service for which we are setting the read-only capability. Possible values are listed in the Service::Type enumeration.

serviceAccessReadOnly

The value to set.

Since:

BlackBerry 10.0.0

void setSocial (
  • boolsocial)

Set function for Account object's social property.

Assigns the value of social to the Account object's social property.

Parameters
social

The value to set.

Since:

BlackBerry 10.0.0

void setValid (
  • boolvalid)

Set function for Account object's state of correctness.

Assigns the value of valid to the object's state of correctness.

Parameters
valid

The value to set.

Since:

BlackBerry 10.0.0

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus