email/imum/Mtms/Inc/SmtpMtmUi.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60: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: 
       
    15 *       SMTP MTM UI
       
    16 *
       
    17 */
       
    18 
       
    19 // MODULE - SMTP MTM UI
       
    20 
       
    21 #ifndef __SMTPMTMUI_H__
       
    22 #define __SMTPMTMUI_H__
       
    23 
       
    24 #include <smtpset.h>
       
    25 #include <AlwaysOnlineManagerClient.h>
       
    26 #include "IMSSettingsUi.h"
       
    27 #include "PROGTYPE.H"
       
    28 #include "ImumMtmBaseMtmUi.h"   // CImumMtmBaseMtmUi
       
    29 #include <msvapi.h>
       
    30 
       
    31 // Forward references
       
    32 class CErrorUI;
       
    33 class CEmailPreCreation;
       
    34 class CClientMtmRegistry;
       
    35 class TEditorParameters;
       
    36 
       
    37 /**
       
    38 * CSmtpMtmUi - SMTP MTM UI
       
    39 */
       
    40 class CSmtpMtmUi : public CImumMtmBaseMtmUi
       
    41     {
       
    42     public:
       
    43         enum TSmtpMtmUiOperations
       
    44             {
       
    45             ESmtpMtmUiEditing=EUiProgTypeEditing
       
    46             };
       
    47 
       
    48     private:
       
    49         enum TSmtpMtmUiCreateNewServiceParameters
       
    50             {
       
    51             ESmtpMtmUiCreateNewServiceSave,
       
    52             ESmtpMtmUiCreateNewServiceExit,
       
    53             ESmtpMtmUiCreateNewServiceSaveAndExit,
       
    54             ESmtpMtmUiCreateNewServiceNotCreated
       
    55             };
       
    56 
       
    57     public:
       
    58         /**
       
    59         *
       
    60         */
       
    61         static CSmtpMtmUi* NewL(
       
    62             CBaseMtm& aBaseMtm,
       
    63             CRegisteredMtmDll& aRegisteredMtmDll );
       
    64 
       
    65         /**
       
    66         * Destructor
       
    67         */
       
    68         virtual ~CSmtpMtmUi();
       
    69 
       
    70         /**
       
    71         * From CBaseMtmUi
       
    72         * Function NOT dependent on the current context
       
    73         */
       
    74         virtual CMsvOperation* CreateL(
       
    75             const TMsvEntry& aEntry,
       
    76             CMsvEntry& aParent,
       
    77             TRequestStatus& aStatus );
       
    78 
       
    79         /**
       
    80         * From CBaseMtmUi
       
    81         * Context-specific
       
    82         */
       
    83         virtual CMsvOperation* OpenL( TRequestStatus& aStatus );
       
    84 
       
    85         /**
       
    86         * From CBaseMtmUi
       
    87         * Context-specific
       
    88         */
       
    89         virtual CMsvOperation* CloseL( TRequestStatus& aStatus );
       
    90 
       
    91         /**
       
    92         * From CBaseMtmUi
       
    93         * Context-specific
       
    94         * Launches editor/settings dialog as appropriate
       
    95         */
       
    96         virtual CMsvOperation* EditL(TRequestStatus& aStatus);
       
    97 
       
    98         /**
       
    99         * From CBaseMtmUi
       
   100         * Context-specific
       
   101         * Launches viewer/settings dialog as appropriate
       
   102         */
       
   103         virtual CMsvOperation* ViewL(TRequestStatus& aStatus);
       
   104 
       
   105         /**
       
   106         * From CBaseMtmUi
       
   107         * Context-specific
       
   108         * Takes ownership of the passed entry (which the context is switched to )
       
   109         */
       
   110         virtual CMsvOperation* ReplyL(
       
   111             TMsvId aDestination,
       
   112             TMsvPartList aPartlist,
       
   113             TRequestStatus& aCompletionStatus );
       
   114 
       
   115         /**
       
   116         * From CBaseMtmUi
       
   117         * Context-specific
       
   118         * Takes ownership of the passed entry (which the context is switched to )
       
   119         */
       
   120         virtual CMsvOperation* ForwardL(
       
   121             TMsvId aDestination,
       
   122             TMsvPartList aPartList,
       
   123             TRequestStatus& aCompletionStatus );
       
   124 
       
   125         /**
       
   126         * From CBaseMtmUi
       
   127         * Context-specific
       
   128         * Selections must be in same folder and all of the correct MTM type
       
   129         * Context may change after calling these functions
       
   130         */
       
   131         virtual CMsvOperation* OpenL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection);
       
   132 
       
   133         /**
       
   134         * From CBaseMtmUi
       
   135         * Context-specific
       
   136         * Selections must be in same folder and all of the correct MTM type
       
   137         * Context may change after calling these functions
       
   138         */
       
   139         virtual CMsvOperation* CloseL(
       
   140             TRequestStatus& aStatus,
       
   141             const CMsvEntrySelection& aSelection );
       
   142 
       
   143         /**
       
   144         * From CBaseMtmUi
       
   145         * Context-specific
       
   146         * Selections must be in same folder and all of the correct MTM type
       
   147         * Context may change after calling these functions
       
   148         * Calls EditL for the first item of the selection.
       
   149         */
       
   150         virtual CMsvOperation* EditL(
       
   151             TRequestStatus& aStatus,
       
   152             const CMsvEntrySelection& aSelection );
       
   153 
       
   154         /**
       
   155         * From CBaseMtmUi
       
   156         * Context-specific
       
   157         * Selections must be in same folder and all of the correct MTM type
       
   158         * Context may change after calling these functions
       
   159         * Calls ViewL for the first item of the selection.
       
   160         */
       
   161         virtual CMsvOperation* ViewL(
       
   162             TRequestStatus& aStatus,
       
   163             const CMsvEntrySelection& aSelection );
       
   164 
       
   165         /**
       
   166         * From CBaseMtmUi
       
   167         * Context-specific
       
   168         * Selections must be in same folder and all of the correct MTM type
       
   169         * Context may change after calling these functions
       
   170         * Cancels sending of the selection by creating object of
       
   171         * CSmtpCancelSendingOp class
       
   172         */
       
   173         virtual CMsvOperation* CancelL(
       
   174             TRequestStatus& aStatus,
       
   175             const CMsvEntrySelection& aSelection );
       
   176 
       
   177         /**
       
   178         * From CBaseMtmUi
       
   179         * Context-specific
       
   180         * Context should be MTM folder/service to copy to
       
   181         */
       
   182         virtual CMsvOperation* CopyToL(
       
   183             const CMsvEntrySelection& aSelection,
       
   184             TRequestStatus& aStatus );
       
   185 
       
   186         /**
       
   187         * From CBaseMtmUi
       
   188         * Context-specific
       
   189         * Context should be MTM folder/service to move to
       
   190         */
       
   191         virtual CMsvOperation* MoveToL(
       
   192             const CMsvEntrySelection& aSelection,
       
   193             TRequestStatus& aStatus );
       
   194 
       
   195         /**
       
   196         * From CBaseMtmUi
       
   197         * Context-specific
       
   198         * Context should be MTM folder/service to copy from
       
   199         */
       
   200         virtual CMsvOperation* CopyFromL(
       
   201             const CMsvEntrySelection& aSelection,
       
   202             TMsvId aTargetId,
       
   203             TRequestStatus& aStatus );
       
   204 
       
   205         /**
       
   206         * From CBaseMtmUi
       
   207         * Context-specific
       
   208         * Context should be MTM folder/service to move from
       
   209         */
       
   210         virtual CMsvOperation* MoveFromL(
       
   211             const CMsvEntrySelection& aSelection,
       
   212             TMsvId aTargetId,
       
   213             TRequestStatus& aStatus );
       
   214 
       
   215         /**
       
   216         * From CBaseMtmUi
       
   217         * Interpret transfer progress
       
   218         */
       
   219         virtual TInt DisplayProgressSummary(
       
   220             const TDesC8& aProgress ) const;
       
   221 
       
   222         /**
       
   223         * From CBaseMtmUi
       
   224         * Interpret transfer progress
       
   225         */
       
   226         virtual TInt GetProgress(
       
   227             const TDesC8& aProgress,
       
   228             TBuf<EProgressStringMaxLen>& aReturnString,
       
   229             TInt& aTotalEntryCount,
       
   230             TInt& aEntriesDone,
       
   231             TInt& aCurrentEntrySize,
       
   232             TInt& aCurrentBytesTrans ) const;
       
   233 
       
   234         /**
       
   235         * From CBaseMtmUi
       
   236         */
       
   237         virtual TInt QueryCapability( TUid aCapability, TInt& aResponse );
       
   238 
       
   239         /**
       
   240         * From CBaseMtmUi
       
   241         */
       
   242         virtual void InvokeSyncFunctionL(
       
   243             TInt aFunctionId,
       
   244             const CMsvEntrySelection& aSelection,
       
   245             TDes8& aParameter );
       
   246 
       
   247         /**
       
   248         * From CBaseMtmUi
       
   249         */
       
   250         virtual CMsvOperation* InvokeAsyncFunctionL(
       
   251             TInt aFunctionId,
       
   252             const CMsvEntrySelection& aSelection,
       
   253             TRequestStatus& aCompletionStatus,
       
   254             TDes8& aParameter );
       
   255 
       
   256     protected:
       
   257 
       
   258         /**
       
   259         * From CBaseMtmUi
       
   260         */
       
   261         virtual void ConstructL();
       
   262 
       
   263         /**
       
   264         * From CBaseMtmUi
       
   265         */
       
   266         virtual void GetResourceFileName( TFileName& aFileName ) const;
       
   267 
       
   268     private:
       
   269         /**
       
   270         * C++ constructor
       
   271         */
       
   272         CSmtpMtmUi(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll);
       
   273 
       
   274         /**
       
   275         *
       
   276         */
       
   277         CMsvOperation* LaunchSettingsDialogL( TRequestStatus& aStatus );
       
   278 
       
   279         /**
       
   280         *
       
   281         */
       
   282         CMsvOperation* LaunchEditorApplicationL(
       
   283             TRequestStatus& aStatus,
       
   284             TBool aReadOnly,
       
   285             TBool aNewMsg,
       
   286             CMsvSession& aSession,
       
   287             TMsvId aNewMsgServiceId = KMsvNullIndexEntryIdValue );
       
   288 
       
   289         /**
       
   290         * Explicit send of a message.
       
   291         */
       
   292         CMsvOperation* DoCopyMoveToL(
       
   293             const CMsvEntrySelection& aSelection,
       
   294             TRequestStatus& aStatus,
       
   295             TBool aMoving );
       
   296 
       
   297         /**
       
   298         *
       
   299         */
       
   300         TMsvId CreateNewServiceL( const TMsvEntry& aEntry, TSmtpMtmUiCreateNewServiceParameters& aSaveParameters );
       
   301 
       
   302         /**
       
   303         *
       
   304         */
       
   305         TMsvId HandleNoAccountsL( TSmtpMtmUiCreateNewServiceParameters& aSaveParameters );
       
   306 
       
   307         /**
       
   308         *
       
   309         */
       
   310         void ResolveEditorFileNameL();
       
   311 
       
   312         /**
       
   313         *
       
   314         */
       
   315         void ResolveViewerFileNameL();
       
   316 
       
   317         /**
       
   318         * Finds out name of the remote mailbox
       
   319         */
       
   320         HBufC* GetMailboxNameL( TMsvId aServiceId ) const;
       
   321 
       
   322         /**
       
   323         *
       
   324         */
       
   325         TInt GetConnectionProgress(
       
   326             const TDesC8& aProgress,
       
   327             TBuf<EProgressStringMaxLen>& aReturnString ) const;
       
   328 
       
   329         /**
       
   330         * Draft implementation. Not used yet.
       
   331         * Creates predefined mailboxes on startup or restore factorysettings.
       
   332         */
       
   333         void HandlePredefinedMailboxCreationL( );
       
   334 
       
   335         /**
       
   336         * Shows message info dialog
       
   337         * Context should be the message which info is displayed.
       
   338         */
       
   339         CMsvOperation* ShowMessageInfoL(
       
   340             TRequestStatus& aCompletionStatus,
       
   341             TDes8& aParameter );
       
   342 
       
   343         /**
       
   344         * Checks if aServiceId exists. If not then checks if there are any default
       
   345         * services and if no services asks user to create one.
       
   346         * This is used before launching mail editor.
       
   347         * @param aServiceId: service id to be checked.
       
   348         *    Fills new service id if that service does not exists or new service is created.
       
   349         * @return ETrue if service exists, EFalse if no mail services
       
   350         */
       
   351         TBool CheckMailboxesBeforeEditL(
       
   352             TMsvId& aServiceId,
       
   353             TSmtpMtmUiCreateNewServiceParameters& aSaveParameters );
       
   354 
       
   355         /**
       
   356         * smtp auth fix 23092002
       
   357         * Checks if SMTP has username and password set. If not, they are copied from
       
   358         * mailbox ( pop or imap )
       
   359         * This function should be used only with smtp auth implementation where we use
       
   360         * the same username and password as in mailbox settings.
       
   361         * If and when SMTP has it's own u&p in settings, this function SHOULD be removed.
       
   362         */
       
   363         void CheckAndRestoreSmtpUserAndPasswordL( TMsvId aSmtpService );
       
   364 
       
   365         /**
       
   366         * Validate service function to be used by InvokeAsyncFunction
       
   367         * Checks that a default mailbox exists and that it has access point set.
       
   368         * @param TDes8& result of validation will be set into this parameter. KErrNone
       
   369         * or and error which occurred, usually KErrNotFound
       
   370         */
       
   371         void ValidateServiceL( TDes8& aParameter );
       
   372 
       
   373         /**
       
   374          * 
       
   375          * @since S60 3.2
       
   376          * @param aSelection
       
   377          * @param aParameter
       
   378          */
       
   379         void ValidateServiceL( 
       
   380             const CMsvEntrySelection& aSelection, 
       
   381             TDes8& aParameter );
       
   382             
       
   383         /**
       
   384          * 
       
   385          * @since S60 3.2
       
   386          * @param aMailboxId
       
   387          * @param aParameter
       
   388          */
       
   389         void DoValidateServiceL( 
       
   390             const TMsvId aMailboxId, 
       
   391             TDes8& aParameter );
       
   392 
       
   393         /**
       
   394         *
       
   395         */
       
   396         CMsvOperation* DoExitL(
       
   397             TRequestStatus& aStatus,
       
   398             const TBool aIssueQuit = ETrue );
       
   399 
       
   400         /**
       
   401         *
       
   402         * @since S60 3.0
       
   403         */
       
   404         TBool SettingsDialogExitL(
       
   405             CImumInSettingsData& aSettings,
       
   406             const TImumUiExitCodes& aExitCode );
       
   407 
       
   408         /**
       
   409         *
       
   410         * @since S60 3.0
       
   411         */
       
   412         void SettingsDialogExitSaveAndExitL(
       
   413             CImumInSettingsData& aSettings );
       
   414 
       
   415         /**
       
   416         *
       
   417         * @since S60 3.0
       
   418         */
       
   419         CMsvOperation* PrepareCommandL(
       
   420             TEditorParameters& aParameters,
       
   421             TMsvId aDestination,
       
   422             TMsvPartList aPartlist,
       
   423             TRequestStatus& aCompletionStatus );
       
   424 
       
   425         /**
       
   426         *
       
   427         * @since S60 3.0
       
   428         */
       
   429         CMsvOperation* CreateExecutePreCreationL(
       
   430             const TMsvId aSmtpService, 
       
   431             TRequestStatus& aStatus ) const;
       
   432 
       
   433         /**
       
   434         *
       
   435         * @since S60 3.0
       
   436         */
       
   437         CMsvOperation* CreateEmailServiceL(
       
   438             const TMsvEntry& aEntry,
       
   439             TRequestStatus& aStatus );
       
   440 
       
   441         /**
       
   442         *
       
   443         * @since S60 3.0
       
   444         */
       
   445         void ChangeUnreadFlagL(
       
   446             const TMsvId aEmailId,
       
   447             const TBool aNewState );
       
   448             
       
   449         /**
       
   450          * 
       
   451          * @since S60 3.2
       
   452          * @param 
       
   453          * @return 
       
   454          * @leave &(leavedesc)s
       
   455          */
       
   456         TSmtpMtmUiCreateNewServiceParameters SaveParams(
       
   457             const TImumUiExitCodes& aUiExitCode );
       
   458         
       
   459         /**
       
   460          * Activates rigth view after mailbox creation
       
   461          *
       
   462          * @since S60 3.2
       
   463          * @param aExitCode: how wizard exited and what view should be active
       
   464          * @param aId: the id of the mailbox that should be opened
       
   465          */
       
   466         void ActivateViewL(
       
   467             TImumUiExitCodes aExitCode,
       
   468             TMsvId aId );
       
   469         
       
   470         /**
       
   471          * Removes a screen clearer from the stack if a leave occurs.
       
   472          * @param aScreenClearer ScreenClearer pointer.
       
   473          */
       
   474         static void ScreenClearerCleanupOperation( TAny* aScreenClearer );
       
   475 
       
   476     private:
       
   477         // --- Data ---
       
   478         HBufC*                      iEditorFilename;
       
   479         HBufC*                      iViewerFilename;
       
   480         CEmailPreCreation*          iPreCreate;        
       
   481         TBool                       iNewSecureSettingOn;
       
   482         RAlwaysOnlineClientSession  iAOClient;        
       
   483     };
       
   484 
       
   485 #endif // __SMTPMTMUI_H__