messagingappbase/msgavkon/muiu_internal/emailtools/inc/MuiuEmailTools.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  MuiuEmailTools  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CIMASETTINGSUTILS_H
       
    21 #define CIMASETTINGSUTILS_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <e32cmn.h>             
       
    26 #include <msvstd.h>                 // TEntry        
       
    27 #include <mtmuibas.h>               // CBaseMtmUi
       
    28 #include <cemailaccounts.h>         // CEmailAccounts
       
    29 #include <SendUiConsts.h>           // Mtm's
       
    30 
       
    31 // CONSTANTS
       
    32 // MACROS
       
    33 // DATA TYPES
       
    34 // FUNCTION PROTOTYPES
       
    35 // FORWARD DECLARATIONS
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  This class contains simple tools for mailbox handling
       
    40 *  @lib muiu
       
    41 *  @since S60 3.0
       
    42 */
       
    43 class MuiuEmailTools
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46     public: // New functions             
       
    47                         
       
    48         /**
       
    49         * Checks the current default mailbox
       
    50         * @since S60 3.0
       
    51         * @param aMsvSession Message server session
       
    52         * @param aMtmId 
       
    53         *   Mail Mtm Id to be used for searching default mailbox. If Pop3 or
       
    54         *   Imap4 mtm is offered, the value of aMtmId is changed to 
       
    55         *   corresponding Smtp mtm id.
       
    56         * @return KMsvUnknownServiceIndexEntryId if no default mailbox
       
    57         * @return Default mailbox id
       
    58         */
       
    59         IMPORT_C static TMsvId DefaultSendingMailboxL( 
       
    60             CMsvSession& aMsvSession,            
       
    61             TUid& aMtmId );               
       
    62                             
       
    63         /**
       
    64         * Sets the default sending mailbox
       
    65         * @since S60 3.0
       
    66         * @param aSendingMailboxId 
       
    67         */
       
    68         IMPORT_C static void SetDefaultSendingMailboxL(
       
    69             const TMsvId aSendingMailboxId );                
       
    70             
       
    71         /**
       
    72         * Searches the correct entry of specified protocol for required mailbox
       
    73         * @since S60 3.0
       
    74         * @param aMsvSession Session to be used in search
       
    75         * @param aEntry Entry for result to be stored
       
    76         * @param aMailboxId Id of the required mailbox
       
    77         * @param aGetSendingService Get either receiving or sending type
       
    78         * @return TInt KErrNone if search is successful
       
    79         */
       
    80         IMPORT_C static TInt GetMailboxServiceId(
       
    81             CMsvSession& aMsvSession,
       
    82             TMsvEntry& aEntry,
       
    83             const TMsvId aMailboxId,            
       
    84             const TBool aGetSendingService );              
       
    85             
       
    86         /**
       
    87         * Finds the first valid mailbox with spesific mtm        
       
    88         * @since S60 3.0
       
    89         * @param aMsvSession Message server session
       
    90         * @param a
       
    91         */
       
    92         static TMsvId FindFirstValidMailboxL( 
       
    93             CMsvSession& aMsvSession,
       
    94             const CMsvEntrySelection& aSelection,
       
    95             const TUid& aMtmId );            
       
    96         
       
    97         /**
       
    98         * Checks if given mtm-type matches known mail mtm's 
       
    99         * @since S60 3.0
       
   100         * @param aMtm Mtm to be tested
       
   101         * @param aAllowExtended Other than basic mail mtm's are accepted also
       
   102         * @return EFalse if the mtm is not recognized
       
   103         * @return ETrue if the mtm is supported type (Imap4 / Pop3 / Smtp )
       
   104         */
       
   105        IMPORT_C static TBool IsMailMtm( 
       
   106             const TUid& aMtm,
       
   107             const TBool aAllowExtended = EFalse );          
       
   108     
       
   109         /**
       
   110         * Verifies that the mailbox can be used in the current phone.
       
   111         * @since S60 3.0
       
   112         * @return ETrue/EFalse, Based on the validity of the mailbox
       
   113         */
       
   114         static TBool ValidateMailboxL( 
       
   115             CMsvSession& aMsvSession,
       
   116             const TUid& aMtmId,
       
   117             const TMsvId aMailboxId );
       
   118 
       
   119         /**
       
   120         * Simplifies the call of MtmUi's QueryCapability.
       
   121         * @since S60 3.0
       
   122         * @param aQuery Capability to be queried
       
   123         * @param aMtmUi MtmUi to be used for the query
       
   124         * @return ETrue, when no error and capability exist        
       
   125         * @return EFalse, when the capability is rejected or error has occurred
       
   126         */
       
   127         static TBool QueryCapability( 
       
   128             const TInt aQuery, 
       
   129             CBaseMtmUi& aMtmUi ); 
       
   130             
       
   131         /**
       
   132         * Queries default service from specific MTM
       
   133         * @since S60 3.0
       
   134         * @param aMtmId Mtm type to be queried
       
   135         * @return Id of the default service
       
   136         */
       
   137         static TMsvId QueryDefaultServiceL( 
       
   138             CMsvSession& aMsvSession, 
       
   139             const TUid& aMtmId );          
       
   140     
       
   141     public: // Functions from base classes
       
   142 
       
   143     protected:  // Constructors
       
   144     protected:  // New virtual functions
       
   145     protected:  // New functions
       
   146     protected:  // Functions from base classes
       
   147 
       
   148     private:  // New virtual functions
       
   149     private:  // New functions
       
   150     
       
   151         /**
       
   152         * Simplifies the MtmUi's query Mtm
       
   153         * @since S60 3.0
       
   154         * @param aMailboxId, Mailbox id to be checked
       
   155         * @param aMtmUi, MtmUi to be used for the query      
       
   156         * @return The result of the query
       
   157         */
       
   158         static TInt QueryMailboxValidityL( 
       
   159             const TMsvId aMailboxId,
       
   160             CBaseMtmUi& aMtmUi );            
       
   161             
       
   162     private:  // Functions from base classes
       
   163 
       
   164     public:     // Data
       
   165     protected:  // Data
       
   166     private:    // Data
       
   167     };
       
   168 
       
   169 #endif //  CIMASETTINGSUTILS_H
       
   170 
       
   171 // End of File