logsui/logscntfinder/src/logscntfinder.cpp
changeset 16 c5af8598d22c
parent 14 f27aebe284bb
child 21 2f0af9ba7665
equal deleted inserted replaced
14:f27aebe284bb 16:c5af8598d22c
    18 #include <qcontactdetailfilter.h>
    18 #include <qcontactdetailfilter.h>
    19 #include <qcontactphonenumber.h>
    19 #include <qcontactphonenumber.h>
    20 #include <qcontactname.h>
    20 #include <qcontactname.h>
    21 #include <qcontactmanager.h>
    21 #include <qcontactmanager.h>
    22 #include <qcontactavatar.h>
    22 #include <qcontactavatar.h>
       
    23 #include <qcontactaction.h>
    23 
    24 
    24 #include "logscntentry.h"
    25 #include "logscntentry.h"
    25 #include "logscntfinder.h"
    26 #include "logscntfinder.h"
    26 #include "logspredictivetranslator.h"
    27 #include "logspredictivetranslator.h"
    27 #include "logslogger.h"
    28 #include "logslogger.h"
   173 //
   174 //
   174 void LogsCntFinder::doPredictiveContactQuery( LogsCntEntryList& recentResults )
   175 void LogsCntFinder::doPredictiveContactQuery( LogsCntEntryList& recentResults )
   175 {
   176 {
   176     LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doPredictiveContactQuery()" )
   177     LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::doPredictiveContactQuery()" )
   177     QContactDetailFilter df;
   178     QContactDetailFilter df;
   178     df.setDetailDefinitionName( QContactName::DefinitionName );
   179     df.setDetailDefinitionName( QContactName::DefinitionName, QContactName::FieldFirstName );
   179     df.setMatchFlags( QContactFilter::MatchKeypadCollation );
   180     df.setMatchFlags( QContactFilter::MatchKeypadCollation );
   180     df.setValue( mCurrentInputPattern );
   181     df.setValue( mCurrentInputPattern );
   181     QList<QContactLocalId> cntIds;
   182     QList<QContactLocalId> cntIds;
   182     LOGS_QDEBUG( "logs [FINDER] about to call contacts manager" )
   183     LOGS_QDEBUG( "logs [FINDER] about to call contacts manager" )
   183     
   184     
   283 QString LogsCntFinder::phoneNumber(const QContact& contact) const
   284 QString LogsCntFinder::phoneNumber(const QContact& contact) const
   284 {
   285 {
   285     LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::phoneNumber()" )
   286     LOGS_QDEBUG( "logs [FINDER] -> LogsCntFinder::phoneNumber()" )
   286     QString number;
   287     QString number;
   287     if (mPreferDefaultNumber) {
   288     if (mPreferDefaultNumber) {
   288         number = contact.preferredDetail("call").value(
   289             
   289                                     QContactPhoneNumber::FieldNumber );
   290         QContactActionDescriptor callActionName("call");
   290         if (number.isEmpty()) {
   291         
   291             number = contact.detailWithAction("call").value(
   292         number = contact.preferredDetail( callActionName.actionName() ).value(
   292                                     QContactPhoneNumber::FieldNumber );
   293                     QContactPhoneNumber::FieldNumber );
       
   294         
       
   295         if ( number.isEmpty() ) {
       
   296             number = contact.detailWithAction( 
       
   297                     QContactAction::action( callActionName ) ).value(
       
   298                     QContactPhoneNumber::FieldNumber );
   293         }
   299         }
   294     }
   300     }
   295     
   301     
   296     if (number.isEmpty()) {
   302     if (number.isEmpty()) {
   297         QContactPhoneNumber contactPhoneNumber = 
   303         QContactPhoneNumber contactPhoneNumber =