applayerpluginsandutils/bookmarksupport/inc/bookmarkdatabase.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     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 // Class for opening and manipulating the bookmark database.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef __BOOKMARKDATABASE_H__
       
    25 #define __BOOKMARKDATABASE_H__
       
    26 
       
    27 #include <bookmarkdef.h>
       
    28 #include <bookmark.h>
       
    29 
       
    30 class CBookmarkDb;
       
    31 
       
    32 /**
       
    33 Applications can derive from this class in order to receive notifications if the
       
    34 the database changes. The system shares a single bookmark database so it is possible 
       
    35 for another application or service to change the database while you are using it.
       
    36 By registering as an observer, and deriving from MBookmarkObserver, you can be 
       
    37 notified if such an event occurs. 
       
    38 
       
    39 Your view of the database will not be automatically updated. You will need to call
       
    40 RBkDatabase::RefreshL() in order for changes to be updated.
       
    41 
       
    42 @publishedPartner
       
    43 @released
       
    44 */
       
    45 class MBookmarkObserver
       
    46 	{
       
    47 public:
       
    48 	/**
       
    49 	  Bookmark database change notification events.
       
    50 	 */
       
    51 	enum TEvent
       
    52 		{
       
    53 		/**
       
    54 			One or more folders or bookmarks have had their properties modified
       
    55 		 */
       
    56 		EEventUpdatedBookmarkTree,	
       
    57 		/**
       
    58 			One or more database-wide properties has been modified
       
    59 		 */
       
    60 		EEventUpdatedConfig,		
       
    61 		/**
       
    62 			Icon data has been added or modified
       
    63 		 */
       
    64 		EEventUpdatedIcons
       
    65 		};
       
    66 public:
       
    67 	/**
       
    68 	The call-back function that will be called when the database has changed.
       
    69 	
       
    70 	@param aEvent The type of bookmark database change.
       
    71 	@publishedPartner
       
    72 	@released
       
    73 	*/
       
    74 	virtual void MBONotify(TEvent aEvent) = 0;
       
    75 	};
       
    76 
       
    77 
       
    78 
       
    79 /**
       
    80 RBkDatabase represents a handle to the database as a whole. Opening the handle 
       
    81 will initiate a connection to the system-wide bookmark store. RBkDatabase is 
       
    82 responsible for all operations such as creating new bookmarks and folders or changing 
       
    83 database-wide data such as setting the home page or registering custom properties.
       
    84 
       
    85 @publishedPartner
       
    86 @released
       
    87 */
       
    88 class RBkDatabase
       
    89 	{
       
    90 public:
       
    91 	IMPORT_C RBkDatabase();
       
    92 
       
    93 	IMPORT_C void OpenL(Bookmark::TVisibility aVisibility = Bookmark::EVisibilityDefault, MBookmarkObserver* aObserver = NULL);
       
    94 	IMPORT_C void Close();
       
    95 
       
    96 	IMPORT_C void RefreshL();
       
    97 
       
    98 	IMPORT_C void CommitL();
       
    99 
       
   100 	IMPORT_C RBkFolder OpenRootL() const;
       
   101 	
       
   102 	IMPORT_C RBkBookmark CreateBookmarkL(RBkFolder* aParent = NULL);
       
   103 	IMPORT_C RBkFolder CreateFolderL(const TDesC& aTitle, RBkFolder* aParent = NULL);
       
   104 
       
   105 	IMPORT_C void DeleteItemL(Bookmark::TItemId aBookmarkId, TBool aRecursive = EFalse);
       
   106 
       
   107 	IMPORT_C RBkBookmark OpenBookmarkL(Bookmark::TItemId aBookmarkID) const;
       
   108 	IMPORT_C RBkFolder OpenFolderL(Bookmark::TItemId aFolderID) const;
       
   109 	IMPORT_C RBkFolder OpenFolderL(const TDesC& aFolderTitle) const;
       
   110 
       
   111 	IMPORT_C Bookmark::TAttachmentId CreateIconL(const TDesC8& aIconData);
       
   112 	IMPORT_C const TDesC8& GetIconL(Bookmark::TAttachmentId aIconId) const;
       
   113 	IMPORT_C TInt DeleteIconL(Bookmark::TAttachmentId aIconId);
       
   114 
       
   115 	IMPORT_C TVersion Version() const;
       
   116 
       
   117 	IMPORT_C RBkBookmark OpenHomeL() const;
       
   118 
       
   119 	/**
       
   120 	Method for setting the home page bookmark. 
       
   121  
       
   122 	@param aHome Reference to the new home page
       
   123 	@publishedPartner
       
   124 	@deprecated Left in for source compatibility, Use SetHomeL function instead
       
   125 	*/
       
   126 	inline void SetHome(const RBkBookmark& aHome)	
       
   127 		{SetHomeL(aHome);}
       
   128 
       
   129 	IMPORT_C const TDesC& HomePageText() const;
       
   130 	IMPORT_C void SetHomePageTextL(const TDesC& aHomePageText);
       
   131 
       
   132 	IMPORT_C const TDesC8& SearchUri() const;
       
   133 	IMPORT_C void SetSearchUriL(const TDesC8& aUri);
       
   134 
       
   135 	IMPORT_C TUint32 DefaultProxy() const;
       
   136 	IMPORT_C void SetDefaultProxy(TUint32 aServiceId);
       
   137 
       
   138 	IMPORT_C TUint32 DefaultNap() const;
       
   139 	IMPORT_C void SetDefaultNap(TUint32 aNetworkId);
       
   140 
       
   141 	IMPORT_C void RegisterDatabasePropertyL(TUid aCustomId, Bookmark::TPropertyType aDataType);
       
   142 	IMPORT_C void RegisterFolderPropertyL(TUid aCustomId, Bookmark::TPropertyType aDataType);
       
   143 	IMPORT_C void RegisterBookmarkPropertyL(TUid aCustomId, Bookmark::TPropertyType aDataType);
       
   144 
       
   145 	IMPORT_C TInt DeregisterDatabasePropertyL(TUid aCustomId);
       
   146 	IMPORT_C TInt DeregisterFolderPropertyL(TUid aCustomId);
       
   147 	IMPORT_C TInt DeregisterBookmarkPropertyL(TUid aCustomId);
       
   148 
       
   149 	IMPORT_C void GetCustomPropertyL(TUid aPropertyId, TInt& aValue) const;
       
   150 	IMPORT_C void GetCustomPropertyL(TUid aPropertyId, TReal& aValue) const;
       
   151 	IMPORT_C void GetCustomPropertyL(TUid aPropertyId, TDes& aValue) const;
       
   152 	IMPORT_C void GetCustomPropertyL(TUid aPropertyId, TDes8& aValue) const;
       
   153 	IMPORT_C void SetCustomPropertyL(TUid aPropertyId, TInt aValue);
       
   154 	IMPORT_C void SetCustomPropertyL(TUid aPropertyId, TReal aValue);
       
   155 	IMPORT_C void SetCustomPropertyL(TUid aPropertyId, const TDesC& aValue);
       
   156 	IMPORT_C void SetCustomPropertyL(TUid aPropertyId, const TDesC8& aValue);
       
   157 
       
   158 	IMPORT_C void SetHomeL(const RBkBookmark& aHome);
       
   159 private:
       
   160 	CBookmarkDb* iDatabase; // The internal database object that this handle is connected to
       
   161 	};
       
   162 
       
   163 #endif //__BOOKMARKDATABASE_H__