apengine/apsettingshandlerui/src/apsettingshandleruiImpl.cpp
changeset 66 ed07dcc72692
parent 47 cb7afde124a3
equal deleted inserted replaced
64:84c6623982f6 66:ed07dcc72692
    93                                          TInt aIspFilter,
    93                                          TInt aIspFilter,
    94                                          TInt aBearerFilter,
    94                                          TInt aBearerFilter,
    95                                          TInt aSortType,
    95                                          TInt aSortType,
    96                                          TBool aNoEdit )
    96                                          TBool aNoEdit )
    97     {
    97     {
    98     APSETUILOGGER_CREATE;
    98     return NULL;
    99     
       
   100     CApSettingsHandlerImpl* db = 
       
   101             new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
       
   102                                               aListType,
       
   103                                               aSelMenuType,
       
   104                                               aNoEdit );
       
   105     CleanupStack::PushL( db );
       
   106 
       
   107     db->ConstructL( aIspFilter, aBearerFilter, aSortType );
       
   108     
       
   109     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC")
       
   110     
       
   111     return db;
       
   112     }
    99     }
   113 
   100 
   114 
   101 
   115 
   102 
   116 
   103 
   127                                             TInt aBearerFilter,
   114                                             TInt aBearerFilter,
   128                                             TInt aSortType,
   115                                             TInt aSortType,
   129                                             TBool aNoEdit
   116                                             TBool aNoEdit
   130                                             )
   117                                             )
   131     {
   118     {
   132     APSETUILOGGER_CREATE;
   119     return NULL;
   133 
       
   134     CApSettingsHandlerImpl* db = 
       
   135             new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
       
   136                                               aListType,
       
   137                                               aSelMenuType,
       
   138                                               aNoEdit );
       
   139     CleanupStack::PushL( db );
       
   140 
       
   141     db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType );
       
   142     
       
   143     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC2")
       
   144     
       
   145     return db;
       
   146     }
   120     }
   147 
   121 
   148 
   122 
   149 
   123 
   150 // ---------------------------------------------------------
   124 // ---------------------------------------------------------
   160                                          TInt aSortType,
   134                                          TInt aSortType,
   161                                          TInt aReqIpvType,
   135                                          TInt aReqIpvType,
   162                                          TBool aNoEdit
   136                                          TBool aNoEdit
   163                                          )
   137                                          )
   164     {
   138     {
   165     APSETUILOGGER_CREATE;
   139     return NULL;
   166     
       
   167     CApSettingsHandlerImpl* db = 
       
   168         new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
       
   169                                           aListType,
       
   170                                           aSelMenuType,
       
   171                                           aReqIpvType,
       
   172                                           aNoEdit
       
   173                                           );
       
   174     CleanupStack::PushL( db );
       
   175     
       
   176     db->ConstructL( aIspFilter, aBearerFilter, aSortType );
       
   177     
       
   178     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC3")
       
   179     
       
   180     return db;
       
   181     }
   140     }
   182 
   141 
   183 
   142 
   184 
   143 
   185 
   144 
   197                                             TInt aSortType,
   156                                             TInt aSortType,
   198                                             TInt aReqIpvType,
   157                                             TInt aReqIpvType,
   199                                             TBool aNoEdit
   158                                             TBool aNoEdit
   200                                             )
   159                                             )
   201     {
   160     {
   202     APSETUILOGGER_CREATE;
   161     return NULL;
   203     
       
   204     CApSettingsHandlerImpl* db = 
       
   205         new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
       
   206                                           aListType,
       
   207                                           aSelMenuType,
       
   208                                           aReqIpvType,
       
   209                                           aNoEdit
       
   210                                           );
       
   211     CleanupStack::PushL( db );
       
   212 
       
   213     db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType );
       
   214     
       
   215     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC4")
       
   216     
       
   217     return db;
       
   218     }
   162     }
   219 
   163 
   220 
   164 
   221 
   165 
   222 
   166 
   235                                         TInt aReqIpvType,
   179                                         TInt aReqIpvType,
   236                                         TVpnFilterType aVpnFilterType,
   180                                         TVpnFilterType aVpnFilterType,
   237                                         TBool aNoEdit
   181                                         TBool aNoEdit
   238                                             )
   182                                             )
   239     {
   183     {
   240     APSETUILOGGER_CREATE;
   184     return NULL;
   241     
       
   242     CApSettingsHandlerImpl* db = 
       
   243         new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
       
   244                                           aListType,
       
   245                                           aSelMenuType,
       
   246                                           aReqIpvType,
       
   247                                           aNoEdit
       
   248                                           );
       
   249     CleanupStack::PushL( db );
       
   250 
       
   251     db->ConstructL( aIspFilter, aBearerFilter, 
       
   252                     aSortType, aVpnFilterType );
       
   253                     
       
   254     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC5")
       
   255     
       
   256     return db;
       
   257     }
   185     }
   258 
   186 
   259 
   187 
   260 // ---------------------------------------------------------
   188 // ---------------------------------------------------------
   261 // CApSettingsHandlerImpl::NewLC
   189 // CApSettingsHandlerImpl::NewLC
   272                                             TInt aReqIpvType,
   200                                             TInt aReqIpvType,
   273                                             TVpnFilterType aVpnFilterType,
   201                                             TVpnFilterType aVpnFilterType,
   274                                             TBool aNoEdit
   202                                             TBool aNoEdit
   275                                             )
   203                                             )
   276     {
   204     {
   277     APSETUILOGGER_CREATE;
   205     return NULL;
   278     
       
   279     CApSettingsHandlerImpl* db = 
       
   280         new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
       
   281                                           aListType,
       
   282                                           aSelMenuType,
       
   283                                           aReqIpvType,
       
   284                                           aNoEdit
       
   285                                           );
       
   286     CleanupStack::PushL( db );
       
   287 
       
   288     db->ConstructL( aDb, aIspFilter, aBearerFilter, 
       
   289                     aSortType, aVpnFilterType );
       
   290     
       
   291     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC6")
       
   292     
       
   293     return db;
       
   294     }
   206     }
   295 
   207 
   296 
   208 
   297 
   209 
   298 
   210 
   314                                         TVpnFilterType aVpnFilterType,
   226                                         TVpnFilterType aVpnFilterType,
   315                                         TBool aIncludeEasyWlan,
   227                                         TBool aIncludeEasyWlan,
   316                                         TBool aNoEdit
   228                                         TBool aNoEdit
   317                                         )
   229                                         )
   318     {
   230     {
   319     APSETUILOGGER_CREATE;
   231     return NULL;    
   320     
       
   321     CApSettingsHandlerImpl* db = 
       
   322         new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
       
   323                                           aListType,
       
   324                                           aSelMenuType,
       
   325                                           aReqIpvType,
       
   326                                           aNoEdit
       
   327                                           );
       
   328     CleanupStack::PushL( db );
       
   329     db->ConstructL( aDb, aIspFilter, aBearerFilter, 
       
   330                     aSortType, aVpnFilterType, aIncludeEasyWlan );
       
   331     
       
   332     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC7")
       
   333     
       
   334     return db;    
       
   335     }
   232     }
   336 
   233 
   337 
   234 
   338 
   235 
   339 // Destructor
   236 // Destructor
   340 CApSettingsHandlerImpl::~CApSettingsHandlerImpl()
   237 CApSettingsHandlerImpl::~CApSettingsHandlerImpl()
   341     {
   238     {
   342     APSETUILOGGER_DELETE;
       
   343 
       
   344     if ( iTextOverrides )
       
   345         {
       
   346         delete iTextOverrides;
       
   347         iTextOverrides = NULL;
       
   348         APSETUILOGGER_WRITE( EAPI,"EApImpl::txtoverrides deleted");
       
   349         }
       
   350     if ( iExt )
       
   351         {
       
   352         if ( iExt->iResOffset )
       
   353             {
       
   354             iModel->EikEnv()->DeleteResourceFile( iExt->iResOffset );
       
   355             APSETUILOGGER_WRITE( EAPI,"EApImpl::Resource file deleted");
       
   356             }
       
   357         if ( iExt->iIsFeatureManagerInitialised )
       
   358             {
       
   359             FeatureManager::UnInitializeLib();
       
   360             APSETUILOGGER_WRITE( EAPI,"EApImpl::FeatMan. uninitialised");
       
   361             }
       
   362         }
       
   363 
       
   364     if ( iModel )
       
   365         {
       
   366         delete iModel;
       
   367         iModel = NULL;
       
   368         }
       
   369 
       
   370     APSETUILOGGER_WRITE( EAPI,"EApImpl::imodel deleted");
       
   371 
       
   372     delete iExt;
       
   373     
       
   374     APSETUILOGGER_WRITE( EAPI,"EApImpl::iext deleted");
       
   375     }
   239     }
   376 
   240 
   377 
   241 
   378 // Constructor
   242 // Constructor
   379 CApSettingsHandlerImpl::CApSettingsHandlerImpl( TBool aStartWithSelection,
   243 CApSettingsHandlerImpl::CApSettingsHandlerImpl( TBool aStartWithSelection,
   388 iBearerFilter( EApBearerTypeAll ),
   252 iBearerFilter( EApBearerTypeAll ),
   389 iReqIpvType( EIPv4 ),
   253 iReqIpvType( EIPv4 ),
   390 iEventStore( KApUiEventNone ),
   254 iEventStore( KApUiEventNone ),
   391 iNoEdit( aNoEdit )
   255 iNoEdit( aNoEdit )
   392     {
   256     {
   393     iHelpMajor = KHelpUidApSettingsHandler;
       
   394     }
   257     }
   395 
   258 
   396 
   259 
   397 
   260 
   398 
   261 
   411 iBearerFilter( EApBearerTypeAll ),
   274 iBearerFilter( EApBearerTypeAll ),
   412 iReqIpvType( aReqIpvType ),
   275 iReqIpvType( aReqIpvType ),
   413 iEventStore( KApUiEventNone ),
   276 iEventStore( KApUiEventNone ),
   414 iNoEdit( aNoEdit )
   277 iNoEdit( aNoEdit )
   415     {
   278     {
   416     iHelpMajor = KHelpUidApSettingsHandler;
       
   417     }
   279     }
   418 
   280 
   419 
   281 
   420 
   282 
   421 // ---------------------------------------------------------
   283 // ---------------------------------------------------------
   424 //
   286 //
   425 void CApSettingsHandlerImpl::ConstructL(   TInt aIspFilter,
   287 void CApSettingsHandlerImpl::ConstructL(   TInt aIspFilter,
   426                                                 TInt aBearerFilter,
   288                                                 TInt aBearerFilter,
   427                                                 TInt aSortType )
   289                                                 TInt aSortType )
   428     {
   290     {
   429     APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL")
       
   430     
       
   431     DoConstructL( NULL, aIspFilter, aBearerFilter, 
       
   432                   aSortType, EVpnFilterBoth, EFalse );
       
   433                   
       
   434     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL")
       
   435     }
   291     }
   436 
   292 
   437 
   293 
   438 
   294 
   439 // ---------------------------------------------------------
   295 // ---------------------------------------------------------
   443 void CApSettingsHandlerImpl::ConstructL(   CActiveApDb& aDb,
   299 void CApSettingsHandlerImpl::ConstructL(   CActiveApDb& aDb,
   444                                                 TInt aIspFilter,
   300                                                 TInt aIspFilter,
   445                                                 TInt aBearerFilter,
   301                                                 TInt aBearerFilter,
   446                                                 TInt aSortType )
   302                                                 TInt aSortType )
   447     {
   303     {
   448     APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL2")
       
   449     
       
   450     DoConstructL( &aDb, aIspFilter, aBearerFilter, 
       
   451                   aSortType, EVpnFilterBoth, EFalse );
       
   452 
       
   453     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL2")    
       
   454     }
   304     }
   455 
   305 
   456 
   306 
   457 
   307 
   458 // ---------------------------------------------------------
   308 // ---------------------------------------------------------
   464                                              TInt aBearerFilter,
   314                                              TInt aBearerFilter,
   465                                              TInt aSortType,
   315                                              TInt aSortType,
   466                                              TVpnFilterType aVpnFilterType
   316                                              TVpnFilterType aVpnFilterType
   467                                             )
   317                                             )
   468     {
   318     {
   469     APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL3")
       
   470     
       
   471     DoConstructL( NULL, aIspFilter, aBearerFilter, 
       
   472                   aSortType, aVpnFilterType, EFalse );
       
   473     
       
   474     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL3")
       
   475     }
   319     }
   476 
   320 
   477 
   321 
   478 
   322 
   479 // ---------------------------------------------------------
   323 // ---------------------------------------------------------
   486                                              TInt aBearerFilter,
   330                                              TInt aBearerFilter,
   487                                              TInt aSortType,
   331                                              TInt aSortType,
   488                                              TVpnFilterType aVpnFilterType
   332                                              TVpnFilterType aVpnFilterType
   489                                              )
   333                                              )
   490     {
   334     {
   491     APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL4")
       
   492     
       
   493     DoConstructL( &aDb, aIspFilter, aBearerFilter, 
       
   494                   aSortType, aVpnFilterType, EFalse );
       
   495     
       
   496     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL4")
       
   497     }
   335     }
   498 
   336 
   499 
   337 
   500 
   338 
   501 
   339 
   510                                         TInt aSortType,
   348                                         TInt aSortType,
   511                                         TVpnFilterType aVpnFilterType,
   349                                         TVpnFilterType aVpnFilterType,
   512                                         TBool aIncludeEasyWlan
   350                                         TBool aIncludeEasyWlan
   513                                         )
   351                                         )
   514     {
   352     {
   515     APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL5")
       
   516     
       
   517     DoConstructL( &aDb, aIspFilter, aBearerFilter, 
       
   518                   aSortType, aVpnFilterType, aIncludeEasyWlan );
       
   519     
       
   520     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL5")
       
   521     }
   353     }
   522 
   354 
   523 
   355 
   524 // ---------------------------------------------------------
   356 // ---------------------------------------------------------
   525 // CApSettingsHandlerImpl::SetFilter
   357 // CApSettingsHandlerImpl::SetFilter
   527 //
   359 //
   528 void CApSettingsHandlerImpl::SetFilterL(   TInt aIspFilter,
   360 void CApSettingsHandlerImpl::SetFilterL(   TInt aIspFilter,
   529                                                 TInt aBearerFilter,
   361                                                 TInt aBearerFilter,
   530                                                 TInt aSortType )
   362                                                 TInt aSortType )
   531     {
   363     {
   532     APSETUILOGGER_ENTERFN( EApImpl,"Impl::SetFilterL")
       
   533     
       
   534     iIspFilter = aIspFilter;
       
   535     iBearerFilter = aBearerFilter;
       
   536     iExt->iSortType = aSortType;
       
   537     
       
   538     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SetFilterL")
       
   539     }
   364     }
   540 
   365 
   541 
   366 
   542 
   367 
   543 
   368 
   546 // ---------------------------------------------------------
   371 // ---------------------------------------------------------
   547 //
   372 //
   548 void CApSettingsHandlerImpl::SetTextOverrideL( TTextID aText2Change,
   373 void CApSettingsHandlerImpl::SetTextOverrideL( TTextID aText2Change,
   549                                                     const TDesC& aNewText )
   374                                                     const TDesC& aNewText )
   550     {
   375     {
   551     APSETUILOGGER_ENTERFN( EApImpl,"Impl::SetTextOverrideL")
       
   552     
       
   553     __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) );
       
   554     iTextOverrides->SetTextOverrideL( aText2Change, aNewText );
       
   555     
       
   556     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SetTextOverrideL")
       
   557     }
   376     }
   558 
   377 
   559 
   378 
   560 // ---------------------------------------------------------
   379 // ---------------------------------------------------------
   561 // CApSettingsHandlerImpl::TextOverrideL
   380 // CApSettingsHandlerImpl::TextOverrideL
   562 // ---------------------------------------------------------
   381 // ---------------------------------------------------------
   563 //
   382 //
   564 const TDesC& CApSettingsHandlerImpl::TextOverrideL( TTextID aTextId )
   383 const TDesC& CApSettingsHandlerImpl::TextOverrideL( TTextID aTextId )
   565     {
   384     {
   566     APSETUILOGGER_ENTERFN( EApImpl,"Impl::TextOverrideL <- ->")
   385     User::Leave( KErrNotSupported );
   567     
       
   568     __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) );
       
   569     return iTextOverrides->TextOverrideL( aTextId );
       
   570     }
   386     }
   571 
   387 
   572 
   388 
   573 
   389 
   574 // ---------------------------------------------------------
   390 // ---------------------------------------------------------
   576 // ---------------------------------------------------------
   392 // ---------------------------------------------------------
   577 //
   393 //
   578 TInt CApSettingsHandlerImpl::RunSettingsL( TUint32 aHighLight,
   394 TInt CApSettingsHandlerImpl::RunSettingsL( TUint32 aHighLight,
   579                                                 TUint32& aSelected )
   395                                                 TUint32& aSelected )
   580     {    
   396     {    
   581     APSETUILOGGER_ENTERFN( EApImpl,"Impl::RunSettingsL")
   397     return 0;
   582     
       
   583     // this function is only called from outside, need to init iEventStore
       
   584     iEventStore = KApUiEventNone;
       
   585 
       
   586     TRAPD( err, HandleRunSettingsL( aHighLight, aSelected ) );
       
   587     if ( iEventStore & KApUiEventInternal )
       
   588         {
       
   589         // internal 'exit', not an error, 
       
   590         // clear flag and return normally
       
   591         iEventStore &= (~KApUiEventInternal);
       
   592         }
       
   593     else
       
   594         {
       
   595         User::LeaveIfError(err);
       
   596         }
       
   597 
       
   598     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::RunSettingsL")
       
   599 
       
   600     return iEventStore;
       
   601     }
   398     }
   602 
   399 
   603 
   400 
   604 
   401 
   605 // ---------------------------------------------------------
   402 // ---------------------------------------------------------
   606 // CApSettingsHandlerImpl::Cvt()
   403 // CApSettingsHandlerImpl::Cvt()
   607 // ---------------------------------------------------------
   404 // ---------------------------------------------------------
   608 //
   405 //
   609 TInt CApSettingsHandlerImpl::Cvt()
   406 TInt CApSettingsHandlerImpl::Cvt()
   610     {
   407     {
   611     APSETUILOGGER_ENTERFN( EApImpl,"Impl::Cvt")
   408     return KErrNotSupported;
   612     
       
   613     return KErrNone;
       
   614     }
   409     }
   615 
   410 
   616 
   411 
   617 // ---------------------------------------------------------
   412 // ---------------------------------------------------------
   618 // CApSettingsHandlerImpl::DoRunSettingsL
   413 // CApSettingsHandlerImpl::DoRunSettingsL
   619 // ---------------------------------------------------------
   414 // ---------------------------------------------------------
   620 //
   415 //
   621 TInt CApSettingsHandlerImpl::DoRunSettingsL( TUint32 aHighLight,
   416 TInt CApSettingsHandlerImpl::DoRunSettingsL( TUint32 aHighLight,
   622                                          TUint32& aSelected )
   417                                          TUint32& aSelected )
   623     {
   418     {
   624     APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunSettingsL")
       
   625     
       
   626     __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) );
       
   627 
       
   628     if ( ( iListType == EApSettingsSelListIsPopUp ) ||
       
   629          ( iListType == EApSettingsSelListIsPopUpWithNone ) )
       
   630         {
       
   631         DoRunSetPageSettingsL( aHighLight, aSelected );
       
   632         }
       
   633     else
       
   634         {
       
   635         DoRunListSettingsL( aHighLight, aSelected );
       
   636         }
       
   637     
       
   638     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunSettingsL")
       
   639     return 0;
   419     return 0;
   640     }
   420     }
   641 
   421 
   642 
   422 
   643 // ---------------------------------------------------------
   423 // ---------------------------------------------------------
   644 // CApSettingsHandlerImpl::RunViewerL
   424 // CApSettingsHandlerImpl::RunViewerL
   645 // ---------------------------------------------------------
   425 // ---------------------------------------------------------
   646 //
   426 //
   647 TInt CApSettingsHandlerImpl::RunViewerL( TUint32 aUid )
   427 TInt CApSettingsHandlerImpl::RunViewerL( TUint32 aUid )
   648     {
   428     {
   649     APSETUILOGGER_ENTERFN( EApImpl,"Impl::RunViewerL")
   429     return 0;
   650     
       
   651     // this function is only called from outside, need to init iEventStore
       
   652     iEventStore = KApUiEventNone;
       
   653 
       
   654 #ifdef __TEST_OOMDEBUG
       
   655     if ( iMemTestOn )
       
   656         {
       
   657         TInt leavecode( KErrNoMemory );
       
   658         TInt ts( GetTestStateL() );
       
   659 
       
   660         TBuf<48> buf;
       
   661         buf.Format( _L("\r\n\t( ts: %d )"), ts );
       
   662         APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
   663 
       
   664         if ( ts == KViewerTest )
       
   665             {
       
   666             TBuf<48> buf;
       
   667             APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KViewerTest memtest") );
       
   668 
       
   669             TUint32 rate( 0 );
       
   670             TUint32 retrycount( KOOMRetryCount );
       
   671             TUint32 retryoffset( KOOMRetryOffset );
       
   672             for (
       
   673                 rate = 1;
       
   674                 ((rate < 50000) && (leavecode == KErrNoMemory))
       
   675                     || retrycount;
       
   676                 rate++
       
   677                 )
       
   678                 {
       
   679                 __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
       
   680                 TRAP( leavecode, DoRunViewerL( aUid ) );
       
   681                 __UHEAP_RESET;
       
   682                 if ( !leavecode )
       
   683                     {
       
   684                     retrycount--;
       
   685                     rate += retryoffset;
       
   686                     }
       
   687                 }
       
   688             User::LeaveIfError( leavecode );
       
   689             buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate );
       
   690             APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
   691             }
       
   692         else
       
   693             {
       
   694             DoRunViewerL( aUid );
       
   695             }
       
   696         }
       
   697     else
       
   698         {
       
   699         DoRunViewerL( aUid );
       
   700         }
       
   701 #else
       
   702     DoRunViewerL( aUid );
       
   703 #endif // __TEST_OOMDEBUG
       
   704 
       
   705     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::RunViewerL")
       
   706     
       
   707     return iEventStore;
       
   708     }
   430     }
   709 
   431 
   710 
   432 
   711 
   433 
   712 // ---------------------------------------------------------
   434 // ---------------------------------------------------------
   713 // CApSettingsHandlerImpl::DoRunViewerL
   435 // CApSettingsHandlerImpl::DoRunViewerL
   714 // ---------------------------------------------------------
   436 // ---------------------------------------------------------
   715 //
   437 //
   716 TInt CApSettingsHandlerImpl::DoRunViewerL( TUint32 aUid )
   438 TInt CApSettingsHandlerImpl::DoRunViewerL( TUint32 aUid )
   717     {
   439     {
   718     APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunViewerL")
   440     return 0;
   719     
       
   720     TInt retval( KErrNone );
       
   721 
       
   722     TBool protSupported = FeatureManager::FeatureSupported( 
       
   723                                            KFeatureIdSettingsProtection );
       
   724 
       
   725 
       
   726     TTransactionResult ownTransaction = iModel->StartTransactionLC
       
   727                                                     (
       
   728                                                     /*aWrite*/EFalse,
       
   729                                                     /*aShowNote*/ETrue,
       
   730                                                     /*aRetry*/ETrue
       
   731                                                     );
       
   732     if ( ownTransaction != EFailedWithLocked )
       
   733         {
       
   734         TBool isinuse = iModel->ApUtils()->IsAPInUseL( aUid );
       
   735         TBool isprotected(EFalse);
       
   736         if ( protSupported )
       
   737             {
       
   738             isprotected = iModel->ApUtils()->IsReadOnlyL( aUid );
       
   739             isprotected |= CApProtHandler::IsTableProtectedL( 
       
   740                                 iModel->Database()->Database() );
       
   741             }
       
   742 
       
   743         TBool isvpn = iModel->VpnEngine()->IsVpnApL( aUid );
       
   744 
       
   745         if ( ownTransaction == EOwnTransaction )
       
   746             {
       
   747             TInt err = iModel->CommitTransaction();
       
   748             User::LeaveIfError( err );
       
   749             CleanupStack::Pop(); // RollbackTransactionOnLeave
       
   750             }
       
   751 
       
   752         if ( isinuse )
       
   753             {
       
   754             // Ap is in use right now, can not edit or delete,
       
   755             // show information note qtn_set_note_iap_in_use
       
   756             ShowNoteL( R_APUI_NOTE_AP_IN_USE_EDIT );
       
   757             }
       
   758         else 
       
   759             {
       
   760             if ( protSupported && isprotected )
       
   761                 {
       
   762                 ShowNoteL( R_APUI_NOTE_PROTECTED_AP_SETT );
       
   763                 }
       
   764             else
       
   765                 { // not in use, not protected, check if it is vpn
       
   766                 if ( isvpn )
       
   767                     {
       
   768                     ShowNoteL( R_APUI_NOTE_VPN_AP_SETT );
       
   769                     }
       
   770                 else
       
   771                     { // may start wondering about editing...
       
   772                     TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aUid );
       
   773 #ifdef __TEST_LAN_BEARER
       
   774                     if ( bearer == EApBearerTypeLAN )
       
   775                         {
       
   776                         User::Leave( KErrNotSupported );
       
   777         //                ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
       
   778                         // Leave needed?
       
   779                         }
       
   780                     else
       
   781                         {
       
   782                         CApSettingsDlg* iMyDialog = 
       
   783                                 CApSettingsDlg::NewL( iIspFilter,
       
   784                                                       iBearerFilter,
       
   785                                                       iExt->iSortType,
       
   786                                                       iEventStore,
       
   787                                                       iReqIpvType
       
   788                                                       );
       
   789 
       
   790                         iMyDialog->SetTextOverrides( iTextOverrides );
       
   791 
       
   792                         retval = iMyDialog->ConstructAndRunLD( 
       
   793                                                 *iModel, *this, aUid );
       
   794                         }
       
   795 #else
       
   796                     if ( bearer == EApBearerTypeLANModem )
       
   797                         {
       
   798                         User::Leave( KErrNotSupported );
       
   799         //                ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
       
   800                         // Leave needed?
       
   801                         }
       
   802                     else
       
   803                         {
       
   804                         CApSettingsDlg* iMyDialog = 
       
   805                                 CApSettingsDlg::NewL( iIspFilter,
       
   806                                                       iBearerFilter,
       
   807                                                       iExt->iSortType,
       
   808                                                       iEventStore,
       
   809                                                       iReqIpvType
       
   810                                                       );
       
   811 
       
   812                         iMyDialog->SetTextOverrides( iTextOverrides );
       
   813 
       
   814                         retval = iMyDialog->ConstructAndRunLD( 
       
   815                                                 *iModel, *this, aUid );
       
   816                         }
       
   817 #endif // __TEST_LAN_BEARER
       
   818                     }
       
   819                 }
       
   820             }
       
   821         }
       
   822     
       
   823     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunViewerL")
       
   824     
       
   825     return retval;
       
   826     }
   441     }
   827 
   442 
   828 
   443 
   829 
   444 
   830 //----------------------------------------------------------
   445 //----------------------------------------------------------
   831 // CApSettingsHandlerImpl::HandleApDeleteCmdL
   446 // CApSettingsHandlerImpl::HandleApDeleteCmdL
   832 //----------------------------------------------------------
   447 //----------------------------------------------------------
   833 //
   448 //
   834 void CApSettingsHandlerImpl::HandleApDeleteCmdL( TUint32 aUid, TBool aIsLast )
   449 void CApSettingsHandlerImpl::HandleApDeleteCmdL( TUint32 aUid, TBool aIsLast )
   835     {
   450     {
   836     APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApDeleteCmdL")
       
   837     
       
   838     // OOD handling. If disk space is low,
       
   839     // we try to get some spare.
       
   840     RFs fs;
       
   841     User::LeaveIfError( fs.Connect() );
       
   842     CleanupClosePushL<RFs>( fs );
       
   843     TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL
       
   844             ( &fs, KEstimatedDeleteFfsOverhead );
       
   845 
       
   846     RSharedDataClient sdClient;
       
   847     if ( diskLow )
       
   848         {
       
   849         User::LeaveIfError( sdClient.Connect() );
       
   850         CleanupClosePushL<RSharedDataClient>( sdClient );
       
   851         sdClient.RequestFreeDiskSpaceLC
       
   852                     ( KEstimatedDeleteFfsOverhead );
       
   853         }
       
   854     
       
   855         // check that the Ap is not used so it can be deleted!!
       
   856     TTransactionResult ownTransaction = iModel->StartTransactionLC(
       
   857                                                 /*aWrite*/EFalse,
       
   858                                                 /*aShowNote*/ETrue,
       
   859                                                 /*aRetry*/ETrue );
       
   860     if ( ownTransaction != EFailedWithLocked )
       
   861         {
       
   862         TBool isinuse = iModel->ApUtils()->IsAPInUseL( aUid );
       
   863         TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aUid );
       
   864 #ifdef __TEST_LAN_BEARER        
       
   865         if ( bearer == EApBearerTypeLAN )
       
   866             {
       
   867             User::Leave( KErrNotSupported );
       
   868             }
       
   869 #endif // __TEST_LAN_BEARER
       
   870         if ( bearer == EApBearerTypeLANModem )
       
   871             {
       
   872             User::Leave( KErrNotSupported );
       
   873             // Leave needed?
       
   874             }
       
   875 
       
   876         TBool protSupported = FeatureManager::FeatureSupported( 
       
   877                                                KFeatureIdSettingsProtection );
       
   878         TBool isprotected(EFalse);
       
   879         if ( protSupported )
       
   880             {
       
   881             isprotected = iModel->ApUtils()->IsReadOnlyL( aUid );
       
   882             }
       
   883 
       
   884         if ( ownTransaction == EOwnTransaction )
       
   885             {
       
   886             TInt err = iModel->CommitTransaction();
       
   887             User::LeaveIfError( err );
       
   888             CleanupStack::Pop(); // RollbackTransactionOnLeave
       
   889             }
       
   890 
       
   891         if ( isinuse )
       
   892             {
       
   893             // Ap is in use right now, can not edit or delete,
       
   894             // show information note qtn_set_note_iap_in_use
       
   895             ShowNoteL( R_APUI_NOTE_AP_IN_USE_DELETE );
       
   896             }
       
   897         else
       
   898             { // not in use, maybe protected?
       
   899             if ( protSupported && isprotected )
       
   900                 {
       
   901                 ShowNoteL( R_APUI_NOTE_PROTECTED_AP );
       
   902                 }
       
   903             else
       
   904                 { // not in use or protected, may start wondering about delete...
       
   905                 // need to check whether it is the last one...
       
   906                 TBool candelete( ETrue );
       
   907                 // Linked to VPN? 
       
   908                 TBool isvpn = iModel->VpnEngine()->IsVpnApL( aUid );
       
   909                 if ( !isvpn )
       
   910                     {
       
   911                     if ( iExt->iVariant & KApUiEditOnlyVPNs )
       
   912                         {
       
   913                         candelete = EFalse;
       
   914                         }
       
   915                     else
       
   916                         {
       
   917                         HBufC* sgd = NULL;
       
   918                         sgd = iModel->GetLinkedVpnAccessPointLC( aUid ); 
       
   919                         if ( sgd )
       
   920                             {// has linked VPN, 
       
   921                             // According to current spec. there should
       
   922                             // be something like linked to VPN, Delete? 
       
   923                             // BUT it causes incomplete access point to exist
       
   924                             // hard to handle, therefore last minute change
       
   925                             // is that it can not be delted.
       
   926                             /*
       
   927                             if ( !AskQueryL( R_APUI_IAP_DEL_IAP_ASSOCIATED, sgd ) )
       
   928                                 {
       
   929                                 candelete = EFalse;
       
   930                                 }
       
   931                             */
       
   932                             ShowNoteL( R_APUI_NOTE_AP_IN_USE_DELETE );
       
   933                             candelete = EFalse;
       
   934                             
       
   935                             CleanupStack::PopAndDestroy( sgd );
       
   936                             }
       
   937                         else
       
   938                             { // simply confirm
       
   939                             candelete = ConfirmDeleteL( aUid, aIsLast );
       
   940                             }
       
   941                         }
       
   942                     }
       
   943                 else
       
   944                     { // simply confirm
       
   945                     candelete = ConfirmDeleteL( aUid, aIsLast );
       
   946                     }
       
   947                 if ( candelete )
       
   948                     { // seems that we can delete it, so let's go on
       
   949                     iModel->RemoveApL( aUid );
       
   950                     iEventStore |= KApUiEventDeleted;
       
   951                     }
       
   952                 }
       
   953             }
       
   954         }
       
   955     
       
   956     if ( diskLow )
       
   957         {
       
   958         // Cancel RequestFreeDiskSpaceLC (by popping off an destroy);
       
   959         // close sdClient.
       
   960         CleanupStack::PopAndDestroy( 2 );
       
   961         }
       
   962     CleanupStack::PopAndDestroy(); // fs, will also close it
       
   963     
       
   964     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApDeleteCmdL")
       
   965     }
   451     }
   966 
   452 
   967 
   453 
   968 //----------------------------------------------------------
   454 //----------------------------------------------------------
   969 // CApSettingsHandlerImpl::HandleApBlankNewL
   455 // CApSettingsHandlerImpl::HandleApBlankNewL
   970 //----------------------------------------------------------
   456 //----------------------------------------------------------
   971 //
   457 //
   972 TUint32 CApSettingsHandlerImpl::HandleApBlankNewL( TInt aBearers, TInt aIsps )
   458 TUint32 CApSettingsHandlerImpl::HandleApBlankNewL( TInt aBearers, TInt aIsps )
   973     {
   459     {
   974     APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApBlankNewL")
   460     return 0;
   975     
       
   976     TUint32 retval( KErrNone );
       
   977 
       
   978 #ifdef __TEST_OOMDEBUG
       
   979     if ( iMemTestOn )
       
   980         {
       
   981         TInt leavecode( KErrNoMemory );
       
   982 
       
   983         TInt ts( GetTestStateL() );
       
   984 
       
   985         if ( ts == KCreateBlankTest )
       
   986             {
       
   987             TBuf<48> buf;
       
   988             APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KCreateBlankTest memtest") );
       
   989 
       
   990             TUint32 rate( 0 );
       
   991             TUint32 retrycount( KOOMRetryCount );
       
   992             TUint32 retryoffset( KOOMRetryOffset );
       
   993             for (
       
   994                 rate = 1;
       
   995                 ((rate < 50000) && (leavecode == KErrNoMemory))
       
   996                     || retrycount;
       
   997                 rate++
       
   998                 )
       
   999                 {
       
  1000                 __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
       
  1001                 TRAP( leavecode,
       
  1002                       retval = DoHandleApBlankNewL( aBearers, aIsps ) );
       
  1003                 __UHEAP_RESET;
       
  1004                 if ( !leavecode )
       
  1005                     {
       
  1006                     retrycount--;
       
  1007                     rate += retryoffset;
       
  1008                     }
       
  1009                 }
       
  1010             User::LeaveIfError( leavecode );
       
  1011             buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate );
       
  1012             APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
  1013             }
       
  1014         else
       
  1015             {
       
  1016             retval = DoHandleApBlankNewL( aBearers, aIsps );
       
  1017             }
       
  1018         }
       
  1019     else
       
  1020         {
       
  1021         retval = DoHandleApBlankNewL( aBearers, aIsps );
       
  1022         }
       
  1023 #else
       
  1024     retval = DoHandleApBlankNewL( aBearers, aIsps );
       
  1025 #endif // __TEST_OOMDEBUG
       
  1026 
       
  1027     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApBlankNewL")
       
  1028     return retval;
       
  1029     }
   461     }
  1030 
   462 
  1031 
   463 
  1032 
   464 
  1033 
   465 
  1035 // CApSettingsHandlerImpl::HandleApUseOldNewL
   467 // CApSettingsHandlerImpl::HandleApUseOldNewL
  1036 //----------------------------------------------------------
   468 //----------------------------------------------------------
  1037 //
   469 //
  1038 TUint32 CApSettingsHandlerImpl::HandleApUseOldNewL()
   470 TUint32 CApSettingsHandlerImpl::HandleApUseOldNewL()
  1039     {
   471     {
  1040     APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApUseOldNewL")
   472     return 0;
  1041     
       
  1042     TUint32 retval = KErrNone;
       
  1043 
       
  1044 #ifdef __TEST_OOMDEBUG
       
  1045     if ( iMemTestOn )
       
  1046         {
       
  1047         TInt leavecode( KErrNoMemory );
       
  1048         TInt ts( GetTestStateL() );
       
  1049 
       
  1050         TBuf<48> buf;
       
  1051         buf.Format( _L("\r\n\t( ts: %d )"), ts );
       
  1052         APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
  1053 
       
  1054         if ( ts == KQueryTest )
       
  1055             {
       
  1056             TBuf<48> buf;
       
  1057             APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KQueryTest memtest") );
       
  1058             TUint32 rate( 0 );
       
  1059             TUint32 retrycount( KOOMRetryCount );
       
  1060             TUint32 retryoffset( KOOMRetryOffset );
       
  1061             for (
       
  1062                 rate = 1;
       
  1063                 ((rate < 50000) && (leavecode == KErrNoMemory))
       
  1064                     || retrycount;
       
  1065                 rate++
       
  1066                 )
       
  1067                 {
       
  1068                 __UHEAP_MARK;
       
  1069                 __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
       
  1070                 TRAP( leavecode, retval = SelectApToCopyL() );
       
  1071                 __UHEAP_RESET;
       
  1072                 __UHEAP_MARKEND;
       
  1073                 if ( !leavecode )
       
  1074                     {
       
  1075                     retrycount--;
       
  1076                     rate += retryoffset;
       
  1077                     }
       
  1078                 }
       
  1079             User::LeaveIfError( leavecode );
       
  1080             buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate );
       
  1081             APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
  1082             }
       
  1083         else
       
  1084             {
       
  1085             retval = SelectApToCopyL();
       
  1086             }
       
  1087         }
       
  1088     else
       
  1089         {
       
  1090         retval = SelectApToCopyL();
       
  1091         }
       
  1092 #else
       
  1093     retval = SelectApToCopyL();
       
  1094 #endif // __TEST_OOMDEBUG
       
  1095 
       
  1096     if ( retval != (TUint32)KErrNone )
       
  1097         { // so user had chosen something
       
  1098 #ifdef __TEST_OOMDEBUG
       
  1099         if ( iMemTestOn )
       
  1100             {
       
  1101             TInt leavecode( KErrNoMemory );
       
  1102             TInt ts( GetTestStateL() );
       
  1103             if ( ts == KCreateUseExistTest )
       
  1104                 {
       
  1105                 TBuf<48> buf;
       
  1106                 APSETUILOGGER_WRITE_BUF
       
  1107                     ( _L("Starting KCreateUseExistTest memtest") );
       
  1108                 TUint32 rate( 0 );
       
  1109                 TUint32 retrycount( KOOMRetryCount );
       
  1110                 TUint32 retryoffset( KOOMRetryOffset );
       
  1111                 for (
       
  1112                     rate = 1;
       
  1113                     ((rate < 50000) && (leavecode == KErrNoMemory))
       
  1114                         || retrycount;
       
  1115                     rate++
       
  1116                     )
       
  1117                     {
       
  1118                     __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
       
  1119                     TRAP( leavecode, retval = DoHandleApUseOldNewL( retval ) );
       
  1120                     __UHEAP_RESET;
       
  1121                     if ( !leavecode )
       
  1122                         {
       
  1123                         retrycount--;
       
  1124                         rate += retryoffset;
       
  1125                         }
       
  1126                     }
       
  1127                 User::LeaveIfError( leavecode );
       
  1128                 buf.Format( _L("\t Memtest finished, max. rate was: %d )"),
       
  1129                             rate );
       
  1130                 APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
  1131                 }
       
  1132             else
       
  1133                 {
       
  1134                 retval = DoHandleApUseOldNewL( retval );
       
  1135                 }
       
  1136             }
       
  1137         else
       
  1138             {
       
  1139             retval = DoHandleApUseOldNewL( retval );
       
  1140             }
       
  1141 #else
       
  1142         retval = DoHandleApUseOldNewL( retval );
       
  1143 #endif // __TEST_OOMDEBUG
       
  1144         }
       
  1145     
       
  1146     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApUseOldNewL")
       
  1147     
       
  1148     return retval;
       
  1149     }
   473     }
  1150 
   474 
  1151 
   475 
  1152 
   476 
  1153 //----------------------------------------------------------
   477 //----------------------------------------------------------
  1155 //----------------------------------------------------------
   479 //----------------------------------------------------------
  1156 //
   480 //
  1157 TUint32 CApSettingsHandlerImpl::EditAfterCreateL( TUint32 aUid,
   481 TUint32 CApSettingsHandlerImpl::EditAfterCreateL( TUint32 aUid,
  1158                                               CApAccessPointItem* aItem )
   482                                               CApAccessPointItem* aItem )
  1159     {
   483     {
  1160     APSETUILOGGER_ENTERFN( EApImpl,"Impl::EditAfterCreateL")
   484     return 0;
  1161     
       
  1162     CApSettingsDlg* iMySetDialog = CApSettingsDlg::NewL
       
  1163                                                     (
       
  1164                                                     KEApIspTypeAll,
       
  1165                                                     EApBearerTypeAll,
       
  1166                                                     KEApSortNameAscending,
       
  1167                                                     iEventStore,
       
  1168                                                     iReqIpvType
       
  1169                                                     );
       
  1170 
       
  1171     iMySetDialog->SetTextOverrides( iTextOverrides );
       
  1172     iMySetDialog->ConstructAndRunLD( *iModel, *this, aUid, aItem );
       
  1173     
       
  1174     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::EditAfterCreateL")
       
  1175     
       
  1176     return aUid;
       
  1177     }
   485     }
  1178 
   486 
  1179 
   487 
  1180 
   488 
  1181 //----------------------------------------------------------
   489 //----------------------------------------------------------
  1187                                        TInt aBearerFilter,
   495                                        TInt aBearerFilter,
  1188                                        TInt aSortType,
   496                                        TInt aSortType,
  1189                                        TVpnFilterType aVpnFilterType,
   497                                        TVpnFilterType aVpnFilterType,
  1190                                        TBool aIncludeEasyWlan )
   498                                        TBool aIncludeEasyWlan )
  1191     {
   499     {
  1192     APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoConstructL")
       
  1193     
       
  1194     iExt = new ( ELeave )TApSetHandlerImplExtra;
       
  1195     iExt->iResOffset = 0;
       
  1196     iExt->iIsIpv6Supported = EFalse;
       
  1197     iExt->iIsFeatureManagerInitialised = EFalse;
       
  1198     iExt->iExtra = 0;
       
  1199     iExt->iSortType = KEApSortNameAscending;
       
  1200     iExt->iVpnFilterType = aVpnFilterType;
       
  1201     iExt->iVariant = GetVariantL();
       
  1202     iExt->iIncludeEasyWlan = aIncludeEasyWlan;
       
  1203     
       
  1204 #ifdef __TEST_CDMA_WRITE_PROTECT
       
  1205     iExt->iVariant |= KApUiEditOnlyVPNs;
       
  1206 #endif // __TEST_CDMA_WRITE_PROTECT
       
  1207     iIspFilter = KEApIspTypeAll;
       
  1208     iBearerFilter = aBearerFilter;
       
  1209 
       
  1210     // get IPv6 features from feature manager
       
  1211     FeatureManager::InitializeLibL();
       
  1212     iExt->iIsFeatureManagerInitialised = ETrue;
       
  1213 
       
  1214     iExt->iIsIpv6Supported = 
       
  1215             FeatureManager::FeatureSupported( KFeatureIdIPv6 );
       
  1216 #ifdef __TEST_IPV6_SUPPORT    
       
  1217     iExt->iIsIpv6Supported = ETrue;
       
  1218 #endif //  __TEST_IPV6_SUPPORT    
       
  1219 
       
  1220     // we ask IPv6 only if it is asked by client AND supported by the phone
       
  1221     iReqIpvType = iExt->iIsIpv6Supported ? iReqIpvType : EIPv4;
       
  1222 
       
  1223 
       
  1224 #ifdef __TEST_OOMDEBUG
       
  1225     RFs fs;
       
  1226     User::LeaveIfError( fs.Connect() );
       
  1227     CleanupClosePushL<RFs>( fs );
       
  1228     TUint att;
       
  1229     if ( fs.Att( KTestFileName, att ) == KErrNone )
       
  1230         {
       
  1231         iMemTestOn = ETrue;
       
  1232         }
       
  1233     else
       
  1234         {
       
  1235         iMemTestOn = EFalse;
       
  1236         }
       
  1237     CleanupStack::PopAndDestroy(); // fs, will also close it
       
  1238 #endif // __TEST_OOMDEBUG
       
  1239     iTextOverrides = CTextOverrides::NewL();
       
  1240     // No need to PushL( iTextOverrides ), it's pointer is owned
       
  1241     // & will be deleted in destructor, because 'this' is already
       
  1242     // on the CleanupStack...
       
  1243     if ( aDb )
       
  1244         {
       
  1245         iModel = CApSettingsModel::NewL( *aDb, aIspFilter,
       
  1246                                          aBearerFilter, aSortType, 
       
  1247                                          iReqIpvType,
       
  1248                                          iExt->iVpnFilterType,
       
  1249                                          iExt->iVariant,
       
  1250                                          iExt->iIncludeEasyWlan,
       
  1251                                          iNoEdit );
       
  1252         }
       
  1253     else
       
  1254         {
       
  1255         iModel = CApSettingsModel::NewL( aIspFilter, aBearerFilter,
       
  1256                                          aSortType, iReqIpvType,
       
  1257                                          iExt->iVpnFilterType,
       
  1258                                          iExt->iVariant,
       
  1259                                          iExt->iIncludeEasyWlan,
       
  1260                                          iNoEdit );
       
  1261         }
       
  1262     SetFilterL( aIspFilter, aBearerFilter, aSortType );
       
  1263 
       
  1264     // can't use resource here because it has not been added yet....
       
  1265     TFileName resourceFile;
       
  1266     resourceFile.Append( KApSettingsResDriveZ );
       
  1267     resourceFile.Append( KDC_RESOURCE_FILES_DIR );
       
  1268     resourceFile.Append( KApSettingsResFileName );
       
  1269     BaflUtils::NearestLanguageFile( iModel->EikEnv()->FsSession(),
       
  1270                                     resourceFile );
       
  1271     // as we are not an Application having iCoeEnv, we must figure it out,
       
  1272     // no matter what it takes. Also it is getted once per construction...
       
  1273     iExt->iResOffset = iModel->EikEnv()->AddResourceFileL( resourceFile );
       
  1274     
       
  1275     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoConstructL")    
       
  1276     }
   500     }
  1277 
   501 
  1278 
   502 
  1279 
   503 
  1280 
   504 
  1283 //----------------------------------------------------------
   507 //----------------------------------------------------------
  1284 //
   508 //
  1285 void CApSettingsHandlerImpl::DoRunSetPageSettingsL( TUint32 aHighLight,
   509 void CApSettingsHandlerImpl::DoRunSetPageSettingsL( TUint32 aHighLight,
  1286                                                 TUint32& aSelected )
   510                                                 TUint32& aSelected )
  1287     {
   511     {
  1288     APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunSetPageSettingsL")
       
  1289     
       
  1290     TInt aHigh = aHighLight;
       
  1291 
       
  1292     HBufC* titlebuf;
       
  1293 
       
  1294     if ( iTextOverrides->IsTextOverridenL( EPopupPromptText ) )
       
  1295         {
       
  1296         titlebuf = iTextOverrides->TextOverrideL(
       
  1297                                                 EPopupPromptText
       
  1298                                                 ).AllocLC();
       
  1299         }
       
  1300     else
       
  1301         {
       
  1302         titlebuf = iModel->EikEnv()->AllocReadResourceLC
       
  1303                                 (
       
  1304                                 R_APUI_VIEW_DEFAULT_AP
       
  1305                                 );
       
  1306         }
       
  1307     /*
       
  1308     * We need to pass an int& as starting selection to
       
  1309     * CAknRadioButtonSettingPage
       
  1310     * But we use preferred UID & not list-item nuber...
       
  1311     * Also it sets selection in it's ConstructL() but our list is filled
       
  1312     * up dynamically and it must be done after ConstructL()
       
  1313     * (list must be already constructed...)
       
  1314     * Therefore we pass a dummy int& initialized to 0 as
       
  1315     * selecting the 0th element does no harm...
       
  1316     */
       
  1317     TInt Dummy( -1 );
       
  1318     // needs this Dummy array to pass it to CAknSettingPage's constructor...
       
  1319     CDesCArrayFlat* aItemArray = new ( ELeave ) CDesCArrayFlat( 1 );
       
  1320     CleanupStack::PushL( aItemArray );
       
  1321     CApSelPopupList* dlg = CApSelPopupList::NewL
       
  1322                             (
       
  1323                             *iModel,
       
  1324                             *this,
       
  1325                             Dummy,
       
  1326                             aHigh,
       
  1327                             iSelMenuType,
       
  1328                             iIspFilter,
       
  1329                             iBearerFilter,
       
  1330                             iExt->iSortType,
       
  1331                             iEventStore,
       
  1332                             aItemArray,
       
  1333                             iListType == EApSettingsSelListIsPopUpWithNone,
       
  1334                             iReqIpvType,
       
  1335                             iExt->iVpnFilterType,
       
  1336                             iExt->iIncludeEasyWlan,
       
  1337                             iNoEdit
       
  1338                             );
       
  1339     CleanupStack::PushL( dlg );
       
  1340     TPtrC ptr( titlebuf->Des() );
       
  1341     dlg->SetSettingTextL( ptr );
       
  1342     // dlg must be Pop-ed because ExecuteLD starts with PushL()...
       
  1343     CleanupStack::Pop();
       
  1344     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
  1345         {
       
  1346         aSelected = aHigh;
       
  1347         }
       
  1348     CleanupStack::PopAndDestroy( 2 ); // aItemArray, titlebuf
       
  1349     
       
  1350     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunSetPageSettingsL")
       
  1351     }
   512     }
  1352 
   513 
  1353 
   514 
  1354 
   515 
  1355 //----------------------------------------------------------
   516 //----------------------------------------------------------
  1357 //----------------------------------------------------------
   518 //----------------------------------------------------------
  1358 //
   519 //
  1359 void CApSettingsHandlerImpl::DoRunListSettingsL( TUint32 aHighLight,
   520 void CApSettingsHandlerImpl::DoRunListSettingsL( TUint32 aHighLight,
  1360                                              TUint32& aSelected )
   521                                              TUint32& aSelected )
  1361     {
   522     {
  1362     APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunListSettingsL")
       
  1363     
       
  1364     CApSelectorDialog* iMyDialog = CApSelectorDialog::NewL
       
  1365                                             (
       
  1366                                             iListType,
       
  1367                                             iSelMenuType,
       
  1368                                             iIspFilter,
       
  1369                                             iBearerFilter,
       
  1370                                             iExt->iSortType,
       
  1371                                             iEventStore,
       
  1372                                             iNoEdit,
       
  1373                                             iReqIpvType
       
  1374                                             );
       
  1375     iMyDialog->SetTextOverrides( iTextOverrides );
       
  1376 
       
  1377     iMyDialog->ConstructAndRunLD( *iModel, *this, aHighLight, aSelected );
       
  1378     
       
  1379     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunListSettingsL")
       
  1380     }
   523     }
  1381 
   524 
  1382 
   525 
  1383 
   526 
  1384 //----------------------------------------------------------
   527 //----------------------------------------------------------
  1385 // CApSettingsHandlerImpl::DoHandleApUseOldNewL
   528 // CApSettingsHandlerImpl::DoHandleApUseOldNewL
  1386 //----------------------------------------------------------
   529 //----------------------------------------------------------
  1387 //
   530 //
  1388 TUint32 CApSettingsHandlerImpl::DoHandleApUseOldNewL( TUint32 aSelected )
   531 TUint32 CApSettingsHandlerImpl::DoHandleApUseOldNewL( TUint32 aSelected )
  1389     {
   532     {
  1390     APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoHandleApUseOldNewL")
   533     return KErrNotSupported;
  1391     
       
  1392     TInt retval = KErrNone;
       
  1393 
       
  1394     TTransactionResult ownTransaction = iModel->StartTransactionLC
       
  1395                                                         ( /*aWrite*/ETrue,
       
  1396                                                         /*aShowNote*/ETrue,
       
  1397                                                         /*aRetry*/ETrue
       
  1398                                                         );
       
  1399     if ( ownTransaction != EFailedWithLocked )
       
  1400         {
       
  1401         // check the original bearer's type
       
  1402         TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aSelected );
       
  1403 #ifdef __TEST_LAN_BEARER        
       
  1404         if ( bearer == EApBearerTypeLAN )
       
  1405             {
       
  1406             User::Leave( KErrNotSupported );
       
  1407 //            ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
       
  1408 //            User::Leave( KLeaveWithoutAlert );
       
  1409             }
       
  1410 #endif // __TEST_LAN_BEARER
       
  1411         if ( bearer == EApBearerTypeLANModem )
       
  1412             {
       
  1413             User::Leave( KErrNotSupported );
       
  1414 //            ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
       
  1415 //            User::Leave( KLeaveWithoutAlert );
       
  1416             }
       
  1417         TBool isprotected( EFalse );
       
  1418 
       
  1419         TBool protSupported = FeatureManager::FeatureSupported( 
       
  1420                                                KFeatureIdSettingsProtection );
       
  1421 
       
  1422         if ( protSupported )
       
  1423             {
       
  1424             isprotected = iModel->ApUtils()->IsReadOnlyL( aSelected );
       
  1425             isprotected |= CApProtHandler::IsTableProtectedL( 
       
  1426                                 iModel->Database()->Database() );
       
  1427             }
       
  1428         if ( isprotected )
       
  1429             {
       
  1430             ShowNoteL( R_APUI_NOTE_PROTECTED_AP_SETT );
       
  1431             }
       
  1432         if ( !isprotected )
       
  1433             {
       
  1434             TUint32 aUid = iModel->DataHandler()->CreateCopyFromL( aSelected );
       
  1435             if ( ownTransaction == EOwnTransaction )
       
  1436                 {
       
  1437                 TInt err = iModel->CommitTransaction();
       
  1438                 User::LeaveIfError( err );
       
  1439                 CleanupStack::Pop(); // RollbackTransactionOnLeave
       
  1440                 }
       
  1441             iEventStore |= KApUiEventCreatedUsedOld;
       
  1442             retval = aUid;
       
  1443             EditAfterCreateL( aUid );
       
  1444             }
       
  1445         else
       
  1446             {
       
  1447             if ( ownTransaction == EOwnTransaction )
       
  1448                 {
       
  1449                 TInt err = iModel->CommitTransaction();
       
  1450                 User::LeaveIfError( err );
       
  1451                 CleanupStack::Pop(); // RollbackTransactionOnLeave
       
  1452                 }
       
  1453             }
       
  1454         }
       
  1455 
       
  1456     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoHandleApUseOldNewL")
       
  1457     return retval;
       
  1458     }
   534     }
  1459 
   535 
  1460 
   536 
  1461 
   537 
  1462 //----------------------------------------------------------
   538 //----------------------------------------------------------
  1463 // CApSettingsHandlerImpl::SelectApToCopyL
   539 // CApSettingsHandlerImpl::SelectApToCopyL
  1464 //----------------------------------------------------------
   540 //----------------------------------------------------------
  1465 //
   541 //
  1466 TUint32 CApSettingsHandlerImpl::SelectApToCopyL()
   542 TUint32 CApSettingsHandlerImpl::SelectApToCopyL()
  1467     {
   543     {
  1468     APSETUILOGGER_ENTERFN( EApImpl,"Impl::SelectApToCopyL")
   544     return KErrNotSupported;
  1469     
       
  1470     // = KErrNone just to suppress compiler warning C4701
       
  1471     TUint32 aSelected = KErrNone;
       
  1472     TUint32 retval = KErrNone;
       
  1473 
       
  1474     CApSelQueryDialog* dlg = new ( ELeave ) CApSelQueryDialog( *iModel,
       
  1475                                                                &aSelected );
       
  1476     TInt iQueryOk = dlg->ExecuteLD( R_LIST_QUERY );
       
  1477     if ( iQueryOk )
       
  1478         {
       
  1479         retval = aSelected;
       
  1480         }
       
  1481     
       
  1482     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SelectApToCopyL")
       
  1483     return retval;
       
  1484     }
   545     }
  1485 
   546 
  1486 
   547 
  1487 
   548 
  1488 
   549 
  1491 // CApSettingsHandlerImpl::DoHandleApBlankNewL
   552 // CApSettingsHandlerImpl::DoHandleApBlankNewL
  1492 //----------------------------------------------------------
   553 //----------------------------------------------------------
  1493 //
   554 //
  1494 TUint32 CApSettingsHandlerImpl::DoHandleApBlankNewL( TInt aBearers, TInt aIsps )
   555 TUint32 CApSettingsHandlerImpl::DoHandleApBlankNewL( TInt aBearers, TInt aIsps )
  1495     {
   556     {
  1496     APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoHandleApBlankNewL")
   557     return 0;
  1497 
       
  1498     CApAccessPointItem* apitem = CApAccessPointItem::NewLC();
       
  1499 /*
       
  1500 KEApIspTypeInternetOnly:
       
  1501     EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS
       
  1502 
       
  1503 KEApIspTypeInternetAndWAP
       
  1504     EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS
       
  1505 
       
  1506 KEApIspTypeWAPOnly
       
  1507     EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeSMS, EApBearerTypeGPRS
       
  1508 
       
  1509 KEApIspTypeWAPMandatory
       
  1510     EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeSMS, EApBearerTypeGPRS
       
  1511 
       
  1512 KEApIspTypeAll
       
  1513     All
       
  1514 
       
  1515 
       
  1516     EIspTypeInternetOnly,
       
  1517     EIspTypeWAPOnly,
       
  1518     EIspTypeInternetAndWAP
       
  1519 
       
  1520 */
       
  1521     ChooseBearerTypeL( aBearers, *apitem );
       
  1522     
       
  1523     if ( aIsps & KEApIspTypeAll )
       
  1524         {
       
  1525         apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP );
       
  1526         }
       
  1527     else
       
  1528         {
       
  1529         if ( aIsps & KEApIspTypeWAPOnly )
       
  1530             { // EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS,
       
  1531             apitem->WriteUint( EApIspIspType, EIspTypeWAPOnly );
       
  1532             }
       
  1533         else
       
  1534             {
       
  1535             if ( aIsps & 
       
  1536                      ( KEApIspTypeWAPMandatory | KEApIspTypeMMSMandatory ) )
       
  1537                 { // EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS
       
  1538                 apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP );
       
  1539                 }
       
  1540             else
       
  1541                 {
       
  1542                 if ( aIsps & KEApIspTypeInternetAndWAP )
       
  1543                     {
       
  1544                     apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP );
       
  1545                     }
       
  1546                 else
       
  1547                     {
       
  1548                     if ( aIsps & KEApIspTypeInternetOnly )
       
  1549                         {
       
  1550                         apitem->WriteUint( EApIspIspType,
       
  1551                                            EIspTypeInternetOnly );
       
  1552                         }
       
  1553                     else
       
  1554                         {
       
  1555                         __ASSERT_DEBUG( EFalse, Panic( EInvalidIspRequest ) );
       
  1556                         }
       
  1557                     }
       
  1558                 }
       
  1559             }
       
  1560         }
       
  1561 /*
       
  1562 KEApIspTypeInternetOnly
       
  1563 KEApIspTypeWAPOnly
       
  1564 KEApIspTypeInternetAndWAP
       
  1565 KEApIspTypeWAPMandatory
       
  1566 KEApIspTypeAll
       
  1567 */
       
  1568 
       
  1569 //    apitem->WriteUint( EApIspIspType, EIspTypeInternetOnly );
       
  1570 
       
  1571     TUint32 aUid( KApNoneUID );
       
  1572     HBufC* buf = HBufC::NewLC( KApMaxConnNameLength );
       
  1573     TPtr16 ptr( buf->Des() );
       
  1574     apitem->ReadTextL( EApWapAccessPointName, ptr );
       
  1575 
       
  1576     TTransactionResult ownTransaction = iModel->StartTransactionLC(
       
  1577                                                     ETrue, // aWrite
       
  1578                                                     ETrue, // aShowNote
       
  1579                                                     ETrue ); // aRetry
       
  1580     if ( ownTransaction != EFailedWithLocked )
       
  1581         {
       
  1582         if ( iModel->ApUtils()->MakeValidNameL( ptr ) )
       
  1583             {
       
  1584             apitem->SetNamesL( ptr );
       
  1585             }
       
  1586         if ( ownTransaction == EOwnTransaction )
       
  1587             {
       
  1588             TInt err = iModel->CommitTransaction();
       
  1589             User::LeaveIfError( err );
       
  1590             CleanupStack::Pop(); // RollbackTransactionOnLeave
       
  1591             }
       
  1592         }
       
  1593 
       
  1594     aUid = EditAfterCreateL( KApNoneUID, apitem );
       
  1595     CleanupStack::PopAndDestroy( 2 ); // apitem, buf
       
  1596     
       
  1597     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoHandleApBlankNewL")
       
  1598     return aUid;
       
  1599     }
   558     }
  1600 
   559 
  1601 
   560 
  1602 
   561 
  1603 
   562 
  1605 // CApSettingsHandlerImpl::HandleNetworkDeleteCmdL
   564 // CApSettingsHandlerImpl::HandleNetworkDeleteCmdL
  1606 //----------------------------------------------------------
   565 //----------------------------------------------------------
  1607 //
   566 //
  1608 void CApSettingsHandlerImpl::HandleNetworkDeleteCmdL( TUint32 aUid )
   567 void CApSettingsHandlerImpl::HandleNetworkDeleteCmdL( TUint32 aUid )
  1609     {
   568     {
  1610     APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleNetworkDeleteCmdL")
       
  1611     
       
  1612         // check that the Ap is not used so it can be deleted!!
       
  1613     TTransactionResult ownTransaction = iModel->StartTransactionLC(
       
  1614                                                 /*aWrite*/EFalse,
       
  1615                                                 /*aShowNote*/ETrue,
       
  1616                                                 /*aRetry*/ETrue );
       
  1617     if ( ownTransaction != EFailedWithLocked )
       
  1618         {
       
  1619         TBool protSupported = FeatureManager::FeatureSupported( 
       
  1620                                                KFeatureIdSettingsProtection );
       
  1621         if ( protSupported )
       
  1622             {
       
  1623             TBool isprotected = iModel->ApUtils()->IsReadOnlyL( aUid );
       
  1624             if ( isprotected )
       
  1625                 {
       
  1626                 ShowNoteL( R_APUI_NOTE_PROTECTED_AP );
       
  1627                 return;
       
  1628                 }
       
  1629             }
       
  1630         if ( ownTransaction == EOwnTransaction )
       
  1631             {
       
  1632             TInt err = iModel->CommitTransaction();
       
  1633             User::LeaveIfError( err );
       
  1634             CleanupStack::Pop(); // RollbackTransactionOnLeave
       
  1635             }
       
  1636 
       
  1637         // not protected, may start wondering about delete...
       
  1638         // simply confirm
       
  1639 
       
  1640         // OOD handling. If disk space is low,
       
  1641         // we try to get some spare.
       
  1642         RFs fs;
       
  1643         User::LeaveIfError( fs.Connect() );
       
  1644         CleanupClosePushL<RFs>( fs );
       
  1645         TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL
       
  1646                 ( &fs, KEstimatedDeleteFfsOverhead );
       
  1647         RSharedDataClient sdClient;
       
  1648         if ( diskLow )
       
  1649             {
       
  1650             User::LeaveIfError( sdClient.Connect() );
       
  1651             CleanupClosePushL<RSharedDataClient>( sdClient );
       
  1652             sdClient.RequestFreeDiskSpaceLC
       
  1653                         ( KEstimatedDeleteFfsOverhead );
       
  1654             }
       
  1655         // Handle getting the name, showing the query,
       
  1656         // and deleting the network group.
       
  1657         // get the name:
       
  1658         CApNetworkItem* net = CApNetworkItem::NewLC();
       
  1659         iModel->DataHandler()->ReadNetworkL( aUid, *net );
       
  1660         HBufC* buf = net->Name().AllocLC();
       
  1661         if ( AskQueryL( R_APUI_IAP_ARE_YOU_SURE_TO_DEL, buf ) )
       
  1662             {
       
  1663             iModel->DataHandler()->RemoveNetworkL( aUid );
       
  1664             }
       
  1665         CleanupStack::PopAndDestroy( buf ); // buf
       
  1666         CleanupStack::PopAndDestroy( net );
       
  1667         if ( diskLow )
       
  1668             {
       
  1669             // Cancel RequestFreeDiskSpaceLC (by popping off an destroy);
       
  1670             // close scClient.
       
  1671             CleanupStack::PopAndDestroy( 2 );
       
  1672             }
       
  1673         CleanupStack::PopAndDestroy(); // fs, will also close it
       
  1674         }
       
  1675     
       
  1676     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleNetworkDeleteCmdL")
       
  1677     }
   569     }
  1678 
   570 
  1679 
   571 
  1680 
   572 
  1681 //----------------------------------------------------------
   573 //----------------------------------------------------------
  1702 // CApSettingsHandlerImpl::ConfirmDeleteL
   594 // CApSettingsHandlerImpl::ConfirmDeleteL
  1703 //----------------------------------------------------------
   595 //----------------------------------------------------------
  1704 //
   596 //
  1705 TInt CApSettingsHandlerImpl::ConfirmDeleteL( TUint32 aUid, TBool aIsLast )
   597 TInt CApSettingsHandlerImpl::ConfirmDeleteL( TUint32 aUid, TBool aIsLast )
  1706     {
   598     {
  1707     APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConfirmDeleteL")
   599     return 0;
  1708     
       
  1709     TInt retval( 0 );
       
  1710     HBufC* sgd = HBufC::NewLC( KModifiableTextLength );
       
  1711     TPtr ptr( sgd->Des() );
       
  1712 
       
  1713     // OOD handling. If disk space is low,
       
  1714     // we try to get some spare.
       
  1715     RFs fs;
       
  1716     User::LeaveIfError( fs.Connect() );
       
  1717     CleanupClosePushL<RFs>( fs );
       
  1718     TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL
       
  1719             ( &fs, KEstimatedDeleteFfsOverhead );
       
  1720 
       
  1721     RSharedDataClient sdClient;
       
  1722     if ( diskLow )
       
  1723         {
       
  1724         User::LeaveIfError( sdClient.Connect() );
       
  1725         CleanupClosePushL<RSharedDataClient>( sdClient );
       
  1726         sdClient.RequestFreeDiskSpaceLC
       
  1727                     ( KEstimatedDeleteFfsOverhead );
       
  1728         }
       
  1729 
       
  1730     TTransactionResult ownTransaction = iModel->StartTransactionLC
       
  1731                                                (
       
  1732                                                /*aWrite*/ETrue,
       
  1733                                                /*aShowNote*/ETrue,
       
  1734                                                /*aRetry*/ETrue,
       
  1735                                                /*aLFFSChecking*/EFalse
       
  1736                                                );
       
  1737     if ( ownTransaction != EFailedWithLocked )
       
  1738         {
       
  1739         iModel->ApUtils()->NameL( aUid, ptr );
       
  1740         if ( ownTransaction == EOwnTransaction )
       
  1741             {
       
  1742             TInt err = iModel->CommitTransaction();
       
  1743             User::LeaveIfError( err );
       
  1744             CleanupStack::Pop(); // RollbackTransactionOnLeave
       
  1745             }
       
  1746 
       
  1747         if ( aIsLast )
       
  1748             { // we are deleting the last one, needs to confirm
       
  1749             retval = AskQueryL( R_APUI_IAP_DEL_LAST_AP, sgd );
       
  1750             }
       
  1751         else
       
  1752             { // not the last one, simply confirm
       
  1753             // handle exotic language number conversion here
       
  1754             TPtr t(sgd->Des());
       
  1755             AknTextUtils::LanguageSpecificNumberConversion( t );
       
  1756             retval = AskQueryL( R_APUI_IAP_ARE_YOU_SURE_TO_DEL, sgd );
       
  1757             }
       
  1758         }
       
  1759 
       
  1760 
       
  1761     CleanupStack::PopAndDestroy(); // sgd
       
  1762     if ( diskLow )
       
  1763         {
       
  1764         // Cancel RequestFreeDiskSpaceLC (by popping off an destroy);
       
  1765         // close scClient.
       
  1766         CleanupStack::PopAndDestroy( 2 );
       
  1767         }
       
  1768     CleanupStack::PopAndDestroy(); // fs, will also close it
       
  1769     
       
  1770     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConfirmDeleteL")
       
  1771     return retval;
       
  1772     }
   600     }
  1773 
   601 
  1774 
   602 
  1775 
   603 
  1776 
   604 
  1780 //----------------------------------------------------------
   608 //----------------------------------------------------------
  1781 //
   609 //
  1782 void CApSettingsHandlerImpl::HandleRunSettingsL( TUint32 aHighLight, 
   610 void CApSettingsHandlerImpl::HandleRunSettingsL( TUint32 aHighLight, 
  1783                                              TUint32& aSelected )
   611                                              TUint32& aSelected )
  1784     {
   612     {
  1785     APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleRunSettingsL")
       
  1786     
       
  1787     if ( iStartWithSelection == EFalse )
       
  1788         {
       
  1789         RunViewerL( aHighLight );
       
  1790         }
       
  1791     else
       
  1792         {
       
  1793 #ifdef __TEST_OOMDEBUG
       
  1794         if ( iMemTestOn )
       
  1795             {
       
  1796             TInt leavecode( KErrNoMemory );
       
  1797             TInt state( GetTestStateL() );
       
  1798 
       
  1799             if ( ( (
       
  1800                    ( iListType == EApSettingsSelListIsPopUp ) ||
       
  1801                    ( iListType == EApSettingsSelListIsPopUpWithNone ) ) &&
       
  1802                    ( state == KPopupListTest ) )
       
  1803                  ||
       
  1804                  (
       
  1805                  ( iListType == EApSettingsSelListIsListPane ) &&
       
  1806                  ( state == KDialogListTest ) ) )
       
  1807                 {
       
  1808                 TBuf<48> buf;
       
  1809                 if ( state == KDialogListTest )
       
  1810                     {
       
  1811                     APSETUILOGGER_WRITE_BUF( EApImpl, \
       
  1812                         _L("Doing memtest KDialogListTest") );
       
  1813                     }
       
  1814                 if ( state == KPopupListTest )
       
  1815                     {
       
  1816                     APSETUILOGGER_WRITE_BUF( EApImpl, \ 
       
  1817                         _L("Doing memtest KPopupListTest") );
       
  1818                     }
       
  1819                 TUint32 rate( 0 );
       
  1820                 TUint32 retrycount( KOOMRetryCount );
       
  1821                 TUint32 retryoffset( KOOMRetryOffset );
       
  1822                 for (
       
  1823                     rate = 1;
       
  1824                     ((rate < 50000) && (leavecode == KErrNoMemory))
       
  1825                         || retrycount;
       
  1826                     rate++
       
  1827                     )
       
  1828                     {
       
  1829                     __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
       
  1830                     TRAP( leavecode,
       
  1831                           DoRunSettingsL( aHighLight, aSelected ) );
       
  1832                     __UHEAP_RESET;
       
  1833                     if ( !leavecode )
       
  1834                         {
       
  1835                         retrycount--;
       
  1836                         rate += retryoffset;
       
  1837                         }
       
  1838                     }
       
  1839                 User::LeaveIfError( leavecode );
       
  1840                 buf.Format( _L("\t Memtest finished, max. rate was: %d )"), 
       
  1841                            rate );
       
  1842                 APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
  1843                 }
       
  1844             else
       
  1845                 {
       
  1846                 DoRunSettingsL( aHighLight, aSelected );
       
  1847                 }
       
  1848             }
       
  1849         else
       
  1850             {
       
  1851             DoRunSettingsL( aHighLight, aSelected );
       
  1852             }
       
  1853 #else
       
  1854         DoRunSettingsL( aHighLight, aSelected );
       
  1855 #endif // __TEST_OOMDEBUG
       
  1856         }
       
  1857     
       
  1858     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleRunSettingsL")
       
  1859     }
   613     }
  1860 
   614 
  1861 
   615 
  1862 //----------------------------------------------------------
   616 //----------------------------------------------------------
  1863 // CApSettingsHandlerImpl::ChooseBearerTypeL
   617 // CApSettingsHandlerImpl::ChooseBearerTypeL
  1864 //----------------------------------------------------------
   618 //----------------------------------------------------------
  1865 //
   619 //
  1866 void CApSettingsHandlerImpl::ChooseBearerTypeL( TInt aBearers, 
   620 void CApSettingsHandlerImpl::ChooseBearerTypeL( TInt aBearers, 
  1867                                             CApAccessPointItem& aItem )
   621                                             CApAccessPointItem& aItem )
  1868     {
   622     {
  1869     APSETUILOGGER_ENTERFN( EApImpl,"Impl::ChooseBearerTypeL")
       
  1870     
       
  1871     // Check for support in each case!!!!!
       
  1872     TBool gprssupported = ETrue;
       
  1873     TBool csdsupported = ETrue;         // OK
       
  1874     TBool hscsdsupported = ETrue;       // NO WAY TO CHECK IT
       
  1875     TBool wlansupported = ETrue;        // OK
       
  1876     TBool lansupported = ETrue;         // NO WAY TO CHECK IT
       
  1877     TBool lanmodemsupported = ETrue;    // NO WAY TO CHECK IT
       
  1878     TBool cdmasupported = ETrue;        // OK
       
  1879     
       
  1880     if ( iExt->iIsFeatureManagerInitialised )
       
  1881         {
       
  1882         cdmasupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma );
       
  1883         csdsupported = FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport );
       
  1884         wlansupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
       
  1885         }
       
  1886 
       
  1887     if ( ( ( aBearers & EApBearerTypeAll ) || 
       
  1888         ( aBearers & EApBearerTypeGPRS ) ) &&
       
  1889         gprssupported )
       
  1890         {
       
  1891         aItem.SetBearerTypeL( EApBearerTypeGPRS );
       
  1892         }
       
  1893     else
       
  1894         {
       
  1895         if ( ( ( aBearers & EApBearerTypeAll ) || 
       
  1896             ( aBearers & EApBearerTypeHSCSD ) ) 
       
  1897             && hscsdsupported ) 
       
  1898             {
       
  1899             aItem.SetBearerTypeL( EApBearerTypeHSCSD );
       
  1900             }
       
  1901         else
       
  1902             {
       
  1903             if ( ( ( aBearers & EApBearerTypeAll ) || 
       
  1904                 (aBearers & EApBearerTypeCSD ) ) && csdsupported )
       
  1905                 {
       
  1906                 aItem.SetBearerTypeL( EApBearerTypeCSD );
       
  1907                 }
       
  1908             else
       
  1909                 {
       
  1910                 if ( ( ( aBearers & EApBearerTypeAll ) || 
       
  1911                     ( aBearers & EApBearerTypeWLAN ) ) 
       
  1912                     && wlansupported )
       
  1913                     {
       
  1914                     aItem.SetBearerTypeL( EApBearerTypeWLAN );
       
  1915                     }
       
  1916                 else
       
  1917                     {
       
  1918                     if ( ( ( aBearers & EApBearerTypeAll ) || 
       
  1919                         ( aBearers & EApBearerTypeLAN ) ) 
       
  1920                         && lansupported )
       
  1921                         {
       
  1922                         aItem.SetBearerTypeL( EApBearerTypeLAN );
       
  1923                         }
       
  1924                     else
       
  1925                         {
       
  1926                         if ( ( ( aBearers & EApBearerTypeAll ) || 
       
  1927                             ( aBearers & EApBearerTypeLANModem ) )
       
  1928                             && lanmodemsupported )
       
  1929                             {
       
  1930                             aItem.SetBearerTypeL( EApBearerTypeLANModem );
       
  1931                             }
       
  1932                         else
       
  1933                             {
       
  1934                             if ( ( ( aBearers & EApBearerTypeAll ) || 
       
  1935                                 ( aBearers & EApBearerTypeCDMA ) )
       
  1936                                 && cdmasupported )
       
  1937                                 {
       
  1938                                 aItem.SetBearerTypeL( EApBearerTypeCDMA );
       
  1939                                 }
       
  1940                             else
       
  1941                                 {
       
  1942                                 User::Leave( KErrInvalidBearerType );
       
  1943                                 }
       
  1944                             }
       
  1945                         }
       
  1946                     }
       
  1947                 }
       
  1948             }
       
  1949         }    
       
  1950     
       
  1951     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ChooseBearerTypeL")
       
  1952     }
   623     }
  1953 
   624 
  1954 
   625 
  1955 
   626 
  1956 
   627 
  1958 // CApSettingsHandlerImpl::HandleDuplicateL
   629 // CApSettingsHandlerImpl::HandleDuplicateL
  1959 //----------------------------------------------------------
   630 //----------------------------------------------------------
  1960 //
   631 //
  1961 TUint32 CApSettingsHandlerImpl::HandleDuplicateL( TUint32 aUid )
   632 TUint32 CApSettingsHandlerImpl::HandleDuplicateL( TUint32 aUid )
  1962     {
   633     {
  1963     APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleDuplicateL")
   634     return KErrNotSupported;
  1964     
       
  1965     TUint32 retval(KErrNone);
       
  1966     // so user had chosen something
       
  1967 #ifdef __TEST_OOMDEBUG
       
  1968     if ( iMemTestOn )
       
  1969         {
       
  1970         TInt leavecode( KErrNoMemory );
       
  1971         TInt ts( GetTestStateL() );
       
  1972         if ( ts == KCreateUseExistTest )
       
  1973             {
       
  1974             TBuf<48> buf;
       
  1975             APSETUILOGGER_WRITE_BUF
       
  1976                 ( _L("Starting KCreateUseExistTest memtest") );
       
  1977             TUint32 rate( 0 );
       
  1978             TUint32 retrycount( KOOMRetryCount );
       
  1979             TUint32 retryoffset( KOOMRetryOffset );
       
  1980             for (
       
  1981                 rate = 1;
       
  1982                 ((rate < 50000) && (leavecode == KErrNoMemory))
       
  1983                     || retrycount;
       
  1984                 rate++
       
  1985                 )
       
  1986                 {
       
  1987                 __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
       
  1988                 TRAP( leavecode, retval = DoHandleApUseOldNewL( aUid ) );
       
  1989                 __UHEAP_RESET;
       
  1990                 if ( !leavecode )
       
  1991                     {
       
  1992                     retrycount--;
       
  1993                     rate += retryoffset;
       
  1994                     }
       
  1995                 }
       
  1996             User::LeaveIfError( leavecode );
       
  1997             buf.Format( _L("\t Memtest finished, max. rate was: %d )"),
       
  1998                         rate );
       
  1999             APSETUILOGGER_WRITE_BUF( EApImpl, buf );
       
  2000             }
       
  2001         else
       
  2002             {
       
  2003             retval = DoHandleApUseOldNewL( aUid );
       
  2004             }
       
  2005         }
       
  2006     else
       
  2007         {
       
  2008         retval = DoHandleApUseOldNewL( aUid );
       
  2009         }
       
  2010 #else
       
  2011         retval = DoHandleApUseOldNewL( aUid );
       
  2012 #endif // __TEST_OOMDEBUG
       
  2013     
       
  2014     APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleDuplicateL")
       
  2015     return retval;
       
  2016     }
   635     }
  2017 
   636 
  2018 
   637 
  2019 // End of File
   638 // End of File
  2020 
   639