|
1 /* |
|
2 * Copyright (c) 2005-2008 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: Implementation of the CBrowserDialogsProviderProxy class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE Files |
|
20 |
|
21 // User includes |
|
22 #include "BrowserDialogsProviderProxy.h" |
|
23 #include "BrowserDialogsProviderBlocker.h" |
|
24 #include "BrowserWindowFocusNotifier.h" |
|
25 #include "BrowserWindow.h" |
|
26 #include "logger.h" |
|
27 |
|
28 // System includes |
|
29 #include <BrowserDialogsProviderObserver.h> |
|
30 #include <BrowserDialogsProvider.h> |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 //----------------------------------------------------------------------------- |
|
35 // CBrowserDialogsProviderProxy::CBrowserDialogsProviderProxy |
|
36 //----------------------------------------------------------------------------- |
|
37 CBrowserDialogsProviderProxy::CBrowserDialogsProviderProxy( |
|
38 CBrowserDialogsProvider& aDialogsProvider, |
|
39 MBrowserDialogsProviderObserver* aDialogsObserver, |
|
40 CBrowserWindow& aBrowserWindow ) |
|
41 : iDialogsProvider( aDialogsProvider ), |
|
42 iDialogsObserver( aDialogsObserver ), |
|
43 iBrowserWindow( aBrowserWindow ), |
|
44 iCancelWaitingDialogs( EFalse ) |
|
45 { |
|
46 } |
|
47 |
|
48 |
|
49 //----------------------------------------------------------------------------- |
|
50 // CBrowserDialogsProviderProxy::~CBrowserDialogsProviderProxy |
|
51 //----------------------------------------------------------------------------- |
|
52 CBrowserDialogsProviderProxy::~CBrowserDialogsProviderProxy() |
|
53 { |
|
54 LOG_ENTERFN("~CBrowserDialogsProviderProxy"); |
|
55 delete iWinFocusNotifier; |
|
56 } |
|
57 |
|
58 |
|
59 //----------------------------------------------------------------------------- |
|
60 // CBrowserDialogsProviderProxy* CBrowserDialogsProviderProxy::NewL |
|
61 //----------------------------------------------------------------------------- |
|
62 CBrowserDialogsProviderProxy* CBrowserDialogsProviderProxy::NewL( |
|
63 CBrowserDialogsProvider& aDialogsProvider, |
|
64 MBrowserDialogsProviderObserver* aDialogsObserver, |
|
65 CBrowserWindow& aBrowserWindow ) |
|
66 { |
|
67 CBrowserDialogsProviderProxy* self = new (ELeave) |
|
68 CBrowserDialogsProviderProxy( aDialogsProvider, |
|
69 aDialogsObserver, |
|
70 aBrowserWindow ); |
|
71 |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL( ); |
|
74 CleanupStack::Pop( self ); // self |
|
75 return self; |
|
76 } |
|
77 |
|
78 //----------------------------------------------------------------------------- |
|
79 // CBrowserDialogsProviderProxy::ConstructL |
|
80 // |
|
81 //----------------------------------------------------------------------------- |
|
82 void CBrowserDialogsProviderProxy::ConstructL() |
|
83 { |
|
84 // Keeps track of blocked dialogs |
|
85 iWinFocusNotifier = CBrowserWindowFocusNotifier::NewL(); |
|
86 } |
|
87 |
|
88 |
|
89 //----------------------------------------------------------------------------- |
|
90 // CBrowserDialogsProviderProxy::DialogNotifyErrorL |
|
91 // |
|
92 //----------------------------------------------------------------------------- |
|
93 void CBrowserDialogsProviderProxy::DialogNotifyErrorL( TInt aErrCode ) |
|
94 { |
|
95 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogNotifyErrorL"); |
|
96 |
|
97 // Forward dialog to DialogsProvider if it has not been cancelled |
|
98 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
99 { |
|
100 iDialogsProvider.DialogNotifyErrorL( aErrCode ); |
|
101 if ( iDialogsObserver ) |
|
102 { |
|
103 iDialogsObserver->ReportDialogEventL( |
|
104 MBrowserDialogsProviderObserver::ENotifyError, |
|
105 aErrCode ); |
|
106 } |
|
107 } |
|
108 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogNotifyErrorL"); |
|
109 } |
|
110 |
|
111 |
|
112 //----------------------------------------------------------------------------- |
|
113 // CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL |
|
114 //----------------------------------------------------------------------------- |
|
115 void CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL( |
|
116 TInt aErrCode, const TDesC& aUri ) |
|
117 { |
|
118 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL"); |
|
119 |
|
120 // Forward dialog to DialogsProvider if it has not been cancelled |
|
121 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
122 { |
|
123 iDialogsProvider.DialogNotifyHttpErrorL( aErrCode, aUri ); |
|
124 if ( iDialogsObserver ) |
|
125 { |
|
126 iDialogsObserver->ReportDialogEventL( |
|
127 MBrowserDialogsProviderObserver::ENotifyHttpError, |
|
128 NULL ); |
|
129 } |
|
130 } |
|
131 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL"); |
|
132 } |
|
133 |
|
134 |
|
135 //----------------------------------------------------------------------------- |
|
136 // CBrowserDialogsProviderProxy::DialogFileSelectLC |
|
137 //----------------------------------------------------------------------------- |
|
138 TBool CBrowserDialogsProviderProxy::DialogFileSelectLC( |
|
139 const TDesC& aStartPath, |
|
140 const TDesC& aRootPath, |
|
141 HBufC*& aSelectedFileName ) |
|
142 { |
|
143 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogFileSelectLC"); |
|
144 TBool retVal( EFalse ); |
|
145 |
|
146 // Forward dialog to DialogsProvider if it has not been cancelled |
|
147 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
148 { |
|
149 CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); |
|
150 TBool softKeysVisible( ETrue ); |
|
151 if ( currentCba ) |
|
152 { |
|
153 softKeysVisible = currentCba->IsVisible(); |
|
154 } |
|
155 |
|
156 retVal = iDialogsProvider.DialogFileSelectLC( aStartPath, |
|
157 aRootPath, |
|
158 aSelectedFileName ); |
|
159 |
|
160 // If the softkeys were not visible before, then make sure they are not |
|
161 // visible after. |
|
162 if ( currentCba && !softKeysVisible ) |
|
163 { |
|
164 currentCba->MakeVisible( EFalse ); |
|
165 } |
|
166 } |
|
167 |
|
168 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogFileSelectLC"); |
|
169 return retVal; |
|
170 } |
|
171 |
|
172 //----------------------------------------------------------------------------- |
|
173 // CBrowserDialogsProviderProxy::DialogSelectOptionL |
|
174 //----------------------------------------------------------------------------- |
|
175 TBool CBrowserDialogsProviderProxy::DialogSelectOptionL( |
|
176 const TDesC& aTitle, |
|
177 TBrCtlSelectOptionType aBrCtlSelectOptionType, |
|
178 CArrayFix<TBrCtlSelectOptionData>& aOptions ) |
|
179 { |
|
180 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogSelectOptionL"); |
|
181 TBool retVal( EFalse ); |
|
182 |
|
183 // Forward dialog to DialogsProvider if it has not been cancelled |
|
184 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
185 { |
|
186 CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); |
|
187 TBool softKeysVisible( ETrue ); |
|
188 if ( currentCba ) |
|
189 { |
|
190 softKeysVisible = currentCba->IsVisible(); |
|
191 } |
|
192 |
|
193 retVal = iDialogsProvider.DialogSelectOptionL( |
|
194 aTitle, |
|
195 aBrCtlSelectOptionType, |
|
196 aOptions ); |
|
197 // If the softkeys were not visible before, then make sure they are not |
|
198 // visible after. |
|
199 if ( currentCba && !softKeysVisible ) |
|
200 { |
|
201 currentCba->MakeVisible( EFalse ); |
|
202 } |
|
203 } |
|
204 |
|
205 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogSelectOptionL"); |
|
206 return retVal; |
|
207 } |
|
208 |
|
209 |
|
210 //----------------------------------------------------------------------------- |
|
211 // CBrowserDialogsProviderProxy::DialogUserAuthenticationLC |
|
212 //----------------------------------------------------------------------------- |
|
213 TBool CBrowserDialogsProviderProxy::DialogUserAuthenticationLC( |
|
214 const TDesC& aUrl, |
|
215 const TDesC& aRealm, |
|
216 const TDesC& aDefaultUserName, |
|
217 HBufC*& aReturnedUserName, |
|
218 HBufC*& aReturnedPasswd, |
|
219 TBool aBasicAuthentication ) |
|
220 { |
|
221 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogUserAuthenticationLC"); |
|
222 TBool retVal( EFalse ); |
|
223 |
|
224 // Forward dialog to DialogsProvider if it has not been cancelled |
|
225 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
226 { |
|
227 CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); |
|
228 TBool softKeysVisible( ETrue ); |
|
229 if ( currentCba ) |
|
230 { |
|
231 softKeysVisible = currentCba->IsVisible(); |
|
232 } |
|
233 |
|
234 retVal = iDialogsProvider.DialogUserAuthenticationLC( |
|
235 aUrl, |
|
236 aRealm, |
|
237 aDefaultUserName, |
|
238 aReturnedUserName, |
|
239 aReturnedPasswd, |
|
240 aBasicAuthentication ); |
|
241 if ( iDialogsObserver ) |
|
242 { |
|
243 iDialogsObserver->ReportDialogEventL( |
|
244 MBrowserDialogsProviderObserver::EUserAuthentication, |
|
245 ( TInt ) retVal ); |
|
246 } |
|
247 |
|
248 // If the softkeys were not visible before, then make sure they are not |
|
249 // visible after. |
|
250 if ( currentCba && !softKeysVisible ) |
|
251 { |
|
252 currentCba->MakeVisible( EFalse ); |
|
253 } |
|
254 } |
|
255 |
|
256 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogUserAuthenticationLC"); |
|
257 return retVal; |
|
258 } |
|
259 |
|
260 |
|
261 //----------------------------------------------------------------------------- |
|
262 // CBrowserDialogsProviderProxy::DialogNoteL |
|
263 //----------------------------------------------------------------------------- |
|
264 void CBrowserDialogsProviderProxy::DialogNoteL( const TDesC& aMessage ) |
|
265 { |
|
266 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogNoteL"); |
|
267 |
|
268 // Forward dialog to DialogsProvider if it has not been cancelled |
|
269 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
270 { |
|
271 iDialogsProvider.DialogNoteL( aMessage ); |
|
272 } |
|
273 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogNoteL"); |
|
274 } |
|
275 |
|
276 |
|
277 //----------------------------------------------------------------------------- |
|
278 // CBrowserDialogsProviderProxy::DialogAlertL |
|
279 //----------------------------------------------------------------------------- |
|
280 void CBrowserDialogsProviderProxy::DialogAlertL( const TDesC& aTitle, |
|
281 const TDesC& aMessage ) |
|
282 { |
|
283 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogAlertL"); |
|
284 |
|
285 // Forward dialog to DialogsProvider if it has not been cancelled |
|
286 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
287 { |
|
288 iDialogsProvider.DialogAlertL( aTitle, aMessage ); |
|
289 } |
|
290 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogAlertL"); |
|
291 } |
|
292 |
|
293 |
|
294 //----------------------------------------------------------------------------- |
|
295 // CBrowserDialogsProviderProxy::DialogConfirmL |
|
296 //----------------------------------------------------------------------------- |
|
297 TBool CBrowserDialogsProviderProxy::DialogConfirmL( const TDesC& aTitle, |
|
298 const TDesC& aMessage, |
|
299 const TDesC& aYesMessage, |
|
300 const TDesC& aNoMessage ) |
|
301 { |
|
302 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogConfirmL"); |
|
303 TBool retVal( EFalse ); |
|
304 |
|
305 // Forward dialog to DialogsProvider if it has not been cancelled |
|
306 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
307 { |
|
308 CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); |
|
309 TBool softKeysVisible( ETrue ); |
|
310 if ( currentCba ) |
|
311 { |
|
312 softKeysVisible = currentCba->IsVisible(); |
|
313 } |
|
314 |
|
315 retVal = iDialogsProvider.DialogConfirmL( aTitle, aMessage, |
|
316 aYesMessage, aNoMessage ); |
|
317 |
|
318 // If the softkeys were not visible before, then make sure they are not |
|
319 // visible after. |
|
320 if ( currentCba && !softKeysVisible ) |
|
321 { |
|
322 currentCba->MakeVisible( EFalse ); |
|
323 } |
|
324 } |
|
325 |
|
326 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogConfirmL"); |
|
327 return retVal; |
|
328 } |
|
329 |
|
330 //----------------------------------------------------------------------------- |
|
331 // CBrowserDialogsProviderProxy::DialogPromptLC |
|
332 //----------------------------------------------------------------------------- |
|
333 TBool CBrowserDialogsProviderProxy::DialogPromptLC( const TDesC& aTitle, |
|
334 const TDesC& aMessage, |
|
335 const TDesC& aDefaultInput, |
|
336 HBufC*& aReturnedInput ) |
|
337 { |
|
338 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogPromptLC"); |
|
339 TBool retVal( EFalse ); |
|
340 |
|
341 // Forward dialog to DialogsProvider if it has not been cancelled |
|
342 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
343 { |
|
344 CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); |
|
345 TBool softKeysVisible( ETrue ); |
|
346 if ( currentCba ) |
|
347 { |
|
348 softKeysVisible = currentCba->IsVisible(); |
|
349 } |
|
350 |
|
351 retVal = iDialogsProvider.DialogPromptLC( aTitle, aMessage, |
|
352 aDefaultInput, aReturnedInput ); |
|
353 |
|
354 // If the softkeys were not visible before, then make sure they are not |
|
355 // visible after. |
|
356 if ( currentCba && !softKeysVisible ) |
|
357 { |
|
358 currentCba->MakeVisible( EFalse ); |
|
359 } |
|
360 } |
|
361 |
|
362 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogPromptLC"); |
|
363 return retVal; |
|
364 } |
|
365 |
|
366 //----------------------------------------------------------------------------- |
|
367 // CBrowserDialogsProviderProxy::DialogDownloadObjectL |
|
368 //----------------------------------------------------------------------------- |
|
369 TBool CBrowserDialogsProviderProxy::DialogDownloadObjectL( |
|
370 CBrCtlObjectInfo* aBrCtlObjectInfo ) |
|
371 { |
|
372 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogDownloadObjectL"); |
|
373 TBool retVal( EFalse ); |
|
374 |
|
375 if (iBrowserWindow.IsWindowActive()) |
|
376 { |
|
377 retVal = iDialogsProvider.DialogDownloadObjectL( aBrCtlObjectInfo ); |
|
378 } |
|
379 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogDownloadObjectL"); |
|
380 return retVal; |
|
381 } |
|
382 |
|
383 //----------------------------------------------------------------------------- |
|
384 // CBrowserDialogsProviderProxy::DialogDisplayPageImagesL |
|
385 //----------------------------------------------------------------------------- |
|
386 void CBrowserDialogsProviderProxy::DialogDisplayPageImagesL( |
|
387 CArrayFixFlat<TBrCtlImageCarrier>& aPageImages ) |
|
388 { |
|
389 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogDisplayPageImagesL"); |
|
390 |
|
391 // Forward dialog to DialogsProvider if it has not been cancelled |
|
392 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
393 { |
|
394 iDialogsProvider.DialogDisplayPageImagesL( aPageImages ); |
|
395 } |
|
396 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogDisplayPageImagesL"); |
|
397 } |
|
398 |
|
399 |
|
400 //----------------------------------------------------------------------------- |
|
401 // CBrowserDialogsProviderProxy::CancelAll |
|
402 //----------------------------------------------------------------------------- |
|
403 // |
|
404 void CBrowserDialogsProviderProxy::CancelAll() |
|
405 { |
|
406 LOG_ENTERFN("CBrowserDialogsProviderProxy::CancelAll"); |
|
407 // Dialogs should be flushed, but not displayed |
|
408 iCancelWaitingDialogs = ETrue; |
|
409 iDialogsProvider.CancelAll(); |
|
410 iWinFocusNotifier->FlushAOStatusArray(); |
|
411 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::CancelAll"); |
|
412 } |
|
413 |
|
414 //----------------------------------------------------------------------------- |
|
415 // CBrowserDialogsProviderProxy::DialogMimeFileSelectLC |
|
416 //----------------------------------------------------------------------------- |
|
417 TBool CBrowserDialogsProviderProxy::DialogMimeFileSelectLC( |
|
418 HBufC*& aSelectedFileName, |
|
419 const TDesC& aMimeType ) |
|
420 { |
|
421 LOG_ENTERFN("CBrowserDialogsProviderProxy::DialogMimeFileSelectLC"); |
|
422 TBool retVal( EFalse ); |
|
423 |
|
424 // Forward dialog to DialogsProvider if it has not been cancelled |
|
425 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
426 { |
|
427 CEikButtonGroupContainer* currentCba = CEikButtonGroupContainer::Current(); |
|
428 TBool softKeysVisible( ETrue ); |
|
429 if ( currentCba ) |
|
430 { |
|
431 softKeysVisible = currentCba->IsVisible(); |
|
432 } |
|
433 |
|
434 retVal = iDialogsProvider.DialogMimeFileSelectLC( aSelectedFileName, |
|
435 aMimeType ); |
|
436 // If the softkeys were not visible before, then make sure they are not |
|
437 // visible after. |
|
438 if ( currentCba && !softKeysVisible ) |
|
439 { |
|
440 currentCba->MakeVisible( EFalse ); |
|
441 } |
|
442 } |
|
443 |
|
444 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::DialogMimeFileSelectLC"); |
|
445 return retVal; |
|
446 } |
|
447 |
|
448 //----------------------------------------------------------------------------- |
|
449 // CBrowserDialogsProviderProxy::ShowTooltipL |
|
450 //----------------------------------------------------------------------------- |
|
451 // |
|
452 void CBrowserDialogsProviderProxy::ShowTooltipL( const TDesC& aText, |
|
453 TInt aDuration, |
|
454 TInt aDelay ) |
|
455 { |
|
456 LOG_ENTERFN("CBrowserDialogsProviderProxy::ShowTooltipL"); |
|
457 |
|
458 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
459 { |
|
460 iDialogsProvider.ShowTooltipL( aText, aDuration, aDelay ); |
|
461 } |
|
462 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::ShowTooltipL"); |
|
463 } |
|
464 |
|
465 //----------------------------------------------------------------------------- |
|
466 // CBrowserDialogsProviderProxy::UploadProgressNoteL |
|
467 //----------------------------------------------------------------------------- |
|
468 // |
|
469 void CBrowserDialogsProviderProxy::UploadProgressNoteL( |
|
470 TInt32 aTotalSize, |
|
471 TInt32 aChunkSize, |
|
472 TBool aIsLastChunk, |
|
473 MBrowserDialogsProviderObserver* aObserver ) |
|
474 { |
|
475 LOG_ENTERFN("CBrowserDialogsProviderProxy::UploadProgressNoteL"); |
|
476 |
|
477 // Forward dialog to DialogsProvider if it has not been cancelled |
|
478 if ( iBrowserWindow.IsWindowActive() && !iCancelWaitingDialogs ) |
|
479 { |
|
480 iDialogsProvider.UploadProgressNoteL( aTotalSize, |
|
481 aChunkSize, |
|
482 aIsLastChunk, |
|
483 aObserver ); |
|
484 } |
|
485 |
|
486 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::UploadProgressNoteL"); |
|
487 } |
|
488 |
|
489 //----------------------------------------------------------------------------- |
|
490 // CBrowserDialogsProviderProxy::WindowActivated() |
|
491 //----------------------------------------------------------------------------- |
|
492 // |
|
493 void CBrowserDialogsProviderProxy::WindowActivated() |
|
494 { |
|
495 LOG_ENTERFN("CBrowserDialogsProviderProxy::WindowActivated"); |
|
496 // Window is now topmost, all waiting dialogs should be shown in turn |
|
497 iWinFocusNotifier->OnFocusGained(); |
|
498 // LOG_LEAVEFN("CBrowserDialogsProviderProxy::WindowActivated"); |
|
499 } |
|
500 |
|
501 // End of File |