engine/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonths.cpp
changeset 36 6481344a6d67
parent 23 74c9f037fd5d
equal deleted inserted replaced
33:1ee2af37811f 36:6481344a6d67
    44 #include "glxcollectionpluginmonths.hrh"
    44 #include "glxcollectionpluginmonths.hrh"
    45 /**
    45 /**
    46  * @internal reviewed 14/06/2007 by Alex Birkett
    46  * @internal reviewed 14/06/2007 by Alex Birkett
    47  */
    47  */
    48 // CONSTANTS
    48 // CONSTANTS
       
    49 const TInt KYearBufferSize = 8;
       
    50 const TInt KDateBufferPaddingMin = 10;
       
    51 const TInt KDateBufferPaddingMax = 20;
       
    52 const TInt KDateFormat1 = 1;
       
    53 
       
    54 const TInt KDateFormat2 = 2;
       
    55 const TInt KDateFormat3 = 3;
    49 
    56 
    50 // ============================ LOCAL FUNCTIONS ==============================
    57 // ============================ LOCAL FUNCTIONS ==============================
    51     
    58     
    52 // ============================ MEMBER FUNCTIONS ==============================
    59 // ============================ MEMBER FUNCTIONS ==============================
    53 // ----------------------------------------------------------------------------
    60 // ----------------------------------------------------------------------------
    94  
   101  
    95 // ----------------------------------------------------------------------------
   102 // ----------------------------------------------------------------------------
    96 // CpiAttributeAdditionalAttributes
   103 // CpiAttributeAdditionalAttributes
    97 // ----------------------------------------------------------------------------
   104 // ----------------------------------------------------------------------------
    98 //
   105 //
    99 void CGlxCollectionPluginMonths::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray<TMPXAttribute>& aAttributeArray)
   106 void CGlxCollectionPluginMonths::CpiAttributeAdditionalAttributes(
       
   107 	const TMPXAttribute& aCpiAttribute, RArray<TMPXAttribute>& aAttributeArray)
   100 	{
   108 	{
   101     TRACER("CGlxCollectionPluginMonths::CpiAttributeAdditionalAttributes");
   109     TRACER("CGlxCollectionPluginMonths::CpiAttributeAdditionalAttributes");
   102     // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files
   110     // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files
   103     // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count
   111     // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count
   104 	if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle)
   112 	if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle)
   183 
   191 
   184 // ----------------------------------------------------------------------------
   192 // ----------------------------------------------------------------------------
   185 // HandleCpiAttributeResponseL
   193 // HandleCpiAttributeResponseL
   186 // ----------------------------------------------------------------------------
   194 // ----------------------------------------------------------------------------
   187 // 
   195 // 
   188 void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, TArray<TGlxMediaId> aMediaIds)
   196 void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse,
       
   197 		TArray<TMPXAttribute> aCpiAttributes, TArray<TGlxMediaId> aMediaIds)
   189     {
   198     {
   190     TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL");
   199     TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL");
   191     
   200     
   192     const TInt mediaIdCount = aMediaIds.Count();
   201     const TInt mediaIdCount = aMediaIds.Count();
   193     
   202     
   209             if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0])
   218             if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0])
   210                 {
   219                 {
   211                 User::Leave(KErrNotSupported);
   220                 User::Leave(KErrNotSupported);
   212                 }
   221                 }
   213                 
   222                 
   214             CMPXMediaArray* mediaArray = aResponse->ValueCObjectL<CMPXMediaArray>(KMPXMediaArrayContents);
   223             CMPXMediaArray* mediaArray =
       
   224             	aResponse->ValueCObjectL<CMPXMediaArray>(KMPXMediaArrayContents);
   215             CleanupStack::PushL(mediaArray);
   225             CleanupStack::PushL(mediaArray);
   216 
   226 
   217             const TInt arrayCount = mediaArray->Count();
   227             const TInt arrayCount = mediaArray->Count();
   218             
   228             
   219             // Sanity check
   229             // Sanity check
   222                 User::Leave(KErrArgument);
   232                 User::Leave(KErrArgument);
   223                 }
   233                 }
   224             
   234             
   225             for (TInt index = 0; index < arrayCount; index++)
   235             for (TInt index = 0; index < arrayCount; index++)
   226                 {
   236                 {
   227                 HandleCpiAttributeResponseL((*mediaArray)[index], aCpiAttributes, aMediaIds[index]);
   237                 HandleCpiAttributeResponseL((*mediaArray)[index],
       
   238                 		aCpiAttributes, aMediaIds[index]);
   228                 }
   239                 }
   229 
   240 
   230             aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray);
   241             aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray);
   231             CleanupStack::PopAndDestroy(mediaArray);
   242             CleanupStack::PopAndDestroy(mediaArray);
   232             }
   243             }
   237 
   248 
   238 // ----------------------------------------------------------------------------
   249 // ----------------------------------------------------------------------------
   239 // HandleCpiAttributeResponseL
   250 // HandleCpiAttributeResponseL
   240 // ----------------------------------------------------------------------------
   251 // ----------------------------------------------------------------------------
   241 // 
   252 // 
   242 void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, TGlxMediaId aMediaId)
   253 void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse,
       
   254 		TArray<TMPXAttribute> aCpiAttributes, TGlxMediaId aMediaId)
   243     {
   255     {
   244     TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL");
   256     TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL");
   245     
   257     
   246     _LIT(KResourceFile, "z:glxpluginmonths.rsc");
   258     _LIT(KResourceFile, "z:glxpluginmonths.rsc");
   247 
   259 
   295 						
   307 						
   296 						tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI_BY_MONTH);						
   308 						tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI_BY_MONTH);						
   297 						TPtr formatString = tempTitle->Des();
   309 						TPtr formatString = tempTitle->Des();
   298 
   310 
   299 						// Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   311 						// Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   300 						HBufC* title = HBufC::NewLC(formatString.Length() + 10);
   312 						HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin);
   301 						TPtr ptr = title->Des();
   313 						TPtr ptr = title->Des();
   302 						StringLoader::Format(ptr, formatString, -1, usageCount);
   314 						StringLoader::Format(ptr, formatString, -1, usageCount);
   303 
   315 
   304 						// Set the title in the response.
   316 						// Set the title in the response.
   305 						aResponse->SetTextValueL(attr, *title);    
   317 						aResponse->SetTextValueL(attr, *title);    
   391                         {
   403                         {
   392                         monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_DEC);
   404                         monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_DEC);
   393                         break;
   405                         break;
   394                         }
   406                         }
   395                     }
   407                     }
   396                 TBuf<8> yearTitle2;
   408                 TBuf<KYearBufferSize> yearTitle2;
   397                 end.FormatL(yearTitle2, KGlxTempMonthYearTitleFormat);
   409                 end.FormatL(yearTitle2, KGlxTempMonthYearTitleFormat);
   398                 HBufC* monthTitle2 = NULL;
   410                 HBufC* monthTitle2 = NULL;
   399                 switch(end.DateTime().Month())
   411                 switch(end.DateTime().Month())
   400                     {
   412                     {
   401                     case EJanuary:
   413                     case EJanuary:
   458                         monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_DEC);
   470                         monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_DEC);
   459                         break;
   471                         break;
   460                         }
   472                         }
   461                     }
   473                     }
   462 
   474 
   463                 HBufC* title1 = HBufC::NewLC(formatString.Length() + 20);
   475                 HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax);
   464                 TPtr ptr1 = title1->Des();
   476                 TPtr ptr1 = title1->Des();
   465                 HBufC* title2 = HBufC::NewLC(formatString.Length() + 20);
   477                 HBufC* title2 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax);
   466                 TPtr ptr2 = title2->Des();
   478                 TPtr ptr2 = title2->Des();
   467                 HBufC* title3 = HBufC::NewLC(formatString.Length() + 20);
   479                 HBufC* title3 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax);
   468                 TPtr ptr3 = title3->Des();
   480                 TPtr ptr3 = title3->Des();
   469                 HBufC* title4 = HBufC::NewLC(formatString.Length() + 20);
   481                 HBufC* title4 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax);
   470                 TPtr ptr4 = title4->Des();
   482                 TPtr ptr4 = title4->Des();
   471                 TPtr monthPtr = monthTitle->Des();
   483                 TPtr monthPtr = monthTitle->Des();
   472                 TPtr monthPtr2 = monthTitle2->Des();
   484                 TPtr monthPtr2 = monthTitle2->Des();
   473                 StringLoader::Format(ptr1, formatString, 0, monthPtr);
   485                 StringLoader::Format(ptr1, formatString, 0, monthPtr);
   474                 StringLoader::Format(ptr2, ptr1, 1, yearTitle);
   486                 StringLoader::Format(ptr2, ptr1, KDateFormat1, yearTitle);
   475                 StringLoader::Format(ptr3, ptr2, 2, monthPtr2);
   487                 StringLoader::Format(ptr3, ptr2, KDateFormat2, monthPtr2);
   476                 StringLoader::Format(ptr4, ptr3, 3, yearTitle2);
   488                 StringLoader::Format(ptr4, ptr3, KDateFormat3, yearTitle2);
   477                 
   489                 
   478 
   490 
   479                 aResponse->SetTextValueL(attr, *title4);  
   491                 aResponse->SetTextValueL(attr, *title4);  
   480                 CleanupStack::PopAndDestroy(title4); 
   492                 CleanupStack::PopAndDestroy(title4); 
   481                 CleanupStack::PopAndDestroy(title3); 
   493                 CleanupStack::PopAndDestroy(title3); 
   500 				//No Images or Videos
   512 				//No Images or Videos
   501 				if ((0 == videoCount) && (0 == imageCount ))
   513 				if ((0 == videoCount) && (0 == imageCount ))
   502 					{  
   514 					{  
   503 					GLX_LOG_INFO("VideoCount:0,ImageCount:0");
   515 					GLX_LOG_INFO("VideoCount:0,ImageCount:0");
   504 					              	
   516 					              	
   505 					tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO);
   517 					tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   518 										R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO);
   506 					aResponse->SetTextValueL(attr, *tempTitle);	
   519 					aResponse->SetTextValueL(attr, *tempTitle);	
   507 					}
   520 					}
   508 				else
   521 				else
   509 					{
   522 					{
   510 					// 1 Image and multi/0 Videos                	
   523 					// 1 Image and multi/0 Videos                	
   511 					if (1 == imageCount) 
   524 					if (1 == imageCount) 
   512 						{
   525 						{
   513 						GLX_LOG_INFO1("ImageCount:1,VideoCount:%d",videoCount);
   526 						GLX_LOG_INFO1("ImageCount:1,VideoCount:%d",videoCount);
   514 						
   527 						
   515 						tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_ONE_IMAGE_MULTI_VIDEO);
   528 						tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   529 										R_MONTHS_SUB_TITLE_ONE_IMAGE_MULTI_VIDEO);
   516 
   530 
   517 						TPtr formatString = tempTitle->Des();
   531 						TPtr formatString = tempTitle->Des();
   518 
   532 
   519 						// Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   533 						// Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   520 						HBufC* title = HBufC::NewLC(formatString.Length() + 10);
   534 						HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin);
   521 						TPtr ptr = title->Des();
   535 						TPtr ptr = title->Des();
   522 
   536 
   523 						StringLoader::Format(ptr, formatString, -1, videoCount);
   537 						StringLoader::Format(ptr, formatString, -1, videoCount);
   524 
   538 
   525 						// Set the title in the response.	
   539 						// Set the title in the response.	
   531 					// Multi/0 Image and 1 Video					
   545 					// Multi/0 Image and 1 Video					
   532 					else if (1 == videoCount)
   546 					else if (1 == videoCount)
   533 						{
   547 						{
   534 						GLX_LOG_INFO1("ImageCount: %d,VideoCount:1",imageCount);
   548 						GLX_LOG_INFO1("ImageCount: %d,VideoCount:1",imageCount);
   535 						
   549 						
   536 						tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI_IMAGE_ONE_VIDEO);                	
   550 						tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   551 									R_MONTHS_SUB_TITLE_MULTI_IMAGE_ONE_VIDEO);
   537 
   552 
   538 						TPtr formatString = tempTitle->Des();
   553 						TPtr formatString = tempTitle->Des();
   539 
   554 
   540 						// Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   555 						// Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   541 						HBufC* title = HBufC::NewLC(formatString.Length() + 10);
   556 						HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin);
   542 						TPtr ptr = title->Des();
   557 						TPtr ptr = title->Des();
   543 
   558 
   544 						StringLoader::Format(ptr, formatString, -1, imageCount);
   559 						StringLoader::Format(ptr, formatString, -1, imageCount);
   545 
   560 
   546 						// Set the title in the response.	
   561 						// Set the title in the response.	
   552 					// Multi Image and Multi Video
   567 					// Multi Image and Multi Video
   553 					else 
   568 					else 
   554 						{						
   569 						{						
   555 						GLX_LOG_INFO2("ImageCount %d,VideoCount %d",imageCount,videoCount);
   570 						GLX_LOG_INFO2("ImageCount %d,VideoCount %d",imageCount,videoCount);
   556 						
   571 						
   557 						tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI_IMAGE_MULTI_VIDEO);                	
   572 						tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   573 									R_MONTHS_SUB_TITLE_MULTI_IMAGE_MULTI_VIDEO);
       
   574 
   558 						TPtr formatString = tempTitle->Des();	
   575 						TPtr formatString = tempTitle->Des();	
   559 
   576 
   560 						HBufC* title = HBufC::NewLC(formatString.Length() + 10);
   577 						HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin);
   561 						TPtr ptr = title->Des();
   578 						TPtr ptr = title->Des();
   562 
   579 
   563 						HBufC* title1 = HBufC::NewLC(formatString.Length() + 10);
   580 						HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin);
   564 						TPtr ptr1 = title1->Des();
   581 						TPtr ptr1 = title1->Des();
   565 
   582 
   566 						StringLoader::Format(ptr, formatString, 0, imageCount);
   583 						StringLoader::Format(ptr, formatString, 0, imageCount);
   567 						StringLoader::Format(ptr1, ptr, 1, videoCount);	
   584 						StringLoader::Format(ptr1, ptr, KDateFormat1, videoCount);
   568 
   585 
   569 						// Set the title in the response.	
   586 						// Set the title in the response.	
   570 						aResponse->SetTextValueL(attr, *title1);
   587 						aResponse->SetTextValueL(attr, *title1);
   571 
   588 
   572 						CleanupStack::PopAndDestroy(title1);
   589 						CleanupStack::PopAndDestroy(title1);
   582                     {
   599                     {
   583                     usageCount = aResponse->ValueTObjectL<TInt>(KMPXMediaGeneralCount);
   600                     usageCount = aResponse->ValueTObjectL<TInt>(KMPXMediaGeneralCount);
   584                     }
   601                     }
   585                 else if ( aResponse->IsSupported(KGlxMediaCollectionInternalUsageCount) )
   602                 else if ( aResponse->IsSupported(KGlxMediaCollectionInternalUsageCount) )
   586                     {
   603                     {
   587                     usageCount = aResponse->ValueTObjectL<TInt>(KGlxMediaCollectionInternalUsageCount);
   604                     usageCount =
       
   605                     aResponse->ValueTObjectL<TInt>(KGlxMediaCollectionInternalUsageCount);
   588                     }
   606                     }
   589                 else
   607                 else
   590                     {
   608                     {
   591                     User::Leave(KErrNotSupported);
   609                     User::Leave(KErrNotSupported);
   592                     }
   610                     }
   593                 HBufC* tempTitle = NULL;
   611                 HBufC* tempTitle = NULL;
   594                 
   612 
   595             	if(0 == usageCount)
   613             	if(0 == usageCount)
   596             		{
   614             		{
   597                 	tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO);                	
   615                 	tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   616                 				R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO);
       
   617 
   598                 	// Set the title in the response.
   618                 	// Set the title in the response.
   599             		aResponse->SetTextValueL(attr, *tempTitle);  
   619             		aResponse->SetTextValueL(attr, *tempTitle);  
   600             		CleanupStack::PopAndDestroy(tempTitle);
   620             		CleanupStack::PopAndDestroy(tempTitle);
   601             		continue;                	
   621             		continue;
   602             		}  
   622             		}
   603                 
   623 
   604             	else if (1 == usageCount)
   624             	else if (1 == usageCount)
   605                     {
   625                     {
   606                     tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_SINGLE);
   626                     tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   627                     			R_MONTHS_SUB_TITLE_SINGLE);
   607                     }
   628                     }
   608                 else
   629                 else
   609                     {
   630                     {
   610                     tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI);
   631                     tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   632                     			R_MONTHS_SUB_TITLE_MULTI);
   611                     }
   633                     }
   612                 
   634                 
   613                 TPtr formatString = tempTitle->Des();
   635                 TPtr formatString = tempTitle->Des();
   614                 
   636                 
   615                 // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   637                 // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number
   616                 HBufC* title = HBufC::NewLC(formatString.Length() + 10);
   638                 HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin);
   617                 TPtr ptr = title->Des();
   639                 TPtr ptr = title->Des();
   618                 StringLoader::Format(ptr, formatString, -1, usageCount);
   640                 StringLoader::Format(ptr, formatString, -1, usageCount);
   619                 
   641                 
   620                 // Set the title in the response.
   642                 // Set the title in the response.
   621                 aResponse->SetTextValueL(attr, *title);    
   643                 aResponse->SetTextValueL(attr, *title);    
   649             
   671             
   650             if( TGlxMediaId(KGlxCollectionRootId) == aMediaId )
   672             if( TGlxMediaId(KGlxCollectionRootId) == aMediaId )
   651                 {
   673                 {
   652                 GLX_LOG_INFO("Attribute : GeneralTitle:RootId");
   674                 GLX_LOG_INFO("Attribute : GeneralTitle:RootId");
   653                 
   675                 
   654                 HBufC* title = LoadLocalizedStringLC(KResourceFile, R_MONTHS_GENERAL_TITLE);
   676                 HBufC* title = LoadLocalizedStringLC(KResourceFile,
       
   677                 			R_MONTHS_GENERAL_TITLE);
   655                 aResponse->SetTextValueL(attr, *title);  
   678                 aResponse->SetTextValueL(attr, *title);  
   656                 CleanupStack::PopAndDestroy(title); 
   679                 CleanupStack::PopAndDestroy(title); 
   657                 }
   680                 }
   658             else
   681             else
   659                 {
   682                 {
   660                 if( aResponse->IsSupported(KGlxMediaCollectionInternalStartDate) )
   683                 if( aResponse->IsSupported(KGlxMediaCollectionInternalStartDate) )
   661                     {
   684                     {
   662                     HBufC* tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_ITEM_TITLE);
   685                     HBufC* tempTitle = LoadLocalizedStringLC(KResourceFile,
       
   686                     			R_MONTHS_ITEM_TITLE);
   663                     TPtr formatString = tempTitle->Des();
   687                     TPtr formatString = tempTitle->Des();
   664                     TTime month = aResponse->ValueTObjectL<TInt64>(KGlxMediaCollectionInternalStartDate);
   688                     TTime month =
       
   689                     aResponse->ValueTObjectL<TInt64>(KGlxMediaCollectionInternalStartDate);
   665                     _LIT(KGlxTempMonthYearTitleFormat, "%F%Y");
   690                     _LIT(KGlxTempMonthYearTitleFormat, "%F%Y");
   666                     TBuf<8> yearTitle;
   691                     TBuf<KYearBufferSize> yearTitle;
   667                     month.FormatL(yearTitle, KGlxTempMonthYearTitleFormat);
   692                     month.FormatL(yearTitle, KGlxTempMonthYearTitleFormat);
   668                     HBufC* monthTitle = NULL;
   693                     HBufC* monthTitle = NULL;
   669                     switch(month.DateTime().Month())
   694                     switch(month.DateTime().Month())
   670                         {
   695                         {
   671                         case EJanuary:
   696                         case EJanuary:
   728                             monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_DEC);
   753                             monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_DEC);
   729                             break;
   754                             break;
   730                             }
   755                             }
   731                         }
   756                         }
   732 
   757 
   733                     HBufC* title1 = HBufC::NewLC(formatString.Length() + 20);
   758                     HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax);
   734                     TPtr ptr = title1->Des();
   759                     TPtr ptr = title1->Des();
   735                     HBufC* title = HBufC::NewLC(formatString.Length() + 20);
   760                     HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax);
   736                     TPtr ptr2 = title->Des();
   761                     TPtr ptr2 = title->Des();
   737                     TPtr monthPtr = monthTitle->Des();
   762                     TPtr monthPtr = monthTitle->Des();
   738                     StringLoader::Format(ptr, formatString, 0, monthPtr);
   763                     StringLoader::Format(ptr, formatString, 0, monthPtr);
   739                     StringLoader::Format(ptr2, ptr, 1, yearTitle);
   764                     StringLoader::Format(ptr2, ptr, KDateFormat1, yearTitle);
   740                     
   765                     
   741 
   766 
   742                     aResponse->SetTextValueL(attr, *title);  
   767                     aResponse->SetTextValueL(attr, *title);  
   743                     CleanupStack::PopAndDestroy(title); 
   768                     CleanupStack::PopAndDestroy(title); 
   744                     CleanupStack::PopAndDestroy(title1); 
   769                     CleanupStack::PopAndDestroy(title1);