email/imum/Utils/Inc/IMSSettingsNoteUi.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:  Contains functions to show notes in UI
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef IMSSETTINGSNOTEUI_H
       
    21 #define IMSSETTINGSNOTEUI_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <e32cmn.h>
       
    26 #include <AknQueryDialog.h>
       
    27 #include <ImumUtils.rsg>
       
    28 #include "MuiuDynamicHeader.h"
       
    29 #include "MuiuDynamicSettingsDialog.h"
       
    30 #include <AknInfoPopupNoteController.h>
       
    31 
       
    32 // CONSTANTS
       
    33 const TInt KMaxVisibleTime = KMaxTInt / 1000;
       
    34 enum TIMSNotes
       
    35     {
       
    36     EIMSConfirmationNote = 0,
       
    37     EIMSInformationNote,
       
    38     EIMSErrorNote,
       
    39     EIMSWarningNote
       
    40     };
       
    41 
       
    42 enum TIMSErrors
       
    43     {
       
    44     // Common
       
    45     EIMSNoError = 0,
       
    46     EIMSItemInvalid,
       
    47     EIMSItemEmpty,
       
    48     // Mailbox
       
    49     EIMSMailboxNameExists,
       
    50     EIMSMailboxNameEmpty,
       
    51     EIMSMailboxNameRejected,
       
    52     // Always Online
       
    53     EIMSAoAlwaysAsk,
       
    54     EIMSAoIAPPassword,
       
    55     EIMSAoNoLogin,
       
    56     EIMSAoOmaEmnOn,
       
    57     EIMSOmaEmnAoOn,
       
    58     EIMSAoManyAlwaysOnline,
       
    59     EIMSAoFetchNotAccepted,
       
    60     EIMSAoIapTypeCSD
       
    61     };
       
    62 
       
    63 // DATA TYPES
       
    64 // FUNCTION PROTOTYPES
       
    65 // FORWARD DECLARATIONS
       
    66 class CImumInternalApiImpl;
       
    67 class CIMSSettingsBaseUI;
       
    68 class CAknResourceNoteDialog;
       
    69 class CMuiuFlags;
       
    70 
       
    71 // CLASS DECLARATION
       
    72 
       
    73 /**
       
    74 *
       
    75 *  @lib
       
    76 *  @since S60 3.0
       
    77 */
       
    78 NONSHARABLE_CLASS( CIMSSettingsNoteUi ) : public CBase
       
    79     {
       
    80     public:  // Constructors and destructor
       
    81 
       
    82         /**
       
    83         * Creates object from CIMSSettingsNoteUi and leaves it to cleanup stack
       
    84         * @since S60 3.0
       
    85         * @return, Constructed object
       
    86         */
       
    87         static CIMSSettingsNoteUi* NewLC(
       
    88             CImumInternalApiImpl& aEmailApi,
       
    89             CIMSSettingsBaseUI& aDialog );
       
    90 
       
    91         /**
       
    92         * Create object from CIMSSettingsNoteUi
       
    93         * @since S60 3.0
       
    94         * @return, Constructed object
       
    95         */
       
    96         static CIMSSettingsNoteUi* NewL(
       
    97             CImumInternalApiImpl& aEmailApi,
       
    98             CIMSSettingsBaseUI& aDialog );
       
    99 
       
   100         /**
       
   101         * Destructor
       
   102         * @since S60 3.0
       
   103         */
       
   104         virtual ~CIMSSettingsNoteUi();
       
   105 
       
   106     public: // New functions
       
   107 
       
   108         /**
       
   109         * Shows the query for user and waits for user answer.
       
   110         *
       
   111         * @since S60 3.0
       
   112         * @param aTextResource Resource string, that shall be shown in note
       
   113         * @param aDialogResource ResourceId of dialog, which shall be used
       
   114         *        Locate the resource dialogs from emailutils.ra
       
   115         * @param aTone Tone to be played with query
       
   116         *        Class CAknQueryDialog defines the TTone type, which contains
       
   117         *        following enumerations:
       
   118         *           - ENoTone
       
   119         *           - EConfirmationTone
       
   120         *           - EWarningTone
       
   121         *           - EErrorTone
       
   122         *        Example usage: CAknQueryDialog::EConfirmationTone
       
   123         * @return Command returned from the query
       
   124         */
       
   125         IMPORT_C static TInt ShowQueryL(
       
   126             const TUint aTextResource,
       
   127             const TInt  aDialogResource = R_EMAIL_CONFIRMATION_QUERY,
       
   128             const TBool& aClearBackground = EFalse,
       
   129             const CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone );
       
   130 
       
   131         IMPORT_C static TInt ShowQueryL(
       
   132             const TDesC& aText,
       
   133             const TInt  aDialogResource = R_EMAIL_CONFIRMATION_QUERY,
       
   134             const TBool& aClearBackground = EFalse,
       
   135             const CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone );
       
   136 
       
   137         /**
       
   138          * 
       
   139          *
       
   140          * @since S60 v3.2
       
   141          */    
       
   142         template<TInt TLength>    
       
   143         static inline TInt ShowQueryL(
       
   144             const TInt aTextResource,
       
   145             const TDesC& aAdditionalText,            
       
   146             const TInt aDialogResource = R_EMAIL_CONFIRMATION_QUERY,
       
   147             const TBool& aClearBackground = EFalse,
       
   148             const CAknQueryDialog::TTone& aTone = CAknQueryDialog::ENoTone );
       
   149             
       
   150 
       
   151         /**
       
   152         * This function fetches the text from given resource file and shows
       
   153         * the string found from it in small note box.
       
   154         * More info in file aknnotewrappers.h
       
   155         *
       
   156         * @since S60 3.0
       
   157         * @param aNoteType Type of note to be shown
       
   158         *        Avkon offers several type of notes, which differs from each
       
   159         *        other. There are following types of notes available:
       
   160         *           - EMsvConfirmationNote
       
   161         *           - EMsvInformationNote
       
   162         *           - EMsvErrorNote
       
   163         *           - EMsvWarningNote
       
   164         * @param aNoteWaiting Parameter to create the note
       
   165         *        When parameter is TRUE, created note will be waitnote
       
   166         *        When parameter is FALSE, note is not waitnote
       
   167         * @param aResource Resource string, that shall be shown in note
       
   168         * @param aFile File, from the string shall be read
       
   169         */
       
   170         IMPORT_C static void ShowNoteL(
       
   171             const TUint      aResource,
       
   172             const TIMSNotes& aNoteType = EIMSErrorNote,
       
   173             const TBool      aNoteWaiting = EFalse );
       
   174 
       
   175         IMPORT_C static void ShowNoteL(
       
   176             const TDesC&      aText,
       
   177             const TIMSNotes& aNoteType = EIMSErrorNote,
       
   178             const TBool      aNoteWaiting = EFalse );
       
   179 
       
   180         /**
       
   181         * @since S60 3.2
       
   182         */
       
   183         IMPORT_C static void ShowNoteL(
       
   184             const TUint aResource,
       
   185             TIMSNotes aNoteType,
       
   186             TBool aNoteWaiting,
       
   187             TInt aTimeOut
       
   188             );
       
   189 
       
   190         /**
       
   191         *
       
   192         * @since S60 3.0
       
   193         */
       
   194         static HBufC* MakeStringLC( const TUint aTextResource );
       
   195 
       
   196         /**
       
   197         *
       
   198         * @since S60 3.0
       
   199         */
       
   200         static void MakeString(
       
   201             TDes& aDest,
       
   202             TInt aResourceId,
       
   203             TInt aValue );
       
   204 
       
   205         /**
       
   206         *
       
   207         * @since S60 3.0
       
   208         */
       
   209         static void MakeStringL(
       
   210             TDes& aDest,
       
   211             TInt aResourceId,
       
   212             const TDesC& aSubs );
       
   213 
       
   214         /**
       
   215         *
       
   216         * @since S60 3.2
       
   217         */
       
   218         static void MakeString(
       
   219             TDes& aDest,
       
   220             const TDesC& aTag,
       
   221             const TDesC& aSubs );
       
   222 
       
   223         /**
       
   224         *
       
   225         * @since S60 3.0
       
   226         */
       
   227         static CAknInfoPopupNoteController* ShowPopupLC(
       
   228             const TInt aResource,
       
   229             const TInt aAfterMs,
       
   230             const TInt aPopupVisibleTime = KMaxVisibleTime );
       
   231 
       
   232         /**
       
   233         *
       
   234         * @since S60 3.0
       
   235         */
       
   236         static CAknInfoPopupNoteController* ShowPopupL(
       
   237             const TInt aResource,
       
   238             const TInt aAfterMs,
       
   239             const TInt aPopupVisibleTimeMs = KMaxVisibleTime );
       
   240 
       
   241         /**
       
   242         *
       
   243         * @since S60 3.0
       
   244         */
       
   245         TMuiuPageEventResult ShowDialog(
       
   246             const CMuiuSettingBase& aBaseItem,
       
   247             const TIMSErrors aError,
       
   248             const TDesC& aNewText );
       
   249 
       
   250     public: // Functions from base classes
       
   251 
       
   252     protected:  // Constructors
       
   253 
       
   254         /**
       
   255         * Default constructor for classCIMSSettingsNoteUi
       
   256         * @since S60 3.0
       
   257         * @return, Constructed object
       
   258         */
       
   259         CIMSSettingsNoteUi(
       
   260             CImumInternalApiImpl& aEmailApi,
       
   261             CIMSSettingsBaseUI& aDialog );
       
   262 
       
   263         /**
       
   264         * Symbian 2-phase constructor
       
   265         * @since S60 3.0
       
   266         */
       
   267         void ConstructL();
       
   268 
       
   269     protected:  // New virtual functions
       
   270     protected:  // New functions
       
   271     protected:  // Functions from base classes
       
   272 
       
   273     private:  // New virtual functions
       
   274     private:  // New functions
       
   275 
       
   276         /**
       
   277         *
       
   278         * @since S60 3.0
       
   279         */
       
   280         TMuiuPageEventResult ShowProtocolErrorNoteL(
       
   281             const TIMSErrors aError );
       
   282 
       
   283         /**
       
   284         *
       
   285         * @since S60 3.0
       
   286         */
       
   287         TMuiuPageEventResult ShowEmailAddressErrorNoteL(
       
   288             const TIMSErrors aError );
       
   289 
       
   290         /**
       
   291         *
       
   292         * @since S60 3.0
       
   293         */
       
   294         TMuiuPageEventResult ShowServerErrorNoteL(
       
   295             const TIMSErrors aError );
       
   296 
       
   297         /**
       
   298         *
       
   299         * @since S60 3.0
       
   300         */
       
   301         TMuiuPageEventResult ShowIapErrorNoteL(
       
   302             const TIMSErrors aError );
       
   303 
       
   304         /**
       
   305         *
       
   306         * @since S60 3.0
       
   307         */
       
   308         TMuiuPageEventResult ShowWizMailboxNameErrorNoteL(
       
   309             const TIMSErrors aError );
       
   310 
       
   311         /**
       
   312         *
       
   313         * @since S60 3.0
       
   314         */
       
   315         TBool ShowMailboxAlreadyExistsErrorNoteL(
       
   316             const TDesC& aMailboxName );
       
   317 
       
   318         /**
       
   319         *
       
   320         * @since S60 3.0
       
   321         */
       
   322         TMuiuPageEventResult ShowSetMailboxNameErrorNoteL(
       
   323             const TIMSErrors aError,
       
   324             const TDesC& aMailboxName );
       
   325 
       
   326         /**
       
   327         *
       
   328         * @since S60 3.0
       
   329         */
       
   330         TMuiuPageEventResult ShowProtocolReadOnlyErrorNoteL(
       
   331             const TIMSErrors aError );
       
   332 
       
   333         /**
       
   334         *
       
   335         * @since S60 3.0
       
   336         */
       
   337         TMuiuPageEventResult ShowAlwaysOnlineErrorNoteL(
       
   338             const TIMSErrors aError );
       
   339 
       
   340         /**
       
   341         *
       
   342         * @since S60 3.0
       
   343         */
       
   344         TMuiuPageEventResult ShowAoCsdIapError();
       
   345 
       
   346         /**
       
   347         *
       
   348         * @since S60 3.0
       
   349         */
       
   350         TMuiuPageEventResult ShowAlwaysOnlineRemovalQueryL(
       
   351             const TIMSErrors aError );
       
   352 
       
   353         /**
       
   354         *
       
   355         * @since S60 3.0
       
   356         */
       
   357         TMuiuPageEventResult ShowFetchLimitErrorNoteL(
       
   358             const TIMSErrors aError );
       
   359             
       
   360             
       
   361         /**
       
   362         * Selects which dialog to show based on aBaseItem
       
   363         * @param aBaseItem determines which note should be shown
       
   364         * @param aError tells what error has occurred
       
   365         * @return users answer
       
   366         * @since S60 3.2
       
   367         */
       
   368         TMuiuPageEventResult SelectDialogL( 
       
   369            const CMuiuSettingBase& aBaseItem,
       
   370            const TIMSErrors aError,
       
   371            const TDesC& aNewText );
       
   372 
       
   373         /**
       
   374         * @since S60 3.2
       
   375         */
       
   376         static CAknResourceNoteDialog* NewNoteL( TIMSNotes aNoteType,
       
   377             TBool aNoteWaiting );
       
   378         
       
   379         /**
       
   380          * Removes a screen clearer from the stack if a leave occurs.
       
   381          * @param aScreenClearer ScreenClearer pointer.
       
   382          */
       
   383         static void ScreenClearerCleanupOperation( TAny* aScreenClearer );
       
   384 
       
   385     private:  // Functions from base classes
       
   386 
       
   387     public:     // Data
       
   388     protected:  // Data
       
   389     private:    // Data
       
   390 
       
   391         // Dialog that owns the notification UI
       
   392         CIMSSettingsBaseUI&     iDialog;
       
   393         // Internal mail API implementation
       
   394         CImumInternalApiImpl&       iMailboxApi;
       
   395     };
       
   396 
       
   397 #include "IMSSettingsNoteUi.inl"
       
   398 
       
   399 #endif // IMSSETTINGSNOTEUI_H