1.1 --- a/epoc32/include/mw/aknwaitnotewrapper.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/aknwaitnotewrapper.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,155 @@
1.4 -aknwaitnotewrapper.h
1.5 +/*
1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Declares a wait note wrapper.
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +#ifndef CAknWaitNoteWrapper_H
1.25 +#define CAknWaitNoteWrapper_H
1.26 +
1.27 +// INCLUDES
1.28 +#include <e32base.h>
1.29 +#include <AknProgressDialog.h>
1.30 +
1.31 +
1.32 +// CONSTANTS
1.33 +class CAknWaitDialog;
1.34 +
1.35 +
1.36 +// CLASS DECLARATION
1.37 +
1.38 +/**
1.39 + * Abstract process divided into steps.
1.40 + */
1.41 +class MAknBackgroundProcess
1.42 + {
1.43 + public: // interface
1.44 + /**
1.45 + * Completes one cycle of the process.
1.46 + */
1.47 + virtual void StepL()=0;
1.48 +
1.49 + /**
1.50 + * Return true when the process is done.
1.51 + */
1.52 + virtual TBool IsProcessDone() const =0;
1.53 +
1.54 + /**
1.55 + * Callback when the process is finished.
1.56 + */
1.57 + virtual void ProcessFinished() { }
1.58 +
1.59 + /**
1.60 + * Callback when the dialog is dismissed
1.61 + */
1.62 + virtual void DialogDismissedL(TInt /*aButtonId*/) { }
1.63 +
1.64 + /**
1.65 + * Handles error occurred in StepL
1.66 + * @param aError error code that occurred
1.67 + * @return translated error code. If this is != KErrNone process will be stopped.
1.68 + */
1.69 + virtual TInt CycleError(TInt aError) { return aError; }
1.70 + };
1.71 +
1.72 +/**
1.73 + * CAknWaitNoteWrapper class.
1.74 + */
1.75 +NONSHARABLE_CLASS(CAknWaitNoteWrapper) : private CActive, private MProgressDialogCallback
1.76 + {
1.77 + public: // constructor and destructor
1.78 + IMPORT_C static CAknWaitNoteWrapper* NewL();
1.79 +
1.80 + IMPORT_C ~CAknWaitNoteWrapper();
1.81 +
1.82 + public: // interface
1.83 + /**
1.84 + * Executes the wait note and calls the cycle callback.
1.85 + *
1.86 + * @param aResId Resource id for the dialog.
1.87 + * @param aBackgroundProcess Callback interface.
1.88 + * @param aVisibilityDelayOff If set ETrue the dialog will be visible
1.89 + * immediality. Use only when the length of
1.90 + * the process is ALWAYS over 1.5 seconds.
1.91 + * @param aTone Will be played when the dialog is shown.
1.92 + *
1.93 + * @return true if success, false if wait note was canceled.
1.94 + */
1.95 + IMPORT_C TBool ExecuteL(TInt aResId, MAknBackgroundProcess& aBackgroundProcess,
1.96 + TBool aVisibilityDelayOff = EFalse, const CAknNoteDialog::TTone& aTone = CAknNoteDialog::ENoTone);
1.97 +
1.98 +
1.99 + /**
1.100 + * Executes the wait note and calls the cycle callback.
1.101 + * Dynamically set note prompt.
1.102 + *
1.103 + * @param aResId Resource id for the dialog.
1.104 + * @param aBackgroundProcess Callback interface.
1.105 + * @param aPrompt Note Prompt
1.106 + * @param aVisibilityDelayOff If set ETrue the dialog will be visible
1.107 + * immediality. Use only when the length of
1.108 + * the process is ALWAYS over 1.5 seconds.
1.109 + * @param aTone Will be played when the dialog is shown.
1.110 + *
1.111 + * @return true if success, false if wait note was canceled.
1.112 + */
1.113 + IMPORT_C TBool ExecuteL(TInt aResId, MAknBackgroundProcess& aBackgroundProcess,
1.114 + const TDesC& aPrompt, TBool aVisibilityDelayOff = EFalse, const CAknNoteDialog::TTone& aTone = CAknNoteDialog::ENoTone);
1.115 +
1.116 + /**
1.117 + * Return pointer to dialog
1.118 + */
1.119 + inline CAknWaitDialog* WaitDialog() const;
1.120 +
1.121 + private: // from CActive
1.122 + void DoCancel();
1.123 + void RunL();
1.124 + TInt RunError(TInt aError);
1.125 +
1.126 + private: // from MProgressDialogCallback
1.127 + void DialogDismissedL(TInt aButtonId);
1.128 +
1.129 + private: // implementation
1.130 + class CWaitNote;
1.131 +
1.132 + CAknWaitNoteWrapper();
1.133 + void NextCycle();
1.134 +
1.135 + TBool NextCycleAndReturnL();
1.136 + void CreateDialogL(TBool aVisibilityDelayOff, const CAknNoteDialog::TTone& aTone);
1.137 +
1.138 +
1.139 + private: // data members
1.140 + /// Ref: callback to client
1.141 + MAknBackgroundProcess* iBackgroundProcess;
1.142 + /// Own: error code from RunL
1.143 + TInt iRunError;
1.144 + /// Own: wait note dialog
1.145 + CAknWaitDialog* iWaitDialog;
1.146 + /// Own: is dialog dismissed
1.147 + TBool iIsDialogCanceled;
1.148 + /// Own: scheduler wait object, safe to use as direct member data.
1.149 + CActiveSchedulerWait iWait;
1.150 + ///Event generator for this AO (interval is zero seconds)
1.151 + RTimer iTimer;
1.152 +
1.153 + };
1.154 +
1.155 +CAknWaitDialog* CAknWaitNoteWrapper::WaitDialog() const { return iWaitDialog;}
1.156 +
1.157 +#endif
1.158 +
1.159 +// End of File