gssettingsuis/Gs/GSCallDivertPlugin/Src/GSCallDivertPluginContainer.cpp
branchRCL_3
changeset 54 7e0eff37aedb
equal deleted inserted replaced
53:8ee96d21d9bf 54:7e0eff37aedb
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Container for Call Divert's view.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "CallDivertPlugin.hrh"
       
    21 #include "GSCallDivertPluginContainer.h"
       
    22 
       
    23 #include <aknlists.h>
       
    24 #include <gscalldivertpluginrsc.rsg>
       
    25 #include <featmgr.h>
       
    26 #include <csxhelp/cp.hlp.hrh>          // for help context of Divert
       
    27 #include <gsfwviewuids.h>       // for KUidGS
       
    28 #include <gslistbox.h>
       
    29 
       
    30 // ========================= MEMBER FUNCTIONS ================================
       
    31 // ---------------------------------------------------------------------------
       
    32 // CGSCallDivertPluginContainer::ConstructL
       
    33 // Symbian OS two phased constructor
       
    34 //
       
    35 // ---------------------------------------------------------------------------
       
    36 void CGSCallDivertPluginContainer::ConstructL( const TRect& aRect )
       
    37     {
       
    38     iListBox = new ( ELeave ) CAknSettingStyleListBox;
       
    39     BaseConstructL( aRect, R_CF_MAIN_VIEW_TITLE, R_CF_MAIN_LBX );
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // CGSCallDivertPluginContainer::~CGSCallDivertPluginContainer
       
    44 // Destructor
       
    45 //
       
    46 // ---------------------------------------------------------------------------
       
    47 CGSCallDivertPluginContainer::~CGSCallDivertPluginContainer()
       
    48     {
       
    49     if ( iListboxItemArray )
       
    50         {
       
    51         delete iListboxItemArray;
       
    52         }
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // CGSCallDivertPluginContainer::GetHelpContext
       
    57 // This function is called when Help application is launched.
       
    58 // Only available, when __SERIES60_HELP is defined.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 void CGSCallDivertPluginContainer::GetHelpContext(
       
    62     TCoeHelpContext& aContext ) const
       
    63     {
       
    64     aContext.iMajor = KUidGS;
       
    65     aContext.iContext = KDIV_HLP_CALL_FORW_MAIN;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CGSCallDivertPluginContainer::ConstructListBoxL
       
    70 // Creates list box from resources.
       
    71 //
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void CGSCallDivertPluginContainer::ConstructListBoxL( TInt aResLbxId )
       
    75     {
       
    76     iListBox->ConstructL( this, EAknListBoxSelectionList );
       
    77 
       
    78     iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId,
       
    79         *iListBox, *iCoeEnv );
       
    80     iListBox->Model()->SetItemTextArray( iListboxItemArray );
       
    81     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
    82 
       
    83     MakeVoiceDivertsItemL();
       
    84     MakeVideoDivertsItemL();
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CGSCallDivertPluginContainer::UpdateListBoxL
       
    89 //
       
    90 //
       
    91 // ---------------------------------------------------------------------------
       
    92 void CGSCallDivertPluginContainer::UpdateListBoxL( TInt aFeatureId )
       
    93     {
       
    94     switch( aFeatureId )
       
    95         {
       
    96         case EGSSettIdVoiceDivert:
       
    97             MakeVoiceDivertsItemL();
       
    98             break;
       
    99         case EGSSettIdVideoDivert:
       
   100             MakeVideoDivertsItemL();
       
   101             break;
       
   102         default:
       
   103             break;
       
   104         }
       
   105 
       
   106     // Update the listbox
       
   107     iListBox->HandleItemAdditionL();
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // CGSCallDivertPluginContainer::CurrentFeatureId
       
   112 //
       
   113 //
       
   114 // ---------------------------------------------------------------------------
       
   115 TGSCallDivertServiceGroups CGSCallDivertPluginContainer::CurrentFeatureId() const
       
   116     {
       
   117     // Actually listbox item IDs are from TGSCallDivertServiceGroups so safe to cast
       
   118     return (TGSCallDivertServiceGroups) iListboxItemArray->CurrentFeature( );
       
   119     }
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CGSCallDivertPluginContainer::MakeVoiceDivertsItemL
       
   123 //
       
   124 //
       
   125 // ---------------------------------------------------------------------------
       
   126 void CGSCallDivertPluginContainer::MakeVoiceDivertsItemL()
       
   127     {
       
   128     iListboxItemArray->SetItemVisibilityL( EGSSettIdVoiceDivert,
       
   129         CGSListBoxItemTextArray::EVisible );
       
   130     }
       
   131 
       
   132 // ---------------------------------------------------------------------------
       
   133 // CGSCallDivertPluginContainer::MakeDataAndVideoDivertsItemL
       
   134 //
       
   135 //
       
   136 // ---------------------------------------------------------------------------
       
   137 void CGSCallDivertPluginContainer::MakeVideoDivertsItemL()
       
   138     {
       
   139 	
       
   140      if ( FeatureManager::FeatureSupported(
       
   141            KFeatureIdCsVideoTelephony ) )
       
   142          {
       
   143          iListboxItemArray->SetItemVisibilityL( EGSSettIdVideoDivert,
       
   144              CGSListBoxItemTextArray::EVisible );
       
   145          } 
       
   146      else 
       
   147     	 {
       
   148          iListboxItemArray->SetItemVisibilityL( EGSSettIdVideoDivert,
       
   149              CGSListBoxItemTextArray::EInvisible ); 
       
   150        	 }
       
   151     }
       
   152 //End of file