|
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 source file for the CClkDateTimeViewExtension class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // System Includes |
|
19 #include <StringLoader.h> |
|
20 #include <pathinfo.h> |
|
21 #include <ConeResLoader.h> |
|
22 #include <clockdomaincrkeys.h> |
|
23 #include <centralrepository.h> |
|
24 #include <ProfileEngineDomainConstants.h> |
|
25 #include <e32math.h> |
|
26 #include <clock.rsg> |
|
27 #include <aknpopupsettingpage.h> |
|
28 #include <AknQueryValueText.h> |
|
29 |
|
30 // User Includes |
|
31 #include "clkdatetimeview.hrh" |
|
32 #include "clkdatetimeviewextension.h" |
|
33 #include "clockecomlistener.h" |
|
34 #include "clkdatetimeview.h" |
|
35 #include "clkcommon.h" |
|
36 |
|
37 // Constants |
|
38 const TInt KSnoozeTimeDigits( 2 ); |
|
39 const TInt KBaseTwo( 2 ); |
|
40 const TInt KOneMinute( 1 ); |
|
41 const TInt KGmtStringLength( 32 ); |
|
42 const TInt KWorkDaysBufferLength( 10 ); |
|
43 const TInt KOneCharacter( 1 ); |
|
44 |
|
45 // Literals |
|
46 |
|
47 // --------------------------------------------------------- |
|
48 // CClkDateTimeViewExtension::NewL |
|
49 // rest of the details are commented in the header |
|
50 // --------------------------------------------------------- |
|
51 // |
|
52 CClkDateTimeViewExtension* CClkDateTimeViewExtension::NewL( CClkDateTimeView* aParent, CCoeEnv* aEnv ) |
|
53 { |
|
54 CClkDateTimeViewExtension* self = new ( ELeave ) CClkDateTimeViewExtension( aParent, aEnv ); |
|
55 CleanupStack::PushL( self ); |
|
56 |
|
57 self->ConstructL(); |
|
58 |
|
59 CleanupStack::Pop( self ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CClkDateTimeViewExtension::~CClkDateTimeViewExtension |
|
65 // rest of the details are commented in the header |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 CClkDateTimeViewExtension::~CClkDateTimeViewExtension() |
|
69 { |
|
70 DeleteResourceBuf(); |
|
71 |
|
72 if( iWorkDaysStr ) |
|
73 { |
|
74 delete iWorkDaysStr; |
|
75 iWorkDaysStr = NULL; |
|
76 } |
|
77 if( iWorkDaysList ) |
|
78 { |
|
79 delete iWorkDaysList; |
|
80 iWorkDaysList = NULL; |
|
81 } |
|
82 if( iWorkDaysShortList ) |
|
83 { |
|
84 delete iWorkDaysShortList; |
|
85 iWorkDaysShortList = NULL; |
|
86 } |
|
87 if( iAlarmToneNotifier ) |
|
88 { |
|
89 iAlarmToneNotifier->StopListening(); |
|
90 delete iAlarmToneNotifier; |
|
91 iAlarmToneNotifier = NULL; |
|
92 } |
|
93 if( iSnoozeValueNotifier ) |
|
94 { |
|
95 iSnoozeValueNotifier->StopListening(); |
|
96 delete iSnoozeValueNotifier; |
|
97 iSnoozeValueNotifier = NULL; |
|
98 } |
|
99 if( iSnoozeValueNotifier ) |
|
100 { |
|
101 delete iSnoozeValueNotifier; |
|
102 iSnoozeValueNotifier = NULL; |
|
103 } |
|
104 if( iRepository ) |
|
105 { |
|
106 delete iRepository; |
|
107 iRepository = NULL; |
|
108 } |
|
109 if( iSilentTone ) |
|
110 { |
|
111 delete iSilentTone; |
|
112 iSilentTone = NULL; |
|
113 } |
|
114 if( iClockEComListener ) |
|
115 { |
|
116 delete iClockEComListener; |
|
117 iClockEComListener = NULL; |
|
118 } |
|
119 if( iAutomaticTimeUpdateString ) |
|
120 { |
|
121 delete iAutomaticTimeUpdateString; |
|
122 iAutomaticTimeUpdateString = NULL; |
|
123 } |
|
124 |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------- |
|
128 // CClkDateTimeViewExtension::NotifyPluginInstallUninstallL |
|
129 // rest of the details are commented in the header |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 void CClkDateTimeViewExtension::NotifyPluginInstallUninstallL( const CImplementationInformation& /*aImplInfo*/, TBool /*aInstalled*/ ) |
|
133 { |
|
134 // Check if the auto time update page is being shown. |
|
135 if( iAutoTimeUpdatePageOpen ) |
|
136 { |
|
137 // TODO : We need to update the page dynamically. |
|
138 // Due to some issues with the way the framework handles dynamic updation, we dont do it as of now. |
|
139 // RefreshAutoTimeUpdatePageL(); |
|
140 } |
|
141 else |
|
142 { |
|
143 // Update the time update and timezone fields. |
|
144 iParent->HandleSettingsChangeL( 0 ); |
|
145 } |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------- |
|
149 // CClkDateTimeViewExtension::HandleNotifyStringL |
|
150 // rest of the details are commented in the header |
|
151 // --------------------------------------------------------- |
|
152 // |
|
153 void CClkDateTimeViewExtension::HandleNotifyStringL( TUint32 aId, const TDesC16& aNewValue ) |
|
154 { |
|
155 // Let the datetime view update itself. |
|
156 iParent->UpdateDTViewL( aId, aNewValue ); |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------- |
|
160 // CClkDateTimeViewExtension::GetAlarmSnoozeTimeStr |
|
161 // rest of the details are commented in the header |
|
162 // --------------------------------------------------------- |
|
163 // |
|
164 HBufC* CClkDateTimeViewExtension::GetAlarmSnoozeTimeStr() |
|
165 { |
|
166 return iAlarmSnoozeTime; |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------- |
|
170 // CClkDateTimeViewExtension::DeleteResourceBuf |
|
171 // rest of the details are commented in the header |
|
172 // --------------------------------------------------------- |
|
173 // |
|
174 void CClkDateTimeViewExtension::DeleteResourceBuf() |
|
175 { |
|
176 if( iAlarmSnoozeTime ) |
|
177 { |
|
178 delete iAlarmSnoozeTime; |
|
179 iAlarmSnoozeTime = NULL; |
|
180 } |
|
181 if( iSnoozeTime ) |
|
182 { |
|
183 delete iSnoozeTime; |
|
184 iSnoozeTime = NULL; |
|
185 } |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------- |
|
189 // CClkDateTimeViewExtension::MakeSnoozeTimeItemL |
|
190 // rest of the details are commented in the header |
|
191 // --------------------------------------------------------- |
|
192 // |
|
193 void CClkDateTimeViewExtension::MakeSnoozeTimeItemL() |
|
194 { |
|
195 TBuf< KSnoozeTimeDigits > snoozeTimeBuf; |
|
196 // Convert the number to string. |
|
197 snoozeTimeBuf.Num( iSnoozeTimeValue ); |
|
198 |
|
199 if( iSnoozeTime ) |
|
200 { |
|
201 delete iSnoozeTime; |
|
202 iSnoozeTime = NULL; |
|
203 } |
|
204 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( snoozeTimeBuf ); |
|
205 |
|
206 if( iSnoozeTimeValue == KOneMinute ) |
|
207 { |
|
208 // If snooze time is 1, load 'Minute'( singular ) string. |
|
209 iSnoozeTime = StringLoader::LoadL( R_QTN_SANIM_TIME_OUT_SLIDER_YKCUR, iEnv ); |
|
210 } |
|
211 else |
|
212 { |
|
213 // If snooze time is more than 1, load 'Minutes'(plural) string. |
|
214 iSnoozeTime = StringLoader::LoadL( R_QTN_SANIM_TIME_OUT_SLIDER_CUR, snoozeTimeBuf, iEnv ); |
|
215 } |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------- |
|
219 // CClkDateTimeViewExtension::GetSnoozeTimeStr |
|
220 // rest of the details are commented in the header |
|
221 // --------------------------------------------------------- |
|
222 // |
|
223 HBufC* CClkDateTimeViewExtension::GetSnoozeTimeStr() |
|
224 { |
|
225 return iSnoozeTime; |
|
226 } |
|
227 |
|
228 // --------------------------------------------------------- |
|
229 // CClkDateTimeViewExtension::GetWorkDays |
|
230 // rest of the details are commented in the header |
|
231 // --------------------------------------------------------- |
|
232 // |
|
233 TUint CClkDateTimeViewExtension::GetWorkDays() |
|
234 { |
|
235 return iWorkDays; |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------- |
|
239 // CClkDateTimeViewExtension::SetWorkDays |
|
240 // rest of the details are commented in the header |
|
241 // --------------------------------------------------------- |
|
242 // |
|
243 void CClkDateTimeViewExtension::SetWorkDays( TUint aWorkDays ) |
|
244 { |
|
245 iWorkDays = aWorkDays; |
|
246 } |
|
247 |
|
248 // --------------------------------------------------------- |
|
249 // CClkDateTimeViewExtension::ConstructWorkDaysStrL |
|
250 // rest of the details are commented in the header |
|
251 // --------------------------------------------------------- |
|
252 // |
|
253 void CClkDateTimeViewExtension::ConstructWorkDaysStrL() |
|
254 { |
|
255 // Changes to prevent the overflowing size of final str is going 30 when hindi fonts are in use. |
|
256 TBuf< KGmtStringLength > finalStr; |
|
257 HBufC* workDaySeparator = StringLoader::LoadLC( R_QTN_WORD_LIST_SEPARATOR, iEnv ); |
|
258 |
|
259 // Get the days that are currently chosen as workdays. |
|
260 for( TInt index( FALSE ); index < iWorkDaysShortList->MdcaCount(); index++ ) |
|
261 { |
|
262 TReal powExponent; |
|
263 Math::Pow( powExponent, KBaseTwo, index ); |
|
264 |
|
265 if( iWorkDays & ( TInt )powExponent ) |
|
266 { |
|
267 TBuf< KWorkDaysBufferLength > tempBuf = ( *iWorkDaysShortList )[ index ]; |
|
268 finalStr.Append( tempBuf ); |
|
269 finalStr.Append( workDaySeparator->Des() ); |
|
270 } |
|
271 } |
|
272 |
|
273 // Remove the last character. |
|
274 if( FALSE < finalStr.Length() ) |
|
275 { |
|
276 finalStr.Delete( finalStr.Length() - KOneCharacter, KOneCharacter ); |
|
277 } |
|
278 |
|
279 if( iWorkDaysStr ) |
|
280 { |
|
281 delete iWorkDaysStr; |
|
282 iWorkDaysStr = NULL; |
|
283 } |
|
284 |
|
285 // The final workdays' string. |
|
286 iWorkDaysStr = finalStr.Alloc(); |
|
287 |
|
288 // Cleanup. |
|
289 CleanupStack::PopAndDestroy( workDaySeparator ); |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------- |
|
293 // CClkDateTimeViewExtension::GetWorkDaysStr |
|
294 // rest of the details are commented in the header |
|
295 // --------------------------------------------------------- |
|
296 // |
|
297 HBufC* CClkDateTimeViewExtension::GetWorkDaysStr() |
|
298 { |
|
299 return iWorkDaysStr; |
|
300 } |
|
301 |
|
302 // --------------------------------------------------------- |
|
303 // CClkDateTimeViewExtension::GetWorkDaysList |
|
304 // rest of the details are commented in the header |
|
305 // --------------------------------------------------------- |
|
306 // |
|
307 CDesCArrayFlat* CClkDateTimeViewExtension::GetWorkDaysList() |
|
308 { |
|
309 return iWorkDaysList; |
|
310 } |
|
311 |
|
312 // --------------------------------------------------------- |
|
313 // CClkDateTimeViewExtension::StartListeningL |
|
314 // rest of the details are commented in the header |
|
315 // --------------------------------------------------------- |
|
316 // |
|
317 void CClkDateTimeViewExtension::StartListeningL() |
|
318 { |
|
319 if( iAlarmToneNotifier ) |
|
320 { |
|
321 iAlarmToneNotifier->StartListeningL(); |
|
322 } |
|
323 |
|
324 if( iSnoozeValueNotifier ) |
|
325 { |
|
326 iSnoozeValueNotifier->StartListeningL(); |
|
327 } |
|
328 } |
|
329 |
|
330 // --------------------------------------------------------- |
|
331 // CClkDateTimeViewExtension::StopListening |
|
332 // rest of the details are commented in the header |
|
333 // --------------------------------------------------------- |
|
334 // |
|
335 void CClkDateTimeViewExtension::StopListening() |
|
336 { |
|
337 if( iAlarmToneNotifier ) |
|
338 { |
|
339 iAlarmToneNotifier->StopListening(); |
|
340 } |
|
341 |
|
342 if( iSnoozeValueNotifier ) |
|
343 { |
|
344 iSnoozeValueNotifier->StopListening(); |
|
345 } |
|
346 } |
|
347 |
|
348 // --------------------------------------------------------- |
|
349 // CClkDateTimeViewExtension::GetSnoozeTimeValue |
|
350 // rest of the details are commented in the header |
|
351 // --------------------------------------------------------- |
|
352 // |
|
353 TInt CClkDateTimeViewExtension::GetSnoozeTimeValue() |
|
354 { |
|
355 return iSnoozeTimeValue ; |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------- |
|
359 // CClkDateTimeViewExtension::SetSnoozeTimeValue |
|
360 // rest of the details are commented in the header |
|
361 // --------------------------------------------------------- |
|
362 // |
|
363 void CClkDateTimeViewExtension::SetSnoozeTimeValue( TInt aSnoozeTimeValue ) |
|
364 { |
|
365 iSnoozeTimeValue = aSnoozeTimeValue; |
|
366 } |
|
367 |
|
368 // --------------------------------------------------------- |
|
369 // CClkDateTimeViewExtension::GetSilentToneStr |
|
370 // rest of the details are commented in the header |
|
371 // --------------------------------------------------------- |
|
372 // |
|
373 HBufC* CClkDateTimeViewExtension::GetSilentToneStr() |
|
374 { |
|
375 return iSilentTone; |
|
376 } |
|
377 |
|
378 // --------------------------------------------------------- |
|
379 // CClkDateTimeViewExtension::SetUsedByGS |
|
380 // rest of the details are commented in the header |
|
381 // --------------------------------------------------------- |
|
382 // |
|
383 void CClkDateTimeViewExtension::SetUsedByGS() |
|
384 { |
|
385 iUsedByGS = ETrue; |
|
386 } |
|
387 |
|
388 // --------------------------------------------------------- |
|
389 // CClkDateTimeViewExtension::UsedByGS |
|
390 // rest of the details are commented in the header |
|
391 // --------------------------------------------------------- |
|
392 // |
|
393 TBool CClkDateTimeViewExtension::UsedByGS() |
|
394 { |
|
395 return iUsedByGS; |
|
396 } |
|
397 |
|
398 // --------------------------------------------------------- |
|
399 // CClkDateTimeViewExtension::AlarmToneListInUse |
|
400 // rest of the details are commented in the header |
|
401 // --------------------------------------------------------- |
|
402 // |
|
403 TBool CClkDateTimeViewExtension::AlarmToneListInUse() |
|
404 { |
|
405 return iAlarmToneListInUse; |
|
406 } |
|
407 |
|
408 // --------------------------------------------------------- |
|
409 // CClkDateTimeViewExtension::AlarmToneListInUse |
|
410 // rest of the details are commented in the header |
|
411 // --------------------------------------------------------- |
|
412 // |
|
413 void CClkDateTimeViewExtension::SetAlarmToneListInUse( TBool aAlarmToneListInUse ) |
|
414 { |
|
415 iAlarmToneListInUse = aAlarmToneListInUse; |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------- |
|
419 // CClkDateTimeViewExtension::IsUnLocalisedCity |
|
420 // rest of the details are commented in the header |
|
421 // --------------------------------------------------------- |
|
422 // |
|
423 TBool CClkDateTimeViewExtension::IsUnLocalisedCity() |
|
424 { |
|
425 return iUnlocalisedCity; |
|
426 } |
|
427 |
|
428 // --------------------------------------------------------- |
|
429 // CClkDateTimeViewExtension::UnLocalisedCity |
|
430 // rest of the details are commented in the header |
|
431 // --------------------------------------------------------- |
|
432 // |
|
433 void CClkDateTimeViewExtension::UnLocalisedCity( TBool aUnlocalisedCity ) |
|
434 { |
|
435 iUnlocalisedCity = aUnlocalisedCity; |
|
436 } |
|
437 |
|
438 // --------------------------------------------------------- |
|
439 // CClkDateTimeViewExtension::IsAutoTimeUpdatePageOpen |
|
440 // rest of the details are commented in the header |
|
441 // --------------------------------------------------------- |
|
442 // |
|
443 TBool CClkDateTimeViewExtension::IsAutoTimeUpdatePageOpen() |
|
444 { |
|
445 return iAutoTimeUpdatePageOpen; |
|
446 } |
|
447 |
|
448 // --------------------------------------------------------- |
|
449 // CClkDateTimeViewExtension::SetAutoTimeUpdatePageOpen |
|
450 // rest of the details are commented in the header |
|
451 // --------------------------------------------------------- |
|
452 // |
|
453 void CClkDateTimeViewExtension::SetAutoTimeUpdatePageOpen( TBool aOpen ) |
|
454 { |
|
455 iAutoTimeUpdatePageOpen = aOpen; |
|
456 } |
|
457 |
|
458 // --------------------------------------------------------- |
|
459 // CClkDateTimeViewExtension::GetQueryTextArray |
|
460 // rest of the details are commented in the header |
|
461 // --------------------------------------------------------- |
|
462 // |
|
463 CAknQueryValueTextArray* CClkDateTimeViewExtension::GetQueryTextArray() |
|
464 { |
|
465 return iTextArray; |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------- |
|
469 // CClkDateTimeViewExtension::SetQueryTextArray |
|
470 // rest of the details are commented in the header |
|
471 // --------------------------------------------------------- |
|
472 // |
|
473 void CClkDateTimeViewExtension::SetQueryTextArray( CAknQueryValueTextArray* aTextArray ) |
|
474 { |
|
475 iTextArray = aTextArray; |
|
476 } |
|
477 |
|
478 // --------------------------------------------------------- |
|
479 // CClkDateTimeViewExtension::GetQueryValueText |
|
480 // rest of the details are commented in the header |
|
481 // --------------------------------------------------------- |
|
482 // |
|
483 CAknQueryValueText* CClkDateTimeViewExtension::GetQueryValueText() |
|
484 { |
|
485 return iQueryValue; |
|
486 } |
|
487 |
|
488 // --------------------------------------------------------- |
|
489 // CClkDateTimeViewExtension::SetQueryValueText |
|
490 // rest of the details are commented in the header |
|
491 // --------------------------------------------------------- |
|
492 // |
|
493 void CClkDateTimeViewExtension::SetQueryValueText( CAknQueryValueText* aQueryValueText ) |
|
494 { |
|
495 iQueryValue = aQueryValueText; |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------- |
|
499 // CClkDateTimeViewExtension::SetPopupSettingPage |
|
500 // rest of the details are commented in the header |
|
501 // --------------------------------------------------------- |
|
502 // |
|
503 void CClkDateTimeViewExtension::SetPopupSettingPage( CAknPopupSettingPage* aPopupSettingPage ) |
|
504 { |
|
505 iSettingPage = aPopupSettingPage; |
|
506 } |
|
507 |
|
508 // --------------------------------------------------------- |
|
509 // CClkDateTimeViewExtension::GetPluginList |
|
510 // rest of the details are commented in the header |
|
511 // --------------------------------------------------------- |
|
512 // |
|
513 CDesCArrayFlat* CClkDateTimeViewExtension::GetPluginList() |
|
514 { |
|
515 return iPluginList; |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------- |
|
519 // CClkDateTimeViewExtension::SetPluginList |
|
520 // rest of the details are commented in the header |
|
521 // --------------------------------------------------------- |
|
522 // |
|
523 void CClkDateTimeViewExtension::SetPluginList( CDesCArrayFlat* aPluginList ) |
|
524 { |
|
525 iPluginList = aPluginList; |
|
526 } |
|
527 |
|
528 // --------------------------------------------------------- |
|
529 // CClkDateTimeViewExtension::GetActiveProtocol |
|
530 // rest of the details are commented in the header |
|
531 // --------------------------------------------------------- |
|
532 // |
|
533 TInt CClkDateTimeViewExtension::GetActiveProtocol() |
|
534 { |
|
535 return iActiveProtocol; |
|
536 } |
|
537 |
|
538 // --------------------------------------------------------- |
|
539 // CClkDateTimeViewExtension::SetActiveProtocol |
|
540 // rest of the details are commented in the header |
|
541 // --------------------------------------------------------- |
|
542 // |
|
543 void CClkDateTimeViewExtension::SetActiveProtocol( TInt aProtocolsState ) |
|
544 { |
|
545 iActiveProtocol = aProtocolsState; |
|
546 } |
|
547 |
|
548 // --------------------------------------------------------- |
|
549 // CClkDateTimeViewExtension::QueryPopupSettingPageL |
|
550 // rest of the details are commented in the header |
|
551 // --------------------------------------------------------- |
|
552 // |
|
553 TInt CClkDateTimeViewExtension::QueryPopupSettingPageL() |
|
554 { |
|
555 // Construct the list of plugins that we support. |
|
556 iPluginList = new( ELeave ) CDesCArrayFlat( KBaseTwo ); |
|
557 |
|
558 // Append Off text. |
|
559 iPluginList->AppendL( iParent->GetAutoTimeUpdateStr( EFalse ) ); |
|
560 |
|
561 // Append On text. |
|
562 iPluginList->AppendL( iParent->GetAutoTimeUpdateStr( ETrue ) ); |
|
563 |
|
564 // Get the currently active plugin. |
|
565 TInt activeProtocol( GetActiveProtocol() ); |
|
566 |
|
567 TInt highlightIndex( KZerothIndex ); |
|
568 |
|
569 if( activeProtocol ) |
|
570 { |
|
571 highlightIndex =highlightIndex+1; |
|
572 } |
|
573 |
|
574 TInt returnVal( KZerothIndex ); |
|
575 // Construct the text array for the page. |
|
576 iTextArray = CAknQueryValueTextArray::NewL(); |
|
577 iTextArray->SetArray( *iPluginList ); |
|
578 |
|
579 // Construct the text value. |
|
580 iQueryValue = CAknQueryValueText::NewL(); |
|
581 iQueryValue->SetArrayL( iTextArray ); |
|
582 iQueryValue->SetCurrentValueIndex( highlightIndex ); |
|
583 |
|
584 iSettingPage = new( ELeave ) CAknPopupSettingPage( R_DATE_TIME_POPUP_PAGE_MSK, *iQueryValue ); |
|
585 // Set the header text. |
|
586 iSettingPage->SetSettingTextL( *iAutomaticTimeUpdateString ); |
|
587 |
|
588 // Set the flag to indicate the page is open. |
|
589 SetAutoTimeUpdatePageOpen( ETrue ); |
|
590 |
|
591 if( iSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
592 { |
|
593 returnVal = iQueryValue->CurrentValueIndex(); |
|
594 } |
|
595 else |
|
596 { |
|
597 returnVal = KErrCancel; |
|
598 } |
|
599 |
|
600 // The page has been closed. |
|
601 SetAutoTimeUpdatePageOpen( EFalse ); |
|
602 |
|
603 // Cleanup. |
|
604 if( iQueryValue ) |
|
605 { |
|
606 delete iQueryValue; |
|
607 iQueryValue = NULL; |
|
608 } |
|
609 if( iTextArray ) |
|
610 { |
|
611 delete iTextArray; |
|
612 iTextArray = NULL; |
|
613 } |
|
614 if( iPluginList ) |
|
615 { |
|
616 delete iPluginList; |
|
617 iPluginList = NULL; |
|
618 } |
|
619 |
|
620 // Return. |
|
621 return returnVal; |
|
622 } |
|
623 |
|
624 // --------------------------------------------------------- |
|
625 // CClkDateTimeViewExtension::RefreshAutoTimeUpdatePageL |
|
626 // rest of the details are commented in the header |
|
627 // --------------------------------------------------------- |
|
628 // |
|
629 void CClkDateTimeViewExtension::RefreshAutoTimeUpdatePageL() |
|
630 { |
|
631 // Array to return all implementations in an interface. |
|
632 RImplInfoPtrArray plugInArray; |
|
633 // Get the list of all implementations. |
|
634 REComSession::ListImplementationsL( KTimeSourceInterfaceUID, plugInArray ); |
|
635 |
|
636 if( !plugInArray.Count() ) |
|
637 { |
|
638 // There are no plugins to list. Simply return. |
|
639 plugInArray.ResetAndDestroy(); |
|
640 plugInArray.Close(); |
|
641 return; |
|
642 } |
|
643 |
|
644 if( plugInArray.Count() ) |
|
645 { |
|
646 if( iPluginList ) |
|
647 { |
|
648 delete iPluginList; |
|
649 iPluginList = NULL; |
|
650 } |
|
651 // Construct the list of plugins that we support. |
|
652 iPluginList = new( ELeave ) CDesCArrayFlat( plugInArray.Count() + 1 ); |
|
653 // Append Off text. |
|
654 iPluginList->AppendL( iParent->GetAutoTimeUpdateStr( EFalse ) ); |
|
655 |
|
656 // Update the currently active protocol because some protocol which was active |
|
657 // might have got uninstalled. |
|
658 TInt highlightIndex( KZerothIndex ); |
|
659 for( TInt index( KZerothIndex ); index < plugInArray.Count(); index++ ) |
|
660 { |
|
661 iPluginList->AppendL( plugInArray[ index ]->DisplayName() ); |
|
662 if( iActiveProtocol == plugInArray[ index ]->ImplementationUid().iUid ) |
|
663 { |
|
664 // We need to highlight this item by default. |
|
665 highlightIndex = index + 1; |
|
666 } |
|
667 } |
|
668 |
|
669 // Delete the previous values if present. |
|
670 /*if( iPrevTextArray ) |
|
671 { |
|
672 delete iPrevTextArray; |
|
673 iPrevTextArray = NULL; |
|
674 } |
|
675 if( iPrevQueryValue ) |
|
676 { |
|
677 delete iPrevQueryValue; |
|
678 iPrevQueryValue = NULL; |
|
679 } |
|
680 // Store the previous array references. |
|
681 CAknQueryValueTextArray* iPrevTextArray( iTextArray ); |
|
682 CAknQueryValueText* iPrevQueryValue( iQueryValue );*/ |
|
683 |
|
684 // Construct the new array. |
|
685 iTextArray = CAknQueryValueTextArray::NewL(); |
|
686 iTextArray->SetArray( *iPluginList ); |
|
687 |
|
688 iQueryValue = CAknQueryValueText::NewL(); |
|
689 iQueryValue->SetArrayL( iTextArray ); |
|
690 iQueryValue->SetCurrentValueIndex( highlightIndex ); |
|
691 |
|
692 // Update the settings page with the new value. |
|
693 iSettingPage->UpdateQueryValueL( iQueryValue ); |
|
694 |
|
695 // Cleanup. |
|
696 // delete prevTextArray; |
|
697 // delete prevQueryValue; |
|
698 } |
|
699 // Cleanup. |
|
700 plugInArray.ResetAndDestroy(); |
|
701 plugInArray.Close(); |
|
702 } |
|
703 |
|
704 // --------------------------------------------------------- |
|
705 // CClkDateTimeViewExtension::CClkDateTimeViewExtension |
|
706 // rest of the details are commented in the header |
|
707 // --------------------------------------------------------- |
|
708 // |
|
709 CClkDateTimeViewExtension::CClkDateTimeViewExtension( CClkDateTimeView* aParent, |
|
710 CCoeEnv* aEnv ) |
|
711 : iParent( aParent ), |
|
712 iEnv( aEnv ) |
|
713 { |
|
714 // No implementation yet. |
|
715 } |
|
716 |
|
717 // --------------------------------------------------------- |
|
718 // CClkDateTimeViewExtension::ConstructL |
|
719 // rest of the details are commented in the header |
|
720 // --------------------------------------------------------- |
|
721 // |
|
722 void CClkDateTimeViewExtension::ConstructL() |
|
723 { |
|
724 // Open the repository for the clock application. |
|
725 iRepository = CRepository::NewL( KCRUidClockApp ); |
|
726 |
|
727 // The resources strings. |
|
728 iAlarmSnoozeTime = StringLoader::LoadL( R_QTN_CLK_SETT_SNOOZE_TIME, iEnv ); |
|
729 |
|
730 // The item arrays. |
|
731 iWorkDaysList = iEnv->ReadDesCArrayResourceL( R_CLOCK_WEEK_DAYS_ARRAY ); |
|
732 iWorkDaysShortList = iEnv->ReadDesCArrayResourceL( R_CLOCK_WEEK_DAYS_SHORT_ARRAY ); |
|
733 |
|
734 // Cenrep change notifiers. |
|
735 iAlarmToneNotifier = CCenRepNotifyHandler::NewL( *this, *iRepository, CCenRepNotifyHandler::EStringKey, KClockAppSoundFile ); |
|
736 iSnoozeValueNotifier = CCenRepNotifyHandler::NewL( *this, *iRepository, CCenRepNotifyHandler::EStringKey, KClockAppSnoozeTime ); |
|
737 |
|
738 // Get the silent ringtone. |
|
739 TFileName* fileName = new ( ELeave ) TFileName( TParsePtrC( PathInfo::RomRootPath() ).Drive() ); |
|
740 CleanupStack::PushL( fileName ); |
|
741 fileName->Append( KProfileNoSoundPath ); |
|
742 iSilentTone = fileName->AllocL(); |
|
743 |
|
744 // Cleanup. |
|
745 CleanupStack::PopAndDestroy( fileName ); |
|
746 |
|
747 // Create and subscribe for ecom registry changes. |
|
748 iClockEComListener = CClockEComListener::NewL( *this ); |
|
749 |
|
750 iUsedByGS = EFalse; |
|
751 iAlarmToneListInUse = EFalse; |
|
752 iAutoTimeUpdatePageOpen = EFalse; |
|
753 |
|
754 // Get the string for auto time update page title. |
|
755 iAutomaticTimeUpdateString = StringLoader::LoadL( R_QTN_CLK_SETT_NETWORK_TIME, iEnv ); |
|
756 } |
|
757 |
|
758 // End of File |