clock2/clockui/uilayer/src/clockappui.cpp
changeset 0 f979ecb2b13e
child 14 21239b3bcd78
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 CClockAppUi class.
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <e32base.h>
       
    20 #include <avkon.hrh>
       
    21 #include <avkon.rsg>
       
    22 #include <bacntf.h>
       
    23 #include <clock.rsg>
       
    24 #include <akntitle.h>
       
    25 #include <akntabgrp.h>
       
    26 #include <aknnavide.h>
       
    27 #include <clockapp_tab.mbg>
       
    28 #include <AknsConstants.h>
       
    29 #include <featmgr.h>  
       
    30 
       
    31 // User includes
       
    32 #include "clock.h"
       
    33 #include "clockappui.h"
       
    34 #include "clockmainview.h"
       
    35 #include "clockworldview.h"
       
    36 #include "clkdatetimeview.h"
       
    37 #include "clkuialarmmodel.h"
       
    38 #include "clockdocument.h"
       
    39 #include "clock.hrh"
       
    40 #include "clkdatetimeview.hrh"
       
    41 #include "clock_debug.h"
       
    42 
       
    43 // Constants
       
    44 const TInt KClockNotiferPriority( CActive::EPriorityIdle );
       
    45 const TInt KMaxTitleLength( 64 );
       
    46 const TInt KInitialEvent( EChangesLocale |
       
    47                           EChangesMidnightCrossover |
       
    48                           EChangesThreadDeath |
       
    49                           EChangesPowerStatus |
       
    50                           EChangesSystemTime |
       
    51                           EChangesFreeMemory |
       
    52                           EChangesOutOfMemory );
       
    53 
       
    54 // Literals
       
    55 _LIT( KIconFileName, "\\resource\\apps\\clockapp_tab.mif" );
       
    56 _LIT( KIAParamExec, "clock.exe" );
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CClockAppUi::CClockAppUi
       
    60 // rest of the details are commented in the header
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 CClockAppUi::CClockAppUi()
       
    64     {
       
    65     // No implementation yet.
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CClockAppUi::~CClockAppUi
       
    70 // rest of the details are commented in the header
       
    71 // ---------------------------------------------------------
       
    72 //
       
    73 CClockAppUi::~CClockAppUi()
       
    74     {
       
    75     // No more observing tab change events.
       
    76     if( iTabGroup )
       
    77         {
       
    78         iTabGroup->SetObserver( NULL );
       
    79         }
       
    80     if( iEnvChangeNotifier )
       
    81         {
       
    82         delete iEnvChangeNotifier;
       
    83         iEnvChangeNotifier = NULL;
       
    84         }
       
    85     if( iNavigationDecorator )
       
    86         {
       
    87         delete iNavigationDecorator;
       
    88         iNavigationDecorator = NULL;
       
    89         }
       
    90     // These should be deleted already when they are not needed any more, otherwise
       
    91        // the client-server connection is kept open.
       
    92        // These are here just in case they were not deleted earlier.
       
    93     if( iUpdate )
       
    94         {
       
    95         delete iUpdate;
       
    96         iUpdate = NULL;
       
    97         }
       
    98     if( iParameters )
       
    99         {
       
   100         delete iParameters;
       
   101         iParameters = NULL;
       
   102         }
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CClockAppUi::ConstructL
       
   107 // rest of the details are commented in the header
       
   108 // ---------------------------------------------------------
       
   109 //
       
   110 void CClockAppUi::ConstructL()
       
   111 	{
       
   112 	//single click integration
       
   113     BaseConstructL( EAknEnableMSK | EAknEnableSkin |
       
   114             EAknSingleClickCompatible );
       
   115 
       
   116 	
       
   117 	iIADUpdateFlag = ETrue;
       
   118 	
       
   119 	// Get the alarm model.
       
   120 	CClkUiAlarmModel* alarmModel = static_cast< CClockDocument* > ( Document() )->AlarmModel();
       
   121 	
       
   122 	// Construct the view and add it to the view server stack.
       
   123 	CClockMainView* clockMainView = CClockMainView::NewL( alarmModel );
       
   124 	AddViewL( clockMainView );
       
   125 	
       
   126 	// Construct the world view and add it to the view server stack.
       
   127 	CClockWorldView* clockWorldView = CClockWorldView::NewL();
       
   128 	AddViewL( clockWorldView );
       
   129 	
       
   130 	// Construct the datetime settings view.
       
   131     CClkDateTimeView* dateTimeView = CClkDateTimeView::NewLC( KClockAppMainViewId, ETrue );
       
   132     AddViewL( dateTimeView );
       
   133     CleanupStack::Pop( dateTimeView );
       
   134 	
       
   135 	// Start the model.
       
   136 	alarmModel->Start();
       
   137 	
       
   138 	// Construct and start the environment change notifier.
       
   139 	TCallBack callBack( NotifierCallbackL, this );
       
   140 	iEnvChangeNotifier = CEnvironmentChangeNotifier::NewL( KClockNotiferPriority, callBack );
       
   141 	if( !iEnvChangeNotifier->IsActive() )
       
   142 	    {
       
   143 	    iEnvChangeNotifier->Start();
       
   144 	    }
       
   145 	
       
   146 	// Set the above view as default.
       
   147 	SetDefaultViewL( *clockMainView );
       
   148 	
       
   149     // Setup Navigation Pane.
       
   150     SetupNavigationPaneL();
       
   151 	
       
   152 	// Clock is one of the applications which is launched in the phone boot and it runs in background. If thats the case,
       
   153 	// the view is not activated when it is in background and it happens when clock is opened for the first time.
       
   154 	// If the app is in background, we activate the main view here to ensure faster bootup when the application is opened for the first time.
       
   155 	if( !IsForeground() )
       
   156 		{
       
   157 		if( ExitHidesInBackground() )
       
   158 			{
       
   159 			// First hide application in the background.
       
   160             HideInBackground();
       
   161             // Set a flag indicating that the app is hidden.
       
   162             SetAppHidden( ETrue );
       
   163             // Prevent the control from getting displayed immediately.
       
   164             SetCustomControl( 1 );
       
   165             // Reset to initial state
       
   166             ResetToInitialStateL();
       
   167             // This allows the prevented control to be displayed after the application is
       
   168             // reopened.
       
   169             // SetCustomControl( 0 );
       
   170 			}
       
   171 		}
       
   172 	}
       
   173 
       
   174 // ---------------------------------------------------------
       
   175 // CClockAppUi::NotifierCallbackL
       
   176 // rest of the details are commented in the header
       
   177 // ---------------------------------------------------------
       
   178 //
       
   179 TInt CClockAppUi::NotifierCallbackL( TAny* aPtr )
       
   180     {
       
   181     // Get the this object.
       
   182     CClockAppUi* self = static_cast< CClockAppUi* >( aPtr );
       
   183     
       
   184     // Get the changes in environment.
       
   185     TInt envChanges( self->iEnvChangeNotifier->Change() );
       
   186     
       
   187     if( KInitialEvent <= envChanges )
       
   188         {
       
   189         // We're not concerned about handling environment changes in that range.
       
   190         return FALSE;
       
   191         }
       
   192     
       
   193     if( envChanges & ( EChangesMidnightCrossover |
       
   194                        EChangesLocale |
       
   195                        EChangesSystemTime ) )
       
   196         {
       
   197         // We have to handle one of these changes.
       
   198         self->HandleEnvChangeL( EEnvChanged );
       
   199         }
       
   200     
       
   201     return FALSE;
       
   202     }
       
   203 
       
   204 // ---------------------------------------------------------
       
   205 // CClockAppUi::HandleCommandL
       
   206 // rest of the details are commented in the header
       
   207 // ---------------------------------------------------------
       
   208 //
       
   209 void CClockAppUi::HandleCommandL( TInt aCommandId )
       
   210     {
       
   211     switch( aCommandId )
       
   212     	{
       
   213     	case EClockSettings:
       
   214     	    {
       
   215     	    // Open datetime settings view
       
   216     	    OpenSettingsViewL();
       
   217     	    }
       
   218     	    break;
       
   219     	    
       
   220     	case EClockMainViewExit:
       
   221     	case EClockWorldExit:
       
   222     	case EClkSettExitCmd:
       
   223     	case EClockAlarmExit:
       
   224     	case EAknSoftkeyExit:
       
   225     	    {
       
   226     	    if( ExitHidesInBackground() )
       
   227     	        {
       
   228     	        HandleCommandL( EAknCmdHideInBackground );
       
   229     	        }
       
   230     	    else
       
   231     	        {
       
   232     	        Exit();
       
   233     	        }
       
   234     	    }
       
   235     	    break;
       
   236     	    
       
   237     	case EAknCmdHideInBackground:
       
   238     	    {
       
   239     	    // First hide application in the background.
       
   240             HideInBackground();
       
   241             // Set a flag indicating that the app is hidden.
       
   242             SetAppHidden( ETrue );
       
   243             
       
   244             iIADUpdateFlag = ETrue;
       
   245             // Prevent the control from getting displayed immediately.
       
   246             SetCustomControl( 1 );
       
   247             // Reset to initial state
       
   248             ResetToInitialStateL();
       
   249 
       
   250     	    }
       
   251     	    break;
       
   252     	    
       
   253     	case EEikCmdExit:
       
   254         case EAknCmdExit:
       
   255             {
       
   256             iIADUpdateFlag = ETrue;
       
   257             
       
   258             // In these two cases, we do a hard exit i.e., we close the application.
       
   259             Exit();
       
   260             }
       
   261     	
       
   262     	default:
       
   263     		{
       
   264     		// No implementation yet.
       
   265     		}
       
   266     		break;
       
   267     	}
       
   268     }
       
   269 
       
   270 // ---------------------------------------------------------
       
   271 // CClockAppUi::TabChangedL
       
   272 // rest of the details are commented in the header
       
   273 // ---------------------------------------------------------
       
   274 //
       
   275 void CClockAppUi::TabChangedL( TInt aTabIndex )
       
   276     {
       
   277     TInt activeTabId( iTabGroup->TabIdFromIndex( aTabIndex ) );
       
   278     
       
   279     // Switch on the active tab id and activate the corresponding view.
       
   280     switch( activeTabId )
       
   281         {
       
   282         case EClockAppMainViewId:
       
   283             {
       
   284             // The main view.
       
   285             ActivateLocalViewL( KClockAppMainViewId );
       
   286             }
       
   287             break;
       
   288         
       
   289         case EClockAppWorldViewId:
       
   290             {
       
   291             // The clockworld view.
       
   292             ActivateLocalViewL( KClockAppWorldViewId );
       
   293             }
       
   294             break;
       
   295                     
       
   296         default:
       
   297             {
       
   298             // No implementaiton yet.
       
   299             }
       
   300             break;
       
   301         }
       
   302     }
       
   303 
       
   304 // ---------------------------------------------------------
       
   305 // CClockAppUi::HandleKeyEventL
       
   306 // rest of the details are commented in the header
       
   307 // ---------------------------------------------------------
       
   308 //
       
   309 TKeyResponse CClockAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   310     {
       
   311     TKeyResponse keyResponse( EKeyWasNotConsumed );
       
   312     
       
   313     if( iTabGroup )
       
   314         {
       
   315         CAknTabGroup* tabGroup = NULL;
       
   316         
       
   317         if ( iNavigationDecorator )
       
   318             {
       
   319             // Get the pointer to the tab group.
       
   320             tabGroup = ( CAknTabGroup* ) iNavigationDecorator->DecoratedControl();
       
   321             // Pass the event to the tab group so that it handles the event.
       
   322             keyResponse = tabGroup->OfferKeyEventL( aKeyEvent, aType );
       
   323             }
       
   324         }
       
   325     
       
   326     // Return the result.
       
   327     return keyResponse;
       
   328     }
       
   329 
       
   330 // ---------------------------------------------------------
       
   331 // CClockAppUi::HandleForegroundEventL
       
   332 // rest of the details are commented in the header
       
   333 // ---------------------------------------------------------
       
   334 //
       
   335 void CClockAppUi::HandleForegroundEventL( TBool aForeground )
       
   336     {
       
   337     __PRINTS( "CClockAppUi::HandleForegroundEventL - Entry" );
       
   338     
       
   339     if( aForeground )
       
   340         {
       
   341         __PRINTS( "CClockAppUi::HandleForegroundEventL - aForeground ETrue" );
       
   342         
       
   343         if( iIADUpdateFlag )
       
   344             {
       
   345             __PRINTS( "CClockAppUi::HandleForegroundEventL - iIADUpdateFlag ETrue" );
       
   346             
       
   347             // check for IAD updates
       
   348             HandleIADUpdateL();
       
   349             
       
   350             __PRINTS( "CClockAppUi::HandleForegroundEventL - Checking for updates" );
       
   351             
       
   352             iIADUpdateFlag = EFalse;
       
   353             __PRINTS( "CClockAppUi::HandleForegroundEventL - iIADUpdateFlag EFalse" );
       
   354             }
       
   355         }
       
   356 
       
   357     // Inform the world clock view about the change
       
   358     CClockWorldView* clockWorldView = static_cast< CClockWorldView* > ( View( KClockAppWorldViewId ) );
       
   359     if( clockWorldView )
       
   360         {
       
   361         clockWorldView->HandleForegroundEventL( aForeground );
       
   362         }
       
   363     
       
   364     CClockMainView* clockMainView = static_cast< CClockMainView* >( View( KClockAppMainViewId ) );
       
   365     if( clockMainView )
       
   366         {
       
   367         clockMainView->HandleForegroundEventL( aForeground );
       
   368         }
       
   369 		
       
   370 	CAknAppUi::HandleForegroundEventL( aForeground );
       
   371     
       
   372     __PRINTS( "CClockAppUi::HandleForegroundEventL - Exit" );
       
   373     }
       
   374 
       
   375 // ---------------------------------------------------------
       
   376 // CClockAppUi::CheckUpdatesComplete
       
   377 // rest of the details commented in the header
       
   378 // ---------------------------------------------------------
       
   379 //
       
   380 void CClockAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates )
       
   381     {
       
   382     __PRINTS( "CClockAppUi::CheckUpdatesComplete - Entry" );
       
   383     
       
   384     __PRINT( "aErrorCode: %d", aErrorCode );
       
   385 
       
   386     if ( aErrorCode == KErrNone )
       
   387         {
       
   388         if ( aAvailableUpdates > 0 )
       
   389             {
       
   390             __PRINT( "aAvailableUpdates: %d", aAvailableUpdates );
       
   391             // There were some updates available. Let's ask if the user wants to update them.
       
   392             iUpdate->UpdateQuery();      
       
   393             
       
   394             __PRINTS( "CClockAppUi::CheckUpdatesComplete - update available" );
       
   395             }
       
   396         else
       
   397             {
       
   398             __PRINTS( "CClockAppUi::CheckUpdatesComplete - no update available" );
       
   399 			
       
   400             // No updates available. CIAUpdate object could be deleted already now, since we are not 
       
   401             // going to call anything else from the API. This will also close down the IAUpdate server.
       
   402             delete iUpdate;
       
   403             iUpdate = NULL;
       
   404             delete iParameters;
       
   405             iParameters = NULL;           
       
   406             }
       
   407         }
       
   408     
       
   409     __PRINTS( "CClockAppUi::CheckUpdatesComplete - Exit" );
       
   410     }
       
   411 
       
   412 // ---------------------------------------------------------
       
   413 // CClockAppUi::UpdateComplete
       
   414 // rest of the details commented in the header
       
   415 // ---------------------------------------------------------
       
   416 //
       
   417 void CClockAppUi::UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult )
       
   418     {
       
   419     __PRINTS( "CClockAppUi::UpdateComplete - Entry" );
       
   420     
       
   421     __PRINT( "aErrorCode: %d", aErrorCode );
       
   422 
       
   423     delete aResult; // Ownership was transferred, so this must be deleted by the client
       
   424 
       
   425     // We do not need the client-server session anymore, let's delete the object to close the session
       
   426     delete iUpdate;
       
   427     iUpdate = NULL;
       
   428     delete iParameters;
       
   429     iParameters = NULL;
       
   430     
       
   431     __PRINTS( "CClockAppUi::UpdateComplete - Exit" );
       
   432     }
       
   433 
       
   434 // ---------------------------------------------------------
       
   435 // CClockAppUi::UpdateQueryComplete
       
   436 // rest of the details commented in the header
       
   437 // ---------------------------------------------------------
       
   438 //    
       
   439 void CClockAppUi::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow )
       
   440     {
       
   441     __PRINTS( "CClockAppUi::UpdateQueryComplete - Entry" );
       
   442     
       
   443     __PRINT( "aErrorCode: %d", aErrorCode );
       
   444     
       
   445     if ( aErrorCode == KErrNone )
       
   446         {
       
   447         if ( aUpdateNow )
       
   448             {
       
   449             __PRINTS( "CClockAppUi::UpdateQueryComplete - aUpdateNow is true" );
       
   450             // User choosed to update now, so let's launch the IAUpdate UI.
       
   451             iUpdate->ShowUpdates( *iParameters );
       
   452             }
       
   453         else
       
   454             {
       
   455             __PRINTS( "CClockAppUi::UpdateQueryComplete - update later" );
       
   456             // The answer was 'Later'. CIAUpdate object could be deleted already now, since we are not 
       
   457             // going to call anything else from the API. This will also close down the IAUpdate server.
       
   458             delete iUpdate;
       
   459             iUpdate = NULL;
       
   460             delete iParameters;
       
   461             iParameters = NULL;                
       
   462             }
       
   463         }
       
   464     __PRINTS( "CClockAppUi::UpdateQueryComplete - Exit" );
       
   465     }
       
   466 
       
   467 // ---------------------------------------------------------
       
   468 // CClockAppUi::HandleEnvChangeL
       
   469 // rest of the details are commented in the header
       
   470 // ---------------------------------------------------------
       
   471 //
       
   472 void CClockAppUi::HandleEnvChangeL( TClockEnvChanged aEnvChanged )
       
   473     {
       
   474     // Notify the views about the change, so that they can update themselves.
       
   475     CClockMainView* mainView = static_cast< CClockMainView* > ( View( KClockAppMainViewId ) );
       
   476     mainView->HandleEnvChangeL( aEnvChanged );
       
   477     
       
   478     // Notify the views about the change, so that they can update themselves.
       
   479     CClockWorldView* clockworldView = static_cast< CClockWorldView* > ( View( KClockAppWorldViewId ) );
       
   480     clockworldView->HandleEnvChangeL( aEnvChanged );
       
   481     }
       
   482 
       
   483 // ---------------------------------------------------------
       
   484 // CClockAppUi::OpenSettingsViewL
       
   485 // rest of the details are commented in the header
       
   486 // ---------------------------------------------------------
       
   487 //
       
   488 void CClockAppUi::OpenSettingsViewL()
       
   489     {
       
   490     // Set the title pane text first
       
   491     SetTitlePaneTextL( R_CLOCK_TITLE_SETTINGS );
       
   492 
       
   493     // Don't display the navigation pane when switching to settings view.
       
   494     if( iNavigationDecorator )
       
   495         {
       
   496         iNavigationDecorator->MakeVisible( EFalse );
       
   497         }
       
   498     
       
   499     // Activate the date and time settings view
       
   500     ActivateLocalViewL( KClkDateTimeViewId );
       
   501     }
       
   502 
       
   503 // ---------------------------------------------------------
       
   504 // CClockAppUi::SetTitlePaneTextL
       
   505 // rest of the details are commented in the header
       
   506 // ---------------------------------------------------------
       
   507 //
       
   508 void CClockAppUi::SetTitlePaneTextL( TInt aResourceId )
       
   509     {
       
   510     CEikStatusPane* statusPane = StatusPane();
       
   511     
       
   512     // Set the title pane text
       
   513     TBuf< KMaxTitleLength > titleText;
       
   514     iCoeEnv->ReadResourceL( titleText, aResourceId );
       
   515     
       
   516     CAknTitlePane* titlePane = STATIC_CAST( CAknTitlePane*, statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   517     titlePane->SetTextL( titleText );
       
   518     titlePane->DrawNow();
       
   519     }
       
   520 
       
   521 // ---------------------------------------------------------
       
   522 // CClockAppUi::ResetToInitialStateL
       
   523 // rest of the details commented in the header
       
   524 // ---------------------------------------------------------
       
   525 //
       
   526 void CClockAppUi::ResetToInitialStateL()
       
   527     {
       
   528     TVwsViewId viewId;
       
   529     
       
   530     viewId.iAppUid = KClockAppUid;
       
   531     viewId.iViewUid = KClockAppMainViewId;
       
   532                         
       
   533     // Switch to the main view
       
   534     // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() );
       
   535     TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ;
       
   536 
       
   537 	// Update the tab.
       
   538 	iTabGroup->SetActiveTabById( EClockAppMainViewId );
       
   539     }
       
   540 
       
   541 // ---------------------------------------------------------
       
   542 // CClockAppUi::SetupNavigationPaneL
       
   543 // rest of the details commented in the header
       
   544 // ---------------------------------------------------------
       
   545 //
       
   546 void CClockAppUi::SetupNavigationPaneL()
       
   547     {
       
   548     // Add the tabs for each view in the navigation pane.
       
   549     // Gets a pointer to the status pane.
       
   550     CEikStatusPane* statusPane = StatusPane();
       
   551 
       
   552     // Fetch pointer to the default navi pane control
       
   553     iNaviPane = static_cast< CAknNavigationControlContainer*>
       
   554                 ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   555                 
       
   556     iNavigationDecorator = iNaviPane->CreateTabGroupL( this );
       
   557     iNavigationDecorator->SetControlType( CAknNavigationDecorator::ETabGroup );
       
   558     
       
   559     // Construct the tabgroup and append tabs to it.
       
   560     iTabGroup = ( CAknTabGroup* ) iNavigationDecorator->DecoratedControl();
       
   561     // Set observer for tab changes.
       
   562     iTabGroup->SetObserver( this );
       
   563     // Set tab width.
       
   564     iTabGroup->SetTabFixedWidthL ( EAknTabWidthWithTwoTabs);
       
   565     
       
   566     // Load the images to be displayed in the tabs.
       
   567     // 1. The alarm/main view icon.
       
   568     CFbsBitmap* tabImageBitmap( NULL );
       
   569     CFbsBitmap* tabImageMask( NULL );
       
   570     
       
   571     AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(),
       
   572                                  KAknsIIDQgnPropClkClockTab4,
       
   573                                  KAknsIIDQsnIconColors,
       
   574                                  EAknsCIQsnIconColorsCG7,
       
   575                                  tabImageBitmap,
       
   576                                  tabImageMask,
       
   577                                  KIconFileName,
       
   578                                  EMbmClockapp_tabQgn_prop_clk_clock_tab4,
       
   579                                  EMbmClockapp_tabQgn_prop_clk_clock_tab4_mask,
       
   580                                  TRgb( NULL, NULL, 255 ) );
       
   581     
       
   582     // Add the mainview tab.
       
   583     iTabGroup->AddTabL( EClockAppMainViewId, tabImageBitmap, tabImageMask );
       
   584     
       
   585     // 2. The clock world icon.
       
   586     tabImageBitmap = NULL;
       
   587     tabImageMask = NULL;
       
   588     
       
   589     AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(),
       
   590                                  KAknsIIDQgnPropClkWrldClkTab4,
       
   591                                  KAknsIIDQsnIconColors,
       
   592                                  EAknsCIQsnIconColorsCG7,
       
   593                                  tabImageBitmap,
       
   594                                  tabImageMask,
       
   595                                  KIconFileName,
       
   596                                  EMbmClockapp_tabQgn_prop_clk_wrld_clk_tab4,
       
   597                                  EMbmClockapp_tabQgn_prop_clk_wrld_clk_tab4_mask,
       
   598                                  TRgb( NULL, NULL, 255 ) );
       
   599     // Add the world view tab.
       
   600     iTabGroup->AddTabL( EClockAppWorldViewId, tabImageBitmap, tabImageMask );
       
   601     
       
   602     iNaviPane->PushL( *iNavigationDecorator );
       
   603     // Activate the main view tab.
       
   604     iTabGroup->SetActiveTabById( EClockAppMainViewId );
       
   605     }
       
   606 
       
   607 // ---------------------------------------------------------
       
   608 // CClockAppUi::SetAppHidden
       
   609 // rest of the details commented in the header
       
   610 // ---------------------------------------------------------
       
   611 //
       
   612 void CClockAppUi::SetAppHidden( TBool aAppHidden )
       
   613     {
       
   614     iAppHidden = aAppHidden;
       
   615     }
       
   616 
       
   617 // ---------------------------------------------------------
       
   618 // CClockAppUi::IsAppExitHidden
       
   619 // rest of the details commented in the header
       
   620 // ---------------------------------------------------------
       
   621 //  
       
   622 TBool CClockAppUi::IsAppExitHidden()
       
   623     {
       
   624     return iAppHidden;
       
   625     }
       
   626 
       
   627 // ---------------------------------------------------------
       
   628 // CClockAppUi::MakeNavigationPaneVisible
       
   629 // rest of the details commented in the header
       
   630 // ---------------------------------------------------------
       
   631 //
       
   632 void CClockAppUi::MakeNavigationPaneVisible( TBool aVisible, TInt aViewId )
       
   633     {
       
   634     if( iNavigationDecorator && iTabGroup )
       
   635         {
       
   636         iNavigationDecorator->MakeVisible( aVisible );
       
   637         
       
   638         if( aVisible )
       
   639             {
       
   640             iTabGroup->SetActiveTabById( aViewId );
       
   641             }
       
   642         }
       
   643     }
       
   644 
       
   645 // ---------------------------------------------------------
       
   646 // CClockAppUi::HandleIADUpdateL
       
   647 // rest of the details commented in the header
       
   648 // ---------------------------------------------------------
       
   649 //
       
   650 void CClockAppUi::HandleIADUpdateL()
       
   651     {
       
   652     __PRINTS( "CClockAppUi::HandleIADUpdateL - Entry" );
       
   653 
       
   654     if( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) )
       
   655         {
       
   656         // IAD update feature is supported.
       
   657         if( !iUpdate )
       
   658             {
       
   659             TRAP_IGNORE( iUpdate = CIAUpdate::NewL( *this ) );
       
   660             }       
       
   661         __PRINTS( "CClockAppUi::HandleIADUpdateL - iUpdate created" );
       
   662 
       
   663         if ( iUpdate ) // IAUpdate is supported in the phone
       
   664             {
       
   665             iParameters = CIAUpdateParameters::NewL();
       
   666 
       
   667             // Search for updates to IAUpdateExampleClient, We know that the SIS package
       
   668             // uid is KClockAppUid, so let's use that as a search criteria.
       
   669             iParameters->SetUid( KClockAppUid );
       
   670 
       
   671             __PRINT( "App Uid: %d", KClockAppUid );
       
   672 
       
   673             // We want clock.exe to be started after update is finished
       
   674             iParameters->SetCommandLineExecutableL( KIAParamExec );
       
   675 
       
   676             __PRINTS( "CClockAppUi::HandleIADUpdateL - clock.exe" );
       
   677 
       
   678            
       
   679             // Check the updates
       
   680             iUpdate->CheckUpdates( *iParameters );
       
   681             }
       
   682         }
       
   683     __PRINTS( "CClockAppUi::HandleIADUpdateL - Exit" );
       
   684     }
       
   685 // End of file