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 TIntAdd(CFavouritesItem &, TBool)
IMPORT_C TIntBegin(TBool)
IMPORT_C voidCleanupRollbackPushL()
IMPORT_C TIntCommit()
IMPORT_C TIntCompact()
IMPORT_C TIntCount(TInt &, TInt, CFavouritesItem::TType, const TDesC *, TInt32)
IMPORT_C CFavouritesItem *CreateAdaptiveItemsFolderL()
IMPORT_C CFavouritesItem *CreateStartPageItemL()
IMPORT_C TIntDelete(TInt)
IMPORT_C TIntDeleteFile(TInt)
IMPORT_C TIntFolderExists(TInt, TBool &)
IMPORT_C TIntGet(TInt, CFavouritesItem &)
IMPORT_C TIntGetAll(CFavouritesItemList &, TInt, CFavouritesItem::TType, const TDesC *, TInt32)
IMPORT_C TIntGetBrowserData(TInt, MFavouritesItemData &)
IMPORT_C TIntGetData(TInt, MFavouritesItemData &)
IMPORT_C TIntGetUids(CArrayFix< TInt > &, TInt, CFavouritesItem::TType, const TDesC *, TInt32)
IMPORT_C TIntIsDamaged(TBool &)
IMPORT_C TIntItemExists(TInt, TBool &)
IMPORT_C TIntMakeUniqueName(TDes &, TInt)
IMPORT_C TIntMakeUniqueName(CFavouritesItem &)
IMPORT_C TIntOpen(RFavouritesSession &, const TDesC &)
IMPORT_C TIntPreferredUid(TInt, TInt &)
IMPORT_C TIntRecover()
IMPORT_C voidRestoreFactorySettingsL(const TDesC &, const TDesC &, MRfsApMapper &)
IMPORT_C voidRollback()
IMPORT_C TIntSetBrowserData(TInt, const MFavouritesItemData &)
IMPORT_C TIntSetData(TInt, const MFavouritesItemData &)
IMPORT_C TIntSetFactoryItem(TInt, TBool)
IMPORT_C TIntSetHomepage(CFavouritesItem &)
IMPORT_C TIntSetLastVisited(CFavouritesItem &)
IMPORT_C TIntSetModified(TInt, TTime)
IMPORT_C TIntSetPreferredUid(TInt, TInt)
IMPORT_C TIntSetReadOnly(TInt, TBool)
IMPORT_C TIntSize(RDbDatabase::TSize &)
IMPORT_C TIntUpdate(CFavouritesItem &, TInt, TBool)
IMPORT_C TIntUpdateStats()
IMPORT_C TVersionVersion()
Private Member Functions
voidDoRestoreFactorySettingsL(const TDesC &, MRfsApMapper &)
TInt GetData(TInt, TInt, MFavouritesItemData &)
TInt SetData(TInt, TInt, const MFavouritesItemData &)
TInt SetSpecialItem(CFavouritesItem &, TInt)
voidStaticRollback(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 TIntAdd(CFavouritesItem &aItem,
TBoolaAutoRename
)
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 & aItemThe item to add.
TBool aAutoRenameIf this is ETrue, and the name already exists, the item will be renamed to a non-conflicting name.

Begin(TBool)

IMPORT_C TIntBegin(TBoolaWrite = EFalse)
Explicitly begin a transaction.
Since
0.9

Parameters

TBool aWrite = EFalseAccess mode.

CleanupRollbackPushL()

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

Commit()

IMPORT_C TIntCommit()
Commit the transaction.
Since
0.9

Compact()

IMPORT_C TIntCompact()
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 TIntCount(TInt &aCount,
TIntaParentFolderFilter =  KFavouritesNullUid ,
CFavouritesItem::TTypeaTypeFilter = CFavouritesItem::ENone,
const TDesC *aNameFilter = NULL,
TInt32aContextIdFilter =  KFavouritesNullContextId
)
Count all items matching the supplied criteria.
Since
0.9

Parameters

TInt & aCountPlaceholder 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::ENoneEItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
const TDesC * aNameFilter = NULLWildcard 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 TIntDelete(TIntaUid)
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 aUidUid of item to delete.

DeleteFile(TInt)

IMPORT_C TIntDeleteFile(TIntaUid)
Delete file. See RFavouritesFile.
Since
0.9

Parameters

TInt aUidUid of the item.

DoRestoreFactorySettingsL(const TDesC &, MRfsApMapper &)

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

Parameters

const TDesC & aReferenceDbPathFull pathname of reference database.
MRfsApMapper & aApMapperAccess Point mapper to be used.

FolderExists(TInt, TBool &)

IMPORT_C TIntFolderExists(TIntaFolder,
TBool &aFolderExists
)
Check if the folder exists.
Since
0.9

Parameters

TInt aFolderThe folder to be checked.
TBool & aFolderExistsReturned value.

Get(TInt, CFavouritesItem &)

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

Parameters

TInt aUidUid or item to get.
CFavouritesItem & aItemplaceholder for the returned item data.

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

IMPORT_C TIntGetAll(CFavouritesItemList &aItemList,
TIntaParentFolderFilter =  KFavouritesNullUid ,
CFavouritesItem::TTypeaTypeFilter = CFavouritesItem::ENone,
const TDesC *aNameFilter = NULL,
TInt32aContextIdFilter =  KFavouritesNullContextId
)
Get all items matching the supplied criteria.
Since
0.9

Parameters

CFavouritesItemList & aItemListplaceholder 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::ENoneEItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
const TDesC * aNameFilter = NULLwildcard 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 TIntGetBrowserData(TIntaUid,
MFavouritesItemData &aData
)
Get Browser associated with an item. This data is for Browser's dedicated use, do not tamper.
Since
0.9

Parameters

TInt aUidThe uid of the item, to which the data belongs.
MFavouritesItemData & aDataData object, which receives the data.

GetData(TInt, MFavouritesItemData &)

IMPORT_C TIntGetData(TIntaUid,
MFavouritesItemData &aData
)
Get data associated with an item.
Since
0.9

Parameters

TInt aUidThe uid of the item, to which the data belongs.
MFavouritesItemData & aDataData object, which receives the data.

GetData(TInt, TInt, MFavouritesItemData &)

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

Parameters

TInt aFunctionFunction.
TInt aUidThe uid of the item, to which the data belongs.
MFavouritesItemData & aDataData object, which receives the data.

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

IMPORT_C TIntGetUids(CArrayFix< TInt > &aUids,
TIntaParentFolderFilter =  KFavouritesNullUid ,
CFavouritesItem::TTypeaTypeFilter = CFavouritesItem::ENone,
const TDesC *aNameFilter = NULL,
TInt32aContextIdFilter =  KFavouritesNullContextId
)
Get uids of all items matching the supplied criteria.
Since
0.9

Parameters

CArrayFix< TInt > & aUidsplaceholder 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::ENoneEItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
const TDesC * aNameFilter = NULLwildcard 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 TIntIsDamaged(TBool &aIsDamaged)
Check if the database to be recovered is fully functional.
Since
0.9

Parameters

TBool & aIsDamagedResult is returned here.

ItemExists(TInt, TBool &)

IMPORT_C TIntItemExists(TIntaUid,
TBool &aItemExists
)
Check if we already have this item.
Since
0.9

Parameters

TInt aUidThe item Uid to be checked.
TBool & aItemExistsReturned value.

MakeUniqueName(TDes &, TInt)

IMPORT_C TIntMakeUniqueName(TDes &aName,
TIntaFolder
)
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 & aNameDescriptor 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 aFolderFolder to be used for uniqueness-checking.

MakeUniqueName(CFavouritesItem &)

IMPORT_C TIntMakeUniqueName(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 & aItemItem to set unique name for.

Open(RFavouritesSession &, const TDesC &)

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

Parameters

RFavouritesSession & aSessSession to be used.
const TDesC & aNameDatabase name.

PreferredUid(TInt, TInt &)

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

Parameters

TInt aFolderFolder Uid.
TInt & aPreferredUidUid of preferred item is returned here.

Recover()

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

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

IMPORT_C voidRestoreFactorySettingsL(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 & aNameDatabase name.
const TDesC & aReferenceDbPathFull pathname of reference database.
MRfsApMapper & aApMapperAccess Point mapper to be used.

Rollback()

IMPORT_C voidRollback()
Roll back the transaction.
Since
0.9

SetBrowserData(TInt, const MFavouritesItemData &)

IMPORT_C TIntSetBrowserData(TIntaUid,
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 aUidThe uid of the item, to which the data belongs.
const MFavouritesItemData & aDataData) which replaces existing data.

SetData(TInt, const MFavouritesItemData &)

IMPORT_C TIntSetData(TIntaUid,
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 aUidThe uid of the item, to which the data belongs.
const MFavouritesItemData & aDataData) which replaces existing data.

SetData(TInt, TInt, const MFavouritesItemData &)

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

Parameters

TInt aFunctionFunction.
TInt aUidThe uid of the item, to which the data belongs.
const MFavouritesItemData & aDataData which replaces existing data.

SetFactoryItem(TInt, TBool)

IMPORT_C TIntSetFactoryItem(TIntaUid,
TBoolaFactoryItem
)
Set factory item flag on an item. (Item with this flag set will be deleted if RFS is executed.)
Since
0.9

Parameters

TInt aUidUid of item.
TBool aFactoryItemFlag value to set.

SetHomepage(CFavouritesItem &)

IMPORT_C TIntSetHomepage(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 & aItemContents from this item (except Uid) will be used to update the Homepage Bookmark.

SetLastVisited(CFavouritesItem &)

IMPORT_C TIntSetLastVisited(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 & aItemContents from this item (except Uid) will be used to update the Last Visited Item.

SetModified(TInt, TTime)

IMPORT_C TIntSetModified(TIntaUid,
TTimeaModified
)
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 aUidUid of item.
TTime aModifiedLast Modification Time to set.

SetPreferredUid(TInt, TInt)

IMPORT_C TIntSetPreferredUid(TIntaFolder,
TIntaUid
)
Set preferred Uid for a folder.
Since
0.9

Parameters

TInt aFolderFolder Uid.
TInt aUidUid to be set as preferred. Not checked to exist in the folder.

SetReadOnly(TInt, TBool)

IMPORT_C TIntSetReadOnly(TIntaUid,
TBoolaReadOnly
)
Set read-only flag on an item.
Since
0.9

Parameters

TInt aUidUid of item.
TBool aReadOnlyFlag value to set.

SetSpecialItem(CFavouritesItem &, TInt)

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

Parameters

CFavouritesItem & aItemItem data.
TInt aUidUid of the item to be set.

Size(RDbDatabase::TSize &)

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

Parameters

RDbDatabase::TSize & aSizeDatabase size returned here.

StaticRollback(TAny *)

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

Parameters

TAny * aPtrThis as TAny*.

Update(CFavouritesItem &, TInt, TBool)

IMPORT_C TIntUpdate(CFavouritesItem &aItem,
TIntaUid,
TBoolaAutoRename
)
Update an item. Remember Homapage or Last Visited Page cannot be updated using this method.
Since
0.9

Parameters

CFavouritesItem & aItemContents 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 aUidUpdate this item.
TBool aAutoRenameIf this is ETrue, and the name already exists, the item will be renamed to a non-conflicting name.

UpdateStats()

IMPORT_C TIntUpdateStats()
Update database statistics.
Since
0.9

Version()

IMPORT_C TVersionVersion()const
Get version information.
Since
0.9