calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameseplugin.cpp
changeset 0 f979ecb2b13e
child 5 42814f902fe6
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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 <aknsettingitemlist.h>
       
    27 #include <aknmessagequerydialog.h>
       
    28 #include <data_caging_path_literals.hrh>
       
    29 #include <bautils.h>
       
    30 #include <AknBidiTextUtils.h>
       
    31 #include <CalenLunarVietnamesePluginData.rsg>
       
    32 #include <layoutmetadata.cdl.h>
       
    33 #include <mcalenpreview.h>
       
    34 
       
    35 #include "calendarui_debug.h" 
       
    36 #include "calenlunarvietnameseplugin.h"
       
    37 #include "calenlunarvietnameselocalizer.h"
       
    38 #include "calenlunarpanic.h"
       
    39 #include "calenlunarlocalizedinfo.h"
       
    40 #include "calenlunarlocalizer.h"
       
    41 #include "calenlunarinfoprovider.h"
       
    42 
       
    43 #include "calencommands.hrh"
       
    44 
       
    45 //CONSTANTS
       
    46 _LIT( KFieldSeparator, "\n" );
       
    47 _LIT( KHeaderSeparator, "\n");
       
    48 
       
    49 _LIT( KResourceVietnamesePluginFile, "calenlunarvietnameseplugindata.rsc" );
       
    50 #define KResourcePath KDC_RESOURCE_FILES_DIR
       
    51 
       
    52 const TInt KFieldCount = 5;
       
    53 
       
    54 
       
    55 // ============================ MEMBER FUNCTIONS ===============================
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CCalenLunarVietnamesePlugin::CCalenLunarVietnamesePlugin
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CCalenLunarVietnamesePlugin::CCalenLunarVietnamesePlugin(MCalenServices* aServices)
       
    62 	:iLocalizer(NULL),
       
    63 	 iLocInfo(NULL),
       
    64 	 iServices(aServices),
       
    65 	 iInfoBarText(NULL),
       
    66 	 iResourceFileOffset(NULL)
       
    67 	{
       
    68 	TRACE_ENTRY_POINT;
       
    69 	iLabelControl = NULL;
       
    70 	TRACE_EXIT_POINT;
       
    71 	}
       
    72 	
       
    73 // -----------------------------------------------------------------------------
       
    74 // CCalenLunarVietnamesePlugin::CreateVietnamesePluginL
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CCalenLunarVietnamesePlugin* CCalenLunarVietnamesePlugin::NewL( MCalenServices* 
       
    78 																			aServices )
       
    79 	{
       
    80 	TRACE_ENTRY_POINT;
       
    81 	CCalenLunarVietnamesePlugin* self = new( ELeave ) 
       
    82 											CCalenLunarVietnamesePlugin( aServices);
       
    83 	CleanupStack::PushL( self );
       
    84 	self->ConstructL();
       
    85     CleanupStack::Pop(self);
       
    86 	TRACE_EXIT_POINT;
       
    87 	return self;
       
    88 	
       
    89 	}
       
    90 	
       
    91 // -----------------------------------------------------------------------------
       
    92 // CCalenLunarVietnamesePlugin::~CCalenLunarVietnamesePlugin
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 CCalenLunarVietnamesePlugin::~CCalenLunarVietnamesePlugin()
       
    96 	{
       
    97 	TRACE_ENTRY_POINT;
       
    98 	
       
    99  	delete iLabelControl;
       
   100  	iLabelControl = NULL;
       
   101 	
       
   102 	//Deregister services
       
   103 	if ( iServices )
       
   104         {
       
   105         iServices->CancelNotifications(this);
       
   106         iServices->Release();
       
   107         }
       
   108     if(iInfoBarText)
       
   109         {
       
   110         delete iInfoBarText;
       
   111         iInfoBarText = NULL;
       
   112         }
       
   113 	delete iInfoProvider;
       
   114 	delete iLocalizer;
       
   115 	delete iLocInfo;
       
   116 	
       
   117 	if( iResourceFileOffset )
       
   118         {
       
   119         CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset );
       
   120         }
       
   121 	TRACE_EXIT_POINT;
       
   122 	}
       
   123 	
       
   124 // -----------------------------------------------------------------------------
       
   125 // CCalenLunarVietnamesePlugin::ContructL
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 void CCalenLunarVietnamesePlugin::ConstructL()
       
   129 	{
       
   130 	TRACE_ENTRY_POINT;
       
   131 	
       
   132 		TFileName dllName;
       
   133 	// Get the complate path of the DLL from where it is currently loaded
       
   134 	Dll::FileName( dllName );
       
   135 	
       
   136     TFileName resourceFilename;
       
   137     resourceFilename.Append(dllName.Mid(0,2));
       
   138     resourceFilename.Append(KResourcePath);
       
   139     resourceFilename.Append(KResourceVietnamesePluginFile);
       
   140     BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), resourceFilename );
       
   141     // Add the resource file.
       
   142     iResourceFileOffset = CEikonEnv::Static()->AddResourceFileL( resourceFilename );
       
   143 
       
   144 	iServices->RegisterForNotificationsL( this, ECalenNotifyContextChanged );
       
   145 	iServices->GetCommandRange( iStart, iEnd );
       
   146 	
       
   147 	iInfoProvider = CCalenLunarInfoProvider::NewL(CEikonEnv::Static()->FsSession());
       
   148 	
       
   149 	iLabelControl = CCalenPluginLabel::NewL(*this);
       
   150 	
       
   151     iLocalizer = CCalenLunarVietnameseLocalizer::NewL();
       
   152     
       
   153     
       
   154     TRACE_EXIT_POINT;	
       
   155 	}
       
   156 	
       
   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 // -----------------------------------------------------------------------------
       
   215 // CCalenLunarVietnamesePlugin::SetLabelContentL
       
   216 // -----------------------------------------------------------------------------
       
   217 //
       
   218 void CCalenLunarVietnamesePlugin::SetLabelContentL( CEikLabel& aLabel, 
       
   219 														const TRect&  /*aRect*/ ) 
       
   220     {
       
   221     TRACE_ENTRY_POINT;
       
   222     TRect nullRect;
       
   223     aLabel.SetRect(nullRect);
       
   224     
       
   225     FormatExtraRowStringL( aLabel, EFalse );
       
   226     aLabel.UseLogicalToVisualConversion(ETrue);
       
   227     aLabel.SetLabelAlignment(ELayoutAlignCenter);
       
   228     aLabel.SetTextL(  iExtraRowText );
       
   229     
       
   230     TRACE_EXIT_POINT;
       
   231     }
       
   232     
       
   233     
       
   234 // -----------------------------------------------------------------------------
       
   235 // CCalenLunarVietnamesePlugin::FormatExtraRowStringL
       
   236 // -----------------------------------------------------------------------------
       
   237 //	
       
   238 void CCalenLunarVietnamesePlugin::FormatExtraRowStringL( CEikLabel& aLabel,
       
   239 																TBool aTwoLines)
       
   240     {
       
   241     TRACE_ENTRY_POINT;
       
   242     
       
   243     const CFont*  labelFont = NULL;
       
   244     
       
   245     if( aTwoLines ) 
       
   246     	{
       
   247     	labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL);
       
   248     	} 
       
   249     else
       
   250     	{
       
   251     	labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont,NULL);	
       
   252     	}
       
   253     
       
   254     aLabel.SetFont( labelFont );
       
   255     TInt maxWidth = iRect.Size().iWidth;
       
   256     
       
   257     if ( labelFont && iLocInfo )
       
   258         {
       
   259         iExtraRowText.Set( iLocalizer->GetExtraRowTextL( *iLocInfo, 
       
   260                                                          maxWidth, 
       
   261                                                          *labelFont,
       
   262                                                          aTwoLines ) 
       
   263                                                         );
       
   264         }
       
   265     else 
       
   266         {
       
   267         iExtraRowText.Set( KNullDesC );
       
   268         }
       
   269     
       
   270     TRACE_EXIT_POINT;
       
   271     }
       
   272 	
       
   273 // -----------------------------------------------------------------------------
       
   274 // CCalenLunarVietnamesePlugin::InfobarL
       
   275 // -----------------------------------------------------------------------------
       
   276 //	
       
   277 CCoeControl* CCalenLunarVietnamesePlugin::InfobarL( const TRect&  aRect )
       
   278 	{
       
   279 	TRACE_ENTRY_POINT;
       
   280 
       
   281 	UpdateLocalizerInfoL();
       
   282 	iRect = aRect;
       
   283 	
       
   284 	if(iLabelControl)
       
   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;
       
   296 	
       
   297     TRACE_EXIT_POINT;	
       
   298 	}
       
   299 
       
   300 // ----------------------------------------------------------------------------
       
   301 // CCalenLunarVietnamesePlugin::InfobarL
       
   302 // This function is called in case of Hitchcock views
       
   303 // ----------------------------------------------------------------------------
       
   304 //
       
   305 const TDesC& CCalenLunarVietnamesePlugin::InfobarL( )
       
   306     {
       
   307     TRACE_ENTRY_POINT;
       
   308     TRect nullRect(0,0,0,0);
       
   309     iRect = nullRect;
       
   310     if(iInfoBarText)
       
   311         {
       
   312         delete iInfoBarText;
       
   313         iInfoBarText = NULL;
       
   314         }
       
   315     //Update the local information based on current context
       
   316     //from framework.
       
   317     UpdateLocalizerInfoL(); 
       
   318     
       
   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();
       
   326     CleanupStack::Pop();
       
   327     
       
   328     TRACE_EXIT_POINT;
       
   329     return *iInfoBarText;
       
   330     }
       
   331 
       
   332 // -----------------------------------------------------------------------------
       
   333 // CCalenLunarVietnamesePlugin::CustomPreviewPaneL
       
   334 // -----------------------------------------------------------------------------
       
   335 //
       
   336 MCalenPreview* CCalenLunarVietnamesePlugin::CustomPreviewPaneL( TRect& /*aRect*/ )
       
   337 	{
       
   338 	TRACE_ENTRY_POINT
       
   339 	TRACE_EXIT_POINT
       
   340 	return NULL;
       
   341 	}
       
   342 
       
   343 // -----------------------------------------------------------------------------
       
   344 // CCalenLunarVietnamesePlugin::PreviewPaneL
       
   345 // -----------------------------------------------------------------------------
       
   346 //
       
   347 CCoeControl* CCalenLunarVietnamesePlugin::PreviewPaneL(  TRect&  aRect )
       
   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 // -----------------------------------------------------------------------------
       
   401 // CCalenLunarVietnamesePlugin::HandleCommandL
       
   402 // -----------------------------------------------------------------------------
       
   403 //
       
   404 TBool CCalenLunarVietnamesePlugin::HandleCommandL( const TCalenCommand&  aCommand )
       
   405 	{
       
   406 	TRACE_ENTRY_POINT;
       
   407 	
       
   408 	const TInt commandId = aCommand.Command();
       
   409 	if(iStart == commandId)
       
   410 		{
       
   411 		ShowDetailsL();	
       
   412 		}
       
   413 	TRACE_EXIT_POINT;		
       
   414 	return EFalse;
       
   415 	}
       
   416 
       
   417 // ----------------------------------------------------------------------------
       
   418 // CCalenLunarVietnamesePlugin::CalenCommandHandlerExtensionL
       
   419 //
       
   420 // ----------------------------------------------------------------------------
       
   421 //
       
   422 TAny* CCalenLunarVietnamesePlugin::CalenCommandHandlerExtensionL( TUid /*aExtensionUid*/ )
       
   423     {
       
   424     TRACE_ENTRY_POINT;
       
   425     TRACE_EXIT_POINT;
       
   426     return NULL;
       
   427     }
       
   428 
       
   429 // -----------------------------------------------------------------------------
       
   430 // CCalenLunarVietnamesePlugin::CommandHandlerL
       
   431 // -----------------------------------------------------------------------------
       
   432 //
       
   433 MCalenCommandHandler* CCalenLunarVietnamesePlugin::CommandHandlerL( TInt aCommand )
       
   434 	{
       
   435 	TRACE_ENTRY_POINT;
       
   436 	
       
   437 	MCalenCommandHandler*  commandHandler = NULL;	
       
   438 	
       
   439 	if(iStart == aCommand)
       
   440 		{
       
   441 		commandHandler = this;	
       
   442 		}
       
   443    
       
   444     return commandHandler;
       
   445 	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 	}
       
   496  	
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // CCalenLunarVietnamesePlugin::UpdateInfoLabelL
       
   500 // -----------------------------------------------------------------------------
       
   501 //	
       
   502 void CCalenLunarVietnamesePlugin::UpdateLocalizerInfoL()
       
   503 	{
       
   504 	TRACE_ENTRY_POINT;
       
   505 	
       
   506 	TTime focusTime = iServices->Context().FocusDateAndTimeL().TimeLocalL();
       
   507     
       
   508     TCalenLunarInfo lunarInfo = iInfoProvider->GetLunarInfoL( focusTime );
       
   509     
       
   510     delete iLocInfo;
       
   511 	iLocInfo = NULL;
       
   512 	if(iLocalizer)
       
   513 		{
       
   514 		iLocInfo = iLocalizer->LocalizeL( lunarInfo );	
       
   515 		}
       
   516     
       
   517 	TRACE_EXIT_POINT;
       
   518 	}
       
   519 
       
   520 // -----------------------------------------------------------------------------
       
   521 // CCalenLunarVietnamesePlugin::HandleNotification
       
   522 // -----------------------------------------------------------------------------
       
   523 //	
       
   524 void CCalenLunarVietnamesePlugin::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 // CCalenLunarVietnamesePlugin::ShowDetailsL
       
   536 // Message popup from menu
       
   537 // -----------------------------------------------------------------------------
       
   538 //	
       
   539 void CCalenLunarVietnamesePlugin::ShowDetailsL( )
       
   540     {
       
   541     TRACE_ENTRY_POINT;
       
   542     
       
   543     HBufC* msgText = HBufC::NewLC( 1000 );
       
   544     
       
   545     if ( iLocInfo )
       
   546         {
       
   547         TInt headerIds[KFieldCount] = {
       
   548             R_CALENDAR_LUNAR_INFO_FESTIVAL,
       
   549             R_CALENDAR_LUNAR_INFO_SOLAR,
       
   550             R_CALENDAR_LUNAR_INFO_DATE,
       
   551             R_CALENDAR_LUNAR_INFO_ANIMAL_YEAR,
       
   552             R_CALENDAR_LUNAR_INFO_WESTERN_DATE
       
   553             };
       
   554         
       
   555         RPointerArray<HBufC> headersArray;
       
   556         
       
   557         for ( TInt i=0; i < KFieldCount; i++) 
       
   558             {
       
   559             headersArray.Append( StringLoader::LoadL( headerIds[i] ) );
       
   560             }
       
   561         
       
   562         CPtrCArray* fieldsArray = new (ELeave) CPtrCArray(5);
       
   563         CleanupStack::PushL( fieldsArray );
       
   564         fieldsArray->AppendL( iLocInfo->Festival() );
       
   565         fieldsArray->AppendL( iLocInfo->SolarTerm() );
       
   566         fieldsArray->AppendL( iLocInfo->FullLunarDate() );
       
   567         fieldsArray->AppendL( iLocInfo->AnimalYear() );
       
   568         fieldsArray->AppendL( iLocInfo->GregorianDate() );
       
   569         
       
   570         for (TInt i=0; i < KFieldCount; i++)
       
   571             {
       
   572             TPtrC fieldPtrC = fieldsArray->At(i);
       
   573             if ( fieldPtrC != KNullDesC )
       
   574                 {
       
   575                 msgText->Des().Append( *(headersArray[i]) );
       
   576                 msgText->Des().Append( KHeaderSeparator );
       
   577                 msgText->Des().Append( fieldPtrC );
       
   578                 if ( i < KFieldCount - 1 ) // not last
       
   579                     {
       
   580                     msgText->Des().Append( KFieldSeparator );
       
   581                     }
       
   582                 }
       
   583             }
       
   584         CleanupStack::PopAndDestroy( fieldsArray );
       
   585         headersArray.ResetAndDestroy();
       
   586         }
       
   587     
       
   588     
       
   589     ExecuteMessageDialogL(*msgText);
       
   590    
       
   591     CleanupStack::PopAndDestroy( msgText );
       
   592     
       
   593     TRACE_EXIT_POINT;
       
   594     }
       
   595 
       
   596 // -----------------------------------------------------------------------------
       
   597 // CCalenLunarVietnamesePlugin::ShowMessageDialogL
       
   598 // -----------------------------------------------------------------------------
       
   599 //    
       
   600 void CCalenLunarVietnamesePlugin::ExecuteMessageDialogL(TDesC& aMsgText)
       
   601 	{
       
   602 	TRACE_ENTRY_POINT;
       
   603 	
       
   604 	CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(aMsgText);
       
   605     CleanupStack::PushL(dlg);
       
   606     dlg->PrepareLC(R_CALEN_LUNAR_DETAILS_DIALOG);
       
   607     CleanupStack::Pop(dlg);
       
   608     dlg->RunLD();
       
   609     
       
   610    	TRACE_EXIT_POINT;
       
   611 	}
       
   612 
       
   613 // -----------------------------------------------------------------------------
       
   614 // CCalenPluginLabel::NewL
       
   615 // -----------------------------------------------------------------------------
       
   616 //     
       
   617 CCalenPluginLabel* CCalenPluginLabel::NewL(CCalenLunarVietnamesePlugin& aPlugin)
       
   618 	{
       
   619 	TRACE_ENTRY_POINT;
       
   620 	CCalenPluginLabel* self = new(ELeave)CCalenPluginLabel(aPlugin);
       
   621 	CleanupStack::PushL(self);
       
   622 	self->ConstructL();
       
   623 	CleanupStack::Pop(self);
       
   624 	TRACE_EXIT_POINT;
       
   625 	return self;
       
   626 	}
       
   627 	
       
   628 // -----------------------------------------------------------------------------
       
   629 // CPluginLabel::CCalenLunarVietnamesePlugin
       
   630 // -----------------------------------------------------------------------------
       
   631 // 	
       
   632 CCalenPluginLabel::CCalenPluginLabel(CCalenLunarVietnamesePlugin& aPlugin) : 
       
   633 				   iPlugin(aPlugin) 
       
   634 	{
       
   635     TRACE_ENTRY_POINT;
       
   636     TRACE_EXIT_POINT;	
       
   637 	}
       
   638 	
       
   639 	
       
   640 // -----------------------------------------------------------------------------
       
   641 // CPluginLabel::ConstructL
       
   642 // -----------------------------------------------------------------------------
       
   643 // 
       
   644 void CCalenPluginLabel::ConstructL()
       
   645 	{
       
   646 	TRACE_ENTRY_POINT;
       
   647     SetContainerWindowL(*this);
       
   648     TRACE_EXIT_POINT;
       
   649 	}
       
   650 
       
   651 // -----------------------------------------------------------------------------
       
   652 // CCalenPluginLabel::~CCalenPluginLabel
       
   653 // -----------------------------------------------------------------------------
       
   654 // 
       
   655 CCalenPluginLabel::~CCalenPluginLabel()
       
   656 	{
       
   657 	TRACE_ENTRY_POINT;
       
   658 	TRACE_EXIT_POINT;	
       
   659 	}
       
   660 
       
   661 // -----------------------------------------------------------------------------
       
   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();	
       
   681 	TRACE_EXIT_POINT;
       
   682 	}
       
   683 
       
   684 
       
   685 //EOF