RFavouritesDb Class Reference

#include <mw/favouritesdb.h>

class RFavouritesDb : public RFavouritesHandle

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()
Inherited Attributes
RFavouritesHandle::iHandle
RFavouritesHandle::iSess
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

Detailed Description

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.

Member Function 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
ParameterDescription
aItemThe item to add.
aAutoRenameIf this is ETrue, and the name already exists, the item will be renamed to a non-conflicting name.

Returns: Error code, including:KErrArgument if the item's data is invalid (bad name, no URL, parent folder does not exist etc.).KErrAlreadyExists if the name is already in use in that folder.

Begin ( TBool )

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

Returns: Error code.

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

Returns: void

Commit ( )

IMPORT_C TIntCommit()
Commit the transaction.
Since
0.9

Returns: Error code.

Compact ( )

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

Returns: Error code.

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
ParameterDescription
aCountPlaceholder for the returned item count. In case of any error, existing value is unchanged.
aParentFolderFilterUid value to filter. KFavouritesNullUid clears (all accepted); this is the default.
aTypeFilterEItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
aNameFilterWildcard pattern to be used for name matching. NULL clears (all accepted); this is the default.
aContextIdFilterContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default.

Returns: Error code.

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

Returns: The created item.

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

Returns: The created item.

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
ParameterDescription
aUidUid of item to delete.

Returns: Error code, including:KErrNotFound if the item is not found.KErrAccessDenied if the item's cannot be deleted.

DeleteFile ( TInt )

IMPORT_C TIntDeleteFile(TIntaUid)
Delete file. See RFavouritesFile.
Since
0.9
ParameterDescription
aUidUid of the item.

Returns: Errro code.

FolderExists ( TInt, TBool & )

IMPORT_C TIntFolderExists(TIntaFolder,
TBool &aFolderExists
)
Check if the folder exists.
Since
0.9
ParameterDescription
aFolderThe folder to be checked.
aFolderExistsReturned value.

Returns: Error code.

Get ( TInt, CFavouritesItem & )

IMPORT_C TIntGet(TIntaUid,
CFavouritesItem &aItem
)
Get the item with this Uid.
Since
0.9
ParameterDescription
aUidUid or item to get.
aItemplaceholder for the returned item data.

Returns: Error code.

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
ParameterDescription
aItemListplaceholder for the returned item data. Existing items remain (new ones appended).
aParentFolderFilterUid value to filter. KFavouritesNullUid clears (all accepted); this is the default.
aTypeFilterEItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
aNameFilterwildcard pattern to be used for name matching. NULL clears (all accepted); this is the default.
aContextIdFilterContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default.

Returns: Error code.

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
ParameterDescription
aUidThe uid of the item, to which the data belongs.
aDataData object, which receives the data.

Returns: Error code, including:KErrNotFound No item is found with aUid.

GetData ( TInt, MFavouritesItemData & )

IMPORT_C TIntGetData(TIntaUid,
MFavouritesItemData &aData
)
Get data associated with an item.
Since
0.9
ParameterDescription
aUidThe uid of the item, to which the data belongs.
aDataData object, which receives the data.

Returns: Error code, including:KErrNotFound No item is found with aUid.

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
ParameterDescription
aUidsplaceholder for the returned item data. Existing items remain (new ones appended).
aParentFolderFilterUid value to filter. KFavouritesNullUid clears (all accepted); this is the default.
aTypeFilterEItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default.
aNameFilterwildcard pattern to be used for name matching. NULL clears (all accepted); this is the default.
aContextIdFilterContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default.

Returns: Error code.

IsDamaged ( TBool & )

IMPORT_C TIntIsDamaged(TBool &aIsDamaged)
Check if the database to be recovered is fully functional.
Since
0.9
ParameterDescription
aIsDamagedResult is returned here.

Returns: Error code.

ItemExists ( TInt, TBool & )

IMPORT_C TIntItemExists(TIntaUid,
TBool &aItemExists
)
Check if we already have this item.
Since
0.9
ParameterDescription
aUidThe item Uid to be checked.
aItemExistsReturned value.

Returns: Error code.

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
ParameterDescription
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.)
aFolderFolder to be used for uniqueness-checking.

Returns: Error code, including:KErrArgument aFolder is not found.KErrBadName aName is empty.

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
ParameterDescription
aItemItem to set unique name for.

Returns: Error code, including:KErrArgument aFolder is not found.KErrBadName Current name is empty.

Open ( RFavouritesSession &, const TDesC & )

IMPORT_C TIntOpen(RFavouritesSession &aSess,
const TDesC &aName
)
Open the database. Created if does not exist.
Since
0.9
ParameterDescription
aSessSession to be used.
aNameDatabase name.

Returns: Error code.

PreferredUid ( TInt, TInt & )

IMPORT_C TIntPreferredUid(TIntaFolder,
TInt &aPreferredUid
)
Get preferred Uid for a folder.
Since
0.9
ParameterDescription
aFolderFolder Uid.
aPreferredUidUid of preferred item is returned here.

Returns: Error code.

Recover ( )

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

Returns: Error code.

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
ParameterDescription
aNameDatabase name.
aReferenceDbPathFull pathname of reference database.
aApMapperAccess Point mapper to be used.

Rollback ( )

IMPORT_C voidRollback()
Roll back the transaction.
Since
0.9

Returns: void

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
ParameterDescription
aUidThe uid of the item, to which the data belongs.
aDataData) which replaces existing data.

Returns: Error code, including:KErrNotFound No item is found with aUid.

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
ParameterDescription
aUidThe uid of the item, to which the data belongs.
aDataData) which replaces existing data.

Returns: Error code, including:KErrNotFound No item is found with aUid.

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
ParameterDescription
aUidUid of item.
aFactoryItemFlag value to set.

Returns: Error code, including:KErrNotFound if the item is not found.

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

Returns: Error code, including:KErrArgument if the supplied item is not item, or is not in the root folder.

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

Returns: Error code, including:KErrArgument if the supplied item is not item, or is not in the root folder.

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
ParameterDescription
aUidUid of item.
aModifiedLast Modification Time to set.

Returns: Error code, including:KErrNotFound if the item is not found.

SetPreferredUid ( TInt, TInt )

IMPORT_C TIntSetPreferredUid(TIntaFolder,
TIntaUid
)
Set preferred Uid for a folder.
Since
0.9
ParameterDescription
aFolderFolder Uid.
aUidUid to be set as preferred. Not checked to exist in the folder.

Returns: Error code, including:KErrNotFound if aFolder is not found;KErrArgument if aFolder is not a folder.

SetReadOnly ( TInt, TBool )

IMPORT_C TIntSetReadOnly(TIntaUid,
TBoolaReadOnly
)
Set read-only flag on an item.
Since
0.9
ParameterDescription
aUidUid of item.
aReadOnlyFlag value to set.

Returns: Error code, including:KErrNotFound if the item is not found.

Size ( RDbDatabase::TSize & )

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

Returns: Error code.

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

Returns: Error code, including:KErrNotFound if the item is not found.KErrArgument if the item's data is invalid (bad name, no URL, parent folder does not exist etc.).KErrAlreadyExists if the name is already in use in that folder.KErrAccessDenied for read-only items.

UpdateStats ( )

IMPORT_C TIntUpdateStats()
Update database statistics.
Since
0.9

Returns: Error code.

Version ( )

IMPORT_C TVersionVersion()const
Get version information.
Since
0.9

Returns: Version object of this CFavouritesDb.