|
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: Calendar Lunar Plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "calendarui_debug.h" |
|
20 |
|
21 #include <eikenv.h> |
|
22 #include <AknUtils.h> |
|
23 #include <eiklabel.h> |
|
24 #include <avkon.hrh> |
|
25 #include <StringLoader.h> |
|
26 #include <aknmessagequerydialog.h> |
|
27 #include <data_caging_path_literals.hrh> |
|
28 #include <bautils.h> |
|
29 #include <AknBidiTextUtils.h> |
|
30 #include <CalenLunarChinesePluginData.rsg> |
|
31 #include <layoutmetadata.cdl.h> |
|
32 #include <mcalenpreview.h> |
|
33 |
|
34 #include "calendarui_debug.h" |
|
35 #include "CalenLunarChinesePlugin.h" |
|
36 #include "calenlunarpanic.h" |
|
37 #include "calenlunarlocalizedinfo.h" |
|
38 #include "calenlunarlocalizer.h" |
|
39 #include "calenlunarinfoprovider.h" |
|
40 #include "CalendarPrivateCRKeys.h" |
|
41 #include "calencommands.hrh" |
|
42 |
|
43 //CONSTANTS |
|
44 _LIT( KFieldSeparator, "\n" ); |
|
45 _LIT( KHeaderSeparator, "\n "); |
|
46 _LIT( KResourceChinesePluginFile, "calenlunarchineseplugindata.rsc" ); |
|
47 #define KResourcePath KDC_RESOURCE_FILES_DIR |
|
48 |
|
49 const TInt KFieldCount = 5; |
|
50 |
|
51 |
|
52 // ============================ MEMBER FUNCTIONS =============================== |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CCalenLunarChinesePlugin::CCalenLunarChinesePlugin |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CCalenLunarChinesePlugin::CCalenLunarChinesePlugin(MCalenServices* aServices) |
|
59 :iLocalizer(NULL), |
|
60 iLocInfo(NULL), |
|
61 iServices(aServices), |
|
62 iInfoBarText(NULL), |
|
63 iResourceFileOffset( NULL ) |
|
64 |
|
65 { |
|
66 TRACE_ENTRY_POINT; |
|
67 iLabelControl = NULL; |
|
68 TRACE_EXIT_POINT; |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CCalenLunarChinesePlugin::CreateChinesePluginL |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CCalenLunarChinesePlugin* CCalenLunarChinesePlugin::NewL( MCalenServices* aServices ) |
|
76 { |
|
77 TRACE_ENTRY_POINT; |
|
78 CCalenLunarChinesePlugin* self = new( ELeave ) CCalenLunarChinesePlugin( aServices); |
|
79 CleanupStack::PushL( self ); |
|
80 self->ConstructL(); |
|
81 CleanupStack::Pop(self); |
|
82 TRACE_EXIT_POINT; |
|
83 return self; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CCalenLunarChinesePlugin::~CCalenLunarChinesePlugin |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 CCalenLunarChinesePlugin::~CCalenLunarChinesePlugin() |
|
91 { |
|
92 TRACE_ENTRY_POINT; |
|
93 |
|
94 delete iLabelControl; |
|
95 iLabelControl = NULL; |
|
96 |
|
97 //Deregister services |
|
98 if ( iServices ) |
|
99 { |
|
100 iServices->CancelNotifications(this); |
|
101 iServices->Release(); |
|
102 } |
|
103 if(iInfoBarText) |
|
104 { |
|
105 delete iInfoBarText; |
|
106 iInfoBarText = NULL; |
|
107 } |
|
108 |
|
109 delete iInfoProvider; |
|
110 delete iLocalizer; |
|
111 delete iLocInfo; |
|
112 |
|
113 if( iResourceFileOffset ) |
|
114 { |
|
115 CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
116 } |
|
117 TRACE_EXIT_POINT; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CCalenLunarChinesePlugin::ContructL |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 void CCalenLunarChinesePlugin::ConstructL() |
|
125 { |
|
126 TRACE_ENTRY_POINT; |
|
127 |
|
128 TFileName dllName; |
|
129 // Get the complate path of the DLL from where it is currently loaded |
|
130 Dll::FileName( dllName ); |
|
131 |
|
132 TFileName resourceFilename; |
|
133 resourceFilename.Append(dllName.Mid(0,2)); |
|
134 resourceFilename.Append(KResourcePath); |
|
135 resourceFilename.Append(KResourceChinesePluginFile); |
|
136 BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), resourceFilename ); |
|
137 // Add the resource file. |
|
138 iResourceFileOffset = CEikonEnv::Static()->AddResourceFileL( resourceFilename ); |
|
139 |
|
140 iServices->RegisterForNotificationsL( this, ECalenNotifyContextChanged ); |
|
141 iServices->GetCommandRange( iStart, iEnd ); |
|
142 |
|
143 iLocalizer = CCalenLunarLocalizer::NewL(); |
|
144 |
|
145 iInfoProvider = CCalenLunarInfoProvider::NewL(CEikonEnv::Static()->FsSession()); |
|
146 |
|
147 iLabelControl = CCalenPluginLabel::NewL(*this); |
|
148 |
|
149 |
|
150 TRACE_EXIT_POINT; |
|
151 } |
|
152 |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CCalenLunarChinesePlugin::SetLabelContentExtraL |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 void CCalenLunarChinesePlugin::SetLabelContentExtraL( CEikLabel& aLabel ,TRect& aRect) |
|
159 { |
|
160 TRACE_ENTRY_POINT; |
|
161 |
|
162 TRect nullRect; |
|
163 aLabel.SetRect(nullRect); |
|
164 |
|
165 FormatExtraRowStringL( aLabel, ETrue ); |
|
166 |
|
167 CArrayFixFlat<TPtrC>* textLines = new(ELeave)CArrayFixFlat<TPtrC>( 2 ); |
|
168 CleanupStack::PushL( textLines ); |
|
169 |
|
170 CArrayFixFlat<TInt>* lineWidths = new( ELeave )CArrayFixFlat<TInt>( 1 ); |
|
171 CleanupStack::PushL( lineWidths ); |
|
172 |
|
173 TInt maxWidth = aRect.Size().iWidth; |
|
174 lineWidths->AppendL( maxWidth ); |
|
175 |
|
176 const CFont* fontLabel = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL); |
|
177 |
|
178 HBufC* visualText = AknBidiTextUtils::ConvertToVisualAndWrapToArrayWholeTextL( |
|
179 iExtraRowText, |
|
180 *lineWidths, |
|
181 *fontLabel, |
|
182 *textLines); |
|
183 |
|
184 if(textLines->Count() < 3 && textLines->Count() > 0) |
|
185 { |
|
186 TInt nH = textLines->Count(); |
|
187 aRect.iBr.iY = aRect.iBr.iY * nH; |
|
188 } |
|
189 |
|
190 HBufC* newLinedText = HBufC::NewLC( iExtraRowText.Length() + 4); |
|
191 |
|
192 for(TInt i = 0 ; i < textLines->Count();i++) |
|
193 { |
|
194 newLinedText->Des().Append(textLines->At(i)); |
|
195 newLinedText->Des().Append( KFieldSeparator ); |
|
196 } |
|
197 |
|
198 aLabel.UseLogicalToVisualConversion(ETrue); |
|
199 aLabel.SetLabelAlignment(ELayoutAlignCenter); |
|
200 aLabel.SetTextL( *newLinedText); |
|
201 |
|
202 CleanupStack::PopAndDestroy( newLinedText ); |
|
203 CleanupStack::PopAndDestroy( lineWidths ); |
|
204 CleanupStack::PopAndDestroy( textLines ); |
|
205 delete visualText; |
|
206 |
|
207 TRACE_EXIT_POINT; |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CCalenLunarChinesePlugin::SetLabelContentL |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 void CCalenLunarChinesePlugin::SetLabelContentL( CEikLabel& aLabel, const TRect& /*aRect*/ ) |
|
215 { |
|
216 TRACE_ENTRY_POINT; |
|
217 TRect nullRect(0,0,0,0); |
|
218 aLabel.SetRect(nullRect); |
|
219 |
|
220 FormatExtraRowStringL( aLabel, EFalse ); |
|
221 aLabel.UseLogicalToVisualConversion(ETrue); |
|
222 aLabel.SetLabelAlignment(ELayoutAlignCenter); |
|
223 aLabel.SetTextL( iExtraRowText ); |
|
224 |
|
225 TRACE_EXIT_POINT; |
|
226 } |
|
227 |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // CCalenLunarChinesePlugin::FormatExtraRowStringL |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 void CCalenLunarChinesePlugin::FormatExtraRowStringL( CEikLabel& aLabel,TBool aTwoLines) |
|
234 { |
|
235 TRACE_ENTRY_POINT; |
|
236 |
|
237 const CFont* labelFont = NULL; |
|
238 |
|
239 if( aTwoLines ) |
|
240 { |
|
241 labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL); |
|
242 } |
|
243 else |
|
244 { |
|
245 labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont,NULL); |
|
246 } |
|
247 |
|
248 aLabel.SetFont( labelFont ); |
|
249 TInt maxWidth = 0; |
|
250 if(iRect.IsEmpty()) |
|
251 { |
|
252 maxWidth = 450; //For hitch we take max value |
|
253 } |
|
254 else |
|
255 { |
|
256 maxWidth = iRect.Size().iWidth; |
|
257 } |
|
258 |
|
259 if ( labelFont && iLocInfo ) |
|
260 { |
|
261 iExtraRowText.Set( iLocalizer->GetExtraRowTextL( *iLocInfo, |
|
262 maxWidth, |
|
263 *labelFont, |
|
264 aTwoLines ) |
|
265 ); |
|
266 } |
|
267 else |
|
268 { |
|
269 iExtraRowText.Set( KNullDesC ); |
|
270 } |
|
271 |
|
272 TRACE_EXIT_POINT; |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CCalenLunarChinesePlugin::InfobarL |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 CCoeControl* CCalenLunarChinesePlugin::InfobarL( const TRect& aRect ) |
|
280 { |
|
281 TRACE_ENTRY_POINT; |
|
282 |
|
283 UpdateLocalizerInfoL(); |
|
284 iRect = aRect; |
|
285 |
|
286 if(iLabelControl) |
|
287 { |
|
288 delete iLabelControl; |
|
289 iLabelControl = NULL; |
|
290 } |
|
291 |
|
292 iLabelControl = CCalenPluginLabel::NewL(*this); |
|
293 |
|
294 SetLabelContentL(*iLabelControl,aRect); |
|
295 iLabelControl->SetRect(aRect); |
|
296 |
|
297 return iLabelControl; |
|
298 |
|
299 TRACE_EXIT_POINT; |
|
300 } |
|
301 |
|
302 // ---------------------------------------------------------------------------- |
|
303 // CCalenThaiPlugin::InfobarL |
|
304 // This function is called in case of Hitchcock views |
|
305 // ---------------------------------------------------------------------------- |
|
306 // |
|
307 const TDesC& CCalenLunarChinesePlugin::InfobarL( ) |
|
308 { |
|
309 TRACE_ENTRY_POINT; |
|
310 TRect nullRect(0,0,0,0); |
|
311 iRect = nullRect; |
|
312 if(iInfoBarText) |
|
313 { |
|
314 delete iInfoBarText; |
|
315 iInfoBarText = NULL; |
|
316 } |
|
317 //Update the local information based on current context |
|
318 //from framework. |
|
319 UpdateLocalizerInfoL(); |
|
320 |
|
321 //Dummy label for formatting the iExtraRowText |
|
322 CEikLabel* dummyLabel = new(ELeave) CEikLabel; |
|
323 CleanupStack::PushL(dummyLabel); |
|
324 SetLabelContentL(*dummyLabel,TRect()); |
|
325 CleanupStack::PopAndDestroy(); |
|
326 |
|
327 iInfoBarText = iExtraRowText.AllocLC(); |
|
328 CleanupStack::Pop(); |
|
329 |
|
330 TRACE_EXIT_POINT; |
|
331 return *iInfoBarText; |
|
332 } |
|
333 |
|
334 // ----------------------------------------------------------------------------- |
|
335 // CCalenLunarChinesePlugin::CustomPreviewPaneL |
|
336 // ----------------------------------------------------------------------------- |
|
337 // |
|
338 MCalenPreview* CCalenLunarChinesePlugin::CustomPreviewPaneL( TRect& /*aRect*/ ) |
|
339 { |
|
340 TRACE_ENTRY_POINT |
|
341 TRACE_EXIT_POINT |
|
342 return NULL; |
|
343 } |
|
344 |
|
345 // ----------------------------------------------------------------------------- |
|
346 // CCalenLunarChinesePlugin::PreviewPaneL |
|
347 // ----------------------------------------------------------------------------- |
|
348 // |
|
349 CCoeControl* CCalenLunarChinesePlugin::PreviewPaneL( TRect& aRect ) |
|
350 { |
|
351 TRACE_ENTRY_POINT; |
|
352 |
|
353 UpdateLocalizerInfoL(); |
|
354 iRect = aRect; |
|
355 if (iLabelControl) |
|
356 { |
|
357 delete iLabelControl; |
|
358 iLabelControl = NULL; |
|
359 } |
|
360 |
|
361 iLabelControl = CCalenPluginLabel::NewL(*this); |
|
362 |
|
363 if(!Layout_Meta_Data::IsLandscapeOrientation()) //Portriat |
|
364 { |
|
365 SetLabelContentL(*iLabelControl, aRect); |
|
366 } |
|
367 else |
|
368 { |
|
369 SetLabelContentExtraL(*iLabelControl,aRect); |
|
370 } |
|
371 |
|
372 |
|
373 return iLabelControl; |
|
374 TRACE_EXIT_POINT; |
|
375 } |
|
376 |
|
377 // ----------------------------------------------------------------------------- |
|
378 // CCalenLunarChinesePlugin::CustomiseMenuPaneL |
|
379 // ----------------------------------------------------------------------------- |
|
380 // |
|
381 TBool CCalenLunarChinesePlugin::CustomiseMenuPaneL( TInt /*aResourceId*/, |
|
382 CEikMenuPane* aMenuPane ) |
|
383 { |
|
384 TRACE_ENTRY_POINT; |
|
385 HBufC* itemText = StringLoader::LoadLC(R_CALENDAR_SHOW_LUNAR_DATA); |
|
386 |
|
387 CEikMenuPaneItem::SData menuItem; |
|
388 menuItem.iCommandId = iStart; |
|
389 menuItem.iCascadeId = 0; |
|
390 menuItem.iFlags = 0; |
|
391 menuItem.iText = *itemText; |
|
392 menuItem.iExtraText = KNullDesC; |
|
393 |
|
394 aMenuPane->InsertMenuItemL( menuItem, 1 ); |
|
395 |
|
396 CleanupStack::PopAndDestroy(itemText); |
|
397 TRACE_EXIT_POINT; |
|
398 return ETrue; |
|
399 } |
|
400 |
|
401 // ----------------------------------------------------------------------------- |
|
402 // CCalenLunarChinesePlugin::CanBeEnabledDisabled |
|
403 // ----------------------------------------------------------------------------- |
|
404 // |
|
405 TBool CCalenLunarChinesePlugin::CanBeEnabledDisabled() |
|
406 { |
|
407 TRACE_ENTRY_POINT; |
|
408 TRACE_EXIT_POINT; |
|
409 return ETrue; |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // CCalenLunarChinesePlugin::CalenCustomisationExtensionL |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 TAny* CCalenLunarChinesePlugin::CalenCustomisationExtensionL( TUid /*aExtensionUid*/ ) |
|
417 { |
|
418 TRACE_ENTRY_POINT; |
|
419 TRACE_EXIT_POINT; |
|
420 return NULL; |
|
421 } |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CCalenLunarChinesePlugin::HandleCommandL |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 TBool CCalenLunarChinesePlugin::HandleCommandL( const TCalenCommand& aCommand ) |
|
427 { |
|
428 TRACE_ENTRY_POINT; |
|
429 |
|
430 const TInt commandId = aCommand.Command(); |
|
431 if(iStart == commandId) |
|
432 { |
|
433 ShowDetailsL(); |
|
434 } |
|
435 TRACE_EXIT_POINT; |
|
436 return EFalse; |
|
437 } |
|
438 |
|
439 // ---------------------------------------------------------------------------- |
|
440 // CCalenLunarChinesePlugin::CalenCommandHandlerExtensionL |
|
441 // |
|
442 // ---------------------------------------------------------------------------- |
|
443 // |
|
444 TAny* CCalenLunarChinesePlugin::CalenCommandHandlerExtensionL( TUid /*aExtensionUid*/ ) |
|
445 { |
|
446 TRACE_ENTRY_POINT; |
|
447 TRACE_EXIT_POINT; |
|
448 return NULL; |
|
449 } |
|
450 |
|
451 // ----------------------------------------------------------------------------- |
|
452 // CCalenLunarChinesePlugin::CommandHandlerL |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 MCalenCommandHandler* CCalenLunarChinesePlugin::CommandHandlerL( TInt aCommand ) |
|
456 { |
|
457 TRACE_ENTRY_POINT; |
|
458 |
|
459 MCalenCommandHandler* commandHandler = NULL; |
|
460 |
|
461 if(iStart == aCommand) |
|
462 { |
|
463 commandHandler = this; |
|
464 } |
|
465 |
|
466 return commandHandler; |
|
467 TRACE_EXIT_POINT; |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // CCalenLunarChinesePlugin::RemoveViewsFromCycle |
|
472 // ----------------------------------------------------------------------------- |
|
473 // |
|
474 void CCalenLunarChinesePlugin::RemoveViewsFromCycle( RArray<TInt>& /*aViews*/ ) |
|
475 { |
|
476 TRACE_ENTRY_POINT; |
|
477 TRACE_EXIT_POINT; |
|
478 } |
|
479 |
|
480 // ----------------------------------------------------------------------------- |
|
481 // CCalenLunarChinesePlugin::GetCustomSettingsL |
|
482 // ----------------------------------------------------------------------------- |
|
483 // |
|
484 void CCalenLunarChinesePlugin::GetCustomSettingsL( RPointerArray<CAknSettingItem>& |
|
485 /*aCustomSettingArray*/) |
|
486 { |
|
487 TRACE_ENTRY_POINT; |
|
488 TRACE_EXIT_POINT; |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------------------------- |
|
492 // CCalenLunarChinesePlugin::GetCustomViewsL |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CCalenLunarChinesePlugin::GetCustomViewsL( RPointerArray<CCalenView>& |
|
496 /*aCustomViewArray*/ ) |
|
497 { |
|
498 TRACE_ENTRY_POINT; |
|
499 TRACE_EXIT_POINT; |
|
500 } |
|
501 |
|
502 // ----------------------------------------------------------------------------- |
|
503 // CCalenLunarChinesePlugin::UpdateInfoLabelL |
|
504 // ----------------------------------------------------------------------------- |
|
505 // |
|
506 void CCalenLunarChinesePlugin::UpdateLocalizerInfoL() |
|
507 { |
|
508 TRACE_ENTRY_POINT; |
|
509 TTime focusTime = iServices->Context().FocusDateAndTimeL().TimeLocalL(); |
|
510 TCalenLunarInfo lunarInfo = iInfoProvider->GetLunarInfoL( focusTime ); |
|
511 delete iLocInfo; |
|
512 iLocInfo = NULL; |
|
513 if(iLocalizer) |
|
514 { |
|
515 iLocInfo = iLocalizer->LocalizeL( lunarInfo ); |
|
516 } |
|
517 TRACE_EXIT_POINT; |
|
518 } |
|
519 |
|
520 // ----------------------------------------------------------------------------- |
|
521 // CCalenLunarChinesePlugin::HandleNotification |
|
522 // ----------------------------------------------------------------------------- |
|
523 // |
|
524 void CCalenLunarChinesePlugin::HandleNotification(const TCalenNotification aNotification) |
|
525 { |
|
526 TRACE_ENTRY_POINT; |
|
527 if (aNotification == ECalenNotifyContextChanged) |
|
528 { |
|
529 TRAP_IGNORE(UpdateLocalizerInfoL()); |
|
530 } |
|
531 TRACE_EXIT_POINT; |
|
532 } |
|
533 |
|
534 // ----------------------------------------------------------------------------- |
|
535 // CCalenLunarChinesePlugin::ShowDetailsL |
|
536 // Message popup from menu |
|
537 // ----------------------------------------------------------------------------- |
|
538 // |
|
539 void CCalenLunarChinesePlugin::ShowDetailsL( ) |
|
540 { |
|
541 TRACE_ENTRY_POINT; |
|
542 HBufC* msgText = HBufC::NewLC( 1000 ); |
|
543 if ( iLocInfo ) |
|
544 { |
|
545 TInt headerIds[KFieldCount] = { |
|
546 R_CALENDAR_LUNAR_INFO_FESTIVAL, |
|
547 R_CALENDAR_LUNAR_INFO_SOLAR, |
|
548 R_CALENDAR_LUNAR_INFO_DATE, |
|
549 R_CALENDAR_LUNAR_INFO_ANIMAL_YEAR, |
|
550 R_CALENDAR_LUNAR_INFO_WESTERN_DATE |
|
551 }; |
|
552 |
|
553 RPointerArray<HBufC> headersArray; |
|
554 |
|
555 for ( TInt i=0; i < KFieldCount; i++) |
|
556 { |
|
557 headersArray.Append( StringLoader::LoadL( headerIds[i] ) ); |
|
558 } |
|
559 |
|
560 CPtrCArray* fieldsArray = new (ELeave) CPtrCArray(5); |
|
561 CleanupStack::PushL( fieldsArray ); |
|
562 fieldsArray->AppendL( iLocInfo->Festival() ); |
|
563 fieldsArray->AppendL( iLocInfo->SolarTerm() ); |
|
564 fieldsArray->AppendL( iLocInfo->FullLunarDate() ); |
|
565 fieldsArray->AppendL( iLocInfo->AnimalYear() ); |
|
566 fieldsArray->AppendL( iLocInfo->GregorianDate() ); |
|
567 |
|
568 for (TInt i=0; i < KFieldCount; i++) |
|
569 { |
|
570 TPtrC fieldPtrC = fieldsArray->At(i); |
|
571 if ( fieldPtrC != KNullDesC ) |
|
572 { |
|
573 msgText->Des().Append( *(headersArray[i]) ); |
|
574 msgText->Des().Append( KHeaderSeparator ); |
|
575 msgText->Des().Append( fieldPtrC ); |
|
576 if ( i < KFieldCount - 1 ) // not last |
|
577 { |
|
578 msgText->Des().Append( KFieldSeparator ); |
|
579 } |
|
580 } |
|
581 } |
|
582 CleanupStack::PopAndDestroy( fieldsArray ); |
|
583 headersArray.ResetAndDestroy(); |
|
584 } |
|
585 |
|
586 |
|
587 ExecuteMessageDialogL(*msgText); |
|
588 |
|
589 CleanupStack::PopAndDestroy( msgText ); |
|
590 |
|
591 TRACE_EXIT_POINT; |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // CCalenLunarChinesePlugin::ShowMessageDialogL |
|
596 // ----------------------------------------------------------------------------- |
|
597 // |
|
598 void CCalenLunarChinesePlugin::ExecuteMessageDialogL(TDesC& aMsgText) |
|
599 { |
|
600 TRACE_ENTRY_POINT; |
|
601 |
|
602 CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(aMsgText); |
|
603 CleanupStack::PushL(dlg); |
|
604 dlg->PrepareLC(R_CALEN_LUNAR_DETAILS_DIALOG); |
|
605 CleanupStack::Pop(dlg); |
|
606 dlg->RunLD(); |
|
607 |
|
608 TRACE_EXIT_POINT; |
|
609 } |
|
610 |
|
611 // ----------------------------------------------------------------------------- |
|
612 // CCalenPluginLabel::NewL |
|
613 // ----------------------------------------------------------------------------- |
|
614 // |
|
615 CCalenPluginLabel* CCalenPluginLabel::NewL(CCalenLunarChinesePlugin& aPlugin) |
|
616 { |
|
617 TRACE_ENTRY_POINT; |
|
618 CCalenPluginLabel* self = new(ELeave)CCalenPluginLabel(aPlugin); |
|
619 CleanupStack::PushL(self); |
|
620 self->ConstructL(); |
|
621 CleanupStack::Pop(self); |
|
622 TRACE_EXIT_POINT; |
|
623 return self; |
|
624 } |
|
625 |
|
626 // ----------------------------------------------------------------------------- |
|
627 // CPluginLabel::CCalenLunarChinesePlugin |
|
628 // ----------------------------------------------------------------------------- |
|
629 // |
|
630 CCalenPluginLabel::CCalenPluginLabel(CCalenLunarChinesePlugin& aPlugin) : iPlugin(aPlugin) |
|
631 { |
|
632 TRACE_ENTRY_POINT; |
|
633 TRACE_EXIT_POINT; |
|
634 } |
|
635 |
|
636 |
|
637 // ----------------------------------------------------------------------------- |
|
638 // CPluginLabel::ConstructL |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 void CCalenPluginLabel::ConstructL() |
|
642 { |
|
643 TRACE_ENTRY_POINT; |
|
644 SetContainerWindowL(*this); |
|
645 TRACE_EXIT_POINT; |
|
646 } |
|
647 |
|
648 // ----------------------------------------------------------------------------- |
|
649 // CCalenPluginLabel::~CCalenPluginLabel |
|
650 // ----------------------------------------------------------------------------- |
|
651 // |
|
652 CCalenPluginLabel::~CCalenPluginLabel() |
|
653 { |
|
654 TRACE_ENTRY_POINT; |
|
655 TRACE_EXIT_POINT; |
|
656 } |
|
657 |
|
658 // ----------------------------------------------------------------------------- |
|
659 // CCalenPluginLabel::Draw |
|
660 // ----------------------------------------------------------------------------- |
|
661 // |
|
662 void CCalenPluginLabel::Draw( const TRect& aRect) const |
|
663 { |
|
664 TRACE_ENTRY_POINT; |
|
665 CEikLabel::Draw(aRect); |
|
666 TRACE_EXIT_POINT; |
|
667 } |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // CCalenPluginLabel::HandlePointerEventL |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 void CCalenPluginLabel::HandlePointerEventL(const TPointerEvent& |
|
674 /*aPointerEvent*/) |
|
675 { |
|
676 TRACE_ENTRY_POINT; |
|
677 iPlugin.ShowDetailsL(); |
|
678 TRACE_EXIT_POINT; |
|
679 } |
|
680 |
|
681 //EOF |
|
682 |
|
683 |