landmarksui/app/src/CLmkBaseView.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2002 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:    LandmarksUi Content File -    Provides LM main view class methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 // INCLUDE FILES
       
    25 #include "CLmkBaseView.h"
       
    26 #include "CLmkBaseContainer.h"
       
    27 #include "landmarks.hrh"
       
    28 #include <aknlists.h>
       
    29 #include <aknViewAppUi.h>
       
    30 #include <AknQueryDialog.h>
       
    31 #include <featmgr.h>
       
    32 #include <StringLoader.h>
       
    33 #include <eikmenub.h> // CEikMenuBar
       
    34 #include <landmarks.rsg>
       
    35 #include "clmkmapnavigationinterface.h"
       
    36 #include <locationvariationdomaincrkeys.h>
       
    37 #include <centralrepository.h>
       
    38 
       
    39 // ================= MEMBER FUNCTIONS =======================
       
    40 
       
    41 // ---------------------------------------------------------
       
    42 // CLmkBaseView::ConstructL
       
    43 // ---------------------------------------------------------
       
    44 //
       
    45 CLmkBaseView::CLmkBaseView( MLmkKeyProcessor& aKeyProcessor )
       
    46         : iKeyProcessor( aKeyProcessor )
       
    47     {
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // CLmkBaseView::BaseConstructL
       
    52 // Symbian 2nd phase constructor can leave.
       
    53 // ---------------------------------------------------------
       
    54 //
       
    55 void CLmkBaseView::BaseConstructL( TInt aResId )
       
    56     {
       
    57     FeatureManager::InitializeLibL();
       
    58     CAknView::BaseConstructL( aResId );
       
    59 	
       
    60     // Check if the Coordinates has to be hidden
       
    61 	CheckHideCoordinateL();
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------
       
    65 // CLmkBaseView::~CLocBaseView()
       
    66 // ---------------------------------------------------------
       
    67 //
       
    68 CLmkBaseView::~CLmkBaseView()
       
    69     {
       
    70     if ( iBaseContainer )
       
    71         {
       
    72         AppUi()->RemoveFromViewStack( *this, iBaseContainer );
       
    73         }
       
    74     delete iBaseContainer;
       
    75     FeatureManager::UnInitializeLib();
       
    76     if(iMapNavInterface)
       
    77     	{
       
    78     	iMapNavInterface->Release();
       
    79     	}
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CLmkBaseView::ProcessKeyEventL
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 TBool CLmkBaseView::ProcessKeyEventL( const TKeyEvent& aKeyEvent,
       
    87                                       TEventCode aType )
       
    88     {
       
    89     return iKeyProcessor.ProcessKeyEventL( aKeyEvent, aType );
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // CLmkBaseView::TabObserver()
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 MAknTabObserver* CLmkBaseView::TabObserver()
       
    97     {
       
    98     return iKeyProcessor.TabObserver();
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------
       
   102 // CLmkBaseView::HandleHelpFeature
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 void CLmkBaseView::HandleHelpFeature( CEikMenuPane* aMenuPane ) const
       
   106     {
       
   107     if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) &&
       
   108             !iIsHideHelp )
       
   109         {
       
   110         aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   111         }
       
   112     else
       
   113         {
       
   114         aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   115         }
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------
       
   119 // CLmkBaseView::CheckHideCoordinateL()
       
   120 // ---------------------------------------------------------
       
   121 //
       
   122 void CLmkBaseView::CheckHideCoordinateL()
       
   123 	{
       
   124     TInt coordinateSettingValue = ELocCoordinatesNotHidden;
       
   125     TInt helpSettingValue = ELocHelpNotHidden;
       
   126     CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidLocLocalVariation) );
       
   127     CleanupStack::PushL( repository );
       
   128     User::LeaveIfError( repository->Get( KLocHideCoordinates,
       
   129                                               coordinateSettingValue ));  
       
   130     User::LeaveIfError( repository->Get( KLocHideHelp,
       
   131                                               helpSettingValue ));  
       
   132     CleanupStack::PopAndDestroy( repository );
       
   133 	
       
   134 	if( ELocCoordinatesHidden == coordinateSettingValue )
       
   135 		iIsHideCoordinate = ETrue;
       
   136 	else
       
   137 		iIsHideCoordinate = EFalse;
       
   138 	
       
   139 	if( ELocHelpHidden == helpSettingValue )
       
   140 		iIsHideHelp = ETrue;
       
   141 	else
       
   142 		iIsHideHelp = EFalse;
       
   143 	
       
   144 	}
       
   145 
       
   146 // ---------------------------------------------------------
       
   147 // CLmkBaseView::Update()
       
   148 // ---------------------------------------------------------
       
   149 //
       
   150 void CLmkBaseView::Update()
       
   151 	{
       
   152 	//base class do not have any implementation logic
       
   153 	}
       
   154 
       
   155 // ---------------------------------------------------------
       
   156 // CLmkBaseView::EnableMskMenuL()
       
   157 // ---------------------------------------------------------
       
   158 //
       
   159 void CLmkBaseView::EnableMskMenuL(TBool /*aEnable*/)
       
   160 	{
       
   161 	//base class do not have any implementation logic
       
   162 	}
       
   163 
       
   164 // ---------------------------------------------------------
       
   165 // CLmkBaseView::EnableMskLabelL()
       
   166 // ---------------------------------------------------------
       
   167 //
       
   168 void CLmkBaseView::EnableMskLabelL(TBool /*aEnable*/)
       
   169 	{
       
   170 	//base class do not have any implementation logic
       
   171 	}
       
   172 
       
   173 // ---------------------------------------------------------
       
   174 // CLmkBaseView::UpdateMskViewL()
       
   175 // ---------------------------------------------------------
       
   176 //
       
   177 void CLmkBaseView::UpdateMskViewL(TLmkMskDispItem aMskDispItem)
       
   178 	{
       
   179 	switch(aMskDispItem)
       
   180 		{
       
   181 		case EContextMenu:
       
   182 			{
       
   183 			EnableMskMenuL(ETrue);
       
   184 			break;
       
   185 			}
       
   186 		case ELabel:
       
   187 			{
       
   188 			EnableMskLabelL(ETrue);
       
   189 			break;
       
   190 			}
       
   191 		case ENoMsk:
       
   192 			{
       
   193 			EnableMskMenuL(EFalse);
       
   194 			EnableMskLabelL(EFalse);
       
   195 			break;
       
   196 			}
       
   197 		default:
       
   198 		    User::Leave(KErrGeneral);
       
   199 			break;
       
   200 		}
       
   201 	}
       
   202 
       
   203 #ifdef RD_SCALABLE_UI_V2
       
   204 // ---------------------------------------------------------
       
   205 // CLmkBaseView::HandleListBoxEventL()
       
   206 // ---------------------------------------------------------
       
   207 //
       
   208 void CLmkBaseView::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent /*aEventType*/ )
       
   209 	{
       
   210 	//does nothing
       
   211 	}
       
   212 #endif//RD_SCALABLE_UI_V2
       
   213 // End of File