2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Uses notification framework to show a global progress dialog.
18 #ifndef __AKNGLOBALPROGRESSDIALOG_H__
19 #define __AKNGLOBALPROGRESSDIALOG_H__
21 #include <AknNotify.h>
22 #include <AknNotifyStd.h>
23 #include <AknProgressDialog.h>
24 #include <AknsItemID.h>
29 * CAknGlobalProgressDialog
30 * Uses notification framework to show a global progress dialog.
32 * Create an active object, start it and pass its TRequestStatus as a
33 * parameter to ShowProgressDialogL. After the dialog gets dismissed,
34 * the request status will hold the id of the pressed softkey. E.g.
35 * If the user selected Cancel, the request status will hold -1.
37 * Example 1. Construct global progress dialog and set icon and image.
39 * iGlobalProgressDialog = CAknGlobalProgressDialog::NewL();
40 * iGlobalProgressDialog->SetIconL(
46 * iGlobalProgressDialog->SetImageL(
51 * Example 2. Show the global progress dialog:
53 * iGlobalProgressDialog->ShowMsgQueryL(
56 * R_AVKON_SOFTKEYS_OK_CANCEL,
58 * CAknQueryDialog::EConfirmationTone );
60 * Example 3. Update the progress (current and final value of the process).
62 * iGlobalProgressDialog->UpdateProgressDialog( 100, 500 );
64 * Example 4. Finish the progress
65 * Needs to be called everytime the process has finished.
66 * Dismisses the dialog.
68 * iGlobalProgressDialog->ProcessFinished();
70 * Example 5. Get and handle the result in active object.
72 * void CMyActiveObject::RunL()
74 * TBuf<120> msg = _L("Received: ");
75 * // iStatus.Int() holds the return value
76 * msg.AppendNum( iStatus.Int() );
77 * iEnv->InfoMsg(msg); // Show infomsg
81 * Example 6. Cancel the progress dialog
83 * iGlobalProgressDialog->CancelProgressDialog();
86 NONSHARABLE_CLASS(CAknGlobalProgressDialog) : public CBase
89 IMPORT_C static CAknGlobalProgressDialog* NewL();
90 IMPORT_C static CAknGlobalProgressDialog* NewLC();
91 IMPORT_C ~CAknGlobalProgressDialog();
94 * Set icon for the progress dialog
95 * Must be called before ShowProgressDialogL.
97 * @param aIconText Icon text
98 * @param aIconFile Icon file
99 * @param aIconId Icon id
100 * @param aIconMaskId Mask id for icon
102 IMPORT_C void SetIconL( const TDesC& aIconText,
103 const TDesC& aIconFile,
105 TInt aIconMaskId = -1 );
108 * Set image for the progress dialog
109 * Must be called before ShowProgressDialogL.
110 * If not set, default image will be used,
111 * i.e. EMbmAvkonQgn_note_progress
113 * @param aImageFile Image file
114 * @param aImageId Image id
115 * @param aImageMaskId Mask id for Image
117 IMPORT_C void SetImageL(
118 const TDesC& aImageFile,
120 TInt aImageMaskId = -1 );
123 * Shows global progress dialog asynchronously
125 * @param aStatus TRequestStatus which will be completed
126 * when the dialog gets dismissed
127 * @param aPrompt Prompt text
128 * @param aSoftkeys Softkeys resource id
129 * If not set default softkeys are used.
130 * i.e. R_AVKON_SOFTKEYS_CANCEL
131 * @param aFinalValue Final value of the process
132 * @param aTone Tone to be played after completion
134 IMPORT_C void ShowProgressDialogL(
135 TRequestStatus& aStatus,
136 const TDesC& aPrompt,
138 TInt aFinalValue = 0,
139 CAknNoteDialog::TTone aTone = CAknNoteDialog::ENoTone );
142 * Update Progress dialog with new progress values.
144 * @param aValue Current value of the process.
145 * @param aFinalValue Final value of the process. If not given the
146 * existing value is used.
148 IMPORT_C void UpdateProgressDialog(
150 TInt aFinalValue = -1 );
154 * Dismisses the dialog. Needs to be called after the
155 * process has finished.
157 IMPORT_C void ProcessFinished();
160 * Cancel the progress dialog.
161 * Cancels the request and deletes the dialog.
163 IMPORT_C void CancelProgressDialog();
167 * Set Skin ids for note image and icon. Must be called before ShowProgressDialogL in order
168 * to have effect. No need to use this method if image from avkon.mbm is used.
170 * @aparam aImageId SkinId for image in query. If image not found from active skin,
171 * default image / SetImageL definitions used instead.
173 * @aparam aIconId SkinId for icon in query. If image not found from active skin,
174 * default icon / SetIconL definitions used instead.
176 IMPORT_C void SetImageSkinIds( TAknsItemID& aImageId, TAknsItemID& aIconId );
180 * Sets additional information to be sent to secondary display.
181 * Takes ownership of object.
182 * Must be called before sending data to notifier to have effect.
185 * @aparam aData Data to be sent to cover UI.
187 IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
191 * Default constructor.
193 CAknGlobalProgressDialog();
203 void UpdateNotifier();
206 // Command send to server.
207 TAknGlobalQueryCmd iCmd;
208 // Final value of the process.
210 // Current value of the process.
212 // Handle to session with notify server.
214 // Buffer used to pass parameters to server.
216 // Pointer to iBuffer
221 // Id of the image's mask.
225 // Id of the icon's mask.
235 TInt iImageSkinsMajorId;
236 TInt iImageSkinsMinorId;
238 TInt iIconSkinsMajorId;
239 TInt iIconSkinsMinorId;
240 CAknSDData* iAknSDData;
241 TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
244 #endif // __AKNGLOBALPROGRESSDIALOG_H__