omadm/omadmappui/inc/NSmlDMProgress.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Header file for CNSmlDMProgressDialog
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NSMLDMPROGRESSDIALOG_H
       
    20 #define NSMLDMPROGRESSDIALOG_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <e32base.h>
       
    25 #include    <AknProgressDialog.h>
       
    26 #include    <AknsItemID.h>
       
    27 
       
    28 #include "NSmlDMSyncDocument.h"
       
    29 #include    "NSmlDMdef.h"
       
    30 
       
    31 // CLASS DECLARATIONS
       
    32 
       
    33 /**
       
    34 *  MNSmlDMProgressDialogObserver
       
    35 * 
       
    36 */
       
    37 class MNSmlDMProgressDialogObserver
       
    38     {
       
    39     public:
       
    40         /**
       
    41         * Callback method
       
    42         * Get's called when a dialog is dismissed.
       
    43         */
       
    44         virtual void HandleDialogEventL(TInt aButtonId) = 0;
       
    45     };
       
    46 
       
    47 /**
       
    48 * CNSmlDMProgressDialog2
       
    49 *
       
    50 * CNSmlDMProgressDialog2 is needed to modify CAknProgressDialog::OkToExitL. 
       
    51 */
       
    52 NONSHARABLE_CLASS (CNSmlDMProgressDialog2) : public CAknProgressDialog
       
    53     {
       
    54 	public:
       
    55 
       
    56         /**
       
    57         * C++ default constructor.
       
    58         */
       
    59 		CNSmlDMProgressDialog2(CEikDialog** aSelfPtr);
       
    60 
       
    61         /**
       
    62         * From the base class.
       
    63 		* Called by framework before exiting the dialog.
       
    64         * @param Button id.
       
    65 		* @return ETrue to exit\ EFalse to not to exit.
       
    66         */
       
    67         TBool OkToExitL(TInt aButtonId);
       
    68 
       
    69         /**
       
    70         * From the base class.
       
    71 		* Called to launch the dialog.
       
    72         * @param None.
       
    73 		* @return the Button Id which exits the dialog
       
    74         */
       
    75         TInt RunLD();
       
    76 
       
    77         /**
       
    78         * From the base class.
       
    79 		* Called to stop the timer and delete the dialog.
       
    80         * @param None.
       
    81 		* @return None.
       
    82         */
       
    83         void ProcessFinishedL();
       
    84         
       
    85   private:
       
    86   
       
    87         /**
       
    88         * From the base class.
       
    89 		* Called by framework for key event handling.
       
    90         * @param aKeyEvent.
       
    91 		* @param TEventCode.
       
    92 		* @return Return code.
       
    93         */
       
    94 		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
    95 
       
    96         
       
    97   private:
       
    98         // has dialog received close event (eg. end key) 
       
    99 		TBool iCloseEventReceived;
       
   100 		
       
   101 		// has DM Connection been closed
       
   102         TBool iClosed;
       
   103         //Documnet class reference
       
   104 		CNSmlDMSyncDocument*        iDoc;       
       
   105     };
       
   106 
       
   107 /**
       
   108 *  CNSmlDMProgressDialog
       
   109 *  
       
   110 */
       
   111 NONSHARABLE_CLASS (CNSmlDMProgressDialog) : public CBase,
       
   112                                             public MProgressDialogCallback
       
   113     {
       
   114 	enum TAnimationState
       
   115         {
       
   116         EAnimationOn,
       
   117     	EAnimationOff,
       
   118     	EAnimationNone
       
   119         };
       
   120 
       
   121     public:// Constructors and destructor
       
   122 
       
   123         /**
       
   124         * Two-phased constructor.
       
   125         */
       
   126         static CNSmlDMProgressDialog* NewL(MNSmlDMProgressDialogObserver* aObserver);
       
   127         
       
   128         /**
       
   129         * Destructor.
       
   130         */
       
   131         virtual ~CNSmlDMProgressDialog();
       
   132     
       
   133     private:
       
   134 
       
   135         /**
       
   136         * C++ default constructor.
       
   137         */
       
   138         CNSmlDMProgressDialog( MNSmlDMProgressDialogObserver* aObserverPtr );
       
   139 	
       
   140         /**
       
   141         * By default Symbian OS constructor is private.
       
   142         */
       
   143         void ConstructL();
       
   144         
       
   145 		/**
       
   146 		* From MProgressDialogCallback.
       
   147         * Called by the framework when dialog is dismissed.
       
   148         * @param aButtonId
       
   149         * @return None
       
   150         */
       
   151         void DialogDismissedL( TInt aButtonId );
       
   152 
       
   153     public:        
       
   154         
       
   155         /**
       
   156         * Launches progress dialog.
       
   157         * @param aLabel.
       
   158         * @return None.
       
   159         */
       
   160         void LaunchProgressDialogL( const TDesC& aLabel );
       
   161         
       
   162         /**
       
   163         * Launches progress dialog with custom bitmap.
       
   164         * @param aLabel Dialog label
       
   165         * @param aId Item identifier used to identify items
       
   166         * @param aFileName Name of the file
       
   167         * @param aFileBitmapId Bitmap id
       
   168         * @param aFileMaskId Mask id
       
   169         * @return None.
       
   170         */
       
   171         void LaunchProgressDialogL( const TDesC& aLabel,
       
   172                                     TAknsItemID aId,
       
   173                                     const TDesC& aFileName,
       
   174                                     TInt aFileBitmapId,
       
   175                                     TInt aFileMaskId );
       
   176         
       
   177         /**
       
   178         * Closes progress dialog.
       
   179         * @param None
       
   180         * @return None
       
   181         */
       
   182         void CancelProgressDialogL();
       
   183         
       
   184         /**
       
   185         * Update dialog label text.
       
   186         * @param aText.
       
   187         * @return None.
       
   188         */
       
   189         void UpdateTextL( const TDesC& aText );
       
   190 
       
   191         /**
       
   192         * Update dialog label text.
       
   193         * @param aResId.
       
   194         * @return None.
       
   195         */
       
   196         void UpdateTextL( TInt aResId );
       
   197 
       
   198 
       
   199         /**
       
   200         * Set progress bar state.
       
   201         * @param aValue.
       
   202         * @return None
       
   203         */
       
   204         void SetProgress( TInt aValue );
       
   205 
       
   206         /**
       
   207         * Set progress bar state.
       
   208         * @param aFinalValue.
       
   209         * @return None
       
   210         */
       
   211         void SetFinalProgress( TInt aFinalValue );
       
   212 
       
   213         /**
       
   214         * Gets CAknNoteControl from CAknProgressDialog.
       
   215         * @param None
       
   216         * @return CAknNoteControl.
       
   217         */
       
   218 		CAknNoteControl* NoteControl();
       
   219 
       
   220         /**
       
   221         * Cancels animation.
       
   222         * @param None.
       
   223         * @return None.
       
   224         */
       
   225 		void CancelAnimation();
       
   226         
       
   227 		/**
       
   228         * Starts animation.
       
   229         * @param None
       
   230         * @return None.
       
   231         */
       
   232 		void StartAnimationL();
       
   233     private:
       
   234         /**
       
   235         * Read resource
       
   236         * @param aText Resource text
       
   237         * @param aResourceId Resource id
       
   238         * @return None.
       
   239         */
       
   240         void ReadL( TDes& aText, TInt aResourceId );
       
   241 
       
   242     public:       
       
   243         /**
       
   244         * Create image
       
   245         * @param aId
       
   246         * @param aFileName
       
   247         * @param aFileBitmapId
       
   248         * @param aFileMaskId
       
   249         * @return CEikImage*
       
   250         */        
       
   251         CEikImage* CreateImageLC( TAknsItemID aId,
       
   252                                   const TDesC& aFileName,
       
   253                                   TInt aFileBitmapId,
       
   254                                   TInt aFileMaskId );
       
   255        /**
       
   256         * Set's the image
       
   257         * @param CEikImage*
       
   258         * @return None
       
   259         */                            
       
   260        void SetImageL(CEikImage* aimage);
       
   261 
       
   262     private:
       
   263         // progress dialog
       
   264 		CNSmlDMProgressDialog2*	iProgressDialog;
       
   265 
       
   266         // progress dialog info
       
   267         CEikProgressInfo* iProgressInfo;
       
   268 
       
   269 		// last label text
       
   270 		TBuf<KBufSize> iLastText;
       
   271 
       
   272 		// animation state
       
   273 		TBool iAnimation;
       
   274 
       
   275 		// dialog observer
       
   276         MNSmlDMProgressDialogObserver*	iObserver;
       
   277 
       
   278 		// count of received events from CAknProgressDialog
       
   279 		TInt iEventCount;
       
   280     };
       
   281 
       
   282 #endif // NSMLDMPROGRESSDIALOG_H
       
   283             
       
   284 // End of File