gssettingsuis/Gs/GSCallDivertPlugin/Src/GSCallDivertContainer.cpp
changeset 0 8c5d936e5675
child 17 3b47783fdf16
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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 "GSCallDivertContainer.h"
       
    21 #include "CallDivertPlugin.hrh"
       
    22 
       
    23 #include <aknlists.h>
       
    24 #include <GSCallDivertPluginRsc.rsg>
       
    25 #include <gslistbox.h>
       
    26 #include <csxhelp/cp.hlp.hrh>        // for help context of Divert
       
    27 #include <gsfwviewuids.h>     // for KUidGS
       
    28 
       
    29 // ========================= MEMBER FUNCTIONS ================================
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // CGSCallDivertContainer::CGSCallDivertContainer
       
    33 //
       
    34 // C++ constructor
       
    35 // ---------------------------------------------------------------------------
       
    36 CGSCallDivertContainer::CGSCallDivertContainer( TGSCallDivertServiceGroups aItemId )
       
    37     : iItemId( aItemId )
       
    38     {
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CGSCallDivertContainer::ConstructL
       
    43 //
       
    44 // Symbian OS two phased constructor
       
    45 // ---------------------------------------------------------------------------
       
    46 void CGSCallDivertContainer::ConstructL( const TRect& aRect )
       
    47     {
       
    48     iListBox = new ( ELeave ) CAknSettingStyleListBox;
       
    49     switch( iItemId )
       
    50         {
       
    51         case EGSSettIdVoiceDivert:
       
    52             BaseConstructL( aRect, R_CF_VOICE_VIEW_TITLE, R_CF_DIV_LBX );
       
    53             break;
       
    54         case EGSSettIdVideoDivert:
       
    55             BaseConstructL( aRect, R_CF_VIDEO_VIEW_TITLE, R_CF_DIV_LBX );
       
    56             break;
       
    57         default:
       
    58             break;
       
    59         }
       
    60 
       
    61     }
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CGSCallDivertContainer::~CGSCallDivertContainer
       
    66 //
       
    67 // Destructor
       
    68 // ---------------------------------------------------------------------------
       
    69 CGSCallDivertContainer::~CGSCallDivertContainer()
       
    70     {
       
    71     if ( iListboxItemArray )
       
    72         {
       
    73         delete iListboxItemArray;
       
    74         }
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CGSCallDivertContainer::GetHelpContext
       
    79 //
       
    80 // This function is called when Help application is launched.
       
    81 // Only available, when __SERIES60_HELP is defined.
       
    82 // ---------------------------------------------------------------------------
       
    83 void CGSCallDivertContainer::GetHelpContext(
       
    84     TCoeHelpContext& aContext ) const
       
    85     {
       
    86     aContext.iMajor = KUidGS;
       
    87 
       
    88     switch( iItemId )
       
    89         {
       
    90         case EGSSettIdVoiceDivert:
       
    91             aContext.iContext = KDIV_HLP_CALL_FORW_VOI;
       
    92             break;
       
    93         case EGSSettIdVideoDivert:
       
    94             aContext.iContext = KDIV_HLP_CALL_FORW_DAT;
       
    95             break;
       
    96         default:
       
    97             break;
       
    98         }
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CGSCallDivertContainer::ConstructListBoxL
       
   103 // Creates list box from resources.
       
   104 //
       
   105 // ---------------------------------------------------------------------------
       
   106 //
       
   107 void CGSCallDivertContainer::ConstructListBoxL( TInt aResLbxId )
       
   108     {
       
   109     iListBox->ConstructL(this, EAknListBoxSelectionList);
       
   110 
       
   111     iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId,
       
   112         *iListBox, *iCoeEnv );
       
   113     iListBox->Model()->SetItemTextArray( iListboxItemArray );
       
   114     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   115 
       
   116     CreateListBoxItemsL();
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CGSCallDivertContainer::CreateListBoxItemsL
       
   121 //
       
   122 // Creates List box items
       
   123 // ---------------------------------------------------------------------------
       
   124 void CGSCallDivertContainer::CreateListBoxItemsL()
       
   125     {
       
   126     if ( iItemId == EGSSettIdVoiceDivert )
       
   127         {
       
   128         MakeAllVoiceCallDivertsItemL();
       
   129         }
       
   130     else if ( iItemId == EGSSettIdVideoDivert )
       
   131         {
       
   132         MakeAllVideoCallDivertsItemL();
       
   133         }
       
   134 
       
   135     MakeIfBusyItemL();
       
   136     MakeIfNotAnsweredItemL();
       
   137     MakeIfOutOfReachItemL();
       
   138     MakeIfNotAvailableItemL();
       
   139     }
       
   140 
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CGSCallDivertContainer::MakeAllVoiceCallDivertsItemL
       
   144 //
       
   145 // Create voice call diverts item
       
   146 // ---------------------------------------------------------------------------
       
   147 void CGSCallDivertContainer::MakeAllVoiceCallDivertsItemL()
       
   148     {
       
   149     iListboxItemArray->SetItemVisibilityL( ECFDivertVoiceCalls,
       
   150         CGSListBoxItemTextArray::EVisible );
       
   151     }
       
   152 
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // CGSCallDivertContainer::MakeAllVideoCallDivertsItemL
       
   156 //
       
   157 // Create data & video call diverts item
       
   158 // ---------------------------------------------------------------------------
       
   159 void CGSCallDivertContainer::MakeAllVideoCallDivertsItemL()
       
   160     {
       
   161     iListboxItemArray->SetItemVisibilityL( ECFDivertVideoCalls,
       
   162         CGSListBoxItemTextArray::EVisible );
       
   163     }
       
   164 
       
   165 
       
   166 // ---------------------------------------------------------------------------
       
   167 // CGSCallDivertContainer::MakeAllVoiceCallDivertsItemL
       
   168 //
       
   169 // Create if_busy item
       
   170 // ---------------------------------------------------------------------------
       
   171 void CGSCallDivertContainer::MakeIfBusyItemL()
       
   172     {
       
   173     iListboxItemArray->SetItemVisibilityL( ECFDivertWhenBusy,
       
   174         CGSListBoxItemTextArray::EVisible );
       
   175     }
       
   176 
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // CGSCallDivertContainer::MakeAllVoiceCallDivertsItemL
       
   180 //
       
   181 // Create if_not_answered item
       
   182 // ---------------------------------------------------------------------------
       
   183 void CGSCallDivertContainer::MakeIfNotAnsweredItemL()
       
   184     {
       
   185     iListboxItemArray->SetItemVisibilityL( ECFDivertWhenNoAnswer,
       
   186         CGSListBoxItemTextArray::EVisible );
       
   187     }
       
   188 
       
   189 
       
   190 // ---------------------------------------------------------------------------
       
   191 // CGSCallDivertContainer::MakeAllVoiceCallDivertsItemL
       
   192 //
       
   193 // Create if_out_of_reach item
       
   194 // ---------------------------------------------------------------------------
       
   195 void CGSCallDivertContainer::MakeIfOutOfReachItemL()
       
   196     {
       
   197     iListboxItemArray->SetItemVisibilityL( ECFDivertWhenOutOfReach,
       
   198         CGSListBoxItemTextArray::EVisible );
       
   199     }
       
   200 
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // CGSCallDivertContainer::MakeIfNotAvailableItemL
       
   204 //
       
   205 // Create if_not_available item
       
   206 // ---------------------------------------------------------------------------
       
   207 void CGSCallDivertContainer::MakeIfNotAvailableItemL()
       
   208     {
       
   209     iListboxItemArray->SetItemVisibilityL( ECFDivertWhenNotAvailable,
       
   210         CGSListBoxItemTextArray::EVisible );
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // CGSCallDivertContainer::CurrentFeatureId
       
   215 //
       
   216 //
       
   217 // ---------------------------------------------------------------------------
       
   218 TInt CGSCallDivertContainer::CurrentFeatureId() const
       
   219     {
       
   220     return iListboxItemArray->CurrentFeature( );
       
   221     }
       
   222 
       
   223 
       
   224 //End of File