RFavouritesDb Class Reference
#include
<mw/favouritesdb.h>
class RFavouritesDb : public RFavouritesHandle |
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() |
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 )
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
Parameter | Description | aItem | The item to add. |
aAutoRename | If 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 )
Explicitly begin a transaction.
- Since
- 0.9
Parameter | Description | aWrite | 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 ( )
Commit the transaction.
- Since
- 0.9
Compact ( )
Perform databas synchronous compaction. This function requires exclusive access to the database.
- Since
- 0.9
Count ( TInt &, TInt, CFavouritesItem::TType, const TDesC *, TInt32 )
Count all items matching the supplied criteria.
- Since
- 0.9
Parameter | Description | aCount | Placeholder for the returned item count. In case of any error, existing value is unchanged. |
aParentFolderFilter | Uid value to filter. KFavouritesNullUid clears (all accepted); this is the default. |
aTypeFilter | EItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default. |
aNameFilter | Wildcard pattern to be used for name matching. NULL clears (all accepted); this is the default. |
aContextIdFilter | ContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default. |
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 ( )
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 )
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
Parameter | Description | aUid | Uid 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 )
Parameter | Description | aUid | Uid of the item. |
FolderExists ( TInt, TBool & )
Check if the folder exists.
- Since
- 0.9
Parameter | Description | aFolder | The folder to be checked. |
aFolderExists | Returned value. |
Get ( TInt, CFavouritesItem & )
Get the item with this Uid.
- Since
- 0.9
Parameter | Description | aUid | Uid or item to get. |
aItem | placeholder for the returned item data. |
GetAll ( CFavouritesItemList &, TInt, CFavouritesItem::TType, const TDesC *, TInt32 )
Get all items matching the supplied criteria.
- Since
- 0.9
Parameter | Description | aItemList | placeholder for the returned item data. Existing items remain (new ones appended). |
aParentFolderFilter | Uid value to filter. KFavouritesNullUid clears (all accepted); this is the default. |
aTypeFilter | EItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default. |
aNameFilter | wildcard pattern to be used for name matching. NULL clears (all accepted); this is the default. |
aContextIdFilter | ContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default. |
GetBrowserData ( TInt, MFavouritesItemData & )
Get Browser associated with an item. This data is for Browser's dedicated use, do not tamper.
- Since
- 0.9
Parameter | Description | aUid | The uid of the item, to which the data belongs. |
aData | Data object, which receives the data. |
Returns: Error code, including:KErrNotFound No item is found with aUid.
GetData ( TInt, MFavouritesItemData & )
Get data associated with an item.
- Since
- 0.9
Parameter | Description | aUid | The uid of the item, to which the data belongs. |
aData | Data 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 )
Get uids of all items matching the supplied criteria.
- Since
- 0.9
Parameter | Description | aUids | placeholder for the returned item data. Existing items remain (new ones appended). |
aParentFolderFilter | Uid value to filter. KFavouritesNullUid clears (all accepted); this is the default. |
aTypeFilter | EItem or EFolder to use filter; ENone to clear filter (all accepted); this is the default. |
aNameFilter | wildcard pattern to be used for name matching. NULL clears (all accepted); this is the default. |
aContextIdFilter | ContextId value to filter. KFavouritesNullContextId clears (all accepted); this is the default. |
IsDamaged ( TBool & )
Check if the database to be recovered is fully functional.
- Since
- 0.9
Parameter | Description | aIsDamaged | Result is returned here. |
ItemExists ( TInt, TBool & )
Check if we already have this item.
- Since
- 0.9
Parameter | Description | aUid | The item Uid to be checked. |
aItemExists | Returned value. |
MakeUniqueName ( TDes &, TInt )
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
Parameter | Description | 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.) |
aFolder | Folder to be used for uniqueness-checking. |
Returns: Error code, including:KErrArgument aFolder is not found.KErrBadName aName is empty.
MakeUniqueName ( CFavouritesItem & )
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
Parameter | Description | aItem | Item to set unique name for. |
Returns: Error code, including:KErrArgument aFolder is not found.KErrBadName Current name is empty.
Open ( RFavouritesSession &, const TDesC & )
Open the database. Created if does not exist.
- Since
- 0.9
Parameter | Description | aSess | Session to be used. |
aName | Database name. |
PreferredUid ( TInt, TInt & )
IMPORT_C TInt | PreferredUid | ( | TInt | aFolder, |
| TInt & | aPreferredUid |
| ) | |
Get preferred Uid for a folder.
- Since
- 0.9
Parameter | Description | aFolder | Folder Uid. |
aPreferredUid | Uid of preferred item is returned here. |
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
Parameter | Description | aName | Database name. |
aReferenceDbPath | Full pathname of reference database. |
aApMapper | Access Point mapper to be used. |
Rollback ( )
Roll back the transaction.
- Since
- 0.9
SetBrowserData ( TInt, const MFavouritesItemData & )
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
Parameter | Description | aUid | The uid of the item, to which the data belongs. |
aData | Data) which replaces existing data. |
Returns: Error code, including:KErrNotFound No item is found with aUid.
SetData ( TInt, const MFavouritesItemData & )
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
Parameter | Description | aUid | The uid of the item, to which the data belongs. |
aData | Data) which replaces existing data. |
Returns: Error code, including:KErrNotFound No item is found with aUid.
SetFactoryItem ( TInt, TBool )
Set factory item flag on an item. (Item with this flag set will be deleted if RFS is executed.)
- Since
- 0.9
Parameter | Description | aUid | Uid of item. |
aFactoryItem | Flag value to set. |
Returns: Error code, including:KErrNotFound if the item is not found.
SetHomepage ( CFavouritesItem & )
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
Parameter | Description | aItem | Contents 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 & )
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
Parameter | Description | aItem | Contents 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 )
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
Parameter | Description | aUid | Uid of item. |
aModified | Last Modification Time to set. |
Returns: Error code, including:KErrNotFound if the item is not found.
SetPreferredUid ( TInt, TInt )
Set preferred Uid for a folder.
- Since
- 0.9
Parameter | Description | aFolder | Folder Uid. |
aUid | Uid 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 )
Set read-only flag on an item.
- Since
- 0.9
Parameter | Description | aUid | Uid of item. |
aReadOnly | Flag value to set. |
Returns: Error code, including:KErrNotFound if the item is not found.
Size ( RDbDatabase::TSize & )
Get available database size.
- Since
- 0.9
Parameter | Description | aSize | Database size returned here. |
Update ( CFavouritesItem &, TInt, TBool )
Update an item. Remember Homapage or Last Visited Page cannot be updated using this method.
- Since
- 0.9
Parameter | Description | 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. |
aUid | Update this item. |
aAutoRename | If 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 TInt | UpdateStats | ( | ) | |
Update database statistics.
- Since
- 0.9
Version ( )
Get version information.
- Since
- 0.9
Returns: Version object of this CFavouritesDb.