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