dbgagents/trkagent/app/s60/TrkSettingsView.cpp
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     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 FILES
       
    19 #include <AknUtils.h>
       
    20 #include "TrkAppUi.h"
       
    21 
       
    22 #include <trkapp_200170bb.rsg>
       
    23 
       
    24 #include "TrkApp.hrh"
       
    25 #include "TrkUids.h"
       
    26 #include "TrkSettingsContainer.h"
       
    27 #include "TrkSettingsData.h"
       
    28 #include "TrkSettingsView.h"
       
    29 
       
    30 
       
    31 // ========================= MEMBER FUNCTIONS ================================
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // CTrkSettingsView::CTrkSettingsView
       
    35 // C++ constructor
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CTrkSettingsView::CTrkSettingsView(CTrkSettingsData* aSettingsData)
       
    39 : iSettingsData(aSettingsData)
       
    40 {
       
    41 }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // CTrkSettingsView.::NewLC
       
    46 // Symbian OS two-phased constructor.
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CTrkSettingsView* CTrkSettingsView::NewL(CTrkSettingsData* aSettingsData)
       
    50 {
       
    51     CTrkSettingsView* self = new (ELeave) CTrkSettingsView(aSettingsData);
       
    52     self->ConstructL();
       
    53 
       
    54     return self;
       
    55 }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CTrkSettingsView::ConstructL
       
    60 // Symbian OS 2nd phase constructor
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 void CTrkSettingsView::ConstructL()
       
    64 {
       
    65     BaseConstructL(R_TRKSETTINGS_VIEW);
       
    66 }
       
    67 
       
    68 
       
    69 // Destructor
       
    70 CTrkSettingsView::~CTrkSettingsView()
       
    71 {
       
    72     if (iContainer)
       
    73 	{
       
    74         AppUi()->RemoveFromStack(iContainer);
       
    75         delete iContainer;
       
    76         iContainer = NULL;
       
    77 	}
       
    78 }
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CTrkSettingsView::Id
       
    83 // From CAknView, returns Uid of View
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 TUid CTrkSettingsView::Id() const
       
    87 {
       
    88     return KUidTrkConnSettingsView;
       
    89 }
       
    90 
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CTrkSettingsView::HandleCommandL
       
    94 // From MEikMenuObserver delegate commands from the menu
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CTrkSettingsView::HandleCommandL(TInt aCommand)
       
    98 {
       
    99     switch (aCommand)
       
   100 	{
       
   101         case ETrkCmdChange:
       
   102 		{
       
   103             iContainer->EditCurrentL();
       
   104             break;
       
   105 		}
       
   106         case EAknSoftkeyBack:
       
   107 		{
       
   108 			if (iContainer)
       
   109 			{
       
   110 				iContainer->SaveSettingsL();
       
   111 			}
       
   112             AppUi()->ActivateLocalViewL(KUidTrkAppView);
       
   113             break;
       
   114 		}
       
   115 
       
   116         default:
       
   117 		{
       
   118             AppUi()->HandleCommandL( aCommand );
       
   119             break;
       
   120 		}
       
   121  	}
       
   122 }
       
   123 
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // CTrkSettingsView::DoActivateL
       
   127 // Activate this view
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CTrkSettingsView::DoActivateL( const TVwsViewId& /* aPrevViewId */,
       
   131                                           TUid /*aCustomMessageId*/,
       
   132                                           const TDesC8& /*aCustomMessage*/ )
       
   133 {
       
   134 
       
   135     if (!iContainer)
       
   136 	{
       
   137         iContainer = new (ELeave) CTrkSettingsContainer(iSettingsData);
       
   138         iContainer->SetMopParent( this );
       
   139         iContainer->ConstructL(ClientRect());
       
   140         AppUi()->AddToStackL( *this, iContainer );
       
   141         iContainer->ActivateL();
       
   142 	}
       
   143 	
       
   144 }
       
   145 
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // CTrkSettingsView::DoDeactivate
       
   149 // Deactivate this view
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 void CTrkSettingsView::DoDeactivate()
       
   153 {
       
   154     if (iContainer)
       
   155 	{   
       
   156         AppUi()->RemoveFromStack(iContainer);
       
   157         delete iContainer;
       
   158         iContainer = NULL;
       
   159 	}
       
   160 }
       
   161 
       
   162 
       
   163 // ---------------------------------------------------------------------------
       
   164 // CTrkSettingsView::DynInitMenuPaneL
       
   165 // Dynamically customize menu items
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 void CTrkSettingsView::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/)
       
   169 {
       
   170 }
       
   171 
       
   172 
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CTrkSettingsView::HandleSizeChange
       
   176 // Handle screen size change.
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 void CTrkSettingsView::HandleSizeChange()
       
   180 {
       
   181     if (iContainer)
       
   182 	{
       
   183 		TRect mainPaneRect;
       
   184      	AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
       
   185 		iContainer->SetRect(mainPaneRect);
       
   186     }
       
   187 }
       
   188 
       
   189 /** 
       
   190  * Handle status pane size change for this view (override)
       
   191  */
       
   192 void CTrkSettingsView::HandleStatusPaneSizeChange()
       
   193 {
       
   194 	CAknView::HandleStatusPaneSizeChange();
       
   195 }
       
   196 
       
   197 
       
   198 // End of File