clock2/clockui/adtupdater/src/adtupdatercontainer.cpp
branchRCL_3
changeset 86 ed599363c2d7
parent 78 356f28cd5ca0
equal deleted inserted replaced
78:356f28cd5ca0 86:ed599363c2d7
    57 const TInt KSingleCity( 1 );
    57 const TInt KSingleCity( 1 );
    58 const TInt KZero( 0 );
    58 const TInt KZero( 0 );
    59 const TInt KFirstBootDone( 1 );
    59 const TInt KFirstBootDone( 1 );
    60 const TInt KTimeFormatLength( 16 );				 // "20070000:090000."
    60 const TInt KTimeFormatLength( 16 );				 // "20070000:090000."
    61 const TInt KMaxMobileCountryCode( 4 );
    61 const TInt KMaxMobileCountryCode( 4 );
    62 const TInt KCDTQueryTimer( 2000000 );           // 2 seconds
    62 const TInt KCDTQueryTimer( 5000000 );           // 5 seconds
    63 const TInt KAppBackgroundInterval( 2000000 );   // 2 seconds
    63 const TInt KAppBackgroundInterval( 2000000 );   // 2 seconds
    64 
    64 
    65 // Literals
    65 // Literals
    66 _LIT( KOneSpace, " " );
    66 _LIT( KOneSpace, " " );
    67 _LIT( KMobileCountryCode, "%d" );
    67 _LIT( KMobileCountryCode, "%d" );
   176 	
   176 	
   177 	iPeriodic = CPeriodic::NewL( EPriorityAbsoluteHigh );
   177 	iPeriodic = CPeriodic::NewL( EPriorityAbsoluteHigh );
   178 	
   178 	
   179 	iNitzTimerActive = EFalse;
   179 	iNitzTimerActive = EFalse;
   180 	
   180 	
   181 	ActivateL();
   181     ActivateL();
   182   
   182   
   183     __PRINTS( "CAdtUpdaterContainer::ConstructL - Exit" );
   183     __PRINTS( "CAdtUpdaterContainer::ConstructL - Exit" );
   184     }     
   184     }     
   185 
   185 
   186 // ---------------------------------------------------------
   186 // ---------------------------------------------------------
   405             selfObject->NitzInfoNotAvailableL();
   405             selfObject->NitzInfoNotAvailableL();
   406             }
   406             }
   407         }
   407         }
   408 	else//CDT Query timer is active. 
   408 	else//CDT Query timer is active. 
   409 	    {
   409 	    {
   410         if(selfObject->iAdtUpdaterAppUi->IsHighPriorityWindowActive())
   410         //For every 2 sec, until ADTUpdater exits, we will check whether app is in background
       
   411         //and bring to foreground.
       
   412         if(selfObject->QueryDialogsInDisplay() && selfObject->iAdtUpdaterAppUi->IsAppInBackground())
   411             {
   413             {
   412             //If any high priority window is active, we push the CDT to background.
       
   413             selfObject->iAdtUpdaterAppUi->ToggleAppViewL(EFalse);
       
   414             }
       
   415         else if(selfObject->QueryDialogsInDisplay() && selfObject->iAdtUpdaterAppUi->IsAppInBackground()
       
   416                 && !selfObject->iAdtUpdaterAppUi->IsHighPriorityWindowActive())
       
   417             {
       
   418             //For every 2 sec, until ADTUpdater exits, we will check whether app is in background
       
   419             //and bring to foreground.
       
   420             selfObject->iAdtUpdaterAppUi->ToggleAppViewL(ETrue);
   414             selfObject->iAdtUpdaterAppUi->ToggleAppViewL(ETrue);
   421             }
   415             }
   422          }
   416        }
   423 	__PRINTS( "CAdtUpdaterContainer::CallBackL - Exit" );
   417 	__PRINTS( "CAdtUpdaterContainer::CallBackL - Exit" );
   424 											
   418 											
   425 	return KZero;
   419 	return KZero;
   426 	}
   420 	}
   427 
   421 
   468 		iTimeAttributes = aTimeAttributes;
   462 		iTimeAttributes = aTimeAttributes;
   469 		iTimeZoneId = aTimeZoneId;
   463 		iTimeZoneId = aTimeZoneId;
   470 		
   464 		
   471 		// Cancel all requests and timers.
   465 		// Cancel all requests and timers.
   472 		CancelAllRequests();
   466 		CancelAllRequests();
   473 		//set nitz info only if automatic time update is ON
   467 		
   474 		if(isAutomaticTimeUpdateON())
   468 		// Display the Nitz info.
   475 		    {
   469 		DisplayNitzInfoL();
   476             // Display the Nitz info.
   470 		
   477             DisplayNitzInfoL();
       
   478 		    }
       
   479 		else
       
   480 		    {
       
   481             //do not set the nitz info if the user has 
       
   482             //set date/time or changed automatic time update 
       
   483             //to OFF before 90 seconds
       
   484             // Marking this boot as first boot.
       
   485 		    MarkFirstBoot();
       
   486 		    }
       
   487 
       
   488 		// We're done. Exit the application.
   471 		// We're done. Exit the application.
   489 		iAdtUpdaterAppUi->Exit();
   472 		iAdtUpdaterAppUi->Exit();
   490 		}
   473 		}
   491 	
   474 	
   492 	__PRINTS( "CAdtUpdaterContainer::NitzInfoAvailableL - Exit" );
   475 	__PRINTS( "CAdtUpdaterContainer::NitzInfoAvailableL - Exit" );
   669 void CAdtUpdaterContainer::DoContinueWithNormalBootL()
   652 void CAdtUpdaterContainer::DoContinueWithNormalBootL()
   670 	{
   653 	{
   671 	__PRINTS( "CAdtUpdaterContainer::DoContinueWithNormalBootL - Entry" );
   654 	__PRINTS( "CAdtUpdaterContainer::DoContinueWithNormalBootL - Entry" );
   672 	
   655 	
   673 	// First bring the application to the foreground.
   656 	// First bring the application to the foreground.
   674 	if(!iAdtUpdaterAppUi->IsHighPriorityWindowActive())
   657 	iAdtUpdaterAppUi->ToggleAppViewL( ETrue );	
   675 	    {
       
   676         iAdtUpdaterAppUi->ToggleAppViewL( ETrue );
       
   677 	    }
       
   678 	// Show in FSW.
   658 	// Show in FSW.
   679     iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
   659     iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
   680 	// Hide the status pane.
   660 	// Hide the status pane.
   681     iAdtUpdaterAppUi->HideStatusPane( ETrue );
   661     iAdtUpdaterAppUi->HideStatusPane( ETrue );
   682 
   662 	
   683     TBool timeSaved(ETrue);
   663 	//Deactivating Nitz
   684     TBool dateSaved(ETrue);
   664 	DeActivateNitzPlugin();
   685     //show date/time queries only if automatic time update is ON
   665 	
   686     if(isAutomaticTimeUpdateON())
   666     TBool timeSaved;
   687         {
   667     TBool dateSaved;
   688         //Deactivating Nitz
   668     
   689         DeActivateNitzPlugin();
   669     iQueryDialogsInDisplay = ETrue;
   690 
   670     
   691         iQueryDialogsInDisplay = ETrue;
   671 	// First the country/city list.
   692     
   672 	ShowCountryAndCityListsL(); 
   693         // First the country/city list.
   673 	// Then query date.
   694         ShowCountryAndCityListsL(); 
   674 	timeSaved = ShowDateQueryL();
   695         // Then query date.
   675     // Then query time.
   696         timeSaved = ShowDateQueryL();
   676 	dateSaved = ShowTimeQueryL();
   697         // Then query time.
   677 	
   698         dateSaved = ShowTimeQueryL();
   678 	iQueryDialogsInDisplay = EFalse;
   699     
   679 	
   700         iQueryDialogsInDisplay = EFalse;
   680 	// Modify the FirstBoot flag.
   701     
   681 	if( timeSaved && dateSaved )
   702         }
   682 		{
   703     // Modify the FirstBoot flag.
   683 		MarkFirstBoot();
   704     if( timeSaved && dateSaved )
   684 		}	
   705         {
   685 	
   706         MarkFirstBoot();
       
   707         }
       
   708 
       
   709     __PRINTS( "CAdtUpdaterContainer::ContinueWithNormalBootL - Exit" );
   686     __PRINTS( "CAdtUpdaterContainer::ContinueWithNormalBootL - Exit" );
   710 	}
   687 	}
   711 	
   688 	
   712 // ---------------------------------------------------------
   689 // ---------------------------------------------------------
   713 // CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset
   690 // CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset
   721 	// Show in FSW.
   698 	// Show in FSW.
   722     iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
   699     iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse );
   723 	// Hide the status pane.
   700 	// Hide the status pane.
   724     iAdtUpdaterAppUi->HideStatusPane( ETrue );
   701     iAdtUpdaterAppUi->HideStatusPane( ETrue );
   725 		
   702 		
   726     iQueryDialogsInDisplay = ETrue;
       
   727 	// No first boot but RTCStatus is corrupted. Ask time and date"
   703 	// No first boot but RTCStatus is corrupted. Ask time and date"
   728 		
   704 		
   729 	// Showing Date query to user.
   705 	// Showing Date query to user.
   730 	ShowDateQueryL();
   706 	ShowDateQueryL();
   731 		
   707 		
   732 	// Showing Time query to user.
   708 	// Showing Time query to user.
   733 	ShowTimeQueryL();
   709 	ShowTimeQueryL();
   734 	iQueryDialogsInDisplay = EFalse;
   710 		
   735 	//Deactivate the plug-in as we are setting the date/time manually
   711 	//Deactivate the plug-in as we are setting the date/time manually
   736 	DeActivateNitzPlugin();
   712 	DeActivateNitzPlugin();
   737 		
   713 		
   738 	__PRINTS( "CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset - Exit" );
   714 	__PRINTS( "CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset - Exit" );
   739 	}
   715 	}
  1587 		}
  1563 		}
  1588 	
  1564 	
  1589 	__PRINTS( "CAdtUpdaterContainer::DeActivateNitzPlugin - Exit" );
  1565 	__PRINTS( "CAdtUpdaterContainer::DeActivateNitzPlugin - Exit" );
  1590 	}
  1566 	}
  1591 
  1567 
  1592 // ---------------------------------------------------------
       
  1593 // CAdtUpdaterListener::isAutomaticTimeUpdateON
       
  1594 // Check if automatic time update value is ON
       
  1595 // ---------------------------------------------------------
       
  1596 //
       
  1597 
       
  1598 TBool CAdtUpdaterContainer::isAutomaticTimeUpdateON()
       
  1599     {
       
  1600     __PRINTS( "CAdtUpdaterContainer::isAutomaticTimeUpdateON - Entry" );
       
  1601     
       
  1602     RClkSrvInterface clkSrvInterface;
       
  1603     
       
  1604     TBool timeUpdateOn( EFalse );
       
  1605     if(KErrNone ==  clkSrvInterface.Connect())
       
  1606         {
       
  1607     __PRINTS( "connection to clock server was successful" );
       
  1608     // get the value of AutoTimeUpdate setting
       
  1609     clkSrvInterface.IsAutoTimeUpdateOn( timeUpdateOn );   
       
  1610     clkSrvInterface.Close();
       
  1611         }
       
  1612 
       
  1613     __PRINTS( "CAdtUpdaterContainer::isAutomaticTimeUpdateON - Exit" );
       
  1614     return timeUpdateOn;
       
  1615     }
       
  1616 
       
  1617 // -----------------------------------------------------
  1568 // -----------------------------------------------------
  1618 // CAdtUpdaterContainer::Listener
  1569 // CAdtUpdaterContainer::Listener
  1619 // rest of the details are commented in the header
  1570 // rest of the details are commented in the header
  1620 // -----------------------------------------------------
  1571 // -----------------------------------------------------
  1621 //
  1572 //
  1700  
  1651  
  1701      __PRINTS( "CAdtUpdaterContainer::PredictiveTimeEnabled - Exit" );
  1652      __PRINTS( "CAdtUpdaterContainer::PredictiveTimeEnabled - Exit" );
  1702      return value;
  1653      return value;
  1703      } 
  1654      } 
  1704 
  1655 
  1705 // ---------------------------------------------------------------------------
       
  1706 // CAdtUpdaterContainer::PredictiveTimeEnabled()
       
  1707 // 
       
  1708 // ---------------------------------------------------------------------------
       
  1709 //
       
  1710 CPsKeyObserver::CPsKeyObserver( TUid aCategory, TUint aKey, TInt aTargetValue , MStartupUIPhaseObserver* aObsever)
  1656 CPsKeyObserver::CPsKeyObserver( TUid aCategory, TUint aKey, TInt aTargetValue , MStartupUIPhaseObserver* aObsever)
  1711   : CActive( EPriorityStandard ), iCategory( aCategory ),
  1657   : CActive( EPriorityStandard ), iCategory( aCategory ),
  1712     iKey( aKey ), iTargetValue(aTargetValue), iStartupUIPhaseObserver(aObsever)
  1658     iKey( aKey ), iTargetValue(aTargetValue), iStartupUIPhaseObserver(aObsever)
  1713     {
  1659     {
  1714     __PRINTS( "CPsKeyObserver::CPsKeyObserver - Entry" );
  1660     __PRINTS( "CPsKeyObserver::CPsKeyObserver - Entry" );