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.
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
()
|
Member Functions 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
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()
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)
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()
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()
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)
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)
Parameters
TInt
aUid
|
Uid of the item.
|
DoRestoreFactorySettingsL(const TDesC &, MRfsApMapper &)
void
|
DoRestoreFactorySettingsL
|
(
|
const
TDesC
&
|
aReferenceDbPath,
|
|
MRfsApMapper
&
|
aApMapper
|
|
)
|
[private]
|
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 &)
Get the item with this Uid.
-
Since
-
0.9
GetAll(CFavouritesItemList &, TInt, CFavouritesItem::TType, const TDesC *, TInt32)
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 &)
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 &)
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 &)
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)
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 &)
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)
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 &)
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
Open(RFavouritesSession &, const TDesC &)
Open the database. Created if does not exist.
-
Since
-
0.9
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 &)
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 &)
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 &)
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)
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 &)
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 &)
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)
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)
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)
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)
Set Homepage / Last Visited Page.
-
Since
-
0.9
Size(RDbDatabase::TSize &)
Get available database size.
-
Since
-
0.9
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)
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()
Get version information.
-
Since
-
0.9
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.