calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameseplugin.cpp
changeset 18 c198609911f9
parent 0 f979ecb2b13e
child 45 b6db4fd4947b
equal deleted inserted replaced
0:f979ecb2b13e 18:c198609911f9
    13 *
    13 *
    14 * Description:   Calendar Lunar Plugin 
    14 * Description:   Calendar Lunar Plugin 
    15  *
    15  *
    16 */
    16 */
    17 
    17 
       
    18 #include <QtGui>
    18 
    19 
    19 #include "calendarui_debug.h"
    20 #include "calendarui_debug.h"
    20 
    21 
    21 #include <eikenv.h>
    22 #include <eikenv.h>
    22 #include <AknUtils.h>
    23 #include <aknutils.h>
    23 #include <eiklabel.h>
    24 #include <eiklabel.h>
    24 #include <avkon.hrh>
    25 #include <avkon.hrh>
    25 #include <StringLoader.h>
    26 #include <StringLoader.h>
    26 #include <aknsettingitemlist.h>
       
    27 #include <aknmessagequerydialog.h>
       
    28 #include <data_caging_path_literals.hrh>
    27 #include <data_caging_path_literals.hrh>
    29 #include <bautils.h>
    28 #include <bautils.h>
    30 #include <AknBidiTextUtils.h>
    29 #include <aknbiditextutils.h>
    31 #include <CalenLunarVietnamesePluginData.rsg>
    30 #include <CalenLunarVietnamesePluginData.rsg>
    32 #include <layoutmetadata.cdl.h>
    31 #include <layoutmetadata.cdl.h>
    33 #include <mcalenpreview.h>
    32 
    34 
    33 #include <hblabel.h>
       
    34 #include <hbwidget.h>
       
    35 #include <qstring.h>
       
    36 #include <hbaction.h>
       
    37 #include <hbtextedit.h>
       
    38 #include <hbmainwindow.h>
       
    39 #include <hbview.h>
       
    40 #include <hbmenu.h>
    35 #include "calendarui_debug.h" 
    41 #include "calendarui_debug.h" 
    36 #include "calenlunarvietnameseplugin.h"
    42 #include "CalenLunarVietnamesePlugin.h"
    37 #include "calenlunarvietnameselocalizer.h"
    43 #include "CalenLunarVietnameseLocalizer.h"
    38 #include "calenlunarpanic.h"
    44 #include "CalenLunarPanic.h"
    39 #include "calenlunarlocalizedinfo.h"
    45 #include "CalenLunarLocalizedInfo.h"
    40 #include "calenlunarlocalizer.h"
    46 #include "CalenLunarLocalizer.h"
    41 #include "calenlunarinfoprovider.h"
    47 #include "CalenLunarInfoProvider.h"
    42 
    48 
    43 #include "calencommands.hrh"
    49 #include "hb_calencommands.hrh"
    44 
    50 
    45 //CONSTANTS
    51 //CONSTANTS
    46 _LIT( KFieldSeparator, "\n" );
    52 _LIT( KFieldSeparator, "\n" );
    47 _LIT( KHeaderSeparator, "\n");
    53 _LIT( KHeaderSeparator, "\n");
    48 
    54 
   143 
   149 
   144 	iServices->RegisterForNotificationsL( this, ECalenNotifyContextChanged );
   150 	iServices->RegisterForNotificationsL( this, ECalenNotifyContextChanged );
   145 	iServices->GetCommandRange( iStart, iEnd );
   151 	iServices->GetCommandRange( iStart, iEnd );
   146 	
   152 	
   147 	iInfoProvider = CCalenLunarInfoProvider::NewL(CEikonEnv::Static()->FsSession());
   153 	iInfoProvider = CCalenLunarInfoProvider::NewL(CEikonEnv::Static()->FsSession());
   148 	
   154 			
   149 	iLabelControl = CCalenPluginLabel::NewL(*this);
       
   150 	
       
   151     iLocalizer = CCalenLunarVietnameseLocalizer::NewL();
   155     iLocalizer = CCalenLunarVietnameseLocalizer::NewL();
   152     
   156     
       
   157 	iLabelControl = new CalenPluginLabel(*this);
   153     
   158     
   154     TRACE_EXIT_POINT;	
   159     TRACE_EXIT_POINT;	
   155 	}
   160 	}
   156 	
   161 	
   157 	
       
   158 // -----------------------------------------------------------------------------
       
   159 // CCalenLunarVietnamesePlugin::SetLabelContentExtraL
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 void CCalenLunarVietnamesePlugin::SetLabelContentExtraL( CEikLabel& aLabel ,TRect& aRect) 
       
   163     {
       
   164     TRACE_ENTRY_POINT;
       
   165     
       
   166     TRect nullRect;
       
   167     aLabel.SetRect(nullRect);
       
   168     
       
   169     FormatExtraRowStringL( aLabel, ETrue );
       
   170 
       
   171     CArrayFixFlat<TPtrC>* textLines = new(ELeave)CArrayFixFlat<TPtrC>( 2 );
       
   172     CleanupStack::PushL( textLines );
       
   173     
       
   174     CArrayFixFlat<TInt>* lineWidths = new( ELeave )CArrayFixFlat<TInt>( 1 );
       
   175     CleanupStack::PushL( lineWidths );
       
   176     
       
   177     TInt maxWidth = aRect.Size().iWidth;
       
   178     lineWidths->AppendL( maxWidth );
       
   179     
       
   180     const CFont* fontLabel = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL);
       
   181     
       
   182     HBufC* visualText = AknBidiTextUtils::ConvertToVisualAndWrapToArrayWholeTextL(
       
   183         iExtraRowText,
       
   184         *lineWidths,
       
   185         *fontLabel,
       
   186         *textLines);
       
   187         
       
   188     if(textLines->Count() < 3 && textLines->Count() > 0)
       
   189     	{
       
   190     	 TInt nH =	textLines->Count();
       
   191     	 aRect.iBr.iY = aRect.iBr.iY * nH;
       
   192     	}
       
   193        
       
   194     HBufC* newLinedText = HBufC::NewLC( iExtraRowText.Length() + 4);
       
   195         
       
   196     for(TInt i = 0 ; i < textLines->Count();i++)
       
   197     	{
       
   198     	newLinedText->Des().Append(textLines->At(i));
       
   199     	newLinedText->Des().Append( KFieldSeparator );
       
   200     	}
       
   201    
       
   202     aLabel.UseLogicalToVisualConversion(ETrue);
       
   203     aLabel.SetLabelAlignment(ELayoutAlignCenter); 
       
   204     aLabel.SetTextL( *newLinedText);
       
   205     
       
   206     CleanupStack::PopAndDestroy( newLinedText );
       
   207     CleanupStack::PopAndDestroy( lineWidths );
       
   208     CleanupStack::PopAndDestroy( textLines );
       
   209     delete visualText;
       
   210 
       
   211     TRACE_EXIT_POINT;
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
   162 // -----------------------------------------------------------------------------
   215 // CCalenLunarVietnamesePlugin::SetLabelContentL
   163 // CCalenLunarVietnamesePlugin::SetLabelContentL
   216 // -----------------------------------------------------------------------------
   164 // -----------------------------------------------------------------------------
   217 //
   165 //
   218 void CCalenLunarVietnamesePlugin::SetLabelContentL( CEikLabel& aLabel, 
   166 void CCalenLunarVietnamesePlugin::SetLabelContentL( HbLabel& aLabel ) 
   219 														const TRect&  /*aRect*/ ) 
   167     {
   220     {
   168     TRACE_ENTRY_POINT;
   221     TRACE_ENTRY_POINT;
   169     
   222     TRect nullRect;
   170     FormatExtraRowStringL( aLabel, EFalse );    
   223     aLabel.SetRect(nullRect);
   171     QString text = QString::fromUtf16(iExtraRowText.Ptr(),iExtraRowText.Length());
   224     
   172     aLabel.setPlainText(text);
   225     FormatExtraRowStringL( aLabel, EFalse );
       
   226     aLabel.UseLogicalToVisualConversion(ETrue);
       
   227     aLabel.SetLabelAlignment(ELayoutAlignCenter);
       
   228     aLabel.SetTextL(  iExtraRowText );
       
   229     
   173     
   230     TRACE_EXIT_POINT;
   174     TRACE_EXIT_POINT;
   231     }
   175     }
   232     
   176     
   233     
   177     
   234 // -----------------------------------------------------------------------------
   178 // -----------------------------------------------------------------------------
   235 // CCalenLunarVietnamesePlugin::FormatExtraRowStringL
   179 // CCalenLunarVietnamesePlugin::FormatExtraRowStringL
   236 // -----------------------------------------------------------------------------
   180 // -----------------------------------------------------------------------------
   237 //	
   181 //	
   238 void CCalenLunarVietnamesePlugin::FormatExtraRowStringL( CEikLabel& aLabel,
   182 void CCalenLunarVietnamesePlugin::FormatExtraRowStringL(HbLabel& aLabel,TBool aTwoLines)
   239 																TBool aTwoLines)
   183     {
   240     {
   184     TRACE_ENTRY_POINT;
   241     TRACE_ENTRY_POINT;
   185     
   242     
   186     Q_UNUSED(aLabel);
   243     const CFont*  labelFont = NULL;
   187     const CFont*  labelFont = NULL;
   244     
   188     
   245     if( aTwoLines ) 
   189     if( aTwoLines ) 
   246     	{
   190     	{
   247     	labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL);
   191     	labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL);
   249     else
   193     else
   250     	{
   194     	{
   251     	labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont,NULL);	
   195     	labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont,NULL);	
   252     	}
   196     	}
   253     
   197     
   254     aLabel.SetFont( labelFont );
   198     //aLabel.SetFont( labelFont );
   255     TInt maxWidth = iRect.Size().iWidth;
   199     TInt maxWidth = 0;
       
   200     if(iRect.IsEmpty())
       
   201     	{
       
   202     	maxWidth = 450; //For hitch we take max value
       
   203     	}
       
   204     else 
       
   205     	{
       
   206     	maxWidth = iRect.Size().iWidth;
       
   207     	}
   256     
   208     
   257     if ( labelFont && iLocInfo )
   209     if ( labelFont && iLocInfo )
   258         {
   210         {
   259         iExtraRowText.Set( iLocalizer->GetExtraRowTextL( *iLocInfo, 
   211         iExtraRowText.Set( iLocalizer->GetExtraRowTextL( *iLocInfo, 
   260                                                          maxWidth, 
   212                                                          maxWidth, 
   272 	
   224 	
   273 // -----------------------------------------------------------------------------
   225 // -----------------------------------------------------------------------------
   274 // CCalenLunarVietnamesePlugin::InfobarL
   226 // CCalenLunarVietnamesePlugin::InfobarL
   275 // -----------------------------------------------------------------------------
   227 // -----------------------------------------------------------------------------
   276 //	
   228 //	
   277 CCoeControl* CCalenLunarVietnamesePlugin::InfobarL( const TRect&  aRect )
   229 HbWidget* CCalenLunarVietnamesePlugin::InfobarL( )
   278 	{
   230 	{
   279 	TRACE_ENTRY_POINT;
   231 	TRACE_ENTRY_POINT;
   280 
   232 
   281 	UpdateLocalizerInfoL();
   233 	UpdateLocalizerInfoL();
   282 	iRect = aRect;
   234     
   283 	
   235 	SetLabelContentL(*iLabelControl);
   284 	if(iLabelControl)
   236 		 
   285 	    {
       
   286 		delete iLabelControl;
       
   287 		iLabelControl = NULL;
       
   288 	    }
       
   289 	
       
   290 	iLabelControl = CCalenPluginLabel::NewL(*this);
       
   291     
       
   292 	SetLabelContentL(*iLabelControl,aRect);
       
   293 	iLabelControl->SetRect(aRect);
       
   294 	 
       
   295 	return iLabelControl;
   237 	return iLabelControl;
   296 	
   238 	
   297     TRACE_EXIT_POINT;	
   239     TRACE_EXIT_POINT;	
   298 	}
   240 	}
   299 
   241 
   300 // ----------------------------------------------------------------------------
   242 // ----------------------------------------------------------------------------
   301 // CCalenLunarVietnamesePlugin::InfobarL
   243 // CCalenLunarVietnamesePlugin::InfobarL
   302 // This function is called in case of Hitchcock views
   244 // This function is called in case of Hitchcock views
   303 // ----------------------------------------------------------------------------
   245 // ----------------------------------------------------------------------------
   304 //
   246 //
   305 const TDesC& CCalenLunarVietnamesePlugin::InfobarL( )
   247 QString* CCalenLunarVietnamesePlugin::InfobarTextL( )
   306     {
   248     {
   307     TRACE_ENTRY_POINT;
   249     TRACE_ENTRY_POINT;
   308     TRect nullRect(0,0,0,0);
   250     TRect nullRect(0,0,0,0);
   309     iRect = nullRect;
   251     iRect = nullRect;
   310     if(iInfoBarText)
   252     if(iInfoBarText)
   313         iInfoBarText = NULL;
   255         iInfoBarText = NULL;
   314         }
   256         }
   315     //Update the local information based on current context
   257     //Update the local information based on current context
   316     //from framework.
   258     //from framework.
   317     UpdateLocalizerInfoL(); 
   259     UpdateLocalizerInfoL(); 
   318     
   260     SetLabelContentL(*iLabelControl);        
   319     //Dummy label for formatting the iExtraRowText
       
   320     CEikLabel* dummyLabel = new(ELeave) CEikLabel;
       
   321     CleanupStack::PushL(dummyLabel);
       
   322     SetLabelContentL(*dummyLabel,TRect());
       
   323     CleanupStack::PopAndDestroy();
       
   324     
       
   325     iInfoBarText = iExtraRowText.AllocLC();
   261     iInfoBarText = iExtraRowText.AllocLC();
   326     CleanupStack::Pop();
   262     CleanupStack::Pop();
   327     
   263     
   328     TRACE_EXIT_POINT;
   264     TRACE_EXIT_POINT;
   329     return *iInfoBarText;
   265     return  (new QString((QChar*)iInfoBarText->Des().Ptr(),iInfoBarText->Length()));
   330     }
   266     }
   331 
   267 
   332 // -----------------------------------------------------------------------------
   268 // ----------------------------------------------------------------------------
   333 // CCalenLunarVietnamesePlugin::CustomPreviewPaneL
   269 // CCalenThaiPlugin::InfobarL
   334 // -----------------------------------------------------------------------------
   270 // This function is called to add menuitem 
   335 //
   271 // ----------------------------------------------------------------------------
   336 MCalenPreview* CCalenLunarVietnamesePlugin::CustomPreviewPaneL( TRect& /*aRect*/ )
   272 //
   337 	{
   273 
   338 	TRACE_ENTRY_POINT
   274 void CCalenLunarVietnamesePlugin::CustomiseMenu(HbMenu* aHbMenu)
   339 	TRACE_EXIT_POINT
   275     {
   340 	return NULL;
   276     HbAction* lunarAction = new HbAction("Show Lunar Data");
   341 	}
   277     QList<QAction*> actionList = aHbMenu->actions();     
   342 
   278     TInt count = actionList.count() - 1;  
   343 // -----------------------------------------------------------------------------
   279     if(count >= 0)
   344 // CCalenLunarVietnamesePlugin::PreviewPaneL
   280     aHbMenu->insertAction(actionList[count], lunarAction);
   345 // -----------------------------------------------------------------------------
   281     QObject::connect(lunarAction, SIGNAL(triggered()), iLabelControl, SLOT(showLunarData()));
   346 //
   282     }
   347 CCoeControl* CCalenLunarVietnamesePlugin::PreviewPaneL(  TRect&  aRect )
   283 
   348 	{
       
   349 	TRACE_ENTRY_POINT;
       
   350     
       
   351     UpdateLocalizerInfoL();
       
   352 	iRect = aRect;
       
   353 	if (iLabelControl)
       
   354 	    {
       
   355 		delete iLabelControl;
       
   356 		iLabelControl = NULL;
       
   357 	    }
       
   358 
       
   359 	iLabelControl = CCalenPluginLabel::NewL(*this);
       
   360 	
       
   361 	if(!Layout_Meta_Data::IsLandscapeOrientation()) //Portriat
       
   362 		{
       
   363 		SetLabelContentL(*iLabelControl, aRect);
       
   364 		}
       
   365 	else
       
   366 		{
       
   367 		SetLabelContentExtraL(*iLabelControl,aRect);	
       
   368 		}
       
   369 	
       
   370 	
       
   371     return iLabelControl;
       
   372 	TRACE_EXIT_POINT;	
       
   373 	}
       
   374 
       
   375 // -----------------------------------------------------------------------------
       
   376 // CCalenLunarVietnamesePlugin::CustomiseMenuPaneL
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 TBool CCalenLunarVietnamesePlugin::CustomiseMenuPaneL( TInt /*aResourceId*/, 
       
   380 												CEikMenuPane* aMenuPane )
       
   381 	{
       
   382 	TRACE_ENTRY_POINT;
       
   383 	HBufC* itemText =  HBufC::NewLC(100);//= StringLoader::LoadLC(R_CALENDAR_SHOW_LUNAR_DATA);
       
   384 	itemText->Des().Append(_L("Viet No Settings"));
       
   385     
       
   386     CEikMenuPaneItem::SData menuItem;
       
   387     menuItem.iCommandId = iStart; 
       
   388     menuItem.iCascadeId = 0;
       
   389     menuItem.iFlags = 0;
       
   390     menuItem.iText = *itemText;
       
   391     menuItem.iExtraText = KNullDesC;
       
   392     
       
   393     aMenuPane->InsertMenuItemL( menuItem, 1 );
       
   394     
       
   395     CleanupStack::PopAndDestroy(itemText);
       
   396 	TRACE_EXIT_POINT;
       
   397 	return ETrue;
       
   398 	}
       
   399 	
       
   400 // -----------------------------------------------------------------------------
   284 // -----------------------------------------------------------------------------
   401 // CCalenLunarVietnamesePlugin::HandleCommandL
   285 // CCalenLunarVietnamesePlugin::HandleCommandL
   402 // -----------------------------------------------------------------------------
   286 // -----------------------------------------------------------------------------
   403 //
   287 //
   404 TBool CCalenLunarVietnamesePlugin::HandleCommandL( const TCalenCommand&  aCommand )
   288 TBool CCalenLunarVietnamesePlugin::HandleCommandL( const TCalenCommand&  aCommand )
   441 		commandHandler = this;	
   325 		commandHandler = this;	
   442 		}
   326 		}
   443    
   327    
   444     return commandHandler;
   328     return commandHandler;
   445 	TRACE_EXIT_POINT;	
   329 	TRACE_EXIT_POINT;	
   446 	}
       
   447 
       
   448 // -----------------------------------------------------------------------------
       
   449 // CCalenLunarVietnamesePlugin::RemoveViewsFromCycle
       
   450 // -----------------------------------------------------------------------------
       
   451 //
       
   452 void CCalenLunarVietnamesePlugin::RemoveViewsFromCycle( RArray<TInt>& /*aViews*/ )
       
   453 	{
       
   454 	TRACE_ENTRY_POINT;
       
   455 	TRACE_EXIT_POINT;	
       
   456 	}
       
   457 
       
   458 // -----------------------------------------------------------------------------
       
   459 // CCalenLunarVietnamesePlugin::CanBeEnabledDisabled
       
   460 // -----------------------------------------------------------------------------
       
   461 //
       
   462 TBool CCalenLunarVietnamesePlugin::CanBeEnabledDisabled()
       
   463     {
       
   464     TRACE_ENTRY_POINT;
       
   465     TRACE_EXIT_POINT;
       
   466     return ETrue;
       
   467     }
       
   468 
       
   469 TAny* CCalenLunarVietnamesePlugin::CalenCustomisationExtensionL( TUid /*aExtensionUid*/ )
       
   470     {
       
   471     TRACE_ENTRY_POINT;
       
   472     TRACE_EXIT_POINT;
       
   473     return NULL;
       
   474     }
       
   475 // -----------------------------------------------------------------------------
       
   476 // CCalenLunarVietnamesePlugin::GetCustomSettingsL
       
   477 // -----------------------------------------------------------------------------
       
   478 //
       
   479 void CCalenLunarVietnamesePlugin::GetCustomSettingsL( RPointerArray<CAknSettingItem>&  
       
   480 														/*aCustomSettingArray*/)
       
   481 	{
       
   482     TRACE_ENTRY_POINT;
       
   483     TRACE_EXIT_POINT;		
       
   484 	}
       
   485 
       
   486 // -----------------------------------------------------------------------------
       
   487 // CCalenLunarVietnamesePlugin::GetCustomViewsL
       
   488 // -----------------------------------------------------------------------------
       
   489 //	
       
   490 void CCalenLunarVietnamesePlugin::GetCustomViewsL(  RPointerArray<CCalenView>& 
       
   491 															/*aCustomViewArray*/ )
       
   492 	{
       
   493 	TRACE_ENTRY_POINT;
       
   494 	TRACE_EXIT_POINT;		
       
   495 	}
   330 	}
   496  	
   331  	
   497 
   332 
   498 // -----------------------------------------------------------------------------
   333 // -----------------------------------------------------------------------------
   499 // CCalenLunarVietnamesePlugin::UpdateInfoLabelL
   334 // CCalenLunarVietnamesePlugin::UpdateInfoLabelL
   597 // CCalenLunarVietnamesePlugin::ShowMessageDialogL
   432 // CCalenLunarVietnamesePlugin::ShowMessageDialogL
   598 // -----------------------------------------------------------------------------
   433 // -----------------------------------------------------------------------------
   599 //    
   434 //    
   600 void CCalenLunarVietnamesePlugin::ExecuteMessageDialogL(TDesC& aMsgText)
   435 void CCalenLunarVietnamesePlugin::ExecuteMessageDialogL(TDesC& aMsgText)
   601 	{
   436 	{
   602 	TRACE_ENTRY_POINT;
   437 	TRACE_ENTRY_POINT;	
   603 	
   438 	QString text = QString::fromUtf16(aMsgText.Ptr(),aMsgText.Length());
   604 	CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(aMsgText);
   439 	
   605     CleanupStack::PushL(dlg);
   440     // Instantiate a popup
   606     dlg->PrepareLC(R_CALEN_LUNAR_DETAILS_DIALOG);
   441     HbPopup popup;
   607     CleanupStack::Pop(dlg);
   442 
   608     dlg->RunLD();
   443     // Set dismiss policy that determines what tap events will cause the popup
       
   444     // to be dismissed
       
   445     popup.setDismissPolicy(HbPopup::NoDismiss);
       
   446     popup.setTimeout(HbPopup::NoTimeout);
       
   447     
       
   448     // Set the label as heading widget    
       
   449     popup.setHeadingWidget(new HbLabel("Lunar Calendar"));
       
   450     HbTextEdit* contentWidget = new HbTextEdit (text);
       
   451     contentWidget->setReadOnly(true);
       
   452     contentWidget->setCursorHidden(true);
       
   453     QSizeF size = contentWidget->maximumSize();
       
   454     contentWidget->setMinimumSize(200,250);    
       
   455     popup.setContentWidget(contentWidget);
       
   456     
       
   457     // Sets the primary action 
       
   458     popup.setPrimaryAction(new HbAction("Ok",&popup));  
       
   459 
       
   460     // Launch popup syncronously
       
   461     popup.exec();
   609     
   462     
   610    	TRACE_EXIT_POINT;
   463    	TRACE_EXIT_POINT;
   611 	}
   464 	}
   612 
   465 
   613 // -----------------------------------------------------------------------------
   466 
   614 // CCalenPluginLabel::NewL
   467 CalenPluginLabel::CalenPluginLabel(CCalenLunarVietnamesePlugin& aPlugin , QGraphicsItem* parent)
   615 // -----------------------------------------------------------------------------
   468     :HbLabel(parent),iPlugin(aPlugin)
   616 //     
   469     {
   617 CCalenPluginLabel* CCalenPluginLabel::NewL(CCalenLunarVietnamesePlugin& aPlugin)
   470 	TRACE_ENTRY_POINT;
   618 	{
   471 	
   619 	TRACE_ENTRY_POINT;
   472 	setAlignment(Qt::AlignHCenter);
   620 	CCalenPluginLabel* self = new(ELeave)CCalenPluginLabel(aPlugin);
   473 	setTextColor(Qt::blue);    
   621 	CleanupStack::PushL(self);
   474     QFont font("Times", 9, QFont::Bold);    
   622 	self->ConstructL();
   475     setFont(font);
   623 	CleanupStack::Pop(self);
   476     setTextWrapping(Hb::TextWrapping);
   624 	TRACE_EXIT_POINT;
   477     setOpacity(12);
   625 	return self;
   478 	    
   626 	}
   479     TRACE_EXIT_POINT;    
   627 	
   480     }
   628 // -----------------------------------------------------------------------------
   481 
   629 // CPluginLabel::CCalenLunarVietnamesePlugin
   482 CalenPluginLabel::~CalenPluginLabel()
   630 // -----------------------------------------------------------------------------
   483     {
   631 // 	
   484     TRACE_ENTRY_POINT;
   632 CCalenPluginLabel::CCalenPluginLabel(CCalenLunarVietnamesePlugin& aPlugin) : 
   485     TRACE_EXIT_POINT;
   633 				   iPlugin(aPlugin) 
   486     }
   634 	{
   487 
   635     TRACE_ENTRY_POINT;
   488 void CalenPluginLabel::showLunarData()
   636     TRACE_EXIT_POINT;	
   489     {
   637 	}
   490     TRACE_ENTRY_POINT;
   638 	
   491     iPlugin.ShowDetailsL(); 
   639 	
   492     TRACE_EXIT_POINT;
   640 // -----------------------------------------------------------------------------
   493     }
   641 // CPluginLabel::ConstructL
   494 void CalenPluginLabel::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget )
   642 // -----------------------------------------------------------------------------
   495     {
   643 // 
   496 	TRACE_ENTRY_POINT;
   644 void CCalenPluginLabel::ConstructL()
   497    
   645 	{
   498     HbLabel::paint(painter,option,widget);
   646 	TRACE_ENTRY_POINT;
   499     QPen pen;//
   647     SetContainerWindowL(*this);
   500     pen.setStyle(Qt::SolidLine);
   648     TRACE_EXIT_POINT;
   501     pen.setWidth(1);
   649 	}
   502     pen.setBrush(Qt::gray);
   650 
   503     painter->setPen(pen);
   651 // -----------------------------------------------------------------------------
   504     QRectF rect = this->rect();
   652 // CCalenPluginLabel::~CCalenPluginLabel
   505     painter->eraseRect(rect);
   653 // -----------------------------------------------------------------------------
   506     painter->drawRect(rect);
   654 // 
   507     painter->fillRect(rect,Qt::gray);
   655 CCalenPluginLabel::~CCalenPluginLabel()
   508     TRACE_EXIT_POINT;    
   656 	{
   509     }
   657 	TRACE_ENTRY_POINT;
   510 	
   658 	TRACE_EXIT_POINT;	
   511 void CalenPluginLabel::mousePressEvent(QGraphicsSceneMouseEvent* event)
   659 	}
   512     {
   660 
   513 	TRACE_ENTRY_POINT;
   661 // -----------------------------------------------------------------------------
   514 	Q_UNUSED(event);
   662 // CCalenPluginLabel::Draw
       
   663 // -----------------------------------------------------------------------------
       
   664 // 
       
   665 void CCalenPluginLabel::Draw( const TRect& aRect) const
       
   666 	{
       
   667 	TRACE_ENTRY_POINT;
       
   668 	CEikLabel::Draw(aRect);
       
   669 	TRACE_EXIT_POINT;
       
   670 	}	
       
   671 
       
   672 // -----------------------------------------------------------------------------
       
   673 // CCalenPluginLabel::HandlePointerEventL
       
   674 // -----------------------------------------------------------------------------
       
   675 //
       
   676 void CCalenPluginLabel::HandlePointerEventL(const TPointerEvent& 
       
   677                                             /*aPointerEvent*/)
       
   678 	{
       
   679 	TRACE_ENTRY_POINT;
       
   680 	iPlugin.ShowDetailsL();	
   515 	iPlugin.ShowDetailsL();	
   681 	TRACE_EXIT_POINT;
   516 	TRACE_EXIT_POINT;    
   682 	}
   517     }
   683 
   518 		
   684 
   519 //EOF	
   685 //EOF