logsui/logsengine/src/logsmatchesmodel.cpp
changeset 21 2f0af9ba7665
parent 17 90fe74753f71
equal deleted inserted replaced
18:acd4e87b24b4 21:2f0af9ba7665
   350         connect( &mParentModel, SIGNAL(modelReset()), this, SLOT(eventsResetted()));
   350         connect( &mParentModel, SIGNAL(modelReset()), this, SLOT(eventsResetted()));
   351         readEvents(0, mParentModel.rowCount());
   351         readEvents(0, mParentModel.rowCount());
   352         mIconManager = new LogsThumbIconManager();
   352         mIconManager = new LogsThumbIconManager();
   353         connect(mIconManager, SIGNAL(contactIconReady(int)),
   353         connect(mIconManager, SIGNAL(contactIconReady(int)),
   354                 this, SLOT(updateContactIcon(int)));
   354                 this, SLOT(updateContactIcon(int)));
       
   355         connect(&LogsCommonData::getInstance(), SIGNAL(commonDataChanged()),
       
   356                 this, SLOT(forceSearchQuery()));
   355     }
   357     }
   356 }
   358 }
   357 
   359 
   358 // -----------------------------------------------------------------------------
   360 // -----------------------------------------------------------------------------
   359 // Add result container but don't get real data yet. Get data once it is
   361 // Add result container but don't get real data yet. Get data once it is
   730 {
   732 {
   731     return mResultIndex;
   733     return mResultIndex;
   732 }
   734 }
   733 
   735 
   734 // -----------------------------------------------------------------------------
   736 // -----------------------------------------------------------------------------
       
   737 //
       
   738 // -----------------------------------------------------------------------------
       
   739 //
       
   740 QString LogsMatchesModelItemContainer::richText(const LogsCntText& cntText,
       
   741         bool phoneNumber) const
       
   742 {
       
   743     LogsCommonData& cd = LogsCommonData::getInstance();
       
   744     QString richText;
       
   745     if (phoneNumber) {
       
   746         if (cntText.highlights() > 0) {
       
   747             richText = mParentModel.phoneNumString(cntText.text());
       
   748             richText.insert(cntText.highlights(),cd.highlightEnd());
       
   749             richText.insert(0,cd.highlightStart());
       
   750         }
       
   751     } else {
       
   752         richText = cntText.richText(cd.highlightStart(), cd.highlightEnd());
       
   753     }
       
   754     return richText;
       
   755 }
       
   756 
       
   757 // -----------------------------------------------------------------------------
   735 // Note: Mapping of search result entry into caller ID is depended on
   758 // Note: Mapping of search result entry into caller ID is depended on
   736 // updateSearchEntry() implemention.
   759 // updateSearchEntry() implemention.
   737 // -----------------------------------------------------------------------------
   760 // -----------------------------------------------------------------------------
   738 //
   761 //
   739 QString LogsMatchesModelItemContainer::getFormattedCallerId(
   762 QString LogsMatchesModelItemContainer::getFormattedCallerId(
   741 {    
   764 {    
   742     QString callerId;
   765     QString callerId;
   743     getFormattedName(callerId, entry.firstName());
   766     getFormattedName(callerId, entry.firstName());
   744     
   767     
   745     if  ( callerId.length() == 0 ) {
   768     if  ( callerId.length() == 0 ) {
   746         callerId = mParentModel.phoneNumString(entry.phoneNumber().richText());
   769         callerId = richText(entry.phoneNumber(), true);
   747     }
   770     }
   748 
   771 
   749     return callerId.trimmed();
   772     return callerId.trimmed();
   750 }
   773 }
   751 
   774 
   776 void  LogsMatchesModelItemContainer::getFormattedName(
   799 void  LogsMatchesModelItemContainer::getFormattedName(
   777     QString& formattedName, const QList<LogsCntText>& list) const
   800     QString& formattedName, const QList<LogsCntText>& list) const
   778 {
   801 {
   779     foreach( LogsCntText name, list ) {
   802     foreach( LogsCntText name, list ) {
   780         if ( name.text().length() > 0 ) {
   803         if ( name.text().length() > 0 ) {
   781             formattedName.append(name.richText());   
   804             formattedName.append(richText(name));   
   782             formattedName.append(" ");
   805             formattedName.append(" ");
   783         }
   806         }
   784     }
   807     }
   785 }
   808 }
   786 
   809 
   792     QString& formattedName, QString& formattedNameSimple,
   815     QString& formattedName, QString& formattedNameSimple,
   793     const QList<LogsCntText>& list) const
   816     const QList<LogsCntText>& list) const
   794 {
   817 {
   795     foreach( LogsCntText name, list ) {
   818     foreach( LogsCntText name, list ) {
   796         if ( name.text().length() > 0 ) {
   819         if ( name.text().length() > 0 ) {
   797             formattedName.append(name.richText());   
   820             formattedName.append(richText(name));   
   798             formattedName.append(" ");
   821             formattedName.append(" ");
   799             formattedNameSimple.append(name.text());
   822             formattedNameSimple.append(name.text());
   800             formattedNameSimple.append(" ");
   823             formattedNameSimple.append(" ");
   801         }
   824         }
   802     }
   825     }