|
1 /* |
|
2 * Copyright (c) 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: sync progress indication |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ASPPROGRESSDIALOG_H |
|
20 #define ASPPROGRESSDIALOG_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <AknWaitDialog.h> |
|
26 #include <AknProgressDialog.h> |
|
27 |
|
28 #include "AspDefines.h" |
|
29 #include "AspResHandler.h" |
|
30 |
|
31 |
|
32 // CLASS DECLARATIONS |
|
33 |
|
34 |
|
35 /** |
|
36 * MAspProgressDialogObserver |
|
37 * |
|
38 * Observer interface function for observing progress dialog. |
|
39 */ |
|
40 NONSHARABLE_CLASS (MAspProgressDialogObserver) |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Callback method |
|
45 * Get's called when a dialog is dismissed. |
|
46 */ |
|
47 virtual void HandleDialogEventL(TInt aButtonId) = 0; |
|
48 }; |
|
49 |
|
50 |
|
51 |
|
52 /** |
|
53 * CAspProgressDialog2 |
|
54 * |
|
55 * CAspProgressDialog2 is needed to modify CAknProgressDialog::OkToExitL. |
|
56 */ |
|
57 NONSHARABLE_CLASS (CAspProgressDialog2) : public CAknProgressDialog |
|
58 { |
|
59 public: |
|
60 /** |
|
61 * C++ default constructor. |
|
62 */ |
|
63 CAspProgressDialog2(CEikDialog** aSelfPtr, TInt aApplicationId); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CAspProgressDialog2(); |
|
69 |
|
70 /** |
|
71 * From the base class. |
|
72 * Called by framework before exiting the dialog. |
|
73 * @param Button id. |
|
74 * @return ETrue to exit\ EFalse to not to exit. |
|
75 */ |
|
76 TBool OkToExitL(TInt aButtonId); |
|
77 |
|
78 /** |
|
79 * From the base class. |
|
80 * Called by framework for key event handling. |
|
81 * @param aKeyEvent. |
|
82 * @param TEventCode. |
|
83 * @return Return code. |
|
84 */ |
|
85 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
86 |
|
87 private: |
|
88 // has dialog received close event (eg. end key) |
|
89 TBool iCloseEventReceived; |
|
90 |
|
91 // has cancel key been pressed |
|
92 TBool iCancelEventReceived; |
|
93 |
|
94 // has sync been closed |
|
95 TBool iClosed; |
|
96 |
|
97 // has sync been canceled |
|
98 TBool iCanceled; |
|
99 |
|
100 // id of the calling application |
|
101 TInt iApplicationId; |
|
102 }; |
|
103 |
|
104 |
|
105 |
|
106 /** |
|
107 * CAspProgressDialog |
|
108 * |
|
109 * CAspProgressDialog show sync progress dialog. |
|
110 */ |
|
111 NONSHARABLE_CLASS (CAspProgressDialog) : public CBase, public MProgressDialogCallback |
|
112 { |
|
113 |
|
114 public:// Constructors and destructor |
|
115 |
|
116 /** |
|
117 * Two-phased constructor. |
|
118 */ |
|
119 static CAspProgressDialog* NewL(MAspProgressDialogObserver* aObserver); |
|
120 |
|
121 /** |
|
122 * Destructor. |
|
123 */ |
|
124 virtual ~CAspProgressDialog(); |
|
125 |
|
126 private: |
|
127 |
|
128 /** |
|
129 * C++ default constructor. |
|
130 */ |
|
131 CAspProgressDialog(MAspProgressDialogObserver* aObserverPtr); |
|
132 |
|
133 /** |
|
134 * By default Symbian OS constructor is private. |
|
135 */ |
|
136 void ConstructL(); |
|
137 |
|
138 /** |
|
139 * From MProgressDialogCallback. |
|
140 * Called by the framework when dialog is dismissed. |
|
141 * @param aButtonId |
|
142 * @return None |
|
143 */ |
|
144 void DialogDismissedL(TInt aButtonId); |
|
145 |
|
146 public: |
|
147 |
|
148 /** |
|
149 * Launches progress dialog with custom bitmap. |
|
150 * @param aLabel. |
|
151 * @param aId. |
|
152 * @param aFileName. |
|
153 * @param aFileBitmapId. |
|
154 * @param aFileMaskId. |
|
155 * @return None. |
|
156 */ |
|
157 void LaunchProgressDialogL(const TDesC& aLabel, TAknsItemID aId, const TDesC& aFileName, TInt aFileBitmapId, TInt aFileMaskId); |
|
158 |
|
159 |
|
160 /** |
|
161 * Closes progress dialog. |
|
162 * @param None |
|
163 * @return None |
|
164 */ |
|
165 void CancelProgressDialogL(); |
|
166 |
|
167 /** |
|
168 * Update dialog label text. |
|
169 * @param aText. |
|
170 * @return None. |
|
171 */ |
|
172 void UpdateTextL(const TDesC& aText); |
|
173 |
|
174 /** |
|
175 * Set progress bar state. |
|
176 * @param aValue. |
|
177 * @return None |
|
178 */ |
|
179 void SetProgress(TInt aValue); |
|
180 |
|
181 /** |
|
182 * Set progress bar state. |
|
183 * @param aFinalValue. |
|
184 * @return None |
|
185 */ |
|
186 void SetFinalProgress(TInt aFinalValue); |
|
187 |
|
188 /** |
|
189 * Gets CAknNoteControl from CAknProgressDialog. |
|
190 * @param None |
|
191 * @return CAknNoteControl. |
|
192 */ |
|
193 CAknNoteControl* NoteControl(); |
|
194 |
|
195 /** |
|
196 * Cancels animation. |
|
197 * @param None. |
|
198 * @return None. |
|
199 */ |
|
200 void CancelAnimation(); |
|
201 |
|
202 /** |
|
203 * Starts animation. |
|
204 * @param None |
|
205 * @return None. |
|
206 */ |
|
207 void StartAnimationL(); |
|
208 |
|
209 /** |
|
210 * Hides cancel button. |
|
211 * @param None |
|
212 * @return None. |
|
213 */ |
|
214 void HideButtonL(); |
|
215 |
|
216 /** |
|
217 * Set application id. |
|
218 * @param aApplicationId |
|
219 * @return None. |
|
220 */ |
|
221 void SetApplicationId(TInt aApplicationId); |
|
222 |
|
223 /** |
|
224 * Returns progress dialog |
|
225 * @param None |
|
226 * @return CAspProgressDialog2* |
|
227 */ |
|
228 CAspProgressDialog2* ProgressDialog(); |
|
229 |
|
230 private: |
|
231 // id of the calling application |
|
232 TInt iApplicationId; |
|
233 |
|
234 // progress dialog |
|
235 CAspProgressDialog2* iProgressDialog; |
|
236 |
|
237 // is dialog running |
|
238 TBool iProgressDialogRunning; |
|
239 |
|
240 // progress dialog info |
|
241 CEikProgressInfo* iProgressInfo; |
|
242 |
|
243 // last label text |
|
244 TBuf<KBufSize> iLastText; |
|
245 |
|
246 // animation state |
|
247 TBool iAnimation; |
|
248 |
|
249 // resource handler |
|
250 CAspResHandler* iResHandler; |
|
251 |
|
252 // dialog observer |
|
253 MAspProgressDialogObserver* iObserver; |
|
254 }; |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 #endif // ASPPROGRESSDIALOG_H |
|
260 |
|
261 // End of File |