mobilemessaging/mmsui/notmtminc/NotMtmUi.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2004 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 *       CNotMtmUi - UI part of the Notification MTM type
       
    16 *       to Symbian OS Messaging
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef NOTMTMUI_H
       
    23 #define NOTMTMUI_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <AknWaitDialog.h>          //Wait note
       
    27 #include <mtmuibas.h>
       
    28 #include <MuiuMsgEditorLauncher.h> // for launch flags
       
    29 #include <MsvPrgReporter.h> // MMsvProgressDecoder
       
    30 
       
    31 #include <mmsconst.h>
       
    32 
       
    33 #include "MmsSettingsHandler.h"
       
    34 #include "MmsSettingsDialog.h"
       
    35 
       
    36 // CONSTANTS
       
    37 
       
    38 // MACROS
       
    39 
       
    40 // DATA TYPES
       
    41 // Editor types used to launch the correct application
       
    42 enum TEditorType
       
    43     {
       
    44     EReadOnly,
       
    45     EEditExisting,
       
    46     ECreateNewMessage
       
    47     };
       
    48 
       
    49 // FUNCTION PROTOTYPES
       
    50 
       
    51 
       
    52 // FORWARD DECLARATIONS
       
    53 class CMmsSettingsHandler;
       
    54 
       
    55 // CLASS DECLARATION
       
    56 
       
    57 /**
       
    58 * CNotMtmUi - UI part of the Notification MTM type to Symbian OS Messaging
       
    59 *
       
    60 * @since 2.5
       
    61 */
       
    62 class CNotMtmUi : public CBaseMtmUi,
       
    63                   public MMsvProgressDecoder 
       
    64     {
       
    65     public:  // Constructors and destructor
       
    66         
       
    67         /**
       
    68         * Symbian OS constructor
       
    69         * @param aBaseMtm client MTM
       
    70         * @param aRegisteredMtmDll registry dll
       
    71         * @return a new Notification MTM UI object.
       
    72         */
       
    73         static CNotMtmUi* NewL(
       
    74             CBaseMtm& aBaseMtm,
       
    75             CRegisteredMtmDll& aRegisteredMtmDll );
       
    76         
       
    77         /**
       
    78         * Destructor.
       
    79         */
       
    80         ~CNotMtmUi();
       
    81         
       
    82     public: // Functions from base classes
       
    83         
       
    84         /**
       
    85         * From CBaseMtmUi: Capability check.
       
    86         */
       
    87         TInt QueryCapability( TUid aCapability, TInt& aResponse );
       
    88         
       
    89         /**
       
    90         * From CBaseMtmUi: not supported in Series 60
       
    91         */
       
    92         CMsvOperation* DeleteServiceL(
       
    93             const TMsvEntry& aService,
       
    94             TRequestStatus& aStatus );
       
    95         
       
    96         /**
       
    97         * From CBaseMtmUi:
       
    98         * Just leaves with "not supported".
       
    99         */
       
   100         CMsvOperation* CreateL(
       
   101             const TMsvEntry& aEntry,
       
   102             CMsvEntry& aParent,
       
   103             TRequestStatus& aStatus );
       
   104 
       
   105         /**
       
   106         * From CBaseMtmUi: not supported in Series 60
       
   107         */
       
   108         CMsvOperation* DeleteFromL(
       
   109             const CMsvEntrySelection& aSelection,
       
   110             TRequestStatus& aStatus );
       
   111 
       
   112         /**
       
   113         * From CBaseMtmUi:
       
   114         * Suspends sending of the selected messages (if possible)
       
   115         */
       
   116         CMsvOperation* CancelL(
       
   117             TRequestStatus& aStatus,
       
   118             const CMsvEntrySelection& aSelection );
       
   119         
       
   120         /**
       
   121         * From CBaseMtmUi: Handles open request to the message or service
       
   122         * entry having context. Asynchronous.
       
   123         * @param aStatus follows the operation progress
       
   124         * @return started operation
       
   125         */
       
   126         CMsvOperation* OpenL( TRequestStatus& aStatus );
       
   127         
       
   128         /**
       
   129         * From CBaseMtmUi: As the other OpenL() but gets the first entry
       
   130         * in a selection and opens it.
       
   131         */
       
   132         CMsvOperation* OpenL(
       
   133             TRequestStatus& aStatus,
       
   134             const CMsvEntrySelection& aSelection );
       
   135         
       
   136         /**
       
   137         * From CBaseMtmUi: not supported in Series 60
       
   138         */
       
   139         CMsvOperation* CloseL( TRequestStatus& aStatus );
       
   140         
       
   141         /**
       
   142         * From CBaseMtmUi: not supported in Series 60
       
   143         */
       
   144         CMsvOperation* CloseL(
       
   145             TRequestStatus& aStatus,
       
   146             const CMsvEntrySelection& aSelection );
       
   147         
       
   148         /**
       
   149         * From CBaseMtmUi: Opens MmsEditor for editing a message. If
       
   150         * service entry opens MMS Settings dialog for editing MMS settings.
       
   151         * @param aStatus follows the operation progress
       
   152         * @return started operation
       
   153         */
       
   154         CMsvOperation* EditL( TRequestStatus& aStatus );
       
   155         
       
   156         /**
       
   157         * From CBaseMtmUi: As the other EditL(), but gets the first entry in
       
   158         * a selection and edits it.
       
   159         */
       
   160         CMsvOperation* EditL(
       
   161             TRequestStatus& aStatus,
       
   162             const CMsvEntrySelection& aSelection );
       
   163         
       
   164         /**
       
   165         * From CBaseMtmUi: Views the message or service entry having context.
       
   166         * Asynchronous.
       
   167         * Opens Notification Viewer or Settings dialog depending of the entry.
       
   168         * @param aStatus follows the operation progress
       
   169         * @return started operation
       
   170         */
       
   171         CMsvOperation* ViewL( TRequestStatus& aStatus );
       
   172         
       
   173         /**
       
   174         * From CBaseMtmUi: As the other ViewL(), but gets the first entry in
       
   175         * a selection ands views it.
       
   176         */
       
   177         CMsvOperation* ViewL(
       
   178             TRequestStatus& aStatus,
       
   179             const CMsvEntrySelection& aSelection );
       
   180         
       
   181         /**
       
   182         * From CBaseMtmUi: Opens MmsEditor for message Reply.
       
   183         * @param aStatus follows the operation progress
       
   184         * @return started operation
       
   185         */
       
   186         CMsvOperation* ReplyL(
       
   187             TMsvId aDestination,
       
   188             TMsvPartList aPartlist,
       
   189             TRequestStatus& aCompletionStatus );
       
   190         
       
   191         /**
       
   192         * From CBaseMtmUi: Opens Notification Viewer for forwarding message.
       
   193         * @param aStatus follows the operation progress
       
   194         * @return started operation
       
   195         */
       
   196         CMsvOperation* ForwardL(
       
   197             TMsvId aDestination,
       
   198             TMsvPartList aPartList,
       
   199             TRequestStatus& aCompletionStatus );
       
   200         
       
   201         /**
       
   202         * From CBaseMtmUi: Copy a message from outbox to remote service (=send)
       
   203         * Context should be in MTM folder/service.
       
   204         * @param aSelection messages to be copied/sent
       
   205         * @param aStatus follows the operation progress
       
   206         * @return operation started
       
   207         */
       
   208         CMsvOperation* CopyToL(
       
   209             const CMsvEntrySelection& aSelection,
       
   210             TRequestStatus& aStatus );
       
   211         
       
   212         /**
       
   213         * From CBaseMtmUi: Move a message from outbox to remote service (=send)
       
   214         * Context should be in MTM folder/service.
       
   215         * @param aSelection messages to be moved/sent
       
   216         * @param aStatus follows the operation progress
       
   217         * @return operation started
       
   218         */
       
   219         CMsvOperation* MoveToL(
       
   220             const CMsvEntrySelection& aSelection,
       
   221             TRequestStatus& aStatus );
       
   222         
       
   223         /**
       
   224         * From CBaseMtmUi: Copy a message from remote service to inbox.
       
   225         * Just leaves with "not supported".
       
   226         */
       
   227         CMsvOperation* CopyFromL(
       
   228             const CMsvEntrySelection& aSelection,
       
   229             TMsvId aTargetId,
       
   230             TRequestStatus& aStatus );
       
   231         
       
   232         /**
       
   233         * From CBaseMtmUi: Move a message from remote service to inbox.
       
   234         * Just leaves with "not supported".
       
   235         */
       
   236         CMsvOperation* MoveFromL(
       
   237             const CMsvEntrySelection& aSelection,
       
   238             TMsvId aTargetId,
       
   239             TRequestStatus& aStatus );
       
   240         
       
   241         /**
       
   242         * From CBaseMtmUi: Perform an asynchronous operation
       
   243         */
       
   244         CMsvOperation* InvokeAsyncFunctionL(
       
   245             TInt aFunctionId,
       
   246             const CMsvEntrySelection& aSelection,
       
   247             TRequestStatus& aCompletionStatus,
       
   248             TDes8& aParameter );
       
   249         
       
   250         /**
       
   251         * From CBaseMtmUi: Perform a synchronous operation
       
   252         */
       
   253         void InvokeSyncFunctionL(
       
   254             TInt aFunctionId,
       
   255             const CMsvEntrySelection& aSelection,
       
   256             TDes8& aParameter );
       
   257         
       
   258         /**
       
   259         * From CBaseMtmUi: Used for display operation summary (usually completed operations).
       
   260         * This does nothing, because MsgErrorWatcher shows all MMS error messages.
       
   261         * Furthermore currently MMS engine does not return any sensible progress to report.
       
   262         */
       
   263         TInt DisplayProgressSummary( const TDesC8& aProgress ) const;
       
   264 
       
   265         /**
       
   266         * From MMsvProgressDecoder
       
   267         * decode progress
       
   268         * @param aProgress: progress buffer
       
   269         * @param aReturnString: String to be displayed to the user usually in the CMsvWrappableProgressDialog dialog.
       
   270         * @param aTotalEntryCount: total entries to be processes
       
   271         * @param aEntriesDone: entries processes so far
       
   272         * @param aCurrentEntrySize: total size of the entries to be processes
       
   273         *           used to display progress bar (for example mail size to be fetched is 42000 bytes)
       
   274         *           If for example deleting messges then this should be number of messages to be deleted
       
   275         * @param aCurrentBytesTrans: number of bytes received so far
       
   276         *           used to display progress bar (for example received bytes is 21000 bytes, then progress bar half done)
       
   277         *           If for example deleting messges then this should be number of messages to deleted so far
       
   278         * @param aInternal: used only in CImapConnectionOp
       
   279         */
       
   280         TInt DecodeProgress (
       
   281             const TDesC8& aProgress,
       
   282             TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString,
       
   283             TInt& aTotalEntryCount,
       
   284             TInt& aEntriesDone,
       
   285             TInt& aCurrentEntrySize,
       
   286             TInt& aCurrentBytesTrans, TBool aInternal );
       
   287 
       
   288 
       
   289     public: // New functions
       
   290 
       
   291         /**
       
   292         * Checks whether or not MMS service settings are OK. Open settings
       
   293         * dialog if not.
       
   294         * @param aExitCode settings dialog exit code
       
   295         * @return are settings ok or not
       
   296         */
       
   297         IMPORT_C TBool CheckSettingsL( CMmsSettingsDialog::TMmsExitCode& aExitCode ) const;
       
   298 
       
   299         /**
       
   300         * Opens settings dialog for the MMS service.
       
   301         * @param aCompletionStatus follows the operation progress
       
   302         * @return started operation
       
   303         */
       
   304         IMPORT_C CMsvOperation* OpenServiceSettingsDialogL(
       
   305             TRequestStatus& aCompletionStatus );
       
   306     
       
   307         /**
       
   308         * Checks if ap exists
       
   309         * @param aAp, access point id
       
   310         */
       
   311         IMPORT_C TBool ApExistsL( TInt32 aAp );
       
   312 
       
   313         /**
       
   314         * Creates completed operation after settings dialog closing with
       
   315         * appropriate parameters.
       
   316         * @param aCompletionStatus the operation progress
       
   317         * @param aExitCode settings dialog exit code
       
   318         * @return completed operation
       
   319         */
       
   320         IMPORT_C CMsvOperation* CompleteSettingsOperationL(
       
   321             TRequestStatus& aCompletionStatus,
       
   322             const CMmsSettingsDialog::TMmsExitCode& aExitCode = CMmsSettingsDialog::EMmsExternalInterrupt );
       
   323     
       
   324         /**
       
   325         * Actual settings dialog launcher
       
   326         * @param aExitCode out: the exit code causing dialog to close
       
   327         */
       
   328         IMPORT_C void LaunchSettingsDialogL(
       
   329             CMmsSettingsDialog::TMmsExitCode& aExitCode ) const;
       
   330 
       
   331         /**
       
   332         * Factory settings initializing function
       
   333         * @param aLevel normal or deep
       
   334         */
       
   335         IMPORT_C void HandleFactorySettingsL( TDes8& aLevel );
       
   336 
       
   337         /**
       
   338         * This returns ETrue, if the delete options flag is defined.
       
   339         */
       
   340         IMPORT_C TBool DeleteQueryRequiredByMtm();
       
   341 
       
   342         /*
       
   343         * Shows user a query where the notifications should be deleted
       
   344         * Options are Server only and Both server and local. Returns false
       
   345         * if the query was cancelled, so first check the return value.
       
   346         */
       
   347         TInt DeleteFromQueryL( TInt& result );
       
   348 
       
   349         /**
       
   350         * Checks if AP settings are OK. If they are not OK, shows user
       
   351         * AP define dialog. This function is meant to be used by MMBox only.
       
   352         * @result ETrue - if settings are ok or user created new ok settings
       
   353         * @result EFalse - if settings were ok and user did not create settings
       
   354         */
       
   355         TBool CheckSettingsL( );
       
   356 
       
   357     protected:  // New functions
       
   358 
       
   359         /**
       
   360         * Handles the actual launching of editor or viewer when viewing or editing a 
       
   361         * message.
       
   362         * @param aStatus follows the operation progress.
       
   363         * @param aSession Message server session to be used.
       
   364         * @param aEditorType Editor type used to launch the correct application. 
       
   365         *                    Defaults to EEditExisting.
       
   366         * @return started operation
       
   367         */        
       
   368         CMsvOperation* LaunchEditorApplicationL(
       
   369             TRequestStatus& aStatus,
       
   370             CMsvSession& aSession,
       
   371             TEditorType aEditorType = EEditExisting );
       
   372 
       
   373         /**
       
   374         * Performs CopyToL or MoveToL operation
       
   375         * @param aSelection the entries to be sent
       
   376         * @param aStatus follows the operation progress
       
   377         * @param aCopyOnly defines is it copy or move
       
   378         * @return started operation
       
   379         */
       
   380         CMsvOperation* CopyMoveToL(
       
   381             const CMsvEntrySelection& aSelection,
       
   382             TRequestStatus& aStatus,
       
   383             TBool aCopyOnly );
       
   384     
       
   385     
       
   386     protected:  // Functions from base classes
       
   387     
       
   388         /**
       
   389         * From CBaseMtmUi: Returns resource file
       
   390         * @param aFileName Store resource file here
       
   391         */
       
   392         void GetResourceFileName( TFileName& aFileName ) const;
       
   393     
       
   394     private:
       
   395 
       
   396          enum TNotUiFlags
       
   397             {
       
   398             // set by mms local variation bit KMmsFeatureIdDeleteOptions
       
   399             EDeleteOptionsSupported                         = 0x0001,
       
   400 
       
   401             // set when delete operation is started
       
   402             EDeletingFromMMBox                              = 0x0002,
       
   403 
       
   404             // set when delete operation is started
       
   405             EDeletingMany                                   = 0x0004,
       
   406 
       
   407             // set by feature flag KFeatureIdOfflineMode
       
   408             EOffline                                        = 0x0008
       
   409 
       
   410             };
       
   411 
       
   412         /**
       
   413         * From CBaseMtmUi: construction.
       
   414         * @param
       
   415         * @return
       
   416         */
       
   417         void ConstructL();
       
   418 
       
   419         /**
       
   420         * From CBaseMtmUi: constructor.
       
   421         * @param aBaseMtm client MTM reference
       
   422         * @param aRegisteredMtmDll Registry DLL
       
   423         * @return
       
   424         */
       
   425         CNotMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll );
       
   426     
       
   427         /**
       
   428         * Default C++ constructor
       
   429         */
       
   430         CNotMtmUi();
       
   431 
       
   432         /**
       
   433         * Does nothing - done in engine by FactorySettings
       
   434         */
       
   435         void CreateDefaultSettingsL();
       
   436 
       
   437         /**
       
   438         * Opens message info popup.
       
   439         * @param aStatus follows the operation progress
       
   440         * @param aParameter contains message size from Editor, otherwise empty
       
   441         * @return started operation
       
   442         */
       
   443         CMsvOperation* OpenMessageInfoL(
       
   444             TRequestStatus& aCompletionStatus,
       
   445             TDes8& aParameter );
       
   446 
       
   447         /**
       
   448         * Opens MMBox dialog.
       
   449         * @param aStatus follows the operation progress
       
   450         * @param aParameter contains message size from Editor, otherwise empty
       
   451         * @return started operation
       
   452         */
       
   453         CMsvOperation* OpenMMBoxDialogL(
       
   454             TRequestStatus& aCompletionStatus );
       
   455 
       
   456         /**
       
   457         * Starts fetching procedure. This is called by InvokeAsyncfunction
       
   458         * @param aSelection Selection of entries to be fetched
       
   459         * @param aCompletionStatus Follows the progress of the operation
       
   460         * @return started operation
       
   461         */
       
   462         CMsvOperation* StartFetchingL(
       
   463             const CMsvEntrySelection& aSelection,
       
   464             TRequestStatus& aCompletionStatus );
       
   465 
       
   466         /**
       
   467         * Starts deleting procedure. This is called by InvokeAsyncfunction
       
   468         * @param aSelection Selection of entries to be deleted
       
   469         * @param aCompletionStatus Follows the progress of the operation
       
   470         * @return started operation
       
   471         */
       
   472         CMsvOperation* StartDeletingL(
       
   473             const CMsvEntrySelection& aSelection,
       
   474             TRequestStatus& aCompletionStatus );
       
   475 
       
   476             /**
       
   477         * Creates "To" recipient list for Message Info
       
   478         * @param aRecip     IN  Recipient array
       
   479         * @return New recipient string in CleanupStack
       
   480         */
       
   481         HBufC* TurnRecipientsArrayIntoStringLC( const CMsvRecipientList& aRecip ) const;
       
   482             
       
   483         /**
       
   484         * Message size - integer to string converter
       
   485         * Converts message size in bytes to a kilobyte string. Rounds the bytes up to the
       
   486         * next full kilo. I.e:
       
   487         * 0 -> 0KB
       
   488         * 1 -> 1KB
       
   489         * 1024 -> 1KB
       
   490         * 1025 -> 2KB
       
   491         * @param aTarget returned size string
       
   492         * @param aFileSize source size
       
   493         */
       
   494         void MessageSizeToStringL( TDes& aTarget, TInt aFileSize ) const; 
       
   495     
       
   496         /**
       
   497         * ShowConfirmationQueryL
       
   498         * Shows confirmation query with question aResourceId
       
   499         * @param IN aResourceId id of the confirmation resource
       
   500         */
       
   501         TInt ShowConfirmationQueryL( TInt aResourceId ) const;
       
   502 
       
   503         /**
       
   504         * Shows wait note using CAknWaitDialog.
       
   505         * @param aNoteTxtResourceId
       
   506         * @param aVisibilityDelayOff, ETrue show note immediately, 
       
   507         *                             EFalse after 1.5 sec
       
   508         */
       
   509         void ShowWaitNoteLC(
       
   510             TInt aNoteTxtResourceId, 
       
   511             TBool aVisibilityDelayOff);
       
   512 
       
   513         /**
       
   514         * Construct and prepares wait note using CAknWaitDialog.
       
   515         * This is called from ShowWaitNoteLC variants.
       
   516         * @param aVisibilityDelayOff, ETrue show note immediately, 
       
   517         *                             EFalse after 1.5 sec
       
   518         */
       
   519         void ConstructWaitNoteLC( TBool aVisibilityDelayOff );
       
   520 
       
   521         /**
       
   522         * To handle waitdialog PopAndDestroy destruction from cleanupstack.
       
   523         * @param 
       
   524         */ 
       
   525         static void CleanupWaitDialog(TAny* aAny);
       
   526 
       
   527         /**
       
   528         * Checks if query needed -> if there are more than one entry
       
   529         * or if one that has not been deleted from server yet.
       
   530         * This is used only locally by the MTM.
       
   531         */
       
   532         TBool DeleteQueryReallyNeededL( const CMsvEntrySelection& aSelection );
       
   533 
       
   534         /**
       
   535         * ShowInformationNoteL
       
   536         * Shows information note for user
       
   537         * @param aResourceID
       
   538         * @param aWaiting, is note waiting or not.
       
   539         */  
       
   540         void ShowInformationNoteL(TInt aResourceID, TBool aWaiting );
       
   541 
       
   542 
       
   543     private:    // Data
       
   544         CMmsSettingsHandler*    iSettingsHandler;
       
   545 
       
   546         // Used to show waiting dialog while deleting messages from server
       
   547         CAknWaitDialog*         iWaitDialog;
       
   548 
       
   549         TUint                   iNotUiFlags;
       
   550 
       
   551     };
       
   552     
       
   553 #endif      // NOTMTMUI_H
       
   554     
       
   555     // End of File
       
   556