clock2/clockui/adtupdater/src/adtupdatercontainer.cpp
branchRCL_3
changeset 28 96907930389d
parent 15 9711e452b5e9
equal deleted inserted replaced
27:aba12c885d83 28:96907930389d
    46 #include "clock_debug.h"
    46 #include "clock_debug.h"
    47 #include <uikon/eiksrvui.h>
    47 #include <uikon/eiksrvui.h>
    48 
    48 
    49 // Constants
    49 // Constants
    50 const TInt KNitzPlugin( 0x200159A5 );
    50 const TInt KNitzPlugin( 0x200159A5 );
    51 const TInt KTimeout( 40000000 );				// 40 seconds
    51 const TInt KTimeout( 90000000 );				// 90 seconds
    52 const TInt KInterval( 5000000 );				// 5 seconds
    52 const TInt KInterval( 5000000 );				// 5 seconds
    53 const TInt KMaximumTwoDigitValue( 99 );
    53 const TInt KMaximumTwoDigitValue( 99 );
    54 const TInt KNitzYearOffset( 2000 );
    54 const TInt KNitzYearOffset( 2000 );
    55 const TInt KMaxCityLength( 120 );
    55 const TInt KMaxCityLength( 120 );
    56 const TInt KMaxCountryLength( 120 );
    56 const TInt KMaxCountryLength( 120 );
    95 //
    95 //
    96 CAdtUpdaterContainer::~CAdtUpdaterContainer()
    96 CAdtUpdaterContainer::~CAdtUpdaterContainer()
    97     {
    97     {
    98     __PRINTS( "CAdtUpdaterContainer::~CAdtUpdaterContainer - Entry" );
    98     __PRINTS( "CAdtUpdaterContainer::~CAdtUpdaterContainer - Entry" );
    99     
    99     
       
   100     if(iPSObserver)
       
   101         {
       
   102         delete iPSObserver;
       
   103         iPSObserver = NULL;
       
   104         }
   100 	if( iBgContext )
   105 	if( iBgContext )
   101 		{
   106 		{
   102 		delete iBgContext;
   107 		delete iBgContext;
   103 		iBgContext = NULL;
   108 		iBgContext = NULL;
   104 		}
   109 		}
   151     
   156     
   152 	CreateWindowL();
   157 	CreateWindowL();
   153 	
   158 	
   154 	iAdtUpdaterAppUi =  static_cast < CAdtUpdaterAppUi* > ( CCoeEnv::Static()->AppUi() );
   159 	iAdtUpdaterAppUi =  static_cast < CAdtUpdaterAppUi* > ( CCoeEnv::Static()->AppUi() );
   155 	
   160 	
   156 	SetRect( aRect );
   161 	
   157 	
   162 	
   158 	// Construct the background control context.
   163 	// Construct the background control context.
   159     iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen,
   164     iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen,
   160     													   aRect.Size(),
   165     													   aRect.Size(),
   161     													   EFalse );
   166     													   EFalse );
       
   167     SetRect( aRect );
   162     
   168     
   163     // set the flag for showing startup queries
   169     // set the flag for showing startup queries
   164     iDisplayStartupQueries = DisplayStartupQueriesL();
   170     iDisplayStartupQueries = DisplayStartupQueriesL();
   165     
   171     
   166     
   172     iPSObserver = CPsKeyObserver::NewL(KPSUidStartup, KPSStartupUiPhase, EStartupUiPhaseAllDone, this);
       
   173     
       
   174 	iIsRTCInvalidAndHiddenReset = EFalse;
       
   175 	
   167     ActivateL();
   176     ActivateL();
   168   
   177   
   169     __PRINTS( "CAdtUpdaterContainer::ConstructL - Exit" );
   178     __PRINTS( "CAdtUpdaterContainer::ConstructL - Exit" );
   170     }     
   179     }     
   171 
   180 
   279 	{
   288 	{
   280 	__PRINTS( "CAdtUpdaterContainer::HandleResourceChange - Entry" );
   289 	__PRINTS( "CAdtUpdaterContainer::HandleResourceChange - Entry" );
   281 	
   290 	
   282 	// Forward the control to CCoeControl.
   291 	// Forward the control to CCoeControl.
   283 	CCoeControl::HandleResourceChange( aType );
   292 	CCoeControl::HandleResourceChange( aType );
       
   293 	if( KAknsMessageSkinChange == aType || KEikDynamicLayoutVariantSwitch == aType )
       
   294 	    {
       
   295         TRect mainPane;
       
   296 	    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, mainPane );
       
   297 	    SetRect(mainPane);	    
       
   298 	    }
   284 	
   299 	
   285 	__PRINTS( "CAdtUpdaterContainer::HandleResourceChange - Exit" );
   300 	__PRINTS( "CAdtUpdaterContainer::HandleResourceChange - Exit" );
   286 	}
   301 	}
   287 
   302 
   288 // ---------------------------------------------------------
   303 // ---------------------------------------------------------
   313 		TCallBack timerCallBack( CallBackL, this );
   328 		TCallBack timerCallBack( CallBackL, this );
   314 		iPeriodic = CPeriodic::NewL( EPriorityAbsoluteHigh );
   329 		iPeriodic = CPeriodic::NewL( EPriorityAbsoluteHigh );
   315 		// Start the timer	
   330 		// Start the timer	
   316 		iPeriodic->Start( KTimeout, KInterval, timerCallBack );
   331 		iPeriodic->Start( KTimeout, KInterval, timerCallBack );
   317 		}
   332 		}
   318 	else if( IsFirstBoot()&& PredictiveTimeEnabled() )
   333 	else if( IsFirstBoot()&& PredictiveTimeEnabled())
   319 		{	
   334 		{		
   320 		__PRINTS( "First boot, normal boot sequence" );
   335 		__PRINTS( "First boot, normal boot sequence" );
   321 		
   336 		WaitToShowQueriesL();
   322 		// The normal bootup sequence.		
       
   323 		ContinueWithNormalBootL();
       
   324 		
       
   325 		__PRINTS( "CAdtUpdaterContainer::InformAboutNwUpdate : 2nd condition - Exit" );
   337 		__PRINTS( "CAdtUpdaterContainer::InformAboutNwUpdate : 2nd condition - Exit" );
   326 		
       
   327 		// Exit the application.
       
   328 		iAdtUpdaterAppUi->Exit();
       
   329 		}
   338 		}
   330 	else if( !RTCStatus() && !HiddenReset() && PredictiveTimeEnabled())
   339 	else if( !RTCStatus() && !HiddenReset() && PredictiveTimeEnabled())
   331 		{
   340 		{
   332 		__PRINTS( "RTC invalid or Hidden Reset" );
   341 		__PRINTS( "RTC invalid or Hidden Reset" );
   333 		
   342 		
   334 		// Show in FSW.
   343 		
   335 	    iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
   344 		iIsRTCInvalidAndHiddenReset = ETrue;
   336 		// Hide the status pane.
   345 		
   337 	    iAdtUpdaterAppUi->HideStatusPane( ETrue );
   346 		WaitToShowQueriesL();
   338 		
       
   339 		// No first boot but RTCStatus is corrupted. Ask time and date"
       
   340 		
       
   341 		// Showing Date query to user.
       
   342 		ShowDateQueryL();
       
   343 		
       
   344 		// Showing Time query to user.
       
   345 		ShowTimeQueryL();
       
   346 		
       
   347 		//Deactivate the plug-in as we are setting the date/time manually
       
   348 		DeActivateNitzPlugin();
       
   349 		
       
   350 		__PRINTS( "CAdtUpdaterContainer::InformAboutNwUpdate : 3rd condition - Exit" );
   347 		__PRINTS( "CAdtUpdaterContainer::InformAboutNwUpdate : 3rd condition - Exit" );
   351 		
       
   352 		// Exit the application.
       
   353 		iAdtUpdaterAppUi->Exit();
       
   354 		}		
   348 		}		
   355 	else
   349 	else
   356 		{
   350 		{
   357 		__PRINTS( "Not the first boot, simply exit" );
   351 		__PRINTS( "Not the first boot, simply exit" );
   358 		
   352 		
   420 	iTimeOut = ETrue;
   414 	iTimeOut = ETrue;
   421 	// First cancel all requests.
   415 	// First cancel all requests.
   422 	CancelAllRequests();
   416 	CancelAllRequests();
   423 	
   417 	
   424 	// The normal bootup sequence.
   418 	// The normal bootup sequence.
   425 	ContinueWithNormalBootL();
   419 	WaitToShowQueriesL();
   426 
   420 
   427 	__PRINTS( "CAdtUpdaterContainer::NitzInfoNotAvailableL - Exit" );
   421 	__PRINTS( "CAdtUpdaterContainer::NitzInfoNotAvailableL - Exit" );
   428 	
   422 	
   429 	// We're done. Exit the application.
   423 	// We're done. Exit the application.
   430 	iAdtUpdaterAppUi->Exit();
   424 	//iAdtUpdaterAppUi->Exit();
   431 	}
   425 	}
   432 
   426 
   433 // ---------------------------------------------------------
   427 // ---------------------------------------------------------
   434 // CAdtUpdaterContainer::NitzInfoAvailableL
   428 // CAdtUpdaterContainer::NitzInfoAvailableL
   435 // rest of the details are commented in the header
   429 // rest of the details are commented in the header
   451 		iTimeAttributes = aTimeAttributes;
   445 		iTimeAttributes = aTimeAttributes;
   452 		iTimeZoneId = aTimeZoneId;
   446 		iTimeZoneId = aTimeZoneId;
   453 		
   447 		
   454 		// Cancel all requests and timers.
   448 		// Cancel all requests and timers.
   455 		CancelAllRequests();
   449 		CancelAllRequests();
   456 		
   450 		//set nitz info only if automatic time update is ON
   457 		// Display the Nitz info.
   451 		if(isAutomaticTimeUpdateON())
   458 		DisplayNitzInfoL();
   452 		    {
   459 		
   453             // Display the Nitz info.
       
   454             DisplayNitzInfoL();
       
   455 		    }
       
   456 		else
       
   457 		    {
       
   458             //do not set the nitz info if the user has 
       
   459             //set date/time or changed automatic time update 
       
   460             //to OFF before 90 seconds
       
   461             // Marking this boot as first boot.
       
   462 		    MarkFirstBoot();
       
   463 		    }
       
   464 
   460 		// We're done. Exit the application.
   465 		// We're done. Exit the application.
   461 		iAdtUpdaterAppUi->Exit();
   466 		iAdtUpdaterAppUi->Exit();
   462 		}
   467 		}
   463 	
   468 	
   464 	__PRINTS( "CAdtUpdaterContainer::NitzInfoAvailableL - Exit" );
   469 	__PRINTS( "CAdtUpdaterContainer::NitzInfoAvailableL - Exit" );
   580 	
   585 	
   581 	__PRINTS( "CAdtUpdaterContainer::DisplayNitzInfoL - Exit" );
   586 	__PRINTS( "CAdtUpdaterContainer::DisplayNitzInfoL - Exit" );
   582 	}
   587 	}
   583 
   588 
   584 // ---------------------------------------------------------
   589 // ---------------------------------------------------------
   585 // CAdtUpdaterContainer::ContinueWithNormalBootL
   590 // CAdtUpdaterContainer::WaitToShowQueriesL
   586 // rest of the details are commented in the header
   591 // rest of the details are commented in the header
   587 // ---------------------------------------------------------
   592 // ---------------------------------------------------------
   588 //
   593 //
   589 void CAdtUpdaterContainer::ContinueWithNormalBootL()
   594 void CAdtUpdaterContainer::WaitToShowQueriesL()
   590 	{
   595 	{
   591 	__PRINTS( "CAdtUpdaterContainer::ContinueWithNormalBootL - Entry" );
   596 	__PRINTS( "CAdtUpdaterContainer::WaitToShowQueriesL - Enter" );
       
   597 	
       
   598 	iAdtUpdaterAppUi->ToggleAppViewL( EFalse);
       
   599 	iPSObserver->StartObservingL();
       
   600 	
       
   601 	__PRINTS( "CAdtUpdaterContainer::WaitToShowQueriesL - Exit" );
       
   602 	}
       
   603 
       
   604 // ---------------------------------------------------------
       
   605 // CAdtUpdaterContainer::ShowQueriesL
       
   606 // rest of the details are commented in the header
       
   607 // ---------------------------------------------------------
       
   608 //
       
   609 void CAdtUpdaterContainer::ShowQueriesL()
       
   610 	{
       
   611 	__PRINTS( "CAdtUpdaterContainer::ShowQueriesL - Entry" );
       
   612 	
       
   613     iPSObserver->Cancel();
       
   614     
       
   615     if(iIsRTCInvalidAndHiddenReset)
       
   616         {
       
   617         ShowDateAndTimeQueriesL();				
       
   618         }
       
   619     else
       
   620         {
       
   621         DoContinueWithNormalBootL();
       
   622         }
       
   623 
       
   624     __PRINTS( "CAdtUpdaterContainer::Exit from APP" );
       
   625     
       
   626     // Exit the application.
       
   627     iAdtUpdaterAppUi->Exit();
       
   628 	}
       
   629 	
       
   630 // ---------------------------------------------------------
       
   631 // CAdtUpdaterContainer::DoContinueWithNormalBootL
       
   632 // rest of the details are commented in the header
       
   633 // ---------------------------------------------------------
       
   634 //		
       
   635 void CAdtUpdaterContainer::DoContinueWithNormalBootL()
       
   636 	{
       
   637 	__PRINTS( "CAdtUpdaterContainer::DoContinueWithNormalBootL - Entry" );
   592 	
   638 	
   593 	// First bring the application to the foreground.
   639 	// First bring the application to the foreground.
   594 	iAdtUpdaterAppUi->ToggleAppViewL( ETrue );	
   640 	iAdtUpdaterAppUi->ToggleAppViewL( ETrue );	
   595 	// Show in FSW.
   641 	// Show in FSW.
   596     iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
   642     iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
   597 	// Hide the status pane.
   643 	// Hide the status pane.
   598     iAdtUpdaterAppUi->HideStatusPane( ETrue );
   644     iAdtUpdaterAppUi->HideStatusPane( ETrue );
   599 	
   645 
   600 	//Deactivating Nitz
   646     TBool timeSaved(ETrue);
       
   647     TBool dateSaved(ETrue);
       
   648     //show date/time queries only if automatic time update is ON
       
   649     if(isAutomaticTimeUpdateON())
       
   650         {
       
   651         //Deactivating Nitz
       
   652         DeActivateNitzPlugin();
       
   653 
       
   654         iQueryDialogsInDisplay = ETrue;
       
   655     
       
   656         // First the country/city list.
       
   657         ShowCountryAndCityListsL(); 
       
   658         // Then query date.
       
   659         timeSaved = ShowDateQueryL();
       
   660         // Then query time.
       
   661         dateSaved = ShowTimeQueryL();
       
   662     
       
   663         iQueryDialogsInDisplay = EFalse;
       
   664     
       
   665         }
       
   666     // Modify the FirstBoot flag.
       
   667     if( timeSaved && dateSaved )
       
   668         {
       
   669         MarkFirstBoot();
       
   670         }
       
   671 
       
   672     __PRINTS( "CAdtUpdaterContainer::ContinueWithNormalBootL - Exit" );
       
   673 	}
       
   674 	
       
   675 // ---------------------------------------------------------
       
   676 // CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset
       
   677 // rest of the details are commented in the header
       
   678 // ---------------------------------------------------------
       
   679 //
       
   680 void CAdtUpdaterContainer::ShowDateAndTimeQueriesL()
       
   681 	{
       
   682 	__PRINTS( "CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset - Entry" );	
       
   683 		
       
   684 	// Show in FSW.
       
   685     iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
       
   686 	// Hide the status pane.
       
   687     iAdtUpdaterAppUi->HideStatusPane( ETrue );
       
   688 		
       
   689 	// No first boot but RTCStatus is corrupted. Ask time and date"
       
   690 		
       
   691 	// Showing Date query to user.
       
   692 	ShowDateQueryL();
       
   693 		
       
   694 	// Showing Time query to user.
       
   695 	ShowTimeQueryL();
       
   696 		
       
   697 	//Deactivate the plug-in as we are setting the date/time manually
   601 	DeActivateNitzPlugin();
   698 	DeActivateNitzPlugin();
   602 	
   699 		
   603     TBool timeSaved;
   700 	__PRINTS( "CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset - Exit" );
   604     TBool dateSaved;
   701 	}
   605     
       
   606     iQueryDialogsInDisplay = ETrue;
       
   607     
       
   608 	// First the country/city list.
       
   609 	ShowCountryAndCityListsL(); 
       
   610 	// Then query date.
       
   611 	timeSaved = ShowDateQueryL();
       
   612     // Then query time.
       
   613 	dateSaved = ShowTimeQueryL();
       
   614 	
       
   615 	iQueryDialogsInDisplay = EFalse;
       
   616 	
       
   617 	// Modify the FirstBoot flag.
       
   618 	if( timeSaved && dateSaved )
       
   619 		{
       
   620 		MarkFirstBoot();
       
   621 		}	
       
   622 	
       
   623     __PRINTS( "CAdtUpdaterContainer::ContinueWithNormalBootL - Exit" );
       
   624 	}
       
   625 
       
   626 // ---------------------------------------------------------
   702 // ---------------------------------------------------------
   627 // CAdtUpdaterContainer::ShowCountryAndCityListsL
   703 // CAdtUpdaterContainer::ShowCountryAndCityListsL
   628 // rest of the details are commented in the header
   704 // rest of the details are commented in the header
   629 // ---------------------------------------------------------
   705 // ---------------------------------------------------------
   630 //
   706 //
  1473 		}
  1549 		}
  1474 	
  1550 	
  1475 	__PRINTS( "CAdtUpdaterContainer::DeActivateNitzPlugin - Exit" );
  1551 	__PRINTS( "CAdtUpdaterContainer::DeActivateNitzPlugin - Exit" );
  1476 	}
  1552 	}
  1477 
  1553 
       
  1554 // ---------------------------------------------------------
       
  1555 // CAdtUpdaterListener::isAutomaticTimeUpdateON
       
  1556 // Check if automatic time update value is ON
       
  1557 // ---------------------------------------------------------
       
  1558 //
       
  1559 
       
  1560 TBool CAdtUpdaterContainer::isAutomaticTimeUpdateON()
       
  1561     {
       
  1562     __PRINTS( "CAdtUpdaterContainer::isAutomaticTimeUpdateON - Entry" );
       
  1563     
       
  1564     RClkSrvInterface clkSrvInterface;
       
  1565     
       
  1566     TBool timeUpdateOn( EFalse );
       
  1567     if(KErrNone ==  clkSrvInterface.Connect())
       
  1568         {
       
  1569     __PRINTS( "connection to clock server was successful" );
       
  1570     // get the value of AutoTimeUpdate setting
       
  1571     clkSrvInterface.IsAutoTimeUpdateOn( timeUpdateOn );   
       
  1572     clkSrvInterface.Close();
       
  1573         }
       
  1574 
       
  1575     __PRINTS( "CAdtUpdaterContainer::isAutomaticTimeUpdateON - Exit" );
       
  1576     return timeUpdateOn;
       
  1577     }
       
  1578 
  1478 // -----------------------------------------------------
  1579 // -----------------------------------------------------
  1479 // CAdtUpdaterContainer::Listener
  1580 // CAdtUpdaterContainer::Listener
  1480 // rest of the details are commented in the header
  1581 // rest of the details are commented in the header
  1481 // -----------------------------------------------------
  1582 // -----------------------------------------------------
  1482 //
  1583 //
  1541 
  1642 
  1542 // ---------------------------------------------------------------------------
  1643 // ---------------------------------------------------------------------------
  1543 // CAdtUpdaterContainer::PredictiveTimeEnabled()
  1644 // CAdtUpdaterContainer::PredictiveTimeEnabled()
  1544 // Rest of the details are commented in headers.
  1645 // Rest of the details are commented in headers.
  1545 // ---------------------------------------------------------------------------
  1646 // ---------------------------------------------------------------------------
       
  1647 //
  1546 TBool CAdtUpdaterContainer::PredictiveTimeEnabled()
  1648 TBool CAdtUpdaterContainer::PredictiveTimeEnabled()
  1547      {
  1649      {
       
  1650      __PRINTS( "CAdtUpdaterContainer::PredictiveTimeEnabled - Entry" );
       
  1651     
  1548      TInt value( EPredictiveTimeEnabled );
  1652      TInt value( EPredictiveTimeEnabled );
  1549      CRepository* repository(NULL);
  1653      CRepository* repository(NULL);
  1550      
  1654      
  1551      TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
  1655      TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
  1552 
  1656 
  1554          {
  1658          {
  1555          err = repository->Get( KPredictiveTimeAndCountrySelection, value );
  1659          err = repository->Get( KPredictiveTimeAndCountrySelection, value );
  1556          }
  1660          }
  1557      delete repository;
  1661      delete repository;
  1558  
  1662  
       
  1663      __PRINTS( "CAdtUpdaterContainer::PredictiveTimeEnabled - Exit" );
  1559      return value;
  1664      return value;
  1560      } 
  1665      } 
  1561 
  1666 
       
  1667 // ---------------------------------------------------------------------------
       
  1668 // CAdtUpdaterContainer::PredictiveTimeEnabled()
       
  1669 // 
       
  1670 // ---------------------------------------------------------------------------
       
  1671 //
       
  1672 CPsKeyObserver::CPsKeyObserver( TUid aCategory, TUint aKey, TInt aTargetValue , MStartupUIPhaseObserver* aObsever)
       
  1673   : CActive( EPriorityStandard ), iCategory( aCategory ),
       
  1674     iKey( aKey ), iTargetValue(aTargetValue), iStartupUIPhaseObserver(aObsever)
       
  1675     {
       
  1676     __PRINTS( "CPsKeyObserver::CPsKeyObserver - Entry" );
       
  1677     
       
  1678     ASSERT( iStartupUIPhaseObserver != NULL );
       
  1679     CActiveScheduler::Add( this );
       
  1680 	
       
  1681     __PRINTS( "CPsKeyObserver::CPsKeyObserver - Exit" );
       
  1682     }
       
  1683 
       
  1684 
       
  1685 // ---------------------------------------------------------------------------
       
  1686 // CPsKeyObserver::~CPsKeyObserver
       
  1687 //
       
  1688 // ---------------------------------------------------------------------------
       
  1689 //
       
  1690 CPsKeyObserver::~CPsKeyObserver()
       
  1691     {
       
  1692     __PRINTS( "CPsKeyObserver::~CPsKeyObserver - Entry" );
       
  1693 	
       
  1694 	if(IsActive())
       
  1695 		{
       
  1696 	    Cancel();
       
  1697 		}
       
  1698     iProperty.Close();	
       
  1699     
       
  1700 	__PRINTS( "CPsKeyObserver::~CPsKeyObserver - Exit" );
       
  1701     }
       
  1702 
       
  1703 
       
  1704 // ---------------------------------------------------------------------------
       
  1705 // CPsKeyObserver::StartObservingL
       
  1706 //
       
  1707 // ---------------------------------------------------------------------------
       
  1708 //
       
  1709 void CPsKeyObserver::StartObservingL()
       
  1710     {
       
  1711 	__PRINTS( "CPsKeyObserver::StartObservingL - Entry" );
       
  1712 	
       
  1713     ASSERT( !IsActive() );
       
  1714 	
       
  1715     TInt errorCode = iProperty.Attach( iCategory, iKey );	
       
  1716     if ( errorCode == KErrNone )
       
  1717         {
       
  1718         HandleKeyValueL();
       
  1719         }
       
  1720     else
       
  1721         {
       
  1722         CompleteL( errorCode );
       
  1723         }
       
  1724     
       
  1725 	__PRINTS( "CPsKeyObserver::StartObservingL - Exit" );
       
  1726     }
       
  1727 
       
  1728 
       
  1729 // ---------------------------------------------------------------------------
       
  1730 // CPsKeyObserver::DoCancel
       
  1731 //
       
  1732 // ---------------------------------------------------------------------------
       
  1733 //
       
  1734 void CPsKeyObserver::DoCancel()
       
  1735     {
       
  1736 	__PRINTS( "CPsKeyObserver::DoCancel - Entry" );
       
  1737 	
       
  1738     iProperty.Cancel();
       
  1739     CompleteL( KErrCancel );
       
  1740 	
       
  1741 	__PRINTS( "CPsKeyObserver::DoCancel - Exit" );
       
  1742     }
       
  1743 
       
  1744 
       
  1745 // ---------------------------------------------------------------------------
       
  1746 // CPsKeyObserver::RunL
       
  1747 //
       
  1748 // ---------------------------------------------------------------------------
       
  1749 //
       
  1750 void CPsKeyObserver::RunL()
       
  1751     {
       
  1752     __PRINTS( "CPsKeyObserver::RunL - Entry" );
       
  1753 	
       
  1754     if ( iStatus == KErrCancel ||
       
  1755          iStatus == KErrServerTerminated ||
       
  1756          iStatus ==KErrNotSupported )
       
  1757         {
       
  1758         CompleteL( iStatus.Int() );
       
  1759         }
       
  1760     else
       
  1761         {
       
  1762         HandleKeyValueL();
       
  1763         }
       
  1764 		
       
  1765 	__PRINTS( "CPsKeyObserver::RunL - Exit" );
       
  1766     }
       
  1767 
       
  1768 // ---------------------------------------------------------------------------
       
  1769 // CPsKeyObserver::IsMatch
       
  1770 //
       
  1771 // ---------------------------------------------------------------------------
       
  1772 //
       
  1773 TBool CPsKeyObserver::IsMatch( const TInt aKeyValue ) const
       
  1774     {
       
  1775 	__PRINTS( "CPsKeyObserver::IsMatch - Entry" );
       
  1776 	__PRINTS( "CPsKeyObserver::IsMatch - Exit" );
       
  1777 	
       
  1778     return aKeyValue == iTargetValue;
       
  1779     }
       
  1780 
       
  1781 
       
  1782 // ---------------------------------------------------------------------------
       
  1783 // CPsKeyObserver::HandleKeyValueL
       
  1784 //
       
  1785 // ---------------------------------------------------------------------------
       
  1786 //
       
  1787 void CPsKeyObserver::HandleKeyValueL()
       
  1788     {
       
  1789 	__PRINTS( "CPsKeyObserver::HandleKeyValueL - Entry" );
       
  1790 	
       
  1791     ASSERT( !IsActive() );		
       
  1792 
       
  1793     TInt value( -KMaxTInt );
       
  1794     TInt errorCode = iProperty.Get( value );
       
  1795     
       
  1796     if ( errorCode != KErrNone || IsMatch( value ) )
       
  1797         {
       
  1798         __PRINTS( "CPsKeyObserver::HandleKeyValueL - Inside If" );	
       
  1799         CompleteL( errorCode );
       
  1800         }
       
  1801     else
       
  1802         {
       
  1803         __PRINTS( "CPsKeyObserver::HandleKeyValueL - Inside else  - resubscribe" );
       
  1804    	    iProperty.Subscribe( iStatus );
       
  1805     	SetActive();
       
  1806         }
       
  1807 		
       
  1808 	__PRINTS( "CPsKeyObserver::HandleKeyValueL - Exit" );	
       
  1809     }
       
  1810 
       
  1811 
       
  1812 // ---------------------------------------------------------------------------
       
  1813 // CPsKeyObserver::CompleteL
       
  1814 //
       
  1815 // ---------------------------------------------------------------------------
       
  1816 //
       
  1817 void CPsKeyObserver::CompleteL( const TInt aErrorCode )
       
  1818     {
       
  1819     __PRINTS( "CPsKeyObserver::CompleteL - Entry" );	
       
  1820 	
       
  1821 	if(aErrorCode == KErrNone)
       
  1822 		{		
       
  1823 		iStartupUIPhaseObserver->ShowQueriesL();
       
  1824 		}
       
  1825 	else
       
  1826         {
       
  1827         __PRINTS( "CPsKeyObserver::CompleteL - Else" );
       
  1828         }
       
  1829 	
       
  1830 	__PRINTS( "CPsKeyObserver::CompleteL - Exit" );		
       
  1831     }
       
  1832 
       
  1833 // ---------------------------------------------------------------------------
       
  1834 // CPsKeyObserver::NewL
       
  1835 //
       
  1836 // ---------------------------------------------------------------------------
       
  1837 //
       
  1838 CPsKeyObserver* CPsKeyObserver::NewL( TUid aCategory, TUint aKey, TInt aTargetValue , MStartupUIPhaseObserver* aObsever )
       
  1839 	{
       
  1840 	__PRINTS( "CPsKeyObserver::NewL - Entry" );
       
  1841 	__PRINTS( "CPsKeyObserver::NewL - Exit" );
       
  1842 	
       
  1843 	return new ( ELeave ) CPsKeyObserver( aCategory, aKey, aTargetValue  , aObsever);
       
  1844 	}
       
  1845 
       
  1846 
  1562 // End of file
  1847 // End of file