|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Encapsulates the data which populates the fields in the message |
|
16 * info dialogs (email, sms, bios, mms), also holds the text for the |
|
17 * labels and fields in the message info dialog and displays a message |
|
18 * info dialog for particular message types |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include "muiumsginfo.h" |
|
26 #include "muiumsginfo.hrh" |
|
27 #include <badesca.h> |
|
28 #include <muiu.rsg> |
|
29 #include <aknutils.h> // AknLayoutUtils::FontFromId |
|
30 #include <aknlayout.lag> // AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_2(0) |
|
31 #include <AknLayoutDef.h> // TAknTextLineLayout |
|
32 #include <AknBidiTextUtils.h> // ConvertToVisualAndWrapToArrayL |
|
33 #include <AknPhoneNumberGrouping.h> // CAknPhoneNumberGrouping |
|
34 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR |
|
35 #include <AknAppUi.h> // iAvkonAppUi |
|
36 |
|
37 // CONSTANTS |
|
38 const TInt KWhitespaceBuffer = 1; |
|
39 const TInt KLoopStartingIndex = 0; |
|
40 const TInt KMaxCharsInLine = 50; // needs to be longer than the max possible chars that could be in a line in the dialog |
|
41 const TInt KMuiuArrayGranularity = 4; |
|
42 const TInt KInfoArrayGranularity = 8; |
|
43 const TInt KNumOfReplaceChars = 3; // for subject field whitebox removal |
|
44 const TInt KMessageTypeLines = 4; // specified max lines for message type field |
|
45 const TInt KLineFeed = 0x0000000a; // unicode representation for linefeed. |
|
46 const TInt KExtraPixels = 2; // Extra pixels for label field (Value from AVKON LAF document) |
|
47 const TInt KItemCount = 0; // Magic |
|
48 const TInt KTitleVisible = 1; // Known value ( we always have title in message info) |
|
49 const TInt KDateSize = 30; // Size of Date and Time strings in Message info |
|
50 |
|
51 _LIT( KDirAndMuiuResFileName,"muiu.rsc" ); |
|
52 _LIT(KWhitespace, " "); //must be just one char |
|
53 _LIT(KNullString, ""); |
|
54 |
|
55 |
|
56 // ============================ MEMBER FUNCTIONS =============================== |
|
57 |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // CMsgInfoLabelAndTextArray::~CMsgInfoLabelAndTextArray |
|
61 // --------------------------------------------------------- |
|
62 // |
|
63 CMsgInfoLabelAndTextArray::~CMsgInfoLabelAndTextArray() |
|
64 { |
|
65 delete iLabels; |
|
66 delete iTextFields; |
|
67 delete iLine; |
|
68 iFont = NULL; |
|
69 iLabelFont = NULL; |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // CMsgInfoLabelAndTextArray::NewL |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 CMsgInfoLabelAndTextArray* CMsgInfoLabelAndTextArray::NewL() |
|
78 { |
|
79 CMsgInfoLabelAndTextArray* self = new( ELeave ) CMsgInfoLabelAndTextArray; |
|
80 CleanupStack::PushL( self ); |
|
81 self->ConstructL(); |
|
82 CleanupStack::Pop(); //self |
|
83 return self; |
|
84 } |
|
85 |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // CMsgInfoLabelAndTextArray::CMsgInfoLabelAndTextArray |
|
89 // --------------------------------------------------------- |
|
90 // |
|
91 CMsgInfoLabelAndTextArray::CMsgInfoLabelAndTextArray() : iEnv( *CEikonEnv::Static() ) |
|
92 { |
|
93 TAknTextLineLayout layout( AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_2(0) ); |
|
94 iFont = AknLayoutUtils::FontFromId( layout.FontId() ); |
|
95 TAknTextLineLayout labelLayout( AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_1 ); |
|
96 iLabelFont = AknLayoutUtils::FontFromId( labelLayout.FontId() ); |
|
97 } |
|
98 |
|
99 |
|
100 // --------------------------------------------------------- |
|
101 // CMsgInfoLabelAndTextArray::ConstructL |
|
102 // --------------------------------------------------------- |
|
103 // |
|
104 void CMsgInfoLabelAndTextArray::ConstructL() |
|
105 { |
|
106 iLabels = new(ELeave)CDesCArrayFlat( KInfoArrayGranularity ); |
|
107 iTextFields = new(ELeave)CDesCArrayFlat( KInfoArrayGranularity ); |
|
108 iLine = HBufC::NewL( KMaxCharsInLine) ; |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------- |
|
113 // CMsgInfoLabelAndTextArray::AddLabelAndTextL |
|
114 // Add label text (identified by resource id) and the corresponding |
|
115 // field text to the array structure - may need to add multiple lines |
|
116 // if the label text is long and aWrap is set to ETrue - this is done |
|
117 // by making AddWrapLineToArrayL recursive |
|
118 // --------------------------------------------------------- |
|
119 // |
|
120 void CMsgInfoLabelAndTextArray::AddLabelAndTextL(TInt aLabelResourceId, const TPtrC& aFieldText, TBool aWrap) |
|
121 { |
|
122 HBufC* labelText = iEnv.AllocReadResourceLC( aLabelResourceId ); |
|
123 HBufC* visualConvertedLabelStr = NULL; |
|
124 visualConvertedLabelStr = ConstructVisualConvertedStringLC( labelText->Des() ); |
|
125 |
|
126 if( aLabelResourceId == R_MESSAGE_INFO_TYPE_LABEL ) |
|
127 { |
|
128 AddFixedLinesWrapMessageTypeToArrayL( aFieldText, *visualConvertedLabelStr, KMessageTypeLines ); |
|
129 } |
|
130 else if ( aWrap ) |
|
131 { |
|
132 AddWrapMessageTypeToArrayL( aFieldText, *visualConvertedLabelStr ); |
|
133 } |
|
134 else |
|
135 { |
|
136 iLabels->AppendL( *visualConvertedLabelStr ); |
|
137 HBufC* visualConvertedFieldTextStr = NULL; |
|
138 visualConvertedFieldTextStr = ConstructVisualConvertedFieldTextStringLC( aFieldText ); |
|
139 iTextFields->AppendL( *visualConvertedFieldTextStr ); |
|
140 CleanupStack::PopAndDestroy( ); |
|
141 } |
|
142 CleanupStack::PopAndDestroy( 2 ); //labelText, visualConvertedLabelStr |
|
143 } |
|
144 |
|
145 |
|
146 // --------------------------------------------------------- |
|
147 // CMsgInfoLabelAndTextArray::MdcaCount |
|
148 // |
|
149 // Return the total number of message info lines |
|
150 // |
|
151 // --------------------------------------------------------- |
|
152 // |
|
153 TInt CMsgInfoLabelAndTextArray::MdcaCount() const |
|
154 { |
|
155 return ( iLabels->Count() ); |
|
156 } |
|
157 |
|
158 |
|
159 // --------------------------------------------------------- |
|
160 // CMsgInfoLabelAndTextArray::MdcaPoint |
|
161 // |
|
162 // Return the message info line (label and text separated by a delimiter) |
|
163 // according to the index |
|
164 // --------------------------------------------------------- |
|
165 // |
|
166 TPtrC CMsgInfoLabelAndTextArray::MdcaPoint( TInt aIndex ) const |
|
167 { |
|
168 TPtr ptr = iLine->Des(); |
|
169 |
|
170 ptr.Zero(); |
|
171 ptr.Append( ( *iLabels )[aIndex] ); |
|
172 ptr.Append( KColumnListSeparator ); |
|
173 ptr.Append( ( *iTextFields )[aIndex] ); |
|
174 return ptr; |
|
175 } |
|
176 |
|
177 |
|
178 // --------------------------------------------------------- |
|
179 // CMsgInfoLabelAndTextArray::AddFixedLinesWrapMessageTypeToArrayL |
|
180 // Add label text and field text into info message array structure. |
|
181 // Field text has max number of lines which is passed in parameter aMaxLines. |
|
182 // If field text doesn't fit to these lines so text is truncated and added '...' to end. |
|
183 // --------------------------------------------------------- |
|
184 // |
|
185 void CMsgInfoLabelAndTextArray::AddFixedLinesWrapMessageTypeToArrayL( const TDesC& aField, |
|
186 const TDesC& aLabel, |
|
187 TInt aMaxLines ) |
|
188 { |
|
189 const TInt KPixelLineWidth( LineMaxWidthInPixels( ETrue ) ); |
|
190 HBufC* string = 0; |
|
191 |
|
192 if( aField.Length() ) |
|
193 { |
|
194 string = aField.AllocLC(); |
|
195 } |
|
196 else |
|
197 { |
|
198 string = HBufC::NewLC( KWhitespaceBuffer ); |
|
199 string->Des().Append( KWhitespace ); |
|
200 } |
|
201 |
|
202 CArrayFix<TInt>* widthArray = new ( ELeave ) CArrayFixFlat<TInt>( KMuiuArrayGranularity ); |
|
203 CleanupStack::PushL( widthArray ); |
|
204 widthArray->AppendL( KPixelLineWidth, aMaxLines ); |
|
205 CArrayFix<TPtrC>* wrappedArray = new ( ELeave ) CArrayFixFlat<TPtrC>( KMuiuArrayGranularity ); |
|
206 CleanupStack::PushL( wrappedArray ); |
|
207 |
|
208 HBufC* convertBuff; |
|
209 if( ( string->Des().MaxLength() - string->Des().Length() ) < |
|
210 ( widthArray->Count() * KAknBidiExtraSpacePerLine ) ) |
|
211 { |
|
212 convertBuff = HBufC::NewLC( widthArray->Count() * KAknBidiExtraSpacePerLine + string->Des().Length() ); |
|
213 } |
|
214 else |
|
215 { |
|
216 convertBuff = HBufC::NewLC( string->Des().MaxLength()); |
|
217 } |
|
218 |
|
219 TPtr strPtr = convertBuff->Des(); |
|
220 strPtr.Copy( *string ); |
|
221 AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( strPtr, *widthArray, *iFont, *wrappedArray, ETrue ); |
|
222 |
|
223 const TInt lines = wrappedArray->Count(); |
|
224 for ( TInt loop = KLoopStartingIndex; loop < lines; loop++ ) |
|
225 { |
|
226 if ( loop == KLoopStartingIndex ) |
|
227 { |
|
228 iLabels->AppendL( aLabel ); |
|
229 } |
|
230 else |
|
231 { |
|
232 iLabels->AppendL( KWhitespace ); |
|
233 } |
|
234 iTextFields->AppendL( ( *wrappedArray )[loop]); |
|
235 } |
|
236 |
|
237 CleanupStack::PopAndDestroy( 4 ); //convertBuff, wrappedArray, widthArray, string |
|
238 } |
|
239 |
|
240 |
|
241 // --------------------------------------------------------- |
|
242 // CMsgInfoLabelAndTextArray::AddWrapMessageTypeToArrayL |
|
243 // Add label text and field text into info message array structure. |
|
244 // If field text doesn't fit to one line then wraps text to lines so that all |
|
245 // text is shown. |
|
246 // --------------------------------------------------------- |
|
247 // |
|
248 void CMsgInfoLabelAndTextArray::AddWrapMessageTypeToArrayL( const TDesC& aField, const TDesC& aLabel ) |
|
249 { |
|
250 const TInt KPixelLineWidth( LineMaxWidthInPixels( ETrue ) ); |
|
251 HBufC* string = 0; |
|
252 |
|
253 if( aField.Length() ) |
|
254 { |
|
255 string = aField.AllocLC(); |
|
256 } |
|
257 else |
|
258 { |
|
259 string = HBufC::NewLC( KWhitespaceBuffer ); |
|
260 string->Des().Append( KWhitespace ); |
|
261 } |
|
262 |
|
263 CArrayFix<TPtrC>* wrappedArray = new ( ELeave ) CArrayFixFlat<TPtrC>( KMuiuArrayGranularity ); |
|
264 CleanupStack::PushL( wrappedArray ); |
|
265 HBufC* visual = AknBidiTextUtils::ConvertToVisualAndWrapToArrayL(*string, KPixelLineWidth, *iFont, *wrappedArray); |
|
266 CleanupStack::PushL( visual ); |
|
267 const TInt lines = wrappedArray->Count(); |
|
268 for ( TInt loop = KLoopStartingIndex; loop < lines; loop++ ) |
|
269 { |
|
270 if ( loop == KLoopStartingIndex ) |
|
271 { |
|
272 iLabels->AppendL(aLabel); |
|
273 } |
|
274 else |
|
275 { |
|
276 iLabels->AppendL( KWhitespace ); |
|
277 } |
|
278 iTextFields->AppendL( ( *wrappedArray )[loop]); |
|
279 } |
|
280 |
|
281 CleanupStack::PopAndDestroy( 3 ); //visual, wrappedArray, string |
|
282 } |
|
283 |
|
284 |
|
285 // --------------------------------------------------------- |
|
286 // CMsgInfoLabelAndTextArray::ConstructVisualConvertedStringLC |
|
287 // |
|
288 // Convert string in parameter "aLabelString" to visual order |
|
289 // and clips it if necessary and return this visual |
|
290 // converted string. |
|
291 // |
|
292 // --------------------------------------------------------- |
|
293 // |
|
294 HBufC* CMsgInfoLabelAndTextArray::ConstructVisualConvertedStringLC( const TDesC& aLabelString ) const |
|
295 { |
|
296 HBufC* convertedLabelStr = NULL; |
|
297 |
|
298 if( aLabelString.Length() ) |
|
299 { |
|
300 convertedLabelStr = HBufC::NewLC( aLabelString.Length() + KAknBidiExtraSpacePerLine ); |
|
301 convertedLabelStr->Des().Copy( aLabelString ); |
|
302 } |
|
303 else |
|
304 { |
|
305 convertedLabelStr = HBufC::NewLC( KWhitespaceBuffer + KAknBidiExtraSpacePerLine ); |
|
306 convertedLabelStr->Des().Copy( KWhitespace ); |
|
307 } |
|
308 const TInt KMaxWidthInPixels( LineMaxWidthInPixels( EFalse ) ); |
|
309 const TInt KMaxClippedWidthInPixels = KMaxWidthInPixels + KExtraPixels; |
|
310 |
|
311 TPtr convLabelStrPtr = convertedLabelStr->Des(); |
|
312 AknBidiTextUtils::ConvertToVisualAndClipL( convLabelStrPtr, *iLabelFont , KMaxWidthInPixels, KMaxClippedWidthInPixels ); |
|
313 return convertedLabelStr; |
|
314 } |
|
315 |
|
316 |
|
317 |
|
318 // --------------------------------------------------------- |
|
319 // CMsgInfoLabelAndTextArray::ConstructVisualConvertedFieldTextStringLC |
|
320 // |
|
321 // Convert string in parameter "aFieldTextString" to visual order |
|
322 // and clips it if necessary and return this visual |
|
323 // converted string. |
|
324 // |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 HBufC* CMsgInfoLabelAndTextArray::ConstructVisualConvertedFieldTextStringLC( const TDesC& aFieldTextString ) const |
|
328 { |
|
329 HBufC* convertedFieldTextStr = NULL; |
|
330 |
|
331 if( aFieldTextString.Length() ) |
|
332 { |
|
333 convertedFieldTextStr = HBufC::NewLC( aFieldTextString.Length() + KAknBidiExtraSpacePerLine ); |
|
334 convertedFieldTextStr->Des().Copy( aFieldTextString ); |
|
335 } |
|
336 else |
|
337 { |
|
338 convertedFieldTextStr = HBufC::NewLC( KWhitespaceBuffer + KAknBidiExtraSpacePerLine ); |
|
339 convertedFieldTextStr->Des().Copy( KWhitespace ); |
|
340 } |
|
341 const TInt KMaxWidthInPixels( LineMaxWidthInPixels( ETrue ) ); |
|
342 TPtr convFieldTextStrPtr = convertedFieldTextStr->Des(); |
|
343 AknBidiTextUtils::ConvertToVisualAndClipL( convFieldTextStrPtr, *iFont, KMaxWidthInPixels, KMaxWidthInPixels ); |
|
344 return convertedFieldTextStr; |
|
345 } |
|
346 |
|
347 |
|
348 // --------------------------------------------------------- |
|
349 // MsgInfoLabelAndTextArray::LineMaxWidthInPixels |
|
350 // |
|
351 // Return line max width in pixels in LAF situations: |
|
352 // AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_2(0) and |
|
353 // AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_1. |
|
354 // If parameter aLine2Pixels is true then return line max width in pixels |
|
355 // in LAF situation: AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_2(0) |
|
356 // If parameter aLine2Pixels is false then return line max width in pixels |
|
357 // in LAF situation: AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_1 |
|
358 // Because screen size can vary then also max line width in pixels can vary and |
|
359 // this function is used in this situation. |
|
360 // --------------------------------------------------------- |
|
361 // |
|
362 TInt CMsgInfoLabelAndTextArray::LineMaxWidthInPixels( TBool aLine2Pixels ) const |
|
363 { |
|
364 TRect main_pane = iAvkonAppUi->ClientRect(); |
|
365 |
|
366 TAknLayoutRect popup_menu_graphic_window; |
|
367 popup_menu_graphic_window.LayoutRect( main_pane, AknLayout::popup_menu_graphic_window( KItemCount ) ); |
|
368 |
|
369 TAknLayoutRect menu_heading_pane; |
|
370 menu_heading_pane.LayoutRect( popup_menu_graphic_window.Rect() , AknLayout::list_menu_heading_pane( KTitleVisible, KItemCount ) ); |
|
371 |
|
372 TAknLayoutRect list_item; |
|
373 list_item.LayoutRect( menu_heading_pane.Rect() , AknLayout::list_single_heading_popup_menu_pane( KItemCount ) ); |
|
374 |
|
375 TAknLayoutText text; |
|
376 if( aLine2Pixels ) |
|
377 { |
|
378 text.LayoutText( list_item.Rect(), AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_2( 0 ) ); |
|
379 } |
|
380 else |
|
381 { |
|
382 text.LayoutText( list_item.Rect(), AKN_LAYOUT_TEXT_List_pane_texts__menu_single_heading__Line_1 ); |
|
383 } |
|
384 return text.TextRect().Width(); |
|
385 } |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 //////////////////////////////////////////////////////////////////////////////////// |
|
391 |
|
392 |
|
393 // --------------------------------------------------------- |
|
394 // CMsgInfoMessageInfoDialog::~CMsgInfoMessageInfoDialog |
|
395 // --------------------------------------------------------- |
|
396 // |
|
397 CMsgInfoMessageInfoDialog::~CMsgInfoMessageInfoDialog() |
|
398 { |
|
399 iResources.Close(); |
|
400 delete iListBox; |
|
401 } |
|
402 |
|
403 |
|
404 // --------------------------------------------------------- |
|
405 // CMsgInfoMessageInfoDialog::CMsgInfoMessageInfoDialog |
|
406 // --------------------------------------------------------- |
|
407 // |
|
408 CMsgInfoMessageInfoDialog::CMsgInfoMessageInfoDialog() : iResources( *CEikonEnv::Static() ) |
|
409 {} |
|
410 |
|
411 |
|
412 // --------------------------------------------------------- |
|
413 // CMsgInfoMessageInfoDialog::ConstructL |
|
414 // --------------------------------------------------------- |
|
415 // |
|
416 void CMsgInfoMessageInfoDialog::ConstructL() |
|
417 { |
|
418 TParse parse; |
|
419 parse.Set( KDirAndMuiuResFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
420 TFileName fileName( parse.FullName() ); |
|
421 iResources.OpenL( fileName ); |
|
422 iListBox = new( ELeave )CAknSingleHeadingPopupMenuStyleListBox; |
|
423 } |
|
424 |
|
425 |
|
426 // --------------------------------------------------------- |
|
427 // CMsgInfoMessageInfoDialog::NewL |
|
428 // --------------------------------------------------------- |
|
429 // |
|
430 EXPORT_C CMsgInfoMessageInfoDialog* CMsgInfoMessageInfoDialog::NewL() |
|
431 { |
|
432 CMsgInfoMessageInfoDialog* self = new( ELeave ) CMsgInfoMessageInfoDialog; |
|
433 CleanupStack::PushL( self ); |
|
434 self->ConstructL(); |
|
435 CleanupStack::Pop(); //self |
|
436 return self; |
|
437 } |
|
438 |
|
439 |
|
440 // --------------------------------------------------------- |
|
441 // CMsgInfoMessageInfoDialog::ExecuteLD |
|
442 // Show the message info dialog. |
|
443 // --------------------------------------------------------- |
|
444 // |
|
445 EXPORT_C void CMsgInfoMessageInfoDialog::ExecuteLD( TMsgInfoMessageInfoData& aFieldData, TMessageInfoType aMessageType) |
|
446 { |
|
447 TMsgInfoMessageInfoData convertedFieldData; |
|
448 |
|
449 CleanupStack::PushL( this ); |
|
450 |
|
451 iMessageType = aMessageType; |
|
452 |
|
453 |
|
454 // Note: Lanquage specific number conversion done here. |
|
455 // This way dialog seem to open faster. (Number conversion and memory allocation take time) |
|
456 |
|
457 //From ---------------------------------------------------------------------- |
|
458 HBufC* tmpFromString = CAknPhoneNumberGrouping::CreateGroupedPhoneNumberL( aFieldData.iFrom ); |
|
459 CleanupStack::PushL( tmpFromString ); |
|
460 DoNumberConversionL( tmpFromString, convertedFieldData.iFrom ); |
|
461 |
|
462 //Subject ---------------------------------------------------------------------- |
|
463 HBufC* tmpSubjectString = aFieldData.iSubject.AllocLC(); |
|
464 TPtr tmpSubjecPtr = tmpSubjectString->Des(); |
|
465 TBuf<KNumOfReplaceChars> replaceChars; |
|
466 replaceChars.Zero(); |
|
467 replaceChars.Append( CEditableText::EParagraphDelimiter ); |
|
468 replaceChars.Append( CEditableText::ETabCharacter ); |
|
469 replaceChars.Append( KLineFeed ); |
|
470 AknTextUtils::ReplaceCharacters( |
|
471 tmpSubjecPtr, |
|
472 replaceChars, |
|
473 CEditableText::ESpace ); |
|
474 if ( tmpSubjecPtr.Length() > 0 ) |
|
475 { |
|
476 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( tmpSubjecPtr ); |
|
477 } |
|
478 convertedFieldData.iSubject.Set( tmpSubjecPtr ); |
|
479 |
|
480 //Callback ---------------------------------------------------------------------- |
|
481 HBufC* tmpCallbackString = CAknPhoneNumberGrouping::CreateGroupedPhoneNumberL( aFieldData.iCallback ); |
|
482 CleanupStack::PushL( tmpCallbackString ); |
|
483 DoNumberConversionL( tmpCallbackString, convertedFieldData.iCallback ); |
|
484 |
|
485 //Status ---------------------------------------------------------------------- |
|
486 HBufC* tmpStatusString = aFieldData.iStatus.AllocLC(); |
|
487 TPtr tmpStatusPtr = tmpStatusString->Des(); |
|
488 convertedFieldData.iStatus.Set( tmpStatusPtr ); |
|
489 |
|
490 // Priority ------------------------------------------------------------------ |
|
491 HBufC* tmpPriorityString = aFieldData.iPriority.AllocLC(); |
|
492 TPtr tmpPriorityPtr = tmpPriorityString->Des(); |
|
493 convertedFieldData.iPriority.Set( tmpPriorityPtr ); |
|
494 |
|
495 //Type ---------------------------------------------------------------------- |
|
496 HBufC* tmpTypeString = aFieldData.iType.AllocLC(); |
|
497 DoNumberConversionL( tmpTypeString, convertedFieldData.iType ); |
|
498 |
|
499 //Size ---------------------------------------------------------------------- |
|
500 HBufC* tmpSizeString = aFieldData.iSize.AllocLC(); |
|
501 DoNumberConversionL( tmpSizeString, convertedFieldData.iSize ); |
|
502 |
|
503 //To---------------------------------------------------------------------- |
|
504 HBufC* tmpToString = CAknPhoneNumberGrouping::CreateGroupedPhoneNumberL( aFieldData.iTo ); |
|
505 CleanupStack::PushL( tmpToString ); |
|
506 DoNumberConversionL( tmpToString, convertedFieldData.iTo ); |
|
507 |
|
508 //CC---------------------------------------------------------------------- |
|
509 HBufC* tmpCCString = CAknPhoneNumberGrouping::CreateGroupedPhoneNumberL( aFieldData.iCC ); |
|
510 CleanupStack::PushL( tmpCCString ); |
|
511 DoNumberConversionL( tmpCCString, convertedFieldData.iCC ); |
|
512 |
|
513 //BCC---------------------------------------------------------------------- |
|
514 HBufC* tmpBCCString = CAknPhoneNumberGrouping::CreateGroupedPhoneNumberL( aFieldData.iBCC ); |
|
515 CleanupStack::PushL( tmpBCCString ); |
|
516 DoNumberConversionL( tmpBCCString, convertedFieldData.iBCC ); |
|
517 |
|
518 CAknPopupList* popupList = CAknPopupList::NewL( iListBox, R_AVKON_SOFTKEYS_OK_EMPTY, AknPopupLayouts::EMenuGraphicHeadingWindow ); |
|
519 CleanupStack::PushL( popupList ); |
|
520 |
|
521 TInt flags = EAknListBoxViewerFlags; |
|
522 iListBox->ConstructL( popupList, flags ); |
|
523 iListBox->CreateScrollBarFrameL( ETrue ); |
|
524 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
525 |
|
526 convertedFieldData.iDateTime = aFieldData.iDateTime; |
|
527 SetInfoArrayL( convertedFieldData ); |
|
528 SetTitleL( popupList ); |
|
529 |
|
530 CleanupStack::Pop(); //popupList |
|
531 popupList->ExecuteLD(); |
|
532 CleanupStack::PopAndDestroy( 10 ); //tmpFromString, tmpSubjectString, tmpBCCString, |
|
533 // tmpTypeString, tmpSizeString, tmpToString, tmpCCString, tmpCallbackString, tmpPriorityString |
|
534 // tmpStatusString |
|
535 CleanupStack::Pop(); //this |
|
536 delete this; |
|
537 } |
|
538 |
|
539 |
|
540 // --------------------------------------------------------- |
|
541 // CMsgInfoMessageInfoDialog::SetInfoArrayL |
|
542 // Construct the array of labels and text fields and add it to the listbox model |
|
543 // --------------------------------------------------------- |
|
544 // |
|
545 void CMsgInfoMessageInfoDialog::SetInfoArrayL( TMsgInfoMessageInfoData& aFieldData ) |
|
546 { |
|
547 TBuf<KDateSize> dateString; |
|
548 TBuf<KDateSize> timeString; |
|
549 TPtrC dateStr; |
|
550 TPtrC timeStr; |
|
551 |
|
552 CMsgInfoLabelAndTextArray* infoArray = CMsgInfoLabelAndTextArray::NewL(); |
|
553 CleanupStack::PushL( infoArray ); |
|
554 |
|
555 //From ----------------------------------------------------------- |
|
556 switch( iMessageType ) |
|
557 { |
|
558 case EEmailViewer: |
|
559 case ESmsViewer: |
|
560 case EBiosViewer: |
|
561 case EMmsViewer: |
|
562 //deliberate fall through |
|
563 if( aFieldData.iFrom.Length() ) |
|
564 { |
|
565 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_FROM_LABEL, aFieldData.iFrom ); |
|
566 } |
|
567 break; |
|
568 default: |
|
569 break; |
|
570 }; |
|
571 |
|
572 |
|
573 //Subject -------------------------------------------------- |
|
574 switch(iMessageType) |
|
575 { |
|
576 case ESmsEditor: |
|
577 case ESmsViewer: |
|
578 case EBiosEditor: |
|
579 case EBiosViewer: |
|
580 //deliberate fall through - no wrap for sms subject |
|
581 if( aFieldData.iSubject.Length() ) |
|
582 { |
|
583 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_SUBJECT_LABEL, aFieldData.iSubject, EFalse ); |
|
584 } |
|
585 break; |
|
586 default: |
|
587 if( aFieldData.iSubject.Length() ) |
|
588 { |
|
589 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_SUBJECT_LABEL, aFieldData.iSubject ); |
|
590 } |
|
591 break; |
|
592 }; |
|
593 |
|
594 //Callback ------------------------------------------------------------------ |
|
595 // CDMA only |
|
596 switch( iMessageType ) |
|
597 { |
|
598 case ESmsEditor: |
|
599 case ESmsViewer: |
|
600 infoArray->AddLabelAndTextL(R_MESSAGE_INFO_CALLBACK_LABEL,aFieldData.iCallback); |
|
601 break; |
|
602 default: |
|
603 break; |
|
604 }; |
|
605 |
|
606 //Status ---------------------------------------------------------------------- |
|
607 //Only for CDMA MO messages |
|
608 // |
|
609 switch( iMessageType ) |
|
610 { |
|
611 case ESmsEditor: |
|
612 //deliberate fall through - no wrap for sms subject |
|
613 infoArray->AddLabelAndTextL(R_MESSAGE_INFO_STATUS_LABEL,aFieldData.iStatus,EFalse); |
|
614 break; |
|
615 default: |
|
616 break; |
|
617 }; |
|
618 |
|
619 //Priority ---------------------------------------------------------------------- |
|
620 switch( iMessageType ) |
|
621 { |
|
622 case ESmsEditor: |
|
623 case ESmsViewer: |
|
624 infoArray->AddLabelAndTextL(R_MESSAGE_INFO_PRIORITY_LABEL,aFieldData.iPriority,EFalse); |
|
625 break; |
|
626 default: |
|
627 break; |
|
628 }; |
|
629 |
|
630 //Date and Time ------------------------------------------------------------- |
|
631 |
|
632 GetFormattedTimeAndDateStringsL( aFieldData.iDateTime, dateString, timeString ); |
|
633 HBufC* tmpDateString = dateString.AllocLC(); |
|
634 DoNumberConversionL( tmpDateString, dateStr ); |
|
635 HBufC* tmpTimeString = timeString.AllocLC(); |
|
636 DoNumberConversionL( tmpTimeString, timeStr ); |
|
637 |
|
638 //Date ------------------------------------------------------------------ |
|
639 if( dateStr.Length() ) |
|
640 { |
|
641 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_DATE_LABEL, dateStr ); |
|
642 } |
|
643 |
|
644 //Time ------------------------------------------------------------------ |
|
645 if( timeStr.Length() ) |
|
646 { |
|
647 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_TIME_LABEL, timeStr ); |
|
648 } |
|
649 |
|
650 CleanupStack::PopAndDestroy( 2 ); //tmpDateString, tmpTimeString |
|
651 |
|
652 |
|
653 //Type ---------------------------------------------------------------------- |
|
654 if( aFieldData.iType.Length() ) |
|
655 { |
|
656 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_TYPE_LABEL, aFieldData.iType ); |
|
657 } |
|
658 |
|
659 |
|
660 //Size ---------------------------------------------------------------------- |
|
661 switch( iMessageType ) |
|
662 { |
|
663 case EEmailViewer: |
|
664 case EEmailEditor: |
|
665 case EMmsViewer: |
|
666 case EMmsEditor: |
|
667 //deliberate fall through |
|
668 if( aFieldData.iSize.Length() ) |
|
669 { |
|
670 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_SIZE_LABEL, aFieldData.iSize ); |
|
671 } |
|
672 break; |
|
673 default: |
|
674 break; |
|
675 }; |
|
676 |
|
677 |
|
678 //To ---------------------------------------------------------------------- |
|
679 switch( iMessageType ) |
|
680 { |
|
681 case ESmsViewer: |
|
682 case EBiosViewer: |
|
683 //deliberate fall through |
|
684 break; |
|
685 case EEmailEditor: |
|
686 case ESmsEditor: |
|
687 case EBiosEditor: |
|
688 case EMmsViewer: |
|
689 case EMmsEditor: |
|
690 //deliberate fall through |
|
691 //All editors and mms viewer show always "To" label is "aFieldData.iTo" empty or not |
|
692 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_TO_LABEL, aFieldData.iTo ); |
|
693 break; |
|
694 default: |
|
695 if( aFieldData.iTo.Length() ) |
|
696 { |
|
697 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_TO_LABEL, aFieldData.iTo ); |
|
698 } |
|
699 break; |
|
700 }; |
|
701 |
|
702 //Cc ---------------------------------------------------------------------- |
|
703 switch( iMessageType ) |
|
704 { |
|
705 case EEmailViewer: |
|
706 case EEmailEditor: |
|
707 case EMmsViewer: |
|
708 case EMmsEditor: |
|
709 //deliberate fall through |
|
710 if( aFieldData.iCC.Length() ) |
|
711 { |
|
712 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_CC_LABEL, aFieldData.iCC ); |
|
713 } |
|
714 break; |
|
715 default: |
|
716 break; |
|
717 }; |
|
718 |
|
719 //Bcc ---------------------------------------------------------------------- |
|
720 switch( iMessageType ) |
|
721 { |
|
722 case EEmailViewer: |
|
723 case EEmailEditor: |
|
724 case EMmsEditor: |
|
725 //deliberate fall through |
|
726 if( aFieldData.iBCC.Length() ) |
|
727 { |
|
728 infoArray->AddLabelAndTextL( R_MESSAGE_INFO_BCC_LABEL, aFieldData.iBCC ); |
|
729 } |
|
730 break; |
|
731 default: |
|
732 break; |
|
733 }; |
|
734 |
|
735 |
|
736 // ------------------------------------------------------------------------- |
|
737 |
|
738 CleanupStack::Pop(); //infoArray |
|
739 iListBox->UseLogicalToVisualConversion(EFalse); |
|
740 iListBox->Model()->SetItemTextArray( infoArray ); //owns the array |
|
741 } |
|
742 |
|
743 |
|
744 // --------------------------------------------------------- |
|
745 // CMsgInfoMessageInfoDialog::SetTitleL |
|
746 // Set up the title. |
|
747 // --------------------------------------------------------- |
|
748 // |
|
749 void CMsgInfoMessageInfoDialog::SetTitleL( CAknPopupList* aPopupList ) const |
|
750 { |
|
751 if( aPopupList != NULL) |
|
752 { |
|
753 HBufC* title = CEikonEnv::Static()->AllocReadResourceLC( R_MESSAGE_INFO_TITLE ); |
|
754 aPopupList->SetTitleL( *title ); |
|
755 CleanupStack::PopAndDestroy(); //title |
|
756 } |
|
757 } |
|
758 |
|
759 |
|
760 // --------------------------------------------------------- |
|
761 // Convert between arabic-indic digits and european digits based on existing language setting. |
|
762 // So it'll convert any digit from the string |
|
763 // to use either european digits or arabic-indic digits based on current settings. |
|
764 // @param aFieldString: Data buffer used in conversion. |
|
765 // @param aFieldData: Return converted data in this parameter. |
|
766 // --------------------------------------------------------- |
|
767 // |
|
768 void CMsgInfoMessageInfoDialog::DoNumberConversionL( HBufC* aFieldString, TPtrC& aFieldData ) const |
|
769 { |
|
770 if( aFieldString != NULL) |
|
771 { |
|
772 TPtr tmpPtr = aFieldString->Des(); |
|
773 if ( tmpPtr.Length() > 0 ) |
|
774 { |
|
775 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( tmpPtr ); |
|
776 } |
|
777 aFieldData.Set( tmpPtr ); |
|
778 } |
|
779 else |
|
780 { |
|
781 aFieldData.Set(KNullString); |
|
782 } |
|
783 } |
|
784 |
|
785 |
|
786 // --------------------------------------------------------- |
|
787 // Creates formatted date and time strings and return these strings in parameters |
|
788 // aDateBuf and aTimeBuf. Function get UTC time in parameter aUTCtime and |
|
789 // constructs date and time strings with this UTC time value. |
|
790 // @param aUTCtime: UTC time used in time conversion. |
|
791 // @param aDateBuf: Return date string after time conversion. |
|
792 // @param aTimeBuf: Return time string after time conversion. |
|
793 // |
|
794 // --------------------------------------------------------- |
|
795 // |
|
796 void CMsgInfoMessageInfoDialog::GetFormattedTimeAndDateStringsL( TTime& aUTCtime, |
|
797 TDes& aDateBuf, |
|
798 TDes& aTimeBuf ) |
|
799 { |
|
800 TLocale locale; |
|
801 |
|
802 // If home daylight saving in effect, add one hour offset. |
|
803 if ( locale.QueryHomeHasDaylightSavingOn() ) |
|
804 { |
|
805 TTimeIntervalHours daylightSaving( 1 ); |
|
806 aUTCtime+=daylightSaving; |
|
807 } |
|
808 |
|
809 //Set date and time |
|
810 HBufC* dateFormat = CEikonEnv::Static()->AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO );//from avkon resources |
|
811 aUTCtime.FormatL( aDateBuf, *dateFormat ); |
|
812 CleanupStack::PopAndDestroy();//dateFormat |
|
813 |
|
814 HBufC* timeFormat = CEikonEnv::Static()->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO );//from avkon resources |
|
815 aUTCtime.FormatL( aTimeBuf, *timeFormat ); |
|
816 CleanupStack::PopAndDestroy();//timeFormat |
|
817 } |
|
818 |
|
819 |
|
820 // End of file |