applayerpluginsandutils/bookmarksupport/inc/bookmarkdef.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 // Place holder for common constants, type definitions and enums.
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 #ifndef __BOOKMARKDEF_H__
       
    20 #define __BOOKMARKDEF_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <centralrepository.h>
       
    24 
       
    25 /**
       
    26 The Bookmark namespace contains all the bookmark database specific constants and enums
       
    27 
       
    28 @publishedPartner
       
    29 @released
       
    30 */
       
    31 namespace Bookmark
       
    32 {
       
    33 	/**
       
    34 	Id for bookmarks and folders
       
    35 	*/
       
    36 	typedef TUint32 TItemId;							
       
    37 	/**
       
    38 	Id for bookmark attachments like icons
       
    39 	*/
       
    40 	typedef TUint32 TAttachmentId;
       
    41 	
       
    42 	/**
       
    43 	A NULL value for a bookmark item ID
       
    44 	*/
       
    45 	const TItemId KNullItemID = 0x00000000;
       
    46 	/**
       
    47 	A NULL value for an attachment (icon) ID
       
    48 	*/
       
    49 	const TAttachmentId KNullAttachmentID = 0x00000000;
       
    50 	/**
       
    51 	The title of the root folder
       
    52 	*/
       
    53 	_LIT(KTxtRootTitle, "Root");
       
    54 	/**
       
    55 	The root folder's ID
       
    56 	*/
       
    57 	const TItemId KRootItemID = 0xffffffff;
       
    58 
       
    59 	/**
       
    60 	The maximum length of a 16 bit desciptor for a bookmark property
       
    61 	*/
       
    62 	const TInt KMaxDescriptorLength = NCentralRepositoryConstants::KMaxUnicodeStringLength;	
       
    63 	/**
       
    64 	The maximum length of a 8 bit desciptor for a bookmark property
       
    65 	*/
       
    66 	const TInt KMaxDataLength = NCentralRepositoryConstants::KMaxBinaryLength;
       
    67 	/**
       
    68 	The maximum length of a bookmark URI
       
    69 	*/
       
    70 	const TInt KMaxUriLength = NCentralRepositoryConstants::KMaxBinaryLength;
       
    71 	/**
       
    72 	The maximum number of bookmark entries available in the database
       
    73 	*/
       
    74 	const TInt KMaxBookmarkEntries = 0xFFFFFF;
       
    75 	/**
       
    76 	The maximum depth that folders can be placed under folders
       
    77 	*/
       
    78 	const TInt KMaxFolderDepth = 1024;
       
    79 	/**
       
    80 	The maximum number of custom properties that can be registered
       
    81 	*/
       
    82 	const TInt KMaxCustomProperties = 255;
       
    83 	/**
       
    84 	A bookmark's owner ID will be set to this if it has no owner
       
    85 	*/
       
    86 	_LIT_SECURE_ID(KNoOwnerId,0x00000000);		
       
    87 
       
    88 	/**
       
    89 	A bookmark item will always be either a bookmark or a folder. The TType enum is used
       
    90 	to identify which.
       
    91 	*/
       
    92 	enum TType
       
    93 		{
       
    94 		/** 
       
    95 		The item is a folder
       
    96 		*/
       
    97 		ETypeFolder,
       
    98 		/** 
       
    99 		The item is a bookmark			
       
   100 		*/
       
   101 		ETypeBookmark			
       
   102 		};
       
   103 
       
   104 	/**
       
   105 	The TVisibility enum is used to specify which bookmarks will be seen by the client opening the
       
   106 	bookmark database
       
   107 	*/
       
   108 	enum TVisibility
       
   109 		{
       
   110 		/**
       
   111 		Open as All
       
   112 		@deprecated Deprecated in 9.1
       
   113 		*/				
       
   114 		EVisibilityDefault,
       
   115 		/**
       
   116 		View only public items
       
   117 		*/
       
   118 		EVisibilityPublic,
       
   119 		/**
       
   120 		View only items owned by the application
       
   121 		*/
       
   122 		EVisibilityPrivate,
       
   123 		/**
       
   124 		View public items and private items owned by the application
       
   125 		*/
       
   126 		EVisibilityAll,
       
   127 		/**
       
   128 		View all items regardless of owner - requires WriteUserData
       
   129 		*/
       
   130 		EVisibilityManager
       
   131 		};
       
   132 
       
   133 	/**
       
   134 	The TPropertyType is used when registering custom properties. Custom properties must be of one of
       
   135 	these types
       
   136 	bookmark database
       
   137 	*/
       
   138 	enum TPropertyType
       
   139 		{
       
   140 		/**
       
   141 		The property is an int
       
   142 		*/
       
   143 		EDataTypeInt,
       
   144 		/**
       
   145 		The property is an floating point number
       
   146 		*/
       
   147 		EDataTypeReal,
       
   148 		/**
       
   149 		The property is a 16 bit descriptor
       
   150 		*/
       
   151 		EDataTypeDes16,
       
   152 		/**
       
   153 		The property is a 8 bit descriptor
       
   154 		*/
       
   155 		EDataTypeDes8
       
   156 		};
       
   157 
       
   158 	/**
       
   159 	Error codes error numbers -7150 to -7199 have been reserved for the bookmark database
       
   160 	*/
       
   161 	static const TInt KErrorBase 			= -7150;
       
   162 	/**
       
   163 	The version number in the repository does not match the bookmark database version number
       
   164 	*/
       
   165 	static const TInt KErrBadVersion		= KErrorBase;
       
   166 	/**
       
   167 	The item is of the wrong type. A folder item is given where a bookmark item is required or visa versa
       
   168 	*/
       
   169 	static const TInt KErrWrongType			= KErrorBase - 1;
       
   170 	/** 
       
   171 	Not all handles have been closed. A database object has been opened and has not been closed.
       
   172 	*/
       
   173 	static const TInt KErrOpenHandle		= KErrorBase - 2;
       
   174 	/**
       
   175 	The handle has not been opened. The handle is not attached to any bookmark object
       
   176 	*/
       
   177 	static const TInt KErrNotOpen			= KErrorBase - 3;
       
   178 	/**
       
   179 	The bookmark item is read only and can not be modified.
       
   180 	*/
       
   181 	static const TInt KErrReadOnly			= KErrorBase - 4;
       
   182 	/**
       
   183 	An attempt has been made to set the parent of an item to an item it owns lower in the tree. This invalidate the tree structure.
       
   184 	*/
       
   185 	static const TInt KErrCyclicLoop		= KErrorBase - 5;
       
   186 	/**
       
   187 	The central database store is either locked or unaccessable at this time. You may want to try again later.
       
   188 	*/
       
   189 	static const TInt KErrDatabaseLocked	= KErrorBase - 6;
       
   190 	/**
       
   191 	The database has no more space for new bookmark entries
       
   192 	*/
       
   193 	static const TInt KErrNoMoreSpace		= KErrorBase - 7;
       
   194 	/**
       
   195 	The database is in a corrupt state
       
   196 	*/
       
   197 	static const TInt KErrCorrupt			= KErrorBase - 8;
       
   198 	/**
       
   199 	A custom property with the given UID has not been reistered
       
   200 	*/
       
   201 	static const TInt KErrNotRegistered		= KErrorBase - 9;
       
   202 	/**
       
   203 	The an attempt was made to register a property using a UID that has already been used
       
   204 	*/
       
   205 	static const TInt KErrUidAlreadyUsed	= KErrorBase - 10;
       
   206 	/**
       
   207 	An orphaned item is one that is currently in the root folder due to its normal parent not being loaded
       
   208 	This usually occurs when folders are private but some of the bookmarks it contains are public
       
   209 	Some operations (such as changing the rank or order of an item) can not be performed on an orphaned object
       
   210 	*/
       
   211 	static const TInt KErrOrphanedItem		= KErrorBase - 11;
       
   212 	/**
       
   213 	An attempt has been made to create a folder with a title that already exists
       
   214 	*/
       
   215 	static const TInt KErrTitleAlreadyUsed	= KErrorBase - 12;
       
   216 	/**
       
   217 	The operation is not allowed. (Like trying to delete the root folder)
       
   218 	*/
       
   219 	static const TInt KErrOperationDenied	= KErrorBase - 13;
       
   220 	/**
       
   221 	The operation can not be completed until the item has been committed to the database (e.g. setting the owner ID)
       
   222 	*/
       
   223 	static const TInt KErrNotCommitted		= KErrorBase - 14;
       
   224 
       
   225 	// Panic text
       
   226 	_LIT(KBookmarkErrNullPointer, 		"Pointer not null");
       
   227 	_LIT(KBookmarkErrNegativeRefCount, 	"Ref count zero");
       
   228 	_LIT(KBookmarkErrOpenHandles, 		"Handle(s) open");
       
   229 	_LIT(KBookmarkErrWrongType, 		"Wrong item type");
       
   230 	_LIT(KBookmarkErrHandleNotOpen,		"Handle not open");
       
   231 	_LIT(KBookmarkErrNoParent,			"No parent");
       
   232 	_LIT(KBookmarkErrParent,			"Invalid parent");
       
   233 	_LIT(KBookmarkErrCorrupt,			"Corrupt database");
       
   234 	_LIT(KBookmarkErrTooLong,			"Length too long");
       
   235 }
       
   236 
       
   237 #endif // __BOOKMARKDEF_H__