videofeeds/vcnsscheduleview/src/CVcxNsScheduleSettingsViewContainer.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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:    Video on Demand schedule settings view container class.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #include <coecntrl.h>
       
    20 #include <AknUtils.h>
       
    21 #include <StringLoader.h>
       
    22 #include "IptvDebug.h"
       
    23 #include "vcxnsservicesettings.h"
       
    24 
       
    25 #include <csxhelp/iptv.hlp.hrh> // KIPTV_HLP_SCHEDULE_DOWNLOAD
       
    26 
       
    27 #include <vcxnsscheduleview.rsg>
       
    28 #include "vcxnsscheduleview.hrh"
       
    29 
       
    30 #include "CVcxNsScheduleSettingsViewContainer.h"
       
    31 #include "CVcxNsScheduleSettingsSettingItem.h"
       
    32 #include "CVcxNsScheduleSettingsList.h"
       
    33 
       
    34 const TUid KUidIptvMainApp = { 0x102750E2 };
       
    35 
       
    36 CVcxNsScheduleSettingsViewContainer::CVcxNsScheduleSettingsViewContainer(
       
    37     CVcxNsServiceSettings& aSettings,
       
    38     TIptvServiceId aServiceId )
       
    39     : iSettings( aSettings ),
       
    40       iServiceId( aServiceId )
       
    41     {
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------
       
    45 // Destructor
       
    46 // ---------------------------------------------------------
       
    47 //
       
    48 CVcxNsScheduleSettingsViewContainer::~CVcxNsScheduleSettingsViewContainer()
       
    49     {
       
    50     delete iSettingItem;
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------
       
    54 // CVcxNsScheduleSettingsViewContainer::ConstructL()
       
    55 // ---------------------------------------------------------
       
    56 //
       
    57 void CVcxNsScheduleSettingsViewContainer::ConstructL( const TRect& aRect )
       
    58     {
       
    59     IPTVLOGSTRING_LOW_LEVEL( 
       
    60         "IPTV VOD ## CVcxNsScheduleSettingsViewContainer::ConstructL -- Enter" );
       
    61    
       
    62     CreateWindowL();
       
    63     SetRect( aRect );
       
    64     
       
    65     iSettingItem = CVcxNsScheduleSettingsSettingItem::NewL( 
       
    66             this,iSettings );
       
    67             
       
    68     if ( iSettingItem )
       
    69         {
       
    70         iSettingItem->Listbox()->LoadSettingValuesL( iServiceId ); 
       
    71         iSettingItem->ActivateL();
       
    72         }
       
    73 	DrawNow();
       
    74     ActivateL();
       
    75                 
       
    76     IPTVLOGSTRING_LOW_LEVEL(
       
    77         "IPTV VOD ## CVcxNsScheduleSettingsViewContainer::ConstructL -- Exit" );
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------
       
    81 // CVcxNsScheduleSettingsViewContainer::SizeChanged()
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 void CVcxNsScheduleSettingsViewContainer::SizeChanged()
       
    85     {  
       
    86     if ( iSettingItem )
       
    87         {
       
    88         iSettingItem->Listbox()->SetRect( Rect() );
       
    89         }
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // CVcxNsScheduleSettingsViewContainer::CountComponentControls()
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 TInt CVcxNsScheduleSettingsViewContainer::CountComponentControls() const
       
    97     {
       
    98     if ( iSettingItem )
       
    99         {
       
   100         return 1;  // iSettingItem->iListbox
       
   101         }
       
   102     else 
       
   103         {
       
   104         return 0;    
       
   105         }
       
   106     }
       
   107 // ---------------------------------------------------------
       
   108 // CVcxNsScheduleSettingsViewContainer::ComponentControl()
       
   109 // ---------------------------------------------------------
       
   110 //
       
   111 CCoeControl* CVcxNsScheduleSettingsViewContainer::ComponentControl( TInt aIndex ) const
       
   112     {
       
   113     switch ( aIndex )
       
   114         {
       
   115         case 0:
       
   116             {
       
   117             if ( iSettingItem )
       
   118                 {
       
   119                 return iSettingItem->Listbox();
       
   120                 }
       
   121             return NULL;
       
   122             }
       
   123         default:
       
   124             {
       
   125             return NULL;
       
   126             }
       
   127         }
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------
       
   131 // CVcxNsScheduleSettingsViewContainer::OfferKeyEventL
       
   132 // ---------------------------------------------------------
       
   133 //
       
   134 TKeyResponse CVcxNsScheduleSettingsViewContainer::OfferKeyEventL(
       
   135         const TKeyEvent& aKeyEvent,
       
   136         TEventCode aType)
       
   137     {
       
   138     if ( iSettingItem )
       
   139         {
       
   140         return iSettingItem->Listbox()->OfferKeyEventL( aKeyEvent, aType );
       
   141         }
       
   142     return EKeyWasNotConsumed;   
       
   143     }
       
   144   
       
   145 // ---------------------------------------------------------
       
   146 // CVcxNsScheduleSettingsViewContainer::Draw
       
   147 // ---------------------------------------------------------
       
   148 //
       
   149 void CVcxNsScheduleSettingsViewContainer::Draw( const TRect& aRect ) const
       
   150     {
       
   151     IPTVLOGSTRING_LOW_LEVEL( "IPTV VOD ## CVcxNsScheduleSettingsViewContainer::Draw ()" );
       
   152 
       
   153     CWindowGc& gc = SystemGc();
       
   154     gc.Clear(aRect);
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CVcxNsScheduleSettingsViewContainer::HandleResourceChange
       
   159 // ---------------------------------------------------------
       
   160 //
       
   161 void CVcxNsScheduleSettingsViewContainer::HandleResourceChange( TInt aType )
       
   162     {
       
   163     IPTVLOGSTRING_LOW_LEVEL(
       
   164         "IPTV VOD ## CVcxNsScheduleSettingsViewContainer::HandleResourceChange -- Enter" );
       
   165         
       
   166     CCoeControl::HandleResourceChange( aType );
       
   167 
       
   168     iSettingItem->Listbox()->HandleResourceChange( aType );
       
   169     
       
   170     if( aType == KEikDynamicLayoutVariantSwitch )
       
   171         {
       
   172         TRect rect;
       
   173         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
       
   174         SetRect(rect);
       
   175         SizeChanged();
       
   176         DrawNow();
       
   177         }
       
   178         
       
   179     IPTVLOGSTRING_LOW_LEVEL(
       
   180         "IPTV VOD ## CVcxNsScheduleSettingsViewContainer::HandleResourceChange -- Exit" );
       
   181     }
       
   182    
       
   183 // ---------------------------------------------------------
       
   184 // CVcxNsScheduleSettingsViewContainer::HandleChangeSelectedSettingItemL
       
   185 // ---------------------------------------------------------
       
   186 //
       
   187 void CVcxNsScheduleSettingsViewContainer::HandleChangeSelectedSettingItemL( 
       
   188     TInt /*aCommand*/ )
       
   189     {
       
   190     if ( iSettingItem )
       
   191         {
       
   192         iSettingItem->ChangeSelectedItemL();
       
   193         }
       
   194     }
       
   195 
       
   196 // ---------------------------------------------------------
       
   197 // CVcxNsScheduleSettingsViewContainer::SaveSettingsL
       
   198 // ---------------------------------------------------------
       
   199 //
       
   200 void CVcxNsScheduleSettingsViewContainer::SaveSettingsL()
       
   201     {
       
   202     if ( iSettingItem )
       
   203         {
       
   204         iSettingItem->Listbox()->SaveSettingValuesL( iServiceId );
       
   205         }
       
   206     }
       
   207 
       
   208 // ---------------------------------------------------------
       
   209 // CVcxNsScheduleSettingsViewContainer::GetHelpContext()
       
   210 // ---------------------------------------------------------
       
   211 //
       
   212 void CVcxNsScheduleSettingsViewContainer::GetHelpContext( 
       
   213     TCoeHelpContext& aContext ) const
       
   214     {
       
   215     aContext.iMajor   = KUidIptvMainApp;
       
   216     aContext.iContext = KIPTV_HLP_SCHEDULE_DOWNLOAD;
       
   217     }
       
   218 
       
   219 // ---------------------------------------------------------
       
   220 // CVcxNsScheduleSettingsViewContainer::IsSchedulingActive
       
   221 // ---------------------------------------------------------
       
   222 //
       
   223 TBool CVcxNsScheduleSettingsViewContainer::IsSchedulingActive()
       
   224     {
       
   225     if ( iSettingItem )
       
   226         {
       
   227         return iSettingItem->Listbox()->IsSchedulingActive();
       
   228         }
       
   229     return EFalse;
       
   230     }
       
   231 
       
   232 // End of File