email/imum/Utils/Inc/IMASAccountControl.h
branchRCL_3
changeset 27 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  This class handles the complex account id shifting operations.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IMASACCOUNTCONTROL_H
       
    20 #define IMASACCOUNTCONTROL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <msvstd.h>                     // TMsvId
       
    25 #include <cemailaccounts.h>             // CEmailAccounts
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // NOTE: Do not change the order of the enumerations, as it will 
       
    30 //       break the data compatibility. Add new keys just before
       
    31 //       EImaKeyLast -key.
       
    32 enum TImasCommonSettings
       
    33     {
       
    34     // 3.0
       
    35     EImaCommonSetStatusFlagsH = 0x00,
       
    36     EImaCommonSetStatusFlagsL,
       
    37     EImaCommonSetMailboxId,
       
    38     EImaCommonSetAccountId,
       
    39     EImaCommonSetExtensionId,
       
    40     EImaCommonSetProtocol,
       
    41     EImaCommonSetEmailAddress,
       
    42     EImaExtSetEmailNotif,
       
    43     EImaExtSetIndicators,
       
    44     EImaExtSetHideMsgs,
       
    45     EImaExtSetOpenHtmlMail,
       
    46     EImaAoVersion,
       
    47     EImaAoOnlineState,
       
    48     EImaAoWeekDays,
       
    49     EImaAoTimeStartH,
       
    50     EImaAoTimeStartL,
       
    51     EImaAoTimeStopH,
       
    52     EImaAoTimeStopL,
       
    53     EImaAoInboxRefreshTime,
       
    54     EImaAoUpdateMode,
       
    55     EImaAoLastSuccessfulUpdateH,
       
    56     EImaAoLastSuccessfulUpdateL,
       
    57     EImaAoLastUpdateFailed,
       
    58     EImaAoUpdateSuccessfulWithCurSettings,
       
    59     // 3.2
       
    60     EImaExtSetMailDeletion,
       
    61     EImaExtIsPredefined,
       
    62     EImaKeyLast                 // Keep this last!
       
    63     };
       
    64     
       
    65 // MACROS
       
    66 // DATA TYPES
       
    67 // FUNCTION PROTOTYPES
       
    68 // FORWARD DECLARATIONS
       
    69 // CLASS DECLARATION
       
    70 
       
    71 /**
       
    72 *  Definitions: 
       
    73 *   - Mailbox Id :  TMsvId, TEntry.Id()
       
    74 *                   Entry Id of mail service entry. 
       
    75 *   - AccountId  :  TUint32, TEntry.iMtmData2
       
    76 *                   Index of the Symbian account in the Central Repository 
       
    77 *                   for the specific protocol. Each protocol can have 
       
    78 *                   account id of 1. Can get values from 1 to 6.
       
    79 *   - ExtensionId : TUint32 (a.k.a ExtendedAccountId)
       
    80 *                   Index of the S60 account in the Central Repository for
       
    81 *                   the specific protocol. Extension Id is always unique.
       
    82 *                   Can get any value except 0.
       
    83 *                       Imap4 keys  : 0x00000001 - 0x000000ff
       
    84 *                       Pop3 keys   : 0x00000100 - 0x0000ff00
       
    85 *   - Base Key   :  Extension id shifted left by 8 (1 byte). This basekey 
       
    86 *                   is then used to form the unique key id to refer the 
       
    87 *                   setting item.
       
    88 *                       Imap4 keys  : 0x000001xx - 0x0000ffxx
       
    89 *                       Pop3 keys   : 0x000100xx - 0x00ff00xx
       
    90 *
       
    91 *  @lib ImumUtils.lib
       
    92 *  @since S60 3.0
       
    93 */
       
    94 class IMASAccountControl
       
    95     {
       
    96     public:  // Constructors and destructor
       
    97     public: // New functions
       
    98 
       
    99         /**
       
   100         *
       
   101         * @since S60 3.0
       
   102         */
       
   103         static TUint32 CreateBaseKeyFromAccountId(
       
   104             const TUint32 aAccountId,
       
   105             const TUid& aProtocol );
       
   106 
       
   107         /**
       
   108         *
       
   109         * @since S60 3.0
       
   110         */
       
   111         static TUint32 CreateBaseKeyFromExtendedAccountId(
       
   112             const TUint32 aExtendedAccountId );
       
   113 
       
   114         /**
       
   115         *
       
   116         * @since S60 3.0
       
   117         */
       
   118         static TUint32 AccountIdToExtendedAccountId(
       
   119             const TUint32 aAccountId,
       
   120             const TUid& aMtmId );
       
   121 
       
   122         /**
       
   123         *
       
   124         * @since S60 3.0
       
   125         */
       
   126         static TUint32 ExtendedAccountIdToAccountId(
       
   127             const TUint32 aExtension,
       
   128             const TUid& aMtmId );
       
   129 
       
   130         /**
       
   131         *
       
   132         * @since S60 3.0
       
   133         */
       
   134         static TUint32 MailboxIdToAccountIdL(
       
   135             const TMsvId aMailboxId,
       
   136             const TUid& aMtmId );
       
   137 
       
   138         /**
       
   139         *
       
   140         * @since S60 3.0
       
   141         */
       
   142         static TMsvId AccountIdToMailboxId(
       
   143             CEmailAccounts& aAccounts,
       
   144             const TUint32 aAccountId,
       
   145             const TUid& aMtmId );
       
   146                     
       
   147         /**
       
   148         *
       
   149         * @since Series60 3.0
       
   150         */
       
   151         static TUint32 CreateSettingKey(
       
   152             const TUint32 aAccountId,
       
   153             const TUint32 aSetting,
       
   154             const TUid& aMtmId );            
       
   155 
       
   156     public: // Functions from base classes
       
   157 
       
   158     protected:  // Constructors
       
   159     protected:  // New virtual functions
       
   160     protected:  // New functions
       
   161     protected:  // Functions from base classes
       
   162 
       
   163     private:  // New virtual functions
       
   164     private:  // New functions
       
   165         
       
   166         /**
       
   167         * Searches the correct account id to be used to load settings
       
   168         * @since S60 3.2
       
   169         * @param aEntry aPopMailboxId Id of the Pop3 mailbox
       
   170         * @return Account id of the mailbox
       
   171         */
       
   172         static TPopAccount GetPopAccountIdL( 
       
   173             const TMsvId aPopMailboxId );
       
   174 
       
   175         /**
       
   176         * Searches the correct account id to be used to load settings
       
   177         * @since S60 3.2
       
   178         * @param aEntry aImapMailboxId Id of the Imap4 mailbox
       
   179         * @return Account id of the mailbox
       
   180         */
       
   181         static TImapAccount GetImapAccountIdL( 
       
   182             const TMsvId aImapMailboxId );
       
   183             
       
   184         /**
       
   185         * Searches the correct account id to be used to load settings
       
   186         * @since S60 3.2
       
   187         * @param aEntry aSmtpMailboxId Id of the Smtp mailbox
       
   188         * @return Account id of the mailbox
       
   189         */
       
   190         static TSmtpAccount GetSmtpAccountIdL( 
       
   191             const TMsvId aSmtpMailboxId );             
       
   192             
       
   193     private:  // Functions from base classes
       
   194 
       
   195     public:     // Data
       
   196     protected:  // Data
       
   197     private:    // Data
       
   198     };
       
   199 
       
   200 #endif //  IMASACCOUNTCONTROL_H
       
   201 
       
   202 // End of File