williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Declaration of RFavouritesDb.
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef FAVOURITES_DB_H
|
williamr@2
|
20 |
#define FAVOURITES_DB_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
// INCLUDES
|
williamr@2
|
23 |
|
williamr@2
|
24 |
#include <e32base.h>
|
williamr@2
|
25 |
#include <d32dbms.h>
|
williamr@4
|
26 |
#include <favouritesitem.h>
|
williamr@4
|
27 |
#include <favouriteslimits.h>
|
williamr@4
|
28 |
#include <favouritessession.h>
|
williamr@4
|
29 |
#include <favouriteshandle.h>
|
williamr@2
|
30 |
|
williamr@2
|
31 |
// FORWARD DECLARATIONS
|
williamr@2
|
32 |
|
williamr@2
|
33 |
class CFavouritesItemList;
|
williamr@2
|
34 |
class MFavouritesItemData;
|
williamr@2
|
35 |
class MRfsApMapper;
|
williamr@2
|
36 |
|
williamr@2
|
37 |
// CLASS DECLARATION
|
williamr@2
|
38 |
|
williamr@2
|
39 |
/**
|
williamr@2
|
40 |
* RFavouritesDb is the representation of the favourites database.
|
williamr@2
|
41 |
* This class encapsulates a session with bookmark database server.
|
williamr@2
|
42 |
* It provides a way to access the database, do administration
|
williamr@2
|
43 |
* (recovery, compaction) and explicit transaction support.
|
williamr@2
|
44 |
*/
|
williamr@2
|
45 |
class RFavouritesDb: public RFavouritesHandle
|
williamr@2
|
46 |
{
|
williamr@2
|
47 |
|
williamr@2
|
48 |
public: // New methods
|
williamr@2
|
49 |
|
williamr@2
|
50 |
/**
|
williamr@2
|
51 |
* Open the database. Created if does not exist.
|
williamr@2
|
52 |
* @since 0.9
|
williamr@2
|
53 |
* @param aSess Session to be used.
|
williamr@2
|
54 |
* @param aName Database name.
|
williamr@2
|
55 |
* @return Error code.
|
williamr@2
|
56 |
*/
|
williamr@2
|
57 |
IMPORT_C TInt Open( RFavouritesSession& aSess, const TDesC& aName );
|
williamr@2
|
58 |
|
williamr@2
|
59 |
public: // Adminstration
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
* Get version information.
|
williamr@2
|
63 |
* @since 0.9
|
williamr@2
|
64 |
* @return Version object of this CFavouritesDb.
|
williamr@2
|
65 |
*/
|
williamr@2
|
66 |
IMPORT_C TVersion Version() const;
|
williamr@2
|
67 |
|
williamr@2
|
68 |
/**
|
williamr@2
|
69 |
* Check if the database to be recovered is fully functional.
|
williamr@2
|
70 |
* @since 0.9
|
williamr@2
|
71 |
* @param aIsDamaged Result is returned here.
|
williamr@2
|
72 |
* @return Error code.
|
williamr@2
|
73 |
*/
|
williamr@2
|
74 |
IMPORT_C TInt IsDamaged( TBool& aIsDamaged );
|
williamr@2
|
75 |
|
williamr@2
|
76 |
/**
|
williamr@2
|
77 |
* Perform database synchronous recovery. This function requires exclusive access
|
williamr@2
|
78 |
* to the database.
|
williamr@2
|
79 |
* @since 0.9
|
williamr@2
|
80 |
* @return Error code.
|
williamr@2
|
81 |
*/
|
williamr@2
|
82 |
IMPORT_C TInt Recover();
|
williamr@2
|
83 |
|
williamr@2
|
84 |
/**
|
williamr@2
|
85 |
* Perform databas synchronous compaction. This function requires exclusive access
|
williamr@2
|
86 |
* to the database.
|
williamr@2
|
87 |
* @since 0.9
|
williamr@2
|
88 |
* @return Error code.
|
williamr@2
|
89 |
*/
|
williamr@2
|
90 |
IMPORT_C TInt Compact();
|
williamr@2
|
91 |
|
williamr@2
|
92 |
/**
|
williamr@2
|
93 |
* Get available database size.
|
williamr@2
|
94 |
* @since 0.9
|
williamr@2
|
95 |
* @param aSize Database size returned here.
|
williamr@2
|
96 |
* @return Error code.
|
williamr@2
|
97 |
*/
|
williamr@2
|
98 |
IMPORT_C TInt Size( RDbDatabase::TSize& aSize ) const;
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/**
|
williamr@2
|
101 |
* Update database statistics.
|
williamr@2
|
102 |
* @since 0.9
|
williamr@2
|
103 |
* @return Error code.
|
williamr@2
|
104 |
*/
|
williamr@2
|
105 |
IMPORT_C TInt UpdateStats();
|
williamr@2
|
106 |
|
williamr@2
|
107 |
public: // Transaction support
|
williamr@2
|
108 |
|
williamr@2
|
109 |
/**
|
williamr@2
|
110 |
* Explicitly begin a transaction.
|
williamr@2
|
111 |
* @since 0.9
|
williamr@2
|
112 |
* @param aWrite Access mode.
|
williamr@2
|
113 |
* @return Error code.
|
williamr@2
|
114 |
*/
|
williamr@2
|
115 |
IMPORT_C TInt Begin( TBool aWrite = EFalse );
|
williamr@2
|
116 |
|
williamr@2
|
117 |
/**
|
williamr@2
|
118 |
* Commit the transaction.
|
williamr@2
|
119 |
* @since 0.9
|
williamr@2
|
120 |
* @return Error code.
|
williamr@2
|
121 |
*/
|
williamr@2
|
122 |
IMPORT_C TInt Commit();
|
williamr@2
|
123 |
|
williamr@2
|
124 |
/**
|
williamr@2
|
125 |
* Roll back the transaction.
|
williamr@2
|
126 |
* @since 0.9
|
williamr@2
|
127 |
* @return void
|
williamr@2
|
128 |
*/
|
williamr@2
|
129 |
IMPORT_C void Rollback();
|
williamr@2
|
130 |
|
williamr@2
|
131 |
/**
|
williamr@2
|
132 |
* Push a rollback on the cleanup stack. Call this after Begin() call,
|
williamr@2
|
133 |
* to make the transaction leave-safe.
|
williamr@2
|
134 |
* @since 0.9
|
williamr@2
|
135 |
* @return void
|
williamr@2
|
136 |
*/
|
williamr@2
|
137 |
IMPORT_C void CleanupRollbackPushL();
|
williamr@2
|
138 |
|
williamr@2
|
139 |
public: // Data access / update / delete
|
williamr@2
|
140 |
|
williamr@2
|
141 |
/**
|
williamr@2
|
142 |
* Get the item with this Uid.
|
williamr@2
|
143 |
* @since 0.9
|
williamr@2
|
144 |
* @param aUid Uid or item to get.
|
williamr@2
|
145 |
* @param aItem placeholder for the returned item data.
|
williamr@2
|
146 |
* @return Error code.
|
williamr@2
|
147 |
*/
|
williamr@2
|
148 |
IMPORT_C TInt Get( TInt aUid, CFavouritesItem& aItem );
|
williamr@2
|
149 |
|
williamr@2
|
150 |
/**
|
williamr@2
|
151 |
* Get all items matching the supplied criteria.
|
williamr@2
|
152 |
* @since 0.9
|
williamr@2
|
153 |
* @param aItemList placeholder for the returned item data. Existing
|
williamr@2
|
154 |
* items remain (new ones appended).
|
williamr@2
|
155 |
* @param aParentFolderFilter Uid value to filter. KFavouritesNullUid
|
williamr@2
|
156 |
* clears (all accepted); this is the default.
|
williamr@2
|
157 |
* @param aTypeFilter EItem or EFolder to use filter; ENone to clear
|
williamr@2
|
158 |
* filter (all accepted); this is the default.
|
williamr@2
|
159 |
* @param aNameFilter wildcard pattern to be used for name matching.
|
williamr@2
|
160 |
* NULL clears (all accepted); this is the default.
|
williamr@2
|
161 |
* @param aContextIdFilter ContextId value to filter.
|
williamr@2
|
162 |
* KFavouritesNullContextId clears (all accepted); this is the default.
|
williamr@2
|
163 |
* @return Error code.
|
williamr@2
|
164 |
*/
|
williamr@2
|
165 |
IMPORT_C TInt GetAll
|
williamr@2
|
166 |
(
|
williamr@2
|
167 |
CFavouritesItemList& aItemList,
|
williamr@2
|
168 |
TInt aParentFolderFilter = KFavouritesNullUid,
|
williamr@2
|
169 |
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone,
|
williamr@2
|
170 |
const TDesC* aNameFilter = NULL,
|
williamr@2
|
171 |
TInt32 aContextIdFilter = KFavouritesNullContextId
|
williamr@2
|
172 |
);
|
williamr@2
|
173 |
|
williamr@2
|
174 |
/**
|
williamr@2
|
175 |
* Get uids of all items matching the supplied criteria.
|
williamr@2
|
176 |
* @since 0.9
|
williamr@2
|
177 |
* @param aUids placeholder for the returned item data. Existing
|
williamr@2
|
178 |
* items remain (new ones appended).
|
williamr@2
|
179 |
* @param aParentFolderFilter Uid value to filter. KFavouritesNullUid
|
williamr@2
|
180 |
* clears (all accepted); this is the default.
|
williamr@2
|
181 |
* @param aTypeFilter EItem or EFolder to use filter; ENone to clear
|
williamr@2
|
182 |
* filter (all accepted); this is the default.
|
williamr@2
|
183 |
* @param aNameFilter wildcard pattern to be used for name matching.
|
williamr@2
|
184 |
* NULL clears (all accepted); this is the default.
|
williamr@2
|
185 |
* @param aContextIdFilter ContextId value to filter.
|
williamr@2
|
186 |
* KFavouritesNullContextId clears (all accepted); this is the default.
|
williamr@2
|
187 |
* @return Error code.
|
williamr@2
|
188 |
*/
|
williamr@2
|
189 |
IMPORT_C TInt GetUids
|
williamr@2
|
190 |
(
|
williamr@2
|
191 |
CArrayFix<TInt>& aUids,
|
williamr@2
|
192 |
TInt aParentFolderFilter = KFavouritesNullUid,
|
williamr@2
|
193 |
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone,
|
williamr@2
|
194 |
const TDesC* aNameFilter = NULL,
|
williamr@2
|
195 |
TInt32 aContextIdFilter = KFavouritesNullContextId
|
williamr@2
|
196 |
);
|
williamr@2
|
197 |
|
williamr@2
|
198 |
/**
|
williamr@2
|
199 |
* Get preferred Uid for a folder.
|
williamr@2
|
200 |
* @since 0.9
|
williamr@2
|
201 |
* @param aFolder Folder Uid.
|
williamr@2
|
202 |
* @param aPreferredUid Uid of preferred item is returned here.
|
williamr@2
|
203 |
* @return Error code.
|
williamr@2
|
204 |
*/
|
williamr@2
|
205 |
IMPORT_C TInt PreferredUid( TInt aFolder, TInt& aPreferredUid );
|
williamr@2
|
206 |
|
williamr@2
|
207 |
/**
|
williamr@2
|
208 |
* Delete item by Uid. If this is a folder, all descendants and the contents
|
williamr@2
|
209 |
* of them are deleted. Homepage or root cannot be deleted.
|
williamr@2
|
210 |
* @since 0.9
|
williamr@2
|
211 |
* @param aUid Uid of item to delete.
|
williamr@2
|
212 |
* @return Error code, including:
|
williamr@2
|
213 |
* - KErrNotFound if the item is not found.
|
williamr@2
|
214 |
* - KErrAccessDenied if the item's cannot be deleted.
|
williamr@2
|
215 |
*/
|
williamr@2
|
216 |
IMPORT_C TInt Delete( TInt aUid );
|
williamr@2
|
217 |
|
williamr@2
|
218 |
/**
|
williamr@2
|
219 |
* Update an item. Remember Homapage or Last Visited Page cannot be updated using
|
williamr@2
|
220 |
* this method.
|
williamr@2
|
221 |
* @since 0.9
|
williamr@2
|
222 |
* @param aItem Contents from this item (except Uid) will be used to
|
williamr@2
|
223 |
* update the item.
|
williamr@2
|
224 |
* If successful, its Uid, Last-Mod-Time (and possibly its name) is
|
williamr@2
|
225 |
* updated on return.
|
williamr@2
|
226 |
* @param aUid Update this item.
|
williamr@2
|
227 |
* @param aAutoRename If this is ETrue, and the name already exists,
|
williamr@2
|
228 |
* the item will be renamed to a non-conflicting name.
|
williamr@2
|
229 |
* @return Error code, including:
|
williamr@2
|
230 |
* - KErrNotFound if the item is not found.
|
williamr@2
|
231 |
* - KErrArgument if the item's data is invalid (bad name, no URL,
|
williamr@2
|
232 |
* parent folder does not exist etc.).
|
williamr@2
|
233 |
* - KErrAlreadyExists if the name is already in use in that folder.
|
williamr@2
|
234 |
* - KErrAccessDenied for read-only items.
|
williamr@2
|
235 |
*/
|
williamr@2
|
236 |
IMPORT_C TInt Update
|
williamr@2
|
237 |
( CFavouritesItem& aItem, TInt aUid, TBool aAutoRename );
|
williamr@2
|
238 |
|
williamr@2
|
239 |
/**
|
williamr@2
|
240 |
* Add a new item to the database.
|
williamr@2
|
241 |
* If successful, its Uid, Last-Mod-Time (and possibly its name) is
|
williamr@2
|
242 |
* updated on return.
|
williamr@2
|
243 |
* @since 0.9
|
williamr@2
|
244 |
* @param aItem The item to add.
|
williamr@2
|
245 |
* @param aAutoRename If this is ETrue, and the name already exists,
|
williamr@2
|
246 |
* the item will be renamed to a non-conflicting name.
|
williamr@2
|
247 |
* @return Error code, including:
|
williamr@2
|
248 |
* - KErrArgument if the item's data is invalid (bad name, no URL,
|
williamr@2
|
249 |
* parent folder does not exist etc.).
|
williamr@2
|
250 |
* - KErrAlreadyExists if the name is already in use in that folder.
|
williamr@2
|
251 |
*/
|
williamr@2
|
252 |
IMPORT_C TInt Add( CFavouritesItem& aItem, TBool aAutoRename );
|
williamr@2
|
253 |
|
williamr@2
|
254 |
/**
|
williamr@2
|
255 |
* Update the Homepage item. If does not exist, it is now
|
williamr@2
|
256 |
* created. The old Homepage, if any, is overwritten.
|
williamr@2
|
257 |
* If successful, its Uid and Last-Mod-Time is updated on return.
|
williamr@2
|
258 |
* Name needs not be unique.
|
williamr@2
|
259 |
* @since 0.9
|
williamr@2
|
260 |
* @param aItem Contents from this item (except Uid) will
|
williamr@2
|
261 |
* be used to update the Homepage Bookmark.
|
williamr@2
|
262 |
* @return Error code, including:
|
williamr@2
|
263 |
* - KErrArgument if the supplied item is not item, or is not in
|
williamr@2
|
264 |
* the root folder.
|
williamr@2
|
265 |
*/
|
williamr@2
|
266 |
IMPORT_C TInt SetHomepage( CFavouritesItem& aItem );
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/**
|
williamr@2
|
269 |
* Update the Last Visited. If does not exist, it is now
|
williamr@2
|
270 |
* created. The old Last Visited, if any, is overwritten.
|
williamr@2
|
271 |
* If successful, its Uid is updated on return.
|
williamr@2
|
272 |
* Name needs not be unique.
|
williamr@2
|
273 |
* @since 0.9
|
williamr@2
|
274 |
* @param aItem Contents from this item (except Uid) will
|
williamr@2
|
275 |
* be used to update the Last Visited Item.
|
williamr@2
|
276 |
* @return Error code, including:
|
williamr@2
|
277 |
* - KErrArgument if the supplied item is not item, or is not in
|
williamr@2
|
278 |
* the root folder.
|
williamr@2
|
279 |
*/
|
williamr@2
|
280 |
IMPORT_C TInt SetLastVisited( CFavouritesItem& aItem );
|
williamr@2
|
281 |
|
williamr@2
|
282 |
/**
|
williamr@2
|
283 |
* Set factory item flag on an item.
|
williamr@2
|
284 |
* (Item with this flag set will be deleted if RFS is executed.)
|
williamr@2
|
285 |
* @since 0.9
|
williamr@2
|
286 |
* @param aUid Uid of item.
|
williamr@2
|
287 |
* @param aFactoryItem Flag value to set.
|
williamr@2
|
288 |
* @return Error code, including:
|
williamr@2
|
289 |
* - KErrNotFound if the item is not found.
|
williamr@2
|
290 |
*/
|
williamr@2
|
291 |
IMPORT_C TInt SetFactoryItem( TInt aUid, TBool aFactoryItem );
|
williamr@2
|
292 |
|
williamr@2
|
293 |
/**
|
williamr@2
|
294 |
* Set read-only flag on an item.
|
williamr@2
|
295 |
* @since 0.9
|
williamr@2
|
296 |
* @param aUid Uid of item.
|
williamr@2
|
297 |
* @param aReadOnly Flag value to set.
|
williamr@2
|
298 |
* @return Error code, including:
|
williamr@2
|
299 |
* - KErrNotFound if the item is not found.
|
williamr@2
|
300 |
*/
|
williamr@2
|
301 |
IMPORT_C TInt SetReadOnly( TInt aUid, TBool aReadOnly );
|
williamr@2
|
302 |
|
williamr@2
|
303 |
/**
|
williamr@2
|
304 |
* Manual setting of Last Modification Time of an item.
|
williamr@2
|
305 |
* Note that the Last Modification Time is automatically set by any
|
williamr@2
|
306 |
* edit, so this method need not be used in usual circumstances. It is
|
williamr@2
|
307 |
* provided for administration purposes only.
|
williamr@2
|
308 |
* @since 0.9
|
williamr@2
|
309 |
* @param aUid Uid of item.
|
williamr@2
|
310 |
* @param aModified Last Modification Time to set.
|
williamr@2
|
311 |
* @return Error code, including:
|
williamr@2
|
312 |
* - KErrNotFound if the item is not found.
|
williamr@2
|
313 |
*/
|
williamr@2
|
314 |
IMPORT_C TInt SetModified( TInt aUid, TTime aModified );
|
williamr@2
|
315 |
|
williamr@2
|
316 |
/**
|
williamr@2
|
317 |
* Set preferred Uid for a folder.
|
williamr@2
|
318 |
* @since 0.9
|
williamr@2
|
319 |
* @param aFolder Folder Uid.
|
williamr@2
|
320 |
* @param aUid Uid to be set as preferred. Not checked to exist in the folder.
|
williamr@2
|
321 |
* @return Error code, including:
|
williamr@2
|
322 |
* - KErrNotFound if aFolder is not found;
|
williamr@2
|
323 |
* - KErrArgument if aFolder is not a folder.
|
williamr@2
|
324 |
*/
|
williamr@2
|
325 |
IMPORT_C TInt SetPreferredUid( TInt aFolder, TInt aUid );
|
williamr@2
|
326 |
|
williamr@2
|
327 |
/**
|
williamr@2
|
328 |
* Check if we already have this item.
|
williamr@2
|
329 |
* @since 0.9
|
williamr@2
|
330 |
* @param aUid The item Uid to be checked.
|
williamr@2
|
331 |
* @param aItemExists Returned value.
|
williamr@2
|
332 |
* @return Error code.
|
williamr@2
|
333 |
*/
|
williamr@2
|
334 |
IMPORT_C TInt ItemExists( TInt aUid, TBool& aItemExists );
|
williamr@2
|
335 |
|
williamr@2
|
336 |
/**
|
williamr@2
|
337 |
* Check if the folder exists.
|
williamr@2
|
338 |
* @since 0.9
|
williamr@2
|
339 |
* @param aFolder The folder to be checked.
|
williamr@2
|
340 |
* @param aFolderExists Returned value.
|
williamr@2
|
341 |
* @return Error code.
|
williamr@2
|
342 |
*/
|
williamr@2
|
343 |
IMPORT_C TInt FolderExists( TInt aFolder, TBool& aFolderExists );
|
williamr@2
|
344 |
|
williamr@2
|
345 |
/**
|
williamr@2
|
346 |
* Count all items matching the supplied criteria.
|
williamr@2
|
347 |
* @since 0.9
|
williamr@2
|
348 |
* @param aCount Placeholder for the returned item count. In case of
|
williamr@2
|
349 |
* any error, existing value is unchanged.
|
williamr@2
|
350 |
* @param aParentFolderFilter Uid value to filter. KFavouritesNullUid
|
williamr@2
|
351 |
* clears (all accepted); this is the default.
|
williamr@2
|
352 |
* @param aTypeFilter EItem or EFolder to use filter; ENone to clear
|
williamr@2
|
353 |
* filter (all accepted); this is the default.
|
williamr@2
|
354 |
* @param aNameFilter Wildcard pattern to be used for name matching.
|
williamr@2
|
355 |
* NULL clears (all accepted); this is the default.
|
williamr@2
|
356 |
* @param aContextIdFilter ContextId value to filter.
|
williamr@2
|
357 |
* KFavouritesNullContextId clears (all accepted); this is the default.
|
williamr@2
|
358 |
* @return Error code.
|
williamr@2
|
359 |
*/
|
williamr@2
|
360 |
IMPORT_C TInt Count
|
williamr@2
|
361 |
(
|
williamr@2
|
362 |
TInt& aCount,
|
williamr@2
|
363 |
TInt aParentFolderFilter = KFavouritesNullUid,
|
williamr@2
|
364 |
CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone,
|
williamr@2
|
365 |
const TDesC* aNameFilter = NULL,
|
williamr@2
|
366 |
TInt32 aContextIdFilter = KFavouritesNullContextId
|
williamr@2
|
367 |
);
|
williamr@2
|
368 |
|
williamr@2
|
369 |
public: // extra data
|
williamr@2
|
370 |
|
williamr@2
|
371 |
/**
|
williamr@2
|
372 |
* Set data associated with an item. Any existing data, belonging to
|
williamr@2
|
373 |
* item having aUid, is now replaced. The item itself is not changed.
|
williamr@2
|
374 |
* In case of any errors, the data is not saved.
|
williamr@2
|
375 |
* @since 0.9
|
williamr@2
|
376 |
* @param aUid The uid of the item, to which the data belongs.
|
williamr@2
|
377 |
* @param aData Data) which replaces existing data.
|
williamr@2
|
378 |
* @return Error code, including:
|
williamr@2
|
379 |
* - KErrNotFound No item is found with aUid.
|
williamr@2
|
380 |
*/
|
williamr@2
|
381 |
IMPORT_C TInt SetData( TInt aUid, const MFavouritesItemData& aData );
|
williamr@2
|
382 |
|
williamr@2
|
383 |
/**
|
williamr@2
|
384 |
* Get data associated with an item.
|
williamr@2
|
385 |
* @since 0.9
|
williamr@2
|
386 |
* @param aUid The uid of the item, to which the data belongs.
|
williamr@2
|
387 |
* @param aData Data object, which receives the data.
|
williamr@2
|
388 |
* @return Error code, including:
|
williamr@2
|
389 |
* - KErrNotFound No item is found with aUid.
|
williamr@2
|
390 |
*/
|
williamr@2
|
391 |
IMPORT_C TInt GetData( TInt aUid, MFavouritesItemData& aData );
|
williamr@2
|
392 |
|
williamr@2
|
393 |
public: // Browser data
|
williamr@2
|
394 |
|
williamr@2
|
395 |
/**
|
williamr@2
|
396 |
* Set Browser data associated with an item. Any existing data,
|
williamr@2
|
397 |
* belonging to item having aUid, is now replaced. The item itself is
|
williamr@2
|
398 |
* not changed.
|
williamr@2
|
399 |
* This data is for Browser's dedicated use, do not tamper.
|
williamr@2
|
400 |
* In case of any errors, the data is not saved.
|
williamr@2
|
401 |
* @since 0.9
|
williamr@2
|
402 |
* @param aUid The uid of the item, to which the data belongs.
|
williamr@2
|
403 |
* @param aData Data) which replaces existing data.
|
williamr@2
|
404 |
* @return Error code, including:
|
williamr@2
|
405 |
* - KErrNotFound No item is found with aUid.
|
williamr@2
|
406 |
*/
|
williamr@2
|
407 |
IMPORT_C TInt SetBrowserData( TInt aUid, const MFavouritesItemData& aData );
|
williamr@2
|
408 |
|
williamr@2
|
409 |
/**
|
williamr@2
|
410 |
* Get Browser associated with an item.
|
williamr@2
|
411 |
* This data is for Browser's dedicated use, do not tamper.
|
williamr@2
|
412 |
* @since 0.9
|
williamr@2
|
413 |
* @param aUid The uid of the item, to which the data belongs.
|
williamr@2
|
414 |
* @param aData Data object, which receives the data.
|
williamr@2
|
415 |
* @return Error code, including:
|
williamr@2
|
416 |
* - KErrNotFound No item is found with aUid.
|
williamr@2
|
417 |
*/
|
williamr@2
|
418 |
IMPORT_C TInt GetBrowserData( TInt aUid, MFavouritesItemData& aData );
|
williamr@2
|
419 |
|
williamr@2
|
420 |
public: // unique name support
|
williamr@2
|
421 |
|
williamr@2
|
422 |
/**
|
williamr@2
|
423 |
* Check if aName is unique in aFolder; and if not, change to
|
williamr@2
|
424 |
* an unique one, appending a number. In case of any errors, aName is
|
williamr@2
|
425 |
* unchanged. Names of special items (Start Page etc.) are not
|
williamr@2
|
426 |
* considered (can have conflicting names).
|
williamr@2
|
427 |
* @since 0.9
|
williamr@2
|
428 |
* @param aName Descriptor containing the original name and receiving
|
williamr@2
|
429 |
* the resulting unique name. Must be large enough to accomodate the
|
williamr@2
|
430 |
* result. (The appended text is KFavouritesMaxPostfix characters at
|
williamr@2
|
431 |
* most; the resulting length is KFavouritesMaxName at most.)
|
williamr@2
|
432 |
* @param aFolder Folder to be used for uniqueness-checking.
|
williamr@2
|
433 |
* @return Error code, including:
|
williamr@2
|
434 |
* - KErrArgument aFolder is not found.
|
williamr@2
|
435 |
* - KErrBadName aName is empty.
|
williamr@2
|
436 |
*/
|
williamr@2
|
437 |
IMPORT_C TInt MakeUniqueName( TDes& aName, TInt aFolder );
|
williamr@2
|
438 |
|
williamr@2
|
439 |
/**
|
williamr@2
|
440 |
* Check if aName is unique in its folder; and if not, change to
|
williamr@2
|
441 |
* an unique one, appending a number. In case of any errors, aItem is
|
williamr@2
|
442 |
* unchanged. Names of special items (Start Page etc.) are not
|
williamr@2
|
443 |
* considered (can have conflicting names).
|
williamr@2
|
444 |
* @since 0.9
|
williamr@2
|
445 |
* @param aItem Item to set unique name for.
|
williamr@2
|
446 |
* @return Error code, including:
|
williamr@2
|
447 |
* - KErrArgument aFolder is not found.
|
williamr@2
|
448 |
* - KErrBadName Current name is empty.
|
williamr@2
|
449 |
*/
|
williamr@2
|
450 |
IMPORT_C TInt MakeUniqueName( CFavouritesItem& aItem );
|
williamr@2
|
451 |
|
williamr@2
|
452 |
public: // Browser support
|
williamr@2
|
453 |
|
williamr@2
|
454 |
/**
|
williamr@2
|
455 |
* Create an empty item with uid KFavouritesStartPageUid. Owner is the
|
williamr@2
|
456 |
* caller. Except its uid, the item is uninitialized. The Browser
|
williamr@2
|
457 |
* needs this. Note that this item does not exist in the database.
|
williamr@2
|
458 |
* @since 0.9
|
williamr@2
|
459 |
* @return The created item.
|
williamr@2
|
460 |
*/
|
williamr@2
|
461 |
IMPORT_C CFavouritesItem* CreateStartPageItemL();
|
williamr@2
|
462 |
|
williamr@2
|
463 |
/**
|
williamr@2
|
464 |
* Create a folder with uid KFavouritesAdaptiveItemsFolderUid.
|
williamr@2
|
465 |
* Owner is the caller. Uid, type (folder) and parent (root) is set,
|
williamr@2
|
466 |
* other properties are uninitialized. The Browser needs this. Note
|
williamr@2
|
467 |
* that this item does not exist in the database.
|
williamr@2
|
468 |
* @since 0.9
|
williamr@2
|
469 |
* @return The created item.
|
williamr@2
|
470 |
*/
|
williamr@2
|
471 |
IMPORT_C CFavouritesItem* CreateAdaptiveItemsFolderL();
|
williamr@2
|
472 |
|
williamr@2
|
473 |
public: // Files
|
williamr@2
|
474 |
|
williamr@2
|
475 |
/**
|
williamr@2
|
476 |
* Delete file. See RFavouritesFile.
|
williamr@2
|
477 |
* @since 0.9
|
williamr@2
|
478 |
* @param aUid Uid of the item.
|
williamr@2
|
479 |
* @return Errro code.
|
williamr@2
|
480 |
*/
|
williamr@2
|
481 |
IMPORT_C TInt DeleteFile( TInt aUid );
|
williamr@2
|
482 |
|
williamr@2
|
483 |
public: // RFS
|
williamr@2
|
484 |
|
williamr@2
|
485 |
/**
|
williamr@2
|
486 |
* User-level Restore Factory Settings operation.
|
williamr@2
|
487 |
* Delete all items that has "factory item" flag set, then add new
|
williamr@2
|
488 |
* ones from reference database. In case of name conflilcts, new
|
williamr@2
|
489 |
* names are generated. Leaves on any error.
|
williamr@2
|
490 |
* @since 0.9
|
williamr@2
|
491 |
* @param aName Database name.
|
williamr@2
|
492 |
* @param aReferenceDbPath Full pathname of reference database.
|
williamr@2
|
493 |
* @param aApMapper Access Point mapper to be used.
|
williamr@2
|
494 |
*/
|
williamr@2
|
495 |
IMPORT_C static void RestoreFactorySettingsL
|
williamr@2
|
496 |
(
|
williamr@2
|
497 |
const TDesC& aName,
|
williamr@2
|
498 |
const TDesC& aReferenceDbPath,
|
williamr@2
|
499 |
MRfsApMapper& aApMapper
|
williamr@2
|
500 |
);
|
williamr@2
|
501 |
|
williamr@2
|
502 |
private: // New methods
|
williamr@2
|
503 |
|
williamr@2
|
504 |
/**
|
williamr@2
|
505 |
* Set Homepage / Last Visited Page.
|
williamr@2
|
506 |
* @since 0.9
|
williamr@2
|
507 |
* @param aItem Item data.
|
williamr@2
|
508 |
* @param aUid Uid of the item to be set.
|
williamr@2
|
509 |
* @return Error code.
|
williamr@2
|
510 |
*/
|
williamr@2
|
511 |
TInt SetSpecialItem( CFavouritesItem& aItem, TInt aUid );
|
williamr@2
|
512 |
|
williamr@2
|
513 |
/**
|
williamr@2
|
514 |
* Set data associated with an item.
|
williamr@2
|
515 |
* @since 0.9
|
williamr@2
|
516 |
* @param aFunction Function.
|
williamr@2
|
517 |
* @param aUid The uid of the item, to which the data belongs.
|
williamr@2
|
518 |
* @param aData Data which replaces existing data.
|
williamr@2
|
519 |
* @return Error code.
|
williamr@2
|
520 |
*/
|
williamr@2
|
521 |
TInt SetData
|
williamr@2
|
522 |
( TInt aFunction, TInt aUid, const MFavouritesItemData& aData );
|
williamr@2
|
523 |
|
williamr@2
|
524 |
/**
|
williamr@2
|
525 |
* Get data associated with an item.
|
williamr@2
|
526 |
* @since 0.9
|
williamr@2
|
527 |
* @param aFunction Function.
|
williamr@2
|
528 |
* @param aUid The uid of the item, to which the data belongs.
|
williamr@2
|
529 |
* @param aData Data object, which receives the data.
|
williamr@2
|
530 |
* @return Error code.
|
williamr@2
|
531 |
*/
|
williamr@2
|
532 |
TInt GetData
|
williamr@2
|
533 |
( TInt aFunction, TInt aUid, MFavouritesItemData& aData );
|
williamr@2
|
534 |
|
williamr@2
|
535 |
/**
|
williamr@2
|
536 |
* Implementation of RestoreFactorySettingsL().
|
williamr@2
|
537 |
* @since 0.9
|
williamr@2
|
538 |
* @param aReferenceDbPath Full pathname of reference database.
|
williamr@2
|
539 |
* @param aApMapper Access Point mapper to be used.
|
williamr@2
|
540 |
*/
|
williamr@2
|
541 |
void DoRestoreFactorySettingsL
|
williamr@2
|
542 |
( const TDesC& aReferenceDbPath, MRfsApMapper& aApMapper );
|
williamr@2
|
543 |
|
williamr@2
|
544 |
/**
|
williamr@2
|
545 |
* Cleanup helper, static wrapper around the rollback call.
|
williamr@2
|
546 |
* @since 0.9
|
williamr@2
|
547 |
* @param aPtr This as TAny*.
|
williamr@2
|
548 |
*/
|
williamr@2
|
549 |
static void StaticRollback( TAny* aPtr );
|
williamr@2
|
550 |
|
williamr@2
|
551 |
};
|
williamr@2
|
552 |
|
williamr@2
|
553 |
#endif
|
williamr@2
|
554 |
|
williamr@2
|
555 |
// End of File
|