#include <mw/AknProgressDialog.h>
class CAknProgressDialog : public CAknNoteDialog |
Protected Attributes | |
---|---|
MProgressDialogCallback * | iCallback |
TTimerModel | iModel |
CPeriodic * | iProgressDialogTimer |
TProgressDialogState | iState |
TBool | iVisibilityDelayOff |
Protected Member Enumerations | |
---|---|
enum | TProgressDialogState { EProcessOnDisplayOff, EProcessOnDisplayOn, EProcessOffDisplayOff, EProcessOffDisplayOn, ..., EProcessOnDisplayOnCanBeDismissed } |
Public Member Functions | |
---|---|
CAknProgressDialog(TInt, TInt, TInt, CEikDialog **) | |
CAknProgressDialog(CEikDialog **) | |
CAknProgressDialog(CEikDialog **, TBool) | |
virtual | ~CAknProgressDialog() |
IMPORT_C CEikProgressInfo * | GetProgressInfoL() |
virtual IMPORT_C void | HandlePointerEventL(const TPointerEvent &) |
virtual IMPORT_C TKeyResponse | OfferKeyEventL(const TKeyEvent &, TEventCode) |
IMPORT_C void | ProcessFinishedL() |
virtual IMPORT_C TInt | RunLD() |
IMPORT_C void | SetCallback(MProgressDialogCallback *) |
Protected Member Functions | |
---|---|
TInt | DialogTimerCallback(TAny *) |
TInt | DialogTimerEvent() |
virtual IMPORT_C TBool | OkToExitL(TInt) |
virtual IMPORT_C void | PreLayoutDynInitL(void) |
Inherited Enumerations | |
---|---|
CAknNoteDialog:TTimeout | |
CAknNoteDialog:TTone | |
CCoeControl:TZoomType | |
CEikDialog:@121 |
A note dialog with a timer. Display the note only if the process is at least 1 second long in order to avoid a note quickly flashing on the screen. Display the note for at least 1.5 seconds (even if the client process is shorter that this). The client can specify an initial delay when displaying the note. Timer events are used for displaying and dismissing the dialog. The client can set the progress by specifying the values in the constructors provided.
Fixed process length
iProgressDialog = new(ELeave)CAknProgressDialog(model->FinalValue(),model->Increment(), model->Interval(), (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressDialog->ExecuteLD(R_PROGRESS_NOTE);
Variable process length
iProgressDialog = new(ELeave)CAknProgressDialog( (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressInfo = iProgressDialog->GetProgressInfoL(); iProgressInfo->SetFinalValue(model->FinalValue()); iProgressDialog->ExecuteLD(R_PROGRESS_NOTE);
// Incrementing progress of the process: iProgressInfo->IncrementAndDraw(model->Increment());
// Process finished iProgressDialog->ProcessFinishedL(); // deletes the dialog
Variable process length, modal dialog
Set following flags in resources: EEikDialogFlagWait and EAknProgressNoteFlags
iProgressDialog = new(ELeave)CAknProgressDialog( (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressInfo = iProgressDialog->GetProgressInfoL(); iProgressInfo->SetFinalValue(model->FinalValue()); iProgressInfo->SetTone( CAknNoteDialog::EConfirmationTone ); iProgressDialog->ExecuteLD(R_PROGRESS_NOTE);
// Incrementing progress of the process: iProgressInfo->IncrementAndDraw(model->Increment());
// Process finished iProgressDialog->ProcessFinishedL(); // deletes the dialog
Setting label dynamically
iProgressDialog = new(ELeave)CAknProgressDialog( (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); iProgressDialog->PrepareLC(R_PROGRESS_NOTE); iProgressDialog->SetTextL(_L("Hello AVKON!")); iProgressDialog->RunLD();
Inherit from pure virtual class MProgressDialogCallback
Implement DialogDismissedL
Call CAknProgressDialog->SetCallback(this);
Or make your dialog modal. If the dialog is used as a modal, RunLD returns 0 if the dialog is dismissed and EAknSoftkeyDone if not.
Always set EEikDialogFlagNotifyEsc. (or use preset avkon dialog resource flag, i.e. EAknProgressNoteFlags).
To make a dialog modal use EEikDialogFlagWait
Note! If aVisibilityDelayOff is set to ETrue in constructor the dialog will be visible immediality. This should only be used in cases where the process lasts ALWAYS atleast 1.5 seconds.
For comprehensive example, see
CPeriodic * | iProgressDialogTimer | [protected] |
Timer to handle dialog's visibility and existence.
TBool | iVisibilityDelayOff | [protected] |
Boolean to declare whether the visibility delay should be on or off.
Enumeration to handle progress states
IMPORT_C | CAknProgressDialog | ( | TInt | aFinalValue, |
TInt | anIncrement, | |||
TInt | anInterval, | |||
CEikDialog ** | aSelfPtr | |||
) |
Constructor Use this when the length (in time) of the process is known.
Parameter | Description |
---|---|
aFinalValue | Final value for the process |
anIncrement | Increment of the process |
anInterval | Interval of the process |
aSelfPtr | Pointer to itself. The pointer must be valid when the dialog is dismissed and it must not be on the stack. |
IMPORT_C | CAknProgressDialog | ( | CEikDialog ** | aSelfPtr | ) |
Constructor Use this if the length of the process is unknown but the progress can be calculated.
Parameter | Description |
---|---|
aSelfPtr | Pointer to itself. The pointer must be valid when the dialog is dismissed and it must not be on the stack. |
IMPORT_C | CAknProgressDialog | ( | CEikDialog ** | aSelfPtr, |
TBool | aVisibilityDelayOff | |||
) |
Constructor Use this if the length of the process is unknown but the progress can be calculated.
Parameter | Description |
---|---|
aSelfPtr | Pointer to itself. The pointer must be valid when the dialog is dismissed and it must not be on the stack. |
aVisibilityDelayOff | If set ETrue the dialog will be visible immediality. Use only when the length of the process is ALWAYS over 1.5 seconds. |
IMPORT_C CEikProgressInfo * | GetProgressInfoL | ( | ) |
Get a handle to the progress bar.
IMPORT_C void | HandlePointerEventL | ( | const TPointerEvent & | aPointerEvent | ) | [virtual] |
Reimplemented from CAknNoteDialog::HandlePointerEventL(const TPointerEvent &)
HandlePointerEventL processes pointer events directed at the ProgressDialog.
Parameter | Description |
---|---|
aPointerEvent | Pointerevent to be handled. |
IMPORT_C TKeyResponse | OfferKeyEventL | ( | const TKeyEvent & | aKeyEvent, |
TEventCode | aType | |||
) | [virtual] |
Reimplemented from CAknNoteDialog::OfferKeyEventL(const TKeyEvent &,TEventCode)
Handle key events (part of CONE framework)
Reimplemented from CEikDialog::OkToExitL(TInt)
Called by the dialog framework, returns true if the dialog can exit, false otherwise.
Parameter | Description |
---|---|
aButtonId | Id of the softkey which was pressed |
Returns: ETrue if the dialog can exit, false otherwise.
IMPORT_C void | PreLayoutDynInitL | ( | void | ) | [protected, virtual] |
Reimplemented from CAknNoteDialog::PreLayoutDynInitL(void)
Initializes dialog before layout is executed (part of dialog framework).
IMPORT_C void | ProcessFinishedL | ( | ) |
This must be called when the dialog must be dismissed. It stops the timer and deletes the dialog.
IMPORT_C TInt | RunLD | ( | ) | [virtual] |
Reimplemented from CAknNoteDialog::RunLD()
Executes the dialog (part of dialog framework). PrepareLC needs to be called before this.
IMPORT_C void | SetCallback | ( | MProgressDialogCallback * | aCallback | ) |
This callback notifies the client when the dialog is dismissed.