messagingfw/msgsrvnstore/server/inc/MSVSTD.H
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 1998-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 // MSVSTD.H
       
    15 //
       
    16 /**
       
    17  * @file 
       
    18  * @publishedAll
       
    19  * @released
       
    20  */
       
    21 #ifndef __MSVSTD_H__
       
    22 #define __MSVSTD_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <s32file.h>
       
    26 #include <msvstd.hrh>
       
    27 
       
    28 /**
       
    29 Specifies an entry in the Message Server index.
       
    30 @publishedAll
       
    31 @released
       
    32 @see #KMsvNullIndexEntryId
       
    33 @see #KMsvTempIndexEntryId
       
    34 @see #KMsvRootIndexEntryId
       
    35 @see #KMsvLocalServiceIndexEntryId
       
    36 @see #KMsvGlobalInBoxIndexEntryId
       
    37 @see #KMsvGlobalOutBoxIndexEntryId
       
    38 @see #KMsvDraftEntryId
       
    39 @see #KMsvSentEntryId
       
    40 @see #KMsvDeletedEntryFolderEntryId
       
    41 @see #KMsvUnknownServiceIndexEntryId
       
    42 */
       
    43 typedef TInt32 TMsvId;
       
    44 
       
    45 /** Identifies an asynchronous messaging operation. 
       
    46 
       
    47 This ID is unique within a 
       
    48 Message Server session. The ID of an operation can be obtained from CMsvOperation::Id(). */
       
    49 typedef TInt32 TMsvOp;
       
    50 
       
    51 /** Supplies the standard values for the message priority index entry field. 
       
    52 @publishedAll
       
    53 @released
       
    54 */
       
    55 enum TMsvPriority {	
       
    56 	/** High message priority */
       
    57 					EMsvHighPriority,
       
    58 	/** Medium message priority */
       
    59 					EMsvMediumPriority,
       
    60 	/** Low message priority */
       
    61 					EMsvLowPriority};	
       
    62 
       
    63 class CRichText;
       
    64 class CMsvStore;
       
    65 class CMsvEntry;
       
    66 class CMsvMove;
       
    67 class CMsvServer;
       
    68 class CMsvServerEntry;
       
    69 
       
    70 _LIT(KMsvDefaultFolder, "\\Private\\1000484b\\Mail\\");
       
    71 _LIT(KMsvDefaultIndexFile, "\\Private\\1000484b\\Mail\\Index");
       
    72 _LIT(KMsvDefaultFolder2, "\\Private\\1000484b\\Mail2\\");
       
    73 _LIT(KMsvDefaultIndexFile2, "\\Private\\1000484b\\Mail2\\Index");
       
    74 _LIT(KMsvDirectoryExt, "_S\\");
       
    75 _LIT(KMsvBinaryFolderExt, "_F\\");
       
    76 
       
    77 const TInt KFileNameFixedWidth=8;
       
    78 const TInt KMaxSubjectSkipStringLength=8; // For subject based email thread sorting
       
    79 _LIT(KSendAsRenderedImage, "Image");
       
    80 
       
    81 // Server name and moving semaphore
       
    82 _LIT(KMsvServerName, "!MsvServer");
       
    83 _LIT(KMsvMovingSemaphore, "MsvMovingSemaphore");
       
    84 
       
    85 _LIT_SECURE_ID(KMsvServerId, 0x1000484B);
       
    86 
       
    87 
       
    88 /** Represents an entry in the Message Server index.
       
    89 
       
    90 MTM implementations and message client applications use it to access and manipulate 
       
    91 index entry values. Note that a TMsvEntry is effectively a local cache of 
       
    92 the index entry, and changes to it are not automatically written into the 
       
    93 index. To commit changes to the Message Server, you need to call CMsvEntry::ChangeL() 
       
    94 (or CMsvServerEntry::ChangeEntry()).
       
    95 
       
    96 To avoid repetition, the functions and data members are simply listed here, 
       
    97 without detailed explanation of the fields. The public data members can be 
       
    98 used to get and set the values of some index entry fields. 
       
    99 @publishedAll
       
   100 @released
       
   101 */
       
   102 class TMsvEntry
       
   103 	{
       
   104 public: 
       
   105 	IMPORT_C TMsvEntry(); 
       
   106 	IMPORT_C TMsvEntry(const TMsvEntry& aEntry);
       
   107 	IMPORT_C TMsvEntry& operator=(const TMsvEntry& aEntry);
       
   108 	IMPORT_C TBool operator==(const TMsvEntry& aEntry) const;
       
   109 	IMPORT_C TBool PermanentDataUnchanged(const TMsvEntry& aEntry) const;
       
   110 	//
       
   111 	IMPORT_C TMsvPriority Priority() const;
       
   112 	IMPORT_C void SetPriority(TMsvPriority aPriority);
       
   113 	// 
       
   114 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   115 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   116 	// Read only for clients
       
   117 	inline TMsvId Id() const;
       
   118 	inline TMsvId Parent() const;
       
   119 	inline TBool Owner() const;
       
   120 	inline TBool Deleted() const;
       
   121 	// Read & write for clients
       
   122 	inline TBool Complete() const;
       
   123 	inline void SetComplete(TBool aComplete);
       
   124 	inline TBool New() const;
       
   125 	inline void SetNew(TBool aNew);
       
   126 	inline TBool Unread() const;
       
   127 	inline void SetUnread(TBool aUnread);
       
   128 	inline TBool Failed() const;
       
   129 	inline void SetFailed(TBool aFailed);
       
   130 	inline TBool Operation() const;
       
   131 	inline void SetOperation(TBool aOperation);
       
   132 	inline TBool Visible() const;
       
   133 	inline void SetVisible(TBool aVisble);
       
   134 	inline TBool MultipleRecipients() const;
       
   135 	inline void SetMultipleRecipients(TBool aMultipleRecipient);
       
   136 	inline TBool ReadOnly() const;
       
   137 	inline void SetReadOnly(TBool aReadOnly);
       
   138 	inline TBool StandardFolder() const;
       
   139 	inline void SetStandardFolder(TBool aStanardFolder);
       
   140 	inline TBool Attachment() const;
       
   141 	inline void SetAttachment(TBool aAttachmentFlag);
       
   142 	inline TBool Connected() const;
       
   143 	inline void SetConnected(TBool aConnected);
       
   144 	inline TBool InPreparation() const;
       
   145 	inline void SetInPreparation(TBool aInPreparation);
       
   146 	//
       
   147 	inline TInt PcSyncCount() const;
       
   148 	inline void DecPcSyncCount();
       
   149 	inline void IncPcSyncCount();
       
   150 	//
       
   151 	inline TBool OffPeak() const;
       
   152 	inline void SetOffPeak(TBool aOffPeak);
       
   153 	inline TBool Scheduled() const;
       
   154 	inline void SetScheduled(TBool aScheduled);
       
   155 	inline TUint SendingState() const;
       
   156 	inline void SetSendingState(TUint aSendingState);
       
   157 	inline TBool PendingDelete() const;
       
   158 	inline void SetPendingDelete(TBool aPendingDelete);
       
   159 	
       
   160 	/** This method sets bit 24 of iMtmData1, if you are using this bit elsewhere don't call this method.*/
       
   161 	inline void SetDeleteProtected(TBool aDeleteProtected);
       
   162 	inline TBool DeleteProtected() const;
       
   163 	/** This method sets bit 31 of iMtmData1, if you are using this bit elsewhere don't call this method.*/
       
   164 	inline void SetForwarded(TBool aForwarded);
       
   165 	inline TBool Forwarded() const;
       
   166 	/** This method sets bit 32 of iMtmData1, if you are using this bit elsewhere don't call this method.*/
       
   167 	inline void SetLocallyDeleted(TBool aLocallyDeleted);
       
   168 	inline TBool LocallyDeleted() const;
       
   169 	inline void SetVisibleFolderFlag(TBool aReadOnly);
       
   170 	inline TBool VisibleFolderFlag() const;
       
   171 	
       
   172 	IMPORT_C TBool PendingConditions() const;
       
   173 	IMPORT_C void SetPendingConditions(TBool aPendingConditions);
       
   174 	//
       
   175 	IMPORT_C TInt32 MtmData1() const;
       
   176 	IMPORT_C TInt32 MtmData2() const;
       
   177 	IMPORT_C TInt32 MtmData3() const;
       
   178 
       
   179 	IMPORT_C void SetMtmData1(TInt32 aMtmData);
       
   180 	IMPORT_C void SetMtmData2(TInt32 aMtmData);
       
   181 	IMPORT_C void SetMtmData3(TInt32 aMtmData);
       
   182 	//
       
   183 protected:
       
   184 	// only the server will be able to set the following
       
   185 	inline void SetId(TMsvId aId);
       
   186 	inline void SetParent(TMsvId aId);
       
   187 	inline void SetOwner(TBool aAttachment);
       
   188 	inline void SetDeleted(TBool aDeletedFlag);
       
   189 	//
       
   190 	inline TUint PersistedFlags() const;
       
   191 	inline TUint TemporaryFlags() const;
       
   192 	//
       
   193 private:
       
   194 	void Copy(const TMsvEntry& aEntry);
       
   195 	//
       
   196 private:
       
   197 	TMsvId iId;
       
   198 	TMsvId iParentId;  
       
   199 	TInt32 iData;         
       
   200 	TInt32 iPcSyncCount;
       
   201 	TInt32 iReserved; // reserved for future proofing
       
   202 public: 
       
   203 	/** Service ID. */
       
   204 	TMsvId iServiceId; 
       
   205 	/** Related folder ID. */
       
   206 	TMsvId iRelatedId; 
       
   207 	/** Entry type */
       
   208 	TUid   iType;        
       
   209 	/** MTM */
       
   210 	TUid   iMtm;     
       
   211 	/** Time */
       
   212 	TTime  iDate;       
       
   213 	/** Size */
       
   214 	TInt32 iSize;      
       
   215 	/** Error */
       
   216 	TInt32 iError;
       
   217 	/** BIO message type */
       
   218 	TInt32 iBioType;
       
   219 	// following three can be used by MTM
       
   220 	/** MTM data 1: this can be used for any purpose by an MTM. This member must 
       
   221 	only be accessed through the predefined set and get functions. If you must 
       
   222 	write data to a bit that has no meaning in the predefined derived classes 
       
   223 	then you must derive your own class from TMsvEntry.
       
   224 	*/
       
   225 	TInt32 iMtmData1; 
       
   226 	/** MTM data 2: this can be used for any purpose by an MTM. This member must 
       
   227 	only be accessed through the predefined set and get functions. If you must 
       
   228 	write data to a bit that has no meaning in the predefined derived classes 
       
   229 	then you must derive your own class from TMsvEntry.
       
   230 	*/
       
   231 	TInt32 iMtmData2; 
       
   232 	/** MTM data 3: this can be used for any purpose by an MTM. This member must 
       
   233 	only be accessed through the predefined set and get functions. If you must 
       
   234 	write data to a bit that has no meaning in the predefined derived classes 
       
   235 	then you must derive your own class from TMsvEntry.
       
   236 	*/
       
   237 	TInt32 iMtmData3; 
       
   238 public:
       
   239 	// The TPtrC must be kept at end of class to simplify comparisons and initialisation
       
   240 	/** Description */
       
   241 	TPtrC iDescription;
       
   242 	/** Details */
       
   243 	TPtrC iDetails;    
       
   244 	//
       
   245 	//
       
   246 private:
       
   247 	//
       
   248 	
       
   249 
       
   250 friend class CMsvEntry;
       
   251 friend class CMsvServer;
       
   252 friend class CMsvServerEntry;
       
   253 friend class CMsvClientEntry;
       
   254 friend class CMsvServerSession;
       
   255 friend class TMsvServerEntry; 
       
   256 friend class CMsvServerIndex;
       
   257 friend class RMsvServerSession;
       
   258 friend class CMsvLocalCopyOperation;
       
   259 friend class CMsvMove;
       
   260 friend class CMsvIndexRebuild;
       
   261 friend class CMsvCopyEntry;
       
   262 friend class CMsvDelete;
       
   263 friend class CMsvIndexContext;
       
   264 friend class CMsvEntryArray;
       
   265 friend class CMsvIndexAdapter;
       
   266 friend class CMsvDBAdapter;
       
   267 friend class TSearchSortDbWrapper;
       
   268 
       
   269 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
       
   270 friend class CTestIndexAdapter;
       
   271 friend class CTestDbAdapter;
       
   272 friend class CTestVisibleFolder;
       
   273 friend class CTestIndexTableEntry;
       
   274 friend class CTestEntryFreePool;
       
   275 friend class CTestIndexContext;
       
   276 friend class CTestMsvServer;
       
   277 friend class CTestMsvEntry;
       
   278 friend class CTestSearchSortCacheEntry;
       
   279 friend class CTestSearchSortCacheManager;
       
   280 friend class CTestSearchSortDeltaCache;
       
   281 friend class CTestSearchSortOperation;
       
   282 friend class CTestSearchSortDBadapter;
       
   283 friend class CTestSearchSortCacheManager;
       
   284 friend class CTestSearchSortDeltaCache;
       
   285 friend class CTestHeaderSearchSortOperation;
       
   286 friend class CTestHeaderEntry;
       
   287 #endif
       
   288 
       
   289 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
       
   290 	friend class CMsvVersion0Version1Converter;
       
   291 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
       
   292 	friend class CTestConverterDBAdapter;
       
   293 #endif
       
   294 #endif
       
   295 private:
       
   296 	//
       
   297 enum {	KMsvEntryPriorityMask=			0x00000003,
       
   298 		KMsvEntryHighPriority=			0x00000002,
       
   299 		KMsvEntryMediumPriority=		0x00000001,
       
   300 		KMsvEntryLowPriority=			0x00000000,
       
   301 		KMsvEntryClearFlag=				0x00000000,
       
   302 		KMsvOffPeakFlag=				0x00000004,
       
   303 		KMsvEntryNotCompleteFlag=		0x00000008,
       
   304 		KMsvEntryNewFlag=				0x00000010,
       
   305 		KMsvEntryUnreadFlag=			0x00000020,
       
   306 		KMsvEntryFailedFlag=			0x00000040,
       
   307 		KMsvEntryOperationFlag=			0x00000080,
       
   308 		KMsvEntryOwnerFlag=				0x00000100,
       
   309 		KMsvEntryInvisibleFlag=			0x00000200,
       
   310 		KMsvEntryMultipleRecipientFlag=	0x00000400,
       
   311 		KMsvScheduledFlag=				0x00000800,
       
   312 		KMsvEntryReadOnlyFlag=			0x00001000,
       
   313 		KMsvEntryDeletedFlag=			0x00002000,
       
   314 		KMsvEntryStandardFolderFlag=	0x00004000,
       
   315 		KMsvEntryAttachmentFlag=		0x00008000,
       
   316 		KMsvEntryInPreparationFlag=		0x00010000,
       
   317 		KMsvSendingStateFlags=			0x001E0000, // Note: Sending state is shifted KMsvSendingStateShift places left
       
   318 		KMsvEntryPersistedFlags=		0x00FFFFFF,
       
   319 		KMsvEntryPendingConditionsFlag=	0x00800000,		
       
   320 		KMsvEntryTemporaryFlags=		0xFF000000,
       
   321 		KMsvEntryConnectedFlag=			0x01000000,
       
   322 		KMsvEntryPendingDeleteFlag=		0x02000000,
       
   323 	    KMsvVisibleFolderNodeFlag=      0x04000000
       
   324 	   };
       
   325 	   
       
   326 	};
       
   327 enum 
       
   328 	{
       
   329 		KMsvEntryDeleteProtected=		0x800000,
       
   330 		KMsvEntryForwarded=				0x40000000,
       
   331 		KMsvEntryLocallyDeleted=		0x80000000
       
   332 	};
       
   333 
       
   334 const TUint KMsvSendingStateShift=0x11; // Places to shift sending state
       
   335 
       
   336 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT)
       
   337 	const TInt KDriveMask = 0x0fffffff;
       
   338 	const TInt KCurrentDriveId = 1;
       
   339 #endif
       
   340 
       
   341 /** Defines sending state flags. 
       
   342 @publishedAll
       
   343 @released
       
   344 */
       
   345 enum TMsvSendState
       
   346 	{
       
   347 	/** State unknown. */
       
   348 	KMsvSendStateUnknown		= 0x0,
       
   349 	/** Message will be sent on request. */
       
   350 	KMsvSendStateUponRequest	= 0x1,
       
   351 	/** Waiting to be sent.
       
   352 	
       
   353 	Messages in the outbox with this state can be sent automatically by the relevant 
       
   354 	MTM once an appropriate connection is established. */
       
   355 	KMsvSendStateWaiting		= 0x2,
       
   356 	/** Sending in progress. */
       
   357 	KMsvSendStateSending		= 0x3,
       
   358 	/** Sending scheduled. */
       
   359 	KMsvSendStateScheduled		= 0x4,
       
   360 	/** Resending. */
       
   361 	KMsvSendStateResend			= 0x5,
       
   362 	/** Sending suspended. */
       
   363 	KMsvSendStateSuspended		= 0x6,
       
   364 	/** Sending failed. */
       
   365 	KMsvSendStateFailed			= 0x7,
       
   366 	/** Sending complete. */
       
   367 	KMsvSendStateSent			= 0x8,
       
   368 	/** Not applicable. */
       
   369 	KMsvSendStateNotApplicable	= 0x9
       
   370 	};
       
   371 
       
   372 const TUint KMsvSendStateLast = KMsvSendStateNotApplicable;
       
   373 const TUint KMsvSendStateMax = 0x0F;
       
   374 // Message Database Version.
       
   375 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
       
   376 const TUint KCurrentDatabaseVersion = 2;
       
   377 #else
       
   378 const TUint KCurrentDatabaseVersion = 1;
       
   379 #endif
       
   380 
       
   381 /** Supplies values for bitmasks that allows the rapid setting or clearing of a 
       
   382 number of TMsvEntry fields.
       
   383 
       
   384 The fields that can be manipulated are:
       
   385 
       
   386 1. PC synchronisation
       
   387 
       
   388 2. Visibility flag
       
   389 
       
   390 3. Read flag
       
   391 
       
   392 4. In-preparation flag
       
   393 
       
   394 5. Connected flag
       
   395 
       
   396 6. Pending deletion flag.
       
   397 
       
   398 7. New flag
       
   399 
       
   400 @see TMsvEntry
       
   401 @see CMsvSession::ChangeAttributesL()
       
   402 @see CMsvServerEntry::ChangeAttributes() 
       
   403 @publishedAll
       
   404 @released
       
   405 */
       
   406 enum TMsvAttribute    { 
       
   407 	/** PC synchronisation field. */
       
   408 						KMsvPcSyncCountAttribute	=0x00000001,
       
   409 	/** Visibility flag field. */
       
   410 						KMsvVisibilityAttribute		=0x00000200,
       
   411 	/** Read flag field. */
       
   412 						KMsvUnreadAttribute			=0x00000020,
       
   413 	/** In-preparation field. */
       
   414 						KMsvInPreparationAttribute	=0x00010000,
       
   415 	/** Connected flag field. */
       
   416 						KMsvConnectedAttribute		=0x01000000,
       
   417 	/** Pending deletion flag. */
       
   418 						KMsvPendingDeleteAttribute	=0x02000000,
       
   419 	/** New flag field. */
       
   420 						KMsvNewAttribute			=0x00000010};
       
   421 
       
   422 /** Defines the sort order options for a TMsvSelectionOrdering object. Options 
       
   423 are set through TMsvSelectionOrdering::SetSorting().
       
   424 
       
   425 @see TMsvSelectionOrdering 
       
   426 @publishedAll
       
   427 @released
       
   428 */
       
   429 enum TMsvSorting 
       
   430 	{
       
   431 	/** Don't sort */
       
   432 	EMsvSortByNone=0,				// Don't sort
       
   433 	/** Date (earliest-latest) */
       
   434 	EMsvSortByDate,					// Date (earliest-latest)
       
   435 	/** Date (latest-earliest) */
       
   436 	EMsvSortByDateReverse,			// Date (latest-earliest)
       
   437 	/** Size (smallest-largest) */
       
   438 	EMsvSortBySize,					// Size (smallest-largest)
       
   439 	/** Size (largest-smallest) */
       
   440 	EMsvSortBySizeReverse,			// Size (largest-smallest)
       
   441 	/** To/From (A-Z folded) */
       
   442 	EMsvSortByDetails,				// ToFrom (A-Z collated)
       
   443 	/** To/From (Z-A folded) */
       
   444 	EMsvSortByDetailsReverse,		// ToFrom (Z-A collated)
       
   445 	/** Description (A-Z folded) */
       
   446 	EMsvSortByDescription,			// Description (A-Z collated)
       
   447 	/** Description (Z-A folded) */
       
   448 	EMsvSortByDescriptionReverse,	// Description (Z-A collated)
       
   449 	/** Sort by message ID. */
       
   450 	EMsvSortById,			        // Id (lowest-highest)
       
   451 	/** Sort in reverse order by message ID. */
       
   452 	EMsvSortByIdReverse	            // Id (highest-lowest)
       
   453 	};
       
   454 
       
   455 /** Defines grouping order options for a TMsvEntrySelection object. Grouping options 
       
   456 can be combined in a bitmask and set through the TMsvEntrySelection constructor 
       
   457 @publishedAll
       
   458 @released
       
   459 */
       
   460 enum TMsvGrouping
       
   461 	{
       
   462 	/** No grouping */
       
   463 	KMsvNoGrouping=0,				// No grouping
       
   464 	/** Group by entry type, in order, services, folders, messages, attachments */
       
   465 	KMsvGroupByType=0x2,			// Folder, Message, Attachment
       
   466 	/** Place standard folders first, in the order they were created */
       
   467 	KMsvGroupByStandardFolders=0x6,	// Standrad folders first (must have sorting by type set aswell)
       
   468 	/** Group by message priority, in order, high, medium, then low */
       
   469 	KMsvGroupByPriority=0x8,		// High, Mediem, Low
       
   470 	/** Group by MTM, either in the order set by CMsvEntry::SetMtmListL() or by MTM 
       
   471 	Uid value */
       
   472 	KMsvGroupByMtm=0x10,			// By increasing uid value
       
   473 	};
       
   474 
       
   475 /** Defines the sorting and grouping rules used to prepare a selection of entries.
       
   476  
       
   477 It is used in the interfaces of CMsvEntry and CMsvServerEntry to set the ordering 
       
   478 of an entry's children.
       
   479 
       
   480 Firstly, the entries will be grouped, if the appropriate grouping option is 
       
   481 set, by:
       
   482 
       
   483 1. Standard folders: any entries marked as standard folders are placed first, 
       
   484 in the order they were created.
       
   485 
       
   486 2. Entry type: in the order services, folders, messages, attachments, unknown
       
   487 
       
   488 3. Priority: in the order high, medium, then low
       
   489 
       
   490 4. MTM: either in the MTM order set by CMsvEntry::SetMtmListL() or just in MTM 
       
   491 Uid value
       
   492 
       
   493 Grouping options are simply Boolean flags that can be set on or off by functions 
       
   494 of this class.
       
   495 
       
   496 Secondly, the order of entries within these groups is defined by a sorting 
       
   497 order option.
       
   498 
       
   499 @see CMsvEntry
       
   500 @see CMsvServerEntry 
       
   501 @publishedAll
       
   502 @released
       
   503 */
       
   504 class TMsvSelectionOrdering
       
   505 	{
       
   506 public:
       
   507 	IMPORT_C TMsvSelectionOrdering();
       
   508 	IMPORT_C TMsvSelectionOrdering(TInt aGroupingKey, TMsvSorting aSorting, TBool aShowInvisible=EFalse);
       
   509 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   510 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   511 	IMPORT_C TBool operator==(const TMsvSelectionOrdering& aOrdering) const;
       
   512 	IMPORT_C void SetSubjectSkipString(const TDesC& aSubjectSkipString);
       
   513 	IMPORT_C const TDesC& SubjectSkipString() const;
       
   514 
       
   515 	//
       
   516 	inline TMsvSorting Sorting() const;
       
   517 	inline TBool GroupByType() const;
       
   518 	inline TBool GroupStandardFolders() const;
       
   519 	inline TBool GroupByPriority() const;
       
   520 	inline TBool GroupByMtm() const;
       
   521 	inline TBool ShowInvisibleEntries() const;
       
   522 	inline TBool GroupingOn() const;
       
   523 	// 
       
   524 	inline void SetGroupByType(TBool aFlag);
       
   525 	inline void SetGroupStandardFolders(TBool aFlag);
       
   526 	inline void SetGroupByPriority(TBool aFlag);
       
   527 	inline void SetGroupByMtm(TBool aFlag);
       
   528 	inline void SetShowInvisibleEntries(TBool aFlag);
       
   529 	inline void SetSorting(TMsvSorting aSortType);
       
   530 
       
   531 	//
       
   532 	//
       
   533 private:
       
   534 
       
   535 	enum TMsvGroupingPrivate
       
   536 		{
       
   537 		KMsvInvisibleFlag=0x1,
       
   538 		KMsvStandardFolders=0x4,
       
   539 		KMsvAllGroupingFlags=0x1e
       
   540 		};
       
   541 	TInt iGrouping;
       
   542 	TMsvSorting iSortType;
       
   543  	TBuf<KMaxSubjectSkipStringLength>	iSubjectSkipString;
       
   544 	};
       
   545 
       
   546 const TInt KMsvInvisibleFlag=1;
       
   547 
       
   548 /** Encapsulates an array of entry IDs. 
       
   549 
       
   550 An object of this type is commonly passed to a function to indicate the set 
       
   551 of entries on which the function should operate. The array base class (CArrayFixFlat<TMsvId>) 
       
   552 provide methods to access, sort, and manipulate members of the array.
       
   553  
       
   554 @publishedAll
       
   555 @released
       
   556 */
       
   557 class CMsvEntrySelection : public CArrayFixFlat<TMsvId>
       
   558 	{ 
       
   559 public: 
       
   560 	IMPORT_C CMsvEntrySelection();
       
   561 	IMPORT_C CMsvEntrySelection* CopyL()  const;
       
   562 	IMPORT_C CMsvEntrySelection* CopyLC() const;
       
   563 	IMPORT_C TInt Find(TMsvId aId) const;
       
   564 	};
       
   565 
       
   566 /** Specifies a default service for a MTM.
       
   567 
       
   568 @publishedAll
       
   569 @released
       
   570 */
       
   571 class TMsvDefaultService
       
   572 	{
       
   573 public:
       
   574 	/** MTM for which the default service is specified. */
       
   575 	TUid iMtm;
       
   576 	/** ID of the default service. */
       
   577 	TMsvId iService;
       
   578 	};
       
   579 
       
   580 
       
   581 
       
   582 /** Used to query the Message Server for entries that match the specification defined 
       
   583 in the filter. 
       
   584 
       
   585 It allows a query to be performed on service, MTM, type and last change date. 
       
   586 The filter also enables the specification of the order in which the entries 
       
   587 are returned. 
       
   588 
       
   589 @see CMsvSession::GetChildIdsL() 
       
   590 @publishedAll
       
   591 @released
       
   592 */
       
   593 class CMsvEntryFilter : public CBase
       
   594 	{
       
   595 public:
       
   596 	IMPORT_C static CMsvEntryFilter* NewLC();
       
   597 	IMPORT_C static CMsvEntryFilter* NewL();
       
   598 	//
       
   599 public:
       
   600 	inline TMsvId Service() const;
       
   601 	inline void SetService(TMsvId aServiceId);
       
   602 	//
       
   603 	inline TUid Mtm() const;
       
   604 	inline void SetMtm(TUid aMtm);
       
   605 	//
       
   606 	inline TUid Type() const;
       
   607 	inline void SetType(TUid aType);
       
   608 	//
       
   609 	inline const TTime& LastChangeDate() const;
       
   610 	inline void SetLastChangeDate(const TTime& aLastChange);
       
   611 	//
       
   612 	inline const TMsvSelectionOrdering& Order() const;
       
   613 	inline void SetOrder(const TMsvSelectionOrdering& aOrder);
       
   614 	//
       
   615 	inline TUid SortMtm() const;
       
   616 	inline void SetSortMtm(TUid aSortMtm);
       
   617 	//
       
   618 private:
       
   619 	CMsvEntryFilter();
       
   620 	//
       
   621 private:
       
   622 	TMsvId iServiceId;
       
   623 	TUid iMtm;
       
   624 	TUid iType;
       
   625 	TTime iLastChange;
       
   626 	TMsvSelectionOrdering iOrdering;
       
   627 	TUid iSortMtm;
       
   628 	};
       
   629 
       
   630 // Error resolver leave codes -7000 to -7127
       
   631 /** Defines error codes that relate to the Message Server.
       
   632 
       
   633 @see MMsvEntryObserver::EMsvContextInvalid 
       
   634 @publishedAll
       
   635 @released
       
   636 */
       
   637 enum TMsvResolverLeave
       
   638 	{
       
   639 	/** There is no disk in the drive containing the Message Server index. */
       
   640 	KMsvMediaUnavailable = -7000,
       
   641 	/** There is a disk in the drive containing the Message Server index, but it is 
       
   642 	the wrong one. */
       
   643 	KMsvMediaIncorrect = -7001,
       
   644 	/** A CMsvEntry context is no longer valid because the location of the Message Server's 
       
   645 	index has changed.
       
   646 	
       
   647 	Such contexts will need refreshing by the client.
       
   648 	
       
   649 	@see MMsvEntryObserver::EMsvContextInvalid */
       
   650 	KMsvMediaChanged = -7002,
       
   651 	KMsvIndexBackup      = -7003,
       
   652 	KMsvIndexRestore     = -7004
       
   653 	};
       
   654 
       
   655 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
       
   656 
       
   657 enum EFieldType
       
   658 /**
       
   659 Allowed field types.
       
   660 This class is also used at the server side.
       
   661  
       
   662 @publishedAll
       
   663 @released
       
   664 */
       
   665 	{
       
   666 	EIntegerField,
       
   667 	ETextField,
       
   668 	EDateField
       
   669 	};
       
   670 
       
   671 
       
   672 
       
   673 // Common class used by both client and server.
       
   674 class CFieldPair: public CBase
       
   675 /**
       
   676 Allowed field types.
       
   677 This class is also used at the server side.
       
   678  
       
   679 @publishedAll
       
   680 @released
       
   681 */
       
   682 	{
       
   683 public:
       
   684 	~CFieldPair()
       
   685 		{
       
   686 		if(iFieldName)
       
   687 			{
       
   688 			delete iFieldName;
       
   689 			}
       
   690 		if(iFieldTextValue)
       
   691 			{
       
   692 			delete iFieldTextValue;
       
   693 			}
       
   694 		}
       
   695 	HBufC* iFieldName;			// Column name
       
   696 	EFieldType iFieldType;		// Column type
       
   697 	TInt64 iFieldNumValue;		// Column value in number
       
   698 	HBufC* iFieldTextValue;		// Column value in text
       
   699 	};
       
   700 	
       
   701 
       
   702 
       
   703 class CHeaderFields: public CBase
       
   704 	{
       
   705 public:
       
   706 	~CHeaderFields()
       
   707 		{
       
   708 		iFieldPairList.ResetAndDestroy();
       
   709 		}
       
   710 	RPointerArray<CFieldPair> iFieldPairList;
       
   711 	TUid iUid;
       
   712 	};
       
   713 	
       
   714 
       
   715 /*
       
   716 // Used for CMsvEntry::ReadDBStoreL() and CMsvEntry::ReadDBStoreL()
       
   717 // Used for CMsvServerEntry::ReadDBStoreL() and CMsvServerEntry::ReadDBStoreL()
       
   718 
       
   719 @publishedAll
       
   720 @released
       
   721 */
       
   722 
       
   723 enum TEntryStoreType
       
   724 	{
       
   725 	EHeaderEntry,
       
   726 	EBodyEntry,
       
   727 	EUnknownEntry,
       
   728 	EHeaderAndBodyEntry		
       
   729 	};
       
   730 
       
   731 
       
   732 #endif 				// #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
       
   733 
       
   734 /**
       
   735 Temporary ID used for testing purpose
       
   736 @publishedAll
       
   737 @released
       
   738 @see TMsvId
       
   739 @see KMsvTempIndexEntryIdValue
       
   740 */
       
   741 const TMsvId KMsvTempIndexEntryId = KMsvTempIndexEntryIdValue;//1
       
   742 
       
   743 /**
       
   744 @publishedAll
       
   745 @released
       
   746 @see TMsvId
       
   747 */
       
   748 const TMsvId KFirstFreeEntryId=0x100000;
       
   749 		
       
   750 
       
   751 #include <msvstd.inl>
       
   752 
       
   753 #endif