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