mobilemessaging/smum/simdialogplugins/defaultsimdlg/inc/smssimdialog.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2009 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 *     Sms sim dialog header.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __SMSSIMDLG_H__
       
    22 #define __SMSSIMDLG_H__
       
    23 
       
    24 #include <simdlgplugin.h> //CSimDlgPlugin
       
    25 #include <eikdialg.h>// CEikDialog
       
    26 #include <msvstd.h>  // TMsvId
       
    27 #include <AknForm.h> // CAknDialog
       
    28 #include <eiklbo.h>  // MEikListBoxObserver
       
    29 #include <gulicon.h> // CGulIcon
       
    30 #include <MuiuMsvSingleOpWatcher.h> // MMsvSingleOpWatcher
       
    31 #include <AknWaitDialog.h>          // CAknWaitDialog
       
    32 
       
    33 #include <bldvariant.hrh>
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CEikColumnListBox;
       
    37 class CSmsMtmUi;
       
    38 class CMsvSession;
       
    39 class CCoeEnv;
       
    40 class CAknWaitDialog;
       
    41 class CAknProgressDialog;
       
    42 
       
    43 
       
    44 const TInt KSmumMaxDisplayTextLength = 70;
       
    45 const TInt KSmumMaxVisibleChars = 30;
       
    46 const TInt KSmumMarkReplacementStringLength = 2;
       
    47 
       
    48 
       
    49 //  CLASS DEFINITIONS
       
    50 
       
    51 /**
       
    52 * CSimMessageArray
       
    53 * Helper array class used by CSmsSimDialog
       
    54 */
       
    55 NONSHARABLE_CLASS( CSimMessageArray ) : 
       
    56     public CBase, 
       
    57     public MDesCArray
       
    58     {
       
    59     public:
       
    60         /**
       
    61         * Two phase constructor
       
    62         */
       
    63         static CSimMessageArray* NewL( CMsvSession& aSession );
       
    64 
       
    65         /**
       
    66         * Destructor
       
    67         */
       
    68         ~CSimMessageArray();
       
    69 
       
    70         /**
       
    71         * Update sim messages array
       
    72         * @param aFolderId: id of the folder where sim messages are
       
    73         */
       
    74         void RefreshArrayL( TMsvId aFolderId );
       
    75 
       
    76         /**
       
    77         * Returns entry id 
       
    78         * @param aIndex: index of the entry
       
    79         * @return TMsvId: id of the entry
       
    80         */
       
    81         TMsvId EntryId( TInt aIndex ) const;
       
    82 
       
    83     public: // Functions from base classes
       
    84 
       
    85         /**
       
    86         * from MDesCArray
       
    87         */
       
    88         virtual TInt MdcaCount() const;
       
    89 
       
    90         /**
       
    91         * from MDesCArray
       
    92         */
       
    93         virtual TPtrC MdcaPoint(TInt aIndex) const;
       
    94 
       
    95     private:
       
    96         /**
       
    97         * C++ constructor
       
    98         */
       
    99         CSimMessageArray( CMsvSession& aSession );
       
   100 
       
   101         /**
       
   102         * EPOC constructor
       
   103         */
       
   104         void ConstructL();
       
   105 
       
   106     private:
       
   107         CMsvSession&    iSession;
       
   108         CMsvEntry*      iSmsServiceEntry;
       
   109         HBufC*          iListBoxText;        
       
   110     };
       
   111 
       
   112 
       
   113 /**
       
   114 * CSmsSimDialog
       
   115 * Dialog class to display sim messages
       
   116 */
       
   117 NONSHARABLE_CLASS( CSmsSimDialog ) : 
       
   118     public CAknDialog,
       
   119     public MEikListBoxObserver,
       
   120     public MMsvSingleOpWatcher,
       
   121     public MProgressDialogCallback
       
   122     {
       
   123     public:
       
   124 	    /**
       
   125         * Two phase constructor
       
   126         * @param aSmsMtmUi: reference to sms mtm ui object
       
   127         * @param aSession: reference to message server session
       
   128         * @return object of CSmsSimDialog
       
   129         */
       
   130         static CSmsSimDialog* NewL(CSmsMtmUi&  aSmsMtmUi, CMsvSession& aSession, TInt& aExitCode);
       
   131 	   
       
   132         /**
       
   133         * Destructor
       
   134         */
       
   135         virtual ~CSmsSimDialog();
       
   136      
       
   137     
       
   138 public:   
       
   139         /**
       
   140         * from CEikDialog
       
   141         */
       
   142         void PreLayoutDynInitL();
       
   143 
       
   144         /**
       
   145         * from CEikDialog
       
   146         */
       
   147         TBool OkToExitL(TInt aButtonId);
       
   148 
       
   149         /**
       
   150         * From CAknDialog
       
   151         */
       
   152         void ProcessCommandL( TInt aCommandId );
       
   153 
       
   154         /**
       
   155         * From MEikMenuObserver
       
   156         */
       
   157         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   158 
       
   159         /**
       
   160         * from CCoeControl
       
   161         */
       
   162         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) ;
       
   163 
       
   164         /**
       
   165         * From MMsvSingleOpWatcher
       
   166         */
       
   167         void OpCompleted(
       
   168             CMsvSingleOpWatcher& aOpWatcher, 
       
   169             TInt aCompletionCode );
       
   170 
       
   171         /**
       
   172         * from MProgressDialogCallback
       
   173         */
       
   174         void DialogDismissedL( TInt aButtonId );
       
   175 
       
   176         /**
       
   177         * From CCoeControl, returns help context
       
   178         */
       
   179         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   180 
       
   181     protected:
       
   182 
       
   183         /**
       
   184         * From MEikListBoxObserver
       
   185         */
       
   186         virtual void HandleListBoxEventL(
       
   187             CEikListBox* aListBox, 
       
   188             TListBoxEvent aEventType );
       
   189 
       
   190     private:
       
   191 
       
   192 		/**
       
   193         * C++ constructor
       
   194         */
       
   195         CSmsSimDialog(CSmsMtmUi&  aSmsMtmUi, CMsvSession& aSession, TInt& aExitCode);
       
   196 
       
   197         /**
       
   198         * Symbian OS constructor
       
   199         */
       
   200         void ConstructL();
       
   201 
       
   202         /**
       
   203         * Copies sim messages to local folder
       
   204         */
       
   205         void HandleCopyFromSimToLocalFolderL();
       
   206 
       
   207         /**
       
   208         * Deletes sim messages from sim card
       
   209         */
       
   210         void HandleDeleteFromSimL();
       
   211 
       
   212         /**
       
   213         * Returns object of list box
       
   214         * @return pointer to list box object.
       
   215         */
       
   216         CEikColumnListBox* ListBox() const;
       
   217 
       
   218         /**
       
   219         * Reads sim messages from sim card.
       
   220         */
       
   221         void EnumerateSimMessagesL();
       
   222 
       
   223         /**
       
   224         * Deletes temporary sim messages folder.
       
   225         */
       
   226         void DeleteSimFolderL();
       
   227 
       
   228         /**
       
   229          * Handles Edit submenu. Checks what items are selected and deletes 
       
   230          * Mark, Unmark, Mark All, Unmark All menu items accordingly.
       
   231          */
       
   232         void DynInitEditMenuL( CEikMenuPane* aMenuPane );
       
   233 
       
   234         /**
       
   235          * Creates CMsvEntrySelection array from the selected items.
       
   236          * If no items marked adds item under 'cursor' to the array.
       
   237          * @return pointer to CMsvEntrySelection. Caller must pop and delete array.
       
   238          */
       
   239         CMsvEntrySelection* CreateSelectionArrayLC();
       
   240 
       
   241         /**
       
   242          * Updates iMessages array
       
   243          */
       
   244         void UpdateSimMessagesArrayL();
       
   245 
       
   246         /**
       
   247          * Stores current title pane text and replaces it with new one (qtn_mce_title_sim)
       
   248          */
       
   249         void StoreTitleTextAndSetNewL();
       
   250 
       
   251         /**
       
   252          * Restores title pane text with the text stored in 
       
   253          * StoreTitleTextAndSetNewL.
       
   254          */
       
   255         void RestoreTitleTextL();
       
   256 
       
   257         /**
       
   258         * Called by OpCompleted, does work after operation is completed.
       
   259         * Gets progress of the completed operation, calls sms mtm ui's DisplayProgressSummary.
       
   260         * If completed enumeration operation, updates dialog's array if no errors.
       
   261         *    if errors, dismisses whole dialog.
       
   262         * If completed copy or delete operation, starts enumeration.
       
   263         * @param aOperation: pointer to operation which is completed.
       
   264         * @param aCompletionCode: Same as in OpCompleted.
       
   265         * @return ETrue if TryToExitL is called. That can happen
       
   266         *    if there is errors with enumeration operation and dialog is dismissed.
       
   267         *    OpCompleted should do nothing.
       
   268         */ 
       
   269         TBool DoOperationCompletedL(
       
   270             CMsvOperation* aOperation, 
       
   271             TInt aCompletionCode );
       
   272 
       
   273         /**
       
   274         * TCleanupItem to clean wait or progress dialogs if leave happens after
       
   275         * dialog creation.
       
   276         * @param aAny: pointer to dialog pointer.
       
   277         */
       
   278         static void CleanupWaitDialog(TAny* aAny);
       
   279 
       
   280         /** 
       
   281         * Launches help application
       
   282         */
       
   283         void LaunchHelpL();
       
   284     
       
   285         /** 
       
   286         * Launches note and starts copy/delete operation
       
   287         * @param aDestinationId to separate copy/delete operation
       
   288         */
       
   289         void LaunchNoteAndOperationL( TMsvId aDestinationId = NULL );
       
   290 
       
   291 		/** 
       
   292         * Updates Middle softkey
       
   293         */
       
   294 		void UpdateMskL();
       
   295     private:
       
   296         CSmsMtmUi&          iSmsMtmUi;
       
   297         CMsvSession&        iSession;
       
   298         CSimMessageArray*   iMessages;
       
   299         TMsvId              iSimFolderId;
       
   300         HBufC*              iOldTitleText;
       
   301         TBuf<KSmumMarkReplacementStringLength>  iMarkReplacementText;
       
   302         CMsvSingleOpWatcher* iEnumerationOperation;
       
   303         CMsvSingleOpWatcher* iCopyOrDeleteOperation;
       
   304         CAknWaitDialog*     iWaitDialog;
       
   305         CAknProgressDialog* iProgressDialog;
       
   306         TInt&               iExitCode;
       
   307         TBool               iSelectionKeyPressed;
       
   308         TBool               iDialogDismissed;
       
   309         TBool               iHelpFeatureSupported;
       
   310         TInt                iMsgCountBeforeOperation;
       
   311         TInt                iResourceFileOffset;
       
   312  	    TBool               iContextCommand;
       
   313     };
       
   314 
       
   315 #endif // __SMSSIMDLG_H__
       
   316 
       
   317 //  End of File