|
1 /* |
|
2 * Copyright (c) 2004 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 the License "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: Handle dialogs needed for browser operation |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef BROWSERDIALOGSPROVIDER_H |
|
19 #define BROWSERDIALOGSPROVIDER_H |
|
20 |
|
21 // INCLUDES |
|
22 // System Includes |
|
23 #include <BrCtlDialogsProvider.h> |
|
24 #include <eikenv.h> |
|
25 #include <coneresloader.h> |
|
26 #include <e32std.h> |
|
27 #include <MMGFetchVerifier.h> |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // Tooltip |
|
32 const TInt KDefaultTooltipDelay = 1; // time in milliseconds |
|
33 const TInt KDefaultTooltipDuration = 2000; // time in milliseconds |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CBrowserSelectElementDlg; |
|
37 class MBrowserDialogsProviderObserver; |
|
38 class CAknInfoPopupNoteController; |
|
39 class CBrowserUploadProgressNote; |
|
40 class MMGFetchVerifier; |
|
41 |
|
42 //============================================================================= |
|
43 // CLASS DECLARATION: CBrowserDialogsProvider |
|
44 //============================================================================= |
|
45 /** |
|
46 * Provide dialogs needed for browser operation |
|
47 * |
|
48 * @lib BrowserDialogsProvider.lib |
|
49 * @since 2.8 |
|
50 */ |
|
51 class CBrowserDialogsProvider : public CBase, |
|
52 public MBrCtlDialogsProvider, |
|
53 public MMGFetchVerifier |
|
54 { |
|
55 // Construction/Destruction |
|
56 public: |
|
57 |
|
58 // EPOC Two stage constructor |
|
59 IMPORT_C static CBrowserDialogsProvider* NewL( |
|
60 MBrowserDialogsProviderObserver* aObserver ); |
|
61 |
|
62 // Destructor |
|
63 virtual ~CBrowserDialogsProvider(); |
|
64 |
|
65 protected: |
|
66 |
|
67 // 1st stage Constructor |
|
68 CBrowserDialogsProvider( MBrowserDialogsProviderObserver* aObserver ); |
|
69 |
|
70 // 2nd stage constructor |
|
71 void ConstructL(); |
|
72 |
|
73 public: // From MBrCtlDialogsProvider |
|
74 |
|
75 /** |
|
76 * Notify the user of an error |
|
77 * @since 2.8 |
|
78 * @param aErrCode The error that occured |
|
79 * @return void |
|
80 */ |
|
81 IMPORT_C virtual void DialogNotifyErrorL(TInt aErrCode); |
|
82 |
|
83 /** |
|
84 * Notify the user of an http error |
|
85 * @since 2.8 |
|
86 * @param aErrCode The error that occured |
|
87 * @param aUri The uri of the request that failed |
|
88 * @return void |
|
89 */ |
|
90 IMPORT_C virtual void DialogNotifyHttpErrorL( TInt aErrCode, |
|
91 const TDesC& aUri ); |
|
92 |
|
93 /** |
|
94 * File selection dialog |
|
95 * @since 2.8 |
|
96 * @param aStartPath The initial displayed directory |
|
97 * @param aRootPath The top most directory that the user can go up to |
|
98 * @param aSelectedFileName The selected file name. |
|
99 * Returned on cleanup stack. Browser control will free the buffer |
|
100 * @return EFalse if the user canceled, ETrue otherwise |
|
101 */ |
|
102 IMPORT_C virtual TBool DialogFileSelectLC(const TDesC& aStartPath, |
|
103 const TDesC& aRootPath, |
|
104 HBufC*& aSelectedFileName); |
|
105 |
|
106 /** |
|
107 * List selection dialog |
|
108 * @since 2.8 |
|
109 * @param aTitle The title, could be empty |
|
110 * @param aBrowserSelectOptionType The type of the list box |
|
111 * @param aOptions A list of options to display |
|
112 * @return EFalse if the user canceled, ETrue otherwise |
|
113 */ |
|
114 IMPORT_C virtual TBool DialogSelectOptionL( |
|
115 const TDesC& aTitle, |
|
116 TBrCtlSelectOptionType aBrowserSelectOptionType, |
|
117 CArrayFix<TBrCtlSelectOptionData>& aOptions ); |
|
118 |
|
119 /** |
|
120 * User Authentication dialog. |
|
121 * User name and password are returned on cleanup stack |
|
122 * @since 2.8 |
|
123 * @param aUrl The url requiring authentication |
|
124 * @param aRealm The realm requiring authentication |
|
125 * @param aDefaultUser/Name The user name that was used before for this |
|
126 * realm and path, if any |
|
127 * @param aReturnedUserName The user name entered by the user |
|
128 * @param aReturnedPasswd The password entered by the user |
|
129 * @param aBasicAuthentication A flag if basic authentication was used |
|
130 * @return EFalse if the user canceled, ETrue otherwise |
|
131 */ |
|
132 IMPORT_C virtual TBool DialogUserAuthenticationLC( |
|
133 const TDesC& aUrl, |
|
134 const TDesC& aRealm, |
|
135 const TDesC& aDefaultUserName, |
|
136 HBufC*& aReturnedUserName, |
|
137 HBufC*& aReturnedPasswd, |
|
138 TBool aBasicAuthentication = EFalse); |
|
139 |
|
140 /** |
|
141 * Display a note to the user. No softkeys |
|
142 * @since 2.8 |
|
143 * @param aMessage The message to display |
|
144 * @return void |
|
145 */ |
|
146 IMPORT_C virtual void DialogNoteL( const TDesC& aMessage ); |
|
147 |
|
148 /** |
|
149 * Display a note to the user with ok softkey only |
|
150 * @since 2.8 |
|
151 * @param aTitle The title, could be empty |
|
152 * @param aMessage The message to display |
|
153 * @return void |
|
154 */ |
|
155 IMPORT_C virtual void DialogAlertL( const TDesC& aTitle, |
|
156 const TDesC& aMessage ); |
|
157 |
|
158 /** |
|
159 * Display confirmation message to the user |
|
160 * @since 2.8 |
|
161 * @param aTitle The title, could be empty |
|
162 * @param aMessage The message to display |
|
163 * @param aYesMessage The text to display on left softkey |
|
164 * @param aNoMessage The text to display on right softkey |
|
165 * @return EFalse if the user canceled, ETrue otherwise |
|
166 */ |
|
167 IMPORT_C virtual TBool DialogConfirmL( const TDesC& aTitle, |
|
168 const TDesC& aMessage, |
|
169 const TDesC& aYesMessage, |
|
170 const TDesC& aNoMessage); |
|
171 |
|
172 /** |
|
173 * Display input dialog to the user |
|
174 * @since 2.8 |
|
175 * @param aTitle The title, could be empty |
|
176 * @param aMessage The message to display |
|
177 * @param aDefaultInput The default input if available |
|
178 * @param aReturnedInput The input entered by the user |
|
179 * Returned on the cleanup stack, owned by the calling application |
|
180 * @return EFalse if the user canceled, ETrue otherwise |
|
181 */ |
|
182 IMPORT_C virtual TBool DialogPromptLC(const TDesC& aTitle, |
|
183 const TDesC& aMessage, |
|
184 const TDesC& aDefaultInput, |
|
185 HBufC*& aReturnedInput); |
|
186 |
|
187 /** |
|
188 * Display object info and ask confirmation before download |
|
189 * @since 2.8 |
|
190 * @param aBrCtlObjectInfo The object info |
|
191 * @return EFalse if the user canceled, ETrue otherwise |
|
192 */ |
|
193 IMPORT_C virtual TBool DialogDownloadObjectL( |
|
194 CBrCtlObjectInfo* aBrCtlObjectInfo ); |
|
195 |
|
196 /** |
|
197 * DIsplay the images that appear in the current page |
|
198 * @since 2.8 |
|
199 * @param aPageImages The images that appear in this page |
|
200 * @return vois |
|
201 */ |
|
202 IMPORT_C virtual void DialogDisplayPageImagesL( |
|
203 CArrayFixFlat<TBrCtlImageCarrier>& aPageImages); |
|
204 |
|
205 /** |
|
206 * Cancel any dialog that is being displayed due to |
|
207 * e.g. Browser exit or page was destroyed |
|
208 * @since 2.8 |
|
209 * @return void |
|
210 */ |
|
211 IMPORT_C virtual void CancelAll(); |
|
212 |
|
213 |
|
214 /** |
|
215 * Display search on page dialog |
|
216 * @since 3.0 |
|
217 * @return void |
|
218 */ |
|
219 inline virtual void DialogFindL() {}; |
|
220 |
|
221 |
|
222 public: // New functions |
|
223 |
|
224 /** |
|
225 * Display a tooltip (info popup note) |
|
226 * @since 3.0 |
|
227 * @return void |
|
228 */ |
|
229 IMPORT_C void ShowTooltipL( const TDesC& aText, |
|
230 TInt aDuration = KDefaultTooltipDuration, |
|
231 TInt aDelay = KDefaultTooltipDelay ); |
|
232 |
|
233 |
|
234 /** |
|
235 * Display a dialog which tracks upload progress |
|
236 * @since 3.0 |
|
237 * @param aTotalSize the total size of a file being uploaded |
|
238 * @param aChunkSize the size of the current chunk being uploaded |
|
239 * @param aIsLastChunk boolean value indicating whether the current |
|
240 * @param aObserver an observer for the upload progress dialog |
|
241 * chunk is the last one in the entire download |
|
242 * @return void |
|
243 */ |
|
244 IMPORT_C void UploadProgressNoteL( |
|
245 TInt32 aTotalSize, |
|
246 TInt32 aChunkSize, |
|
247 TBool aIsLastChunk, |
|
248 MBrowserDialogsProviderObserver* aObserver |
|
249 ); |
|
250 // From MBrCtlDialogsProvider |
|
251 /** |
|
252 * Mime File selection dialog for specific mime type files |
|
253 * @since 3.2 |
|
254 * @param aSelectedFileName The selected file name. |
|
255 * @param aMimeType The accepted mime type |
|
256 * Returned on cleanup stack. Browser control will free the buffer |
|
257 * @return EFalse if the user canceled, ETrue otherwise |
|
258 */ |
|
259 IMPORT_C virtual TBool DialogMimeFileSelectLC( |
|
260 HBufC*& aSelectedFileName, |
|
261 const TDesC& aMimeType); |
|
262 |
|
263 /** |
|
264 * Display an confirmation query with given dialog resource |
|
265 * @since Series 60 2.8 |
|
266 * @param aPrompt resource if of prompt to display. |
|
267 * @param aResId resource id of command set |
|
268 * (aResId = 0 means R_AVKON_SOFTKEYS_YES_NO as per default ) |
|
269 * @param aAnimation animation overrides default one |
|
270 * @return selected softkey id. |
|
271 * If you give your own aResId you have to check the return value! |
|
272 * In that case return value are commands |
|
273 * as your specified in resource of that CBA. |
|
274 */ |
|
275 TInt ConfirmQueryDialogL( const TInt aPromptResourceId, |
|
276 TInt aResId = 0, |
|
277 TInt aAnimation = 0 ); |
|
278 |
|
279 /** |
|
280 * Display an confirmation query with given dialog resource |
|
281 * @since Series 60 2.8 |
|
282 * @param aPrompt Prompt to display. |
|
283 * @param aResId resource id of dialog |
|
284 * @param aAnimation animation overrides default one |
|
285 * @return selected softkey id. |
|
286 */ |
|
287 TInt ConfirmQueryDialogL( const TDesC& aPrompt, |
|
288 TInt aResId = 0, |
|
289 TInt aAnimation = 0 ); |
|
290 |
|
291 /** |
|
292 * User authentication dialog |
|
293 * @since Series 60 2.8 |
|
294 * @param aUsername entered username |
|
295 * @param aPassword entered password |
|
296 * @return AVKON error code |
|
297 */ |
|
298 TInt GetUserPasswordL( TDes& aUsername, TDes& aPassword ); |
|
299 |
|
300 inline void SetObserver( |
|
301 MBrowserDialogsProviderObserver* aDialogsObserver ) |
|
302 { |
|
303 iObserver = aDialogsObserver; |
|
304 } |
|
305 |
|
306 /** |
|
307 * Checks if the drive is ready |
|
308 * @param aDrive enumerated drive number |
|
309 * @return error code |
|
310 */ |
|
311 TInt DriveReady( TDriveNumber aDrive ); |
|
312 |
|
313 inline TBool IsDialogLaunched() |
|
314 { |
|
315 return (iDialogs.Count() > 0); |
|
316 } |
|
317 |
|
318 protected: // New functions |
|
319 |
|
320 // Loads the resources for the DLL |
|
321 void AssureResourceL(); |
|
322 |
|
323 private: |
|
324 |
|
325 // Removes a pointer to an open dialog from the array |
|
326 void RemoveDialogFromArray(); |
|
327 |
|
328 private: // from MMGFetchVerifier |
|
329 TBool VerifySelectionL(const MDesCArray* aSelectedFiles); |
|
330 |
|
331 // DATA MEMBERS |
|
332 private: |
|
333 |
|
334 // For DialogSelectOptionL |
|
335 CBrowserSelectElementDlg* iSelectDlg; // owned |
|
336 |
|
337 CBrowserUploadProgressNote* iUploadProgressNote; // owned |
|
338 |
|
339 RPointerArray<CCoeControl> iDialogs; // owned |
|
340 |
|
341 CCoeEnv& iCoeEnv; // Reference to CONE environment. |
|
342 |
|
343 MBrowserDialogsProviderObserver* iObserver; // not ownedCBrowserDialogsProvider |
|
344 |
|
345 RConeResourceLoader iResourceLoader; |
|
346 TBool iResourceOpened; |
|
347 |
|
348 RConeResourceLoader iErrResourceLoader; |
|
349 TBool iErrResourceOpened; |
|
350 |
|
351 // Reusable tooltip |
|
352 CAknInfoPopupNoteController* iTooltip; // owned |
|
353 |
|
354 enum TPanicReason |
|
355 { |
|
356 EInvalidSizeValue |
|
357 }; |
|
358 }; |
|
359 |
|
360 #endif // BROWSERDIALOGSPROVIDER_H |
|
361 |
|
362 // End of File |