Nokia N97 SDK
Example Applications Guide

SatelliteReferenceAppUi.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : SatelliteReferenceAppUi
00004 *  Part of     : Satellite Reference App
00005 *  Interface   : 
00006 *  Description : 
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2005-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 // INCLUDE FILES
00017 #include "SatelliteReferenceAppUi.h"
00018 #include "SatelliteReferenceContainer.h" 
00019 #include <SatelliteReference.rsg>
00020 #include "SatelliteReference.hrh"
00021 #include <StringLoader.h>
00022 
00023 #include <avkon.hrh>
00024 
00025 // ================= MEMBER FUNCTIONS =======================
00026 //
00027 // ----------------------------------------------------------
00028 // CSatelliteReferenceAppUi::ConstructL()
00029 // ----------------------------------------------------------
00030 //
00031 void CSatelliteReferenceAppUi::ConstructL()
00032     {
00033     //we have to enable MSK for 3.2
00034     BaseConstructL( EAknEnableSkin | EAknEnableMSK );
00035     iAppContainer = new (ELeave) CSatelliteReferenceContainer;
00036     iAppContainer->SetMopParent(this);
00037     iAppContainer->ConstructL( ClientRect(), this);
00038     AddToStackL( iAppContainer );
00039     }
00040 
00041 // ----------------------------------------------------
00042 // CSatelliteReferenceAppUi::~CSatelliteReferenceAppUi()
00043 // Destructor
00044 // Frees reserved resources
00045 // ----------------------------------------------------
00046 //
00047 CSatelliteReferenceAppUi::~CSatelliteReferenceAppUi()
00048     {
00049     if (iAppContainer)
00050         {
00051         RemoveFromStack( iAppContainer );
00052         delete iAppContainer;
00053         }
00054    }
00055 
00056 // ------------------------------------------------------------------------------
00057 //  CSatelliteReferenceAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
00058 //  This function is called by the EIKON framework just before it displays
00059 //  a menu pane. Its default implementation is empty, and by overriding it,
00060 //  the application can set the state of menu items dynamically according
00061 //  to the state of application data.
00062 // ------------------------------------------------------------------------------
00063 //
00064 void CSatelliteReferenceAppUi::DynInitMenuPaneL(
00065     TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
00066     {
00067     }
00068 
00069 // ----------------------------------------------------
00070 // CSatelliteReferenceAppUi::HandleKeyEventL(
00071 //     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
00072 // ----------------------------------------------------
00073 //
00074 TKeyResponse CSatelliteReferenceAppUi::HandleKeyEventL(
00075     const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
00076     {
00077     return EKeyWasNotConsumed;
00078     }
00079     
00080 // ------------------------------------------------------------------
00081 // CSatelliteReferenceAppUi::HandleForegroundEventL(TBool aForeground)
00082 // ------------------------------------------------------------------
00083 //
00084 void CSatelliteReferenceAppUi::HandleForegroundEventL(TBool aForeground)
00085         {
00086         if(iSatelliteInfo)      
00087                 {
00088                 iSatelliteInfo->HandleForegroundEventL(aForeground);                    
00089                 }
00090         }
00091 
00092 // ----------------------------------------------------
00093 // CSatelliteReferenceAppUi::HandleCommandL(TInt aCommand)
00094 // ----------------------------------------------------
00095 //
00096 void CSatelliteReferenceAppUi::HandleCommandL(TInt aCommand)
00097     {
00098     switch ( aCommand )
00099         {
00100         case EAknSoftkeyBack:
00101         case EAknSoftkeyExit:
00102         case EEikCmdExit:
00103             {
00104             Exit();
00105             break;
00106             }
00107             
00108         case ESatelliteInfoCmd:
00109                 {
00110                 HBufC* srvName = StringLoader::LoadLC( 
00111                                       R_SATREF_SERVICE_RULE_NAME, 
00112                                       CEikonEnv::Static() );
00113                 // Creating instance of CSatelliteInfo
00114                 iSatelliteInfo = CSatelliteInfoUI::NewL();
00115                 
00116                 //Setting the default satellite view as Firmament view 
00117                 iSatelliteInfo->SetLaunchView(CSatelliteInfoUI::ESatelliteFirmamentView);
00118                 
00119                 // ExecuteLD displays the satellite dialog.
00120                 // The dialog display satellite ID's along with 
00121                 // their signal strengths depicted using bar's.
00122                 iSatelliteInfo->ExecuteLD(*srvName);
00123                 
00124                 CleanupStack::PopAndDestroy(srvName); //srvName
00125                 iSatelliteInfo = NULL;
00126                 break;
00127                 }        
00128                         
00129         default:
00130                 {
00131                 break;
00132                 }            
00133         }
00134     }
00135 
00136 // End of File  

© Nokia 2009

Back to top