apengine/apsettingshandlerui/src/ApSelPopupList.cpp
changeset 66 ed07dcc72692
parent 47 cb7afde124a3
equal deleted inserted replaced
64:84c6623982f6 66:ed07dcc72692
    63                                        TBool aNoEdit,
    63                                        TBool aNoEdit,
    64                                        TInt aReqIpvType,
    64                                        TInt aReqIpvType,
    65                                        TVpnFilterType aVpnFilterType
    65                                        TVpnFilterType aVpnFilterType
    66                                        )
    66                                        )
    67     {
    67     {
    68     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::NewL")
    68     return NULL;
    69     CApSelPopupList* self = 
       
    70         new ( ELeave ) CApSelPopupList( aModel, aHandler,
       
    71                                         aCurrentSelectionIndex,
       
    72                                         aPreferredUid, aSelMenuType,
       
    73                                         aIspFilter, aBearerFilter,
       
    74                                         aSortType, aItemArray,
       
    75                                         aEventStore, aNeedsNone,
       
    76                                         aNoEdit,
       
    77                                         aReqIpvType,
       
    78                                         aVpnFilterType
       
    79                                         );
       
    80 //  till that point, object is only partially constructed!
       
    81     
       
    82     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::NewL")
       
    83     return self;
       
    84     }
    69     }
    85 
    70 
    86 
    71 
    87 
    72 
    88 
    73 
   104                                        TVpnFilterType aVpnFilterType,
    89                                        TVpnFilterType aVpnFilterType,
   105                                        TBool aIncludeEasyWlan,
    90                                        TBool aIncludeEasyWlan,
   106                                        TBool aNoEdit
    91                                        TBool aNoEdit
   107                                        )
    92                                        )
   108     {
    93     {
   109     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::NewL2")
    94     return NULL;
   110     
       
   111     CApSelPopupList* self = 
       
   112         new ( ELeave ) CApSelPopupList( aModel, aHandler,
       
   113                                         aCurrentSelectionIndex,
       
   114                                         aPreferredUid, aSelMenuType,
       
   115                                         aIspFilter, aBearerFilter,
       
   116                                         aSortType, aItemArray,
       
   117                                         aEventStore, aNeedsNone,
       
   118                                         aReqIpvType,
       
   119                                         aVpnFilterType,
       
   120                                         aIncludeEasyWlan,
       
   121                                         aNoEdit
       
   122                                         );
       
   123 //  till that point, object is only partially constructed!
       
   124     
       
   125     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::NewL2")
       
   126     return self;
       
   127     }
    95     }
   128     
    96     
   129     
    97     
   130 
    98 
   131 // ---------------------------------------------------------
    99 // ---------------------------------------------------------
   132 // CApSelPopupList::ConstructL
   100 // CApSelPopupList::ConstructL
   133 // ---------------------------------------------------------
   101 // ---------------------------------------------------------
   134 //
   102 //
   135 void CApSelPopupList::ConstructL()
   103 void CApSelPopupList::ConstructL()
   136     {
   104     {
   137     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ConstructL")
       
   138 
       
   139     FeatureManager::InitializeLibL();
       
   140     iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
       
   141     iProtectionSupported = FeatureManager::FeatureSupported( 
       
   142                                            KFeatureIdSettingsProtection );
       
   143     FeatureManager::UnInitializeLib();
       
   144     
       
   145     CAknRadioButtonSettingPage::ConstructL();
       
   146     iList = ListBoxControl();
       
   147     iModel = new( ELeave )CApSelectorListboxModel(
       
   148                           CApSelectorListboxModel::EGraphicOnOff );
       
   149     iList->Model()->SetItemTextArray( iModel );
       
   150     if ( iProtectionSupported )
       
   151         {
       
   152         TInt offset = LoadIconsL();
       
   153         iModel->SetOwnIconOffset( offset );
       
   154         }
       
   155     FillListBoxWithDataL();
       
   156     iDataModel->Database()->AddObserverL( this );
       
   157         
       
   158     if ( !iModel->Count() )
       
   159         {
       
   160         // no ap defined, ask query if editable,
       
   161         // show note if not
       
   162         if ( iNoEdit )
       
   163             {
       
   164             // show note first, 
       
   165             ShowNoteL( R_APUI_VIEW_NO_IAP_DEFINED_INFO );
       
   166             // then simply go back:
       
   167             iDoExit = ETrue;
       
   168             }
       
   169         else
       
   170             {
       
   171             if ( !AskQueryL( R_APUI_IAP_CREATE_NEW ) )
       
   172                 { // do not create, simply go back
       
   173                 iDoExit = ETrue;
       
   174                 }
       
   175             else
       
   176                 { // create new AP
       
   177                 // just ket it pass, later in it will be handled in CheckIfEmptyL()
       
   178                 }                        
       
   179             }
       
   180         }    
       
   181     
       
   182     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ConstructL")
       
   183     }
   105     }
   184 
   106 
   185 
   107 
   186 
   108 
   187 // Destructor
   109 // Destructor
   188 CApSelPopupList::~CApSelPopupList()
   110 CApSelPopupList::~CApSelPopupList()
   189     {
   111     {
   190     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::~CApSelPopupList")
       
   191     
       
   192     if ( iDataModel )
       
   193         {
       
   194         if ( iDataModel->Database() )
       
   195             {
       
   196             // must remove observer here as there is a chance that we do not exit
       
   197             // through the standard way but through Leave(KErrLeaveWithoutAlert)...
       
   198             iDataModel->Database()->RemoveObserver( this );
       
   199             }
       
   200         }
       
   201 
       
   202     if ( iModel )
       
   203         {
       
   204         iModel->ResetAndDestroy();
       
   205         delete iModel;
       
   206         }
       
   207     
       
   208     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::~CApSelPopupList")
       
   209     }
   112     }
   210 
   113 
   211 
   114 
   212 
   115 
   213 // Constructor
   116 // Constructor
   290 // called when needs to change the highlighting
   193 // called when needs to change the highlighting
   291 // ---------------------------------------------------------
   194 // ---------------------------------------------------------
   292 //
   195 //
   293 void CApSelPopupList::SetHighlighted()
   196 void CApSelPopupList::SetHighlighted()
   294     {
   197     {
   295     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SetHighlighted")
       
   296     
       
   297     TInt err( KErrNone );
       
   298     TInt idx = iModel->Item4Uid( iPreferredUid, err );
       
   299     
       
   300     // if UID exists, set as current, else set 0 as current.
       
   301     iList->SetCurrentItemIndexAndDraw( err == KErrNone ? idx : 0);
       
   302     
       
   303     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SetHighlighted")
       
   304     }
   198     }
   305 
   199 
   306 
   200 
   307 // ---------------------------------------------------------
   201 // ---------------------------------------------------------
   308 // CApSelPopupList::GetHelpContext()
   202 // CApSelPopupList::GetHelpContext()
   309 // ---------------------------------------------------------
   203 // ---------------------------------------------------------
   310 //
   204 //
   311 void CApSelPopupList::GetHelpContext(TCoeHelpContext& aContext) const
   205 void CApSelPopupList::GetHelpContext(TCoeHelpContext& aContext) const
   312     {
   206     {
   313     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::GetHelpContext")
       
   314     
       
   315     aContext.iMajor = iHandler->iHelpMajor;
       
   316     
       
   317     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::GetHelpContext")
       
   318     }
   207     }
   319 
   208 
   320 
   209 
   321 // ---------------------------------------------------------
   210 // ---------------------------------------------------------
   322 // CApSelPopupList::HandleApDbEventL
   211 // CApSelPopupList::HandleApDbEventL
   323 // called by the active access point framework
   212 // called by the active access point framework
   324 // ---------------------------------------------------------
   213 // ---------------------------------------------------------
   325 //
   214 //
   326 void CApSelPopupList::HandleApDbEventL( TEvent anEvent )
   215 void CApSelPopupList::HandleApDbEventL( TEvent anEvent )
   327     {
   216     {
   328     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleApDbEventL")
       
   329     
       
   330     switch ( anEvent )
       
   331         {
       
   332         case EDbChanged:
       
   333             {
       
   334             FillListBoxWithDataL();
       
   335             break;
       
   336             }
       
   337         case EDbClosing:
       
   338             {
       
   339             break;
       
   340             }
       
   341         case EDbAvailable:
       
   342             {
       
   343             if ( iNeedUnlock )
       
   344                 {
       
   345                 FillListBoxWithDataL();
       
   346                 }
       
   347             break;
       
   348             }
       
   349         default:
       
   350             {
       
   351             __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
       
   352             break;
       
   353             }
       
   354         }
       
   355     
       
   356     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleApDbEventL")
       
   357     }
   217     }
   358 
   218 
   359 
   219 
   360 // ---------------------------------------------------------
   220 // ---------------------------------------------------------
   361 // CApSelPopupList::ActivateL()
   221 // CApSelPopupList::ActivateL()
   363 // used to handle empty list - query
   223 // used to handle empty list - query
   364 // ---------------------------------------------------------
   224 // ---------------------------------------------------------
   365 //
   225 //
   366 void CApSelPopupList::ActivateL()
   226 void CApSelPopupList::ActivateL()
   367     {
   227     {
   368     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ActivateL")
       
   369     
       
   370     CAknRadioButtonSettingPage::ActivateL();
       
   371 
       
   372     if (iDoExit)
       
   373         {
       
   374         User::Leave(KErrNone);
       
   375         return;
       
   376         }
       
   377 
       
   378     // put empty list checking & required actions here.
       
   379     CheckIfEmptyL();
       
   380     
       
   381     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ActivateL")
       
   382     }
   228     }
   383 
   229 
   384 
   230 
   385 
   231 
   386 // ---------------------------------------------------------
   232 // ---------------------------------------------------------
   388 // called after the setting had been changed
   234 // called after the setting had been changed
   389 // ---------------------------------------------------------
   235 // ---------------------------------------------------------
   390 //
   236 //
   391 void CApSelPopupList::SelectCurrentItemL()
   237 void CApSelPopupList::SelectCurrentItemL()
   392     {
   238     {
   393     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SelectCurrentItemL")
       
   394     
       
   395     CAknRadioButtonSettingPage::SelectCurrentItemL();
       
   396     TInt idx = iList->CurrentItemIndex();
       
   397     if ( idx >= 0 )
       
   398         {
       
   399         *iSelected = iModel->At( idx )->Uid();
       
   400         }
       
   401     
       
   402     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SelectCurrentItemL")
       
   403     }
   239     }
   404 
   240 
   405 
   241 
   406 
   242 
   407 // ---------------------------------------------------------
   243 // ---------------------------------------------------------
   409 // called by framework when the OK button is pressed
   245 // called by framework when the OK button is pressed
   410 // ---------------------------------------------------------
   246 // ---------------------------------------------------------
   411 //
   247 //
   412 TBool CApSelPopupList::OkToExitL( TInt aButtonId )
   248 TBool CApSelPopupList::OkToExitL( TInt aButtonId )
   413     {
   249     {
   414     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::OkToExitL")
   250     return EFalse;
   415     
       
   416     // Translate the button presses into commands for the appui & current
       
   417     // view to handle.
       
   418     // This is a very good thing, that aButtonId is a TInt,
       
   419     // but the caller ( CAknSettingPage ) simply uses a TBool.
       
   420     // The value of ETrue means the button usually for Yes, Ok, Options, etc
       
   421     // and EFalse means Back, Cancel, etc.
       
   422     // so we must act according to a boolean value and not
       
   423     // according to the real button id...
       
   424     TBool IsAccepted = aButtonId;
       
   425 
       
   426     if ( IsAccepted )
       
   427         {
       
   428         TInt idx = iList->CurrentItemIndex();
       
   429         if ( idx >= 0 )
       
   430             {
       
   431             *iSelected = iModel->At( idx )->Uid();
       
   432             }
       
   433         }
       
   434     
       
   435     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::OkToExitL")
       
   436     return ETrue;
       
   437     }
   251     }
   438 
   252 
   439 
   253 
   440 
   254 
   441 // ---------------------------------------------------------
   255 // ---------------------------------------------------------
   443 // called when listbox needs to be filled with data
   257 // called when listbox needs to be filled with data
   444 // ---------------------------------------------------------
   258 // ---------------------------------------------------------
   445 //
   259 //
   446 void CApSelPopupList::FillListBoxWithDataL()
   260 void CApSelPopupList::FillListBoxWithDataL()
   447     {
   261     {
   448     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::FillListBoxWithDataL")
       
   449     
       
   450     iPreferredLine = iList->CurrentItemIndex();
       
   451     if ( iPreferredLine < 0 )
       
   452         {
       
   453         iPreferredLine = 0;
       
   454         }
       
   455 
       
   456     TBool isLocked(EFalse);
       
   457     iNeedUnlock = EFalse;
       
   458     iDataModel->AllListItemDataL( isLocked, *iModel, iIspFilter, 
       
   459                                   iBearerFilter, iSortType, iReqIpvType,
       
   460                                   iVpnFilterType, iIncludeEasyWlan );
       
   461     if ( isLocked )
       
   462         {
       
   463         iNeedUnlock = ETrue;
       
   464         }
       
   465 
       
   466     iList->View()->SetDisableRedraw( ETrue );
       
   467 
       
   468     if ( iNeedsNone )
       
   469         {
       
   470         HBufC* buf = iEikonEnv->AllocReadResourceLC( R_APUI_VIEW_AP_NONE );
       
   471         CApListItem* NoneItem = CApListItem::NewLC
       
   472                         (
       
   473                         EIspTypeInternetAndWAP, KApNoneUID,
       
   474                         *buf,
       
   475                         EApBearerTypeHSCSD
       
   476                         );
       
   477         iModel->InsertL( 0, NoneItem );
       
   478         // as InsertL passes ownership of item to array,
       
   479         // remove from cleanupstack
       
   480         CleanupStack::Pop(); // NoneItem, as ownership is passed to array
       
   481         CleanupStack::PopAndDestroy(); // buf, as item has copied it...
       
   482         }
       
   483 
       
   484     iList->HandleItemAdditionL();
       
   485 
       
   486     iList->View()->SetDisableRedraw( EFalse );
       
   487     iList->HandleItemAdditionL();
       
   488 
       
   489     SetSelectedL();
       
   490     iPreferredUid = *iSelected;
       
   491     
       
   492     SetHighlighted();
       
   493 
       
   494     SizeChanged();
       
   495     DrawNow();
       
   496     
       
   497     CheckAndSetDataValidity();
       
   498     UpdateCbaL();
       
   499     
       
   500     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::FillListBoxWithDataL")
       
   501     }
   262     }
   502 
   263 
   503 
   264 
   504 // ---------------------------------------------------------
   265 // ---------------------------------------------------------
   505 // CApSelPopupList::SetSelectedL()
   266 // CApSelPopupList::SetSelectedL()
   506 // ---------------------------------------------------------
   267 // ---------------------------------------------------------
   507 //
   268 //
   508 void CApSelPopupList::SetSelectedL()
   269 void CApSelPopupList::SetSelectedL()
   509     {
   270     {
   510     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SetSelectedL")
       
   511     
       
   512     TInt i( 0 );
       
   513     TInt idx( 0 );//set something that does no harm...
       
   514     TInt count = iModel->Count(); 
       
   515     for( i=0; i<count; i++ )
       
   516         {
       
   517         if ( iModel->At( i )->Uid() == TUint32( *iSelected ) )
       
   518             {
       
   519             idx = i;
       
   520             i = count;
       
   521             }
       
   522         }
       
   523     iList->SetCurrentItemIndexAndDraw( idx );
       
   524     SelectCurrentItemL();
       
   525     
       
   526     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SetSelectedL")
       
   527     }
   271     }
   528 
   272 
   529 
   273 
   530 // ---------------------------------------------------------
   274 // ---------------------------------------------------------
   531 // CApSelPopupList::CheckIfEmptyL()
   275 // CApSelPopupList::CheckIfEmptyL()
   532 // ---------------------------------------------------------
   276 // ---------------------------------------------------------
   533 //
   277 //
   534 void CApSelPopupList::CheckIfEmptyL()
   278 void CApSelPopupList::CheckIfEmptyL()
   535     {
   279     {
   536     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::CheckIfEmptyL")
       
   537     
       
   538     if ( !iModel->Count() )
       
   539         {
       
   540         // no ap defined, create new AP
       
   541         ProcessCommandL( EApSelCmdNewBlank );
       
   542         }
       
   543     iInitialised = ETrue;
       
   544     
       
   545     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::CheckIfEmptyL")
       
   546     }
   280     }
   547 
   281 
   548 
   282 
   549 
   283 
   550 // ---------------------------------------------------------
   284 // ---------------------------------------------------------
   552 // ---------------------------------------------------------
   286 // ---------------------------------------------------------
   553 //
   287 //
   554 void CApSelPopupList::DynInitMenuPaneL( TInt aResourceId,
   288 void CApSelPopupList::DynInitMenuPaneL( TInt aResourceId,
   555                                         CEikMenuPane* aMenuPane )
   289                                         CEikMenuPane* aMenuPane )
   556     {
   290     {
   557     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::DynInitMenuPaneL")
       
   558     
       
   559     CAknSettingPage::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   560 
       
   561     TInt itemCount = iList->Model()->NumberOfItems();
       
   562     TInt idx = iList->CurrentItemIndex();
       
   563     TUint32 itemUid(0);
       
   564     if ( itemCount )
       
   565         {
       
   566         itemUid = iModel->At( idx )->Uid();
       
   567         }
       
   568 
       
   569     if ( iHandler->iModel->Need2DeleteSelect( aResourceId, itemCount ) )
       
   570         {
       
   571         aMenuPane->DeleteMenuItem( EApSelCmdSelect );
       
   572         }
       
   573 
       
   574     if ( iHandler->iModel->Need2DeleteOpen( aResourceId, itemCount, 
       
   575                                             itemUid, iNeedsNone ) )
       
   576         {
       
   577         aMenuPane->DeleteMenuItem( EApSelCmdOpen );
       
   578         }
       
   579     if ( iHandler->iModel->Need2DeleteDeleteL( aResourceId, itemCount, 
       
   580                                               itemUid, iNeedsNone ) )
       
   581         {
       
   582         aMenuPane->DeleteMenuItem( EApSelCmdDelete );
       
   583         }
       
   584 
       
   585     if ( iHandler->iModel->Need2DeleteNewUseExisting( 
       
   586                         aResourceId, itemCount ) )
       
   587         {
       
   588         aMenuPane->DeleteMenuItem( EApSelCmdNewUseExisting );
       
   589         }
       
   590     if ( iHandler->iModel->Need2DeleteNewL( aResourceId ) )
       
   591         {
       
   592         aMenuPane->DeleteMenuItem( EApSelCmdNewBlank );
       
   593         }
       
   594 
       
   595     if ( iHandler->iModel->Need2DeleteHelp( aResourceId ) )
       
   596         {
       
   597         aMenuPane->DeleteMenuItem( EAknCmdHelp );                
       
   598         }
       
   599 
       
   600     if ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL )
       
   601         {
       
   602         if ( iSelMenuType == EApSettingsSelMenuSelectOnly )
       
   603             {
       
   604             // Disallow other menues by deleting them
       
   605             aMenuPane->DeleteMenuItem( EApSelCmdExit );
       
   606             }
       
   607         }
       
   608     
       
   609     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::DynInitMenuPaneL")
       
   610     }
   291     }
   611 
   292 
   612 
   293 
   613 // From MEikCommandObserver
   294 // From MEikCommandObserver
   614 // ---------------------------------------------------------
   295 // ---------------------------------------------------------
   615 // CApSelPopupList::ProcessCommandL
   296 // CApSelPopupList::ProcessCommandL
   616 // ---------------------------------------------------------
   297 // ---------------------------------------------------------
   617 //
   298 //
   618 void CApSelPopupList::ProcessCommandL( TInt aCommandId )
   299 void CApSelPopupList::ProcessCommandL( TInt aCommandId )
   619     {
   300     {
   620     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ProcessCommandL")
       
   621     
       
   622     if ( MenuShowing() )
       
   623         {
       
   624         HideMenu();
       
   625         }
       
   626 
       
   627     switch ( aCommandId )
       
   628         {
       
   629         case EAknSoftkeyOptions:
       
   630             {
       
   631             DisplayMenuL();
       
   632             break;
       
   633             }
       
   634         case EAknSoftkeyBack:
       
   635             {
       
   636             AttemptExitL( EFalse );
       
   637             break;
       
   638             }
       
   639         case EAknSoftkeyCancel:
       
   640             {
       
   641             *iEventStore |= KApUiEventShutDownRequested;
       
   642             AttemptExitL( EFalse );
       
   643             break;
       
   644             }
       
   645         case EAknSoftkeyOk:
       
   646         case EApSelCmdSelect:
       
   647             {
       
   648             *iEventStore |= KApUiEventSelected;
       
   649             
       
   650             TUint32 currUid = iModel->At( iList->CurrentItemIndex() )->Uid();
       
   651             if( iPreferredUid != currUid )
       
   652                 {
       
   653                 iPreferredUid = currUid;
       
   654                 SetHighlighted();
       
   655                 }
       
   656 
       
   657             CAknRadioButtonSettingPage::SelectCurrentItemL();
       
   658             AttemptExitL( ETrue );
       
   659             break;
       
   660             }
       
   661         case EApSelCmdOpen:
       
   662             {// as we must be standing on an item, it must exist...
       
   663             // So no problem on iModel->At( ...)
       
   664             iPreferredUid = iModel->At( iList->CurrentItemIndex() )->Uid();
       
   665             iHandler->DoRunViewerL( iPreferredUid );
       
   666             SetHighlighted();
       
   667             break;
       
   668             }
       
   669         case EApSelCmdNew:
       
   670             {
       
   671             break; // starts a submenu, nothing to do here
       
   672             }
       
   673         case EApSelCmdNewBlank:
       
   674             {
       
   675             iPreferredUid = iHandler->HandleApBlankNewL(
       
   676                                             iBearerFilter, iIspFilter );
       
   677             SetHighlighted();
       
   678             break;
       
   679             }
       
   680         case EApSelCmdNewUseExisting:
       
   681             {
       
   682             TUint32 currid = iModel->At( iList->CurrentItemIndex() )->Uid();
       
   683             iPreferredUid = iHandler->HandleDuplicateL( currid );
       
   684             SetHighlighted();
       
   685             break;
       
   686             }
       
   687         case EApSelCmdDelete:
       
   688             {
       
   689             // As it might have been started by the Clear key,
       
   690             // we must check if there is any...
       
   691             TInt cnt = iModel->Count();
       
   692             if ( ( iNeedsNone & ( cnt > 1 ) ) || ( !iNeedsNone && cnt ) )
       
   693                 {
       
   694                 // as we must be standing on an item, it must exists...
       
   695                 // So no problem on iModel->At( ...)
       
   696                 if ( iList->CurrentItemIndex() < ( iModel->Count()-1 ) )
       
   697                     {// move to next one if possible
       
   698                     iPreferredUid = iModel->At(
       
   699                             iList->CurrentItemIndex()+1 )->Uid();
       
   700                     }
       
   701                 else
       
   702                     { // if it is the last, move to previous if possible.
       
   703                     // if not, set to 0
       
   704                     if ( iModel->Count()> 1 )
       
   705                         {// move to prev. one if possible
       
   706                         iPreferredUid = iModel->At(
       
   707                             iList->CurrentItemIndex()-1 )->Uid();
       
   708                         }
       
   709                     else
       
   710                         {
       
   711                         iPreferredUid = 0;
       
   712                         }
       
   713                     }
       
   714                 iHandler->HandleApDeleteCmdL(
       
   715                             iModel->At( iList->CurrentItemIndex() )->Uid(),
       
   716                             iModel->Count() == (1+iNeedsNone) );
       
   717                 }
       
   718             break;
       
   719             }
       
   720         case EAknCmdHelp:
       
   721             {
       
   722 			if ( iHelpSupported )
       
   723 				{
       
   724             	iDataModel->LaunchHelpL();
       
   725 				}
       
   726             break;
       
   727             }
       
   728         default:
       
   729             {
       
   730             // silently ignore it
       
   731             break;
       
   732             }
       
   733         }
       
   734     // check if user wants to Exit....
       
   735     if ( *iEventStore & KApUiEventExitRequested )
       
   736         {
       
   737         if ( iInitialised )
       
   738             {                        
       
   739             AttemptExitL( EFalse );
       
   740             }
       
   741         else
       
   742             {
       
   743             *iEventStore |= KApUiEventInternal;
       
   744             User::Leave(KLeaveWithoutAlert);
       
   745             }            
       
   746         }
       
   747     else
       
   748         {
       
   749         switch ( aCommandId )
       
   750             {
       
   751             case EApSelCmdExit:
       
   752                 {
       
   753                 *iEventStore |= KApUiEventExitRequested;
       
   754                 AttemptExitL( EFalse );
       
   755                 break;
       
   756                 }
       
   757             case EEikCmdExit:
       
   758                 {
       
   759                 *iEventStore |= KApUiEventShutDownRequested;
       
   760                 AttemptExitL( EFalse );
       
   761                 break;
       
   762                 }
       
   763             default:
       
   764                 {
       
   765                 break;
       
   766                 }
       
   767             }
       
   768         }
       
   769     
       
   770     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ProcessCommandL")
       
   771     }
   301     }
   772 
   302 
   773 
   303 
   774     // From MEikListBoxObserver
   304     // From MEikListBoxObserver
   775 void CApSelPopupList::HandleListBoxEventL( CEikListBox* aListBox,
   305 void CApSelPopupList::HandleListBoxEventL( CEikListBox* aListBox,
   776                         MEikListBoxObserver::TListBoxEvent aEventType )
   306                         MEikListBoxObserver::TListBoxEvent aEventType )
   777     {
   307     {
   778     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleListBoxEventL")
       
   779     
       
   780     switch ( aEventType )
       
   781         {
       
   782         case EEventEnterKeyPressed:
       
   783         case EEventItemDoubleClicked:
       
   784         case EEventItemSingleClicked:
       
   785             {
       
   786             ProcessCommandL( EApSelCmdSelect );
       
   787             break;
       
   788             }
       
   789         case EEventEditingStarted:
       
   790             {
       
   791             break;
       
   792             }
       
   793         case EEventEditingStopped:
       
   794             {
       
   795             break;
       
   796             }
       
   797         default:
       
   798             {
       
   799             CAknRadioButtonSettingPage::HandleListBoxEventL( aListBox, aEventType );
       
   800             };
       
   801         };
       
   802     
       
   803     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleListBoxEventL")
       
   804     }
   308     }
   805 
   309 
   806 
   310 
   807 // From CCoeControl
   311 // From CCoeControl
   808 // ---------------------------------------------------------
   312 // ---------------------------------------------------------
   810 // ---------------------------------------------------------
   314 // ---------------------------------------------------------
   811 //
   315 //
   812 TKeyResponse CApSelPopupList::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   316 TKeyResponse CApSelPopupList::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   813                                               TEventCode aType)
   317                                               TEventCode aType)
   814     {
   318     {
   815     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::OfferKeyEventL")
   319     User::Leave( KErrNotSupported );
   816     
       
   817     TKeyResponse retval;
       
   818     
       
   819     if ( aType == EEventKey )
       
   820         {
       
   821         if ( ( aKeyEvent.iCode == EKeyDelete ) ||
       
   822             ( aKeyEvent.iCode == EKeyBackspace ) )
       
   823             {
       
   824             if (!iNoEdit)
       
   825                 {            
       
   826                 ProcessCommandL( EApSelCmdDelete );
       
   827                 }
       
   828             retval = EKeyWasConsumed;
       
   829             }
       
   830         else
       
   831             {
       
   832             if ( ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) &&
       
   833                 ( ( iSelMenuType == EApSettingsSelMenuSelectOnly ) ||
       
   834                     ( iSelMenuType == EApSettingsSelMenuSelectNormal ) ) )
       
   835                 { // process only if command is available...
       
   836                 ProcessCommandL( EApSelCmdSelect );
       
   837                 retval = EKeyWasConsumed;
       
   838                 }
       
   839             else
       
   840                 {
       
   841                 retval = CAknRadioButtonSettingPage::OfferKeyEventL(
       
   842                                         aKeyEvent, aType );
       
   843                 }
       
   844             }
       
   845         }
       
   846     else
       
   847         {
       
   848         retval = CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
       
   849         }
       
   850         
       
   851     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::OfferKeyEventL")
       
   852     return retval;
       
   853     }
   320     }
   854 
   321 
   855 
   322 
   856 
   323 
   857 
   324 
   859 // CApSelPopupList::LoadIconsL
   326 // CApSelPopupList::LoadIconsL
   860 // ---------------------------------------------------------
   327 // ---------------------------------------------------------
   861 //
   328 //
   862 TInt CApSelPopupList::LoadIconsL()
   329 TInt CApSelPopupList::LoadIconsL()
   863     {
   330     {
   864     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::LoadIconsL")
   331     return 0;
   865     
       
   866     CArrayPtr< CGulIcon >* icons = 
       
   867                         iList->ItemDrawer()->FormattedCellData()->IconArray();
       
   868 
       
   869     TInt count = icons->Count();
       
   870 
       
   871     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
   872 
       
   873     TParse mbmFile;
       
   874     User::LeaveIfError( mbmFile.Set( KFileIcons, &KDC_APP_BITMAP_DIR, NULL ) );
       
   875 
       
   876     icons->AppendL( AknsUtils::CreateGulIconL( 
       
   877                             skinInstance, 
       
   878                             KAknsIIDQgnPropWmlGprs,
       
   879                             mbmFile.FullName(), 
       
   880                             EMbmApsettingsQgn_prop_wml_gprs, 
       
   881                             EMbmApsettingsQgn_prop_wml_gprs_mask ) );
       
   882 
       
   883     icons->AppendL( AknsUtils::CreateGulIconL( 
       
   884                             skinInstance, 
       
   885                             KAknsIIDQgnPropWmlCsd,
       
   886                             mbmFile.FullName(), 
       
   887                             EMbmApsettingsQgn_prop_wml_csd, 
       
   888                             EMbmApsettingsQgn_prop_wml_csd_mask ) );
       
   889 
       
   890     icons->AppendL( AknsUtils::CreateGulIconL( 
       
   891                             skinInstance, 
       
   892                             KAknsIIDQgnPropWmlHscsd,
       
   893                             mbmFile.FullName(), 
       
   894                             EMbmApsettingsQgn_prop_wml_hscsd, 
       
   895                             EMbmApsettingsQgn_prop_wml_hscsd_mask ) );
       
   896 
       
   897     icons->AppendL( AknsUtils::CreateGulIconL( 
       
   898                             skinInstance, 
       
   899                             KAknsIIDQgnPropWmlSms,
       
   900                             mbmFile.FullName(), 
       
   901                             EMbmApsettingsQgn_prop_wml_sms, 
       
   902                             EMbmApsettingsQgn_prop_wml_sms_mask ) );
       
   903 
       
   904     icons->AppendL( AknsUtils::CreateGulIconL( 
       
   905                             skinInstance, 
       
   906                             KAknsIIDQgnPropWlanBearer,
       
   907                             mbmFile.FullName(), 
       
   908                             EMbmApsettingsQgn_prop_wlan_bearer, 
       
   909                             EMbmApsettingsQgn_prop_wlan_bearer_mask ) );
       
   910 
       
   911     icons->AppendL( AknsUtils::CreateGulIconL( 
       
   912                             skinInstance, 
       
   913                             KAknsIIDQgnPropWlanBearer,
       
   914                             mbmFile.FullName(), 
       
   915                             EMbmApsettingsQgn_prop_wlan_easy, 
       
   916                             EMbmApsettingsQgn_prop_wlan_easy_mask ) );
       
   917 
       
   918     icons->AppendL( AknsUtils::CreateGulIconL( 
       
   919                             skinInstance, 
       
   920                             KAknsIIDQgnIndiSettProtectedAdd,
       
   921                             mbmFile.FullName(), 
       
   922                             EMbmApsettingsQgn_indi_sett_protected_add, 
       
   923                             EMbmApsettingsQgn_indi_sett_protected_add_mask ) );
       
   924 
       
   925     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::LoadIconsL")
       
   926     return count;
       
   927     }
   332     }
   928 
   333 
   929 
   334 
   930 
   335 
   931 
   336 
   933 // CApSelPopupList::HandleResourceChange
   338 // CApSelPopupList::HandleResourceChange
   934 // ---------------------------------------------------------
   339 // ---------------------------------------------------------
   935 //
   340 //
   936 void CApSelPopupList::HandleResourceChange(TInt aType)
   341 void CApSelPopupList::HandleResourceChange(TInt aType)
   937     {
   342     {
   938     APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleResourceChange")
       
   939     
       
   940     if ( aType == KAknsMessageSkinChange )
       
   941         {
       
   942         iList->HandleResourceChange( aType );
       
   943         if ( iProtectionSupported )
       
   944             {
       
   945             TRAP_IGNORE( LoadIconsL() );
       
   946             }
       
   947         SizeChanged();
       
   948         }    
       
   949         
       
   950     CAknRadioButtonSettingPage::HandleResourceChange( aType );          
       
   951     
       
   952     APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleResourceChange")
       
   953     }
   343     }
   954 
   344 
   955 // End of File
   345 // End of File