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 |
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 // |
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 |