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 special load events such as network connection, |
|
15 * deal with non-http or non-html requests |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <browser_platform_variant.hrh> |
|
22 #include "BrowserContentView.h" // not used, to be removed |
|
23 #include "BrowserSpecialLoadObserver.h" |
|
24 #include "BrowserLoadObserver.h" |
|
25 #include "logger.h" |
|
26 #include "BrowserAppDocument.h" |
|
27 #include "ApiProvider.h" |
|
28 #include "Preferences.h" |
|
29 #include "BrowserUIVariant.hrh" |
|
30 #include "Display.h" |
|
31 #include "BrowserAppUi.h" |
|
32 #include "BrowserWindow.h" |
|
33 #include "BrowserWindowManager.h" |
|
34 #include "CommonConstants.h" |
|
35 #ifdef __WINS__ |
|
36 #include <commdb.h> |
|
37 #include <aknselectionlist.h> |
|
38 #include <AknLists.h> |
|
39 #endif // __WINS__ |
|
40 #include <DocumentHandler.h> |
|
41 #include <mconnection.h> // for MConnection |
|
42 #include <schemehandler.h> |
|
43 #include <BrowserNG.rsg> |
|
44 #include <FeatMgr.h> |
|
45 #include <AiwGenericParam.h> |
|
46 #include <aknnavi.h> |
|
47 |
|
48 //CONSTANTS |
|
49 const TInt KMaxDocHandlerUrlLen = 255; |
|
50 //DestNetChange |
|
51 #include <CmApplicationSettingsUi.h> |
|
52 |
|
53 |
|
54 // --------------------------------------------------------- |
|
55 // CBrowserSpecialLoadObserver::NewL() |
|
56 // --------------------------------------------------------- |
|
57 // |
|
58 CBrowserSpecialLoadObserver* CBrowserSpecialLoadObserver::NewL( |
|
59 MApiProvider& aApiProvider, |
|
60 CBrowserWindow* aWindow, |
|
61 CEikDocument* aDocument, |
|
62 CBrowserContentView* aContentView ) |
|
63 { |
|
64 CBrowserSpecialLoadObserver* self = |
|
65 new (ELeave) CBrowserSpecialLoadObserver( |
|
66 aApiProvider, aWindow, aDocument, aContentView ); |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL( ); |
|
69 CleanupStack::Pop(); // self |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // CBrowserSpecialLoadObserver::~CBrowserSpecialLoadObserver() |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 CBrowserSpecialLoadObserver::~CBrowserSpecialLoadObserver() |
|
78 { |
|
79 delete iSchemeHandler; |
|
80 delete iDocHandler; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CBrowserSpecialLoadObserver::CBrowserSpecialLoadObserver() |
|
85 // --------------------------------------------------------- |
|
86 // |
|
87 CBrowserSpecialLoadObserver::CBrowserSpecialLoadObserver( |
|
88 MApiProvider& aApiProvider, |
|
89 CBrowserWindow* aWindow, |
|
90 CEikDocument* aDocument, |
|
91 CBrowserContentView* aContentView ) : |
|
92 iApiProvider( &aApiProvider ), |
|
93 iWindow( aWindow ), |
|
94 iDocument( aDocument ), |
|
95 iSchemeHandler( NULL ), |
|
96 iContentView( aContentView ), |
|
97 iSchemeProcessing( EFalse ), |
|
98 iLongZeroStartup( EFalse ), |
|
99 iConnectionStarted( EFalse ) |
|
100 { |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------- |
|
104 // CBrowserSpecialLoadObserver::ConstructL() |
|
105 // --------------------------------------------------------- |
|
106 // |
|
107 void CBrowserSpecialLoadObserver::ConstructL() |
|
108 { |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // CBrowserSpecialLoadObserver::NetworkConnectionNeededL() |
|
113 // --------------------------------------------------------- |
|
114 // |
|
115 void CBrowserSpecialLoadObserver::NetworkConnectionNeededL( |
|
116 TInt* aConnectionPtr, |
|
117 TInt* aSockSvrHandle, |
|
118 TBool* aNewConn, |
|
119 TApBearerType* aBearerType ) |
|
120 { |
|
121 LOG_ENTERFN("CBrowserSpecialLoadObserver::NetworkConnectionNeededL"); |
|
122 |
|
123 __ASSERT_DEBUG( (aConnectionPtr != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
124 __ASSERT_DEBUG( (aSockSvrHandle != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
125 __ASSERT_DEBUG( (aNewConn != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
126 __ASSERT_DEBUG( (aBearerType != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
127 |
|
128 #ifdef BRDO_OCC_ENABLED_FF |
|
129 TBool retryFlag = CBrowserAppUi::Static()->GetRetryFlag(); |
|
130 if( retryFlag ) |
|
131 { |
|
132 BROWSER_LOG((_L("Retry is in progress"))); |
|
133 return; |
|
134 } |
|
135 #endif |
|
136 |
|
137 iApiProvider->SetProgressShown( ETrue ); |
|
138 TBool query( EFalse ); |
|
139 if( iApiProvider->Connection().Connected() ) |
|
140 { |
|
141 TInt a( iWindow->WindowId() ); |
|
142 BROWSER_LOG( ( _L( "already connected, WindowId: %d" ), a ) ); |
|
143 *aConnectionPtr = (TInt) &iApiProvider->Connection().Connection(); |
|
144 *aSockSvrHandle = iApiProvider->Connection().SocketServer().Handle(); |
|
145 *aNewConn = EFalse; |
|
146 *aBearerType = iApiProvider->Connection().CurrentBearerTypeL(); |
|
147 } |
|
148 else |
|
149 { |
|
150 BROWSER_LOG((_L("not connected."))); |
|
151 *aNewConn = ETrue; |
|
152 TBool isValid( EFalse ); |
|
153 TUint32 ap( 0 ); |
|
154 TInt err( KErrNone ); |
|
155 |
|
156 BROWSER_LOG((_L("AP selectionMode: %d."), |
|
157 iApiProvider->Preferences().AccessPointSelectionMode() )); |
|
158 |
|
159 //determine the type of connection |
|
160 switch (iApiProvider->Preferences().AccessPointSelectionMode() ) |
|
161 { |
|
162 case EAlwaysAsk: |
|
163 { |
|
164 BROWSER_LOG((_L("always ask."))); |
|
165 // Always ask |
|
166 isValid = ETrue; |
|
167 break; |
|
168 } |
|
169 |
|
170 case EDestination: |
|
171 { |
|
172 isValid = ETrue; // force to show LAN connection dialog |
|
173 |
|
174 #ifdef __WINS__ |
|
175 query = ETrue; // disable connection query dialog |
|
176 #endif // __WINS__ |
|
177 |
|
178 // for bug fix MLAN-7EKFV4, if bookmark has defined its AP, use it |
|
179 if ( iApiProvider->RequestedAp() != KWmlNoDefaultAccessPoint ) |
|
180 { |
|
181 #ifndef __WINS__ |
|
182 ap = Util::IapIdFromWapIdL( |
|
183 *iApiProvider, iApiProvider->RequestedAp() ); |
|
184 BROWSER_LOG((_L("ap: %d"), ap)); |
|
185 #else // __WINS__ |
|
186 // On WINS no need to convert the AP ID |
|
187 ap = iApiProvider->RequestedAp(); |
|
188 #endif // __WINS__ |
|
189 |
|
190 iApiProvider->Connection().SetRequestedAP( ap ); |
|
191 iApiProvider->Connection().SetConnectionType( EConnectionMethod ); |
|
192 } |
|
193 else |
|
194 { |
|
195 TUint32 snapId = iApiProvider->Preferences().DefaultSnapId(); |
|
196 //connection type is destination nw |
|
197 iApiProvider->Connection().SetConnectionType( EDestination ); |
|
198 //set snap id |
|
199 iApiProvider->Connection().SetRequestedSnap( snapId ); |
|
200 } |
|
201 break; |
|
202 } |
|
203 |
|
204 case EConnectionMethod: |
|
205 { |
|
206 BROWSER_LOG((_L("user defined."))); |
|
207 // User defined |
|
208 |
|
209 TRAP( err, isValid = Util::CheckApValidityL( *iApiProvider, |
|
210 iApiProvider->RequestedAp() )); |
|
211 BROWSER_LOG((_L("isValid 1: %d"), isValid)); |
|
212 BROWSER_LOG((_L("err: %d"), err)); |
|
213 if( isValid ) |
|
214 { // valid AP, get it |
|
215 #ifndef __WINS__ |
|
216 ap = Util::IapIdFromWapIdL( |
|
217 *iApiProvider, iApiProvider->RequestedAp() ); |
|
218 BROWSER_LOG((_L("ap: %d"), ap)); |
|
219 #else // __WINS__ |
|
220 // On WINS no need to convert the AP ID |
|
221 ap = iApiProvider->RequestedAp(); |
|
222 #endif // __WINS__ |
|
223 } |
|
224 else if( err == KErrNone ) |
|
225 { // still try to get AP |
|
226 TUint apUid = iApiProvider->Preferences().DefaultAccessPoint(); |
|
227 |
|
228 BROWSER_LOG((_L("apUid: %d"), apUid)); |
|
229 |
|
230 if ( apUid == KWmlNoDefaultAccessPoint ) |
|
231 { |
|
232 #ifdef __WINS__ |
|
233 query = ETrue; // disable connection query dialog |
|
234 isValid = ETrue; // force to show LAN connection dialog |
|
235 #else // __WINS__ |
|
236 BROWSER_LOG((_L("StartPrefView."))); |
|
237 // there are no AP, show preferences view without always ask |
|
238 isValid = iApiProvider->StartPreferencesViewL( EShowDestinations | EShowConnectionMethods ); |
|
239 if( isValid ) |
|
240 { |
|
241 if( iApiProvider->Preferences().AccessPointSelectionMode() == EConnectionMethod ) |
|
242 { |
|
243 ap = iApiProvider->Preferences().DefaultAccessPoint(); |
|
244 } |
|
245 // else if EDestination, user choosed SNAP in preference view |
|
246 } |
|
247 #endif // __WINS__ |
|
248 } |
|
249 } |
|
250 |
|
251 //set connection type and AP or SNAP Id |
|
252 if( iApiProvider->Preferences().AccessPointSelectionMode() == EDestination ) |
|
253 { |
|
254 TUint32 snapId = iApiProvider->Preferences().DefaultSnapId(); |
|
255 iApiProvider->Connection().SetConnectionType( EDestination ); |
|
256 iApiProvider->Connection().SetRequestedSnap( snapId ); |
|
257 } |
|
258 else // EConnectionMethod |
|
259 { |
|
260 iApiProvider->Connection().SetRequestedAP( ap ); |
|
261 iApiProvider->Connection().SetConnectionType( EConnectionMethod ); |
|
262 } |
|
263 break; |
|
264 } |
|
265 |
|
266 default: |
|
267 { |
|
268 BROWSER_LOG((_L("wrong type of connection"))); |
|
269 } |
|
270 } //switch |
|
271 |
|
272 BROWSER_LOG((_L("isValid 2: %d"), isValid)); |
|
273 if( isValid ) |
|
274 { |
|
275 iConnectionCancelled = EFalse; |
|
276 if( !iApiProvider->Connection().Connected() ) |
|
277 { |
|
278 iApiProvider->Connection().SetRequestedAP( ap ); |
|
279 |
|
280 TBool startPage = iWindow->LoadObserver().LoadUrlType() == |
|
281 CBrowserLoadObserver::ELoadUrlTypeStartPage; |
|
282 TBool noConnDlgs = !iApiProvider->Preferences().ShowConnectionDialogs(); |
|
283 |
|
284 // Disable connection dialogs if... |
|
285 TBool disableConnDlgs = |
|
286 query || |
|
287 startPage || // ...the load type is StartPage |
|
288 noConnDlgs || // ...connection dialogs setting = OFF |
|
289 LongZeroStartup(); // ...Browser started with long zero keypress |
|
290 SetLongZeroStartup( EFalse ); |
|
291 |
|
292 BROWSER_LOG((_L("StartConnection params, query: %d, temp: %d"), query, disableConnDlgs)); |
|
293 iConnectionStarted = ETrue; // is true when connection request submited. |
|
294 #ifndef __WINS__ |
|
295 TUint32 bookmarkIap( 0 ); |
|
296 //If bookmark has defined its AP, use it |
|
297 if ( iApiProvider->RequestedAp() != KWmlNoDefaultAccessPoint ) |
|
298 { |
|
299 bookmarkIap = Util::IapIdFromWapIdL( *iApiProvider, iApiProvider->RequestedAp() ); |
|
300 BROWSER_LOG((_L("Bookmark Iap: %d"), bookmarkIap)); |
|
301 iApiProvider->Connection().SetRequestedAP( bookmarkIap ); |
|
302 iApiProvider->Connection().SetConnectionType( EConnectionMethod ); |
|
303 } |
|
304 else |
|
305 { |
|
306 iApiProvider->Connection().SetRequestedAP( bookmarkIap ); |
|
307 BROWSER_LOG((_L("Setting Bookmark Iap: %d"), bookmarkIap)); |
|
308 } |
|
309 #endif |
|
310 // might leave, don't TRAP. OK. |
|
311 err = iApiProvider->Connection().StartConnectionL( disableConnDlgs ); |
|
312 iConnectionStarted = EFalse; // is false when connection response completed. |
|
313 } |
|
314 |
|
315 // during StartConnectionL user pressing "Stop" can cancel |
|
316 if (iConnectionCancelled) |
|
317 { |
|
318 err = KErrCancel; |
|
319 } |
|
320 BROWSER_LOG((_L("err after StartConnection: %d"), err)); |
|
321 |
|
322 if( err == KErrNone ) |
|
323 { |
|
324 *aConnectionPtr = (TInt) &iApiProvider->Connection().Connection(); |
|
325 *aSockSvrHandle = iApiProvider->Connection().SocketServer().Handle(); |
|
326 *aBearerType = iApiProvider->Connection().CurrentBearerTypeL(); |
|
327 } |
|
328 |
|
329 CBrowserAppUi::Static()->ConnNeededStatusL( err ); |
|
330 if (( err == KErrCancel ) && !iApiProvider->IsPageLoaded()) |
|
331 { |
|
332 // Close Browser's Content View window if connection setup is cancelled to avoid a blank white screen |
|
333 // ** Don't do this is page was previously loaded and is visible to user. |
|
334 // ALSO, if feeds are enabled, don't close the window if coming from feeds folder view |
|
335 // or in topic or feed views |
|
336 |
|
337 // *** Changing back to CloseContentView as a part of the new Browser exit functionality |
|
338 #ifdef __RSS_FEEDS |
|
339 TUid previousViewID = iApiProvider->LastActiveViewId(); |
|
340 if( (previousViewID != KUidBrowserFeedsFolderViewId) && |
|
341 (previousViewID != KUidBrowserFeedsTopicViewId) && |
|
342 (previousViewID != KUidBrowserFeedsFeedViewId) ) |
|
343 { |
|
344 iApiProvider->Display().NaviPaneL()->Pop(); |
|
345 CBrowserAppUi::Static()->CloseContentViewL(); |
|
346 } |
|
347 #else //__RSS_FEEDS |
|
348 CBrowserAppUi::Static()->CloseContentViewL(); |
|
349 #endif //__RSS_FEEDS |
|
350 } |
|
351 else if( err == KErrGeneral ) |
|
352 { |
|
353 if( !iApiProvider->Preferences().HttpSecurityWarningsStatSupressed() ) |
|
354 { |
|
355 iWindow->Display().UpdateSecureIndicatorL( |
|
356 EAknIndicatorStateOff ); |
|
357 } |
|
358 } |
|
359 // user might cancel, pass result to BrowserEngine |
|
360 User::LeaveIfError( err ); |
|
361 iApiProvider->Display().StartProgressAnimationL(); |
|
362 } |
|
363 else |
|
364 { |
|
365 User::LeaveIfError( err ); |
|
366 } |
|
367 } |
|
368 } |
|
369 |
|
370 // --------------------------------------------------------- |
|
371 // CBrowserSpecialLoadObserver::DoHandleRequestL() |
|
372 // --------------------------------------------------------- |
|
373 // |
|
374 TBool CBrowserSpecialLoadObserver::DoHandleRequestL |
|
375 ( RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray ) |
|
376 { |
|
377 LOG_ENTERFN("CBrowserSpecialLoadObserver::HandleRequestL"); |
|
378 |
|
379 if( !iSchemeProcessing ) |
|
380 { |
|
381 iSchemeProcessing = ETrue; |
|
382 TBool paramFound( EFalse ); |
|
383 TPtrC requestUrl = ExtractBrCtlParam( |
|
384 EParamRequestUrl, |
|
385 aTypeArray, |
|
386 aDesArray, |
|
387 paramFound ); |
|
388 __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); |
|
389 BROWSER_LOG( ( _L( " EParamRequestUrl: %S" ), &requestUrl ) ); |
|
390 |
|
391 // pass to the CSchemaHandler |
|
392 CSchemeHandler* newSH = CSchemeHandler::NewL( requestUrl ); |
|
393 delete iSchemeHandler; |
|
394 iSchemeHandler = newSH; |
|
395 BROWSER_LOG( ( _L( " iSchemeHandler OK" ) ) ); |
|
396 |
|
397 // construct the current accesspoint |
|
398 // if it's connected, always add it |
|
399 if ( iApiProvider->Connection().Connected() ) |
|
400 { |
|
401 CAiwGenericParamList* paramsList = CAiwGenericParamList::NewL(); |
|
402 CleanupStack::PushL(paramsList); |
|
403 TInt32 ap = iApiProvider->Connection().CurrentAPId(); |
|
404 TAiwVariant paramVariant (ap); |
|
405 TAiwGenericParam genericParam( EGenericParamAccessPoint, paramVariant ); |
|
406 paramsList->AppendL (genericParam ); |
|
407 |
|
408 |
|
409 // set the parameter |
|
410 iSchemeHandler->SetParameterList( paramsList ); |
|
411 |
|
412 CleanupStack::Pop(); |
|
413 } |
|
414 |
|
415 iSchemeHandler->Observer( this ); |
|
416 iSchemeHandler->HandleUrlEmbeddedL(); |
|
417 } |
|
418 return ETrue; |
|
419 } |
|
420 |
|
421 // --------------------------------------------------------- |
|
422 // CBrowserSpecialLoadObserver::HandleRequestL() |
|
423 // --------------------------------------------------------- |
|
424 // |
|
425 TBool CBrowserSpecialLoadObserver::HandleRequestL |
|
426 ( RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray ) |
|
427 { |
|
428 TBool ret( ETrue ); |
|
429 TRAPD( err, DoHandleRequestL( aTypeArray, aDesArray ) ); |
|
430 if( KErrNone != err ) |
|
431 { |
|
432 iSchemeProcessing = EFalse; |
|
433 User::Leave( err ); |
|
434 } |
|
435 return ret; |
|
436 } |
|
437 |
|
438 // --------------------------------------------------------- |
|
439 // CBrowserSpecialLoadObserver::HandleDownloadL() |
|
440 // --------------------------------------------------------- |
|
441 // |
|
442 TBool CBrowserSpecialLoadObserver::HandleDownloadL |
|
443 ( RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray ) |
|
444 { |
|
445 LOG_ENTERFN("CBrowserSpecialLoadObserver::HandleDownloadL"); |
|
446 |
|
447 TBool downloadHandled = EFalse; |
|
448 |
|
449 #ifdef __RSS_FEEDS |
|
450 // Check to see if this is content to be handled by UI (rss or opml) |
|
451 // |
|
452 if (HandleUiContentL(aTypeArray, aDesArray)) |
|
453 { |
|
454 return ETrue; |
|
455 } |
|
456 #endif // __RSS_FEEDS |
|
457 |
|
458 CBrowserAppDocument* appDoc = STATIC_CAST( CBrowserAppDocument*, iDocument ); |
|
459 |
|
460 __ASSERT_DEBUG( (appDoc != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
461 |
|
462 if ( appDoc->IsContentHandlerRegistered() ) |
|
463 { |
|
464 BROWSER_LOG( ( _L( "Calling file handler." ) ) ); |
|
465 |
|
466 TBool paramFound( EFalse ); |
|
467 TPtrC fileName = ExtractBrCtlParam( |
|
468 EParamLocalFileName, |
|
469 aTypeArray, |
|
470 aDesArray, |
|
471 paramFound ); |
|
472 __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); |
|
473 |
|
474 if ( fileName.Length() == 0 ) |
|
475 { |
|
476 // May be a Rights Object download - |
|
477 // no downloaded file, nothing to open/handle/pass to BrowserLauncher client. |
|
478 BROWSER_LOG( ( _L( " Empty fileName" ) ) ); |
|
479 } |
|
480 else |
|
481 { |
|
482 CAiwGenericParamList* genericParamList = |
|
483 BrCtlParamList2GenericParamListL( aTypeArray, aDesArray ); |
|
484 CleanupStack::PushL( genericParamList ); |
|
485 |
|
486 // Forward the file to the registered handler. |
|
487 TBool continueBrowsing( EFalse ); |
|
488 downloadHandled = CBrowserAppUi::Static()->HandleContentL |
|
489 ( fileName, *genericParamList, continueBrowsing ); |
|
490 BROWSER_LOG( ( _L( " downloadHandled: %d, continueBrowsing: %d" ), |
|
491 downloadHandled, continueBrowsing ) ); |
|
492 |
|
493 CleanupStack::PopAndDestroy( genericParamList ); // genericParamList |
|
494 |
|
495 if ( downloadHandled ) |
|
496 { |
|
497 // We can delete the file now. |
|
498 RFs fs; |
|
499 User::LeaveIfError( fs.Connect() ); |
|
500 CleanupClosePushL( fs ); |
|
501 fs.Delete( fileName ); // Return value is ignored. |
|
502 CleanupStack::PopAndDestroy( &fs ); // fs |
|
503 } |
|
504 |
|
505 if ( !continueBrowsing ) |
|
506 { |
|
507 iApiProvider->SetExitFromEmbeddedMode( ETrue ); |
|
508 } |
|
509 } |
|
510 } |
|
511 else |
|
512 { |
|
513 // No handler registered. |
|
514 BROWSER_LOG( ( _L( " No handler registered." ) ) ); |
|
515 } |
|
516 |
|
517 // If the download (file) was not handled, |
|
518 // the BrowserUI handles it with Document Handler. |
|
519 if ( !downloadHandled ) |
|
520 { |
|
521 // This content must be handled by BrowserUI - Browser Control cannot handle it. |
|
522 OpenFileEmbeddedL( aTypeArray, aDesArray ); |
|
523 downloadHandled = ETrue; |
|
524 } |
|
525 |
|
526 BROWSER_LOG( ( _L( " downloadHandled: [%d]" ), (TInt)downloadHandled ) ); |
|
527 return downloadHandled; |
|
528 } |
|
529 |
|
530 #ifdef __RSS_FEEDS |
|
531 // --------------------------------------------------------- |
|
532 // CBrowserSpecialLoadObserver::HandleUiContentL() |
|
533 // --------------------------------------------------------- |
|
534 // |
|
535 TBool CBrowserSpecialLoadObserver::HandleUiContentL( |
|
536 RArray<TUint>* aTypeArray, |
|
537 CDesCArrayFlat* aDesArray ) const |
|
538 { |
|
539 TDataType dataType; |
|
540 |
|
541 TBool contentTypeFound( EFalse ); |
|
542 TBool urlFound( EFalse ); |
|
543 TBool fileFound( EFalse ); |
|
544 TBool result( EFalse ); |
|
545 |
|
546 TPtrC receivedContentType = ExtractBrCtlParam( |
|
547 EParamReceivedContentType, |
|
548 aTypeArray, |
|
549 aDesArray, |
|
550 contentTypeFound ); |
|
551 |
|
552 TPtrC url = ExtractBrCtlParam( |
|
553 EParamRequestUrl, |
|
554 aTypeArray, |
|
555 aDesArray, |
|
556 urlFound ); |
|
557 |
|
558 |
|
559 TPtrC fileName = ExtractBrCtlParam( |
|
560 EParamLocalFileName, |
|
561 aTypeArray, |
|
562 aDesArray, |
|
563 fileFound ); |
|
564 |
|
565 // Compare returns 0 if the strings are the same |
|
566 if ((receivedContentType.Compare(KMimeTypeAppXML) == 0) || |
|
567 (receivedContentType.Compare(KMimeTypeTextXML) == 0) || |
|
568 (receivedContentType.Compare(KMimeTypeRSS) == 0) || |
|
569 (receivedContentType.Compare(KMimeTypeAtom) == 0) || |
|
570 (receivedContentType.Compare(KMimeTypeRDF) == 0) || |
|
571 (receivedContentType.Compare(KOPMLMimeType) == 0) || |
|
572 //++PK added check for Text/xml content-type, only T is in caps, should make string check case insensitive |
|
573 (receivedContentType.Compare(KMimeTypeCapsTextXML) == 0) |
|
574 //++PK |
|
575 ) |
|
576 { |
|
577 if (fileFound) |
|
578 { |
|
579 RFs rfs; |
|
580 RFile rfile; |
|
581 |
|
582 // Open the file. |
|
583 User::LeaveIfError(rfs.Connect()); |
|
584 CleanupClosePushL(rfs); |
|
585 |
|
586 TInt fileResult( rfile.Open( rfs, fileName, EFileRead ) ); |
|
587 // file open doesn't succeeded |
|
588 User::LeaveIfError( fileResult ); |
|
589 if( fileResult == KErrNone ) |
|
590 { |
|
591 CleanupClosePushL( rfile ); |
|
592 |
|
593 TBuf<KMaxDataTypeLength> dataTypeDes; |
|
594 TBool deleteOpml = EFalse; |
|
595 |
|
596 if(CBrowserAppUi::Static()->RecognizeUiFileL(rfile, dataTypeDes)) |
|
597 { |
|
598 TFileName fileNameBuf = TFileName(fileName); |
|
599 TFileName truncFileName; |
|
600 User::LeaveIfError( rfile.Name(truncFileName) ); |
|
601 |
|
602 // Confirm with user that we want to handle it |
|
603 if(CBrowserAppUi::Static()->ConfirmUiHandlingL(truncFileName, dataTypeDes)) |
|
604 { |
|
605 // Have AppUI decide what to do with it, what view, etc. |
|
606 CBrowserAppUi::Static()->HandleUiDownloadL(fileNameBuf, dataTypeDes); |
|
607 } |
|
608 else |
|
609 { |
|
610 deleteOpml = ETrue; |
|
611 } |
|
612 result = ETrue; |
|
613 } |
|
614 |
|
615 |
|
616 // delete the downloaded file if it is not handled |
|
617 if(deleteOpml && (dataTypeDes.Compare(KOPMLMimeType) == 0 )) |
|
618 { |
|
619 rfs.Delete(fileName); |
|
620 } |
|
621 } |
|
622 |
|
623 // If open file was handled, skip sending to feeds engine |
|
624 // otherwise, pass it on |
|
625 if(!result) |
|
626 { |
|
627 TInt fileSize; |
|
628 // Read the file from the beginning into a buffer |
|
629 User::LeaveIfError(rfile.Size(fileSize)); |
|
630 HBufC8* buffer = HBufC8::NewLC(fileSize); |
|
631 TPtr8 bufferPtr(buffer->Des()); |
|
632 TInt startPos = 0; |
|
633 User::LeaveIfError(rfile.Read(startPos, bufferPtr, fileSize)); |
|
634 |
|
635 _LIT8( searchTag1, "<feed" ); //Atom 1.0 Feed |
|
636 _LIT8( searchTag2, "<rdf" ); //RSS 1.0 Feed |
|
637 _LIT8( searchTag3, "<rss" ); //RSS 2.0 Feed |
|
638 |
|
639 if( ( bufferPtr.FindF( searchTag1 ) != KErrNotFound ) || (bufferPtr.FindF( searchTag2 ) != KErrNotFound ) || |
|
640 (bufferPtr.FindF( searchTag3 ) != KErrNotFound ) ) |
|
641 { |
|
642 // Launch the Feeds Engine only when xml file contain atleast one of the above mentioned feeds tag |
|
643 iContentView->HandleSubscribeToWithUrlL(url); |
|
644 } |
|
645 else |
|
646 { |
|
647 //Delete the file, if it is not fwd to Feeds Engine, As displaying of xml files is not supported. |
|
648 rfs.Delete(fileName); |
|
649 } |
|
650 result = ETrue; |
|
651 CleanupStack::PopAndDestroy(); //buffer |
|
652 } |
|
653 |
|
654 CleanupStack::PopAndDestroy(); //rfile |
|
655 CleanupStack::PopAndDestroy(); //rfs |
|
656 } |
|
657 } |
|
658 |
|
659 return result; |
|
660 } |
|
661 |
|
662 #endif // __RSS_FEEDS |
|
663 |
|
664 |
|
665 // --------------------------------------------------------- |
|
666 // CBrowserSpecialLoadObserver::BrCtlParamList2GenericParamListL() |
|
667 // --------------------------------------------------------- |
|
668 // |
|
669 CAiwGenericParamList* CBrowserSpecialLoadObserver::BrCtlParamList2GenericParamListL( |
|
670 RArray<TUint>* aTypeArray, |
|
671 CDesCArrayFlat* aDesArray ) const |
|
672 { |
|
673 LOG_ENTERFN("CBrowserSpecialLoadObserver::BrCtlParamList2GenericParamListL"); |
|
674 |
|
675 __ASSERT_DEBUG( (aTypeArray != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
676 __ASSERT_DEBUG( (aDesArray != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
677 |
|
678 |
|
679 //Creating generic param list |
|
680 CAiwGenericParamList* genericParamList = CAiwGenericParamList::NewLC(); |
|
681 |
|
682 for( TInt j = 0; j < aTypeArray->Count(); j++ ) |
|
683 { |
|
684 BROWSER_LOG( ( _L( " iter: %d" ), j ) ); |
|
685 TBool paramFound( EFalse ); |
|
686 const TUint paramType = (*aTypeArray)[j]; |
|
687 TPtrC param = ExtractBrCtlParam( |
|
688 paramType, |
|
689 aTypeArray, |
|
690 aDesArray, |
|
691 paramFound ); |
|
692 __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); |
|
693 |
|
694 BROWSER_LOG( ( _L( " Type: %d, Value: %S" ), paramType, ¶m ) ); |
|
695 |
|
696 switch( paramType ) |
|
697 { |
|
698 case EParamRequestUrl: |
|
699 { |
|
700 BROWSER_LOG( ( _L( " EParamRequestUrl" ) ) ); |
|
701 // limit url to 255 char's or DocHandler panics! |
|
702 TAiwVariant paramVariant( param.Left( KMaxDocHandlerUrlLen ) ); |
|
703 TAiwGenericParam genericParam( EGenericParamURL, |
|
704 paramVariant ); |
|
705 genericParamList->AppendL( genericParam ); |
|
706 break; |
|
707 } |
|
708 case EParamRealm: |
|
709 { |
|
710 BROWSER_LOG( ( _L( " EParamRealm" ) ) ); |
|
711 // No corresponding generic param! |
|
712 break; |
|
713 } |
|
714 case EParamUsername: |
|
715 { |
|
716 BROWSER_LOG( ( _L( " EParamUsername" ) ) ); |
|
717 // No corresponding generic param! |
|
718 break; |
|
719 } |
|
720 case EParamPassword: |
|
721 { |
|
722 BROWSER_LOG( ( _L( " EParamPassword" ) ) ); |
|
723 // No corresponding generic param! |
|
724 break; |
|
725 } |
|
726 case EParamProxyUsername: |
|
727 { |
|
728 BROWSER_LOG( ( _L( " EParamProxyUsername" ) ) ); |
|
729 // No corresponding generic param! |
|
730 break; |
|
731 } |
|
732 case EParamProxyPassword: |
|
733 { |
|
734 BROWSER_LOG( ( _L( " EParamProxyPassword" ) ) ); |
|
735 // No corresponding generic param! |
|
736 break; |
|
737 } |
|
738 case EParamRawRequestHeader: |
|
739 { |
|
740 BROWSER_LOG( ( _L( " EParamRawRequestHeader" ) ) ); |
|
741 // No corresponding generic param! |
|
742 break; |
|
743 } |
|
744 case EParamReceivedContentType: |
|
745 { |
|
746 BROWSER_LOG( ( _L( " EParamReceivedContentType" ) ) ); |
|
747 // The expected content type should override the response header's |
|
748 // content type => don't use EParamReceivedContentType if |
|
749 // EParamExpectedContentType is set! |
|
750 TBool expectedContentTypeFound( EFalse ); |
|
751 ExtractBrCtlParam( |
|
752 EParamExpectedContentType, |
|
753 aTypeArray, |
|
754 aDesArray, |
|
755 expectedContentTypeFound ); |
|
756 if ( !expectedContentTypeFound ) |
|
757 { |
|
758 // Using EParamReceivedContentType |
|
759 BROWSER_LOG( ( _L( " EParamExpectedContentType not found" ) ) ); |
|
760 TAiwVariant paramVariant( param ); |
|
761 TAiwGenericParam genericParam( EGenericParamMIMEType, |
|
762 paramVariant ); |
|
763 genericParamList->AppendL( genericParam ); |
|
764 } |
|
765 break; |
|
766 } |
|
767 case EParamExpectedContentType: |
|
768 { |
|
769 // Overrides EParamReceivedContentType! |
|
770 BROWSER_LOG( ( _L( " EParamExpectedContentType" ) ) ); |
|
771 TAiwVariant paramVariant( param ); |
|
772 TAiwGenericParam genericParam( EGenericParamMIMEType, |
|
773 paramVariant ); |
|
774 genericParamList->AppendL( genericParam ); |
|
775 break; |
|
776 } |
|
777 case EParamTotalContentLength: |
|
778 { |
|
779 BROWSER_LOG( ( _L( " EParamTotalContentLength" ) ) ); |
|
780 // No corresponding generic param! |
|
781 break; |
|
782 } |
|
783 case EParamReceivedContent: |
|
784 { |
|
785 BROWSER_LOG( ( _L( " EParamReceivedContent" ) ) ); |
|
786 // No corresponding generic param! |
|
787 break; |
|
788 } |
|
789 case EParamRawResponseHeader: |
|
790 { |
|
791 BROWSER_LOG( ( _L( " EParamRawResponseHeader" ) ) ); |
|
792 // No corresponding generic param! |
|
793 break; |
|
794 } |
|
795 case EParamLocalFileName: |
|
796 { |
|
797 BROWSER_LOG( ( _L( " EParamLocalFileName" ) ) ); |
|
798 TAiwVariant paramVariant( param ); |
|
799 TAiwGenericParam genericParam( EGenericParamFile, |
|
800 paramVariant ); |
|
801 genericParamList->AppendL( genericParam ); |
|
802 break; |
|
803 } |
|
804 case EParamCharset: |
|
805 { |
|
806 BROWSER_LOG( ( _L( " EParamCharset" ) ) ); |
|
807 TAiwVariant paramVariant( param ); |
|
808 TAiwGenericParam genericParam( EGenericParamCharSet, |
|
809 paramVariant ); |
|
810 genericParamList->AppendL( genericParam ); |
|
811 break; |
|
812 } |
|
813 case EParamRefererHeader: |
|
814 { |
|
815 BROWSER_LOG( ( _L( " EParamRefererHeader" ) ) ); |
|
816 TAiwVariant paramVariant( param ); |
|
817 TAiwGenericParam genericParam( EGenericParamReferringURI, |
|
818 paramVariant ); |
|
819 genericParamList->AppendL( genericParam ); |
|
820 break; |
|
821 } |
|
822 default: |
|
823 { |
|
824 BROWSER_LOG( ( _L( " Unexpected argument" ) ) ); |
|
825 break; |
|
826 } |
|
827 } |
|
828 } |
|
829 |
|
830 // Always add the access point, if currently connected |
|
831 if( iApiProvider->Connection().Connected() ) |
|
832 { |
|
833 TInt32 ap = iApiProvider->Connection().CurrentAPId(); |
|
834 BROWSER_LOG( ( _L( " IAP: %d" ), ap ) ); |
|
835 TAiwVariant paramVariant( ap ); |
|
836 TAiwGenericParam genericParam( EGenericParamAccessPoint, |
|
837 paramVariant ); |
|
838 genericParamList->AppendL( genericParam ); |
|
839 } |
|
840 |
|
841 CleanupStack::Pop( genericParamList ); // genericParamList |
|
842 return genericParamList; |
|
843 } |
|
844 |
|
845 // --------------------------------------------------------- |
|
846 // CBrowserSpecialLoadObserver::ExtractBrCtlParam() |
|
847 // --------------------------------------------------------- |
|
848 // |
|
849 TPtrC CBrowserSpecialLoadObserver::ExtractBrCtlParam |
|
850 ( TUint aParamTypeToFind, |
|
851 RArray<TUint>* aTypeArray, |
|
852 CDesCArrayFlat* aDesArray, |
|
853 TBool& aParamFound ) const |
|
854 { |
|
855 LOG_ENTERFN("CBrowserSpecialLoadObserver::ExtractBrCtlParam"); |
|
856 |
|
857 __ASSERT_DEBUG( (aTypeArray != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
858 __ASSERT_DEBUG( (aDesArray != NULL), Util::Panic( Util::EUninitializedData ) ); |
|
859 |
|
860 // initialize output parameter |
|
861 aParamFound = EFalse; |
|
862 TPtrC16 retParamValue; |
|
863 |
|
864 for( TInt j = 0; j < aTypeArray->Count(); j++ ) |
|
865 { |
|
866 BROWSER_LOG( ( _L( " iter: %d" ), j ) ); |
|
867 const TUint paramType = (*aTypeArray)[j]; |
|
868 if ( aParamTypeToFind == paramType ) |
|
869 { |
|
870 // That's we need |
|
871 retParamValue.Set( aDesArray->MdcaPoint(j) ); |
|
872 aParamFound = ETrue; // Indicate it in the out param |
|
873 BROWSER_LOG( ( _L( " Type: %d, Value: %S" ), paramType, &retParamValue ) ); |
|
874 break; // break the loop - we found it |
|
875 } |
|
876 } |
|
877 |
|
878 return retParamValue; |
|
879 } |
|
880 |
|
881 // --------------------------------------------------------- |
|
882 // CBrowserSpecialLoadObserver::IsSelfDownloadContentTypeL() |
|
883 // --------------------------------------------------------- |
|
884 // |
|
885 TBool CBrowserSpecialLoadObserver::IsSelfDownloadContentTypeL |
|
886 ( RArray<TUint>* aTypeArray, |
|
887 CDesCArrayFlat* aDesArray ) const |
|
888 { |
|
889 LOG_ENTERFN("CBrowserSpecialLoadObserver::IsSelfDownloadContentTypeL"); |
|
890 |
|
891 TBool isSelfDownloadContentType = EFalse; |
|
892 |
|
893 // First get the download's content type (mime type) |
|
894 TBool paramFound( EFalse ); |
|
895 TPtrC contentType = ExtractBrCtlParam( |
|
896 EParamReceivedContentType, |
|
897 aTypeArray, |
|
898 aDesArray, |
|
899 paramFound ); |
|
900 |
|
901 if ( !paramFound ) |
|
902 { |
|
903 isSelfDownloadContentType = EFalse; |
|
904 } |
|
905 else |
|
906 { |
|
907 BROWSER_LOG( ( _L( " contentType: [%S]" ), &contentType ) ); |
|
908 // Then check, if it is in SelfDownloadContentTypes |
|
909 TInt cTLength = contentType.Length(); |
|
910 TPtrC selfDownloadCTs = iApiProvider->Preferences().SelfDownloadContentTypesL(); |
|
911 TInt idx = KErrNotFound; |
|
912 idx = selfDownloadCTs.FindF( contentType ); |
|
913 const TChar KBrowserSpecLoadObsSemicolon = ';'; |
|
914 while( idx != KErrNotFound ) |
|
915 { |
|
916 // check for ';' on the left KSemicolon |
|
917 if ( idx == 0 || selfDownloadCTs[ idx - 1 ] == KBrowserSpecLoadObsSemicolon ) |
|
918 { |
|
919 // check for ';' on the right |
|
920 idx += cTLength; |
|
921 if ( idx == selfDownloadCTs.Length() || selfDownloadCTs[ idx ] == KBrowserSpecLoadObsSemicolon ) |
|
922 { |
|
923 isSelfDownloadContentType = ETrue; |
|
924 break; |
|
925 } |
|
926 } |
|
927 selfDownloadCTs.Set( selfDownloadCTs.Mid( idx ) ); |
|
928 idx = selfDownloadCTs.FindF( contentType ); |
|
929 } |
|
930 } |
|
931 |
|
932 BROWSER_LOG( ( _L( " isSelfDownloadContentType: %d" ), isSelfDownloadContentType ) ); |
|
933 return isSelfDownloadContentType; |
|
934 } |
|
935 |
|
936 // --------------------------------------------------------- |
|
937 // CBrowserSpecialLoadObserver::OpenFileEmbeddedL() |
|
938 // --------------------------------------------------------- |
|
939 // |
|
940 void CBrowserSpecialLoadObserver::OpenFileEmbeddedL |
|
941 ( RArray<TUint>* aTypeArray, |
|
942 CDesCArrayFlat* aDesArray ) |
|
943 { |
|
944 LOG_ENTERFN("CBrowserSpecialLoadObserver::OpenFileEmbeddedL"); |
|
945 |
|
946 CDocumentHandler* newDocHandler = CDocumentHandler::NewL(); |
|
947 delete iDocHandler; |
|
948 iDocHandler = newDocHandler; |
|
949 iDocHandler->SetExitObserver( this ); |
|
950 |
|
951 TBool paramFound( EFalse ); |
|
952 TPtrC fileName = ExtractBrCtlParam( |
|
953 EParamLocalFileName, |
|
954 aTypeArray, |
|
955 aDesArray, |
|
956 paramFound ); |
|
957 __ASSERT_DEBUG( paramFound, Util::Panic( Util::EUninitializedData ) ); |
|
958 |
|
959 TPtrC contentType = ExtractBrCtlParam( |
|
960 EParamReceivedContentType, |
|
961 aTypeArray, |
|
962 aDesArray, |
|
963 paramFound ); |
|
964 HBufC8* contentType8 = 0; |
|
965 if ( !paramFound ) |
|
966 { |
|
967 contentType8 = KNullDesC8().AllocLC(); |
|
968 } |
|
969 else |
|
970 { |
|
971 BROWSER_LOG( ( _L( " contentType: [%S]" ), &contentType ) ); |
|
972 contentType8 = HBufC8::NewLC( contentType.Length() ); |
|
973 // 16 bit buffer copied into 8 bit buffer. |
|
974 contentType8->Des().Copy( contentType ); |
|
975 } |
|
976 TDataType dataType( *contentType8 ); |
|
977 |
|
978 CAiwGenericParamList* genericParamList = |
|
979 BrCtlParamList2GenericParamListL( aTypeArray, aDesArray ); |
|
980 CleanupStack::PushL( genericParamList ); |
|
981 |
|
982 // File is not yet saved to target folder. |
|
983 TBool allowSave( ETrue ); |
|
984 TAiwVariant allowSaveVariant( allowSave ); |
|
985 TAiwGenericParam genericParamAllowSave |
|
986 ( EGenericParamAllowSave, allowSaveVariant ); |
|
987 genericParamList->AppendL( genericParamAllowSave ); |
|
988 |
|
989 // Set EGenericParamAllowMove - we encourage handlers to apply |
|
990 // move instead of copy for the file. |
|
991 TBool allowMove( ETrue ); |
|
992 TAiwVariant allowMoveVariant( allowMove ); |
|
993 TAiwGenericParam genericParamAllowMove |
|
994 ( EGenericParamAllowMove, allowMoveVariant ); |
|
995 genericParamList->AppendL( genericParamAllowMove ); |
|
996 |
|
997 RFile tempFile; |
|
998 iDocHandler->OpenTempFileL( fileName, tempFile ); |
|
999 CleanupClosePushL( tempFile ); |
|
1000 /*TInt err = */iDocHandler->OpenFileEmbeddedL( tempFile, |
|
1001 dataType, |
|
1002 *genericParamList ); |
|
1003 //BROWSER_LOG( ( _L( " err: %d" ), err ) ); |
|
1004 CleanupStack::PopAndDestroy( &tempFile ); // tempFile |
|
1005 |
|
1006 CleanupStack::PopAndDestroy( genericParamList ); // genericParamList |
|
1007 CleanupStack::PopAndDestroy( contentType8 ); // contentType8 |
|
1008 } |
|
1009 |
|
1010 // --------------------------------------------------------- |
|
1011 // CBrowserSpecialLoadObserver::HandleServerAppExit() |
|
1012 // --------------------------------------------------------- |
|
1013 // |
|
1014 void CBrowserSpecialLoadObserver::HandleServerAppExit( TInt /*aReason*/ ) |
|
1015 { |
|
1016 iSchemeProcessing = EFalse; |
|
1017 } |
|
1018 |
|
1019 #ifdef __WINS__ |
|
1020 // ---------------------------------------------------------------------------- |
|
1021 // CBrowserSpecialLoadObserver::AskIapIdL(TUint32& aId) |
|
1022 // Ask IAP id from the user |
|
1023 // ---------------------------------------------------------------------------- |
|
1024 // |
|
1025 TInt CBrowserSpecialLoadObserver::AskIapIdL( TUint32& aId ) |
|
1026 { |
|
1027 CCommsDatabase* TheDb; |
|
1028 TInt res; |
|
1029 TBuf<40> name; |
|
1030 TUint32 id; |
|
1031 RArray<TUint32> idArray; |
|
1032 CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(16); |
|
1033 CleanupStack::PushL( items ); // 1 |
|
1034 |
|
1035 // Get IAP names and ids from the database |
|
1036 TheDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); |
|
1037 CleanupStack::PushL( TheDb ); // 2 |
|
1038 |
|
1039 TheDb->ShowHiddenRecords(); |
|
1040 |
|
1041 CCommsDbTableView* view = TheDb->OpenTableLC( TPtrC( IAP ) ); // 3 |
|
1042 res = view->GotoFirstRecord(); |
|
1043 |
|
1044 while( !res ) |
|
1045 { |
|
1046 view->ReadTextL( TPtrC( COMMDB_NAME ), name ); |
|
1047 view->ReadUintL( TPtrC( COMMDB_ID ), id ); |
|
1048 |
|
1049 idArray.Insert( id, 0 ); |
|
1050 items->InsertL( 0, name ); |
|
1051 |
|
1052 res = view->GotoNextRecord(); |
|
1053 RDebug::Print(_L("IAP name, id: %S, %d"), &name, id ); |
|
1054 } |
|
1055 |
|
1056 // Create listbox and PUSH it. |
|
1057 CEikTextListBox* list = new (ELeave) CAknSinglePopupMenuStyleListBox; |
|
1058 CleanupStack::PushL( list ); // 4 |
|
1059 |
|
1060 // Create popup list and PUSH it. |
|
1061 CAknPopupList* popupList = CAknPopupList::NewL( |
|
1062 list, R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
|
1063 AknPopupLayouts::EMenuWindow); |
|
1064 CleanupStack::PushL( popupList ); // 5 |
|
1065 |
|
1066 // initialize listbox. |
|
1067 list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); |
|
1068 list->CreateScrollBarFrameL(ETrue); |
|
1069 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
1070 CEikScrollBarFrame::EOff, |
|
1071 CEikScrollBarFrame::EAuto); |
|
1072 |
|
1073 // Set listitems. |
|
1074 CTextListBoxModel* model = list->Model(); |
|
1075 model->SetItemTextArray( items ); |
|
1076 model->SetOwnershipType( ELbmOwnsItemArray ); |
|
1077 |
|
1078 // Set title |
|
1079 popupList->SetTitleL( _L( "Select IAP:" ) ); |
|
1080 |
|
1081 // Show popup list. |
|
1082 TInt popupOk = popupList->ExecuteLD(); |
|
1083 if( popupOk ) |
|
1084 { |
|
1085 TInt index = list->CurrentItemIndex(); |
|
1086 aId = idArray[index]; |
|
1087 } |
|
1088 |
|
1089 CleanupStack::Pop( popupList ); // popuplist |
|
1090 CleanupStack::PopAndDestroy( list ); // list |
|
1091 CleanupStack::PopAndDestroy( view ); // view |
|
1092 CleanupStack::PopAndDestroy( TheDb ); // TheDb |
|
1093 CleanupStack::Pop( items ); // items CTextListBoxModel* model owns it |
|
1094 |
|
1095 idArray.Close(); |
|
1096 items = NULL; |
|
1097 return popupOk; |
|
1098 } |
|
1099 |
|
1100 #endif // __WINS__ |
|
1101 |
|
1102 // End of file |
|