90 // |
90 // |
91 void CPushMessageInfoDialog::ConstructL( CMsvSession& aMsvSession, TMsvId aId ) |
91 void CPushMessageInfoDialog::ConstructL( CMsvSession& aMsvSession, TMsvId aId ) |
92 { |
92 { |
93 PUSHLOG_ENTERFN("CPushMessageInfoDialog::ConstructL"); |
93 PUSHLOG_ENTERFN("CPushMessageInfoDialog::ConstructL"); |
94 |
94 |
95 __ASSERT_DEBUG( !iListBox && |
95 __ASSERT_DEBUG( !iListBox && |
96 !iListBoxModel, |
96 !iListBoxModel, |
97 UiPanic( EPushMtmUiPanAlreadyInitialized ) ); |
97 UiPanic( EPushMtmUiPanAlreadyInitialized ) ); |
98 |
98 |
99 FeatureManager::InitializeLibL(); |
99 FeatureManager::InitializeLibL(); |
100 |
100 |
101 // Add resource file. |
101 // Add resource file. |
102 TParse* fileParser = new (ELeave) TParse; |
102 TParse* fileParser = new (ELeave) TParse; |
103 // Unnecessary to call CleanupStack::PushL( fileParser ); |
103 // Unnecessary to call CleanupStack::PushL( fileParser ); |
104 fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); |
104 fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); |
105 iResourceFile = fileParser->FullName(); |
105 iResourceFile = fileParser->FullName(); |
106 PUSHLOG_WRITE_FORMAT(" iResourceFile: <%S>",&iResourceFile); |
106 PUSHLOG_WRITE_FORMAT(" iResourceFile: <%S>",&iResourceFile); |
107 delete fileParser; |
107 delete fileParser; |
108 fileParser = NULL; |
108 fileParser = NULL; |
109 iResourceLoader.OpenL( iResourceFile ); |
109 iResourceLoader.OpenL( iResourceFile ); |
110 PUSHLOG_WRITE(" iResourceFile opened"); |
110 PUSHLOG_WRITE(" iResourceFile opened"); |
111 |
111 |
112 // Construct list box's model first |
112 // Construct list box's model first |
113 // This list box will be used by an CAknPopupList object. |
113 // This list box will be used by an CAknPopupList object. |
114 __ASSERT_DEBUG( !iListBoxModel && !iListBox, |
114 __ASSERT_DEBUG( !iListBoxModel && !iListBox, |
115 UiPanic( EPushMtmUiPanAlreadyInitialized ) ); |
115 UiPanic( EPushMtmUiPanAlreadyInitialized ) ); |
116 iListBoxModel = new (ELeave) CDesCArrayFlat( KArrayGranularity ); |
116 iListBoxModel = new (ELeave) CDesCArrayFlat( KArrayGranularity ); |
117 // Construct list box. |
117 // Construct list box. |
118 iListBox = new (ELeave) CAknSingleHeadingPopupMenuStyleListBox; |
118 iListBox = new (ELeave) CAknSingleHeadingPopupMenuStyleListBox; |
119 |
119 |
120 // ======================================================== |
120 // ======================================================== |
121 // Layout info of CAknSingleHeadingPopupMenuStyleListBox |
121 // Layout info of CAknSingleHeadingPopupMenuStyleListBox |
122 TAknTextLineLayout textLayout = |
122 TAknTextLineLayout textLayout = |
123 AknLayout::List_pane_texts__menu_single_heading__Line_2(0); |
123 AknLayout::List_pane_texts__menu_single_heading__Line_2(0); |
124 |
124 |
125 // Font of the second column of the given list box |
125 // Font of the second column of the given list box |
126 iSecondColumnFont = AknLayoutUtils::FontFromId( textLayout.FontId() ); |
126 iSecondColumnFont = AknLayoutUtils::FontFromId( textLayout.FontId() ); |
127 |
127 |
128 // Line width of the second column of the given list box |
128 // Line width of the second column of the given list box |
129 TInt itemCount = 0; // No need to set |
129 TInt itemCount = 0; // No need to set |
130 TInt titleVisible = 1; // known value (we always have title) |
130 TInt titleVisible = 1; // known value (we always have title) |
131 TRect main_pane = iAvkonAppUi->ClientRect(); |
131 TRect main_pane = iAvkonAppUi->ClientRect(); |
132 |
132 |
133 TAknLayoutRect popup_menu_graphic_window; |
133 TAknLayoutRect popup_menu_graphic_window; |
134 popup_menu_graphic_window.LayoutRect( main_pane, |
134 popup_menu_graphic_window.LayoutRect( main_pane, |
135 AknLayout::popup_menu_graphic_window(itemCount) ); |
135 AknLayout::popup_menu_graphic_window(itemCount) ); |
136 |
136 |
137 TAknLayoutRect menu_heading_pane; |
137 TAknLayoutRect menu_heading_pane; |
138 menu_heading_pane.LayoutRect( popup_menu_graphic_window.Rect(), |
138 menu_heading_pane.LayoutRect( popup_menu_graphic_window.Rect(), |
139 AknLayout::list_menu_heading_pane(titleVisible, itemCount) ); |
139 AknLayout::list_menu_heading_pane(titleVisible, itemCount) ); |
140 |
140 |
141 TAknLayoutRect list_item; |
141 TAknLayoutRect list_item; |
142 list_item.LayoutRect( menu_heading_pane.Rect(), |
142 list_item.LayoutRect( menu_heading_pane.Rect(), |
143 AknLayout::list_single_heading_popup_menu_pane(itemCount) ); |
143 AknLayout::list_single_heading_popup_menu_pane(itemCount) ); |
144 |
144 |
145 TAknLayoutText text; |
145 TAknLayoutText text; |
146 text.LayoutText( list_item.Rect(), textLayout ); |
146 text.LayoutText( list_item.Rect(), textLayout ); |
147 |
147 |
148 iSecondColumnWidth = text.TextRect().Width(); |
148 iSecondColumnWidth = text.TextRect().Width(); |
149 // ======================================================== |
149 // ======================================================== |
150 |
150 |
151 // Add items to the list. |
151 // Add items to the list. |
152 AddMessageInfoItemsL( aMsvSession, aId ); |
152 AddMessageInfoItemsL( aMsvSession, aId ); |
153 |
153 |
154 CAknPopupList::ConstructL( iListBox, |
154 CAknPopupList::ConstructL( iListBox, |
155 R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
155 R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
156 AknPopupLayouts::EMenuGraphicHeadingWindow ); |
156 AknPopupLayouts::EMenuGraphicHeadingWindow ); |
157 |
157 |
158 iListBox->ConstructL( this, EAknListBoxViewerFlags ); |
158 iListBox->ConstructL( this, EAknListBoxViewerFlags ); |
159 iListBox->CreateScrollBarFrameL( ETrue ); |
159 iListBox->CreateScrollBarFrameL( ETrue ); |
160 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL |
160 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL |
191 if ( paramTextCopyPtr.Length() > 0 ) |
191 if ( paramTextCopyPtr.Length() > 0 ) |
192 { |
192 { |
193 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( paramTextCopyPtr ); |
193 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( paramTextCopyPtr ); |
194 } |
194 } |
195 |
195 |
196 HBufC* header = ( aHeaderResourceId == KNoResource ? |
196 HBufC* header = ( aHeaderResourceId == KNoResource ? |
197 KNullDesC().AllocLC() : |
197 KNullDesC().AllocLC() : |
198 iCoeEnv->AllocReadResourceLC( aHeaderResourceId ) ); |
198 iCoeEnv->AllocReadResourceLC( aHeaderResourceId ) ); |
199 |
199 |
200 CArrayFix<TPtrC>* wrappedArray = |
200 CArrayFix<TPtrC>* wrappedArray = |
201 new ( ELeave ) CArrayFixFlat<TPtrC>( KArrayGranularity ); |
201 new ( ELeave ) CArrayFixFlat<TPtrC>( KArrayGranularity ); |
202 CleanupStack::PushL( wrappedArray ); |
202 CleanupStack::PushL( wrappedArray ); |
203 |
203 |
204 AknTextUtils::WrapToArrayL |
204 AknTextUtils::WrapToArrayL |
205 ( paramTextCopyPtr, iSecondColumnWidth, |
205 ( paramTextCopyPtr, iSecondColumnWidth, |
206 *iSecondColumnFont, *wrappedArray ); |
206 *iSecondColumnFont, *wrappedArray ); |
207 // visual is directly not used, but wrappedArray points to it |
207 // visual is directly not used, but wrappedArray points to it |
208 |
208 |
209 // Add the lines in wrappedArray to the list |
209 // Add the lines in wrappedArray to the list |
210 const TInt lines = wrappedArray->Count(); |
210 const TInt lines = wrappedArray->Count(); |
211 for ( TInt loop = 0; loop < lines; ++loop ) |
211 for ( TInt loop = 0; loop < lines; ++loop ) |
212 { |
212 { |
213 TPtrC current = ( *wrappedArray )[loop]; |
213 TPtrC current = ( *wrappedArray )[loop]; |
214 // Allocate a buffer for the new list box item text |
214 // Allocate a buffer for the new list box item text |
215 // (including header, separator and wrapped text) |
215 // (including header, separator and wrapped text) |
216 HBufC* currentFormattedLine = HBufC::NewLC |
216 HBufC* currentFormattedLine = HBufC::NewLC |
217 ( ((loop==0) ? header->Length() : /*KSpace().Length()*/1) + |
217 ( ((loop==0) ? header->Length() : /*KSpace().Length()*/1) + |
218 /*KTab().Length()*/1 + current.Length() ); |
218 /*KTab().Length()*/1 + current.Length() ); |
219 TPtr currentFormattedLinePtr = currentFormattedLine->Des(); // writeable |
219 TPtr currentFormattedLinePtr = currentFormattedLine->Des(); // writeable |
220 |
220 |
221 if ( loop == 0 ) |
221 if ( loop == 0 ) |
222 { currentFormattedLinePtr.Copy( *header ); } |
222 { currentFormattedLinePtr.Copy( *header ); } |
328 // This can be MSISDN number, URL, etc. |
328 // This can be MSISDN number, URL, etc. |
329 // ************************************************************************ |
329 // ************************************************************************ |
330 TPtrC8 from8( msg->From() ); |
330 TPtrC8 from8( msg->From() ); |
331 if ( from8.Length() ) |
331 if ( from8.Length() ) |
332 { |
332 { |
333 // Copy the 8-bit text into a 16-bit one and convert the string to |
333 // Copy the 8-bit text into a 16-bit one and convert the string to |
334 // decoded form. |
334 // decoded form. |
335 HBufC* from16 = HBufC::NewMaxLC( from8.Length() ); |
335 HBufC* from16 = HBufC::NewMaxLC( from8.Length() ); |
336 from16->Des().Copy( from8 ); |
336 from16->Des().Copy( from8 ); |
337 |
337 |
338 HBufC* convertedFrom = |
338 HBufC* convertedFrom = |
339 CPushMtmUtil::ConvertUriToDisplayFormL( *from16 ); |
339 CPushMtmUtil::ConvertUriToDisplayFormL( *from16 ); |
340 CleanupStack::PushL( convertedFrom ); |
340 CleanupStack::PushL( convertedFrom ); |
341 // |
341 // |
342 AddMessageInfoItemL( R_PUSHMID_FROM, *convertedFrom ); |
342 AddMessageInfoItemL( R_PUSHMID_FROM, *convertedFrom ); |
343 PUSHLOG_WRITE(" From added"); |
343 PUSHLOG_WRITE(" From added"); |
480 AddMessageInfoItemL( KNoResource, date ); |
480 AddMessageInfoItemL( KNoResource, date ); |
481 PUSHLOG_WRITE(" Expires added"); |
481 PUSHLOG_WRITE(" Expires added"); |
482 } |
482 } |
483 } |
483 } |
484 |
484 |
485 CleanupStack::PopAndDestroy( 2, dateFormatString ); |
485 CleanupStack::PopAndDestroy( 2, dateFormatString ); |
486 // timeFormatString, dateFormatString |
486 // timeFormatString, dateFormatString |
487 |
487 |
488 // ************************************************************************ |
488 // ************************************************************************ |
489 // Information item: Size. |
489 // Information item: Size. |
490 // Convert the message size given in bytes into kilobytes. Round the |
490 // Convert the message size given in bytes into kilobytes. Round the |
491 // value up, if necessary. |
491 // value up, if necessary. |
492 // ************************************************************************ |
492 // ************************************************************************ |
493 TReal messageSize( 0 ); |
493 TReal messageSize( 0 ); |
494 if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid ) |
494 if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid ) |
495 { |
495 { |