idlehomescreen/xmluirendering/renderingplugins/xntextfactory/src/xntextadapter.cpp
branchRCL_3
changeset 11 ff572dfe6d86
parent 0 f72a12da539e
equal deleted inserted replaced
9:f966699dea19 11:ff572dfe6d86
   139                             
   139                             
   140                 CleanupStack::PushL( temp );
   140                 CleanupStack::PushL( temp );
   141                 
   141                 
   142                 TInt lineCount( array->Count() );
   142                 TInt lineCount( array->Count() );
   143                 
   143                 
   144                 buffer = HBufC::NewLC( temp->Length() + ( lineCount - 1 ) );
   144                 TInt bufLen = temp->Length() + ( lineCount - 1 );
   145                 
   145                 if ( bufLen > 0 )
   146                 TPtr ptr( buffer->Des() );
       
   147                                                 
       
   148                 for( TInt i = 0; i < lineCount; i++ )
       
   149                     {
   146                     {
   150                     TPtrC line( array->At( i ) );
   147                     buffer = HBufC::NewLC( bufLen );
   151                     
   148                     
   152                     ptr.Append( line );
   149                     TPtr ptr( buffer->Des() );
   153                     
   150                                                     
   154                     if( i + 1 < lineCount )
   151                     for( TInt i = 0; i < lineCount; i++ )
   155                         {
   152                         {
   156                         ptr.Append( '\n' );
   153                         TPtrC line( array->At( i ) );
   157                         }                    
   154                         
       
   155                         ptr.Append( line );
       
   156                         
       
   157                         if( i + 1 < lineCount )
       
   158                             {
       
   159                             ptr.Append( '\n' );
       
   160                             }                    
       
   161                         }
       
   162                         
       
   163                     CleanupStack::Pop();
       
   164                     CleanupStack::PopAndDestroy( temp );
       
   165                     CleanupStack::PushL( buffer );
   158                     }
   166                     }
   159                     
   167                 else
   160                 CleanupStack::Pop();
   168                     {
   161                 CleanupStack::PopAndDestroy( temp );
   169                     CleanupStack::PopAndDestroy( temp );
   162                 CleanupStack::PushL( buffer );                                                    
   170                     }
   163                 }    	        
   171                 }    	        
   164 
   172 
   165             // The text is already in visual form, no need for conversion
   173             // The text is already in visual form, no need for conversion
   166             conversion = EFalse;
   174             conversion = EFalse;
   167 
   175 
   168             aLabel.SetTextL( *buffer );            
   176             if ( buffer )
   169                         
   177                 {
   170             CleanupStack::PopAndDestroy( 2 ); // buffer, array                                       
   178                 aLabel.SetTextL( *buffer );
       
   179                 CleanupStack::PopAndDestroy( buffer );
       
   180                 }
       
   181             
       
   182             CleanupStack::PopAndDestroy(); // array                                       
   171     	    }
   183     	    }
   172         else
   184         else
   173             {
   185             {
   174             aLabel.SetTextL( aSource );            
   186             aLabel.SetTextL( aSource );            
   175             }    	                   
   187             }