clock2/clockui/adtupdater/inc/adtupdatercontainer.h
branchRCL_3
changeset 66 bd7edf625bdd
child 67 1539a383d7b6
child 78 356f28cd5ca0
equal deleted inserted replaced
65:12af337248b1 66:bd7edf625bdd
       
     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 header file for the CAdtUpdaterContainer class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __ADTUPDATER_CONTAINER_H__
       
    19 #define __ADTUPDATER_CONTAINER_H__
       
    20 
       
    21 // System includes
       
    22 #include <coecntrl.h>
       
    23 #include <e32property.h> 
       
    24 // User includes
       
    25 #include "clocktimesourceinterface.hrh"
       
    26 
       
    27 // Constants
       
    28 /**
       
    29 * @enum TDataAvailabilityState
       
    30 * @brief These flags hold the status of data availability state.
       
    31 */
       
    32 enum TDataAvailabilityState
       
    33     {
       
    34     EDataNone,
       
    35     EDataAccepted,
       
    36     EDataRejected,
       
    37     EDataAvailable,
       
    38     EDataNotAvailable
       
    39     };
       
    40 
       
    41 // Forward declarations
       
    42 class CAknsBasicBackgroundControlContext;
       
    43 class CAdtUpdaterAppView;
       
    44 class CAdtUpdaterListener;
       
    45 class CTzLocalizedCityGroupArray;
       
    46 class CTzLocalizedCity;
       
    47 class CAdtUpdaterAppUi;
       
    48 
       
    49 class MStartupUIPhaseObserver
       
    50     {
       
    51     public:
       
    52         virtual ~MStartupUIPhaseObserver() {}
       
    53         virtual void ShowQueriesL () = 0 ;
       
    54     };
       
    55     
       
    56 NONSHARABLE_CLASS( CPsKeyObserver ) : public CActive
       
    57     {
       
    58 
       
    59     public:
       
    60 		static CPsKeyObserver* NewL( TUid aCategory, TUint aKey, TInt aTargetValue, MStartupUIPhaseObserver* aObsever);
       
    61         CPsKeyObserver( TUid aCategory, TUint aKey, TInt aTargetValue, MStartupUIPhaseObserver* aObsever ); //move to private
       
    62         virtual ~CPsKeyObserver();
       
    63         void StartObservingL();
       
    64 
       
    65     private:
       
    66         virtual void DoCancel();
       
    67         virtual void RunL();
       
    68     
       
    69     private:
       
    70         TBool IsMatch( const TInt aKeyValue ) const;
       
    71         void HandleKeyValueL();
       
    72         void CompleteL( const TInt aErrorCode );
       
    73     
       
    74     private: // data
       
    75         RProperty iProperty;
       
    76         TUid iCategory;
       
    77         TUint iKey;
       
    78         TInt iTargetValue;
       
    79         TRequestStatus* iClientStatus;
       
    80         MStartupUIPhaseObserver* iStartupUIPhaseObserver;
       
    81     };
       
    82 
       
    83 
       
    84 // Class declaration
       
    85 /**
       
    86 * @class CAdtUpdaterContainer
       
    87 * @brief The CCoeControl inheriting class.
       
    88 * @exe adtupdater.exe
       
    89 */
       
    90 class CAdtUpdaterContainer : public CCoeControl, public MStartupUIPhaseObserver
       
    91 	{
       
    92 	public:			// Constructor and destructor
       
    93 	
       
    94 		/**
       
    95 		* @brief Create a CAdtUpdaterContainer object. Performs the first phase of 2-phase construction. 
       
    96 		* @return CAdtUpdaterContainer* A pointer to the created instance of CAdtUpdaterContainer.
       
    97 		*/
       
    98 		static CAdtUpdaterContainer* NewL( const TRect& aRect );
       
    99 		
       
   100 		/**
       
   101 		* @brief Destructor
       
   102 		*/
       
   103 		~CAdtUpdaterContainer();
       
   104 		
       
   105 	public: 		// Functions from base classes
       
   106         /**
       
   107         * @brief Derived from CoeControl.
       
   108         * @see CCoeControl
       
   109         */
       
   110         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
   111         							 TEventCode aType );
       
   112 
       
   113 		/**  
       
   114 		* @brief Derived from CoeControl. Draw this CAdtUpdaterContainer to the screen.
       
   115 		* @param aRect the rectangle of this view that needs updating
       
   116 		*/
       
   117     	void Draw( const TRect& aRect ) const;
       
   118     	
       
   119     	/**  
       
   120 		* @brief From CCoeControl. Returns the TTypeUid::Ptr, used to set the background context.
       
   121 		* @param aId
       
   122 		* @return TTypeUid::Ptr
       
   123 		* @see CCoeControl
       
   124 		*/
       
   125     	TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   126     	
       
   127     	/**
       
   128     	* @brief From CCoeControl. Handles the resource change.
       
   129     	* @param aType The resource that changed.
       
   130     	* @see CCoeControl.
       
   131     	*/
       
   132     	void HandleResourceChange( TInt aType );
       
   133     	
       
   134     public:			// New functions
       
   135     
       
   136     	/**
       
   137     	* @brief Informs the user about time update and starts the timers.
       
   138     	*/
       
   139     	void InformAboutNwUpdateL();
       
   140     	
       
   141     	/**
       
   142     	* @brief Called by CPeriodic, when the time timer expires.
       
   143     	* @param aPtr Pointer to 'this'.
       
   144     	*/
       
   145     	static TInt CallBackL( TAny* aPtr );
       
   146     	
       
   147     	/**
       
   148     	* @brief Called when the timer expires and we've not got Nitz yet.
       
   149     	*/
       
   150     	void NitzInfoNotAvailableL();
       
   151     	
       
   152     	/**
       
   153     	* @brief Called by the Listener when Nitz info is available.
       
   154     	* @param aTimeAttributes Has the Nitz information.
       
   155     	* @param aTimeZoneId Is the timezone Id.
       
   156     	*/
       
   157     	void NitzInfoAvailableL( STimeAttributes aTimeAttributes, TInt aTimeZoneId );
       
   158     	
       
   159     	/**
       
   160     	* @brief Confirms whether it's a first boot or not.
       
   161     	* @param 
       
   162     	* @return TBool
       
   163     	*/
       
   164     	TBool IsFirstBoot();
       
   165     	
       
   166     	/**
       
   167     	* @brief Confirms whether the phone is having sim or not.
       
   168     	* @param 
       
   169     	* @return TBool
       
   170     	*/    	    	
       
   171     	TBool IsSimPresent();
       
   172     	
       
   173     	/**
       
   174     	* @brief Confirms whether nitz is activated for the device.
       
   175     	* @param 
       
   176     	* @retrun TBool
       
   177     	*/
       
   178     	TBool IsNitzPluginActive();
       
   179     	
       
   180     	/**
       
   181     	* @brief Check boot reason from the SysUtil.
       
   182     	* @param 
       
   183     	* @return TBool 
       
   184     	*/
       
   185     	TBool HiddenReset();
       
   186     	
       
   187     	/**
       
   188     	* @brief Check the real time clock status from the SysUtil.
       
   189     	* @param 
       
   190     	* @return TBool 
       
   191     	*/
       
   192     	TBool RTCStatus();
       
   193     	
       
   194     	/**
       
   195     	* @brief Modifies the firstboot flag in cenrep.
       
   196     	*/
       
   197     	void MarkFirstBoot();
       
   198     	
       
   199     	/**
       
   200     	* @brief Deactivate Nitz Plugin.
       
   201     	*/
       
   202     	void DeActivateNitzPlugin();
       
   203     	
       
   204     	/**
       
   205     	* @brief Returns a pointer to the CAdtUpdaterListner.
       
   206     	* @return CAdtUpdaterListener* Pointer to the listener.
       
   207     	*/
       
   208     	CAdtUpdaterListener* Listener();
       
   209     	
       
   210     	/**
       
   211     	* @brief Returns if the dialogs are in display now.
       
   212     	* @return TBool The value of QueryDialogsInDisplay.
       
   213     	*/
       
   214     	TBool QueryDialogsInDisplay();
       
   215     	
       
   216     public:
       
   217     	/**
       
   218         * @brief Show the Date/Time/country/place.time queries.      
       
   219         */
       
   220     	void ShowQueriesL ();
       
   221     			
       
   222    	private:    	// Functions from base classes
       
   223 
       
   224    		/**
       
   225         * @brief From CCoeControl. Handles a chage of client area size.
       
   226         */
       
   227         void SizeChanged();
       
   228         
       
   229         /**
       
   230         * @brief From CCoeControl. Returns the number of components.
       
   231         * @return TInt The number of component controls.
       
   232         */
       
   233         TInt CountComponentControls() const;
       
   234 
       
   235         /**
       
   236         * @brief From CCoeControl. Returns a pointer of component.
       
   237         * @return CCoeControl* Component control.
       
   238         */
       
   239         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   240         
       
   241         /**
       
   242         * @brief Return ETrue if startup queries have to be displayed; otherwise return EFalse
       
   243         * @return TBool
       
   244         */        
       
   245         TBool DisplayStartupQueriesL();
       
   246 
       
   247 	private:		// New functions     
       
   248         
       
   249         /**
       
   250         * @brief By default Symbian OS constructor is private.
       
   251         * @param aRect of this container.
       
   252         */
       
   253         void ConstructL( const TRect& aRect );
       
   254         
       
   255         /**
       
   256         * @brief C++ default constructor.
       
   257         */
       
   258         CAdtUpdaterContainer();
       
   259         
       
   260         /**
       
   261         * @brief Cancels all the pending asynchronous requests made.
       
   262         */
       
   263         void CancelAllRequests();
       
   264         
       
   265         /**
       
   266         * @brief Displays the Nitz information obtained from listener.
       
   267         */
       
   268         void DisplayNitzInfoL();
       
   269         
       
   270         /**
       
   271         * @brief Wait for the Cherry Key values to show the country/city/date/time queries.
       
   272         */
       
   273         void WaitToShowQueriesL();
       
   274         
       
   275 		/**
       
   276         * @brief Continues with normal bootup, by displaying country/city list and date/time queries.
       
   277         */
       
   278         void DoContinueWithNormalBootL();
       
   279 		
       
   280 		/**
       
   281         * @brief display date and time queries if RTC time invalid or Hiddedn Reset.
       
   282         */
       
   283 		void ShowDateAndTimeQueriesL();
       
   284         
       
   285         /**
       
   286         * @brief Prompts the user for country/city list.
       
   287         */
       
   288         void ShowCountryAndCityListsL();
       
   289         
       
   290         /**
       
   291         * @brief Displays the country list to the user.
       
   292         * @return The group id of the country selected.
       
   293         */
       
   294         TInt ShowCountryListL();
       
   295         
       
   296         /**
       
   297         * @brief Displays the city list corresponding to the country selected by the user.
       
   298         * @param aGroupId The group id of the country selected.
       
   299         * @return TInt The id of the selected city.
       
   300         */        
       
   301         TInt ShowCityListL( TInt aGroupId );
       
   302         
       
   303         /**
       
   304         * @brief Queries the user for the Date.
       
   305         */
       
   306         TBool ShowDateQueryL();
       
   307         
       
   308         /**
       
   309         * @brief Queries the user for the Time.
       
   310         */
       
   311         TBool ShowTimeQueryL();
       
   312         
       
   313         /**
       
   314         *  Gets default time and date from cenrep
       
   315         *  @param     aTime Carry the default time from cenrep 
       
   316         *  @return    void
       
   317         */
       
   318          void GetDefaultTimeAndDate( TTime& aTime );   
       
   319          
       
   320          /**
       
   321          *  Gets the index of current country from the country list.
       
   322          *  @param     aGroupId Carry the group id whose index is required in countrylist
       
   323          *  @param     currentMcc Contains the mcc of which localized city has to be found based on one of its one timezone id
       
   324          *  @return    CTzLocalizedCity
       
   325          */   
       
   326          CTzLocalizedCity* GetLocalizedCityL(TInt& currentMcc );      
       
   327          
       
   328          /**
       
   329          *  Gets the index of current country from the country list.
       
   330          *  @param     aGroupId Carry the group id whose index is required in countrylist
       
   331          *  @param     aCountryList The list of all countries
       
   332          *  @return    TInt
       
   333          */
       
   334          TInt IndexOfCountry( TInt aGroupId, CTzLocalizedCityGroupArray* aCountryList );    
       
   335        	
       
   336          /**
       
   337          * @brief  Checks whether Daylightsaving is on or off
       
   338          * @param  aTimeZoneId Carry the timezoneid of which DST status is required
       
   339          * @return TBool
       
   340          */
       
   341          TBool IsDstOnL( TInt aTimeZoneId );
       
   342          
       
   343          /**
       
   344           * @brief  Checks whether predictiveapplcation enable key is on/off.
       
   345           * @return TBool
       
   346           */
       
   347          TBool PredictiveTimeEnabled();
       
   348          
       
   349          /**
       
   350           * @brief  Checks if automatic time update is ON
       
   351           * @return TBool ETrue : if automatic time update is ON
       
   352           */
       
   353          TBool isAutomaticTimeUpdateON();
       
   354   
       
   355 	private:       //Data members
       
   356 		
       
   357 		/**
       
   358 		* @var iBgContext
       
   359 		* @brief The skin control context.
       
   360 		*/
       
   361 		CAknsBasicBackgroundControlContext* 		iBgContext;
       
   362 		
       
   363 		/**
       
   364 		* @var iView
       
   365 		* @brief The application view.
       
   366 		*/
       
   367 		CAdtUpdaterAppView* 						iView;
       
   368 		
       
   369 		/**
       
   370 		* @var iListener
       
   371 		* @brief An active object listening for Nitz.
       
   372 		*/
       
   373 		CAdtUpdaterListener*						iListener;
       
   374 		
       
   375 		/**
       
   376 		* @var iPeriodic
       
   377 		* @brief For the timer.
       
   378 		*/
       
   379 		CPeriodic*									iPeriodic;
       
   380 		
       
   381 		/**
       
   382 		* @var iTimeOut
       
   383 		* @brief Will be ETrue if the iPeriodic timer has expired.
       
   384 		*/
       
   385 		TBool										iTimeOut;
       
   386 		
       
   387 		/**
       
   388 		* @var iTimeAttributes
       
   389 		* @brief Will hold the time information recieved by the listener.
       
   390 		*/
       
   391 		STimeAttributes								iTimeAttributes;
       
   392 		
       
   393 		/**
       
   394 		* @var iTimeZoneId
       
   395 		* @brief Will hold the timezone id recieved by the listener.
       
   396 		*/
       
   397 		TInt 										iTimeZoneId;
       
   398 		
       
   399 		/**
       
   400 		* @var iGMTString
       
   401 		* @brief The string that will be displayed in the global message query dialog,
       
   402 		* 		 when Nitz info is recieved.
       
   403 		*/
       
   404 		HBufC*										iGMTString;
       
   405 		
       
   406 		/**
       
   407 		* @var iGMTText
       
   408 		* @brief String holder for the text "GMT".
       
   409 		*/
       
   410 		HBufC*										iGMTText;		
       
   411 		
       
   412 		/**
       
   413 		* @var iDataAvailability
       
   414 		* @brief Keeps the record of data availability.
       
   415 		*/			
       
   416 		TDataAvailabilityState                      iDataAvailability;
       
   417 		
       
   418 		/**
       
   419 		* @var iAdtUpdaterAppUi
       
   420 		* @brief Keeps the appui of the application.
       
   421 		*/	
       
   422 		CAdtUpdaterAppUi*                           iAdtUpdaterAppUi;
       
   423 		
       
   424 		/**
       
   425 		* @var iQueryDialogsInDisplay
       
   426 		* @brief ETrue if the dialogs are being displayed. By default EFalse.
       
   427 		*/
       
   428 		TBool										iQueryDialogsInDisplay;
       
   429 		
       
   430 		/**
       
   431 		* @var iDisplayStartupQueries
       
   432 		* @brief ETrue if the startup queries have to be displayed, EFalse otherwise.
       
   433 		*/ 
       
   434 		TBool                                       iDisplayStartupQueries;
       
   435 		
       
   436 		/**
       
   437 		* @var iIsRTCInvalidAndHiddenReset
       
   438 		* @brief ETrue if the RTC Time is inavalid or Hidden Rest, EFalse otherwise.
       
   439 		*/
       
   440 		TBool										iIsRTCInvalidAndHiddenReset;  
       
   441 		
       
   442 		CPsKeyObserver* iPSObserver;
       
   443 	};	
       
   444 
       
   445 #endif 		// __ADTUPDATER_CONTAINER_H__
       
   446 
       
   447 // End of file