RFavouritesDb Class Reference

class RFavouritesDb : public RFavouritesHandle

RFavouritesDb is the representation of the favourites database. This class encapsulates a session with bookmark database server. It provides a way to access the database, do administration (recovery, compaction) and explicit transaction support.

Inherits from

Public Member Functions
IMPORT_C TInt Add ( CFavouritesItem &, TBool )
IMPORT_C TInt Begin ( TBool )
IMPORT_C void CleanupRollbackPushL ()
IMPORT_C TInt Commit ()
IMPORT_C TInt Compact ()
IMPORT_C TInt Count ( TInt &, TInt , CFavouritesItem::TType , const TDesC *, TInt32 )
IMPORT_C CFavouritesItem * CreateAdaptiveItemsFolderL ()
IMPORT_C CFavouritesItem * CreateStartPageItemL ()
IMPORT_C TInt Delete ( TInt )
IMPORT_C TInt DeleteFile ( TInt )
IMPORT_C TInt FolderExists ( TInt , TBool &)
IMPORT_C TInt Get ( TInt , CFavouritesItem &)
IMPORT_C TInt GetAll ( CFavouritesItemList &, TInt , CFavouritesItem::TType , const TDesC *, TInt32 )
IMPORT_C TInt GetBrowserData ( TInt , MFavouritesItemData &)
IMPORT_C TInt GetData ( TInt , MFavouritesItemData &)
IMPORT_C TInt GetUids ( CArrayFix < TInt > &, TInt , CFavouritesItem::TType , const TDesC *, TInt32 )
IMPORT_C TInt IsDamaged ( TBool &)
IMPORT_C TInt ItemExists ( TInt , TBool &)
IMPORT_C TInt MakeUniqueName ( TDes &, TInt )
IMPORT_C TInt MakeUniqueName ( CFavouritesItem &)
IMPORT_C TInt Open ( RFavouritesSession &, const TDesC &)
IMPORT_C TInt PreferredUid ( TInt , TInt &)
IMPORT_C TInt Recover ()
IMPORT_C void RestoreFactorySettingsL (const TDesC &, const TDesC &, MRfsApMapper &)
IMPORT_C void Rollback ()
IMPORT_C TInt SetBrowserData ( TInt , const MFavouritesItemData &)
IMPORT_C TInt SetData ( TInt , const MFavouritesItemData &)
IMPORT_C TInt SetFactoryItem ( TInt , TBool )
IMPORT_C TInt SetHomepage ( CFavouritesItem &)
IMPORT_C TInt SetLastVisited ( CFavouritesItem &)
IMPORT_C TInt SetModified ( TInt , TTime )
IMPORT_C TInt SetPreferredUid ( TInt , TInt )
IMPORT_C TInt SetReadOnly ( TInt , TBool )
IMPORT_C TInt Size ( RDbDatabase::TSize &)
IMPORT_C TInt Update ( CFavouritesItem &, TInt , TBool )
IMPORT_C TInt UpdateStats ()
IMPORT_C TVersion Version ()
Private Member Functions
void DoRestoreFactorySettingsL (const TDesC &, MRfsApMapper &)
TInt GetData ( TInt , TInt , MFavouritesItemData &)
TInt SetData ( TInt , TInt , const MFavouritesItemData &)
TInt SetSpecialItem ( CFavouritesItem &, TInt )
void StaticRollback ( TAny *)
Inherited Functions
RFavouritesHandle::Close()
RFavouritesHandle::Handle()const
RFavouritesHandle::Open(RFavouritesHandle &,TInt,const TIpcArgs &)
RFavouritesHandle::Open(RFavouritesSession &,TInt,const TIpcArgs &)
RFavouritesHandle::RFavouritesHandle()
RFavouritesHandle::SendReceive(TInt)const
RFavouritesHandle::SendReceive(TInt,const TIpcArgs &)const
RFavouritesHandle::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
Inherited Attributes
RFavouritesHandle::iHandle
RFavouritesHandle::iSess

Member Functions Documentation

Add(CFavouritesItem &, TBool)

IMPORT_C TInt Add ( CFavouritesItem & aItem,
TBool aAutoRename
)
Add a new item to the database. If successful, its Uid, Last-Mod-Time (and possibly its name) is updated on return.
Since
0.9

Parameters

CFavouritesItem & aItem The item to add.
TBool aAutoRename If this is ETrue, and the name already exists, the item will be renamed to a non-conflicting name.

Begin(TBool)

IMPORT_C TInt Begin ( TBool aWrite = EFalse )
Explicitly begin a transaction.
Since
0.9

Parameters

TBool aWrite = EFalse Access mode.

CleanupRollbackPushL()

IMPORT_C void CleanupRollbackPushL ( )
Push a rollback on the cleanup stack. Call this after Begin() call, to make the transaction leave-safe.
Since
0.9

Commit()

IMPORT_C TInt Commit ( )
Commit the transaction.
Since
0.9

Compact()

IMPORT_C TInt Compact ( )
Perform databas synchronous compaction. This function requires exclusive access to the database.
Since
0.9

Count(TInt &, TInt, CFavouritesItem::TType, const TDesC *, TInt32)

IMPORT_C TInt Count ( TInt & aCount,
TInt aParentFolderFilter =  KFavouritesNullUid ,
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone,
const TDesC * aNameFilter = NULL,
TInt32 aContextIdFilter =  KFavouritesNullContextId
)
Count all items matching the supplied criteria.
Since
0.9

Parameters

TInt & aCount Placeholder for the returned item count. In case of any error, existing value is unchanged.
TInt aParentFolderFilter =  KFavouritesNullUid Uid value to filter. KFavouritesNullUid clears (all accepted); this is the default.
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone EItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
const TDesC * aNameFilter = NULL Wildcard pattern to be used for name matching. NULL clears (all accepted); this is the default.
TInt32 aContextIdFilter =  KFavouritesNullContextId ContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default.

CreateAdaptiveItemsFolderL()

IMPORT_C CFavouritesItem * CreateAdaptiveItemsFolderL ( )
Create a folder with uid KFavouritesAdaptiveItemsFolderUid. Owner is the caller. Uid, type (folder) and parent (root) is set, other properties are uninitialized. The Browser needs this. Note that this item does not exist in the database.
Since
0.9

CreateStartPageItemL()

IMPORT_C CFavouritesItem * CreateStartPageItemL ( )
Create an empty item with uid KFavouritesStartPageUid. Owner is the caller. Except its uid, the item is uninitialized. The Browser needs this. Note that this item does not exist in the database.
Since
0.9

Delete(TInt)

IMPORT_C TInt Delete ( TInt aUid )
Delete item by Uid. If this is a folder, all descendants and the contents of them are deleted. Homepage or root cannot be deleted.
Since
0.9

Parameters

TInt aUid Uid of item to delete.

DeleteFile(TInt)

IMPORT_C TInt DeleteFile ( TInt aUid )
Delete file. See RFavouritesFile .
Since
0.9

Parameters

TInt aUid Uid of the item.

DoRestoreFactorySettingsL(const TDesC &, MRfsApMapper &)

void DoRestoreFactorySettingsL ( const TDesC & aReferenceDbPath,
MRfsApMapper & aApMapper
) [private]
Implementation of RestoreFactorySettingsL() .
Since
0.9

Parameters

const TDesC & aReferenceDbPath Full pathname of reference database.
MRfsApMapper & aApMapper Access Point mapper to be used.

FolderExists(TInt, TBool &)

IMPORT_C TInt FolderExists ( TInt aFolder,
TBool & aFolderExists
)
Check if the folder exists.
Since
0.9

Parameters

TInt aFolder The folder to be checked.
TBool & aFolderExists Returned value.

Get(TInt, CFavouritesItem &)

IMPORT_C TInt Get ( TInt aUid,
CFavouritesItem & aItem
)
Get the item with this Uid.
Since
0.9

Parameters

TInt aUid Uid or item to get.
CFavouritesItem & aItem placeholder for the returned item data.

GetAll(CFavouritesItemList &, TInt, CFavouritesItem::TType, const TDesC *, TInt32)

IMPORT_C TInt GetAll ( CFavouritesItemList & aItemList,
TInt aParentFolderFilter =  KFavouritesNullUid ,
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone,
const TDesC * aNameFilter = NULL,
TInt32 aContextIdFilter =  KFavouritesNullContextId
)
Get all items matching the supplied criteria.
Since
0.9

Parameters

CFavouritesItemList & aItemList placeholder for the returned item data. Existing items remain (new ones appended).
TInt aParentFolderFilter =  KFavouritesNullUid Uid value to filter. KFavouritesNullUid clears (all accepted); this is the default.
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone EItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
const TDesC * aNameFilter = NULL wildcard pattern to be used for name matching. NULL clears (all accepted); this is the default.
TInt32 aContextIdFilter =  KFavouritesNullContextId ContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default.

GetBrowserData(TInt, MFavouritesItemData &)

IMPORT_C TInt GetBrowserData ( TInt aUid,
MFavouritesItemData & aData
)
Get Browser associated with an item. This data is for Browser's dedicated use, do not tamper.
Since
0.9

Parameters

TInt aUid The uid of the item, to which the data belongs.
MFavouritesItemData & aData Data object, which receives the data.

GetData(TInt, MFavouritesItemData &)

IMPORT_C TInt GetData ( TInt aUid,
MFavouritesItemData & aData
)
Get data associated with an item.
Since
0.9

Parameters

TInt aUid The uid of the item, to which the data belongs.
MFavouritesItemData & aData Data object, which receives the data.

GetData(TInt, TInt, MFavouritesItemData &)

TInt GetData ( TInt aFunction,
TInt aUid,
MFavouritesItemData & aData
) [private]
Get data associated with an item.
Since
0.9

Parameters

TInt aFunction Function.
TInt aUid The uid of the item, to which the data belongs.
MFavouritesItemData & aData Data object, which receives the data.

GetUids(CArrayFix< TInt > &, TInt, CFavouritesItem::TType, const TDesC *, TInt32)

IMPORT_C TInt GetUids ( CArrayFix < TInt > & aUids,
TInt aParentFolderFilter =  KFavouritesNullUid ,
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone,
const TDesC * aNameFilter = NULL,
TInt32 aContextIdFilter =  KFavouritesNullContextId
)
Get uids of all items matching the supplied criteria.
Since
0.9

Parameters

CArrayFix < TInt > & aUids placeholder for the returned item data. Existing items remain (new ones appended).
TInt aParentFolderFilter =  KFavouritesNullUid Uid value to filter. KFavouritesNullUid clears (all accepted); this is the default.
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone EItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
const TDesC * aNameFilter = NULL wildcard pattern to be used for name matching. NULL clears (all accepted); this is the default.
TInt32 aContextIdFilter =  KFavouritesNullContextId ContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default.

IsDamaged(TBool &)

IMPORT_C TInt IsDamaged ( TBool & aIsDamaged )
Check if the database to be recovered is fully functional.
Since
0.9

Parameters

TBool & aIsDamaged Result is returned here.

ItemExists(TInt, TBool &)

IMPORT_C TInt ItemExists ( TInt aUid,
TBool & aItemExists
)
Check if we already have this item.
Since
0.9

Parameters

TInt aUid The item Uid to be checked.
TBool & aItemExists Returned value.

MakeUniqueName(TDes &, TInt)

IMPORT_C TInt MakeUniqueName ( TDes & aName,
TInt aFolder
)
Check if aName is unique in aFolder; and if not, change to an unique one, appending a number. In case of any errors, aName is unchanged. Names of special items (Start Page etc.) are not considered (can have conflicting names).
Since
0.9

Parameters

TDes & aName Descriptor containing the original name and receiving the resulting unique name. Must be large enough to accomodate the result. (The appended text is KFavouritesMaxPostfix characters at most; the resulting length is KFavouritesMaxName at most.)
TInt aFolder Folder to be used for uniqueness-checking.

MakeUniqueName(CFavouritesItem &)

IMPORT_C TInt MakeUniqueName ( CFavouritesItem & aItem )
Check if aName is unique in its folder; and if not, change to an unique one, appending a number. In case of any errors, aItem is unchanged. Names of special items (Start Page etc.) are not considered (can have conflicting names).
Since
0.9

Parameters

CFavouritesItem & aItem Item to set unique name for.

Open(RFavouritesSession &, const TDesC &)

IMPORT_C TInt Open ( RFavouritesSession & aSess,
const TDesC & aName
)
Open the database. Created if does not exist.
Since
0.9

Parameters

RFavouritesSession & aSess Session to be used.
const TDesC & aName Database name.

PreferredUid(TInt, TInt &)

IMPORT_C TInt PreferredUid ( TInt aFolder,
TInt & aPreferredUid
)
Get preferred Uid for a folder.
Since
0.9

Parameters

TInt aFolder Folder Uid.
TInt & aPreferredUid Uid of preferred item is returned here.

Recover()

IMPORT_C TInt Recover ( )
Perform database synchronous recovery. This function requires exclusive access to the database.
Since
0.9

RestoreFactorySettingsL(const TDesC &, const TDesC &, MRfsApMapper &)

IMPORT_C void RestoreFactorySettingsL ( const TDesC & aName,
const TDesC & aReferenceDbPath,
MRfsApMapper & aApMapper
) [static]
User-level Restore Factory Settings operation. Delete all items that has "factory item" flag set, then add new ones from reference database. In case of name conflilcts, new names are generated. Leaves on any error.
Since
0.9

Parameters

const TDesC & aName Database name.
const TDesC & aReferenceDbPath Full pathname of reference database.
MRfsApMapper & aApMapper Access Point mapper to be used.

Rollback()

IMPORT_C void Rollback ( )
Roll back the transaction.
Since
0.9

SetBrowserData(TInt, const MFavouritesItemData &)

IMPORT_C TInt SetBrowserData ( TInt aUid,
const MFavouritesItemData & aData
)
Set Browser data associated with an item. Any existing data, belonging to item having aUid, is now replaced. The item itself is not changed. This data is for Browser's dedicated use, do not tamper. In case of any errors, the data is not saved.
Since
0.9

Parameters

TInt aUid The uid of the item, to which the data belongs.
const MFavouritesItemData & aData Data) which replaces existing data.

SetData(TInt, const MFavouritesItemData &)

IMPORT_C TInt SetData ( TInt aUid,
const MFavouritesItemData & aData
)
Set data associated with an item. Any existing data, belonging to item having aUid, is now replaced. The item itself is not changed. In case of any errors, the data is not saved.
Since
0.9

Parameters

TInt aUid The uid of the item, to which the data belongs.
const MFavouritesItemData & aData Data) which replaces existing data.

SetData(TInt, TInt, const MFavouritesItemData &)

TInt SetData ( TInt aFunction,
TInt aUid,
const MFavouritesItemData & aData
) [private]
Set data associated with an item.
Since
0.9

Parameters

TInt aFunction Function.
TInt aUid The uid of the item, to which the data belongs.
const MFavouritesItemData & aData Data which replaces existing data.

SetFactoryItem(TInt, TBool)

IMPORT_C TInt SetFactoryItem ( TInt aUid,
TBool aFactoryItem
)
Set factory item flag on an item. (Item with this flag set will be deleted if RFS is executed.)
Since
0.9

Parameters

TInt aUid Uid of item.
TBool aFactoryItem Flag value to set.

SetHomepage(CFavouritesItem &)

IMPORT_C TInt SetHomepage ( CFavouritesItem & aItem )
Update the Homepage item. If does not exist, it is now created. The old Homepage, if any, is overwritten. If successful, its Uid and Last-Mod-Time is updated on return. Name needs not be unique.
Since
0.9

Parameters

CFavouritesItem & aItem Contents from this item (except Uid) will be used to update the Homepage Bookmark.

SetLastVisited(CFavouritesItem &)

IMPORT_C TInt SetLastVisited ( CFavouritesItem & aItem )
Update the Last Visited. If does not exist, it is now created. The old Last Visited, if any, is overwritten. If successful, its Uid is updated on return. Name needs not be unique.
Since
0.9

Parameters

CFavouritesItem & aItem Contents from this item (except Uid) will be used to update the Last Visited Item.

SetModified(TInt, TTime)

IMPORT_C TInt SetModified ( TInt aUid,
TTime aModified
)
Manual setting of Last Modification Time of an item. Note that the Last Modification Time is automatically set by any edit, so this method need not be used in usual circumstances. It is provided for administration purposes only.
Since
0.9

Parameters

TInt aUid Uid of item.
TTime aModified Last Modification Time to set.

SetPreferredUid(TInt, TInt)

IMPORT_C TInt SetPreferredUid ( TInt aFolder,
TInt aUid
)
Set preferred Uid for a folder.
Since
0.9

Parameters

TInt aFolder Folder Uid.
TInt aUid Uid to be set as preferred. Not checked to exist in the folder.

SetReadOnly(TInt, TBool)

IMPORT_C TInt SetReadOnly ( TInt aUid,
TBool aReadOnly
)
Set read-only flag on an item.
Since
0.9

Parameters

TInt aUid Uid of item.
TBool aReadOnly Flag value to set.

SetSpecialItem(CFavouritesItem &, TInt)

TInt SetSpecialItem ( CFavouritesItem & aItem,
TInt aUid
) [private]
Set Homepage / Last Visited Page.
Since
0.9

Parameters

CFavouritesItem & aItem Item data.
TInt aUid Uid of the item to be set.

Size(RDbDatabase::TSize &)

IMPORT_C TInt Size ( RDbDatabase::TSize & aSize ) const
Get available database size.
Since
0.9

Parameters

RDbDatabase::TSize & aSize Database size returned here.

StaticRollback(TAny *)

void StaticRollback ( TAny * aPtr ) [private, static]
Cleanup helper, static wrapper around the rollback call.
Since
0.9

Parameters

TAny * aPtr This as TAny*.

Update(CFavouritesItem &, TInt, TBool)

IMPORT_C TInt Update ( CFavouritesItem & aItem,
TInt aUid,
TBool aAutoRename
)
Update an item. Remember Homapage or Last Visited Page cannot be updated using this method.
Since
0.9

Parameters

CFavouritesItem & aItem Contents from this item (except Uid) will be used to update the item. If successful, its Uid, Last-Mod-Time (and possibly its name) is updated on return.
TInt aUid Update this item.
TBool aAutoRename If this is ETrue, and the name already exists, the item will be renamed to a non-conflicting name.

UpdateStats()

IMPORT_C TInt UpdateStats ( )
Update database statistics.
Since
0.9

Version()

IMPORT_C TVersion Version ( ) const
Get version information.
Since
0.9