29 #include <AknBidiTextUtils.h> |
29 #include <AknBidiTextUtils.h> |
30 #include <CalenLunarChinesePluginData.rsg> |
30 #include <CalenLunarChinesePluginData.rsg> |
31 #include <layoutmetadata.cdl.h> |
31 #include <layoutmetadata.cdl.h> |
32 #include <mcalenpreview.h> |
32 #include <mcalenpreview.h> |
33 |
33 |
|
34 #include <AknsSkinInstance.h> |
|
35 #include <AknsUtils.h> |
|
36 #include <gulcolor.h> |
|
37 |
34 #include "calendarui_debug.h" |
38 #include "calendarui_debug.h" |
35 #include "CalenLunarChinesePlugin.h" |
39 #include "CalenLunarChinesePlugin.h" |
36 #include "calenlunarpanic.h" |
40 #include "calenlunarpanic.h" |
37 #include "calenlunarlocalizedinfo.h" |
41 #include "calenlunarlocalizedinfo.h" |
38 #include "calenlunarlocalizer.h" |
42 #include "calenlunarlocalizer.h" |
169 |
174 |
170 CArrayFixFlat<TInt>* lineWidths = new( ELeave )CArrayFixFlat<TInt>( 1 ); |
175 CArrayFixFlat<TInt>* lineWidths = new( ELeave )CArrayFixFlat<TInt>( 1 ); |
171 CleanupStack::PushL( lineWidths ); |
176 CleanupStack::PushL( lineWidths ); |
172 |
177 |
173 TInt maxWidth = aRect.Size().iWidth; |
178 TInt maxWidth = aRect.Size().iWidth; |
174 lineWidths->AppendL( maxWidth ); |
179 lineWidths->AppendL(maxWidth); |
175 |
180 |
176 const CFont* fontLabel = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL); |
181 const CFont* fontLabel = AknLayoutUtils::FontFromId( |
177 |
182 EAknLogicalFontPrimarySmallFont, NULL); |
178 HBufC* visualText = AknBidiTextUtils::ConvertToVisualAndWrapToArrayWholeTextL( |
183 |
179 iExtraRowText, |
184 HBufC* visualText = |
180 *lineWidths, |
185 AknBidiTextUtils::ConvertToVisualAndWrapToArrayWholeTextL( |
181 *fontLabel, |
186 iExtraRowText, *lineWidths, *fontLabel, *textLines); |
182 *textLines); |
187 |
183 |
188 if (textLines->Count() < 3 && textLines->Count() > 0) |
184 if(textLines->Count() < 3 && textLines->Count() > 0) |
189 { |
185 { |
190 TInt nH = textLines->Count(); |
186 TInt nH = textLines->Count(); |
191 aRect.iBr.iY = aRect.iBr.iY * nH; |
187 aRect.iBr.iY = aRect.iBr.iY * nH; |
192 } |
188 } |
193 |
189 |
194 HBufC* newLinedText = HBufC::NewLC(iExtraRowText.Length() + 4); |
190 HBufC* newLinedText = HBufC::NewLC( iExtraRowText.Length() + 4); |
195 |
191 |
196 for (TInt i = 0; i < textLines->Count(); i++) |
192 for(TInt i = 0 ; i < textLines->Count();i++) |
197 { |
193 { |
198 newLinedText->Des().Append(textLines->At(i)); |
194 newLinedText->Des().Append(textLines->At(i)); |
199 newLinedText->Des().Append(KFieldSeparator); |
195 newLinedText->Des().Append( KFieldSeparator ); |
200 } |
196 } |
201 |
197 |
|
198 aLabel.UseLogicalToVisualConversion(ETrue); |
202 aLabel.UseLogicalToVisualConversion(ETrue); |
199 aLabel.SetLabelAlignment(ELayoutAlignCenter); |
203 aLabel.SetLabelAlignment(ELayoutAlignCenter); |
200 aLabel.SetTextL( *newLinedText); |
204 aLabel.SetTextL( *newLinedText); |
201 |
205 |
202 CleanupStack::PopAndDestroy( newLinedText ); |
206 // Query the text colour based on the theme and update the label text |
203 CleanupStack::PopAndDestroy( lineWidths ); |
207 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
204 CleanupStack::PopAndDestroy( textLines ); |
208 TRgb color; |
|
209 TInt error = AknsUtils::GetCachedColor(skin, color, |
|
210 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); |
|
211 if (error == KErrNone) |
|
212 { |
|
213 aLabel.OverrideColorL(EColorLabelText, color); |
|
214 } |
|
215 CleanupStack::PopAndDestroy(newLinedText); |
|
216 CleanupStack::PopAndDestroy(lineWidths); |
|
217 CleanupStack::PopAndDestroy(textLines); |
205 delete visualText; |
218 delete visualText; |
206 |
219 |
207 TRACE_EXIT_POINT; |
220 TRACE_EXIT_POINT; |
208 } |
221 } |
209 |
222 |
210 // ----------------------------------------------------------------------------- |
223 // ----------------------------------------------------------------------------- |
211 // CCalenLunarChinesePlugin::SetLabelContentL |
224 // CCalenLunarChinesePlugin::SetLabelContentL |
212 // ----------------------------------------------------------------------------- |
225 // ----------------------------------------------------------------------------- |
213 // |
226 // |
214 void CCalenLunarChinesePlugin::SetLabelContentL( CEikLabel& aLabel, const TRect& /*aRect*/ ) |
227 void CCalenLunarChinesePlugin::SetLabelContentL(CEikLabel& aLabel, |
|
228 const TRect& /*aRect*/) |
215 { |
229 { |
216 TRACE_ENTRY_POINT; |
230 TRACE_ENTRY_POINT; |
217 TRect nullRect(0,0,0,0); |
231 TRect nullRect(0,0,0,0); |
218 aLabel.SetRect(nullRect); |
232 aLabel.SetRect(nullRect); |
219 |
233 |
220 FormatExtraRowStringL( aLabel, EFalse ); |
234 FormatExtraRowStringL( aLabel, EFalse ); |
221 aLabel.UseLogicalToVisualConversion(ETrue); |
235 aLabel.UseLogicalToVisualConversion(ETrue); |
222 aLabel.SetLabelAlignment(ELayoutAlignCenter); |
236 aLabel.SetLabelAlignment(ELayoutAlignCenter); |
223 aLabel.SetTextL( iExtraRowText ); |
237 aLabel.SetTextL( iExtraRowText ); |
224 |
238 |
|
239 // Query the text colour based on the theme and update the label text |
|
240 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
241 TRgb color; |
|
242 TInt error = AknsUtils::GetCachedColor(skin, color, |
|
243 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); |
|
244 if (error == KErrNone) |
|
245 { |
|
246 aLabel.OverrideColorL(EColorLabelText, color); |
|
247 } |
|
248 |
225 TRACE_EXIT_POINT; |
249 TRACE_EXIT_POINT; |
226 } |
250 } |
227 |
251 |
228 |
252 |
229 // ----------------------------------------------------------------------------- |
253 // ----------------------------------------------------------------------------- |