ipsservices/ipssossettings/inc/ipssetdatactrlaccount.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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 IPSSETDATACTRLACCOUNT_H
       
    20 #define IPSSETDATACTRLACCOUNT_H
       
    21 
       
    22 
       
    23 #include <msvstd.h>                     // TMsvId
       
    24 
       
    25 class CEmailAccounts;
       
    26 
       
    27 /**
       
    28  *  Definitions:
       
    29  *   - Mailbox Id :  TMsvId, TEntry.Id()
       
    30  *                   Entry Id of mail service entry.
       
    31  *   - AccountId  :  TUint32, TEntry.iMtmData2
       
    32  *                   Index of the Symbian account in the Central Repository
       
    33  *                   for the specific protocol. Each protocol can have
       
    34  *                   account id of 1. Can get values from 1 to 6.
       
    35  *   - ExtensionId : TUint32 (a.k.a ExtendedAccountId)
       
    36  *                   Index of the S60 account in the Central Repository for
       
    37  *                   the specific protocol. Extension Id is always unique.
       
    38  *                   Can get any value except 0.
       
    39  *                       Imap4 keys   : 0x00000001 - 0x000000ff
       
    40  *                        Pop3 keys   : 0x00000100 - 0x0000ff00
       
    41  *   - Base Key   :  Extension id shifted left by 8 (1 byte). This basekey
       
    42  *                   is then used to form the unique key id to refer the
       
    43  *                   setting item.
       
    44  *                        Imap4 keys  : 0x000001xx - 0x0000ffxx
       
    45  *                        Pop3 keys   : 0x000100xx - 0x00ff00xx
       
    46  *
       
    47  *  @lib IpsSosSettings.lib
       
    48  *  @since FS v1.0
       
    49  */
       
    50 class IpsSetDataCtrlAccount
       
    51     {
       
    52 public:
       
    53 
       
    54 // New functions
       
    55 
       
    56     /**
       
    57      * Function to create a base key.
       
    58      * Creates the base key from account id for storing the keys
       
    59      * into extended settings.
       
    60      *
       
    61      * @param aAccountId Id of the symbian account
       
    62      * @param aProtocol Protocol MTM ID of the account
       
    63      * @return Base key
       
    64      */
       
    65     static TUint32 CreateBaseKeyFromAccountId(
       
    66         const TUint32 aAccountId,
       
    67         const TUid& aProtocol );
       
    68 
       
    69     /**
       
    70      * Function to create a base key.
       
    71      * Creates base key from own extended settings. The key is used
       
    72      * to store the settings to extended settings part.
       
    73      *
       
    74      * @param aExtenededAccountId
       
    75      * @return Base key
       
    76      */
       
    77     static TUint32 CreateBaseKeyFromExtendedAccountId(
       
    78         const TUint32 aExtendedAccountId );
       
    79 
       
    80     /**
       
    81      * Converts the account ID to extended account ID.
       
    82      *
       
    83      * @param aAccountId Symbian account ID.
       
    84      * @param aProtocol Protocol MTM ID of the used account
       
    85      * @return Extended account Id
       
    86      */
       
    87     static TUint32 AccountIdToExtendedAccountId(
       
    88         const TUint32 aAccountId,
       
    89         const TUid& aMtmId );
       
    90 
       
    91     /**
       
    92      * Converts extended account ID to Symbian account ID.
       
    93      *
       
    94      * @param aExtension Account's Extension ID
       
    95      * @param aMtmID Protocol MTM ID of the used account
       
    96      * @return Symbian account ID
       
    97      */
       
    98     static TUint32 ExtendedAccountIdToAccountId(
       
    99         const TUint32 aExtension,
       
   100         const TUid& aMtmId );
       
   101 
       
   102     /**
       
   103      * Converts mailbox ID to account ID.
       
   104      *
       
   105      * @param aMailboxId Mailbox entry ID
       
   106      * @param aMtmId Protocol MTM ID of the used entry.
       
   107      * @return Symbian account ID
       
   108      */
       
   109     static TUint32 MailboxIdToAccountIdL(
       
   110         const TMsvId aMailboxId,
       
   111         const TUid& aMtmId );
       
   112 
       
   113     /**
       
   114      * Converts Symbian mailbox account ID to mailbox service entry ID.
       
   115      *
       
   116      * @param aAccountId Symbian account ID.
       
   117      * @param aMtmId Protocol MTM ID of the used entry.
       
   118      */
       
   119     static TMsvId AccountIdToMailboxId(
       
   120         CEmailAccounts& aAccounts,
       
   121         const TUint32 aAccountId,
       
   122         const TUid& aMtmId );
       
   123 
       
   124     /**
       
   125      * Creates setting key for account and its item.
       
   126      *
       
   127      * @param aAccountId Symbian account ID.
       
   128      * @param aSetting Unique ID of the setting
       
   129      * @param aMtmId Protocol MTM ID of the used entry.
       
   130      */
       
   131     static TUint32 CreateSettingKey(
       
   132         const TUint32 aAccountId,
       
   133         const TUint32 aSetting,
       
   134         const TUid& aMtmId );
       
   135     };
       
   136 
       
   137 #endif // IPSSETDATACTRLACCOUNT_H
       
   138 
       
   139 // End of File