RBkDatabase Class Reference

class RBkDatabase

RBkDatabase represents a handle to the database as a whole. Opening the handle will initiate a connection to the system-wide bookmark store. RBkDatabase is responsible for all operations such as creating new bookmarks and folders or changing database-wide data such as setting the home page or registering custom properties.

Public Member Functions
RBkDatabase()
IMPORT_C voidClose()
IMPORT_C voidCommitL()
IMPORT_C RBkBookmarkCreateBookmarkL(RBkFolder *)
IMPORT_C RBkFolderCreateFolderL(const TDesC &, RBkFolder *)
IMPORT_C Bookmark::TAttachmentIdCreateIconL(const TDesC8 &)
IMPORT_C TUint32DefaultNap()
IMPORT_C TUint32DefaultProxy()
IMPORT_C TIntDeleteIconL(Bookmark::TAttachmentId)
IMPORT_C voidDeleteItemL(Bookmark::TItemId, TBool)
IMPORT_C TIntDeregisterBookmarkPropertyL(TUid)
IMPORT_C TIntDeregisterDatabasePropertyL(TUid)
IMPORT_C TIntDeregisterFolderPropertyL(TUid)
IMPORT_C voidGetCustomPropertyL(TUid, TInt &)
IMPORT_C voidGetCustomPropertyL(TUid, TReal &)
IMPORT_C voidGetCustomPropertyL(TUid, TDes &)
IMPORT_C voidGetCustomPropertyL(TUid, TDes8 &)
IMPORT_C const TDesC8 &GetIconL(Bookmark::TAttachmentId)
IMPORT_C const TDesC &HomePageText()
IMPORT_C RBkBookmarkOpenBookmarkL(Bookmark::TItemId)
IMPORT_C RBkFolderOpenFolderL(Bookmark::TItemId)
IMPORT_C RBkFolderOpenFolderL(const TDesC &)
IMPORT_C RBkBookmarkOpenHomeL()
IMPORT_C voidOpenL(Bookmark::TVisibility, MBookmarkObserver *)
IMPORT_C RBkFolderOpenRootL()
IMPORT_C voidRefreshL()
IMPORT_C voidRegisterBookmarkPropertyL(TUid, Bookmark::TPropertyType)
IMPORT_C voidRegisterDatabasePropertyL(TUid, Bookmark::TPropertyType)
IMPORT_C voidRegisterFolderPropertyL(TUid, Bookmark::TPropertyType)
IMPORT_C const TDesC8 &SearchUri()
IMPORT_C voidSetCustomPropertyL(TUid, TInt)
IMPORT_C voidSetCustomPropertyL(TUid, TReal)
IMPORT_C voidSetCustomPropertyL(TUid, const TDesC &)
IMPORT_C voidSetCustomPropertyL(TUid, const TDesC8 &)
IMPORT_C voidSetDefaultNap(TUint32)
IMPORT_C voidSetDefaultProxy(TUint32)
voidSetHome(const RBkBookmark &)
IMPORT_C voidSetHomeL(const RBkBookmark &)
IMPORT_C voidSetHomePageTextL(const TDesC &)
IMPORT_C voidSetSearchUriL(const TDesC8 &)
IMPORT_C TVersionVersion()
Private Attributes
CBookmarkDb *iDatabase

Constructor & Destructor Documentation

RBkDatabase()

IMPORT_CRBkDatabase()

RBkDatabase constructor

Member Functions Documentation

Close()

IMPORT_C voidClose()

Closes the connection to the repository and frees all resources. Does not commit changes so you must call CommitL() if you want to save before calling Close().

CommitL()

IMPORT_C voidCommitL()

Runs through the folder tree and commits any changes. Also commits any changes to icons, registered custom properties and database-wide data.

The central repository, which the bookmark database uses, provides no locking mechanism. Concurrent accesses are simply queued. Although this should cause no problems it is worth remembering if you find any timing and commiting issues.

CreateBookmarkL(RBkFolder *)

IMPORT_C RBkBookmarkCreateBookmarkL(RBkFolder *aParent = NULL)

Creates a new bookmark. If a parent folder is supplied then it is added to this folder. If no parent is supplied then it is placed in the root. The newly created bookmark item is writable. The new bookmark will be permanently added to the database once there is a call to CommitL().

Parameters

RBkFolder * aParent = NULLThe new bookmark will be placed in this folder. The bookmark will be placed in the root is this is NULL.

CreateFolderL(const TDesC &, RBkFolder *)

IMPORT_C RBkFolderCreateFolderL(const TDesC &aTitle,
RBkFolder *aParent = NULL
)

Creates a new folder. If a parent folder is supplied then it is added to this folder. If no parent is supplied then it is placed in the root. The newly created bookmark item is writable. The new folder will be permanently added to the database once there is a call to CommitL();

Parameters

const TDesC & aTitleTitle text for the folder. Each folder's title text must be unique
RBkFolder * aParent = NULLThe new folder will be placed in this folder. The folder will be placed in the root is this is NULL.

CreateIconL(const TDesC8 &)

IMPORT_C Bookmark::TAttachmentIdCreateIconL(const TDesC8 &aIconData)

Creates a new icon and adds it to the database's icon list. The database retains ownership of the icon and the new item's ID is returned.

Parameters

const TDesC8 & aIconDataDescriptor containing the icon's raw data

DefaultNap()

IMPORT_C TUint32DefaultNap()const

Method for getting the default nap.

DefaultProxy()

IMPORT_C TUint32DefaultProxy()const

Method for getting the default proxy.

DeleteIconL(Bookmark::TAttachmentId)

IMPORT_C TIntDeleteIconL(Bookmark::TAttachmentIdaIconId)

Deletes an icon with the given icon Id.

Parameters

Bookmark::TAttachmentId aIconIdId of the icon to delete.

DeleteItemL(Bookmark::TItemId, TBool)

IMPORT_C voidDeleteItemL(Bookmark::TItemIdaBookmarkId,
TBoolaRecursive = EFalse
)

Deletes a bookmark item. If the item is a folder and aRecursive is false, all its children are set to the root folder. If aRecursive is true all child bookmarks and folders are also deleted.

Parameters

Bookmark::TItemId aBookmarkIdId of the bookmark item
TBool aRecursive = EFalseSet to ETrue to delete all child bookmarks and subfolders

DeregisterBookmarkPropertyL(TUid)

IMPORT_C TIntDeregisterBookmarkPropertyL(TUidaCustomId)

Method for deregistering a custom bookmark property

Parameters

TUid aCustomIdThe identifier of the property.

DeregisterDatabasePropertyL(TUid)

IMPORT_C TIntDeregisterDatabasePropertyL(TUidaCustomId)

Method for deregistering a custom database property

Parameters

TUid aCustomIdThe identifier of the property.

DeregisterFolderPropertyL(TUid)

IMPORT_C TIntDeregisterFolderPropertyL(TUidaCustomId)

Method for deregistering a custom folder property

Parameters

TUid aCustomIdThe identifier of the property.

GetCustomPropertyL(TUid, TInt &)

IMPORT_C voidGetCustomPropertyL(TUidaPropertyId,
TInt &aValue
)const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyIdThe ID of the property you wish to get
TInt & aValueAn integer that will hold the data value

GetCustomPropertyL(TUid, TReal &)

IMPORT_C voidGetCustomPropertyL(TUidaPropertyId,
TReal &aValue
)const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyIdThe ID of the property you wish to get
TReal & aValueA floating point that will hold the data value

GetCustomPropertyL(TUid, TDes &)

IMPORT_C voidGetCustomPropertyL(TUidaPropertyId,
TDes &aValue
)const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyIdThe ID of the property you wish to get
TDes & aValueA 16 bit descriptor that will hold the data value

GetCustomPropertyL(TUid, TDes8 &)

IMPORT_C voidGetCustomPropertyL(TUidaPropertyId,
TDes8 &aValue
)const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyIdThe ID of the property you wish to get
TDes8 & aValueAn 8 bit descriptor that will hold the data value

GetIconL(Bookmark::TAttachmentId)

IMPORT_C const TDesC8 &GetIconL(Bookmark::TAttachmentIdaIconId)const

Gets the icon with the given icon Id.

Parameters

Bookmark::TAttachmentId aIconIdId of the icon to find.

HomePageText()

IMPORT_C const TDesC &HomePageText()const

Method for getting the home page text.

OpenBookmarkL(Bookmark::TItemId)

IMPORT_C RBkBookmarkOpenBookmarkL(Bookmark::TItemIdaBookmarkID)const

Finds a bookmark given a bookmark Id. Leaves if the item can not be found

Parameters

Bookmark::TItemId aBookmarkIDId of the bookmark item

OpenFolderL(Bookmark::TItemId)

IMPORT_C RBkFolderOpenFolderL(Bookmark::TItemIdaFolderID)const

Finds a folder given a folder Id. Leaves if the item can not be found

Parameters

Bookmark::TItemId aFolderIDId of the folder item

OpenFolderL(const TDesC &)

IMPORT_C RBkFolderOpenFolderL(const TDesC &aFolderTitle)const

Finds a folder with the given title text. Leaves if the item can not be found

Parameters

const TDesC & aFolderTitleTitle text to find

OpenHomeL()

IMPORT_C RBkBookmarkOpenHomeL()const

Method for getting the home page bookmark. Leaves if no home page has been set.

OpenL(Bookmark::TVisibility, MBookmarkObserver *)

IMPORT_C voidOpenL(Bookmark::TVisibilityaVisibility = Bookmark::EVisibilityDefault,
MBookmarkObserver *aObserver = NULL
)

Creates the bookmark database object and tries to connect to the repository. The client can register an observer if it wants to be notitied of external changes to the database.

Parameters

Bookmark::TVisibility aVisibility = Bookmark::EVisibilityDefaultThe visibility condition under which the database should be opened
MBookmarkObserver * aObserver = NULLPointer to an observer that will be notified of changes to the database

OpenRootL()

IMPORT_C RBkFolderOpenRootL()const

Retrieves the root folder and constructs the internal folder and bookmark tree if it doesn't yet exist. Only includes folders and bookmarks that are visible to this application.

RefreshL()

IMPORT_C voidRefreshL()

Refreshes the bookmark tree. Ususally called in response to a notification that the database has been changed from an external source.

RegisterBookmarkPropertyL(TUid, Bookmark::TPropertyType)

IMPORT_C voidRegisterBookmarkPropertyL(TUidaCustomId,
Bookmark::TPropertyTypeaDataType
)

Method for registering a custom bookmark property

Parameters

TUid aCustomIdUnique identifier to assign for this property.
Bookmark::TPropertyType aDataTypeThe type of data this property will contain.

RegisterDatabasePropertyL(TUid, Bookmark::TPropertyType)

IMPORT_C voidRegisterDatabasePropertyL(TUidaCustomId,
Bookmark::TPropertyTypeaDataType
)

Method for registering a custom database property

Parameters

TUid aCustomIdUnique identifier to assign for this property.
Bookmark::TPropertyType aDataTypeThe type of data this property will contain.

RegisterFolderPropertyL(TUid, Bookmark::TPropertyType)

IMPORT_C voidRegisterFolderPropertyL(TUidaCustomId,
Bookmark::TPropertyTypeaDataType
)

Method for registering a custom folder property

Parameters

TUid aCustomIdUnique identifier to assign for this property.
Bookmark::TPropertyType aDataTypeThe type of data this property will contain.

SearchUri()

IMPORT_C const TDesC8 &SearchUri()const

Method for getting the search page Uri.

SetCustomPropertyL(TUid, TInt)

IMPORT_C voidSetCustomPropertyL(TUidaPropertyId,
TIntaValue
)

Assigns a new custom database property value to the bookmark item.

Parameters

TUid aPropertyIdThe ID of the property you wish to set
TInt aValueAn integer data value

SetCustomPropertyL(TUid, TReal)

IMPORT_C voidSetCustomPropertyL(TUidaPropertyId,
TRealaValue
)

Assigns a new custom database property value to the bookmark item.

Parameters

TUid aPropertyIdThe ID of the property you wish to set
TReal aValueA floating point data value

SetCustomPropertyL(TUid, const TDesC &)

IMPORT_C voidSetCustomPropertyL(TUidaPropertyId,
const TDesC &aValue
)

Assigns a new custom database property value to the bookmark item.

Parameters

TUid aPropertyIdThe ID of the property you wish to set
const TDesC & aValueA 16 bit descriptor

SetCustomPropertyL(TUid, const TDesC8 &)

IMPORT_C voidSetCustomPropertyL(TUidaPropertyId,
const TDesC8 &aValue
)

Assigns a new custom database property value to the bookmark item.

Parameters

TUid aPropertyIdThe ID of the property you wish to set
const TDesC8 & aValueAn 8 bit descriptor

SetDefaultNap(TUint32)

IMPORT_C voidSetDefaultNap(TUint32aNetworkId)

Method for setting the default nap.

Parameters

TUint32 aNetworkIdId for identifying the nap entry in the commdb

SetDefaultProxy(TUint32)

IMPORT_C voidSetDefaultProxy(TUint32aServiceId)

Method for setting the default proxy.

Parameters

TUint32 aServiceIdId for identifying the proxy entry in the commdb

SetHome(const RBkBookmark &)

voidSetHome(const RBkBookmark &aHome)[inline]

Method for setting the home page bookmark.

Left in for source compatibility, Use SetHomeL function instead

Parameters

const RBkBookmark & aHomeReference to the new home page

SetHomeL(const RBkBookmark &)

IMPORT_C voidSetHomeL(const RBkBookmark &aHome)

Method for setting the home page bookmark.

Parameters

const RBkBookmark & aHomeReference to the new home page

SetHomePageTextL(const TDesC &)

IMPORT_C voidSetHomePageTextL(const TDesC &aHomePageText)

Method for setting the home page text.

Parameters

const TDesC & aHomePageTextDescriptor containing the new text

SetSearchUriL(const TDesC8 &)

IMPORT_C voidSetSearchUriL(const TDesC8 &aUri)

Method for setting the search page Uri.

Parameters

const TDesC8 & aUriDescriptor containing the new Uri.

Version()

IMPORT_C TVersionVersion()const

Gets the database version number

Member Data Documentation

CBookmarkDb * iDatabase

CBookmarkDb *iDatabase[private]