epoc32/include/cemailaccounts.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 2004-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __CEMAILACCOUNTS_H__
    17 #define __CEMAILACCOUNTS_H__
    18 
    19 
    20 #include <e32std.h>
    21 #include <e32base.h>
    22 #include <msvapi.h>
    23 
    24 
    25 class CImIAPPreferences;
    26 class CImPop3Settings;
    27 class CImImap4Settings;
    28 class CImSmtpSettings;
    29 class CRepository;
    30 class CImapSyncDownloadRules;
    31 class CImapTransportBufferSizes;
    32 class CImSmtpMobilitySettings;
    33 
    34 /**
    35 Maximum size of email account name
    36 
    37 @publishedAll
    38 @released
    39 */
    40 const TInt KEmailAccountNameSize = 256;
    41 
    42 /**
    43 Maximum number of entries allowed in the IAP list for a SMTP mobility account
    44 
    45 @publishedPartner
    46 @released
    47 */
    48 const TInt KMaxSmtpMobilityAccountIAPListEntries = 32;
    49 
    50 /**
    51 Identifier number for a POP email account.
    52 
    53 @publishedAll
    54 @released
    55 @see TPopAccount
    56 */
    57 typedef TInt TPopAccountId;
    58 
    59 /**
    60 Identifier number for an IMAP email account.
    61 
    62 @publishedAll
    63 @released
    64 @see TImapAccount
    65 */
    66 typedef TInt TImapAccountId;
    67 
    68 /**
    69 Identifier number for an SMTP email account.
    70 
    71 @publishedAll
    72 @released
    73 @see TSmtpAccount
    74 */
    75 typedef TInt TSmtpAccountId;
    76 
    77 /**
    78 Identifier number for an SMTP moblity account.
    79 
    80 @publishedPartner
    81 @released
    82 */
    83 typedef TInt TSmtpMobilityAccountId;
    84 
    85 /**
    86 Array of IAP values
    87 
    88 @publishedPartner
    89 @released
    90 */
    91 typedef RArray<TUint32> RArrayIAP;
    92 
    93 /**
    94 Null or undefined SMTP account identifier
    95 
    96 @publishedPartner
    97 @released
    98 */
    99 const TSmtpAccountId KNullSmtpAccountId = 0;
   100 
   101 /**
   102 POP account ID.
   103 
   104 Objects of this type identify POP email accounts. 
   105 They are obtained when a POP account is created 
   106 (CEmailAccounts::CreatePopAccountL()), or by 
   107 querying for what POP accounts exist 
   108 (CEmailAccounts::GetPopAccountL() and CEmailAccounts::GetPopAccountsL()).
   109 
   110 The object is then used as a handle to the account when getting
   111 the account settings, using CEmailAccounts::LoadPopSettingsL() and 
   112 CEmailAccounts::LoadPopIapSettingsL().
   113 
   114 @publishedAll
   115 @released
   116 */
   117 class TPopAccount
   118 	{
   119 public:
   120 	/** POP account identifier number. 
   121 	
   122 	Each POP account stored on the phone has a different
   123 	identifier number to distinguish it from other accounts.
   124 	*/
   125 	TPopAccountId iPopAccountId;
   126 
   127 	/** POP account name. */
   128 	TBuf<KEmailAccountNameSize> iPopAccountName;
   129 
   130 	/** Entry ID of the POP service for this account. */
   131 	TMsvId iPopService;
   132 
   133 	/** Entry ID of the related SMTP service for this account. 
   134 		
   135 	This is set if an SMTP service has been created, using 
   136 	CEmailAccounts::CreateSmtpAccountL(), that specifies that 
   137 	it is related to this account. An SMTP service (which provides
   138 	email sending functionality) is used in conjunction with 
   139 	a POP or IMAP service (which provide email retrieval).
   140 	*/
   141 	TMsvId iSmtpService;
   142 	};
   143 
   144 /**
   145 IMAP account ID.
   146 
   147 Objects of this type identify IMAP email accounts. 
   148 They are obtained when a IMAP account is created 
   149 (CEmailAccounts::CreateImapAccountL()), or by 
   150 querying for what IMAP accounts exist 
   151 (CEmailAccounts::GetImapAccountL() and CEmailAccounts::GetImapAccountsL()).
   152 
   153 The object is then used as a handle to the account when getting
   154 the account settings, using CEmailAccounts::LoadImapSettingsL() and 
   155 CEmailAccounts::LoadImapIapSettingsL().
   156 
   157 @publishedAll
   158 @released
   159 */
   160 class TImapAccount
   161 	{
   162 public:
   163 	/** IMAP account identifier number.
   164 	
   165 	Each IMAP account stored on the phone has a different
   166 	identifier number to distinguish it from other accounts.
   167 	*/
   168 	TImapAccountId iImapAccountId;
   169 
   170 	/** IMAP account name */
   171 	TBuf<KEmailAccountNameSize> iImapAccountName;
   172 
   173 	/** Entry ID of the IMAP service for this account. */
   174 	TMsvId iImapService;
   175 
   176 	/** Entry ID of the related SMTP service for this account. 
   177 		
   178 	This is set if an SMTP service has been created, using 
   179 	CEmailAccounts::CreateSmtpAccountL(), that specifies that 
   180 	it is related to this account. An SMTP service (which provides
   181 	email sending functionality) is used in conjunction with 
   182 	a POP or IMAP service (which provide email retrieval).
   183 	*/
   184 	TMsvId iSmtpService;
   185 	};
   186 
   187 /**
   188 SMTP account ID.
   189 
   190 Objects of this type identify SMTP email accounts. 
   191 They are obtained when a SMTP account is created 
   192 (CEmailAccounts::CreateSmtpAccountL()), or by 
   193 querying for what SMTP accounts exist 
   194 (CEmailAccounts::GetSmtpAccountL() and CEmailAccounts::GetISmtpAccountsL()).
   195 
   196 The object is then used as a handle to the account when getting
   197 the account settings, using CEmailAccounts::LoadSmtpSettingsL() and 
   198 CEmailAccounts::LoadSmtpIapSettingsL().
   199 
   200 @publishedAll
   201 @released
   202 */
   203 class TSmtpAccount
   204 	{
   205 public:
   206 	/** SMTP account identifier number. */
   207 	TSmtpAccountId iSmtpAccountId;
   208 
   209 	/** SMTP account name */
   210 	TBuf<KEmailAccountNameSize> iSmtpAccountName;
   211 
   212 	/** Entry ID of the SMTP service for this account. */
   213 	TMsvId iSmtpService;
   214 
   215 	/** Entry ID of the related POP or IMAP service for this account. 
   216 		
   217 	An SMTP service (which provides	email sending functionality) is 
   218 	used in conjunction with a POP or IMAP service (which provide email retrieval).
   219 	*/
   220 	TMsvId iRelatedService;
   221 	};
   222 
   223 /**
   224 @publishedPartner
   225 @released
   226 */
   227 class TSmtpMobilityAccount
   228 	{
   229 public:
   230 	/** SMTP mobility account identifier */
   231 	TSmtpMobilityAccountId iAccountId;
   232 
   233 	/** SMTP mobility account name */
   234 	TBuf<KEmailAccountNameSize> iName;
   235 
   236 	/** Parent SMTP account identifier */
   237 	TSmtpAccountId iParentSmtpAccountId;
   238 
   239 	/** Linked SMTP account identifier. Identifies the SMTP account whose
   240 	    settings will be used by this mobility account. If the mobility account
   241 	    is using its own settings, this will be set to KNullSmtpAccountId. */
   242 	TSmtpAccountId iLinkedSmtpAccountId;
   243 	};
   244 
   245 /**
   246 Creates, loads, saves and deletes email (IMAP, POP, and SMTP) accounts. 
   247 
   248 An account encapsulates:
   249 
   250 - Settings for a messaging service. There is a different type of 
   251   settings class for each of the email protocols (CImPop3Settings, 
   252   CImImap4Settings, CImSmtpSettings).
   253 - IAP (Internet account) settings for accessing the service.
   254 
   255 The class has a family of functions for each protocol to create, get,
   256 and delete accounts:
   257 
   258 - Create\<protocol\>AccountL 
   259 - Get\<protocol\>AccountL 
   260 - Get\<protocol\>AccountsL 
   261 - Delete\<protocol\>AccountL 
   262 
   263 where \<protocol\> is either POP, IMAP, or SMTP. 
   264 The Create and Get functions don't directly return settings 
   265 objects, but only account identifiers. 
   266 
   267 Account identifiers are passed to the following functions 
   268 to save and load the service and IAP settings for that account:
   269 
   270 - Load\<protocol\>SettingsL
   271 - Save\<protocol\>SettingsL 
   272 - Load\<protocol\>IapSettingsL 
   273 - Save\<protocol\>IapSettingsL 
   274 
   275 For SMTP only, there is a concept of a default account (as a client
   276 program may want to send an email, and not care which account is used.)
   277 SetDefaultSmtpAccountL(), DefaultSmtpAccountL() and DeleteDefaultSmtpAccountL() 
   278 are used to handle this.
   279 
   280 Note that an account is associated with a service entry in the message store,
   281 but account information itself is stored in the central repository.
   282 
   283 @publishedAll
   284 @released
   285 */
   286 class CEmailAccounts : public CBase, public MMsvSessionObserver
   287 	{
   288 public:
   289 
   290 	IMPORT_C static CEmailAccounts* NewL();
   291 	IMPORT_C static CEmailAccounts* NewLC();
   292 	IMPORT_C virtual ~CEmailAccounts();
   293 
   294 	IMPORT_C TPopAccount CreatePopAccountL(const TDesC& aAccountName, const CImPop3Settings& aPopSettings,
   295 		const CImIAPPreferences& aPopIAP, TBool aReadOnly);
   296 
   297 	IMPORT_C TImapAccount CreateImapAccountL(const TDesC& aAccountName, const CImImap4Settings& aImapSettings,
   298 		const CImIAPPreferences& aImapIAP, TBool aReadOnly);
   299 
   300 	IMPORT_C TSmtpAccount CreateSmtpAccountL(TPopAccount& aPopAccount, const CImSmtpSettings& aSmtpSettings,
   301 		const CImIAPPreferences& aSmtpIAP, TBool aReadOnly);
   302 
   303 	IMPORT_C TSmtpAccount CreateSmtpAccountL(TImapAccount& aImapAccount, const CImSmtpSettings& aSmtpSettings,
   304 		const CImIAPPreferences& aSmtpIAP, TBool aReadOnly);
   305 
   306 	IMPORT_C TSmtpAccount CreateSmtpAccountL(const TDesC& aAccountName, const CImSmtpSettings& aSmtpSettings, 
   307 		const CImIAPPreferences& aSmtpIAP, TBool aReadOnly);
   308 
   309 	IMPORT_C void GetPopAccountsL(RArray<TPopAccount>& aAccounts);
   310 	IMPORT_C void GetPopAccountL(TMsvId aServiceId, TPopAccount& aAccount); 
   311 	IMPORT_C void DeletePopAccountL(const TPopAccount& aAccount);
   312 
   313 	IMPORT_C void GetImapAccountsL(RArray<TImapAccount>& aAccounts);
   314 	IMPORT_C void GetImapAccountL(TMsvId aServiceId, TImapAccount& aAccount); 
   315 	IMPORT_C void DeleteImapAccountL(const TImapAccount& aAccount);
   316 
   317 	IMPORT_C void GetSmtpAccountsL(RArray<TSmtpAccount>& aAccounts);
   318 	IMPORT_C void GetSmtpAccountL(TMsvId aServiceId, TSmtpAccount& aAccount); 
   319 	IMPORT_C void DeleteSmtpAccountL(const TSmtpAccount& aAccount);
   320 	IMPORT_C void DeleteDefaultSmtpAccountL();
   321 
   322 	IMPORT_C void PopulateDefaultPopSettingsL(CImPop3Settings& aPopSettings,
   323 	CImIAPPreferences& aPopIap);
   324 
   325 	IMPORT_C void PopulateDefaultImapSettingsL(CImImap4Settings& aImapSettings,
   326 	CImIAPPreferences& aImapIap);
   327 
   328 	IMPORT_C void PopulateDefaultSmtpSettingsL(CImSmtpSettings& aSmtpSettings,
   329 	CImIAPPreferences& aSmtpIap);
   330 
   331 	IMPORT_C TInt DefaultSmtpAccountL(TSmtpAccount& aAccount);
   332 	IMPORT_C void SetDefaultSmtpAccountL(const TSmtpAccount& aAccount);
   333 
   334 	IMPORT_C void LoadPopSettingsL(const TPopAccount& aAccount, CImPop3Settings& aPopSettings);
   335 	IMPORT_C void LoadPopIapSettingsL(const TPopAccount& aAccount, CImIAPPreferences& aIAP);
   336 
   337 	IMPORT_C void LoadImapSettingsL(const TImapAccount& aAccount, CImImap4Settings& aImapSettings);
   338 	IMPORT_C void LoadImapIapSettingsL(const TImapAccount& aAccount, CImIAPPreferences& aIAP);
   339 
   340 	IMPORT_C void LoadSmtpSettingsL(const TSmtpAccount& aAccount, CImSmtpSettings& aSmtpSettings);
   341 	IMPORT_C void LoadSmtpIapSettingsL(const TSmtpAccount& aAccount, CImIAPPreferences& aIAP);
   342 
   343 	IMPORT_C void SavePopSettingsL(const TPopAccount& aAccount, const CImPop3Settings& aPopSettings);
   344 	IMPORT_C void SavePopIapSettingsL(const TPopAccount& aAccount, const CImIAPPreferences& aIAP);
   345 
   346 	IMPORT_C void SaveImapSettingsL(const TImapAccount& aAccount, const CImImap4Settings& aImapSettings);
   347 
   348 	IMPORT_C void SaveImapIapSettingsL(const TImapAccount& aAccount, const CImIAPPreferences& aIAP);
   349 
   350 	IMPORT_C void SaveSmtpSettingsL(const TSmtpAccount& aAccount, const CImSmtpSettings& aSmtpSettings);
   351 	IMPORT_C void SaveSmtpIapSettingsL(const TSmtpAccount& aAccount, const CImIAPPreferences& aIAP);
   352 
   353 	IMPORT_C TBool IsAccountReadOnlyL(const TPopAccount& aAccount);
   354 	IMPORT_C TBool IsAccountReadOnlyL(const TImapAccount& aAccount);
   355 	IMPORT_C TBool IsAccountReadOnlyL(const TSmtpAccount& aAccount);
   356 
   357 	// Published partner routines
   358 	IMPORT_C TImapAccount CreateImapAccountL(const TDesC& aAccountName,
   359 		const CImImap4Settings& aImapSettings, const CImIAPPreferences& aImapIAP,
   360 		const CImapSyncDownloadRules& aSyncDownloadRules, TBool aReadOnly);
   361 	IMPORT_C void LoadImapSyncDownloadRulesL(const TImapAccount& aAccount, CImapSyncDownloadRules& aRules);
   362 	IMPORT_C void LoadImapTransportBufferSizesL(CImapTransportBufferSizes& aBufferSizes);
   363 	IMPORT_C void SaveImapSyncDownloadRulesL(const TImapAccount& aAccount, const CImapSyncDownloadRules& aRules);
   364 	IMPORT_C void SaveImapTransportBufferSizesL(const CImapTransportBufferSizes& aBufferSizes);
   365 	IMPORT_C void DeleteImapTransportBufferSizesL();
   366 
   367 	IMPORT_C void GetSmtpAccountL(TSmtpAccountId aAccountId, TSmtpAccount& aAccount);
   368 
   369 	IMPORT_C TSmtpMobilityAccount CreateSmtpMobilityAccountL(const TDesC& aAccountName, const RArrayIAP& aIapList, const TSmtpAccount& aSmtpAccount, const CImSmtpMobilitySettings& aSettings, TBool aReadOnly);
   370 	IMPORT_C TSmtpMobilityAccount CreateSmtpMobilityAccountL(const TDesC& aAccountName, const RArrayIAP& aIapList, const TSmtpAccount& aSmtpAccount, const TSmtpAccount& aLinkedSmtpAccount, TBool aReadOnly);
   371 	IMPORT_C void GetSmtpMobilityAccountsL(const TSmtpAccount& aSmtpAccount, RArray<TSmtpMobilityAccount>& aAccounts);
   372 	IMPORT_C void DeleteSmtpMobilityAccountL(const TSmtpMobilityAccount& aAccount);
   373 
   374 	IMPORT_C void PopulateDefaultSmtpMobilitySettingsL(CImSmtpMobilitySettings& aSettings);
   375 	IMPORT_C void LoadSmtpMobilitySettingsL(const TSmtpMobilityAccount& aAccount, CImSmtpMobilitySettings& aSettings);
   376 	IMPORT_C void SaveSmtpMobilitySettingsL(const TSmtpMobilityAccount& aAccount, const CImSmtpMobilitySettings& aSettings);
   377 
   378 	IMPORT_C void LoadSmtpMobilityAccountIapListL(const TSmtpMobilityAccount& aAccount, RArrayIAP& aIapList);
   379 	IMPORT_C void SaveSmtpMobilityAccountIapListL(const TSmtpMobilityAccount& aAccount, const RArrayIAP& aIapList);
   380 
   381 	IMPORT_C TBool IsAccountReadOnlyL(const TSmtpMobilityAccount& aAccount);
   382 
   383 	// Internal routines
   384 	IMPORT_C void GetSmtpMobilityAccountsL(RArray<TSmtpMobilityAccount>& aAccounts);
   385 	IMPORT_C TBool LoadSmtpMobilitySettingsL(TSmtpAccountId& aSmtpAccountId, TUint32 aIap, CImSmtpMobilitySettings& aSettings);
   386 
   387 private:
   388 	CEmailAccounts();
   389 	void HandleSessionEventL(TMsvSessionEvent , TAny* , TAny* , TAny* );
   390 	CMsvSession& SessionL();
   391 	CRepository& PopRepositoryL();
   392 	CRepository& ImapRepositoryL();
   393 	CRepository& SmtpRepositoryL();
   394 
   395 	TMsvId CreateEmailServiceL(CMsvEntry& aMsvEntry, const TDesC& aAccountName, TUid aMTMType, TBool aVisible);
   396 	void SetRelatedIdL(CMsvEntry& aMsvEntry, TMsvId aId, TMsvId aRelatedId);
   397 	void SetEntryDetailsL(TMsvId aId, const TDesC& aAccountName);
   398 	void UnSetInPreparationFlagsL(CMsvEntry& aMsvEntry, TMsvId aId, TInt aAccountId);
   399 	void DeleteServiceEntryL(CMsvEntry& aMsvEntry, TMsvId aId);
   400 
   401 	TUint GetNextEmptyAccountSlotL(CRepository& aRepository);
   402 	TUint32 FindEmailAccountL(TMsvId aService, CRepository& aRepository);
   403 
   404 	void LoadIAPPrefSettingsL(TUint32 aAccountId, CImIAPPreferences& aIAP, CRepository& aRepository);
   405 	void DoLoadPopSettingsL(TUint32 aAccountId, CImPop3Settings& aPopSettings);
   406 	void DoLoadImapSettingsL(TUint32 aAccountId, CImImap4Settings& aImapSettings);
   407 	void DoLoadSmtpSettingsL(TUint32 aAccountId, CImSmtpSettings& aSmtpSettings);
   408 
   409 	void SaveIAPPrefSettingsL(TUint32 aAccountId, const CImIAPPreferences& aIAP, CRepository& aRepository);
   410 	void DoSavePopSettingsL(TUint32 aAccountId, const CImPop3Settings& aPopSettings);
   411 	void DoSaveSmtpSettingsL(TUint32 aAccountId, const CImSmtpSettings& aSmtpSettings);
   412 	void DoSaveImapSettingsL(TUint32 aAccountId, const CImImap4Settings& aImapSettings);	
   413 	void DoSaveImapSyncDownloadRulesL(TUint32 aAccountId, const CImapSyncDownloadRules& aRules, CRepository& aRepository);
   414 
   415 	TImapAccount CreateImapAccountL(const TDesC& aAccountName, const CImImap4Settings& aImapSettings,
   416 		const CImIAPPreferences& aImapIAP, const CImapSyncDownloadRules* aSyncDownloadRules, TBool aReadOnly);
   417 
   418 	TUint32 DoCreatePopAccountL(const TDesC& aAccountName, const CImPop3Settings& aPopSettings, 
   419 		const CImIAPPreferences& aPopIAP, TMsvId aPopService, TMsvId aRelatedService, TBool aReadOnly);
   420 	TUint32 DoCreateImapAccountL(const TDesC& aAccountName, const CImImap4Settings& aImapSettings,
   421 		const CImIAPPreferences& aImapIAP, const CImapSyncDownloadRules* aSyncDownloadRules, TMsvId aImapService,
   422 		TMsvId aRelatedService, TBool aReadOnly);
   423 	TUint32 DoCreateSmtpAccountL(TPopAccount& aPopAccount, const CImSmtpSettings& aSmtpSettings, 
   424 		const CImIAPPreferences& aSmtpIAP, TMsvId aSmtpService, CMsvEntry& aMsvEntry, TUint32& aPopAccountId, TBool aReadOnly);
   425 	TUint32 DoCreateSmtpAccountL(TImapAccount& aImapAccount, const CImSmtpSettings& aSmtpSettings, 
   426 		const CImIAPPreferences& aSmtpIAP, TMsvId aSmtpService, CMsvEntry& aMsvEntry, TUint32& aImapAccountId, TBool aReadOnly);
   427 	TUint32 DoCreateSmtpAccountL(const TDesC& aAccountName, const CImSmtpSettings& aSmtpSettings, 
   428 		const CImIAPPreferences& aSmtpIAP, TMsvId aSmtpService, TMsvId aRelatedService, TBool aReadOnly);	
   429 
   430 	void DeleteIAPPrefSettingsL(TUint32 aAccountId, CRepository& aRepository);
   431 	void DeletePopSettings(TUint32 aAccountId, CRepository& aRepository);
   432 	void DeleteSmtpSettings(TUint32 aAccountId, CRepository& aRepository);
   433 	void DeleteImapSettings(TUint32 aAccountId, CRepository& aRepository);
   434 	void DeleteImapSyncDownloadRulesL(TUint32 aAccountId, CRepository& aRepository);
   435 
   436 	void GetEmailServicesL(CMsvEntrySelection& aServices, TUid aMTMType, CMsvEntry& aMsvEntry);
   437 
   438 	TBool IsAsciiPrintable(const TDesC16& aText);
   439 	TBool IsAsciiPrintable(const TDesC8& aText);
   440 	TBool IsUnicodePrintable(const TDesC16& aText);
   441 
   442 	TSmtpMobilityAccount DoCreateSmtpMobilityAccountL(const TDesC& aAccountName, const RArrayIAP& aIapList, const CImSmtpMobilitySettings& aSettings, const TSmtpAccount& aSmtpAccount, TSmtpAccountId aLinkedSmtpAccountId, TBool aReadOnly);
   443 	void AddMobilityAccountToSmtpAccountL(const TSmtpAccount& aSmtpAccount, const RArrayIAP& aIapList, TUint32 aMobAccRepId, CRepository& aRepository);
   444 	void AddLinkToMobilityAccountL(TSmtpAccountId aLinkedSmtpAccountId, TUint32 aMobAccRepId, CRepository& aRepository);
   445 	TInt FindIapListEntryInSmtpMobilityAccountListL(const RArrayIAP& aIapList, CRepository& aRepository, TUint32 aSmtpAccRepId, TInt aNumEntries, TInt aIgnorePos);
   446 	TInt FindAccountIdInSmtpMobilityAccountListL(TUint32 aMobAccRepId, CRepository& aRepository, TUint32 aSmtpAccRepId, TInt aNumEntries);
   447 	void GetSmtpAccountInfoForMobilityAccountL(TUint32 aMobAccRepId, CRepository& aRepository, TUint32& aSmtpAccRepId, TInt& aPos);
   448 	void DeleteAllOwnedMobilityAccountsL(TUint32 aSmtpAccRepId, CRepository& aRepository);
   449 	void DeleteAllLinkedMobilityAccountsL(TUint32 aLinkedSmtpAccRepId, CRepository& aRepository);
   450 	void DeleteSmtpMobilityAccountListEntryL(TUint32 aMobAccRepId, CRepository& aRepository, TUint32 aSmtpAccRepId);
   451 	void DeleteSmtpMobilityAccountFromLinkedSmtpAccountL(TUint32 aMobAccRepId, CRepository& aRepository);
   452 	TBool IsSmtpTypeAccountReadOnlyL(TUint32 aAccRepId);
   453 	TBool IsSmtpMobilityAccount(CRepository& aRepository, TUint32 aAccRepId);
   454 
   455 private:
   456 	enum TEmailSettingTypes
   457 		{
   458 		// Partial CenRep Id for service settings
   459 		EServiceSettingType 			= 0x00000000,
   460 		// Partial CenRep Id for IAP Prefs
   461 		EIAPPrefSettingType				= 0x00010000,
   462 		// CenRep mask for email accounts
   463 		EAccountMask 					= 0x800FFFFF			
   464 		};
   465 	
   466 	enum TPOPServiceSettingsCenRepId
   467 		{
   468 		EPOPServiceId					= 0x00000000,
   469 		EPOPAccountNameId				= 0x00000001,
   470 		EPOPRelatedSMTPServiceId		= 0x00000002,
   471 		EPOPSettingsVersionId			= 0x00000003, 
   472 		EPOPServerAddressId				= 0x00000004,
   473 		EPOPPortNumberId			   	= 0x00000005,     	
   474 		EPOPFlagsId						= 0x00000006,
   475 		EPOPLoginNameId					= 0x00000007,
   476 		EPOPPasswordId					= 0x00000008,
   477 		EPOPMaxEmailSizeId				= 0x00000009,
   478 		EPOPGetEmailOptionsId			= 0x0000000A,
   479 		EPOPInboxSynchronisationLimitId	= 0x0000000B,
   480 		EPOPPopulationLimitId			= 0x0000000C,
   481 		EPOPReadOnlyAccountId			= 0x0000000D,
   482 		EPOPTlsSslDomainId				= 0x0000000F
   483 		};
   484 
   485 	enum TIMAPServiceSettingsCenRepId
   486 		{
   487 		EIMAPServiceId					= 0x00000000,
   488 		EIMAPAccountNameId				= 0x00000001,
   489 		EIMAPRelatedSMTPServiceId		= 0x00000002,
   490 		EIMAPSettingsVersionId			= 0x00000003, 
   491 		EIMAPServerAddressId			= 0x00000004,
   492 		EIMAPPortNumberId			   	= 0x00000005,     	
   493 		EIMAPFlagsId					= 0x00000006,
   494 		EIMAPLoginNameId				= 0x00000007,
   495 		EIMAPPasswordId					= 0x00000008,
   496 		EIMAPFolderPathId				= 0x00000009,
   497 		EIMAPPathSeparatorId			= 0x0000000A,
   498 		EIMAPSynchronisationStrategyId	= 0x0000000B,
   499 		EIMAPSubscriptionStrategyId		= 0x0000000C,
   500 		EIMAPMaxEmailSizeId				= 0x0000000D,
   501 		EIMAPGetMailOptionsId			= 0x0000000E,
   502 		EIMAPInboxSynchronisationLimitId= 0x0000000F,
   503 		EIMAPMailboxSynchronisationLimitId= 0x00000010,
   504 		EIMAPTlsSslDomainId				= 0x00000012,		
   505 		EIMAPSyncRateId					= 0x00000020,
   506 		EIMAPFetchSizeId				= 0x00000030,
   507 		EIMAPIdleTimeoutId				= 0x00000040,
   508 		EPartialMailOptionsId			= 0x00000050,
   509 		EBodyTextSizeLimitId			= 0x00000060,		
   510 		EAttachmentSizeLimitId			= 0x00000070,
   511 		EIMAPSearchStringId				= 0x00000080,
   512 		EIMAPReadOnlyAccountId			= 0x00000090,
   513 		// 0x00001000 - 0x00002FFF reserved for sync download rules
   514 		// 0x00010000 - 0x00014FFF reserved for IAP/SNAP preferences
   515 		};
   516 
   517 	enum TIMAPSyncDownloadRulesCenRepInfo
   518 		{
   519 		EIMAPSyncDownloadRulesVersionId = 0x00001000,
   520 		EIMAPNumInboxSyncDownloadRulesId = 0x00001001,
   521 		EIMAPNumFolderSyncDownloadRulesId = 0x00001002,
   522 
   523 		EIMAPInboxSyncDownloadRulesBearerTypesId = 0x00001010,
   524 		EIMAPInboxSyncDownloadRulesMailOptionsId = 0x00001011,
   525 		EIMAPInboxSyncDownloadRulesTotalSizeLimitId = 0x00001012,
   526 		EIMAPInboxSyncDownloadRulesBodyTextSizeLimitId = 0x00001013,
   527 		EIMAPInboxSyncDownloadRulesAttachmentSizeLimitId = 0x00001014,
   528 		EIMAPInboxSyncDownloadRulesGetMailBodyPartsId = 0x00001015,
   529 		EIMAPInboxSyncDownloadRulesMaxEmailSizeId = 0x00001016,
   530 
   531 		EIMAPFolderSyncDownloadRulesBearerTypesId = 0x00001030,
   532 		EIMAPFolderSyncDownloadRulesMailOptionsId = 0x00001031,
   533 		EIMAPFolderSyncDownloadRulesTotalSizeLimitId = 0x00001032,
   534 		EIMAPFolderSyncDownloadRulesBodyTextSizeLimitId = 0x00001033,
   535 		EIMAPFolderSyncDownloadRulesAttachmentSizeLimitId = 0x00001034,
   536 		EIMAPFolderSyncDownloadRulesGetMailBodyPartsId = 0x00001035,
   537 		EIMAPFolderSyncDownloadRulesMaxEmailSizeId = 0x00001036,
   538 
   539 		// Offset between sets of rules
   540 		EIMAPSyncDownloadRulesOffset = 0x40
   541 		};
   542 
   543 	enum TIAPPreferencesCenRepId
   544 		{
   545 		// single settings		
   546 		EIAPPrefVersion 				= 0x00010000,
   547 		EIAPChoicesCount 				= 0x00010001,
   548 		
   549 		// List of settings
   550 		EIAPListIDs						= 0x00011000,
   551 		EIAPListDialogPrefs				= 0x00012000,
   552 		// EIAPSnapId placed here is a deviation from Design doc. Remove comment after a decision is made
   553 		EIAPSnapId						= 0x00014000 // The same value is to be used in all account types
   554 		};
   555 
   556 	enum TIMAPTransportBufferSizesCenRepInfo
   557 		{
   558 		EIMAPTransportBufferSizesVersionId = 0x80000100,
   559 		EIMAPNumTransportBufferSizesId = 0x80000101,
   560 
   561 		EIMAPTransportBufferSizesBearerTypesId = 0x80000110,
   562 		EIMAPTransportBufferSizesFetchRequestSizeId = 0x80000111,
   563 		EIMAPTransportBufferSizesMaxOutstandingFetchResponsesId = 0x80000112,
   564 	
   565 		// Offset between entries
   566 		EIMAPTransportBufferSizesOffset = 0x20
   567 		};
   568 
   569 	enum TSMTPServiceSettingsCenRepId
   570 		{
   571 		ESMTPServiceId					= 0x00000000,
   572 		ESMTPAccountNameId				= 0x00000001,		
   573 		ESMTPSettingsVersionId			= 0x00000002,
   574 		ESMTPServerAddressId			= 0x00000003, 
   575 		ESMTPPortNumberId				= 0x00000004, 
   576 		ESMTPFlagsId				   	= 0x00000005,     	
   577 		ESMTPEmailAliasId				= 0x00000006, 
   578 		ESMTPEmailAddressId				= 0x00000007,
   579 		ESMTPReplyToAddressId			= 0x00000008,
   580 		ESMTPReceiptAddressId			= 0x00000009,
   581 		ESMTPBodyEncodingId				= 0x0000000A,
   582 		ESMTPDefaultMsgCharSetId		= 0x0000000B,
   583 		ESMTPSendCopyToSelfId			= 0x0000000C,
   584 		ESMTPSendMessageOptionId		= 0x0000000D,
   585 		ESMTPLoginNameId				= 0x0000000E,
   586 		ESMTPPasswordId					= 0x0000000F,
   587 		ESMTPRelatedServiceId			= 0x00000010,
   588 		ESMTPIncludeToCcId				= 0x00000011,
   589 		ESMTPReadOnlyAccountId			= 0x00000012,
   590 		ESMTPParentAccountId			= 0x00000013,
   591 		ESMTPTlsSslDomainId				= 0x00000014,
   592 		ESMTPLinkedAccountId			= 0x00000015
   593 		};
   594 
   595 	enum TSMTPLinkedMobilityAccountListCenRepInfo
   596 		{
   597 		ESMTPLinkedMobilityAccountListVersionId = 0x00015000,
   598 		ESMTPLinkedMobilityAccountListNumEntriesId = 0x00015001,
   599 		ESMTPLinkedMobilityAccountListEntryId = 0x00015010,
   600 
   601 		// Maximum number of list entries
   602 		ESMTPLinkedMobilityAccountListMaxEntries = 2048
   603 		};
   604 
   605 	enum TSMTPMobilityAccountListCenRepInfo
   606 		{
   607 		ESMTPMobilityAccountListVersionId = 0x00016000,
   608 		ESMTPMobilityAccountListNumEntriesId = 0x00016001,
   609 
   610 		ESMTPMobilityAccountListAccountId = 0x00016010,
   611 		ESMTPMobilityAccountListNumIapsId = 0x00016011,
   612 		ESMTPMobilityAccountListIapId = 0x00016020,
   613 
   614 		// Offset between entries
   615 		ESMTPMobilityAccountListOffset = 0x40,
   616 
   617 		// Maximum number of list entries
   618 		ESMTPMobilityAccountMaxEntries = 32
   619 		};
   620 
   621 private:
   622 	CMsvSession* iMsvSession;
   623 	CRepository* iPOPRepository;
   624 	CRepository* iSMTPRepository;
   625 	CRepository* iIMAPRepository;	
   626 	};
   627 
   628 #endif // __CEMAILACCOUNTS_H__