|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <bookmarkdatabase.h> |
|
17 #include "bkmrkdb.h" |
|
18 #include "bkmrk.h" |
|
19 #include "bkmrkfolder.h" |
|
20 #include "propertyreg.h" |
|
21 |
|
22 /** |
|
23 RBkDatabase constructor |
|
24 @publishedPartner |
|
25 @released |
|
26 */ |
|
27 EXPORT_C RBkDatabase::RBkDatabase() : iDatabase(NULL) |
|
28 { |
|
29 } |
|
30 |
|
31 /** |
|
32 Creates the bookmark database object and tries to connect to the repository. The client can |
|
33 register an observer if it wants to be notitied of external changes to the database. |
|
34 |
|
35 @param aVisibility The visibility condition under which the database should be opened |
|
36 @param aObserver Pointer to an observer that will be notified of changes to the database |
|
37 @publishedPartner |
|
38 @released |
|
39 */ |
|
40 EXPORT_C void RBkDatabase::OpenL(Bookmark::TVisibility aVisibility, MBookmarkObserver* aObserver) |
|
41 { |
|
42 if (iDatabase) |
|
43 { |
|
44 // the database is already open so do nothing |
|
45 return; |
|
46 } |
|
47 iDatabase = CBookmarkDb::NewL(aVisibility, aObserver); |
|
48 } |
|
49 |
|
50 /** |
|
51 Closes the connection to the repository and frees all resources. Does not commit changes |
|
52 so you must call CommitL() if you want to save before calling Close(). |
|
53 |
|
54 @publishedPartner |
|
55 @released |
|
56 */ |
|
57 EXPORT_C void RBkDatabase::Close() |
|
58 { |
|
59 delete iDatabase; |
|
60 iDatabase = NULL; |
|
61 } |
|
62 |
|
63 /** |
|
64 Refreshes the bookmark tree. Ususally called in response to a notification that |
|
65 the database has been changed from an external source. |
|
66 |
|
67 @publishedPartner |
|
68 @released |
|
69 */ |
|
70 EXPORT_C void RBkDatabase::RefreshL() |
|
71 { |
|
72 // The handle must be open and attached to a concrete bookmark object |
|
73 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
74 |
|
75 iDatabase->RefreshL(); |
|
76 } |
|
77 |
|
78 /** |
|
79 Runs through the folder tree and commits any changes. Also commits any changes to icons, |
|
80 registered custom properties and database-wide data. |
|
81 |
|
82 The central repository, which the bookmark database uses, provides no locking mechanism. |
|
83 Concurrent accesses are simply queued. Although this should cause no problems it is worth |
|
84 remembering if you find any timing and commiting issues. |
|
85 |
|
86 @publishedPartner |
|
87 @released |
|
88 */ |
|
89 EXPORT_C void RBkDatabase::CommitL() |
|
90 { |
|
91 // The handle must be open and attached to a concrete bookmark object |
|
92 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
93 |
|
94 iDatabase->CommitL(); |
|
95 } |
|
96 |
|
97 /** |
|
98 Retrieves the root folder and constructs the internal folder and bookmark tree if it doesn't |
|
99 yet exist. Only includes folders and bookmarks that are visible to this application. |
|
100 |
|
101 @return An open handle to the root folder. |
|
102 @publishedPartner |
|
103 @released |
|
104 */ |
|
105 EXPORT_C RBkFolder RBkDatabase::OpenRootL() const |
|
106 { |
|
107 // The handle must be open and attached to a concrete bookmark object |
|
108 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
109 |
|
110 return iDatabase->RootL().OpenFolder(); |
|
111 } |
|
112 |
|
113 /** |
|
114 Creates a new bookmark. If a parent folder is supplied then it is added to this folder. |
|
115 If no parent is supplied then it is placed in the root. The newly created bookmark item is |
|
116 writable. The new bookmark will be permanently added to the database once there is a call |
|
117 to CommitL(). |
|
118 |
|
119 @param aParent The new bookmark will be placed in this folder. The bookmark will be placed in the root is this is NULL. |
|
120 @return An open handle to the created bookmark. This is pushed to cleanup stack. |
|
121 @publishedPartner |
|
122 @released |
|
123 */ |
|
124 EXPORT_C RBkBookmark RBkDatabase::CreateBookmarkL(RBkFolder* aParent) |
|
125 { |
|
126 // The handle must be open and attached to a concrete bookmark object |
|
127 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
128 |
|
129 CBookmarkFolder* parent = NULL; |
|
130 if (aParent) |
|
131 { |
|
132 parent = aParent->Folder(); |
|
133 } |
|
134 else |
|
135 { |
|
136 parent = &(iDatabase->RootL()); |
|
137 } |
|
138 return iDatabase->CreateBookmarkL(*parent).OpenBookmark(); |
|
139 } |
|
140 |
|
141 /** |
|
142 Creates a new folder. If a parent folder is supplied then it is added to this folder. |
|
143 If no parent is supplied then it is placed in the root. The newly created bookmark item is |
|
144 writable. The new folder will be permanently added to the database once there is a call |
|
145 to CommitL(); |
|
146 |
|
147 @param aTitle Title text for the folder. Each folder's title text must be unique |
|
148 @param aParent The new folder will be placed in this folder. The folder will be placed in the root is this is NULL. |
|
149 @return An open handle to the created folder. This is pushed to cleanup stack. |
|
150 @publishedPartner |
|
151 @released |
|
152 */ |
|
153 EXPORT_C RBkFolder RBkDatabase::CreateFolderL(const TDesC& aTitle, RBkFolder* aParent) |
|
154 { |
|
155 // The handle must be open and attached to a concrete bookmark object |
|
156 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
157 |
|
158 CBookmarkFolder* parent = NULL; |
|
159 if (aParent) |
|
160 { |
|
161 parent = aParent->Folder(); |
|
162 } |
|
163 else |
|
164 { |
|
165 parent = &(iDatabase->RootL()); |
|
166 } |
|
167 return iDatabase->CreateFolderL(aTitle, *parent).OpenFolder(); |
|
168 } |
|
169 |
|
170 |
|
171 /** |
|
172 Deletes a bookmark item. If the item is a folder and aRecursive is false, |
|
173 all its children are set to the root folder. If aRecursive is true all child |
|
174 bookmarks and folders are also deleted. |
|
175 |
|
176 @param aBookmarkId Id of the bookmark item |
|
177 @param aRecursive Set to ETrue to delete all child bookmarks and subfolders |
|
178 @return An error if the item to be deleted is read only |
|
179 @publishedPartner |
|
180 @released |
|
181 */ |
|
182 EXPORT_C void RBkDatabase::DeleteItemL(Bookmark::TItemId aBookmarkId, TBool aRecursive) |
|
183 { |
|
184 // The handle must be open and attached to a concrete bookmark object |
|
185 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
186 |
|
187 iDatabase->ConstructTreeL(); |
|
188 iDatabase->DeleteItemL(aBookmarkId, aRecursive); |
|
189 } |
|
190 |
|
191 /** |
|
192 Finds a bookmark given a bookmark Id. Leaves if the item can not be found |
|
193 |
|
194 @param aBookmarkID Id of the bookmark item |
|
195 @return An open handle to the found bookmark. |
|
196 @publishedPartner |
|
197 @released |
|
198 */ |
|
199 EXPORT_C RBkBookmark RBkDatabase::OpenBookmarkL(Bookmark::TItemId aBookmarkID) const |
|
200 { |
|
201 // The handle must be open and attached to a concrete bookmark object |
|
202 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
203 |
|
204 iDatabase->ConstructTreeL(); |
|
205 CBookmarkBase* item = iDatabase->FindItem(aBookmarkID); |
|
206 if (!item || item->Type() != Bookmark::ETypeBookmark) |
|
207 { |
|
208 User::Leave(KErrNotFound); |
|
209 } |
|
210 |
|
211 RBkNode handle = item->OpenItemL(); |
|
212 CleanupClosePushL(handle); |
|
213 RBkBookmark bookmark; |
|
214 bookmark = handle.OpenBookmarkL(); |
|
215 CleanupStack::PopAndDestroy(&handle); |
|
216 |
|
217 return bookmark; |
|
218 } |
|
219 |
|
220 /** |
|
221 Finds a folder given a folder Id. Leaves if the item can not be found |
|
222 |
|
223 @param aFolderID Id of the folder item |
|
224 @return An open handle to the found folder. |
|
225 @publishedPartner |
|
226 @released |
|
227 */ |
|
228 EXPORT_C RBkFolder RBkDatabase::OpenFolderL(Bookmark::TItemId aFolderID) const |
|
229 { |
|
230 // The handle must be open and attached to a concrete bookmark object |
|
231 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
232 |
|
233 iDatabase->ConstructTreeL(); |
|
234 CBookmarkBase* item = iDatabase->FindItem(aFolderID); |
|
235 if (!item || item->Type() != Bookmark::ETypeFolder) |
|
236 { |
|
237 User::Leave(KErrNotFound); |
|
238 } |
|
239 |
|
240 RBkNode handle = item->OpenItemL(); |
|
241 CleanupClosePushL(handle); |
|
242 RBkFolder folder; |
|
243 folder = handle.OpenFolderL(); |
|
244 CleanupStack::PopAndDestroy(&handle); |
|
245 |
|
246 return folder; |
|
247 } |
|
248 |
|
249 /** |
|
250 Finds a folder with the given title text. Leaves if the item can not be found |
|
251 |
|
252 @param aFolderTitle Title text to find |
|
253 @return An open handle to the found folder. |
|
254 @publishedPartner |
|
255 @released |
|
256 */ |
|
257 EXPORT_C RBkFolder RBkDatabase::OpenFolderL(const TDesC& aFolderTitle) const |
|
258 { |
|
259 // The handle must be open and attached to a concrete bookmark object |
|
260 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
261 |
|
262 iDatabase->ConstructTreeL(); |
|
263 CBookmarkFolder* folder = iDatabase->FindFolder(aFolderTitle); |
|
264 if (!folder) |
|
265 { |
|
266 User::Leave(KErrNotFound); |
|
267 } |
|
268 |
|
269 return folder->OpenFolder(); |
|
270 } |
|
271 |
|
272 /** |
|
273 Creates a new icon and adds it to the database's icon list. The database retains ownership of |
|
274 the icon and the new item's ID is returned. |
|
275 |
|
276 @param aIconData Descriptor containing the icon's raw data |
|
277 @return The new icon's Id. |
|
278 @publishedPartner |
|
279 @released |
|
280 */ |
|
281 EXPORT_C Bookmark::TAttachmentId RBkDatabase::CreateIconL(const TDesC8& aIconData) |
|
282 { |
|
283 // The handle must be open and attached to a concrete bookmark object |
|
284 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
285 |
|
286 return iDatabase->CreateIconL(aIconData); |
|
287 } |
|
288 |
|
289 /** |
|
290 Gets the icon with the given icon Id. |
|
291 |
|
292 @param aIconId Id of the icon to find. |
|
293 @return A reference to a descriptor containing the icon's raw data |
|
294 @publishedPartner |
|
295 @released |
|
296 */ |
|
297 EXPORT_C const TDesC8& RBkDatabase::GetIconL(Bookmark::TAttachmentId aIconId) const |
|
298 { |
|
299 // The handle must be open and attached to a concrete bookmark object |
|
300 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
301 |
|
302 return iDatabase->IconL(aIconId); |
|
303 } |
|
304 |
|
305 /** |
|
306 Deletes an icon with the given icon Id. |
|
307 |
|
308 @param aIconId Id of the icon to delete. |
|
309 @return An error if the icon id can't be found. |
|
310 @publishedPartner |
|
311 @released |
|
312 */ |
|
313 EXPORT_C TInt RBkDatabase::DeleteIconL(Bookmark::TAttachmentId aIconId) |
|
314 { |
|
315 // The handle must be open and attached to a concrete bookmark object |
|
316 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
317 |
|
318 return iDatabase->DeleteIconL(aIconId); |
|
319 } |
|
320 |
|
321 /** |
|
322 Gets the database version number |
|
323 |
|
324 @return The version number. |
|
325 @publishedPartner |
|
326 @released |
|
327 */ |
|
328 EXPORT_C TVersion RBkDatabase::Version() const |
|
329 { |
|
330 // The handle must be open and attached to a concrete bookmark object |
|
331 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
332 |
|
333 return iDatabase->Version(); |
|
334 } |
|
335 |
|
336 /** |
|
337 Method for getting the home page bookmark. Leaves if no home page has been set. |
|
338 |
|
339 @return An open handle to the home page bookmark |
|
340 @publishedPartner |
|
341 @released |
|
342 */ |
|
343 EXPORT_C RBkBookmark RBkDatabase::OpenHomeL() const |
|
344 { |
|
345 // The handle must be open and attached to a concrete bookmark object |
|
346 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
347 |
|
348 iDatabase->ConstructTreeL(); |
|
349 CBookmark* home = iDatabase->Home(); |
|
350 if (!home) |
|
351 { |
|
352 User::Leave(KErrNotFound); |
|
353 } |
|
354 |
|
355 return home->OpenBookmark(); |
|
356 } |
|
357 |
|
358 /** |
|
359 Method for setting the home page bookmark. |
|
360 |
|
361 @param aHome Reference to the new home page |
|
362 @publishedPartner |
|
363 @released |
|
364 */ |
|
365 EXPORT_C void RBkDatabase::SetHomeL(const RBkBookmark& aHome) |
|
366 { |
|
367 // The handle must be open and attached to a concrete bookmark object |
|
368 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
369 |
|
370 iDatabase->ConstructTreeL(); |
|
371 CBookmark* home = aHome.Bookmark(); |
|
372 iDatabase->SetHome(home); |
|
373 } |
|
374 |
|
375 /** |
|
376 Method for getting the home page text. |
|
377 |
|
378 @return Descriptor containing the text |
|
379 @publishedPartner |
|
380 @released |
|
381 */ |
|
382 EXPORT_C const TDesC& RBkDatabase::HomePageText() const |
|
383 { |
|
384 // The handle must be open and attached to a concrete bookmark object |
|
385 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
386 |
|
387 return iDatabase->HomePageText(); |
|
388 } |
|
389 |
|
390 /** |
|
391 Method for setting the home page text. |
|
392 |
|
393 @param aHomePageText Descriptor containing the new text |
|
394 @publishedPartner |
|
395 @released |
|
396 */ |
|
397 EXPORT_C void RBkDatabase::SetHomePageTextL(const TDesC& aHomePageText) |
|
398 { |
|
399 // The handle must be open and attached to a concrete bookmark object |
|
400 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
401 |
|
402 iDatabase->SetHomePageTextL(aHomePageText); |
|
403 } |
|
404 |
|
405 /** |
|
406 Method for getting the search page Uri. |
|
407 |
|
408 @return Descriptor containing the Uri. |
|
409 @publishedPartner |
|
410 @released |
|
411 */ |
|
412 EXPORT_C const TDesC8& RBkDatabase::SearchUri() const |
|
413 { |
|
414 // The handle must be open and attached to a concrete bookmark object |
|
415 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
416 |
|
417 return iDatabase->SearchUri(); |
|
418 } |
|
419 /** |
|
420 Method for setting the search page Uri. |
|
421 |
|
422 @param aUri Descriptor containing the new Uri. |
|
423 @publishedPartner |
|
424 @released |
|
425 */ |
|
426 EXPORT_C void RBkDatabase::SetSearchUriL(const TDesC8& aUri) |
|
427 { |
|
428 // The handle must be open and attached to a concrete bookmark object |
|
429 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
430 |
|
431 iDatabase->SetSearchUriL(aUri); |
|
432 } |
|
433 |
|
434 /** |
|
435 Method for getting the default proxy. |
|
436 |
|
437 @return Id for identifying the proxy entry in the commdb |
|
438 @publishedPartner |
|
439 @released |
|
440 */ |
|
441 EXPORT_C TUint32 RBkDatabase::DefaultProxy() const |
|
442 { |
|
443 // The handle must be open and attached to a concrete bookmark object |
|
444 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
445 |
|
446 return iDatabase->DefaultProxy(); |
|
447 } |
|
448 |
|
449 /** |
|
450 Method for setting the default proxy. |
|
451 |
|
452 @param aServiceId Id for identifying the proxy entry in the commdb |
|
453 @publishedPartner |
|
454 @released |
|
455 */ |
|
456 EXPORT_C void RBkDatabase::SetDefaultProxy(TUint32 aServiceId) |
|
457 { |
|
458 // The handle must be open and attached to a concrete bookmark object |
|
459 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
460 |
|
461 iDatabase->SetDefaultProxy(aServiceId); |
|
462 } |
|
463 |
|
464 /** |
|
465 Method for getting the default nap. |
|
466 |
|
467 @return Id for identifying the nap entry in the commdb |
|
468 @publishedPartner |
|
469 @released |
|
470 */ |
|
471 EXPORT_C TUint32 RBkDatabase::DefaultNap() const |
|
472 { |
|
473 // The handle must be open and attached to a concrete bookmark object |
|
474 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
475 |
|
476 return iDatabase->DefaultNap(); |
|
477 } |
|
478 |
|
479 /** |
|
480 Method for setting the default nap. |
|
481 |
|
482 @param aNetworkId Id for identifying the nap entry in the commdb |
|
483 @publishedPartner |
|
484 @released |
|
485 */ |
|
486 EXPORT_C void RBkDatabase::SetDefaultNap(TUint32 aNetworkId) |
|
487 { |
|
488 // The handle must be open and attached to a concrete bookmark object |
|
489 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
490 |
|
491 iDatabase->SetDefaultNap(aNetworkId); |
|
492 } |
|
493 |
|
494 /** |
|
495 Method for registering a custom database property |
|
496 |
|
497 @param aCustomId Unique identifier to assign for this property. |
|
498 @param aDataType The type of data this property will contain. |
|
499 @publishedPartner |
|
500 @released |
|
501 */ |
|
502 EXPORT_C void RBkDatabase::RegisterDatabasePropertyL(TUid aCustomId, Bookmark::TPropertyType aDataType) |
|
503 { |
|
504 // The handle must be open and attached to a concrete bookmark object |
|
505 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
506 |
|
507 iDatabase->CreateDefaultRepositoriesL (); |
|
508 iDatabase->PropertyRegister().RegisterPropertyL(CPropertyReg::EGroupDatabase, aCustomId, aDataType); |
|
509 } |
|
510 |
|
511 /** |
|
512 Method for registering a custom folder property |
|
513 |
|
514 @param aCustomId Unique identifier to assign for this property. |
|
515 @param aDataType The type of data this property will contain. |
|
516 @publishedPartner |
|
517 @released |
|
518 */ |
|
519 EXPORT_C void RBkDatabase::RegisterFolderPropertyL(TUid aCustomId, Bookmark::TPropertyType aDataType) |
|
520 { |
|
521 // The handle must be open and attached to a concrete bookmark object |
|
522 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
523 |
|
524 iDatabase->CreateDefaultRepositoriesL (); |
|
525 iDatabase->PropertyRegister().RegisterPropertyL(CPropertyReg::EGroupFolder, aCustomId, aDataType); |
|
526 } |
|
527 |
|
528 /** |
|
529 Method for registering a custom bookmark property |
|
530 |
|
531 @param aCustomId Unique identifier to assign for this property. |
|
532 @param aDataType The type of data this property will contain. |
|
533 @publishedPartner |
|
534 @released |
|
535 */ |
|
536 EXPORT_C void RBkDatabase::RegisterBookmarkPropertyL(TUid aCustomId, Bookmark::TPropertyType aDataType) |
|
537 { |
|
538 iDatabase->CreateDefaultRepositoriesL (); |
|
539 iDatabase->PropertyRegister().RegisterPropertyL(CPropertyReg::EGroupBookmark, aCustomId, aDataType); |
|
540 } |
|
541 |
|
542 /** |
|
543 Method for deregistering a custom database property |
|
544 |
|
545 @param aCustomId The identifier of the property. |
|
546 @return An error if a property with this aCustomId does not exist |
|
547 @publishedPartner |
|
548 @released |
|
549 */ |
|
550 EXPORT_C TInt RBkDatabase::DeregisterDatabasePropertyL(TUid aCustomId) |
|
551 { |
|
552 // The handle must be open and attached to a concrete bookmark object |
|
553 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
554 |
|
555 return iDatabase->PropertyRegister().DeregisterPropertyL(CPropertyReg::EGroupDatabase, aCustomId); |
|
556 } |
|
557 |
|
558 /** |
|
559 Method for deregistering a custom folder property |
|
560 |
|
561 @param aCustomId The identifier of the property. |
|
562 @return An error if a property with this aCustomId does not exist |
|
563 @publishedPartner |
|
564 @released |
|
565 */ |
|
566 EXPORT_C TInt RBkDatabase::DeregisterFolderPropertyL(TUid aCustomId) |
|
567 { |
|
568 // The handle must be open and attached to a concrete bookmark object |
|
569 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
570 |
|
571 return iDatabase->PropertyRegister().DeregisterPropertyL(CPropertyReg::EGroupFolder, aCustomId); |
|
572 } |
|
573 |
|
574 /** |
|
575 Method for deregistering a custom bookmark property |
|
576 |
|
577 @param aCustomId The identifier of the property. |
|
578 @return An error if a property with this aCustomId does not exist |
|
579 @publishedPartner |
|
580 @released |
|
581 */ |
|
582 EXPORT_C TInt RBkDatabase::DeregisterBookmarkPropertyL(TUid aCustomId) |
|
583 { |
|
584 // The handle must be open and attached to a concrete bookmark object |
|
585 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
586 |
|
587 return iDatabase->PropertyRegister().DeregisterPropertyL(CPropertyReg::EGroupBookmark, aCustomId); |
|
588 } |
|
589 |
|
590 /** |
|
591 Gets a custom database property for the given property ID. |
|
592 |
|
593 @param aPropertyId The ID of the property you wish to get |
|
594 @param aValue An integer that will hold the data value |
|
595 @publishedPartner |
|
596 @released |
|
597 */ |
|
598 EXPORT_C void RBkDatabase::GetCustomPropertyL(TUid aPropertyId, TInt& aValue) const |
|
599 { |
|
600 // The handle must be open and attached to a concrete bookmark object |
|
601 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
602 |
|
603 User::LeaveIfError(iDatabase->CustomProperties().GetCustomProperty(aPropertyId, aValue)); |
|
604 } |
|
605 |
|
606 /** |
|
607 Gets a custom database property for the given property ID. |
|
608 |
|
609 @param aPropertyId The ID of the property you wish to get |
|
610 @param aValue A floating point that will hold the data value |
|
611 @publishedPartner |
|
612 @released |
|
613 */ |
|
614 EXPORT_C void RBkDatabase::GetCustomPropertyL(TUid aPropertyId, TReal& aValue) const |
|
615 { |
|
616 // The handle must be open and at != NULL, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
617 |
|
618 User::LeaveIfError(iDatabase->CustomProperties().GetCustomProperty(aPropertyId, aValue)); |
|
619 } |
|
620 |
|
621 /** |
|
622 Gets a custom database property for the given property ID. |
|
623 |
|
624 @param aPropertyId The ID of the property you wish to get |
|
625 @param aValue A 16 bit descriptor that will hold the data value |
|
626 @publishedPartner |
|
627 @released |
|
628 */ |
|
629 EXPORT_C void RBkDatabase::GetCustomPropertyL(TUid aPropertyId, TDes& aValue) const |
|
630 { |
|
631 // The handle must be open and attached to a concrete bookmark object |
|
632 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
633 |
|
634 User::LeaveIfError(iDatabase->CustomProperties().GetCustomProperty(aPropertyId, aValue)); |
|
635 } |
|
636 |
|
637 /** |
|
638 Gets a custom database property for the given property ID. |
|
639 |
|
640 @param aPropertyId The ID of the property you wish to get |
|
641 @param aValue An 8 bit descriptor that will hold the data value |
|
642 @publishedPartner |
|
643 @released |
|
644 */ |
|
645 EXPORT_C void RBkDatabase::GetCustomPropertyL(TUid aPropertyId, TDes8& aValue) const |
|
646 { |
|
647 // The handle must be open and attached to a concrete bookmark object |
|
648 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
649 |
|
650 User::LeaveIfError(iDatabase->CustomProperties().GetCustomProperty(aPropertyId, aValue)); |
|
651 } |
|
652 |
|
653 /** |
|
654 Assigns a new custom database property value to the bookmark item. |
|
655 |
|
656 @param aPropertyId The ID of the property you wish to set |
|
657 @param aValue An integer data value |
|
658 @publishedPartner |
|
659 @released |
|
660 */ |
|
661 EXPORT_C void RBkDatabase::SetCustomPropertyL(TUid aPropertyId, TInt aValue) |
|
662 { |
|
663 // The handle must be open and attached to a concrete bookmark object |
|
664 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
665 |
|
666 iDatabase->CustomProperties().SetCustomPropertyL(aPropertyId, aValue); |
|
667 iDatabase->SetDirty(); |
|
668 } |
|
669 |
|
670 /** |
|
671 Assigns a new custom database property value to the bookmark item. |
|
672 |
|
673 @param aPropertyId The ID of the property you wish to set |
|
674 @param aValue A floating point data value |
|
675 @publishedPartner |
|
676 @released |
|
677 */ |
|
678 EXPORT_C void RBkDatabase::SetCustomPropertyL(TUid aPropertyId, TReal aValue) __SOFTFP |
|
679 { |
|
680 // The handle must be open and attached to a concrete bookmark object |
|
681 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
682 |
|
683 iDatabase->CustomProperties().SetCustomPropertyL(aPropertyId, aValue); |
|
684 iDatabase->SetDirty(); |
|
685 } |
|
686 |
|
687 /** |
|
688 Assigns a new custom database property value to the bookmark item. |
|
689 |
|
690 @param aPropertyId The ID of the property you wish to set |
|
691 @param aValue A 16 bit descriptor |
|
692 @publishedPartner |
|
693 @released |
|
694 */ |
|
695 EXPORT_C void RBkDatabase::SetCustomPropertyL(TUid aPropertyId, const TDesC& aValue) |
|
696 { |
|
697 // The handle must be open and attached to a concrete bookmark object |
|
698 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
699 |
|
700 iDatabase->CustomProperties().SetCustomPropertyL(aPropertyId, aValue); |
|
701 iDatabase->SetDirty(); |
|
702 } |
|
703 |
|
704 /** |
|
705 Assigns a new custom database property value to the bookmark item. |
|
706 |
|
707 @param aPropertyId The ID of the property you wish to set |
|
708 @param aValue An 8 bit descriptor |
|
709 @publishedPartner |
|
710 @released |
|
711 */ |
|
712 EXPORT_C void RBkDatabase::SetCustomPropertyL(TUid aPropertyId, const TDesC8& aValue) |
|
713 { |
|
714 // The handle must be open and attached to a concrete bookmark object |
|
715 __ASSERT_ALWAYS(iDatabase, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen)); |
|
716 |
|
717 iDatabase->CustomProperties().SetCustomPropertyL(aPropertyId, aValue); |
|
718 iDatabase->SetDirty(); |
|
719 } |