|
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 |
|
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 declaration |
|
50 /** |
|
51 * @class CAdtUpdaterContainer |
|
52 * @brief The CCoeControl inheriting class. |
|
53 * @exe adtupdater.exe |
|
54 */ |
|
55 class CAdtUpdaterContainer : public CCoeControl |
|
56 { |
|
57 public: // Constructor and destructor |
|
58 |
|
59 /** |
|
60 * @brief Create a CAdtUpdaterContainer object. Performs the first phase of 2-phase construction. |
|
61 * @return CAdtUpdaterContainer* A pointer to the created instance of CAdtUpdaterContainer. |
|
62 */ |
|
63 static CAdtUpdaterContainer* NewL( const TRect& aRect ); |
|
64 |
|
65 /** |
|
66 * @brief Destructor |
|
67 */ |
|
68 ~CAdtUpdaterContainer(); |
|
69 |
|
70 public: // Functions from base classes |
|
71 /** |
|
72 * @brief Derived from CoeControl. |
|
73 * @see CCoeControl |
|
74 */ |
|
75 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
76 TEventCode aType ); |
|
77 |
|
78 /** |
|
79 * @brief Derived from CoeControl. Draw this CAdtUpdaterContainer to the screen. |
|
80 * @param aRect the rectangle of this view that needs updating |
|
81 */ |
|
82 void Draw( const TRect& aRect ) const; |
|
83 |
|
84 /** |
|
85 * @brief From CCoeControl. Returns the TTypeUid::Ptr, used to set the background context. |
|
86 * @param aId |
|
87 * @return TTypeUid::Ptr |
|
88 * @see CCoeControl |
|
89 */ |
|
90 TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
91 |
|
92 /** |
|
93 * @brief From CCoeControl. Handles the resource change. |
|
94 * @param aType The resource that changed. |
|
95 * @see CCoeControl. |
|
96 */ |
|
97 void HandleResourceChange( TInt aType ); |
|
98 |
|
99 public: // New functions |
|
100 |
|
101 /** |
|
102 * @brief Informs the user about time update and starts the timers. |
|
103 */ |
|
104 void InformAboutNwUpdateL(); |
|
105 |
|
106 /** |
|
107 * @brief Called by CPeriodic, when the time timer expires. |
|
108 * @param aPtr Pointer to 'this'. |
|
109 */ |
|
110 static TInt CallBackL( TAny* aPtr ); |
|
111 |
|
112 /** |
|
113 * @brief Called when the timer expires and we've not got Nitz yet. |
|
114 */ |
|
115 void NitzInfoNotAvailableL(); |
|
116 |
|
117 /** |
|
118 * @brief Called by the Listener when Nitz info is available. |
|
119 * @param aTimeAttributes Has the Nitz information. |
|
120 * @param aTimeZoneId Is the timezone Id. |
|
121 */ |
|
122 void NitzInfoAvailableL( STimeAttributes aTimeAttributes, TInt aTimeZoneId ); |
|
123 |
|
124 /** |
|
125 * @brief Confirms whether it's a first boot or not. |
|
126 * @param |
|
127 * @return TBool |
|
128 */ |
|
129 TBool IsFirstBoot(); |
|
130 |
|
131 /** |
|
132 * @brief Confirms whether the phone is having sim or not. |
|
133 * @param |
|
134 * @return TBool |
|
135 */ |
|
136 TBool IsSimPresent(); |
|
137 |
|
138 /** |
|
139 * @brief Confirms whether nitz is activated for the device. |
|
140 * @param |
|
141 * @retrun TBool |
|
142 */ |
|
143 TBool IsNitzPluginActive(); |
|
144 |
|
145 /** |
|
146 * @brief Check boot reason from the SysUtil. |
|
147 * @param |
|
148 * @return TBool |
|
149 */ |
|
150 TBool HiddenReset(); |
|
151 |
|
152 /** |
|
153 * @brief Check the real time clock status from the SysUtil. |
|
154 * @param |
|
155 * @return TBool |
|
156 */ |
|
157 TBool RTCStatus(); |
|
158 |
|
159 /** |
|
160 * @brief Modifies the firstboot flag in cenrep. |
|
161 */ |
|
162 void MarkFirstBoot(); |
|
163 |
|
164 /** |
|
165 * @brief Deactivate Nitz Plugin. |
|
166 */ |
|
167 void DeActivateNitzPlugin(); |
|
168 |
|
169 /** |
|
170 * @brief Returns a pointer to the CAdtUpdaterListner. |
|
171 * @return CAdtUpdaterListener* Pointer to the listener. |
|
172 */ |
|
173 CAdtUpdaterListener* Listener(); |
|
174 |
|
175 /** |
|
176 * @brief Returns if the dialogs are in display now. |
|
177 * @return TBool The value of QueryDialogsInDisplay. |
|
178 */ |
|
179 TBool QueryDialogsInDisplay(); |
|
180 |
|
181 private: // Functions from base classes |
|
182 |
|
183 /** |
|
184 * @brief From CCoeControl. Handles a chage of client area size. |
|
185 */ |
|
186 void SizeChanged(); |
|
187 |
|
188 /** |
|
189 * @brief From CCoeControl. Returns the number of components. |
|
190 * @return TInt The number of component controls. |
|
191 */ |
|
192 TInt CountComponentControls() const; |
|
193 |
|
194 /** |
|
195 * @brief From CCoeControl. Returns a pointer of component. |
|
196 * @return CCoeControl* Component control. |
|
197 */ |
|
198 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
199 |
|
200 /** |
|
201 * @brief Return ETrue if startup queries have to be displayed; otherwise return EFalse |
|
202 * @return TBool |
|
203 */ |
|
204 TBool DisplayStartupQueriesL(); |
|
205 |
|
206 private: // New functions |
|
207 |
|
208 /** |
|
209 * @brief By default Symbian OS constructor is private. |
|
210 * @param aRect of this container. |
|
211 */ |
|
212 void ConstructL( const TRect& aRect ); |
|
213 |
|
214 /** |
|
215 * @brief C++ default constructor. |
|
216 */ |
|
217 CAdtUpdaterContainer(); |
|
218 |
|
219 /** |
|
220 * @brief Cancels all the pending asynchronous requests made. |
|
221 */ |
|
222 void CancelAllRequests(); |
|
223 |
|
224 /** |
|
225 * @brief Displays the Nitz information obtained from listener. |
|
226 */ |
|
227 void DisplayNitzInfoL(); |
|
228 |
|
229 /** |
|
230 * @brief Continues with normal bootup, by displaying country/city list and date/time queries. |
|
231 */ |
|
232 void ContinueWithNormalBootL(); |
|
233 |
|
234 /** |
|
235 * @brief Prompts the user for country/city list. |
|
236 */ |
|
237 void ShowCountryAndCityListsL(); |
|
238 |
|
239 /** |
|
240 * @brief Displays the country list to the user. |
|
241 * @return The group id of the country selected. |
|
242 */ |
|
243 TInt ShowCountryListL(); |
|
244 |
|
245 /** |
|
246 * @brief Displays the city list corresponding to the country selected by the user. |
|
247 * @param aGroupId The group id of the country selected. |
|
248 * @return TInt The id of the selected city. |
|
249 */ |
|
250 TInt ShowCityListL( TInt aGroupId ); |
|
251 |
|
252 /** |
|
253 * @brief Queries the user for the Date. |
|
254 */ |
|
255 TBool ShowDateQueryL(); |
|
256 |
|
257 /** |
|
258 * @brief Queries the user for the Time. |
|
259 */ |
|
260 TBool ShowTimeQueryL(); |
|
261 |
|
262 /** |
|
263 * Gets default time and date from cenrep |
|
264 * @param aTime Carry the default time from cenrep |
|
265 * @return void |
|
266 */ |
|
267 void GetDefaultTimeAndDate( TTime& aTime ); |
|
268 |
|
269 /** |
|
270 * Gets the index of current country from the country list. |
|
271 * @param aGroupId Carry the group id whose index is required in countrylist |
|
272 * @param currentMcc Contains the mcc of which localized city has to be found based on one of its one timezone id |
|
273 * @return CTzLocalizedCity |
|
274 */ |
|
275 CTzLocalizedCity* GetLocalizedCityL(TInt& currentMcc ); |
|
276 |
|
277 /** |
|
278 * Gets the index of current country from the country list. |
|
279 * @param aGroupId Carry the group id whose index is required in countrylist |
|
280 * @param aCountryList The list of all countries |
|
281 * @return TInt |
|
282 */ |
|
283 TInt IndexOfCountry( TInt aGroupId, CTzLocalizedCityGroupArray* aCountryList ); |
|
284 |
|
285 /** |
|
286 * @brief Checks whether Daylightsaving is on or off |
|
287 * @param aTimeZoneId Carry the timezoneid of which DST status is required |
|
288 * @return TBool |
|
289 */ |
|
290 TBool IsDstOnL( TInt aTimeZoneId ); |
|
291 |
|
292 private: //Data members |
|
293 |
|
294 /** |
|
295 * @var iBgContext |
|
296 * @brief The skin control context. |
|
297 */ |
|
298 CAknsBasicBackgroundControlContext* iBgContext; |
|
299 |
|
300 /** |
|
301 * @var iView |
|
302 * @brief The application view. |
|
303 */ |
|
304 CAdtUpdaterAppView* iView; |
|
305 |
|
306 /** |
|
307 * @var iListener |
|
308 * @brief An active object listening for Nitz. |
|
309 */ |
|
310 CAdtUpdaterListener* iListener; |
|
311 |
|
312 /** |
|
313 * @var iPeriodic |
|
314 * @brief For the timer. |
|
315 */ |
|
316 CPeriodic* iPeriodic; |
|
317 |
|
318 /** |
|
319 * @var iTimeOut |
|
320 * @brief Will be ETrue if the iPeriodic timer has expired. |
|
321 */ |
|
322 TBool iTimeOut; |
|
323 |
|
324 /** |
|
325 * @var iTimeAttributes |
|
326 * @brief Will hold the time information recieved by the listener. |
|
327 */ |
|
328 STimeAttributes iTimeAttributes; |
|
329 |
|
330 /** |
|
331 * @var iTimeZoneId |
|
332 * @brief Will hold the timezone id recieved by the listener. |
|
333 */ |
|
334 TInt iTimeZoneId; |
|
335 |
|
336 /** |
|
337 * @var iGMTString |
|
338 * @brief The string that will be displayed in the global message query dialog, |
|
339 * when Nitz info is recieved. |
|
340 */ |
|
341 HBufC* iGMTString; |
|
342 |
|
343 /** |
|
344 * @var iGMTText |
|
345 * @brief String holder for the text "GMT". |
|
346 */ |
|
347 HBufC* iGMTText; |
|
348 |
|
349 /** |
|
350 * @var iDataAvailability |
|
351 * @brief Keeps the record of data availability. |
|
352 */ |
|
353 TDataAvailabilityState iDataAvailability; |
|
354 |
|
355 /** |
|
356 * @var iAdtUpdaterAppUi |
|
357 * @brief Keeps the appui of the application. |
|
358 */ |
|
359 CAdtUpdaterAppUi* iAdtUpdaterAppUi; |
|
360 |
|
361 /** |
|
362 * @var iQueryDialogsInDisplay |
|
363 * @brief ETrue if the dialogs are being displayed. By default EFalse. |
|
364 */ |
|
365 TBool iQueryDialogsInDisplay; |
|
366 |
|
367 /** |
|
368 * @var iDisplayStartupQueries |
|
369 * @brief ETrue if the startup queries have to be displayed, EFalse otherwise. |
|
370 */ |
|
371 TBool iDisplayStartupQueries; |
|
372 }; |
|
373 |
|
374 #endif // __ADTUPDATER_CONTAINER_H__ |
|
375 |
|
376 // End of file |