mobilemessaging/mmsui/mtminc/MmsMtmUi.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:  
       
    15 *       CMmsMtmUi - UI part of the MMS MTM type to Symbian OS Messaging
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MMSMTMUI_H
       
    22 #define MMSMTMUI_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <mtmuibas.h>
       
    26 #include <MuiuMsgEditorLauncher.h>  // for launch flags
       
    27 
       
    28 #include <mmsconst.h>
       
    29 
       
    30 #include "MmsSettingsHandler.h"
       
    31 #include "MmsSettingsDialog.h"
       
    32 
       
    33 // CONSTANTS
       
    34 // Expose, if needed:
       
    35 // #define KMtmUiFirstFreeMmsUiFunctionId (KMtmUiFirstFreePlatformMTMFunctionId + 0x1000)
       
    36 
       
    37 
       
    38 // MACROS
       
    39 
       
    40 
       
    41 // DATA TYPES
       
    42 
       
    43 
       
    44    // Editor types used to launch the correct application
       
    45 enum TEditorType
       
    46     {
       
    47     EReadOnly,
       
    48     EEditExisting,
       
    49     ECreateNewMessage,
       
    50     ESpecialEditor,
       
    51     EReadOnlyAudioMessage,
       
    52 	ECreateNewAudioMessage
       
    53     };
       
    54 
       
    55 // FUNCTION PROTOTYPES
       
    56 
       
    57 
       
    58 // FORWARD DECLARATIONS
       
    59 class CMmsClientMtm;
       
    60 class CMmsMtmDeliveryDialogLauncher;
       
    61 
       
    62 // CLASS DECLARATION
       
    63 
       
    64 /**
       
    65 * CMmsMtmUi - UI part of the MMS MTM type to Symbian OS Messaging
       
    66 *
       
    67 * @since 0.9
       
    68 */
       
    69 class CMmsMtmUi : public CBaseMtmUi
       
    70     {
       
    71     public:  // Constructors and destructor
       
    72         
       
    73         /**
       
    74         * Symbian OS constructor
       
    75         * @param aBaseMtm client MTM
       
    76         * @param aRegisteredMtmDll registry dll
       
    77         * @return a new MMS MTM UI object.
       
    78         */
       
    79         static CMmsMtmUi* NewL(
       
    80             CBaseMtm& aBaseMtm,
       
    81             CRegisteredMtmDll& aRegisteredMtmDll );
       
    82         
       
    83         /**
       
    84         * Destructor.
       
    85         */
       
    86         ~CMmsMtmUi();
       
    87         
       
    88     public: // Functions from base classes
       
    89         
       
    90         /**
       
    91         * From CBaseMtmUi: Capability check.
       
    92         */
       
    93         TInt QueryCapability( TUid aCapability, TInt& aResponse );
       
    94         
       
    95         /**
       
    96         * From CBaseMtmUi: not supported in Series 60
       
    97         */
       
    98         CMsvOperation* DeleteServiceL(
       
    99             const TMsvEntry& aService,
       
   100             TRequestStatus& aStatus );
       
   101         
       
   102         /**
       
   103         * From CBaseMtmUi: Create a new entry. Launches MMS editor.
       
   104         * Asynchronous.
       
   105         * @param aEntry entry to be created
       
   106         * @param aParent parent entry
       
   107         * @param aStatus follows the operation progress
       
   108         * @return started operation
       
   109         */
       
   110         CMsvOperation* CreateL(
       
   111             const TMsvEntry& aEntry,
       
   112             CMsvEntry& aParent,
       
   113             TRequestStatus& aStatus );
       
   114         
       
   115         /**
       
   116         * From CBaseMtmUi: not supported in Series 60
       
   117         */
       
   118         CMsvOperation* DeleteFromL(
       
   119             const CMsvEntrySelection& aSelection,
       
   120             TRequestStatus& aStatus );
       
   121         
       
   122         /**
       
   123         * From CBaseMtmUi:
       
   124         * Suspends sending of the selected messages (if possible)
       
   125         */
       
   126         CMsvOperation* CancelL(
       
   127             TRequestStatus& aStatus,
       
   128             const CMsvEntrySelection& aSelection );
       
   129         
       
   130         /**
       
   131         * From CBaseMtmUi: Handles open request to the message or service
       
   132         * entry having context. Asynchronous.
       
   133         * @param aStatus follows the operation progress
       
   134         * @return started operation
       
   135         */
       
   136         CMsvOperation* OpenL( TRequestStatus& aStatus );
       
   137         
       
   138         /**
       
   139         * From CBaseMtmUi: As the other OpenL() but gets the first entry
       
   140         * in a selection and opens it.
       
   141         */
       
   142         CMsvOperation* OpenL(
       
   143             TRequestStatus& aStatus,
       
   144             const CMsvEntrySelection& aSelection );
       
   145         
       
   146         /**
       
   147         * From CBaseMtmUi: not supported in Series 60
       
   148         */
       
   149         CMsvOperation* CloseL( TRequestStatus& aStatus );
       
   150         
       
   151         /**
       
   152         * From CBaseMtmUi: not supported in Series 60
       
   153         */
       
   154         CMsvOperation* CloseL(
       
   155             TRequestStatus& aStatus,
       
   156             const CMsvEntrySelection& aSelection );
       
   157         
       
   158         /**
       
   159         * From CBaseMtmUi: Opens MmsEditor for editing a message. If
       
   160         * service entry opens MMS Settings dialog for editing MMS settings.
       
   161         * @param aStatus follows the operation progress
       
   162         * @return started operation
       
   163         */
       
   164         CMsvOperation* EditL( TRequestStatus& aStatus );
       
   165         
       
   166         /**
       
   167         * From CBaseMtmUi: As the other EditL(), but gets the first entry in
       
   168         * a selection and edits it.
       
   169         */
       
   170         CMsvOperation* EditL(
       
   171             TRequestStatus& aStatus,
       
   172             const CMsvEntrySelection& aSelection );
       
   173         
       
   174         /**
       
   175         * From CBaseMtmUi: Views the message or service entry having context.
       
   176         * Asynchronous.
       
   177         * Opens MMS Viewer or Settings dialog depending of the entry.
       
   178         * @param aStatus follows the operation progress
       
   179         * @return started operation
       
   180         */
       
   181         CMsvOperation* ViewL( TRequestStatus& aStatus );
       
   182         
       
   183         /**
       
   184         * From CBaseMtmUi: As the other ViewL(), but gets the first entry in
       
   185         * a selection ands views it.
       
   186         */
       
   187         CMsvOperation* ViewL(
       
   188             TRequestStatus& aStatus,
       
   189             const CMsvEntrySelection& aSelection );
       
   190         
       
   191         /**
       
   192         * From CBaseMtmUi: Opens MmsEditor for message Reply.
       
   193         * @param aStatus follows the operation progress
       
   194         * @return started operation
       
   195         */
       
   196         CMsvOperation* ReplyL(
       
   197             TMsvId aDestination,
       
   198             TMsvPartList aPartlist,
       
   199             TRequestStatus& aCompletionStatus );
       
   200         
       
   201         /**
       
   202         * From CBaseMtmUi: Opens MmsEditor for forwarding message.
       
   203         * @param aStatus follows the operation progress
       
   204         * @return started operation
       
   205         */
       
   206         CMsvOperation* ForwardL(
       
   207             TMsvId aDestination,
       
   208             TMsvPartList aPartList,
       
   209             TRequestStatus& aCompletionStatus );
       
   210         
       
   211         /**
       
   212         * From CBaseMtmUi: Copy a message from outbox to remote service (=send)
       
   213         * Context should be in MTM folder/service.
       
   214         * @param aSelection messages to be copied/sent
       
   215         * @param aStatus follows the operation progress
       
   216         * @return operation started
       
   217         */
       
   218         CMsvOperation* CopyToL(
       
   219             const CMsvEntrySelection& aSelection,
       
   220             TRequestStatus& aStatus );
       
   221         
       
   222         /**
       
   223         * From CBaseMtmUi: Move a message from outbox to remote service (=send)
       
   224         * Context should be in MTM folder/service.
       
   225         * @param aSelection messages to be moved/sent
       
   226         * @param aStatus follows the operation progress
       
   227         * @return operation started
       
   228         */
       
   229         CMsvOperation* MoveToL(
       
   230             const CMsvEntrySelection& aSelection,
       
   231             TRequestStatus& aStatus );
       
   232         
       
   233         /**
       
   234         * From CBaseMtmUi: Copy a message from remote service to inbox.
       
   235         * Just leaves with "not supported".
       
   236         */
       
   237         CMsvOperation* CopyFromL(
       
   238             const CMsvEntrySelection& aSelection,
       
   239             TMsvId aTargetId,
       
   240             TRequestStatus& aStatus );
       
   241         
       
   242         /**
       
   243         * From CBaseMtmUi: Move a message from remote service to inbox.
       
   244         * Just leaves with "not supported".
       
   245         */
       
   246         CMsvOperation* MoveFromL(
       
   247             const CMsvEntrySelection& aSelection,
       
   248             TMsvId aTargetId,
       
   249             TRequestStatus& aStatus );
       
   250         
       
   251         /**
       
   252         * From CBaseMtmUi: Perform an asynchronous operation
       
   253         */
       
   254         CMsvOperation* InvokeAsyncFunctionL(
       
   255             TInt aFunctionId,
       
   256             const CMsvEntrySelection& aSelection,
       
   257             TRequestStatus& aCompletionStatus,
       
   258             TDes8& aParameter );
       
   259         
       
   260         /**
       
   261         * From CBaseMtmUi: Perform a synchronous operation
       
   262         */
       
   263         void InvokeSyncFunctionL(
       
   264             TInt aFunctionId,
       
   265             const CMsvEntrySelection& aSelection,
       
   266             TDes8& aParameter );
       
   267         
       
   268         /**
       
   269         * From CBaseMtmUi: Used for display operation summary (usually completed operations).
       
   270         * This does nothing, because MsgErrorWatcher shows all MMS error messages.
       
   271         * Furthermore currently MMS engine does not return any sensible progress to report.
       
   272         */
       
   273         TInt DisplayProgressSummary( const TDesC8& aProgress ) const;
       
   274         
       
   275         /**
       
   276         * From CBaseMtmUi: Get progress information. Not used in Series 60.
       
   277         */
       
   278 
       
   279         /**
       
   280         * From CBaseMtmUi: Get user confirmation for sending.
       
   281         */
       
   282 		CMsvOperation* ConfirmSendL(
       
   283 			TRequestStatus& aStatus, 
       
   284 			const CMsvEntrySelection& aSelection, 
       
   285 			const TSecurityInfo& aClientInfo ); 
       
   286 			
       
   287 	    /**
       
   288 	    * Check whether the given TMsvEntry represents an upload message
       
   289 	    * @param aEntry TMsvEntry of the message to be checked
       
   290 	    */
       
   291 	    static inline TBool IsUpload( const TMsvEntry& aEntry );
       
   292 			
       
   293 	    /**
       
   294 	    * Check whether the given TMsvEntry represents a MMS Postcard message
       
   295 	    * @param aEntry TMsvEntry of the message to be checked
       
   296 	    */
       
   297 	    static inline TBool IsPostcard( const TMsvEntry& aEntry );
       
   298 
       
   299 		/**
       
   300 	    * Check whether the given TMsvEntry represents a AMS message
       
   301 	    * @param aEntry TMsvEntry of the message to be checked
       
   302 	    */
       
   303 	    static inline TBool IsAudioMessage( const TMsvEntry& aEntry );
       
   304 
       
   305         static void ConvertUtcToLocalTime( TTime& aTime );
       
   306 
       
   307 
       
   308     protected:  // New functions
       
   309     
       
   310         /**
       
   311         * Handles the actual launching of editor or viewer when viewing or editing a 
       
   312         * message.
       
   313         * @param aStatus follows the operation progress.
       
   314         * @param aSession Message server session to be used.
       
   315         * @param aEditorType Editor type used to launch the correct application. 
       
   316         *                    Defaults to EEditExisting.
       
   317         * @return started operation
       
   318         */        
       
   319         CMsvOperation* LaunchEditorApplicationL(
       
   320             TRequestStatus& aStatus,
       
   321             CMsvSession& aSession,
       
   322             TEditorType aEditorType = EEditExisting );
       
   323     
       
   324         /**
       
   325         * Performs CopyToL or MoveToL operation
       
   326         * @param aSelection the entries to be sent
       
   327         * @param aStatus follows the operation progress
       
   328         * @param aCopyOnly defines is it copy or move
       
   329         * @return started operation
       
   330         */
       
   331         CMsvOperation* CopyMoveToL(
       
   332             const CMsvEntrySelection& aSelection,
       
   333             TRequestStatus& aStatus,
       
   334             TBool aCopyOnly );
       
   335     
       
   336     protected:  // Functions from base classes
       
   337     
       
   338         /**
       
   339         * From CBaseMtmUi: Returns resource file
       
   340         * @param aFileName Store resource file here
       
   341         */
       
   342         void GetResourceFileName( TFileName& aFileName ) const;
       
   343     
       
   344     
       
   345     private:
       
   346     
       
   347         /**
       
   348         * From CBaseMtmUi: construction.
       
   349         * @param
       
   350         * @return
       
   351         */
       
   352         void ConstructL();
       
   353     
       
   354         /**
       
   355         * From CBaseMtmUi: constructor.
       
   356         * @param aBaseMtm client MTM reference
       
   357         * @param aRegisteredMtmDll Registry DLL
       
   358         * @return
       
   359         */
       
   360         CMmsMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll );
       
   361     
       
   362         /**
       
   363         * Does nothing - done in engine by FactorySettings
       
   364         */
       
   365         void CreateDefaultSettingsL();
       
   366     
       
   367         /**
       
   368         * Opens settings dialog for the MMS service.
       
   369         * @param aCompletionStatus follows the operation progress
       
   370         * @return started operation
       
   371         */
       
   372         CMsvOperation* OpenServiceSettingsDialogL(
       
   373             TRequestStatus& aCompletionStatus );
       
   374     
       
   375         /**
       
   376         * Checks whether or not MMS service settings are OK. Open settings
       
   377         * dialog if not.
       
   378         * @param aExitCode settings dialog exit code
       
   379         * @return are settings ok or not
       
   380         */
       
   381         TBool CheckSettingsL( CMmsSettingsDialog::TMmsExitCode& aExitCode ) const;
       
   382     
       
   383         /**
       
   384         * Creates completed operation after settings dialog closing with
       
   385         * appropriate parameters.
       
   386         * @param aCompletionStatus the operation progress
       
   387         * @param aExitCode settings dialog exit code
       
   388         * @return completed operation
       
   389         */
       
   390         CMsvOperation* CompleteSettingsOperationL(
       
   391             TRequestStatus& aCompletionStatus,
       
   392             const CMmsSettingsDialog::TMmsExitCode& aExitCode = CMmsSettingsDialog::EMmsExternalInterrupt );
       
   393     
       
   394         /**
       
   395         * Actual settings dialog launcher
       
   396         * @param aExitCode out: the exit code causing dialog to close
       
   397         */
       
   398         void LaunchSettingsDialogL(
       
   399             CMmsSettingsDialog::TMmsExitCode& aExitCode ) const;
       
   400     
       
   401         /**
       
   402         * Opens message info popup.
       
   403         * @param aStatus follows the operation progress
       
   404         * @return started operation
       
   405         */
       
   406         CMsvOperation* OpenMessageInfoL(
       
   407             TRequestStatus& aCompletionStatus );
       
   408 
       
   409         /**
       
   410         * Opens postcard info popup.
       
   411         * @param aStatus follows the operation progress
       
   412         * @return started operation
       
   413         */
       
   414         CMsvOperation* OpenPostcardInfoL(
       
   415             TRequestStatus& aCompletionStatus );
       
   416             
       
   417         /**
       
   418         * Opens delivery statys popup.
       
   419         * @param aStatus follows the operation progress
       
   420         * @param aParameter contains message size from Editor, otherwise empty
       
   421         * @return started operation
       
   422         */
       
   423         CMsvOperation* OpenDeliveryPopupL(
       
   424             TRequestStatus& aCompletionStatus,
       
   425             TDes8& aParameter ); 
       
   426     
       
   427         /**
       
   428         * Creates a copy from the current message to be sent to Upload service
       
   429         * either directly (sent immediately) or indirectly (open to MMS Editor)
       
   430         *
       
   431         * @param aSelection The entry to be uploaded
       
   432         *                   Notice: Only one entry supported!
       
   433         * @param aCompletionStatus follows the operation progress
       
   434         * @param aParameter Parameter package of type TMsgUploadParameters
       
   435         *                   Defined in "MuiuMsgUploadParam.h"
       
   436         *                   Includes real address, alias and direct/indirect info
       
   437         * @return started operation
       
   438         */
       
   439         CMsvOperation* UploadL(
       
   440             const CMsvEntrySelection& aSelection,
       
   441             TRequestStatus& aCompletionStatus,
       
   442             TDes8& aParameter );
       
   443 
       
   444         /**
       
   445         * Performs DRM checks for Upload messages
       
   446         * @return ETrue, if message is allowed to be sent,
       
   447         *         EFalse, otherwise
       
   448         */
       
   449         TBool UploadDRMChecksL();
       
   450 
       
   451         /**
       
   452         * Creates To:, Cc, and Bcc recipient lists for Message Info.
       
   453         * Creation of Cc and Bcc recipients list are created, if 
       
   454         * these fields are variated On.
       
   455         * Every created recipient buffer object increases pushed object count 
       
   456         * by one. Thus pushed object count is 1-3 depending on variation.
       
   457         * If a field is variated Off, recipients are appended to 
       
   458         * To: or Cc: fields.
       
   459         * @param aRecip  IN  Recipient array
       
   460         * @param aTo     OUT To recipients array
       
   461         * @param aCc     OUT Cc recipients array
       
   462         * @param aBcc    OUT Bcc Recipient array
       
   463         * @param aAddHeadersVariation variation bit flags
       
   464         * @param aMobileTerminated whether this is sent or received message 
       
   465         */
       
   466         void TurnRecipientsArrayIntoStringsLC(
       
   467                             const   CMsvRecipientList&  aRecip,
       
   468                             HBufC*&                     aTo,
       
   469                             HBufC*&                     aCc,
       
   470                             HBufC*&                     aBcc, 
       
   471                             TInt                        aAddHeadersVariation,
       
   472                             TBool                       aMobileTerminated ) const; 
       
   473 
       
   474         /**
       
   475         * Message size - integer to string converter
       
   476         * Converts message size in bytes to a kilobyte string. Rounds the bytes up to the
       
   477         * next full kilo. I.e:
       
   478         * 0 -> 0KB
       
   479         * 1 -> 1KB
       
   480         * 1024 -> 1KB
       
   481         * 1025 -> 2KB
       
   482         * @param aTarget returned size string
       
   483         * @param aFileSize source size
       
   484         */
       
   485         void MessageSizeToStringL( TDes& aTarget, TInt aFileSize ) const; 
       
   486     
       
   487         /**
       
   488         * Checks if the message is effectively empty
       
   489         * @return boolean - empty or not empty
       
   490         */
       
   491         TBool IsMessageEmptyL() const;
       
   492     
       
   493         /**
       
   494         * @return TInt message size including size of attachment files and subject.
       
   495         *         Neither any kind of headers nor recipients fields are calculated ínto figure.
       
   496         */
       
   497         TInt MessageSizeL() const;
       
   498     
       
   499         /**
       
   500         * Factory settings initializing function
       
   501         * @param aLevel normal or deep
       
   502         */
       
   503         void HandleFactorySettingsL( TDes8& aLevel );
       
   504     
       
   505         /**
       
   506         * Checks if ap exists
       
   507         * @param aAp, access point id
       
   508         */
       
   509         TBool ApExistsL( TInt32 aAp );
       
   510 
       
   511     private:    // Data
       
   512         CMmsSettingsHandler*    iSettingsHandler;
       
   513         CMmsMtmDeliveryDialogLauncher* iLauncher;
       
   514         TBool                   iPriorityFeatureSupported;
       
   515     };
       
   516 
       
   517 inline TBool CMmsMtmUi::IsUpload( const TMsvEntry& aEntry )
       
   518     {
       
   519     if ( aEntry.iBioType == KUidMsgSubTypeMmsUpload.iUid )
       
   520         {
       
   521         return ETrue;
       
   522         }
       
   523     return EFalse;
       
   524     }
       
   525 
       
   526 inline TBool CMmsMtmUi::IsPostcard( const TMsvEntry& aEntry )
       
   527     {
       
   528     if ( aEntry.iBioType == KUidMsgSubTypeMmsPostcard.iUid )
       
   529         {
       
   530         return ETrue;
       
   531         }
       
   532     return EFalse;
       
   533     }
       
   534 
       
   535 inline TBool CMmsMtmUi::IsAudioMessage( const TMsvEntry& aEntry )
       
   536     {
       
   537     if ( aEntry.iBioType == KUidMsgSubTypeMmsAudioMsg.iUid )
       
   538         {
       
   539         return ETrue;
       
   540         }
       
   541     return EFalse;    
       
   542     }
       
   543     
       
   544 #endif      // MMSMTMUI_H
       
   545     
       
   546     // End of File
       
   547