commsconfig/cscsettingsui/src/cscsettingsuimainview.cpp
branchRCL_3
changeset 16 6134b5029079
parent 11 bddb6d4447db
child 20 be41ab7b952f
equal deleted inserted replaced
15:ed1e38b404e5 16:6134b5029079
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    36 #include <mediafilelist.h>
    36 #include <mediafilelist.h>
    37 #include <aknpasswordsettingpage.h>
    37 #include <aknpasswordsettingpage.h>
    38 #include <aknradiobuttonsettingpage.h>
    38 #include <aknradiobuttonsettingpage.h>
    39 #include <aknnavi.h>
    39 #include <aknnavi.h>
    40 #include <aknnavide.h>
    40 #include <aknnavide.h>
       
    41 #include <vwsdef.h>
       
    42 #include <AknDef.h>
    41 
    43 
    42 #include "cscconstants.h"
    44 #include "cscconstants.h"
    43 #include "cscsettingsui.hrh"
    45 #include "cscsettingsui.hrh"
    44 #include "cscsettingsuimodel.h"
    46 #include "cscsettingsuimodel.h"
    45 #include "cscsettingsuilogger.h"
    47 #include "cscsettingsuilogger.h"
    46 #include "cscengservicehandler.h"
    48 #include "cscengservicehandler.h"
    47 #include "cscengbrandinghandler.h"
    49 #include "cscengbrandinghandler.h"
    48 #include "cscsettingsuimainview.h"
    50 #include "cscsettingsuimainview.h"
    49 #include "cscsettingsuiconstants.h"
    51 #include "cscsettingsuiconstants.h"
    50 #include "cscengservicepluginhandler.h"
    52 #include "cscengservicepluginhandler.h"
       
    53 #include "cscappui.h"
    51 
    54 
    52 
    55 
    53 #define AppUi() (static_cast<CAknViewAppUi*>(iAvkonAppUi) )
    56 #define AppUi() (static_cast<CAknViewAppUi*>(iAvkonAppUi) )
    54 
    57 
    55 // Preferred service not set
    58 // Preferred service not set
   243             {
   246             {
   244             if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   247             if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   245                 {
   248                 {
   246                 CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL();
   249                 CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL();
   247                     HlpLauncher::LaunchHelpApplicationL(
   250                     HlpLauncher::LaunchHelpApplicationL(
   248                             iEikonEnv->WsSession(), buf );
   251                         iEikonEnv->WsSession(), buf );
   249                 }
   252                 }
   250             break;
   253             break;
   251             }         
   254             }         
   252         case EAknSoftkeyBack:
   255         case EAknSoftkeyBack:
   253             {
   256             {
       
   257             HandleReturnToPreviousViewL();
       
   258             break;
       
   259             }
       
   260         case ECSCSettingsUiDelete:
       
   261             {
       
   262             CSCSETUIDEBUG( "    HandleCommandL - delete service" );
       
   263             iContainer->DeleteServiceL();
       
   264             iDeleted = ETrue;
   254             HandleReturnToPreviousViewL();
   265             HandleReturnToPreviousViewL();
   255             break;
   266             break;
   256             }
   267             }
   257         case EEikCmdExit:
   268         case EEikCmdExit:
   258         case EAknSoftkeyExit:
   269         case EAknSoftkeyExit:
   278     const TVwsViewId& /*aPrevViewId*/, 
   289     const TVwsViewId& /*aPrevViewId*/, 
   279     TUid /*aCustomMessageId*/,
   290     TUid /*aCustomMessageId*/,
   280     const TDesC8& /*aCustomMessage*/ )
   291     const TDesC8& /*aCustomMessage*/ )
   281     {
   292     {
   282     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - begin" );
   293     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - begin" );
   283     
   294 
   284     // Create container when view is activated.
   295     // Create container when view is activated.
   285     if ( !iContainer )
   296     if ( !iContainer )
   286         {
   297         {
   287         iContainer = new ( ELeave ) CCSCSettingsUiMainContainer( iModel );
   298         iContainer = new ( ELeave ) CCSCSettingsUiMainContainer( iModel );
   288         iContainer->SetMopParent( this );
   299         iContainer->SetMopParent( this );
   289         iContainer->ConstructL( ClientRect() );
   300         iContainer->ConstructL( ClientRect() );
   290         AppUi()->AddToStackL( *this, iContainer );
   301         AppUi()->AddToStackL( *this, iContainer );
   291         iContainer->ListBox()->SetListBoxObserver( this );
   302         iContainer->ListBox()->SetListBoxObserver( this );
   292         }
   303         }
   293     
   304 
   294     SetTitleTextL();
   305     SetTitleTextL();
   295     UpdateSoftkeysL();
   306     UpdateSoftkeysL();
   296     iContainer->UpdateContainerL();
   307     iContainer->UpdateContainerL();
   297     
   308 
   298     if (!iNaviPane)
   309     if ( !iNaviPane )
   299          {
   310          {
   300          iNaviPane = static_cast<CAknNavigationControlContainer*>(
   311          iNaviPane = static_cast<CAknNavigationControlContainer*>(
   301              iAvkonAppUi->StatusPane()->ControlL(
   312              iAvkonAppUi->StatusPane()->ControlL(
   302              TUid::Uid(EEikStatusPaneUidNavi)));
   313              TUid::Uid(EEikStatusPaneUidNavi)));
   303          } 
   314          } 
   304      
   315 
   305      if ( !iNaviDecorator )
   316      if ( !iNaviDecorator )
   306          {
   317          {
   307          iNaviDecorator = iNaviPane->CreateNavigationLabelL();
   318          iNaviDecorator = iNaviPane->CreateNavigationLabelL();
   308          iNaviPane->PushL(*iNaviDecorator);
   319          iNaviPane->PushL( *iNaviDecorator );
   309          }
   320          }
   310 
   321 
   311     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - end" );
   322     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - end" );
   312     }
   323     }
   313 
   324 
   319 //
   330 //
   320 void CCSCSettingsUiMainView::DoDeactivate()
   331 void CCSCSettingsUiMainView::DoDeactivate()
   321     {
   332     {
   322     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoDeactivate - begin" );
   333     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoDeactivate - begin" );
   323     
   334     
   324     if (iNaviPane && iNaviDecorator)
   335     if ( iNaviPane && iNaviDecorator )
   325             {
   336             {
   326             iNaviPane->Pop(iNaviDecorator);
   337             iNaviPane->Pop( iNaviDecorator );
   327             }
   338             }
   328    delete iNaviDecorator;
   339    delete iNaviDecorator;
   329    iNaviDecorator = NULL;
   340    iNaviDecorator = NULL;
   330     
   341     
   331     // Delete container when view is deactivated.
   342     // Delete container when view is deactivated.
   428     
   439     
   429     if ( aMenuPane && R_CSCSETTINGSUI_MAINVIEW_MENU == aResourceId )
   440     if ( aMenuPane && R_CSCSETTINGSUI_MAINVIEW_MENU == aResourceId )
   430         {
   441         {
   431         TMainListBoxItem listBoxItem = iContainer->CurrentItem();
   442         TMainListBoxItem listBoxItem = iContainer->CurrentItem();
   432     
   443     
   433         switch( listBoxItem.iItem )
   444         switch ( listBoxItem.iItem )
   434             {
   445             {
   435             // Hide "Change" and show "Open"
   446             // Hide "Change" and show "Open"
   436             case TMainListBoxItem::EServiceConn:
   447             case TMainListBoxItem::EServiceConn:
   437                 aMenuPane->SetItemDimmed( ECSCSettingsUiChange, ETrue );
   448                 aMenuPane->SetItemDimmed( ECSCSettingsUiChange, ETrue );
   438                 aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, EFalse );
   449                 aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, EFalse );
   452             default:
   463             default:
   453                  aMenuPane->SetItemDimmed( ECSCSettingsUiChange, ETrue );
   464                  aMenuPane->SetItemDimmed( ECSCSettingsUiChange, ETrue );
   454                  aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, ETrue );
   465                  aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, ETrue );
   455             break;
   466             break;
   456             }
   467             }
       
   468         if ( !(iModel.CCHHandler().IsServiceDisabled( 
       
   469             iModel.CurrentSPEntryId() ) ) )
       
   470             {
       
   471             aMenuPane->SetItemDimmed( ECSCSettingsUiDelete, ETrue );
       
   472             }
   457         }
   473         }
   458      
   474      
   459     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DynInitMenuPaneL - end" );
   475     CSCSETUIDEBUG( "CCSCSettingsUiMainView::DynInitMenuPaneL - end" );
   460     }
   476     }
   461 
   477 
   854         "CCSCSettingsUiMainView::HandleReturnToPreviousViewL - IN" );
   870         "CCSCSettingsUiMainView::HandleReturnToPreviousViewL - IN" );
   855 
   871 
   856     if ( iModel.ReturnViewId() != KNullUid )
   872     if ( iModel.ReturnViewId() != KNullUid )
   857         {             
   873         {             
   858         TUid tabview( KNullUid );
   874         TUid tabview( KNullUid );
   859         TRAPD( err, tabview.iUid = iModel.SettingsHandler().ServiceTabViewIdL( 
   875 
       
   876         // Error code not needed.
       
   877         TRAP_IGNORE( 
       
   878             tabview.iUid = iModel.SettingsHandler().ServiceTabViewIdL( 
   860             iModel.CurrentSPEntryId() ) )
   879             iModel.CurrentSPEntryId() ) )
   861                  
   880 
   862         if ( tabview.iUid == iModel.ReturnViewId().iUid && !err )
   881         if ( iDeleted && KCSCServiceViewId != iModel.ReturnViewId() )
       
   882             {
       
   883             TVwsViewId idleId;
       
   884             AknDef::GetPhoneIdleViewId( idleId );
       
   885             ActivateViewL( idleId );
       
   886             AppUi()->HandleCommandL( EEikCmdExit );
       
   887             }
       
   888         else if ( tabview.iUid == iModel.ReturnViewId().iUid )
   863             {
   889             {
   864             RxSPViewServices viewServices;
   890             RxSPViewServices viewServices;
   865             TInt err = viewServices.Activate( 
   891             TInt err = viewServices.Activate( 
   866                 KPhoneBookTabUid.iUid, 
   892                 KPhoneBookTabUid.iUid, 
   867                 iModel.ReturnViewId().iUid );
   893                 iModel.ReturnViewId().iUid );
   868               
   894 
   869             CSCSETUIDEBUG2( "   --> ACTIVATE ERR=%d", err );
   895             CSCSETUIDEBUG2( "   --> ACTIVATE ERR=%d", err );
   870               
   896 
   871             AppUi()->HandleCommandL( EEikCmdExit );
   897             AppUi()->HandleCommandL( EEikCmdExit );
   872             }
   898             }
   873         else
   899         else
   874             { 
   900             {
   875             // Not launched from service tab, activate previsous view
   901             // Not deleted or launched from service tab,
       
   902             // activate previous view.
   876             AppUi()->ActivateLocalViewL( iModel.ReturnViewId() );
   903             AppUi()->ActivateLocalViewL( iModel.ReturnViewId() );
   877             }        
   904             }
   878         }
   905         }
   879       
   906       
   880     CSCSETUIDEBUG( 
   907     CSCSETUIDEBUG( 
   881         "CCSCSettingsUiMainView::HandleReturnToPreviousViewL - OUT" );
   908         "CCSCSettingsUiMainView::HandleReturnToPreviousViewL - OUT" );
   882     }
   909     }
   940     iContainer->UpdateContainerL();
   967     iContainer->UpdateContainerL();
   941 
   968 
   942     CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - OUT" );
   969     CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - OUT" );
   943     }
   970     }
   944 
   971 
       
   972 // End of file.
       
   973