locationsatviewrefapp/src/SatelliteReferenceAppUi.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 09:48:36 +0300
branchRCL_3
changeset 16 8173571d354e
parent 0 522cd55cc3d7
permissions -rw-r--r--
Revision: 201030 Kit: 201033

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/

/*
* ============================================================================
*  Name     : SatelliteReferenceAppUi
*  Part of  : Satellite Reference App
* ============================================================================
*/

// INCLUDE FILES
#include "SatelliteReferenceAppUi.h"
#include "SatelliteReferenceContainer.h" 
#include <satellitereference.rsg>
#include "SatelliteReference.hrh"
#include <StringLoader.h>

#include <avkon.hrh>

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CSatelliteReferenceAppUi::ConstructL()
// ----------------------------------------------------------
//
void CSatelliteReferenceAppUi::ConstructL()
    {
    //we hae to enable MSK for 3.2
    BaseConstructL( EAknEnableMSK );
    iAppContainer = new (ELeave) CSatelliteReferenceContainer;
    iAppContainer->SetMopParent(this);
    iAppContainer->ConstructL( ClientRect(), this);
    AddToStackL( iAppContainer );
    }

// ----------------------------------------------------
// CSatelliteReferenceAppUi::~CSatelliteReferenceAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CSatelliteReferenceAppUi::~CSatelliteReferenceAppUi()
    {
    if (iAppContainer)
        {
        RemoveFromStack( iAppContainer );
        delete iAppContainer;
        }
   }

// ------------------------------------------------------------------------------
//  CSatelliteReferenceAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
//  This function is called by the EIKON framework just before it displays
//  a menu pane. Its default implementation is empty, and by overriding it,
//  the application can set the state of menu items dynamically according
//  to the state of application data.
// ------------------------------------------------------------------------------
//
void CSatelliteReferenceAppUi::DynInitMenuPaneL(
    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
    {
    }

// ----------------------------------------------------
// CSatelliteReferenceAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// ----------------------------------------------------
//
TKeyResponse CSatelliteReferenceAppUi::HandleKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    return EKeyWasNotConsumed;
    }
    
// ------------------------------------------------------------------
// CSatelliteReferenceAppUi::HandleForegroundEventL(TBool aForeground)
// ------------------------------------------------------------------
//
void CSatelliteReferenceAppUi::HandleForegroundEventL(TBool aForeground)
	{
	if(iSatelliteInfo)	
		{
		iSatelliteInfo->HandleForegroundEventL(aForeground);			
		}
	}

// ----------------------------------------------------
// CSatelliteReferenceAppUi::HandleCommandL(TInt aCommand)
// ----------------------------------------------------
//
void CSatelliteReferenceAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
        case EAknSoftkeyExit:
        case EEikCmdExit:
            {
            Exit();
            break;
            }
            
        case ESatelliteInfoCmd:
	        {
	        HBufC* srvName = StringLoader::LoadLC( 
	                              R_SATREF_SERVICE_RULE_NAME, 
	                              CEikonEnv::Static() );
	        // Creating instance of CSatelliteInfo
	    	iSatelliteInfo = CSatelliteInfoUI::NewL();
	    	
	    	//Setting the default satellite view as Firmament view 
	    	iSatelliteInfo->SetLaunchView(CSatelliteInfoUI::ESatelliteFirmamentView);
	    	
	    	// ExecuteLD displays the satellite dialog.
	    	// The dialog display satellite ID's along with 
	    	// their signal strengths depicted using bar's.
	    	iSatelliteInfo->ExecuteLD(*srvName);
	    	
	    	CleanupStack::PopAndDestroy(srvName); //srvName
	    	iSatelliteInfo = NULL;
	    	break;
	        }        
	        	
        default:
	        {
	        break;
	        }            
        }
    }

// End of File