clock2/clockui/adtupdater/src/adtupdaterappui.cpp
branchRCL_3
changeset 66 bd7edf625bdd
child 67 1539a383d7b6
child 78 356f28cd5ca0
equal deleted inserted replaced
65:12af337248b1 66:bd7edf625bdd
       
     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:   This is the source file for the CAdtUpdaterAppUi class.
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <apgtask.h>
       
    20 #include <w32std.h>
       
    21 
       
    22 // User includes
       
    23 #include "adtupdaterappui.h"
       
    24 #include "adtupdatercontainer.h"
       
    25 #include "clock_debug.h"
       
    26 
       
    27 // Constants
       
    28 const TInt KOrdinalPosition( 0 );
       
    29 const TInt KOrdinalPriority( 0 );
       
    30 
       
    31 // Literals
       
    32 
       
    33 // ---------------------------------------------------------
       
    34 // CAdtUpdaterAppUi::CAdtUpdaterAppUi
       
    35 // rest of the details are commented in the header
       
    36 // ---------------------------------------------------------
       
    37 //
       
    38 CAdtUpdaterAppUi::CAdtUpdaterAppUi()
       
    39     {
       
    40 	__PRINTS( "CAdtUpdaterAppUi::CAdtUpdaterAppUi - Entry" );
       
    41 	
       
    42     // No implementation yet.
       
    43 	
       
    44 	__PRINTS( "CAdtUpdaterAppUi::CAdtUpdaterAppUi - Exit" );
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CAdtUpdaterAppUi::~CAdtUpdaterAppUi
       
    49 // rest of the details are commented in the header
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 CAdtUpdaterAppUi::~CAdtUpdaterAppUi()
       
    53     {
       
    54 	__PRINTS( "CAdtUpdaterAppUi::~CAdtUpdaterAppUi - Entry" );
       
    55 	
       
    56 	if( iContainer )
       
    57 		{	
       
    58         RemoveFromStack(iContainer);
       
    59 		delete iContainer;
       
    60 		iContainer = NULL;
       
    61 		}
       
    62 	
       
    63 	__PRINTS( "CAdtUpdaterAppUi::~CAdtUpdaterAppUi - Exit" );
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------
       
    67 // CAdtUpdaterAppUi::ConstructL
       
    68 // rest of the details are commented in the header
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 void CAdtUpdaterAppUi::ConstructL()
       
    72 	{
       
    73 	__PRINTS( "CAdtUpdaterAppUi::ConstructL - Entry" );
       
    74 	
       
    75 	//Single click integration
       
    76     BaseConstructL( EStandardApp | EAknEnableSkin | EAknEnableMSK |
       
    77             EAknSingleClickCompatible );
       
    78 
       
    79 	
       
    80 	// Sets the priority for window group
       
    81 	CEikonEnv &eikEnv = *CEikonEnv::Static();	
       
    82 	eikEnv.RootWin().SetOrdinalPosition( KOrdinalPosition, KOrdinalPriority );
       
    83 	
       
    84     // Disable priority changes of window server.
       
    85 	eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled );
       
    86 	
       
    87 	if( !iContainer )
       
    88 	    {	    	
       
    89 	    // Container is not present. Construct and add to the control stack.
       
    90 	    iContainer = CAdtUpdaterContainer::NewL( ApplicationRect() );
       
    91 	    	
       
    92 	    AddToStackL( iContainer );
       
    93 		// Get the Nitz information.
       
    94     	iContainer->InformAboutNwUpdateL();		    	  
       
    95 	    }         
       
    96 		
       
    97 	__PRINTS( "CAdtUpdaterAppUi::ConstructL - Exit" );
       
    98 	}
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // CAdtUpdaterAppUi::HandleCommandL
       
   102 // rest of the details are commented in the header
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 void CAdtUpdaterAppUi::HandleCommandL( TInt aCommandId )
       
   106     {
       
   107 	__PRINTS( "CAdtUpdaterAppUi::HandleCommandL - Entry" );
       
   108 	
       
   109     switch( aCommandId )
       
   110     	{
       
   111 	    case EEikCmdExit:
       
   112 	    case EAknCmdExit:
       
   113 	    	{
       
   114 	    	__PRINTS( "CAdtUpdaterAppUi::HandleCommandL - Exit" );
       
   115 	    	
       
   116 	    	Exit(); 	
       
   117 	    	}
       
   118 	    	break;
       
   119 	    	
       
   120     	default:
       
   121     		{
       
   122     		// No implementation yet.
       
   123     		}
       
   124     		break;    	
       
   125     	}
       
   126     
       
   127 	__PRINTS( "CAdtUpdaterAppUi::HandleCommandL - Exit" );
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------
       
   131 // CAdtUpdaterAppUi::HandleForegroundEventL
       
   132 // rest of the details are commented in the header
       
   133 // ---------------------------------------------------------
       
   134 //
       
   135 void CAdtUpdaterAppUi::HandleForegroundEventL( TBool aForeground )
       
   136 	{
       
   137 	__PRINTS( "CAdtUpdaterAppUi::HandleForegroundEventL - Entry" );
       
   138 	
       
   139 	if( !aForeground && iContainer->QueryDialogsInDisplay() )
       
   140 		{
       
   141 		ToggleAppViewL( ETrue );
       
   142 		}
       
   143 	
       
   144 	__PRINTS( "CAdtUpdaterAppUi::HandleForegroundEventL - Exit" );
       
   145 	}
       
   146 
       
   147 // ---------------------------------------------------------
       
   148 // CAdtUpdaterAppUi::ToggleAppViewL
       
   149 // rest of the details are commented in the header
       
   150 // ---------------------------------------------------------
       
   151 //
       
   152 void CAdtUpdaterAppUi::ToggleAppViewL( TBool aForeground )
       
   153 	{
       
   154 	__PRINTS( "CCAdtUpdaterAppUi::ToggleAppViewL - Entry" );
       
   155 	
       
   156 	// Construct en empty TApaTask object.
       
   157 	// Giving it a reference to the Window Server session.
       
   158 	TApaTask task( iEikonEnv->WsSession( ) );
       
   159 	               
       
   160 	// Initialise the object with the window group id of
       
   161 	// our application (so that it represent our app).
       
   162 	task.SetWgId( CEikonEnv::Static()->RootWin().Identifier() );
       
   163 
       
   164 	if( aForeground )
       
   165 		{
       
   166 		__PRINTS( "Bringing application to foreground" );
       
   167 		
       
   168 		// Request window server to bring our application to foreground.
       
   169 		task.BringToForeground(); 		
       
   170 		}
       
   171 	else
       
   172 		{
       
   173 		__PRINTS( "Sending application to background" );
       
   174 		
       
   175 		// Request window server to send our application to background.
       
   176 		task.SendToBackground(); 	
       
   177 		}
       
   178 	
       
   179 	__PRINTS( "CAdtUpdaterAppUi::ToggleAppViewL - Exit" );
       
   180 	}
       
   181 
       
   182 // ---------------------------------------------------------
       
   183 // CAdtUpdaterAppView::HideStatusPane
       
   184 // rest of the details are commented in the header
       
   185 // ---------------------------------------------------------
       
   186 //
       
   187 void CAdtUpdaterAppUi::HideStatusPane( TBool aHide )
       
   188 	{
       
   189 	__PRINTS( "CAdtUpdaterAppUi::HideStatusPane - Entry" );
       
   190 	
       
   191 	if( aHide )
       
   192 		{
       
   193 		// Hide the status pane.
       
   194 		CEikStatusPane* statusPane = StatusPane();
       
   195 		statusPane->MakeVisible( EFalse );
       
   196 		}
       
   197 	
       
   198 	__PRINTS( "CAdtUpdaterAppUi::HideStatusPane - Exit" );
       
   199 	}
       
   200 
       
   201 // End of file