mobilemessaging/mmsui/notmtminc/MMBoxDialog.h
changeset 79 2981cb3aa489
parent 0 72b543305e3a
equal deleted inserted replaced
25:84d9eb65b26f 79:2981cb3aa489
       
     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 *     MMS MMBox dialog defenitions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __MMBOXDLG_H__
       
    22 #define __MMBOXDLG_H__
       
    23 
       
    24 #include <eikdialg.h>// CEikDialog
       
    25 #include <msvstd.h>  // TMsvId
       
    26 #include <AknForm.h> // CAknDialog
       
    27 #include <eiklbo.h>  // MEikListBoxObserver
       
    28 #include <gulicon.h> // CGulIcon
       
    29 #include <MuiuMsvSingleOpWatcher.h> // MMsvSingleOpWatcher
       
    30 #include <MsvPrgReporter.h> // MMsvProgressDecoder
       
    31 #include <AknWaitDialog.h>          // CAknWaitDialog
       
    32 
       
    33 #include <bldvariant.hrh>
       
    34 
       
    35 #include "MMBoxArray.h"
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CEikColumnListBox;
       
    39 class CAknNavigationControlContainer;
       
    40 class CAknNavigationDecorator;
       
    41 class CNotMtmUi;
       
    42 class CNotMtmUiData;
       
    43 class CMmsNotificationClientMtm;
       
    44 class CClientMtmRegistry;
       
    45 class CMsvSession;
       
    46 class CCoeEnv;
       
    47 class CAknWaitDialog;
       
    48 class CAknProgressDialog;
       
    49 class TMsvSelectionOrdering;
       
    50 
       
    51 const TInt KMMBoxMarkReplacementStringLength = 2;
       
    52 
       
    53 enum TMMBoxDialogFlags
       
    54     {
       
    55     EHelpSupported = 1,     // Set when help menu option should be visible
       
    56     ESortTypeChanged = 2,   // Set if sort type has been changed during dialog lifetime
       
    57     EDoNotDeleteOpen = 4    // Set if user has pressed arrow keys in NotViewer
       
    58     };
       
    59 
       
    60 //  CLASS DEFINITIONS
       
    61 
       
    62 /**
       
    63 * CMMBoxDialog
       
    64 * Dialog class to display MMBox View
       
    65 */
       
    66 class CMMBoxDialog : 
       
    67     public CAknDialog,
       
    68     public MEikListBoxObserver,
       
    69     public MMsvSingleOpWatcher,
       
    70     public MMsvProgressDecoder,
       
    71     public MMsvSessionObserver
       
    72     {
       
    73     public:
       
    74         /**
       
    75         * C++ constructor
       
    76         */
       
    77         CMMBoxDialog( CNotMtmUi&  aUi, 
       
    78             CNotMtmUiData& aUiData, 
       
    79             CMsvSession& aSession, 
       
    80             TInt& aExitCode );
       
    81 
       
    82         /**
       
    83         * Destructor
       
    84         */
       
    85         ~CMMBoxDialog();
       
    86 
       
    87         /**
       
    88         * Two phase constructor
       
    89         * @param aUi: reference to not mtm ui object
       
    90         * @param aUiData: reference to not mtm ui data object
       
    91         * @param aSession: reference to message server session
       
    92         * @return object of CMMBoxDialog
       
    93         */
       
    94         static CMMBoxDialog* NewL( CNotMtmUi& aUi, 
       
    95             CNotMtmUiData& aUiData, 
       
    96             CMsvSession& aSession, 
       
    97             TInt& aExitCode );
       
    98 
       
    99         /**
       
   100         * from CEikDialog
       
   101         * Creates scrollbarframe.
       
   102         * Sets the listbox.
       
   103         * Sets the navipane text.
       
   104         * Calls UpdateMMBoxArrayL.
       
   105         */
       
   106         void PreLayoutDynInitL();
       
   107 
       
   108         /**
       
   109         * from CEikDialog
       
   110         * Check if quota info is available.
       
   111         * Asks user if (s)he wants the info to be updated.
       
   112         */
       
   113         void PostLayoutDynInitL();
       
   114 
       
   115         /**
       
   116         * from CEikDialog
       
   117         * If CEikDialog thinks it's ok to exit, calls
       
   118         * RestoreTitleTextAndNavipaneL to set the title and returns ETrue.
       
   119         */
       
   120         TBool OkToExitL(TInt aButtonId);
       
   121 
       
   122         /**
       
   123         * From CAknDialog
       
   124         */
       
   125         void ProcessCommandL( TInt aCommandId );
       
   126 
       
   127         /**
       
   128         * From MEikMenuObserver
       
   129         */
       
   130         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   131 
       
   132         /**
       
   133         * from CCoeControl
       
   134         */
       
   135         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) ;
       
   136 
       
   137         /**
       
   138         * From MMsvSingleOpWatcher
       
   139         */
       
   140         void OpCompleted(
       
   141             CMsvSingleOpWatcher& aOpWatcher, 
       
   142             TInt aCompletionCode );
       
   143 
       
   144         /**
       
   145         * From CCoeControl, returns help context
       
   146         */
       
   147         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   148 
       
   149         /**
       
   150         * from MProgressDecoder
       
   151         */
       
   152         virtual TInt DecodeProgress (
       
   153             const TDesC8& aProgress,
       
   154             TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString,
       
   155             TInt& aTotalEntryCount,
       
   156             TInt& aEntriesDone,
       
   157             TInt& aCurrentEntrySize,
       
   158             TInt& aCurrentBytesTrans, TBool aInternal );
       
   159 
       
   160         /**
       
   161         * from MMsvSessionObserver
       
   162         */
       
   163     	virtual void HandleSessionEventL(TMsvSessionEvent aEvent, 
       
   164             TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
   165 
       
   166     protected:
       
   167 
       
   168         /**
       
   169         * From MEikListBoxObserver
       
   170         */
       
   171         virtual void HandleListBoxEventL(
       
   172             CEikListBox* aListBox, 
       
   173             TListBoxEvent aEventType );
       
   174 
       
   175     private:
       
   176 
       
   177         /**
       
   178         * Symbian OS constructor
       
   179         * Creates a message array. 
       
   180         * Asks things from Feature Manager.
       
   181         * Gets a pointer to navipane.
       
   182         */
       
   183         void ConstructL();
       
   184 
       
   185         /**
       
   186         * Returns object of list box
       
   187         * @return pointer to list box object.
       
   188         */
       
   189         CEikColumnListBox* ListBox() const;
       
   190 
       
   191         /**
       
   192         * Appends icon to icon array
       
   193         * @param aFileName: Bitmap filename with path
       
   194         * @param aIconIndex: index of the bitmap to be read
       
   195         * @param aIcons: icon array where bitmap is append
       
   196         */
       
   197         void AppendSkinnedIconL(    
       
   198             TFileName& aFileName, 
       
   199             TInt aIconIndex, 
       
   200             CArrayPtrFlat<CGulIcon>* aIcons);
       
   201 
       
   202         /**
       
   203          * Updates iMessages array
       
   204          */
       
   205         void UpdateMMBoxArrayL();
       
   206 
       
   207         /**
       
   208          * Updates navipane with the latest update date
       
   209          */
       
   210         void UpdateNavipaneL();
       
   211 
       
   212         /**
       
   213          * Stores current title pane text and replaces it with new one (qtn_mce_title_mms_notifs_view)
       
   214          */
       
   215         void StoreTitleTextAndNavipaneAndSetNewL();
       
   216 
       
   217         /**
       
   218          * Restores title pane text with the text stored in 
       
   219          * StoreTitleTextAndSetNewL.
       
   220          */
       
   221         void RestoreTitleTextAndNavipaneL();
       
   222 
       
   223         /**
       
   224         * Called by OpCompleted after operation is completed.
       
   225         * If open op was completed and next/prev was chosen in Notviewer,
       
   226         * this function calls HandleOpenNextPreviousL().
       
   227         * If update or Delete operations were completed, calls
       
   228         * UpdateMMBoxArrayL.
       
   229         * Returns ETrue if we should try to exit from MMBoxDialog after this function.
       
   230         * @param aOperation: pointer to operation which is completed.
       
   231         * @param aCompletionCode: Same as in OpCompleted.
       
   232         * @return ETrue if TryToExitL is called. That can happen
       
   233         *    if exit is called during Open operation and dialog is dismissed.
       
   234         */ 
       
   235         TBool DoOperationCompletedL(
       
   236             CMsvOperation* aOperation, 
       
   237             TInt aCompletionCode );
       
   238 
       
   239         /** 
       
   240         * Launches help application
       
   241         */
       
   242         void LaunchHelpL();
       
   243     
       
   244         /**
       
   245         * Sorts the messages again. If aType is the same as the current
       
   246         * sorting, the sorting is reserved.
       
   247         * @param aType the type of the sorting
       
   248         */
       
   249         void SortMessagesByL( TMMBoxSortType aType );
       
   250 
       
   251         /**
       
   252         * Opens the currently focused item in Notification Viewer
       
   253         *
       
   254         */
       
   255         void OpenNotificationL( );
       
   256 
       
   257         /**
       
   258         * Starts fetching messages.
       
   259         * @param aAll - If ETrue, fetches all, if EFalse, fetches selection
       
   260         */
       
   261         void FetchL( TBool aAll=EFalse );
       
   262 
       
   263         /**
       
   264         * Deletes messages.
       
   265         * @param aAll - If ETrue, deletes all, if EFalse, deletes selection
       
   266         */
       
   267         void DeleteL( TBool aAll=EFalse );
       
   268 
       
   269         /**
       
   270         * Returns selection of entries
       
   271         * @param aAll - If ETrue, returns all, if EFalse, returns selected
       
   272         *               if none are selected -> returns just the current one
       
   273         */
       
   274         CMsvEntrySelection* SelectionL( TBool aAll=EFalse );
       
   275 
       
   276         /**
       
   277         * Creates and shows the status info dialog.
       
   278         */
       
   279         void ShowStatusL( );
       
   280 
       
   281         /**
       
   282         * Creates an instance of Progress Reporter and calls Notification 
       
   283         * Client MTM's UpdateMmBoxListL function to start the update process
       
   284         */
       
   285         void UpdateListL( );
       
   286 
       
   287         /**
       
   288         * Creates and shows an information note with text string aResourceId
       
   289         */
       
   290         void ShowInformationNoteL( TInt aResourceID, TBool aWaiting );
       
   291 
       
   292         /**
       
   293         * Creates and shows a confirmation query.
       
   294         * First loads the string aResourceId from the resource file.
       
   295         * Then calls the other ShowConfirmationQuery to show the query.
       
   296         */
       
   297         TInt ShowConfirmationQueryL( TInt aResourceId, TBool aOnlyOK=EFalse ) const;
       
   298 
       
   299         /**
       
   300         * Creates and shows a confirmation query.
       
   301         * First loads the string aResourceId adding numbers into place holders.
       
   302         * Then calls the other ShowConfirmationQuery to show the query.
       
   303         * @param aCount - count of objects for which something happend
       
   304         * @param aTotalOnes - count of total objects
       
   305         * @param aResource - string resource to be shown
       
   306         * @return Returns the value returned by the dialog.
       
   307         */
       
   308         TInt ShowConfirmationQueryL(    TInt    aCount,
       
   309                                         TInt    aTotalOnes,                          
       
   310                                         TInt    aResource );
       
   311 
       
   312         /**
       
   313         * Creates and shows a confirmation query.
       
   314         * Creates a query dialog with text aText. If aOnlyOK is true, the softkeys
       
   315         * are OK-Empty. Otherwise they are Yes-No.
       
   316         * Returns the value returned by the dialog.
       
   317         */
       
   318         TInt ShowConfirmationQueryL( const TDesC& aText, TBool aOnlyOK=EFalse ) const;
       
   319 
       
   320         /**
       
   321          * Opens next or previous message ie. sets the current context to next/prev
       
   322          * notification and calls OpenNotificationL function.
       
   323          */
       
   324         void HandleOpenNextPreviousL( TBool aOpenNext = ETrue );
       
   325 
       
   326         /**
       
   327         * Shows wait note using CAknWaitDialog.
       
   328         * @param aNoteTxtResourceId
       
   329         * @param aVisibilityDelayOff, ETrue show note immediately, 
       
   330         *                             EFalse after 1.5 sec
       
   331         */
       
   332         void ShowWaitNoteLC(
       
   333             TInt aNoteTxtResourceId, 
       
   334             TBool aVisibilityDelayOff);
       
   335 
       
   336         /**
       
   337         * Construct and prepares wait note using CAknWaitDialog.
       
   338         * This is called from ShowWaitNoteLC variants.
       
   339         * @param aVisibilityDelayOff, ETrue show note immediately, 
       
   340         *                             EFalse after 1.5 sec
       
   341         */
       
   342         void ConstructWaitNoteLC( TBool aVisibilityDelayOff );
       
   343 
       
   344         /**
       
   345         * TCleanupItem to clean wait or progress dialogs if leave happens after
       
   346         * dialog creation.
       
   347         * @param aAny: pointer to dialog pointer.
       
   348         */
       
   349         static void CleanupWaitDialog(TAny* aAny);
       
   350 
       
   351         void ShowWaitNoteL(
       
   352             TInt aNoteTxtResourceId, 
       
   353             TBool aVisibilityDelayOff);
       
   354             
       
   355         /**
       
   356         * Sets MSK if necessary.
       
   357         */
       
   358         void SetMSKL();
       
   359 
       
   360     private:
       
   361         CMMBoxArray*        iMessages;
       
   362         CNotMtmUi&          iUi;
       
   363         CNotMtmUiData&      iUiData;
       
   364         CMmsNotificationClientMtm* iClientMtm;
       
   365         CClientMtmRegistry* iMtmReg;
       
   366         CMsvSession&        iSession;
       
   367 
       
   368         CAknNavigationControlContainer* iNaviPane; //not owned
       
   369         CAknNavigationDecorator*    iNaviDecorator; //
       
   370         CAknNavigationDecorator*    iNaviOld;
       
   371         HBufC*              iOldTitleText;
       
   372         TMsvId              iMMBoxFolderId;
       
   373         TBuf<KMMBoxMarkReplacementStringLength>  iMarkReplacementText;
       
   374         
       
   375         CMsvSingleOpWatcher* iDeleteOperation;
       
   376         CMsvSingleOpWatcher* iOpenOperation;
       
   377         CMsvSingleOpWatcherArray    iFetchOperations;
       
   378         CMsvSingleOpWatcher* iUpdateOperation;
       
   379 
       
   380         CMsvEntrySelection* iDeleteSelection;
       
   381 
       
   382         CAknWaitDialog*     iWaitDialog;
       
   383         
       
   384         TInt&               iExitCode;
       
   385         TInt                iFlags;
       
   386         TMsvSelectionOrdering iOriginalOrder;
       
   387     };
       
   388 
       
   389 #endif // __MMBOXDLG_H__
       
   390 
       
   391 //  End of File