pushmtm/MtmUiSrc/PushMessageInfoDialog.cpp
branchRCL_3
changeset 65 8e6fa1719340
equal deleted inserted replaced
64:6385c4c93049 65:8e6fa1719340
       
     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 the License "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:  Member definitions of CPushMessageInfoDialog.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 
       
    22 #include "PushMessageInfoDialog.h"
       
    23 #include "PushMtmUiDef.h"
       
    24 #include "PushMtmUiPanic.h"
       
    25 #include "PushMtmUtil.h"
       
    26 #include "PushMtmLog.h"
       
    27 #include <push/CSIPushMsgEntry.h>
       
    28 #include <push/CSLPushMsgEntry.h>
       
    29 #include <push/CUnknownPushMsgEntry.h>
       
    30 #include <PushMtmUi.rsg>
       
    31 #include <AknLists.h>
       
    32 #include <msvapi.h>
       
    33 #include <e32math.h>
       
    34 #include <StringLoader.h>
       
    35 #include <AVKON.RSG>
       
    36 #include <bldvariant.hrh>
       
    37 #include <FeatMgr.h>
       
    38 #include <data_caging_path_literals.hrh>
       
    39 #include <f32file.h>
       
    40 #include <AknUtils.h>
       
    41 #include <AknBidiTextUtils.h>
       
    42 #include "PushMtmPrivateCRKeys.h"
       
    43 #include <centralrepository.h> 
       
    44 // CONSTANTS
       
    45 LOCAL_D const TInt KNoResource = 0;
       
    46 LOCAL_D const TInt KArrayGranularity = 16;
       
    47 LOCAL_D const TReal KReal1024 = 1024.0;
       
    48 _LIT( KTab, "\t" );
       
    49 _LIT( KSpace, " " );
       
    50 
       
    51 
       
    52 // ================= MEMBER FUNCTIONS =======================
       
    53 
       
    54 // ---------------------------------------------------------
       
    55 // CPushMessageInfoDialog::CPushMessageInfoDialog
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 CPushMessageInfoDialog::CPushMessageInfoDialog()
       
    59 :   CAknPopupList(),
       
    60     iResourceLoader( *iCoeEnv )
       
    61     {
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------
       
    65 // CPushMessageInfoDialog::~CPushMessageInfoDialog
       
    66 // ---------------------------------------------------------
       
    67 //
       
    68 CPushMessageInfoDialog::~CPushMessageInfoDialog()
       
    69     {
       
    70     iSecondColumnFont = 0;
       
    71     iResourceLoader.Close();
       
    72     delete iListBox;
       
    73     delete iListBoxModel;
       
    74     FeatureManager::UnInitializeLib();
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // CPushMessageInfoDialog::ExecuteLD
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 void CPushMessageInfoDialog::ExecuteLD( CMsvSession& aMsvSession, TMsvId aId )
       
    82     {
       
    83     ConstructL( aMsvSession, aId );
       
    84     CAknPopupList::ExecuteLD();
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------
       
    88 // CPushMessageInfoDialog::ConstructL
       
    89 // ---------------------------------------------------------
       
    90 //
       
    91 void CPushMessageInfoDialog::ConstructL( CMsvSession& aMsvSession, TMsvId aId )
       
    92     {
       
    93     PUSHLOG_ENTERFN("CPushMessageInfoDialog::ConstructL");
       
    94     __ASSERT_DEBUG( !iListBox &&
       
    95                     !iListBoxModel,
       
    96                     UiPanic( EPushMtmUiPanAlreadyInitialized ) );
       
    97 
       
    98     FeatureManager::InitializeLibL();
       
    99     
       
   100     CRepository* PushSL = CRepository::NewL( KCRUidPushMtm );
       
   101     CleanupStack::PushL( PushSL );
       
   102     User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) );
       
   103     PUSHLOG_WRITE_FORMAT(" iPushSLEnabled: <%d>",iPushSLEnabled);
       
   104     CleanupStack::PopAndDestroy( PushSL ); 
       
   105 
       
   106     // Add resource file.
       
   107     TParse* fileParser = new (ELeave) TParse;
       
   108     // Unnecessary to call CleanupStack::PushL( fileParser );
       
   109     fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL );
       
   110     iResourceFile = fileParser->FullName();
       
   111     PUSHLOG_WRITE_FORMAT(" iResourceFile: <%S>",&iResourceFile);
       
   112     delete fileParser;
       
   113     fileParser = NULL;
       
   114     iResourceLoader.OpenL( iResourceFile );
       
   115     PUSHLOG_WRITE(" iResourceFile opened");
       
   116 
       
   117     // Construct list box's model first
       
   118     // This list box will be used by an CAknPopupList object.
       
   119     __ASSERT_DEBUG( !iListBoxModel && !iListBox,
       
   120                     UiPanic( EPushMtmUiPanAlreadyInitialized ) );
       
   121    	iListBoxModel = new (ELeave) CDesCArrayFlat( KArrayGranularity );
       
   122     // Construct list box.
       
   123     iListBox = new (ELeave) CAknSingleHeadingPopupMenuStyleListBox;
       
   124 
       
   125     // ========================================================
       
   126     // Layout info of CAknSingleHeadingPopupMenuStyleListBox
       
   127     TAknTextLineLayout textLayout =
       
   128         AknLayout::List_pane_texts__menu_single_heading__Line_2(0);
       
   129 
       
   130     // Font of the second column of the given list box
       
   131     iSecondColumnFont = AknLayoutUtils::FontFromId( textLayout.FontId() );
       
   132 
       
   133     // Line width of the second column of the given list box
       
   134     TInt itemCount = 0; // No need to set
       
   135     TInt titleVisible = 1; // known value (we always have title)
       
   136     TRect main_pane = iAvkonAppUi->ClientRect();
       
   137 
       
   138     TAknLayoutRect popup_menu_graphic_window;
       
   139     popup_menu_graphic_window.LayoutRect( main_pane,
       
   140         AknLayout::popup_menu_graphic_window(itemCount) );
       
   141 
       
   142     TAknLayoutRect menu_heading_pane;
       
   143     menu_heading_pane.LayoutRect( popup_menu_graphic_window.Rect(),
       
   144         AknLayout::list_menu_heading_pane(titleVisible, itemCount) );
       
   145 
       
   146     TAknLayoutRect list_item;
       
   147     list_item.LayoutRect( menu_heading_pane.Rect(),
       
   148         AknLayout::list_single_heading_popup_menu_pane(itemCount) );
       
   149 
       
   150     TAknLayoutText text;
       
   151     text.LayoutText( list_item.Rect(), textLayout );
       
   152 
       
   153     iSecondColumnWidth = text.TextRect().Width();
       
   154     // ========================================================
       
   155 
       
   156     // Add items to the list.
       
   157     AddMessageInfoItemsL( aMsvSession, aId );
       
   158 
       
   159     CAknPopupList::ConstructL( iListBox,
       
   160                                R_AVKON_SOFTKEYS_OK_EMPTY__OK,
       
   161                                AknPopupLayouts::EMenuGraphicHeadingWindow );
       
   162 
       
   163 	iListBox->ConstructL( this, EAknListBoxViewerFlags );
       
   164 	iListBox->CreateScrollBarFrameL( ETrue );
       
   165 	iListBox->ScrollBarFrame()->SetScrollBarVisibilityL
       
   166         ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   167 
       
   168     CTextListBoxModel* listBoxModel = iListBox->Model();
       
   169 	listBoxModel->SetItemTextArray( iListBoxModel );
       
   170 	listBoxModel->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   171 
       
   172     // Get title text of popup list
       
   173     HBufC* title = iCoeEnv->AllocReadResourceLC( R_PUSHMID_TITLE );
       
   174     PUSHLOG_WRITE(" R_PUSHMID_TITLE read");
       
   175     SetTitleL( *title );
       
   176     CleanupStack::PopAndDestroy( title ); // title
       
   177 
       
   178     PUSHLOG_LEAVEFN("CPushMessageInfoDialog::ConstructL");
       
   179 	}
       
   180 
       
   181 // ---------------------------------------------------------
       
   182 // CPushMessageInfoDialog::AddMessageInfoItemL
       
   183 // ---------------------------------------------------------
       
   184 //
       
   185 void CPushMessageInfoDialog::AddMessageInfoItemL( TInt aHeaderResourceId,
       
   186                                                   const TDesC& aText ) const
       
   187     {
       
   188     __ASSERT_DEBUG( iListBoxModel, UiPanic( EPushMtmUiPanNotInitialized ) );
       
   189 
       
   190     // Make some necessary conversion.
       
   191     HBufC* paramTextCopy = aText.AllocLC();
       
   192     TPtr paramTextCopyPtr = paramTextCopy->Des();
       
   193     // Remove tabs, because of the list box...
       
   194     AknTextUtils::StripCharacters( paramTextCopyPtr, KAknStripListControlChars );
       
   195     // Number conversion
       
   196     if ( paramTextCopyPtr.Length() > 0 )
       
   197         {
       
   198         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( paramTextCopyPtr );
       
   199         }
       
   200 
       
   201     HBufC* header = ( aHeaderResourceId == KNoResource ?
       
   202         KNullDesC().AllocLC() :
       
   203         iCoeEnv->AllocReadResourceLC( aHeaderResourceId ) );
       
   204 
       
   205     CArrayFix<TPtrC>* wrappedArray =
       
   206         new ( ELeave ) CArrayFixFlat<TPtrC>( KArrayGranularity );
       
   207     CleanupStack::PushL( wrappedArray );
       
   208 
       
   209     AknTextUtils::WrapToArrayL
       
   210                                 ( paramTextCopyPtr, iSecondColumnWidth,
       
   211                                   *iSecondColumnFont, *wrappedArray );
       
   212     // visual is directly not used, but wrappedArray points to it
       
   213 
       
   214     // Add the lines in wrappedArray to the list
       
   215     const TInt lines = wrappedArray->Count();
       
   216     for ( TInt loop = 0; loop < lines; ++loop )
       
   217         {
       
   218         TPtrC current = ( *wrappedArray )[loop];
       
   219         // Allocate a buffer for the new list box item text
       
   220         // (including header, separator and wrapped text)
       
   221         HBufC* currentFormattedLine = HBufC::NewLC
       
   222             ( ((loop==0) ? header->Length() : /*KSpace().Length()*/1) +
       
   223               /*KTab().Length()*/1 + current.Length() );
       
   224         TPtr currentFormattedLinePtr = currentFormattedLine->Des(); // writeable
       
   225 
       
   226         if ( loop == 0 )
       
   227             { currentFormattedLinePtr.Copy( *header ); }
       
   228         else
       
   229             { currentFormattedLinePtr.Copy( KSpace ); }
       
   230 
       
   231         currentFormattedLinePtr.Append( KTab );
       
   232         currentFormattedLinePtr.Append( current );
       
   233         iListBoxModel->AppendL( currentFormattedLinePtr );
       
   234 
       
   235         CleanupStack::PopAndDestroy( currentFormattedLine ); // currentFormattedLine
       
   236         }
       
   237 
       
   238     CleanupStack::PopAndDestroy( 1, wrappedArray ); //  wrappedArray
       
   239     CleanupStack::PopAndDestroy( 2, paramTextCopy ); // header, paramTextCopy
       
   240     }
       
   241 
       
   242 // ---------------------------------------------------------
       
   243 // CPushMessageInfoDialog::ConvertUniversalToHomeTime
       
   244 // ---------------------------------------------------------
       
   245 //
       
   246 TTime CPushMessageInfoDialog::ConvertUniversalToHomeTime
       
   247                               ( const TTime& aUniversalTime ) const
       
   248     {
       
   249     TTime time( aUniversalTime );   // time stores UTC time.
       
   250 
       
   251     TLocale locale;
       
   252     TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
       
   253     // Add locale's universal time offset to universal time.
       
   254     time += universalTimeOffset;    // time stores Local Time.
       
   255 
       
   256     // If home daylight saving in effect, add one hour offset.
       
   257     if ( locale.QueryHomeHasDaylightSavingOn() )
       
   258           {
       
   259           TTimeIntervalHours daylightSaving(1);
       
   260           time += daylightSaving;   // Now it is Home Time.
       
   261           }
       
   262 
       
   263 #ifdef __TEST_LOG__
       
   264         // The following section will call LEAVEable functions, but
       
   265         // they are only for logging purposes.
       
   266         _LIT( KDateFormat, "%E%D%X%N%Y %1 %2 %3" );
       
   267         _LIT( KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B" );
       
   268         TBuf<32> dateHolder;
       
   269         TBuf<32> timeHolder;
       
   270         aUniversalTime.FormatL( dateHolder, KDateFormat );
       
   271         aUniversalTime.FormatL( timeHolder, KTimeFormat );
       
   272         PUSHLOG_WRITE_FORMAT(" UTC date: <%S>",&dateHolder);
       
   273         PUSHLOG_WRITE_FORMAT(" UTC time: <%S>",&timeHolder);
       
   274         time.FormatL( dateHolder, KDateFormat );
       
   275         time.FormatL( timeHolder, KTimeFormat );
       
   276         PUSHLOG_WRITE_FORMAT(" Home date: <%S>",&dateHolder);
       
   277         PUSHLOG_WRITE_FORMAT(" Home time: <%S>",&timeHolder);
       
   278 #endif // __TEST_LOG__
       
   279 
       
   280     return time; // Home Time.
       
   281     }
       
   282 
       
   283 // ---------------------------------------------------------
       
   284 // CPushMessageInfoDialog::AddMessageInfoItemsL
       
   285 // ---------------------------------------------------------
       
   286 //
       
   287 void CPushMessageInfoDialog::AddMessageInfoItemsL( CMsvSession& aMsvSession,
       
   288                                                    TMsvId aId ) const
       
   289     {
       
   290     PUSHLOG_ENTERFN("CPushMessageInfoDialog::AddMessageInfoItemsL");
       
   291 
       
   292     TMsvEntry tEntry;
       
   293     TMsvId dummyService;
       
   294     User::LeaveIfError( aMsvSession.GetEntry( aId, dummyService, tEntry ) );
       
   295     PUSHLOG_WRITE(" Entry got");
       
   296     __ASSERT_DEBUG
       
   297         ( tEntry.iMtm == KUidMtmWapPush, UiPanic( EPushMtmUiPanBadType ) );
       
   298 
       
   299     // Construct model.
       
   300     CPushMsgEntryBase* msg = NULL;
       
   301     const TInt32 bioType( tEntry.iBioType );
       
   302     if ( bioType == KUidWapPushMsgSI.iUid )
       
   303         {
       
   304         msg = CSIPushMsgEntry::NewL();
       
   305         PUSHLOG_WRITE(" SI");
       
   306         }
       
   307     else if(iPushSLEnabled && bioType == KUidWapPushMsgSL.iUid)
       
   308         {
       
   309         msg = CSLPushMsgEntry::NewL();
       
   310         PUSHLOG_WRITE(" SL");
       
   311         }
       
   312 #ifdef __SERIES60_PUSH_SP
       
   313     else if ( bioType == KUidWapPushMsgUnknown.iUid )
       
   314         {
       
   315         msg = CUnknownPushMsgEntry::NewL();
       
   316         PUSHLOG_WRITE(" Unknown");
       
   317         }
       
   318 #endif // __SERIES60_PUSH_SP
       
   319     else
       
   320         {
       
   321         PUSHLOG_WRITE(" Bad message type");
       
   322         User::Leave( KErrNotSupported );
       
   323         }
       
   324 
       
   325     CleanupStack::PushL( msg );
       
   326     msg->RetrieveL( aMsvSession, tEntry.Id() );
       
   327     PUSHLOG_WRITE(" RetreiveL OK");
       
   328 
       
   329     // ************************************************************************
       
   330     // Information item: From (push initiator).
       
   331     // This can be MSISDN number, URL, etc.
       
   332     // ************************************************************************
       
   333     TPtrC8 from8( msg->From() );
       
   334     if ( from8.Length() )
       
   335         {
       
   336         // Copy the 8-bit text into a 16-bit one and convert the string to
       
   337         // decoded form.
       
   338         HBufC* from16 = HBufC::NewMaxLC( from8.Length() );
       
   339         from16->Des().Copy( from8 );
       
   340 
       
   341         HBufC* convertedFrom =
       
   342             CPushMtmUtil::ConvertUriToDisplayFormL( *from16 );
       
   343         CleanupStack::PushL( convertedFrom );
       
   344         //
       
   345         AddMessageInfoItemL( R_PUSHMID_FROM, *convertedFrom );
       
   346         PUSHLOG_WRITE(" From added");
       
   347         //
       
   348         CleanupStack::PopAndDestroy( 2, from16 ); // convertedFrom, from16
       
   349         }
       
   350 
       
   351     // ************************************************************************
       
   352     // Information item: Address/URL (SI and SL specific).
       
   353     // ************************************************************************
       
   354     if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid )
       
   355         {
       
   356         CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg );
       
   357         const TPtrC url = si->Url();
       
   358         if ( url.Length() )
       
   359             {
       
   360             //
       
   361             HBufC* convertedUrl =
       
   362                 CPushMtmUtil::ConvertUriToDisplayFormL( url );
       
   363             CleanupStack::PushL( convertedUrl );
       
   364             //
       
   365             AddMessageInfoItemL( R_PUSHMID_URL, *convertedUrl );
       
   366             PUSHLOG_WRITE(" URL added");
       
   367             //
       
   368             CleanupStack::PopAndDestroy( convertedUrl );
       
   369             }
       
   370         }
       
   371     else if ( iPushSLEnabled && msg->PushMsgType() == KUidWapPushMsgSL.iUid )
       
   372         {
       
   373         CSLPushMsgEntry* sl = STATIC_CAST( CSLPushMsgEntry*, msg );
       
   374         const TPtrC url = sl->Url();
       
   375         if ( url.Length() )
       
   376             {
       
   377             //
       
   378             HBufC* convertedUrl =
       
   379                 CPushMtmUtil::ConvertUriToDisplayFormL( url );
       
   380             CleanupStack::PushL( convertedUrl );
       
   381             //
       
   382             AddMessageInfoItemL( R_PUSHMID_URL, sl->Url() );
       
   383             PUSHLOG_WRITE(" URL added");
       
   384             //
       
   385             CleanupStack::PopAndDestroy( convertedUrl );
       
   386             }
       
   387         }
       
   388 
       
   389     // ************************************************************************
       
   390     // Information item: Message body/text (SI specific).
       
   391     // ************************************************************************
       
   392     if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid )
       
   393         {
       
   394         CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg );
       
   395         if ( si->Text().Length() )
       
   396             {
       
   397             TPtrC siText = si->Text();
       
   398             PUSHLOG_WRITE_FORMAT(" SI text: <%S>",&siText);
       
   399             AddMessageInfoItemL( R_PUSHMID_BODY, siText );
       
   400             PUSHLOG_WRITE(" SI text added");
       
   401             }
       
   402         }
       
   403 
       
   404     // ************************************************************************
       
   405     // Information item: Type.
       
   406     // ************************************************************************
       
   407     HBufC* value = iCoeEnv->AllocReadResourceLC( R_PUSHMID_TYPE_STR );
       
   408     AddMessageInfoItemL( R_PUSHMID_TYPE, *value );
       
   409     CleanupStack::PopAndDestroy( value ); // value
       
   410     PUSHLOG_WRITE(" Msg. type added");
       
   411 
       
   412 #ifdef __SERIES60_PUSH_SP
       
   413     // ************************************************************************
       
   414     // Information item: Content type (SP specific)
       
   415     // ************************************************************************
       
   416     if ( msg->PushMsgType() == KUidWapPushMsgUnknown.iUid )
       
   417         {
       
   418         CUnknownPushMsgEntry* sp = STATIC_CAST( CUnknownPushMsgEntry*, msg );
       
   419         TPtrC contType = sp->ContentType();
       
   420         if ( contType.Length() )
       
   421             {
       
   422             AddMessageInfoItemL( R_PUSHMID_CONTENT_TYPE, contType );
       
   423             PUSHLOG_WRITE(" Content type added ");
       
   424             }
       
   425         }
       
   426 #endif // __SERIES60_PUSH_SP
       
   427 
       
   428     TBuf<32> time;
       
   429     TBuf<32> date;
       
   430     HBufC* dateFormatString =
       
   431                 iCoeEnv->AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO );
       
   432     HBufC* timeFormatString =
       
   433                 iCoeEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO );
       
   434 
       
   435     // ************************************************************************
       
   436     // SI specific information item: creation time and date.
       
   437     // ************************************************************************
       
   438     if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid )
       
   439         {
       
   440         CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg );
       
   441         const TTime created( si->Created() );
       
   442         // Check if created time was set.
       
   443         if ( created != Time::NullTTime() )
       
   444             {
       
   445             // OK. this attribute was set. Render it to the user.
       
   446             TTime creLocal = ConvertUniversalToHomeTime( created );
       
   447             creLocal.FormatL( time, *timeFormatString );
       
   448             creLocal.FormatL( date, *dateFormatString );
       
   449             AddMessageInfoItemL( R_PUSHMID_CREATED, time );
       
   450             AddMessageInfoItemL( KNoResource, date );
       
   451             PUSHLOG_WRITE(" Created added");
       
   452             }
       
   453         }
       
   454 
       
   455     // ************************************************************************
       
   456     // Information item: Arrival time and date.
       
   457     // ************************************************************************
       
   458     const TTime arrivalTime( msg->ReceivedDate() );
       
   459     // Arrival time is always set by the wappush framework. Render it to the user.
       
   460     TTime arrLocal = ConvertUniversalToHomeTime( arrivalTime );
       
   461     arrLocal.FormatL( time, *timeFormatString );
       
   462     arrLocal.FormatL( date, *dateFormatString );
       
   463     AddMessageInfoItemL( R_PUSHMID_RCVD, time );
       
   464     AddMessageInfoItemL( KNoResource, date );
       
   465     PUSHLOG_WRITE(" Received added");
       
   466 
       
   467     // ************************************************************************
       
   468     // SI specific information item: expiration time and date.
       
   469     // ************************************************************************
       
   470     if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid )
       
   471         {
       
   472         CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg );
       
   473         const TTime expires( si->Expires() );
       
   474         // Check expiration if expiration time was set.
       
   475         if ( expires != Time::NullTTime() )
       
   476             {
       
   477             TTime expLocal = ConvertUniversalToHomeTime( expires );
       
   478             expLocal.FormatL( time, *timeFormatString );
       
   479             expLocal.FormatL( date, *dateFormatString );
       
   480             AddMessageInfoItemL( R_PUSHMID_EXPIRES, time );
       
   481             AddMessageInfoItemL( KNoResource, date );
       
   482             PUSHLOG_WRITE(" Expires added");
       
   483             }
       
   484         }
       
   485 
       
   486     CleanupStack::PopAndDestroy( 2, dateFormatString );
       
   487     // timeFormatString, dateFormatString
       
   488 
       
   489     // ************************************************************************
       
   490     // Information item: Size.
       
   491     // Convert the message size given in bytes into kilobytes. Round the
       
   492     // value up, if necessary.
       
   493     // ************************************************************************
       
   494     TReal messageSize( 0 );
       
   495     if ( msg->PushMsgType() == KUidWapPushMsgSI.iUid )
       
   496         {
       
   497         CSIPushMsgEntry* si = STATIC_CAST( CSIPushMsgEntry*, msg );
       
   498         messageSize = (TReal)si->Text().Size() / KReal1024;
       
   499         }
       
   500     else if ( iPushSLEnabled && msg->PushMsgType() == KUidWapPushMsgSL.iUid )
       
   501         {
       
   502         CSLPushMsgEntry* sl = STATIC_CAST( CSLPushMsgEntry*, msg );
       
   503         messageSize = (TReal)sl->Url().Size() / KReal1024;
       
   504         }
       
   505 #ifdef __SERIES60_PUSH_SP
       
   506     else if ( msg->PushMsgType() == KUidWapPushMsgUnknown.iUid )
       
   507         {
       
   508         CUnknownPushMsgEntry* sp = STATIC_CAST( CUnknownPushMsgEntry*, msg );
       
   509         messageSize = (TReal)sp->MessageData().Size() / KReal1024;
       
   510         }
       
   511 #endif // __SERIES60_PUSH_SP
       
   512     TInt32 messageSizeInt;
       
   513     User::LeaveIfError( Math::Int( messageSizeInt, messageSize ) );
       
   514     TReal fraction;
       
   515     User::LeaveIfError( Math::Frac( fraction, messageSize ) );
       
   516     if ( fraction )
       
   517         {
       
   518         ++messageSizeInt;
       
   519         }
       
   520     HBufC* size =
       
   521         StringLoader::LoadLC( R_QTN_SIZE_KB, messageSizeInt, iCoeEnv );
       
   522     // From avkon.loc:
       
   523     // #define qtn_size_kb " %N kB"
       
   524     // We don't need white spaces at the beginning of the size string, so
       
   525     // remove them:
       
   526     size->Des().Trim();
       
   527     AddMessageInfoItemL( R_PUSHMID_SIZE, *size );
       
   528     PUSHLOG_WRITE(" Size added");
       
   529     CleanupStack::PopAndDestroy( size ); // size
       
   530 
       
   531     CleanupStack::PopAndDestroy( msg ); // msg
       
   532 
       
   533     PUSHLOG_LEAVEFN("CPushMessageInfoDialog::AddMessageInfoItemsL");
       
   534     }
       
   535 
       
   536 // End of file.