memana/analyzetoolclient/configurationappgui/src/atconfigurationappguisettingitemlist.cpp
changeset 0 f0f2b8682603
equal deleted inserted replaced
-1:000000000000 0:f0f2b8682603
       
     1 /*
       
     2 * Copyright (c) 2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <avkon.hrh>
       
    19 #include <avkon.rsg>
       
    20 #include <eikmenup.h>
       
    21 #include <aknappui.h>
       
    22 #include <eikcmobs.h>
       
    23 #include <barsread.h>
       
    24 #include <stringloader.h>
       
    25 #include <aknpopupfieldtext.h>
       
    26 #include <eikenv.h>
       
    27 #include <eikappui.h>
       
    28 #include <aknviewappui.h>
       
    29 #include <aknslidersettingpage.h> 
       
    30 #include <atconfigurationappgui.rsg>
       
    31 
       
    32 #include "atconfigurationappguisettingitemlist.h"
       
    33 #include "atconfigurationappguisettingitemlistsettings.h"
       
    34 #include "atconfigurationappgui.hrh"
       
    35 #include "atconfigurationappguisettingitemlist.hrh"
       
    36 #include "atconfigurationappguisettingitemlistview.h"
       
    37 #include "atlog.h"
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CATConfigurationAppGuiSettingItemList::CATConfigurationAppGuiSettingItemList()
       
    41 // Construct the CATConfigurationAppGuiSettingItemList instance.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CATConfigurationAppGuiSettingItemList::CATConfigurationAppGuiSettingItemList( 
       
    45         CATConfigurationAppGuiSettingItemListSettings& aSettings, 
       
    46         MEikCommandObserver* aCommandObserver )
       
    47     : iSettings( aSettings ), iCommandObserver( aCommandObserver )
       
    48     {
       
    49     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::CATConfigurationAppGuiSettingItemList()" );
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CATConfigurationAppGuiSettingItemList::~CATConfigurationAppGuiSettingItemList()
       
    54 // Destructor.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 CATConfigurationAppGuiSettingItemList::~CATConfigurationAppGuiSettingItemList()
       
    58     {
       
    59     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::~CATConfigurationAppGuiSettingItemList()" );
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CATConfigurationAppGuiSettingItemList::SizeChanged()
       
    64 // Handle system notification that the container's size has changed.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CATConfigurationAppGuiSettingItemList::SizeChanged()
       
    68     {
       
    69     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::SizeChanged()" );
       
    70     
       
    71     if ( ListBox() ) 
       
    72         {
       
    73         ListBox()->SetRect( Rect() );
       
    74         }
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CATConfigurationAppGuiSettingItemList::CreateSettingItemL()
       
    79 // Create one setting item at a time, identified by id.
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 CAknSettingItem* CATConfigurationAppGuiSettingItemList::CreateSettingItemL( 
       
    83 	TInt aId )
       
    84     {
       
    85     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::CreateSettingItemL()" );
       
    86     
       
    87     switch ( aId )
       
    88         {
       
    89         case EATConfigurationAppGuiSettingItemListViewBinarySetting1:
       
    90             {
       
    91             CAknBinaryPopupSettingItem* item = new ( ELeave ) 
       
    92                 CAknBinaryPopupSettingItem( 
       
    93                     aId,
       
    94                     iSettings.BinarySetting1() );
       
    95             return item;
       
    96             }
       
    97         case EATConfigurationAppGuiSettingItemListViewEnumeratedTextPopup1:
       
    98             {
       
    99             //CAknEnumeratedTextPopupSettingItem* item = new ( ELeave ) 
       
   100             //CAknEnumeratedTextPopupSettingItem( aId, iSettings.EnumeratedTextPopup1() );
       
   101             CAknTextSettingItem* item = new (ELeave) CAknTextSettingItem( aId, iSettings.EnumeratedTextPopup1() );
       
   102             return item;
       
   103             }
       
   104         }
       
   105         
       
   106     return NULL;
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CATConfigurationAppGuiSettingItemList::EditItemL()
       
   111 // Edit the setting item identified by the given id.
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 void CATConfigurationAppGuiSettingItemList::EditItemL ( TInt aIndex, 
       
   115 	TBool aCalledFromMenu )
       
   116     {
       
   117     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::EditItemL()" );
       
   118     
       
   119     CAknSettingItem* item = ( *SettingItemArray() )[aIndex];
       
   120 
       
   121     if ( ListBox()->CurrentItemIndex() == 1 )// Update interval
       
   122         {
       
   123         TInt setting( iSettings.UpdateInterval() );
       
   124         CAknSliderSettingPage* settPage = new (ELeave) CAknSliderSettingPage
       
   125                   ( R_ATCONFIGURATION_APP_GUI_SLIDER_SETTING_PAGE, setting );
       
   126         CleanupStack::PushL( settPage );
       
   127         
       
   128         TBool accepted = settPage ->ExecuteLD
       
   129             ( CAknSettingPage::EUpdateWhenChanged );
       
   130         
       
   131         if ( accepted )
       
   132             {
       
   133             iSettings.SetUpdateIntervalL( setting );    
       
   134             }
       
   135         CleanupStack::Pop( settPage );
       
   136         item->LoadL();
       
   137         item->UpdateListBoxTextL();
       
   138         }
       
   139     else
       
   140         {
       
   141         switch ( item->Identifier() )
       
   142             {
       
   143             }
       
   144         
       
   145         CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
       
   146 
       
   147         switch ( item->Identifier() )
       
   148             {
       
   149             }
       
   150 
       
   151         item->StoreL();
       
   152         SaveSettingValuesL();  
       
   153         }
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CATConfigurationAppGuiSettingItemList::ChangeSelectedItemL()
       
   158 // Handle the "Change" option on the Options menu.
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 void CATConfigurationAppGuiSettingItemList::ChangeSelectedItemL()
       
   162     {
       
   163     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::ChangeSelectedItemL()" );
       
   164     
       
   165     if ( ListBox()->CurrentItemIndex() >= 0 )
       
   166         {
       
   167         EditItemL( ListBox()->CurrentItemIndex(), ETrue );
       
   168         }
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CATConfigurationAppGuiSettingItemList::LoadSettingValuesL()
       
   173 // Load the initial contents of the setting items.
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 void CATConfigurationAppGuiSettingItemList::LoadSettingValuesL()
       
   177     {
       
   178     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::LoadSettingValuesL()" );
       
   179     // Load values into iSettings
       
   180     }
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // CATConfigurationAppGuiSettingItemList::SaveSettingValuesL()
       
   184 // Save the contents of the setting items.
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 void CATConfigurationAppGuiSettingItemList::SaveSettingValuesL()
       
   188     {
       
   189     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::SaveSettingValuesL()" );
       
   190     // Store values from iSettings
       
   191     }
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 // CATConfigurationAppGuiSettingItemList::HandleResourceChange()
       
   195 // Handle global resource changes.
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 void CATConfigurationAppGuiSettingItemList::HandleResourceChange( TInt aType )
       
   199     {
       
   200     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::HandleResourceChange()" );
       
   201     CAknSettingItemList::HandleResourceChange( aType );
       
   202     SetRect( iAvkonViewAppUi->View( TUid::Uid( EATConfigurationAppGuiSettingItemListViewId ) )->ClientRect() );
       
   203     }
       
   204                 
       
   205 // -----------------------------------------------------------------------------
       
   206 // CATConfigurationAppGuiSettingItemList::OfferKeyEventL()
       
   207 // Handle key event.
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 TKeyResponse CATConfigurationAppGuiSettingItemList::OfferKeyEventL( 
       
   211     const TKeyEvent& aKeyEvent, TEventCode aType )
       
   212     {
       
   213     LOGSTR1( "ATCU CATConfigurationAppGuiSettingItemList::OfferKeyEventL()" );
       
   214     
       
   215     if ( aKeyEvent.iCode == EKeyLeftArrow 
       
   216         || aKeyEvent.iCode == EKeyRightArrow )
       
   217         {
       
   218         // Allow the tab control to get the arrow keys
       
   219         return EKeyWasNotConsumed;
       
   220         }
       
   221 
       
   222     return CAknSettingItemList::OfferKeyEventL( aKeyEvent, aType );
       
   223     }
       
   224 
       
   225 // End of File