13 * |
13 * |
14 * Description: Calendar Lunar Plugin |
14 * Description: Calendar Lunar Plugin |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 #include <QtGui> |
19 #include "calendarui_debug.h" |
19 |
20 |
20 |
21 #include <eikenv.h> |
21 #include <eikenv.h> |
22 #include <AknUtils.h> |
22 #include <aknutils.h> |
23 #include <eiklabel.h> |
23 #include <eiklabel.h> |
24 #include <avkon.hrh> |
24 #include <avkon.hrh> |
25 #include <StringLoader.h> |
25 #include <StringLoader.h> |
26 #include <aknmessagequerydialog.h> |
|
27 #include <data_caging_path_literals.hrh> |
26 #include <data_caging_path_literals.hrh> |
28 #include <bautils.h> |
27 #include <bautils.h> |
29 #include <AknBidiTextUtils.h> |
28 #include <aknbiditextutils.h> |
30 #include <CalenLunarChinesePluginData.rsg> |
29 #include <CalenLunarChinesePluginData.rsg> |
31 #include <layoutmetadata.cdl.h> |
30 #include <layoutmetadata.cdl.h> |
32 #include <mcalenpreview.h> |
31 |
|
32 #include <hblabel.h> |
|
33 #include <hbwidget.h> |
|
34 #include <qstring.h> |
|
35 #include <hbaction.h> |
|
36 #include <hbtextedit.h> |
|
37 #include <hbmainwindow.h> |
|
38 #include <hbview.h> |
|
39 #include <hbmenu.h> |
33 |
40 |
34 #include "calendarui_debug.h" |
41 #include "calendarui_debug.h" |
35 #include "CalenLunarChinesePlugin.h" |
42 #include "CalenLunarChinesePlugin.h" |
36 #include "calenlunarpanic.h" |
43 #include "CalenLunarPanic.h" |
37 #include "calenlunarlocalizedinfo.h" |
44 #include "CalenLunarLocalizedInfo.h" |
38 #include "calenlunarlocalizer.h" |
45 #include "CalenLunarLocalizer.h" |
39 #include "calenlunarinfoprovider.h" |
46 #include "CalenLunarInfoProvider.h" |
40 #include "CalendarPrivateCRKeys.h" |
47 #include "CalendarPrivateCRKeys.h" |
41 #include "calencommands.hrh" |
48 #include "hb_calencommands.hrh" |
42 |
49 |
43 //CONSTANTS |
50 //CONSTANTS |
44 _LIT( KFieldSeparator, "\n" ); |
51 _LIT( KFieldSeparator, "\n" ); |
45 _LIT( KHeaderSeparator, "\n "); |
52 _LIT( KHeaderSeparator, "\n "); |
46 _LIT( KResourceChinesePluginFile, "calenlunarchineseplugindata.rsc" ); |
53 _LIT( KResourceChinesePluginFile, "calenlunarchineseplugindata.rsc" ); |
47 #define KResourcePath KDC_RESOURCE_FILES_DIR |
54 #define KResourcePath KDC_RESOURCE_FILES_DIR |
48 |
55 |
49 const TInt KFieldCount = 5; |
56 const TInt KFieldCount = 5; |
50 |
57 |
51 |
58 |
58 CCalenLunarChinesePlugin::CCalenLunarChinesePlugin(MCalenServices* aServices) |
65 CCalenLunarChinesePlugin::CCalenLunarChinesePlugin(MCalenServices* aServices) |
59 :iLocalizer(NULL), |
66 :iLocalizer(NULL), |
60 iLocInfo(NULL), |
67 iLocInfo(NULL), |
61 iServices(aServices), |
68 iServices(aServices), |
62 iInfoBarText(NULL), |
69 iInfoBarText(NULL), |
63 iResourceFileOffset( NULL ) |
70 iResourceFileOffset( NULL ), |
|
71 iLabelControl(NULL) |
64 |
72 |
65 { |
73 { |
66 TRACE_ENTRY_POINT; |
74 TRACE_ENTRY_POINT; |
67 iLabelControl = NULL; |
75 |
68 TRACE_EXIT_POINT; |
76 TRACE_EXIT_POINT; |
69 } |
77 } |
70 |
78 |
71 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
72 // CCalenLunarChinesePlugin::CreateChinesePluginL |
80 // CCalenLunarChinesePlugin::CreateChinesePluginL |
73 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
74 // |
82 // |
75 CCalenLunarChinesePlugin* CCalenLunarChinesePlugin::NewL( MCalenServices* aServices ) |
83 CCalenLunarChinesePlugin* CCalenLunarChinesePlugin::NewL( MCalenServices* aServices ) |
76 { |
84 { |
77 TRACE_ENTRY_POINT; |
85 TRACE_ENTRY_POINT; |
78 CCalenLunarChinesePlugin* self = new( ELeave ) CCalenLunarChinesePlugin( aServices); |
86 CCalenLunarChinesePlugin* self = new( ELeave ) |
|
87 CCalenLunarChinesePlugin( aServices); |
79 CleanupStack::PushL( self ); |
88 CleanupStack::PushL( self ); |
80 self->ConstructL(); |
89 self->ConstructL(); |
81 CleanupStack::Pop(self); |
90 CleanupStack::Pop(self); |
82 TRACE_EXIT_POINT; |
91 TRACE_EXIT_POINT; |
83 return self; |
92 return self; |
84 } |
93 } |
85 |
94 |
86 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
142 |
151 |
143 iLocalizer = CCalenLunarLocalizer::NewL(); |
152 iLocalizer = CCalenLunarLocalizer::NewL(); |
144 |
153 |
145 iInfoProvider = CCalenLunarInfoProvider::NewL(CEikonEnv::Static()->FsSession()); |
154 iInfoProvider = CCalenLunarInfoProvider::NewL(CEikonEnv::Static()->FsSession()); |
146 |
155 |
147 iLabelControl = CCalenPluginLabel::NewL(*this); |
156 iLabelControl = new CalenPluginLabel(*this); |
148 |
|
149 |
157 |
150 TRACE_EXIT_POINT; |
158 TRACE_EXIT_POINT; |
151 } |
159 } |
152 |
160 |
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 |
161 |
210 // ----------------------------------------------------------------------------- |
162 // ----------------------------------------------------------------------------- |
211 // CCalenLunarChinesePlugin::SetLabelContentL |
163 // CCalenLunarChinesePlugin::SetLabelContentL |
212 // ----------------------------------------------------------------------------- |
164 // ----------------------------------------------------------------------------- |
213 // |
165 // |
214 void CCalenLunarChinesePlugin::SetLabelContentL( CEikLabel& aLabel, const TRect& /*aRect*/ ) |
166 void CCalenLunarChinesePlugin::SetLabelContentL( HbLabel& aLabel) |
215 { |
167 { |
216 TRACE_ENTRY_POINT; |
168 TRACE_ENTRY_POINT; |
217 TRect nullRect(0,0,0,0); |
|
218 aLabel.SetRect(nullRect); |
|
219 |
169 |
220 FormatExtraRowStringL( aLabel, EFalse ); |
170 FormatExtraRowStringL( aLabel, EFalse ); |
221 aLabel.UseLogicalToVisualConversion(ETrue); |
171 //aLabel.UseLogicalToVisualConversion(ETrue); |
222 aLabel.SetLabelAlignment(ELayoutAlignCenter); |
172 //aLabel.SetLabelAlignment(ELayoutAlignCenter); |
223 aLabel.SetTextL( iExtraRowText ); |
173 //aLabel.setPlainText( iExtraRowText ); |
224 |
174 |
225 TRACE_EXIT_POINT; |
175 QString text = QString::fromUtf16(iExtraRowText.Ptr(),iExtraRowText.Length()); |
226 } |
176 aLabel.setPlainText(text); |
227 |
177 |
|
178 TRACE_EXIT_POINT; |
|
179 } |
228 |
180 |
229 // ----------------------------------------------------------------------------- |
181 // ----------------------------------------------------------------------------- |
230 // CCalenLunarChinesePlugin::FormatExtraRowStringL |
182 // CCalenLunarChinesePlugin::FormatExtraRowStringL |
231 // ----------------------------------------------------------------------------- |
183 // ----------------------------------------------------------------------------- |
232 // |
184 // |
233 void CCalenLunarChinesePlugin::FormatExtraRowStringL( CEikLabel& aLabel,TBool aTwoLines) |
185 void CCalenLunarChinesePlugin::FormatExtraRowStringL( HbLabel& aLabel,TBool aTwoLines) |
234 { |
186 |
235 TRACE_ENTRY_POINT; |
187 { |
236 |
188 TRACE_ENTRY_POINT; |
|
189 |
|
190 Q_UNUSED(aLabel); |
237 const CFont* labelFont = NULL; |
191 const CFont* labelFont = NULL; |
238 |
192 |
239 if( aTwoLines ) |
193 if( aTwoLines ) |
240 { |
194 { |
241 labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL); |
195 labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL); |
274 |
228 |
275 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
276 // CCalenLunarChinesePlugin::InfobarL |
230 // CCalenLunarChinesePlugin::InfobarL |
277 // ----------------------------------------------------------------------------- |
231 // ----------------------------------------------------------------------------- |
278 // |
232 // |
279 CCoeControl* CCalenLunarChinesePlugin::InfobarL( const TRect& aRect ) |
233 HbWidget* CCalenLunarChinesePlugin::InfobarL( ) |
280 { |
234 { |
281 TRACE_ENTRY_POINT; |
235 TRACE_ENTRY_POINT; |
282 |
236 |
283 UpdateLocalizerInfoL(); |
237 UpdateLocalizerInfoL(); |
284 iRect = aRect; |
238 |
285 |
239 SetLabelContentL(*iLabelControl); |
286 if(iLabelControl) |
240 |
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; |
241 return iLabelControl; |
298 |
242 |
299 TRACE_EXIT_POINT; |
243 TRACE_EXIT_POINT; |
300 } |
244 } |
301 |
245 |
302 // ---------------------------------------------------------------------------- |
246 // ---------------------------------------------------------------------------- |
303 // CCalenThaiPlugin::InfobarL |
247 // CCalenThaiPlugin::InfobarL |
304 // This function is called in case of Hitchcock views |
248 // This function is called in case of Hitchcock views |
305 // ---------------------------------------------------------------------------- |
249 // ---------------------------------------------------------------------------- |
306 // |
250 // |
307 const TDesC& CCalenLunarChinesePlugin::InfobarL( ) |
251 QString* CCalenLunarChinesePlugin::InfobarTextL( ) |
308 { |
252 { |
309 TRACE_ENTRY_POINT; |
253 TRACE_ENTRY_POINT; |
310 TRect nullRect(0,0,0,0); |
254 TRect nullRect(0,0,0,0); |
311 iRect = nullRect; |
255 iRect = nullRect; |
312 if(iInfoBarText) |
256 if(iInfoBarText) |
314 delete iInfoBarText; |
258 delete iInfoBarText; |
315 iInfoBarText = NULL; |
259 iInfoBarText = NULL; |
316 } |
260 } |
317 //Update the local information based on current context |
261 //Update the local information based on current context |
318 //from framework. |
262 //from framework. |
319 UpdateLocalizerInfoL(); |
263 UpdateLocalizerInfoL(); |
320 |
264 SetLabelContentL(*iLabelControl); |
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(); |
265 iInfoBarText = iExtraRowText.AllocLC(); |
328 CleanupStack::Pop(); |
266 CleanupStack::Pop(); |
329 |
267 |
330 TRACE_EXIT_POINT; |
268 TRACE_EXIT_POINT; |
331 return *iInfoBarText; |
269 return (new QString((QChar*)iInfoBarText->Des().Ptr(),iInfoBarText->Length())); |
332 } |
270 } |
333 |
271 |
334 // ----------------------------------------------------------------------------- |
272 // ---------------------------------------------------------------------------- |
335 // CCalenLunarChinesePlugin::CustomPreviewPaneL |
273 // CCalenThaiPlugin::InfobarL |
336 // ----------------------------------------------------------------------------- |
274 // This function is called to add menuitem |
337 // |
275 // ---------------------------------------------------------------------------- |
338 MCalenPreview* CCalenLunarChinesePlugin::CustomPreviewPaneL( TRect& /*aRect*/ ) |
276 // |
339 { |
277 |
340 TRACE_ENTRY_POINT |
278 void CCalenLunarChinesePlugin::CustomiseMenu(HbMenu* aHbMenu) |
341 TRACE_EXIT_POINT |
279 { |
342 return NULL; |
280 HbAction* lunarAction = new HbAction("Show Lunar Data"); |
343 } |
281 QList<QAction*> actionList = aHbMenu->actions(); |
344 |
282 TInt count = actionList.count() - 1; |
345 // ----------------------------------------------------------------------------- |
283 if(count >= 0) |
346 // CCalenLunarChinesePlugin::PreviewPaneL |
284 aHbMenu->insertAction(actionList[count], lunarAction); |
347 // ----------------------------------------------------------------------------- |
285 QObject::connect(lunarAction, SIGNAL(triggered()), iLabelControl, SLOT(showLunarData())); |
348 // |
286 } |
349 CCoeControl* CCalenLunarChinesePlugin::PreviewPaneL( TRect& aRect ) |
287 |
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 // ----------------------------------------------------------------------------- |
288 // ----------------------------------------------------------------------------- |
423 // CCalenLunarChinesePlugin::HandleCommandL |
289 // CCalenLunarChinesePlugin::HandleCommandL |
424 // ----------------------------------------------------------------------------- |
290 // ----------------------------------------------------------------------------- |
425 // |
291 // |
426 TBool CCalenLunarChinesePlugin::HandleCommandL( const TCalenCommand& aCommand ) |
292 TBool CCalenLunarChinesePlugin::HandleCommandL( const TCalenCommand& aCommand ) |
463 commandHandler = this; |
329 commandHandler = this; |
464 } |
330 } |
465 |
331 |
466 return commandHandler; |
332 return commandHandler; |
467 TRACE_EXIT_POINT; |
333 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 } |
334 } |
501 |
335 |
502 // ----------------------------------------------------------------------------- |
336 // ----------------------------------------------------------------------------- |
503 // CCalenLunarChinesePlugin::UpdateInfoLabelL |
337 // CCalenLunarChinesePlugin::UpdateInfoLabelL |
504 // ----------------------------------------------------------------------------- |
338 // ----------------------------------------------------------------------------- |
595 // CCalenLunarChinesePlugin::ShowMessageDialogL |
429 // CCalenLunarChinesePlugin::ShowMessageDialogL |
596 // ----------------------------------------------------------------------------- |
430 // ----------------------------------------------------------------------------- |
597 // |
431 // |
598 void CCalenLunarChinesePlugin::ExecuteMessageDialogL(TDesC& aMsgText) |
432 void CCalenLunarChinesePlugin::ExecuteMessageDialogL(TDesC& aMsgText) |
599 { |
433 { |
600 TRACE_ENTRY_POINT; |
434 TRACE_ENTRY_POINT; |
601 |
435 QString text = QString::fromUtf16(aMsgText.Ptr(),aMsgText.Length()); |
602 CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(aMsgText); |
436 |
603 CleanupStack::PushL(dlg); |
437 // Instantiate a popup |
604 dlg->PrepareLC(R_CALEN_LUNAR_DETAILS_DIALOG); |
438 HbPopup popup; |
605 CleanupStack::Pop(dlg); |
439 |
606 dlg->RunLD(); |
440 // Set dismiss policy that determines what tap events will cause the popup |
607 |
441 // to be dismissed |
|
442 popup.setDismissPolicy(HbPopup::NoDismiss); |
|
443 popup.setTimeout(HbPopup::NoTimeout); |
|
444 |
|
445 // Set the label as heading widget |
|
446 popup.setHeadingWidget(new HbLabel("Lunar Calendar")); |
|
447 HbTextEdit* contentWidget = new HbTextEdit (text); |
|
448 contentWidget->setReadOnly(true); |
|
449 //contentWidget->setCursorHidden(true); |
|
450 QSizeF size = contentWidget->maximumSize(); |
|
451 contentWidget->setMinimumSize(200,250); |
|
452 popup.setContentWidget(contentWidget); |
|
453 |
|
454 // Sets the primary action |
|
455 popup.setPrimaryAction(new HbAction("Ok",&popup)); |
|
456 |
|
457 // Launch popup syncronously |
|
458 popup.exec(); |
608 TRACE_EXIT_POINT; |
459 TRACE_EXIT_POINT; |
609 } |
460 } |
610 |
461 |
611 // ----------------------------------------------------------------------------- |
462 |
612 // CCalenPluginLabel::NewL |
463 CalenPluginLabel::CalenPluginLabel(CCalenLunarChinesePlugin& aPlugin , QGraphicsItem* parent) |
613 // ----------------------------------------------------------------------------- |
464 :HbLabel(parent),iPlugin(aPlugin) |
614 // |
465 { |
615 CCalenPluginLabel* CCalenPluginLabel::NewL(CCalenLunarChinesePlugin& aPlugin) |
466 TRACE_ENTRY_POINT; |
616 { |
467 |
617 TRACE_ENTRY_POINT; |
468 setAlignment(Qt::AlignHCenter); |
618 CCalenPluginLabel* self = new(ELeave)CCalenPluginLabel(aPlugin); |
469 setTextColor(Qt::blue); |
619 CleanupStack::PushL(self); |
470 QFont font("Times", 9, QFont::Bold); |
620 self->ConstructL(); |
471 setFont(font); |
621 CleanupStack::Pop(self); |
472 setTextWrapping(Hb::TextWrapping); |
622 TRACE_EXIT_POINT; |
473 setOpacity(12); |
623 return self; |
474 |
624 } |
475 TRACE_EXIT_POINT; |
625 |
476 } |
626 // ----------------------------------------------------------------------------- |
477 |
627 // CPluginLabel::CCalenLunarChinesePlugin |
478 CalenPluginLabel::~CalenPluginLabel() |
628 // ----------------------------------------------------------------------------- |
479 { |
629 // |
480 TRACE_ENTRY_POINT; |
630 CCalenPluginLabel::CCalenPluginLabel(CCalenLunarChinesePlugin& aPlugin) : iPlugin(aPlugin) |
481 TRACE_EXIT_POINT; |
631 { |
482 } |
632 TRACE_ENTRY_POINT; |
483 |
633 TRACE_EXIT_POINT; |
484 void CalenPluginLabel::showLunarData() |
634 } |
485 { |
635 |
486 TRACE_ENTRY_POINT; |
636 |
487 iPlugin.ShowDetailsL(); |
637 // ----------------------------------------------------------------------------- |
488 TRACE_EXIT_POINT; |
638 // CPluginLabel::ConstructL |
489 } |
639 // ----------------------------------------------------------------------------- |
490 void CalenPluginLabel::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget ) |
640 // |
491 { |
641 void CCalenPluginLabel::ConstructL() |
492 TRACE_ENTRY_POINT; |
642 { |
493 |
643 TRACE_ENTRY_POINT; |
494 HbLabel::paint(painter,option,widget); |
644 SetContainerWindowL(*this); |
495 QPen pen;// |
645 TRACE_EXIT_POINT; |
496 pen.setStyle(Qt::SolidLine); |
646 } |
497 pen.setWidth(1); |
647 |
498 pen.setBrush(Qt::gray); |
648 // ----------------------------------------------------------------------------- |
499 painter->setPen(pen); |
649 // CCalenPluginLabel::~CCalenPluginLabel |
500 QRectF rect = this->rect(); |
650 // ----------------------------------------------------------------------------- |
501 painter->eraseRect(rect); |
651 // |
502 painter->drawRect(rect); |
652 CCalenPluginLabel::~CCalenPluginLabel() |
503 painter->fillRect(rect,Qt::gray); |
653 { |
504 |
654 TRACE_ENTRY_POINT; |
505 TRACE_EXIT_POINT; |
655 TRACE_EXIT_POINT; |
506 } |
656 } |
507 |
657 |
508 void CalenPluginLabel::mousePressEvent(QGraphicsSceneMouseEvent* event) |
658 // ----------------------------------------------------------------------------- |
509 { |
659 // CCalenPluginLabel::Draw |
510 TRACE_ENTRY_POINT; |
660 // ----------------------------------------------------------------------------- |
511 Q_UNUSED(event); |
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(); |
512 iPlugin.ShowDetailsL(); |
678 TRACE_EXIT_POINT; |
513 TRACE_EXIT_POINT; |
679 } |
514 } |
680 |
515 |
681 //EOF |
516 //EOF |
682 |
517 |
683 |
518 |