00001 /* 00002 * ============================================================================ 00003 * Name : CAknWaitNoteWrapper.h 00004 * Part of : Avkon 00005 * 00006 * Description: 00007 * Declares a wait note wrapper. 00008 * Version: 00009 * 00010 * Copyright © 2002 Nokia Corporation. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia Corporation. All rights are reserved. Copying, 00014 * including reproducing, storing, adapting or translating, any 00015 * or all of this material requires the prior written consent of 00016 * Nokia Corporation. This material also contains confidential 00017 * information which may not be disclosed to others without the 00018 * prior written consent of Nokia Corporation. 00019 * ============================================================================ 00020 */ 00021 00022 #ifndef CAknWaitNoteWrapper_H 00023 #define CAknWaitNoteWrapper_H 00024 00025 // INCLUDES 00026 #include <e32base.h> 00027 #include <AknProgressDialog.h> 00028 00029 00030 // CONSTANTS 00031 class CAknWaitDialog; 00032 00033 00034 // CLASS DECLARATION 00035 00039 class MAknBackgroundProcess 00040 { 00041 public: // interface 00045 virtual void StepL()=0; 00046 00050 virtual TBool IsProcessDone() const =0; 00051 00055 virtual void ProcessFinished() { } 00056 00060 virtual void DialogDismissedL(TInt /*aButtonId*/) { } 00061 00067 virtual TInt CycleError(TInt aError) { return aError; } 00068 }; 00069 00073 NONSHARABLE_CLASS(CAknWaitNoteWrapper) : private CActive, private MProgressDialogCallback 00074 { 00075 public: // constructor and destructor 00076 IMPORT_C static CAknWaitNoteWrapper* NewL(); 00077 00078 IMPORT_C ~CAknWaitNoteWrapper(); 00079 00080 public: // interface 00093 IMPORT_C TBool ExecuteL(TInt aResId, MAknBackgroundProcess& aBackgroundProcess, 00094 TBool aVisibilityDelayOff = EFalse, const CAknNoteDialog::TTone& aTone = CAknNoteDialog::ENoTone); 00095 00096 00111 IMPORT_C TBool ExecuteL(TInt aResId, MAknBackgroundProcess& aBackgroundProcess, 00112 const TDesC& aPrompt, TBool aVisibilityDelayOff = EFalse, const CAknNoteDialog::TTone& aTone = CAknNoteDialog::ENoTone); 00113 00117 inline CAknWaitDialog* WaitDialog() const; 00118 00119 private: // from CActive 00120 void DoCancel(); 00121 void RunL(); 00122 TInt RunError(TInt aError); 00123 00124 private: // from MProgressDialogCallback 00125 void DialogDismissedL(TInt aButtonId); 00126 00127 private: // implementation 00128 class CWaitNote; 00129 00130 CAknWaitNoteWrapper(); 00131 void NextCycle(); 00132 00133 TBool NextCycleAndReturnL(); 00134 void CreateDialogL(TBool aVisibilityDelayOff, const CAknNoteDialog::TTone& aTone); 00135 00136 00137 private: // data members 00139 MAknBackgroundProcess* iBackgroundProcess; 00141 TInt iRunError; 00143 CAknWaitDialog* iWaitDialog; 00145 TBool iIsDialogCanceled; 00147 CActiveSchedulerWait iWait; 00149 RTimer iTimer; 00150 00151 }; 00152 00153 CAknWaitDialog* CAknWaitNoteWrapper::WaitDialog() const { return iWaitDialog;} 00154 00155 #endif 00156 00157 // End of File