eventsui/eventsmgmtui/src/evtmgmtuiappui.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2008 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:  Application class for Events Management UI.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM FILES
       
    20 #include <avkon.hrh>
       
    21 #include <AknsConstants.h>
       
    22 #include <aknnotewrappers.h>
       
    23 #include <textresolver.h>
       
    24 #include <evtmgmtui.rsg>
       
    25 #include <eikspane.h> 		// Status pane
       
    26 #include <akntitle.h>   	// CAknTitlePane
       
    27 #include <StringLoader.h>
       
    28 #include <eikserverapp.h>
       
    29 #include <aknmessagequerydialog.h>
       
    30 #include <aknnotewrappers.h> 
       
    31 #include <evtmgmtui.rsg>
       
    32 
       
    33 // USER INCLUDES
       
    34 #include "evtmgmtuiappui.h"
       
    35 #include "evtmgmtui.hrh"
       
    36 #include "evtmgmtuistartupview.h"
       
    37 #include "evtmgmtuilegalnote.h"
       
    38 #include "evtdebug.h"
       
    39 
       
    40 // ----------------- Member funtions for CEvtMgmtUiAppUi ------------------------------
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // void CEvtMgmtUiAppUi::ConstructL
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 void CEvtMgmtUiAppUi::ConstructL()
       
    47     {
       
    48     EVTUIDEBUG( "=================================== EventsUi is launched ===========================" );
       
    49     
       
    50     
       
    51     BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
       
    52     MakeTitleL( R_EVTUI_TITLE );
       
    53     
       
    54     // Create the View object and add it to the View stack
       
    55     CEvtMgmtUiStartupView* startupview = CEvtMgmtUiStartupView::NewL();
       
    56     CleanupStack::PushL( startupview );  	
       
    57     AddViewL( startupview );
       
    58     CleanupStack::Pop( startupview );
       
    59     
       
    60     iLegalNote = CEvtMgmtUiLegalNote::NewL(*this);
       
    61     iLegalNote->DisplayNoteL();
       
    62 	
       
    63     EVTUIDEBUG( "CEvtMgmtUiAppUi::ConstructL() Ends" );
       
    64       
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CEvtMgmtUiAppUi::~CEvtMgmtUiAppUi
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CEvtMgmtUiAppUi::~CEvtMgmtUiAppUi()
       
    72     {
       
    73     delete iLegalNote;
       
    74     EVTUIDEBUG( "=================================== EventsUi is terminated ===========================" );
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // TKeyResponse CEvtMgmtUiAppUi::HandleKeyEventL
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 TKeyResponse CEvtMgmtUiAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/,
       
    82                                                      TEventCode /*aType*/ )
       
    83     {
       
    84     return EKeyWasNotConsumed;
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // void CEvtMgmtUiAppUi::HandleCommandL
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CEvtMgmtUiAppUi::HandleCommandL( TInt aCommand )
       
    92     {
       
    93     switch ( aCommand )
       
    94         {        
       
    95         case EAknSoftkeyExit:
       
    96         case EAknSoftkeyBack:
       
    97         case EEikCmdExit:
       
    98         	{
       
    99         	Exit();
       
   100             break;
       
   101         	}
       
   102         case EAknCmdExit:
       
   103             {
       
   104 			// The User has exited the application using the Exit option from
       
   105             //.Options menu.  But, thats possible only if we exit the application
       
   106             // with EAknCmdExit.
       
   107             // A bit of convoluted logic but needed because we are using the
       
   108             // same components for the Settings UI Server as well as LC.
       
   109 
       
   110            	CEikAppServer* server = iEikonEnv->AppServer();
       
   111 			if ( server )
       
   112 				{
       
   113 				server->NotifyServerExit(EAknCmdExit);
       
   114 				}            
       
   115             Exit();            
       
   116             break;
       
   117             }
       
   118        default: 
       
   119        	    { 	          	           	    
       
   120        	    break; 
       
   121        	    }
       
   122         }
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // void CEvtMgmtUiAppUi::MakeTitleL
       
   127 // ---------------------------------------------------------------------------
       
   128 //
       
   129 void CEvtMgmtUiAppUi::MakeTitleL( TInt aResourceText )
       
   130 	{
       
   131 	// Obtain the title from the Status Pane
       
   132 	CAknTitlePane* title = static_cast<CAknTitlePane*>( StatusPane()->
       
   133         ControlL( TUid::Uid( EEikStatusPaneUidTitle )));
       
   134        
       
   135     // Set the Title's buffer    
       
   136     HBufC* buf = StringLoader::LoadL( aResourceText );
       
   137     title->SetText( buf ); // Takes ownership of buf
       
   138 	}
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // CEikStatusPane* CEvtMgmtUiAppUi::StatusPane
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 CEikStatusPane* CEvtMgmtUiAppUi::StatusPane()
       
   145 	{
       
   146 	return iEikonEnv->AppUiFactory()->StatusPane();	
       
   147 	}
       
   148 	
       
   149 // End of File