locationsatviewrefapp/src/SatelliteReferenceAppUi.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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 /*
       
    19 * ============================================================================
       
    20 *  Name     : SatelliteReferenceAppUi
       
    21 *  Part of  : Satellite Reference App
       
    22 * ============================================================================
       
    23 */
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include "SatelliteReferenceAppUi.h"
       
    27 #include "SatelliteReferenceContainer.h" 
       
    28 #include <satellitereference.rsg>
       
    29 #include "SatelliteReference.hrh"
       
    30 #include <StringLoader.h>
       
    31 
       
    32 #include <avkon.hrh>
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================
       
    35 //
       
    36 // ----------------------------------------------------------
       
    37 // CSatelliteReferenceAppUi::ConstructL()
       
    38 // ----------------------------------------------------------
       
    39 //
       
    40 void CSatelliteReferenceAppUi::ConstructL()
       
    41     {
       
    42     //we hae to enable MSK for 3.2
       
    43     BaseConstructL( EAknEnableMSK );
       
    44     iAppContainer = new (ELeave) CSatelliteReferenceContainer;
       
    45     iAppContainer->SetMopParent(this);
       
    46     iAppContainer->ConstructL( ClientRect(), this);
       
    47     AddToStackL( iAppContainer );
       
    48     }
       
    49 
       
    50 // ----------------------------------------------------
       
    51 // CSatelliteReferenceAppUi::~CSatelliteReferenceAppUi()
       
    52 // Destructor
       
    53 // Frees reserved resources
       
    54 // ----------------------------------------------------
       
    55 //
       
    56 CSatelliteReferenceAppUi::~CSatelliteReferenceAppUi()
       
    57     {
       
    58     if (iAppContainer)
       
    59         {
       
    60         RemoveFromStack( iAppContainer );
       
    61         delete iAppContainer;
       
    62         }
       
    63    }
       
    64 
       
    65 // ------------------------------------------------------------------------------
       
    66 //  CSatelliteReferenceAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
    67 //  This function is called by the EIKON framework just before it displays
       
    68 //  a menu pane. Its default implementation is empty, and by overriding it,
       
    69 //  the application can set the state of menu items dynamically according
       
    70 //  to the state of application data.
       
    71 // ------------------------------------------------------------------------------
       
    72 //
       
    73 void CSatelliteReferenceAppUi::DynInitMenuPaneL(
       
    74     TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
       
    75     {
       
    76     }
       
    77 
       
    78 // ----------------------------------------------------
       
    79 // CSatelliteReferenceAppUi::HandleKeyEventL(
       
    80 //     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
       
    81 // ----------------------------------------------------
       
    82 //
       
    83 TKeyResponse CSatelliteReferenceAppUi::HandleKeyEventL(
       
    84     const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
       
    85     {
       
    86     return EKeyWasNotConsumed;
       
    87     }
       
    88     
       
    89 // ------------------------------------------------------------------
       
    90 // CSatelliteReferenceAppUi::HandleForegroundEventL(TBool aForeground)
       
    91 // ------------------------------------------------------------------
       
    92 //
       
    93 void CSatelliteReferenceAppUi::HandleForegroundEventL(TBool aForeground)
       
    94 	{
       
    95 	if(iSatelliteInfo)	
       
    96 		{
       
    97 		iSatelliteInfo->HandleForegroundEventL(aForeground);			
       
    98 		}
       
    99 	}
       
   100 
       
   101 // ----------------------------------------------------
       
   102 // CSatelliteReferenceAppUi::HandleCommandL(TInt aCommand)
       
   103 // ----------------------------------------------------
       
   104 //
       
   105 void CSatelliteReferenceAppUi::HandleCommandL(TInt aCommand)
       
   106     {
       
   107     switch ( aCommand )
       
   108         {
       
   109         case EAknSoftkeyBack:
       
   110         case EAknSoftkeyExit:
       
   111         case EEikCmdExit:
       
   112             {
       
   113             Exit();
       
   114             break;
       
   115             }
       
   116             
       
   117         case ESatelliteInfoCmd:
       
   118 	        {
       
   119 	        HBufC* srvName = StringLoader::LoadLC( 
       
   120 	                              R_SATREF_SERVICE_RULE_NAME, 
       
   121 	                              CEikonEnv::Static() );
       
   122 	        // Creating instance of CSatelliteInfo
       
   123 	    	iSatelliteInfo = CSatelliteInfoUI::NewL();
       
   124 	    	
       
   125 	    	//Setting the default satellite view as Firmament view 
       
   126 	    	iSatelliteInfo->SetLaunchView(CSatelliteInfoUI::ESatelliteFirmamentView);
       
   127 	    	
       
   128 	    	// ExecuteLD displays the satellite dialog.
       
   129 	    	// The dialog display satellite ID's along with 
       
   130 	    	// their signal strengths depicted using bar's.
       
   131 	    	iSatelliteInfo->ExecuteLD(*srvName);
       
   132 	    	
       
   133 	    	CleanupStack::PopAndDestroy(srvName); //srvName
       
   134 	    	iSatelliteInfo = NULL;
       
   135 	    	break;
       
   136 	        }        
       
   137 	        	
       
   138         default:
       
   139 	        {
       
   140 	        break;
       
   141 	        }            
       
   142         }
       
   143     }
       
   144 
       
   145 // End of File