logsui/logsengine/src/logsmatchesmodel.cpp
changeset 10 b04270301d3b
parent 4 e52d42f9500c
child 11 64a47b97e1e1
equal deleted inserted replaced
6:41c0a814d878 10:b04270301d3b
   673 //
   673 //
   674 QString LogsMatchesModelItemContainer::getFormattedCallerId(
   674 QString LogsMatchesModelItemContainer::getFormattedCallerId(
   675         const LogsCntEntry& entry) const
   675         const LogsCntEntry& entry) const
   676 {    
   676 {    
   677     QString callerId;
   677     QString callerId;
   678     foreach( LogsCntText name, entry.firstName() ) {
   678     getFormattedName(callerId, entry.firstName());
   679         callerId.append( name.richText() );
       
   680         if ( name.text().length() > 0 ) {
       
   681             callerId.append(" ");
       
   682         }
       
   683     }
       
   684     
   679     
   685     if  ( callerId.length() == 0 ) {
   680     if  ( callerId.length() == 0 ) {
   686         callerId = entry.phoneNumber().richText();
   681         callerId = entry.phoneNumber().richText();
   687     }
   682     }
   688 
   683 
   697         const LogsCntEntry& entry,
   692         const LogsCntEntry& entry,
   698         QString& contactName, 
   693         QString& contactName, 
   699         QString& contactNumber ) const
   694         QString& contactNumber ) const
   700 {
   695 {
   701     contactName.clear();
   696     contactName.clear();
   702     foreach( LogsCntText name, entry.firstName() ) {
   697     
   703         contactName.append( name.richText() );
   698     getFormattedName(contactName, entry.firstName());
       
   699     getFormattedName(contactName, entry.lastName());
       
   700 
       
   701     contactName = contactName.trimmed();
       
   702     contactNumber = entry.phoneNumber().text();
       
   703 }
       
   704 
       
   705 // -----------------------------------------------------------------------------
       
   706 //
       
   707 // -----------------------------------------------------------------------------
       
   708 //
       
   709 void  LogsMatchesModelItemContainer::getFormattedName(QString& formattedName, 
       
   710         const QList<LogsCntText>& list) const
       
   711 {
       
   712     foreach( LogsCntText name, list ) {
   704         if ( name.text().length() > 0 ) {
   713         if ( name.text().length() > 0 ) {
   705             contactName.append(" ");
   714             formattedName.append(name.richText());
       
   715             formattedName.append(" ");
   706         }
   716         }
   707     }
   717     }
   708     
   718 }
   709     foreach( LogsCntText lastname, entry.lastName() ) {
       
   710         contactName.append( lastname.richText() );
       
   711         if ( lastname.text().length() > 0 ) {
       
   712             contactName.append(" ");
       
   713         }
       
   714     }
       
   715     contactName = contactName.trimmed();
       
   716     
       
   717     contactNumber = entry.phoneNumber().text();
       
   718 }