apengine/apsettingshandlerui/src/ApNetSelPopupList.cpp
changeset 66 ed07dcc72692
parent 47 cb7afde124a3
equal deleted inserted replaced
64:84c6623982f6 66:ed07dcc72692
    53                                        TInt& aPreferredUid,
    53                                        TInt& aPreferredUid,
    54                                        TUint32& aEventStore,
    54                                        TUint32& aEventStore,
    55                                        CDesCArrayFlat* aItemArray,
    55                                        CDesCArrayFlat* aItemArray,
    56                                        TBool aNeedsNone )
    56                                        TBool aNeedsNone )
    57     {
    57     {
    58     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::NewL")
    58     return NULL;
    59     
       
    60     CApNetSelPopupList* self = 
       
    61         new ( ELeave ) CApNetSelPopupList(
       
    62                                          aModel, aHandler,
       
    63                                          aCurrentSelectionIndex,
       
    64                                          aPreferredUid, aItemArray,
       
    65                                          aEventStore, aNeedsNone
       
    66                                          );
       
    67 //  till that point, object is only partially constructed!
       
    68     
       
    69     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::NewL")
       
    70     return self;
       
    71     }
    59     }
    72 
    60 
    73 
    61 
    74 // ---------------------------------------------------------
    62 // ---------------------------------------------------------
    75 // CApNetSelPopupList::ConstructL
    63 // CApNetSelPopupList::ConstructL
    76 // ---------------------------------------------------------
    64 // ---------------------------------------------------------
    77 //
    65 //
    78 void CApNetSelPopupList::ConstructL()
    66 void CApNetSelPopupList::ConstructL()
    79     {
    67     {
    80     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::ConstructL")
       
    81 
       
    82     FeatureManager::InitializeLibL();
       
    83     iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
       
    84     iProtectionSupported = FeatureManager::FeatureSupported( 
       
    85                                            KFeatureIdSettingsProtection );
       
    86     FeatureManager::UnInitializeLib();
       
    87     
       
    88     CAknRadioButtonSettingPage::ConstructL();
       
    89     iList = ListBoxControl();
       
    90     iModel = new( ELeave )CApNetSelectorListboxModel();
       
    91     iList->Model()->SetItemTextArray( iModel );
       
    92     FillListBoxWithDataL();
       
    93     iDataModel->Database()->AddObserverL( this );
       
    94     
       
    95     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::ConstructL")
       
    96     }
    68     }
    97 
    69 
    98 
    70 
    99 // Destructor
    71 // Destructor
   100 CApNetSelPopupList::~CApNetSelPopupList()
    72 CApNetSelPopupList::~CApNetSelPopupList()
   101     {
    73     {
   102     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::~CApNetSelPopupList")
       
   103     
       
   104     if ( iDataModel )
       
   105         {
       
   106         if ( iDataModel->Database() )
       
   107             {
       
   108             // must remove observer here as there is a chance that we do not exit
       
   109             // through the standard way but through Leave(KErrLeaveWithoutAlert)...
       
   110             iDataModel->Database()->RemoveObserver( this );            
       
   111             }
       
   112         }
       
   113     if ( iModel )
       
   114         {
       
   115         iModel->ResetAndDestroy();
       
   116         delete iModel;
       
   117         }
       
   118     
       
   119     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::~CApNetSelPopupList")
       
   120     }
    74     }
   121 
    75 
   122 
    76 
   123 
    77 
   124 // Constructor
    78 // Constructor
   149 // called when needs to change the highlighting
   103 // called when needs to change the highlighting
   150 // ---------------------------------------------------------
   104 // ---------------------------------------------------------
   151 //
   105 //
   152 void CApNetSelPopupList::SetHighlighted()
   106 void CApNetSelPopupList::SetHighlighted()
   153     {
   107     {
   154     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::SetHighlighted")
       
   155     
       
   156     if ( iPreferredUid )
       
   157         {
       
   158         TInt err( KErrNone );
       
   159         TInt idx = iModel->Item4Uid( iPreferredUid, err );
       
   160         // if UID exists, set as current, else set 0 as current.
       
   161         if ( err == KErrNone )
       
   162             {
       
   163             iList->SetCurrentItemIndexAndDraw( idx );
       
   164             iPreferredUid = 0;
       
   165             }
       
   166         else
       
   167             {
       
   168             iList->SetCurrentItemIndexAndDraw( 0 );
       
   169             }
       
   170         }
       
   171     
       
   172     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::SetHighlighted")
       
   173     }
   108     }
   174 
   109 
   175 
   110 
   176 // ---------------------------------------------------------
   111 // ---------------------------------------------------------
   177 // CApNetSelPopupList::GetHelpContext()
   112 // CApNetSelPopupList::GetHelpContext()
   178 // ---------------------------------------------------------
   113 // ---------------------------------------------------------
   179 //
   114 //
   180 void CApNetSelPopupList::GetHelpContext(TCoeHelpContext& aContext) const
   115 void CApNetSelPopupList::GetHelpContext(TCoeHelpContext& aContext) const
   181     {
   116     {
   182     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::GetHelpContext")
       
   183     
       
   184     aContext.iMajor = iHandler->iHelpMajor;
       
   185     
       
   186     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::GetHelpContext")
       
   187     }
   117     }
   188 
   118 
   189 
   119 
   190 // ---------------------------------------------------------
   120 // ---------------------------------------------------------
   191 // CApNetSelPopupList::HandleApDbEventL
   121 // CApNetSelPopupList::HandleApDbEventL
   192 // called by the active access point framework
   122 // called by the active access point framework
   193 // ---------------------------------------------------------
   123 // ---------------------------------------------------------
   194 //
   124 //
   195 void CApNetSelPopupList::HandleApDbEventL( TEvent anEvent )
   125 void CApNetSelPopupList::HandleApDbEventL( TEvent anEvent )
   196     {
   126     {
   197     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::HandleApDbEventL")
       
   198     
       
   199     switch ( anEvent )
       
   200         {
       
   201         case EDbChanged:
       
   202             {
       
   203             FillListBoxWithDataL();
       
   204             break;
       
   205             }
       
   206         case EDbClosing:
       
   207             {
       
   208             break;
       
   209             }
       
   210         case EDbAvailable:
       
   211             {
       
   212             if ( iNeedUnlock )
       
   213                 {
       
   214                 FillListBoxWithDataL();
       
   215                 }
       
   216             break;
       
   217             }
       
   218         default:
       
   219             {
       
   220             __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
       
   221             break;
       
   222             }
       
   223         }
       
   224     
       
   225     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::HandleApDbEventL")
       
   226     }
   127     }
   227 
   128 
   228 
   129 
   229 // ---------------------------------------------------------
   130 // ---------------------------------------------------------
   230 // CApNetSelPopupList::ActivateL()
   131 // CApNetSelPopupList::ActivateL()
   232 // used to handle empty list - query
   133 // used to handle empty list - query
   233 // ---------------------------------------------------------
   134 // ---------------------------------------------------------
   234 //
   135 //
   235 void CApNetSelPopupList::ActivateL()
   136 void CApNetSelPopupList::ActivateL()
   236     {
   137     {
   237     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::ActivateL")
       
   238     
       
   239     CAknRadioButtonSettingPage::ActivateL();
       
   240     
       
   241     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::ActivateL")
       
   242     }
   138     }
   243 
   139 
   244 
   140 
   245 
   141 
   246 // ---------------------------------------------------------
   142 // ---------------------------------------------------------
   248 // called after the setting had been changed
   144 // called after the setting had been changed
   249 // ---------------------------------------------------------
   145 // ---------------------------------------------------------
   250 //
   146 //
   251 void CApNetSelPopupList::SelectCurrentItemL()
   147 void CApNetSelPopupList::SelectCurrentItemL()
   252     {
   148     {
   253     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::SelectCurrentItemL")
       
   254     
       
   255     CAknRadioButtonSettingPage::SelectCurrentItemL();
       
   256     TInt idx = iList->CurrentItemIndex();
       
   257     if ( idx >= 0 )
       
   258         {
       
   259         *iSelected = iModel->At( idx )->Uid();
       
   260         }
       
   261     
       
   262     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::SelectCurrentItemL")
       
   263     }
   149     }
   264 
   150 
   265 
   151 
   266 
   152 
   267 // ---------------------------------------------------------
   153 // ---------------------------------------------------------
   269 // called by framework when the OK button is pressed
   155 // called by framework when the OK button is pressed
   270 // ---------------------------------------------------------
   156 // ---------------------------------------------------------
   271 //
   157 //
   272 TBool CApNetSelPopupList::OkToExitL( TInt aButtonId )
   158 TBool CApNetSelPopupList::OkToExitL( TInt aButtonId )
   273     {
   159     {
   274     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::OkToExitL")
   160     return EFalse;
   275     
       
   276     // Translate the button presses into commands for the appui & current
       
   277     // view to handle.
       
   278     // This is a very good thing, that aButtonId is a TInt,
       
   279     // but the caller ( CAknSettingPage ) simply uses a TBool.
       
   280     // The value of ETrue means the button usually for Yes, Ok, Options, etc
       
   281     // and EFalse means Back, Cancel, etc.
       
   282     // so we must act according to a boolean value and not
       
   283     // according to the real button id...
       
   284     TBool IsAccepted = aButtonId;
       
   285 
       
   286     if ( IsAccepted )
       
   287         {
       
   288         TInt idx = iList->CurrentItemIndex();
       
   289         if ( idx >= 0 )
       
   290             {
       
   291             *iSelected = iModel->At( idx )->Uid();
       
   292             }
       
   293         }
       
   294     
       
   295     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::OkToExitL")
       
   296     return ETrue;
       
   297     }
   161     }
   298 
   162 
   299 
   163 
   300 
   164 
   301 // ---------------------------------------------------------
   165 // ---------------------------------------------------------
   303 // called when listbox needs to be filled with data
   167 // called when listbox needs to be filled with data
   304 // ---------------------------------------------------------
   168 // ---------------------------------------------------------
   305 //
   169 //
   306 void CApNetSelPopupList::FillListBoxWithDataL()
   170 void CApNetSelPopupList::FillListBoxWithDataL()
   307     {
   171     {
   308     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::FillListBoxWithDataL")
       
   309     
       
   310     iPreferredLine = iList->CurrentItemIndex();
       
   311     if ( iPreferredLine < 0 )
       
   312         {
       
   313         iPreferredLine = 0;
       
   314         }
       
   315 
       
   316     if ( !iPreferredUid )
       
   317         { // if not specified explicitly, get current and use as 'preferred'
       
   318         if ( iPreferredLine >= 0 )
       
   319             {
       
   320             if ( iModel->Count() )
       
   321                 {
       
   322                 iPreferredUid = iModel->At( iPreferredLine )->Uid();
       
   323                 }
       
   324             }
       
   325         }
       
   326 
       
   327     TBool isLocked(EFalse);
       
   328     iNeedUnlock = EFalse;
       
   329 
       
   330     iDataModel->NetWorkListDataL( isLocked, *iModel );
       
   331 
       
   332     if ( isLocked )
       
   333         {
       
   334         iNeedUnlock = ETrue;
       
   335         }
       
   336 
       
   337     iList->View()->SetDisableRedraw( ETrue );
       
   338 
       
   339     if ( iNeedsNone )
       
   340         {
       
   341         HBufC* buf = iEikonEnv->AllocReadResourceLC( R_APUI_VIEW_AP_NONE );
       
   342         CApNetworkItem* NoneItem = CApNetworkItem::NewLC();
       
   343         NoneItem->SetUid( KApNoneUID );
       
   344         NoneItem->SetNameL( *buf );
       
   345         iModel->InsertL( 0, NoneItem );
       
   346         // as InsertL passes ownership of item to array,
       
   347         // remove from cleanupstack
       
   348         CleanupStack::Pop(); // NoneItem, as ownership is passed to array
       
   349         CleanupStack::PopAndDestroy(); // buf, as item has copied it...
       
   350         }
       
   351 
       
   352     iList->HandleItemAdditionL();
       
   353 
       
   354     SetSelectedL();
       
   355 
       
   356     SetHighlighted();
       
   357 
       
   358     iList->View()->SetDisableRedraw( EFalse );
       
   359     iList->HandleItemAdditionL();
       
   360 
       
   361     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::FillListBoxWithDataL")
       
   362     }
   172     }
   363 
   173 
   364 
   174 
   365 // ---------------------------------------------------------
   175 // ---------------------------------------------------------
   366 // CApNetSelPopupList::SetSelectedL()
   176 // CApNetSelPopupList::SetSelectedL()
   367 // ---------------------------------------------------------
   177 // ---------------------------------------------------------
   368 //
   178 //
   369 void CApNetSelPopupList::SetSelectedL()
   179 void CApNetSelPopupList::SetSelectedL()
   370     {
   180     {
   371     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::SetSelectedL")
       
   372     
       
   373     TInt i( 0 );
       
   374     for( i=0; i<iModel->Count(); i++ )
       
   375         {
       
   376         if ( iModel->At( i )->Uid() == TUint32( *iSelected ) )
       
   377             {
       
   378             iList->SetCurrentItemIndexAndDraw( i );
       
   379             HandleListBoxEventL(iList,
       
   380                                 MEikListBoxObserver::EEventItemSingleClicked);
       
   381           /*  HandleListBoxEventL(iList,
       
   382                                             MEikListBoxObserver::EEventItemDoubleClicked);*/
       
   383             return; //exit here
       
   384             }
       
   385         }
       
   386     iList->SetCurrentItemIndexAndDraw( 0 );//set something that does no harm...
       
   387     HandleListBoxEventL(iList,
       
   388         MEikListBoxObserver::EEventItemSingleClicked ); // simulate selection...
       
   389     /*HandleListBoxEventL(iList,
       
   390         MEikListBoxObserver::EEventItemDoubleClicked);*/
       
   391     
       
   392     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::SetSelectedL")
       
   393     }
   181     }
   394 
   182 
   395 
   183 
   396 
   184 
   397 
   185 
   400 // ---------------------------------------------------------
   188 // ---------------------------------------------------------
   401 //
   189 //
   402 void CApNetSelPopupList::DynInitMenuPaneL( TInt aResourceId,
   190 void CApNetSelPopupList::DynInitMenuPaneL( TInt aResourceId,
   403                                         CEikMenuPane* aMenuPane )
   191                                         CEikMenuPane* aMenuPane )
   404     {
   192     {
   405     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::DynInitMenuPaneL")
       
   406     
       
   407     CAknSettingPage::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   408     if ( aResourceId == R_APSETTINGSUI_MENU_NETWORK )
       
   409         {
       
   410         if ( Need2DeleteSelect( aResourceId ) )
       
   411             {
       
   412             aMenuPane->DeleteMenuItem( EApSelCmdSelect );
       
   413             }
       
   414         if ( Need2DeleteOpenDelete( aResourceId ) )
       
   415             {
       
   416             aMenuPane->DeleteMenuItem( EApSelCmdDelete );
       
   417             }
       
   418         if ( iProtectionSupported )
       
   419             {
       
   420             if ( CApProtHandler::IsTableProtectedL( 
       
   421                   iDataModel->Database()->Database() ) )
       
   422                 {            
       
   423                 aMenuPane->DeleteMenuItem( EApSelCmdNew );                
       
   424                 }
       
   425             }
       
   426 		if ( !iHelpSupported )
       
   427 			{
       
   428 			aMenuPane->DeleteMenuItem( EAknCmdHelp );
       
   429 			}        
       
   430         }
       
   431 
       
   432     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::DynInitMenuPaneL")
       
   433     }
   193     }
   434 
   194 
   435 
   195 
   436 // From MEikCommandObserver
   196 // From MEikCommandObserver
   437 // ---------------------------------------------------------
   197 // ---------------------------------------------------------
   438 // CApNetSelPopupList::ProcessCommandL
   198 // CApNetSelPopupList::ProcessCommandL
   439 // ---------------------------------------------------------
   199 // ---------------------------------------------------------
   440 //
   200 //
   441 void CApNetSelPopupList::ProcessCommandL( TInt aCommandId )
   201 void CApNetSelPopupList::ProcessCommandL( TInt aCommandId )
   442     {
   202     {
   443     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::ProcessCommandL")
       
   444     
       
   445     if ( MenuShowing() )
       
   446         {
       
   447         HideMenu();
       
   448         }
       
   449 
       
   450     switch ( aCommandId )
       
   451         {
       
   452         case EAknSoftkeyOptions:
       
   453             {
       
   454             DisplayMenuL();
       
   455             break;
       
   456             }
       
   457         case EAknSoftkeyBack:
       
   458             {
       
   459             AttemptExitL( EFalse );
       
   460             break;
       
   461             }
       
   462         case EAknSoftkeyCancel:
       
   463             {
       
   464             *iEventStore |= KApUiEventShutDownRequested;
       
   465             AttemptExitL( EFalse );
       
   466             break;
       
   467             }
       
   468         case EApSelCmdSelect:
       
   469             {
       
   470             *iEventStore |= KApUiEventSelected;
       
   471             AttemptExitL( ETrue );
       
   472             break;
       
   473             }
       
   474         case EApSelCmdNew:
       
   475             {
       
   476             // create a new network group here
       
   477             if ( HandleCreateNewNetworkGroupL() )
       
   478                 {
       
   479                 SetHighlighted();
       
   480                 }
       
   481             break; 
       
   482             }
       
   483         case EApSelCmdDelete:
       
   484             {
       
   485             // As it might have been started by the Clear key,
       
   486             // we must check if there is any...
       
   487             TInt cnt = iModel->Count();
       
   488             if ( ( iNeedsNone & ( cnt > 1 ) ) || ( !iNeedsNone && cnt ) )
       
   489                 {
       
   490                 // as we must be standing on an item, it must exists...
       
   491                 // So no problem on iModel->At( ...)
       
   492                 if ( iList->CurrentItemIndex() < ( iModel->Count()-1 ) )
       
   493                     {// move to next one if possible
       
   494                     iPreferredUid = iModel->At(
       
   495                             iList->CurrentItemIndex()+1 )->Uid();
       
   496                     }
       
   497                 else
       
   498                     { // if it is the last, move to previous if possible.
       
   499                     // if not, set to 0
       
   500                     if ( iModel->Count()> 1 )
       
   501                         {// move to prev. one if possible
       
   502                         iPreferredUid = iModel->At(
       
   503                             iList->CurrentItemIndex()-1 )->Uid();
       
   504                         }
       
   505                     else
       
   506                         {
       
   507                         iPreferredUid = 0;
       
   508                         }
       
   509                     }
       
   510                 iHandler->HandleNetworkDeleteCmdL(
       
   511                             iModel->At( iList->CurrentItemIndex() )->Uid() );
       
   512                 }
       
   513             break;
       
   514             }
       
   515         case EAknCmdHelp:
       
   516             {
       
   517 			if ( iHelpSupported )
       
   518 				{
       
   519 				iDataModel->LaunchHelpL();	
       
   520 				}
       
   521             break;
       
   522             }
       
   523         default:
       
   524             {
       
   525             // silently ignore it
       
   526             break;
       
   527             }
       
   528         }
       
   529     // check if user wants to Exit....
       
   530     if ( *iEventStore & KApUiEventExitRequested )
       
   531         {
       
   532         AttemptExitL( EFalse );
       
   533         }
       
   534     else
       
   535         {
       
   536         switch ( aCommandId )
       
   537             {
       
   538             case EApSelCmdExit:
       
   539                 {
       
   540                 *iEventStore |= KApUiEventExitRequested;
       
   541                 AttemptExitL( EFalse );
       
   542                 break;
       
   543                 }
       
   544             case EEikCmdExit:
       
   545                 {
       
   546                 *iEventStore |= KApUiEventShutDownRequested;
       
   547                 AttemptExitL( EFalse );
       
   548                 break;
       
   549                 }
       
   550             default:
       
   551                 {
       
   552                 break;
       
   553                 }
       
   554             }
       
   555         }
       
   556     
       
   557     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::ProcessCommandL")
       
   558     }
   203     }
   559 
   204 
   560 
   205 
   561 
   206 
   562 // From CCoeControl
   207 // From CCoeControl
   565 // ---------------------------------------------------------
   210 // ---------------------------------------------------------
   566 //
   211 //
   567 TKeyResponse CApNetSelPopupList::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   212 TKeyResponse CApNetSelPopupList::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   568                                               TEventCode aType)
   213                                               TEventCode aType)
   569     {
   214     {
   570     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::OfferKeyEventL")
   215     User::Leave( KErrNotSupported );
   571     TKeyResponse retval;
       
   572     if ( aType == EEventKey )
       
   573         {
       
   574         if ( ( aKeyEvent.iCode == EKeyDelete ) ||
       
   575             ( aKeyEvent.iCode == EKeyBackspace ) )
       
   576             {
       
   577             ProcessCommandL( EApSelCmdDelete );
       
   578             retval = EKeyWasConsumed;
       
   579             }
       
   580         else
       
   581             {
       
   582             if ( aKeyEvent.iCode == EKeyOK )
       
   583                 { // process only if command is available...
       
   584                 ProcessCommandL( EApSelCmdSelect );
       
   585                 retval = EKeyWasConsumed;
       
   586                 }
       
   587             else
       
   588                 {
       
   589                 retval = CAknRadioButtonSettingPage::OfferKeyEventL(
       
   590                                         aKeyEvent, aType );
       
   591                 }
       
   592             }
       
   593         }
       
   594     else
       
   595         {
       
   596         retval = CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
       
   597         }
       
   598     
       
   599     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::OfferKeyEventL")
       
   600     return retval;
       
   601     }
   216     }
   602 
   217 
   603 
   218 
   604 
   219 
   605 // ---------------------------------------------------------
   220 // ---------------------------------------------------------
   606 // CApNetSelPopupList::Need2DeleteSelect
   221 // CApNetSelPopupList::Need2DeleteSelect
   607 // ---------------------------------------------------------
   222 // ---------------------------------------------------------
   608 //
   223 //
   609 TBool CApNetSelPopupList::Need2DeleteSelect( TInt aResourceId )
   224 TBool CApNetSelPopupList::Need2DeleteSelect( TInt aResourceId )
   610     {
   225     {
   611     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::Need2DeleteSelect<->")
   226     return EFalse;
   612     return ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) &&
       
   613              ( iList->Model()->NumberOfItems() == 0 ) );
       
   614     }
   227     }
   615 
   228 
   616 
   229 
   617 
   230 
   618 // ---------------------------------------------------------
   231 // ---------------------------------------------------------
   619 // CApNetSelPopupList::Need2DeleteOpenDelete
   232 // CApNetSelPopupList::Need2DeleteOpenDelete
   620 // ---------------------------------------------------------
   233 // ---------------------------------------------------------
   621 //
   234 //
   622 TBool CApNetSelPopupList::Need2DeleteOpenDelete( TInt aResourceId )
   235 TBool CApNetSelPopupList::Need2DeleteOpenDelete( TInt aResourceId )
   623     {
   236     {
   624     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::Need2DeleteOpenDelete<->")
   237     return EFalse;
   625     
       
   626     return ( ( aResourceId == R_APSETTINGSUI_MENU_NETWORK ) &&
       
   627              (
       
   628                (
       
   629                  ( iList->Model()->NumberOfItems() == 0) && 
       
   630                  ( iNeedsNone == EFalse )
       
   631                )
       
   632                ||
       
   633                ( ( iNeedsNone ) &&
       
   634                  ( iModel->At( iList->CurrentItemIndex() )->Uid() 
       
   635                                   == KApNoneUID )
       
   636              ) ) );
       
   637     }
   238     }
   638 
   239 
   639 
   240 
   640 
   241 
   641 // ---------------------------------------------------------
   242 // ---------------------------------------------------------
   642 // CApNetSelPopupList::HandleCreateNewNetworkGroupL
   243 // CApNetSelPopupList::HandleCreateNewNetworkGroupL
   643 // ---------------------------------------------------------
   244 // ---------------------------------------------------------
   644 //
   245 //
   645 TBool CApNetSelPopupList::HandleCreateNewNetworkGroupL()
   246 TBool CApNetSelPopupList::HandleCreateNewNetworkGroupL()
   646     {
   247     {
   647     APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::HandleCreateNewNetworkGroupL")
   248     return EFalse;
   648     
       
   649     TBool retval( EFalse );
       
   650 
       
   651     // must be prepared for the worst case...
       
   652     TBuf<KModifiableLongTextLength> textToChange;    
       
   653 
       
   654     TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed );
       
   655 
       
   656     CAccessPointTextSettingPage* dlg =
       
   657         new( ELeave )CAccessPointTextSettingPage( 
       
   658                         R_TEXT_SETTING_PAGE_NETW_NAME, 
       
   659                         textToChange,
       
   660                         TextSettingPageFlags,
       
   661                         EFalse );
       
   662 
       
   663     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
       
   664         {
       
   665         CApNetworkItem* network = CApNetworkItem::NewLC();
       
   666         network->SetUid( 0 ); // will be assigned when written toi disk
       
   667         network->SetNameL( textToChange );
       
   668         iDataModel->DataHandler()->CreateNetworkL( *network );
       
   669         iPreferredUid = network->Uid();
       
   670         CleanupStack::PopAndDestroy( network );
       
   671         retval = ETrue;
       
   672         }
       
   673     *iEventStore |= KApUiEventEdited;
       
   674     
       
   675     APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::HandleCreateNewNetworkGroupL")
       
   676     return retval;
       
   677     }
   249     }
   678 
   250 
   679 // End of File
   251 // End of File