messagingappbase/msgavkon/muiu_internal/settingsarray/src/MuiuSettingsArray.cpp
branchRCL_3
changeset 77 da6ac9d688df
parent 71 17302fa075e1
equal deleted inserted replaced
71:17302fa075e1 77:da6ac9d688df
   109             item.iType = EMuiuSettingsUnknown;
   109             item.iType = EMuiuSettingsUnknown;
   110             HBufC* txt = reader.ReadHBufCL();   // message text
   110             HBufC* txt = reader.ReadHBufCL();   // message text
   111             item.iLabelText.Copy( *txt );
   111             item.iLabelText.Copy( *txt );
   112             TBool flag = EFalse;
   112             TBool flag = EFalse;
   113             //If string retrived from resource is "Message sent as" 
   113             //If string retrived from resource is "Message sent as" 
   114             CleanupStack::PushL( txt );
       
   115             flag = IsMessageSentStringL( txt );
   114             flag = IsMessageSentStringL( txt );
   116             CleanupStack::PopAndDestroy( txt );
   115 
       
   116             delete txt;
   117             
   117             
   118             const TMuiuSettingsType type = ( TMuiuSettingsType ) reader.ReadInt16();
   118             const TMuiuSettingsType type = ( TMuiuSettingsType ) reader.ReadInt16();
   119             item.iType = type;
   119             item.iType = type;
   120             const TInt maxLength = reader.ReadInt16();
   120             const TInt maxLength = reader.ReadInt16();
   121             item.iUserTextMaxLength = maxLength < KMuiuMaxSettingsTextLength ?
   121             item.iUserTextMaxLength = maxLength < KMuiuMaxSettingsTextLength ?
   125             
   125             
   126             const TInt array_id = reader.ReadInt32();
   126             const TInt array_id = reader.ReadInt32();
   127             
   127             
   128             if ( type == EMuiuSettingsSelectionList && array_id )
   128             if ( type == EMuiuSettingsSelectionList && array_id )
   129                 {
   129                 {
   130                 TResourceReader arrayReader;
   130                 CDesCArrayFlat* array = 
   131                 env->CreateResourceReaderLC( arrayReader, array_id );
   131                                 new( ELeave ) CDesCArrayFlat( KMuiuSettingsArrayGranularity );
       
   132                 CleanupStack::PushL( array );
       
   133                 TResourceReader reader2;
       
   134                 env->CreateResourceReaderLC( reader2, array_id );
   132                 
   135                 
   133                 CDesCArrayFlat* array = arrayReader.ReadDesCArrayL();
   136                 const TInt count = reader2.ReadInt16();
   134                 
   137                 for ( TInt loop = 0; loop < count; loop++ )
   135                 if ( !flag && array )
       
   136                     {
   138                     {
   137                     item.iMuiuSettingsItemArray = array;
   139                     HBufC* txt = reader2.ReadHBufCL();
   138                     CleanupStack::PushL( array );
   140                     CleanupStack::PushL( txt );
   139                     AppendL( item );
   141                     array->AppendL( *txt );
   140                     CleanupStack::Pop( array );
   142                     CleanupStack::PopAndDestroy(); // txt
   141                     }
   143                     }
   142                 else
   144                 CleanupStack::PopAndDestroy(); //reader2
   143                     {
   145                 item.iMuiuSettingsItemArray = array;
   144                     delete array;
   146                 if(!flag)
   145                     }
   147                 AppendL( item );
   146                 
   148                 CleanupStack::Pop( array ); //array
   147                 CleanupStack::PopAndDestroy();
       
   148                 }
   149                 }
   149             else
   150             else
   150                 {
   151                 {
   151                 AppendL( item );
   152                 AppendL( item );
   152                 }
   153                 }