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 void Close ()
IMPORT_C void CommitL ()
IMPORT_C RBkBookmark CreateBookmarkL ( RBkFolder *)
IMPORT_C RBkFolder CreateFolderL (const TDesC &, RBkFolder *)
IMPORT_C Bookmark::TAttachmentId CreateIconL (const TDesC8 &)
IMPORT_C TUint32 DefaultNap ()
IMPORT_C TUint32 DefaultProxy ()
IMPORT_C TInt DeleteIconL ( Bookmark::TAttachmentId )
IMPORT_C void DeleteItemL ( Bookmark::TItemId , TBool )
IMPORT_C TInt DeregisterBookmarkPropertyL ( TUid )
IMPORT_C TInt DeregisterDatabasePropertyL ( TUid )
IMPORT_C TInt DeregisterFolderPropertyL ( TUid )
IMPORT_C void GetCustomPropertyL ( TUid , TInt &)
IMPORT_C void GetCustomPropertyL ( TUid , TReal &)
IMPORT_C void GetCustomPropertyL ( TUid , TDes &)
IMPORT_C void GetCustomPropertyL ( TUid , TDes8 &)
IMPORT_C const TDesC8 & GetIconL ( Bookmark::TAttachmentId )
IMPORT_C const TDesC & HomePageText ()
IMPORT_C RBkBookmark OpenBookmarkL ( Bookmark::TItemId )
IMPORT_C RBkFolder OpenFolderL ( Bookmark::TItemId )
IMPORT_C RBkFolder OpenFolderL (const TDesC &)
IMPORT_C RBkBookmark OpenHomeL ()
IMPORT_C void OpenL ( Bookmark::TVisibility , MBookmarkObserver *)
IMPORT_C RBkFolder OpenRootL ()
IMPORT_C void RefreshL ()
IMPORT_C void RegisterBookmarkPropertyL ( TUid , Bookmark::TPropertyType )
IMPORT_C void RegisterDatabasePropertyL ( TUid , Bookmark::TPropertyType )
IMPORT_C void RegisterFolderPropertyL ( TUid , Bookmark::TPropertyType )
IMPORT_C const TDesC8 & SearchUri ()
IMPORT_C void SetCustomPropertyL ( TUid , TInt )
IMPORT_C void SetCustomPropertyL ( TUid , TReal )
IMPORT_C void SetCustomPropertyL ( TUid , const TDesC &)
IMPORT_C void SetCustomPropertyL ( TUid , const TDesC8 &)
IMPORT_C void SetDefaultNap ( TUint32 )
IMPORT_C void SetDefaultProxy ( TUint32 )
void SetHome (const RBkBookmark &)
IMPORT_C void SetHomeL (const RBkBookmark &)
IMPORT_C void SetHomePageTextL (const TDesC &)
IMPORT_C void SetSearchUriL (const TDesC8 &)
IMPORT_C TVersion Version ()
Private Attributes
CBookmarkDb * iDatabase

Constructor & Destructor Documentation

RBkDatabase()

IMPORT_C RBkDatabase ( )

RBkDatabase constructor

Member Functions Documentation

Close()

IMPORT_C void Close ( )

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 void CommitL ( )

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 RBkBookmark CreateBookmarkL ( 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 = NULL The 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 RBkFolder CreateFolderL ( 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 & aTitle Title text for the folder. Each folder's title text must be unique
RBkFolder * aParent = NULL The 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::TAttachmentId CreateIconL ( 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 & aIconData Descriptor containing the icon's raw data

DefaultNap()

IMPORT_C TUint32 DefaultNap ( ) const

Method for getting the default nap.

DefaultProxy()

IMPORT_C TUint32 DefaultProxy ( ) const

Method for getting the default proxy.

DeleteIconL(Bookmark::TAttachmentId)

IMPORT_C TInt DeleteIconL ( Bookmark::TAttachmentId aIconId )

Deletes an icon with the given icon Id.

Parameters

Bookmark::TAttachmentId aIconId Id of the icon to delete.

DeleteItemL(Bookmark::TItemId, TBool)

IMPORT_C void DeleteItemL ( Bookmark::TItemId aBookmarkId,
TBool aRecursive = 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 aBookmarkId Id of the bookmark item
TBool aRecursive = EFalse Set to ETrue to delete all child bookmarks and subfolders

DeregisterBookmarkPropertyL(TUid)

IMPORT_C TInt DeregisterBookmarkPropertyL ( TUid aCustomId )

Method for deregistering a custom bookmark property

Parameters

TUid aCustomId The identifier of the property.

DeregisterDatabasePropertyL(TUid)

IMPORT_C TInt DeregisterDatabasePropertyL ( TUid aCustomId )

Method for deregistering a custom database property

Parameters

TUid aCustomId The identifier of the property.

DeregisterFolderPropertyL(TUid)

IMPORT_C TInt DeregisterFolderPropertyL ( TUid aCustomId )

Method for deregistering a custom folder property

Parameters

TUid aCustomId The identifier of the property.

GetCustomPropertyL(TUid, TInt &)

IMPORT_C void GetCustomPropertyL ( TUid aPropertyId,
TInt & aValue
) const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyId The ID of the property you wish to get
TInt & aValue An integer that will hold the data value

GetCustomPropertyL(TUid, TReal &)

IMPORT_C void GetCustomPropertyL ( TUid aPropertyId,
TReal & aValue
) const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyId The ID of the property you wish to get
TReal & aValue A floating point that will hold the data value

GetCustomPropertyL(TUid, TDes &)

IMPORT_C void GetCustomPropertyL ( TUid aPropertyId,
TDes & aValue
) const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyId The ID of the property you wish to get
TDes & aValue A 16 bit descriptor that will hold the data value

GetCustomPropertyL(TUid, TDes8 &)

IMPORT_C void GetCustomPropertyL ( TUid aPropertyId,
TDes8 & aValue
) const

Gets a custom database property for the given property ID.

Parameters

TUid aPropertyId The ID of the property you wish to get
TDes8 & aValue An 8 bit descriptor that will hold the data value

GetIconL(Bookmark::TAttachmentId)

IMPORT_C const TDesC8 & GetIconL ( Bookmark::TAttachmentId aIconId ) const

Gets the icon with the given icon Id.

Parameters

Bookmark::TAttachmentId aIconId Id of the icon to find.

HomePageText()

IMPORT_C const TDesC & HomePageText ( ) const

Method for getting the home page text.

OpenBookmarkL(Bookmark::TItemId)

IMPORT_C RBkBookmark OpenBookmarkL ( Bookmark::TItemId aBookmarkID ) const

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

Parameters

Bookmark::TItemId aBookmarkID Id of the bookmark item

OpenFolderL(Bookmark::TItemId)

IMPORT_C RBkFolder OpenFolderL ( Bookmark::TItemId aFolderID ) const

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

Parameters

Bookmark::TItemId aFolderID Id of the folder item

OpenFolderL(const TDesC &)

IMPORT_C RBkFolder OpenFolderL ( const TDesC & aFolderTitle ) const

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

Parameters

const TDesC & aFolderTitle Title text to find

OpenHomeL()

IMPORT_C RBkBookmark OpenHomeL ( ) const

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

OpenL(Bookmark::TVisibility, MBookmarkObserver *)

IMPORT_C void OpenL ( Bookmark::TVisibility aVisibility = 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::EVisibilityDefault The visibility condition under which the database should be opened
MBookmarkObserver * aObserver = NULL Pointer to an observer that will be notified of changes to the database

OpenRootL()

IMPORT_C RBkFolder OpenRootL ( ) 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 void RefreshL ( )

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 void RegisterBookmarkPropertyL ( TUid aCustomId,
Bookmark::TPropertyType aDataType
)

Method for registering a custom bookmark property

Parameters

TUid aCustomId Unique identifier to assign for this property.
Bookmark::TPropertyType aDataType The type of data this property will contain.

RegisterDatabasePropertyL(TUid, Bookmark::TPropertyType)

IMPORT_C void RegisterDatabasePropertyL ( TUid aCustomId,
Bookmark::TPropertyType aDataType
)

Method for registering a custom database property

Parameters

TUid aCustomId Unique identifier to assign for this property.
Bookmark::TPropertyType aDataType The type of data this property will contain.

RegisterFolderPropertyL(TUid, Bookmark::TPropertyType)

IMPORT_C void RegisterFolderPropertyL ( TUid aCustomId,
Bookmark::TPropertyType aDataType
)

Method for registering a custom folder property

Parameters

TUid aCustomId Unique identifier to assign for this property.
Bookmark::TPropertyType aDataType The 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 void SetCustomPropertyL ( TUid aPropertyId,
TInt aValue
)

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

Parameters

TUid aPropertyId The ID of the property you wish to set
TInt aValue An integer data value

SetCustomPropertyL(TUid, TReal)

IMPORT_C void SetCustomPropertyL ( TUid aPropertyId,
TReal aValue
)

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

Parameters

TUid aPropertyId The ID of the property you wish to set
TReal aValue A floating point data value

SetCustomPropertyL(TUid, const TDesC &)

IMPORT_C void SetCustomPropertyL ( TUid aPropertyId,
const TDesC & aValue
)

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

Parameters

TUid aPropertyId The ID of the property you wish to set
const TDesC & aValue A 16 bit descriptor

SetCustomPropertyL(TUid, const TDesC8 &)

IMPORT_C void SetCustomPropertyL ( TUid aPropertyId,
const TDesC8 & aValue
)

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

Parameters

TUid aPropertyId The ID of the property you wish to set
const TDesC8 & aValue An 8 bit descriptor

SetDefaultNap(TUint32)

IMPORT_C void SetDefaultNap ( TUint32 aNetworkId )

Method for setting the default nap.

Parameters

TUint32 aNetworkId Id for identifying the nap entry in the commdb

SetDefaultProxy(TUint32)

IMPORT_C void SetDefaultProxy ( TUint32 aServiceId )

Method for setting the default proxy.

Parameters

TUint32 aServiceId Id for identifying the proxy entry in the commdb

SetHome(const RBkBookmark &)

void SetHome ( const RBkBookmark & aHome ) [inline]

Method for setting the home page bookmark.

Left in for source compatibility, Use SetHomeL function instead

Parameters

const RBkBookmark & aHome Reference to the new home page

SetHomeL(const RBkBookmark &)

IMPORT_C void SetHomeL ( const RBkBookmark & aHome )

Method for setting the home page bookmark.

Parameters

const RBkBookmark & aHome Reference to the new home page

SetHomePageTextL(const TDesC &)

IMPORT_C void SetHomePageTextL ( const TDesC & aHomePageText )

Method for setting the home page text.

Parameters

const TDesC & aHomePageText Descriptor containing the new text

SetSearchUriL(const TDesC8 &)

IMPORT_C void SetSearchUriL ( const TDesC8 & aUri )

Method for setting the search page Uri.

Parameters

const TDesC8 & aUri Descriptor containing the new Uri.

Version()

IMPORT_C TVersion Version ( ) const

Gets the database version number

Member Data Documentation

CBookmarkDb * iDatabase

CBookmarkDb * iDatabase [private]