email/imum/Mtms/Inc/Imap4MtmUi.h
changeset 0 72b543305e3a
child 16 fa7d37e3fdf4
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: 
       
    15 *       CImap4MtmUi - IMAP4 MTM UI
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __IMAP4MTMUI_H__
       
    20 #define __IMAP4MTMUI_H__
       
    21 
       
    22 #include <imapset.h>
       
    23 #include <mtmuibas.h>
       
    24 #include <eikdialg.h>
       
    25 #include <MsvPrgReporter.h>
       
    26 #include "ImumMtmBaseMtmUi.h"   // CImumMtmBaseMtmUi
       
    27 
       
    28 // forward declarations
       
    29 class CErrorUI;
       
    30 class TEditorParameters;
       
    31 class CMsvProgressReporterOperation;
       
    32 class CImap4ClientMtm;
       
    33 class CMuiuFlags;
       
    34 
       
    35 /**
       
    36 * CImap4MtmUi - IMAP4 MTM UI
       
    37 */
       
    38 class CImap4MtmUi : public CImumMtmBaseMtmUi
       
    39     {
       
    40     public:
       
    41         /**
       
    42         *
       
    43         */
       
    44         static CImap4MtmUi* NewL(
       
    45             CBaseMtm& aBaseMtm,
       
    46             CRegisteredMtmDll& aRegisteredMtmDll);
       
    47 
       
    48         /**
       
    49         * Destructor
       
    50         */
       
    51         virtual ~CImap4MtmUi();
       
    52 
       
    53         /**
       
    54         * From CBaseMtmUi
       
    55         * Function NOT dependent on the current context
       
    56         * Context set to new entry
       
    57         */
       
    58         virtual CMsvOperation* CreateL(
       
    59             const TMsvEntry& aEntry,
       
    60             CMsvEntry& aParent,
       
    61             TRequestStatus& aStatus);
       
    62 
       
    63         /**
       
    64         * From CBaseMtmUi
       
    65         * Context-specific
       
    66         */
       
    67         virtual CMsvOperation* OpenL(TRequestStatus& aStatus);
       
    68 
       
    69         /**
       
    70         * From CBaseMtmUi
       
    71         * Context-specific
       
    72         */
       
    73         virtual CMsvOperation* CloseL(TRequestStatus& aStatus);
       
    74 
       
    75         /**
       
    76         * From CBaseMtmUi
       
    77         * Context-specific
       
    78         */
       
    79         virtual CMsvOperation* EditL(TRequestStatus& aStatus);
       
    80 
       
    81         /**
       
    82         * From CBaseMtmUi
       
    83         * Context-specific
       
    84         */
       
    85         virtual CMsvOperation* ViewL(TRequestStatus& aStatus);
       
    86 
       
    87         /**
       
    88         * From CBaseMtmUi
       
    89         * Context-specific
       
    90         */
       
    91         virtual CMsvOperation* CancelL(
       
    92             TRequestStatus& aStatus,
       
    93             const CMsvEntrySelection& aSelection);
       
    94 
       
    95         /**
       
    96         * From CBaseMtmUi
       
    97         * Deletes entries from the current context, which must be a folder or service of the relevant MTM
       
    98         */
       
    99         virtual CMsvOperation* DeleteFromL(
       
   100             const CMsvEntrySelection& aSelection,
       
   101             TRequestStatus& aStatus);
       
   102 
       
   103         /**
       
   104         * From CBaseMtmUi
       
   105         * Un-deletes entries from the current context, which must be a folder or service of the relevant MTM
       
   106         */
       
   107         virtual CMsvOperation* UnDeleteFromL(
       
   108             const CMsvEntrySelection& aSelection,
       
   109             TRequestStatus& aStatus);
       
   110 
       
   111         /**
       
   112         * From CBaseMtmUi
       
   113         * Selections must be in same folder and all of the correct MTM type
       
   114         * Context may change after calling these functions
       
   115         */
       
   116         virtual CMsvOperation* OpenL(
       
   117             TRequestStatus& aStatus,
       
   118             const CMsvEntrySelection& aSelection);
       
   119 
       
   120         /**
       
   121         * From CBaseMtmUi
       
   122         * Selections must be in same folder and all of the correct MTM type
       
   123         * Context may change after calling these functions
       
   124         */
       
   125         virtual CMsvOperation* CloseL(
       
   126             TRequestStatus& aStatus,
       
   127             const CMsvEntrySelection& aSelection);
       
   128 
       
   129         /**
       
   130         * From CBaseMtmUi
       
   131         * Selections must be in same folder and all of the correct MTM type
       
   132         * Context may change after calling these functions
       
   133         */
       
   134         virtual CMsvOperation* EditL(
       
   135             TRequestStatus& aStatus,
       
   136             const CMsvEntrySelection& aSelection);
       
   137 
       
   138         /**
       
   139         * From CBaseMtmUi
       
   140         * Selections must be in same folder and all of the correct MTM type
       
   141         * Context may change after calling these functions
       
   142         */
       
   143         virtual CMsvOperation* ViewL(
       
   144             TRequestStatus& aStatus,
       
   145             const CMsvEntrySelection& aSelection);
       
   146 
       
   147         /**
       
   148         * From CBaseMtmUi
       
   149         */
       
   150         virtual TInt QueryCapability(TUid aCapability, TInt& aResponse);
       
   151 
       
   152         /**
       
   153         * From CBaseMtmUi
       
   154         */
       
   155         virtual CMsvOperation* InvokeAsyncFunctionL(
       
   156             TInt aFunctionId,
       
   157             const CMsvEntrySelection& aSelection,
       
   158             TRequestStatus& aCompletionStatus,
       
   159             TDes8& aParameter);
       
   160 
       
   161         /**
       
   162         * From CBaseMtmUi
       
   163         */
       
   164         virtual void InvokeSyncFunctionL(
       
   165             TInt aFunctionId,
       
   166             const CMsvEntrySelection& aSelection,
       
   167             TDes8& aParameter);
       
   168 
       
   169         /**
       
   170         * From CBaseMtmUi
       
   171         * Context should be MTM folder/service to copy to
       
   172         */
       
   173         virtual CMsvOperation* CopyToL(
       
   174             const CMsvEntrySelection& aSelection,
       
   175             TRequestStatus& aStatus);
       
   176 
       
   177         /**
       
   178         * From CBaseMtmUi
       
   179         * Context should be MTM folder/service to move to
       
   180         */
       
   181         virtual CMsvOperation* MoveToL(
       
   182             const CMsvEntrySelection& aSelection,
       
   183             TRequestStatus& aStatus);
       
   184 
       
   185         /**
       
   186         * From CBaseMtmUi
       
   187         * Context should be MTM folder/service to copy from
       
   188         */
       
   189         virtual CMsvOperation* CopyFromL(
       
   190             const CMsvEntrySelection& aSelection,
       
   191             TMsvId aTargetId,
       
   192             TRequestStatus& aStatus);
       
   193 
       
   194         /**
       
   195         * From CBaseMtmUi
       
   196         * Context should be MTM folder/service to move from
       
   197         */
       
   198         virtual CMsvOperation* MoveFromL(
       
   199             const CMsvEntrySelection& aSelection,
       
   200             TMsvId aTargetId,
       
   201             TRequestStatus& aStatus);
       
   202 
       
   203         /**
       
   204         * From CBaseMtmUi
       
   205         * Context-specific
       
   206         * Takes ownership of the passed entry (which the context is switched to )
       
   207         */
       
   208         virtual CMsvOperation* ReplyL(
       
   209             TMsvId aDestination,
       
   210             TMsvPartList aPartlist,
       
   211             TRequestStatus& aCompletionStatus);
       
   212 
       
   213         /**
       
   214         * From CBaseMtmUi
       
   215         * Context-specific
       
   216         * Takes ownership of the passed entry (which the context is switched to )
       
   217         */
       
   218         virtual CMsvOperation* ForwardL(
       
   219             TMsvId aDestination,
       
   220             TMsvPartList aPartList,
       
   221             TRequestStatus& aCompletionStatus);
       
   222 
       
   223         /**
       
   224         * From CBaseMtmUi
       
   225         * Interpret transfer progress
       
   226         */
       
   227         virtual TInt GetProgress(
       
   228             const TDesC8& aProgress,
       
   229             TBuf<EProgressStringMaxLen>& aReturnString,
       
   230             TInt& aTotalEntryCount,
       
   231             TInt& aEntriesDone,
       
   232             TInt& aCurrentEntrySize,
       
   233             TInt& aCurrentBytesTrans) const;
       
   234 
       
   235         /**
       
   236         * From CBaseMtmUi
       
   237         * Interpret transfer progress
       
   238         */
       
   239         virtual TInt DisplayProgressSummary(
       
   240             const TDesC8& aProgress) const;
       
   241 
       
   242         /**
       
   243         *
       
   244         */
       
   245         CMsvOperation* LaunchMultipleEditorApplicationsL(
       
   246             const CMsvEntrySelection& aSelection,
       
   247             TRequestStatus& aStatus);
       
   248 
       
   249         /**
       
   250         *
       
   251         */
       
   252         CMsvOperation* LaunchEditorApplicationL(TRequestStatus& aStatus);
       
   253 
       
   254         /**
       
   255         *
       
   256         */
       
   257         CMsvOperation* LaunchEditorApplicationL(
       
   258             TRequestStatus& aStatus,
       
   259             const TEditorParameters& aParams);
       
   260 
       
   261     public:
       
   262         /**
       
   263         *
       
   264         */
       
   265         inline CImap4ClientMtm* Imap4BaseMtm() const;
       
   266 
       
   267         /**
       
   268         *
       
   269         */
       
   270         TMsvId TrueServiceIdOfEntryL(TMsvId aEntryId);
       
   271 
       
   272     protected:
       
   273         /**
       
   274         *
       
   275         */
       
   276         TBool IsConnected(const TMsvId aService) const;
       
   277 
       
   278         /**
       
   279         *
       
   280         */
       
   281         CMsvEntrySelection* SingleEntrySelectionLC(TMsvId aId) const;
       
   282 
       
   283         /**
       
   284         *
       
   285         */
       
   286         TMsvId SelectionContainsInboxL(
       
   287             const CMsvEntry& aParentEntry,
       
   288             const CMsvEntrySelection& aSelection) const;
       
   289 
       
   290         /**
       
   291         *
       
   292         */
       
   293         TBool SelectionContainsGhostEntryL(
       
   294             const CMsvEntry& aParentEntry,
       
   295             const CMsvEntrySelection& aSelection);
       
   296 
       
   297         /**
       
   298         *
       
   299         */
       
   300         TBool SelectionContainsOnlyMessagesL(
       
   301             const CMsvEntry& aParentEntry,
       
   302             const CMsvEntrySelection& aSelection) const;
       
   303 
       
   304         /**
       
   305         *
       
   306         */
       
   307         CMsvOperation* EditImap4ServiceL(
       
   308             TRequestStatus& aStatus,
       
   309             TMsvId aServiceEntry);
       
   310 
       
   311         /**
       
   312         *
       
   313         */
       
   314         HBufC* GetEditorFileNameL();
       
   315 
       
   316         /**
       
   317         *
       
   318         */
       
   319         HBufC* GetViewerFileNameL();
       
   320 
       
   321         /**
       
   322         *
       
   323         */
       
   324         TBool WithinIMAPInboxL(TMsvId aEntry);
       
   325 
       
   326         /**
       
   327         *
       
   328         */
       
   329         CMsvOperation* CopyMoveToL(
       
   330             const CMsvEntrySelection& aSelection,
       
   331             TRequestStatus& aStatus,
       
   332             TBool aCopy);
       
   333 
       
   334         /**
       
   335         *
       
   336         */
       
   337         CMsvOperation* ForwardOrReplyL(
       
   338             TMsvPartList aPartlist,
       
   339             TMsvId aDestination,
       
   340             TRequestStatus& aCompletionStatus,
       
   341             TBool aForward);
       
   342 
       
   343         /**
       
   344         *
       
   345         */
       
   346         CMsvEntrySelection* StripInvalidEntriesLC(
       
   347             const CMsvEntrySelection& aSelection) const;
       
   348 
       
   349         /**
       
   350         *
       
   351         */
       
   352         CMsvEntrySelection* StripBodyTextCompleteEntriesLC(
       
   353             const CMsvEntrySelection& aSelection) const;
       
   354 
       
   355         /**
       
   356         *
       
   357         */
       
   358         CMsvEntrySelection* StripCompleteEntriesLC(
       
   359             const CMsvEntrySelection& aSelection) const;
       
   360 
       
   361         /**
       
   362         *
       
   363         */
       
   364         void ValidateFolderNameL(
       
   365             const TDesC& aName,
       
   366             TDes8& aRetProgress);
       
   367 
       
   368         /**
       
   369         *
       
   370         */
       
   371         CMsvOperation* DeleteFoldersFromL(
       
   372             const CMsvEntrySelection& aSelection,
       
   373             TRequestStatus& aStatus,
       
   374             TMsvId aService,
       
   375             TBool aOnline);
       
   376 
       
   377         /**
       
   378         *
       
   379         */
       
   380         void CheckSelectionL(const CMsvEntrySelection& aSelection) const;
       
   381 
       
   382         /**
       
   383         *
       
   384         */
       
   385         void CheckEntryL(const TMsvEntry& aEntry) const;
       
   386 
       
   387         /**
       
   388         *
       
   389         */
       
   390         CMsvOperation* CompletedImap4OperationL(
       
   391             TMsvId aServiceId,
       
   392             TRequestStatus& aStatus);
       
   393 
       
   394 
       
   395         /**
       
   396         *
       
   397         */
       
   398         CMsvOperation* FetchMessagesL(
       
   399             TRequestStatus& aStatus,
       
   400             const CMsvEntrySelection& aSelection,
       
   401             TInt aFunctionId,
       
   402             TImImap4GetMailInfo& aGetMailInfo);
       
   403 
       
   404         /**
       
   405         * Initialises the parameters for Fetch New, Fetch All or Fetch Selected.
       
   406         * @param aSelection: array of messages to be selected
       
   407         * @param aGetMailInfo: get mail info to be filled
       
   408         * @param aInsertParentFolder: ETrue if parent needs to be inserted at the beginning of the array, Fetch New and Fetch All need that
       
   409         */
       
   410         void InitParametersForFetchCmdL(
       
   411             CMsvEntrySelection* aSelection,
       
   412             TImImap4GetMailInfo& aGetMailInfo,
       
   413             TBool aInsertParentFolder = ETrue ) const;
       
   414 
       
   415 
       
   416         /**
       
   417         *
       
   418         */
       
   419         void InitParametersForGetMailCmdL(
       
   420             CMsvEntrySelection& aSelection,
       
   421             TImImap4GetMailInfo& aGetMailInfo);
       
   422 
       
   423         /**
       
   424         *
       
   425         */
       
   426         TInt PopulateMessagesSyncL(const CMsvEntrySelection& aSelection);
       
   427 
       
   428         /**
       
   429         *
       
   430         */
       
   431         CMsvOperation* OpenMessageL(
       
   432             TRequestStatus& aCompletionStatus,
       
   433             const TEditorParameters& aEditorParams);
       
   434 
       
   435         /**
       
   436         *
       
   437         */
       
   438         CMsvOperation* PopulateMessagesL(
       
   439             TRequestStatus& aCompletionStatus,
       
   440             const CMsvEntrySelection& aSel);
       
   441 
       
   442         /**
       
   443         *
       
   444         */
       
   445         CMsvOperation* DoPopulateIncompleteMessageL(
       
   446             TRequestStatus& aStatus,
       
   447             const CMsvEntrySelection& aSel,
       
   448             const TEditorParameters& aEditorParams);
       
   449 
       
   450         /**
       
   451         *
       
   452         */
       
   453         CMsvOperation* InvokeRemoteFetchOpL(
       
   454             CMsvProgressReporterOperation& aReporter,
       
   455             TRequestStatus& aCompletionStatus,
       
   456             const CMsvEntrySelection& aSel,
       
   457             TInt aFunctionId,
       
   458             const TImImap4GetMailInfo& aGetMailInfo);
       
   459 
       
   460         /**
       
   461         *
       
   462         */
       
   463         CMsvOperation* InvokeCopyMoveOpL(
       
   464             CMsvProgressReporterOperation& aReporter,
       
   465             TRequestStatus& aCompletionStatus,
       
   466             const CMsvEntrySelection& aSel,
       
   467             TMsvId aTargetId,
       
   468             TBool aCopy);
       
   469 
       
   470     protected:
       
   471 
       
   472         /**
       
   473         * from CBaseMtmUi
       
   474         */
       
   475         virtual void GetResourceFileName(TFileName& aFileName) const;
       
   476 
       
   477     private:
       
   478 
       
   479         /**
       
   480         *
       
   481         */
       
   482         TBool RemoteLinkAbort();
       
   483 
       
   484         // --- Service state checking utilities
       
   485         enum TImapServiceInformationFlags
       
   486             {
       
   487             EIsIdle=0x0001,
       
   488             EIsDisconnected=0x0002,
       
   489             EIsConnecting=0x0004,
       
   490             EIsDisconnecting=0x0008,
       
   491             EIsLoaded=0x0010
       
   492             };
       
   493 
       
   494         /**
       
   495         *
       
   496         */
       
   497         inline TBool ServiceIsIdle(TInt aFlags) const;
       
   498 
       
   499         /**
       
   500         *
       
   501         */
       
   502         inline TBool ServiceIsDisconnected(TInt aFlags) const;
       
   503 
       
   504         /**
       
   505         *
       
   506         */
       
   507         inline TBool ServiceIsConnecting(TInt aFlags) const;
       
   508 
       
   509         /**
       
   510         *
       
   511         */
       
   512         inline TBool ServiceIsDisconnecting(TInt aFlags) const;
       
   513 
       
   514         /**
       
   515         *
       
   516         */
       
   517         inline TBool ServiceIsLoaded(TInt aFlags) const;
       
   518 
       
   519         /**
       
   520         *
       
   521         */
       
   522         TInt ServiceState(TMsvId aServiceId) const;
       
   523 
       
   524         /**
       
   525         *
       
   526         */
       
   527         CImap4MtmUi(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll);
       
   528 
       
   529         /**
       
   530         *
       
   531         */
       
   532         virtual void ConstructL();
       
   533 
       
   534         /**
       
   535         *
       
   536         */
       
   537         TInt ShowErrorDialog(TInt aErrorCode, TInt aErrorMessageRID=0) const;
       
   538 
       
   539         /**
       
   540         *
       
   541         */
       
   542         TInt GetUiProgress(
       
   543             const TDesC8& aProgress,
       
   544             TBuf<EProgressStringMaxLen>& aReturnString,
       
   545             TInt& aTotalEntryCount,
       
   546             TInt& aEntriesDone,
       
   547             TInt& aCurrentEntrySize,
       
   548             TInt& aCurrentBytesTrans) const;
       
   549 
       
   550         /**
       
   551         *
       
   552         */
       
   553         TInt GetSyncProgress(
       
   554             const TDesC8& aProgress,
       
   555             TBuf<EProgressStringMaxLen>& aReturnString,
       
   556             TInt& aTotalEntryCount,
       
   557             TInt& aEntriesDone,
       
   558             TInt& aCurrentEntrySize,
       
   559             TInt& aCurrentBytesTrans) const;
       
   560 
       
   561         /**
       
   562         *
       
   563         */
       
   564         TInt DisplayUiProgressSummary(const TDesC8& aProgress) const;
       
   565 
       
   566         /**
       
   567         *
       
   568         */
       
   569         TInt DisplayConnectionProgressSummary(const TDesC8& aProgress) const;
       
   570 
       
   571         /**
       
   572         *
       
   573         */
       
   574         TInt DisplaySyncProgressSummary(const TDesC8& aProgress) const;
       
   575 
       
   576         /**
       
   577         *
       
   578         */
       
   579         CMsvOperation* OfferSynchroniseL(
       
   580             TMsvId aService,
       
   581             TRequestStatus& aStatus);
       
   582 
       
   583         /**
       
   584         *
       
   585         */
       
   586         CMsvOperation* ShowMessageInfoL(
       
   587             TRequestStatus& aCompletionStatus,
       
   588             TDes8& aParameter);
       
   589 
       
   590         /**
       
   591         * InitParametersForFilteredPopulateL
       
   592         **/
       
   593         void InitParametersForFilteredPopulateL( CMsvEntrySelection& aSelection,
       
   594             TImImap4GetPartialMailInfo& aPartialGetMailInfo);
       
   595 
       
   596         /**
       
   597         * DoFilteredPopulateL
       
   598         */
       
   599         CMsvOperation* CImap4MtmUi::DoFilteredPopulateL(
       
   600             TRequestStatus& aStatus,
       
   601             const CMsvEntrySelection& aSelection,
       
   602             TInt aFunctionId,
       
   603             TImImap4GetPartialMailInfo& aPartialGetMailInfo);
       
   604 
       
   605     private:
       
   606         // --- Data ---
       
   607         HBufC*      iEditorFilename;
       
   608         HBufC*      iViewerFilename;
       
   609         CMsvEntry*  iEntry;
       
   610         TBuf<128>   iInboxName;
       
   611     };
       
   612 
       
   613 
       
   614 #include "Imap4MtmUi.inl"
       
   615 
       
   616 #endif // __IMAP4MTMUI_H__