193 new LogsContact(matchItem.number(), *mDbConnector, matchItem.contact()); |
193 new LogsContact(matchItem.number(), *mDbConnector, matchItem.contact()); |
194 if ( !logsContact->isContactRequestAllowed() ) { |
194 if ( !logsContact->isContactRequestAllowed() ) { |
195 delete logsContact; |
195 delete logsContact; |
196 logsContact = 0; |
196 logsContact = 0; |
197 } else { |
197 } else { |
198 connect( logsContact, SIGNAL(saveCompleted(bool)), this, SLOT(forceSearchQuery()) ); |
198 connect(logsContact, SIGNAL(saveCompleted(bool)), this, SLOT(contactUpdated(bool))); |
|
199 connect(logsContact, SIGNAL(openCompleted(bool)), this, SLOT(contactUpdated(bool))); |
199 } |
200 } |
200 QVariant var = qVariantFromValue(logsContact); |
201 QVariant var = qVariantFromValue(logsContact); |
201 LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::createContact()" ) |
202 LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::createContact()" ) |
202 return var; |
203 return var; |
203 } |
204 } |
338 void LogsMatchesModel::initPredictiveSearch() |
339 void LogsMatchesModel::initPredictiveSearch() |
339 { |
340 { |
340 int searchStatus = mDbConnector->predictiveSearchStatus(); |
341 int searchStatus = mDbConnector->predictiveSearchStatus(); |
341 //searchStatus equal to 0 means that search should be permanently disabled |
342 //searchStatus equal to 0 means that search should be permanently disabled |
342 if (searchStatus != 0) { |
343 if (searchStatus != 0) { |
343 mLogsCntFinder = new LogsCntFinder(LogsCommonData::getInstance().contactManager()); |
344 mLogsCntFinder = new LogsCntFinder(LogsCommonData::getInstance().contactManager(), |
|
345 true); |
344 connect(mLogsCntFinder, SIGNAL(queryReady()),this, SLOT(queryReady())); |
346 connect(mLogsCntFinder, SIGNAL(queryReady()),this, SLOT(queryReady())); |
345 |
347 |
346 connect( &mParentModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), |
348 connect( &mParentModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), |
347 this, SLOT(eventsUpdated(const QModelIndex&,const QModelIndex&))); |
349 this, SLOT(eventsUpdated(const QModelIndex&,const QModelIndex&))); |
348 connect( &mParentModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), |
350 connect( &mParentModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), |
498 |
500 |
499 // ----------------------------------------------------------------------------- |
501 // ----------------------------------------------------------------------------- |
500 // |
502 // |
501 // ----------------------------------------------------------------------------- |
503 // ----------------------------------------------------------------------------- |
502 // |
504 // |
|
505 void LogsMatchesModel::contactUpdated(bool /*updated*/) |
|
506 { |
|
507 LOGS_QDEBUG( "logs [ENG] -> LogsMatchesModel::contactUpdated()" ) |
|
508 // At the moment phonebook doesnt notify properly when contact was updated |
|
509 // Let's reset all results (to clear cached contacts) for now, in the |
|
510 // future do it only if the contact was changed for real |
|
511 mLogsCntFinder->resetResults(); |
|
512 forceSearchQuery(); |
|
513 LOGS_QDEBUG( "logs [ENG] <- LogsMatchesModel::contactUpdated()" ) |
|
514 } |
|
515 |
|
516 // ----------------------------------------------------------------------------- |
|
517 // |
|
518 // ----------------------------------------------------------------------------- |
|
519 // |
503 void LogsMatchesModel::updateSearchEntry(LogsCntEntry& entry, LogsEvent& event) |
520 void LogsMatchesModel::updateSearchEntry(LogsCntEntry& entry, LogsEvent& event) |
504 { |
521 { |
505 if ( event.remoteParty().length() > 0 ) { |
522 if ( event.remoteParty().length() > 0 ) { |
506 entry.setFirstName(event.remoteParty()); |
523 entry.setFirstName(event.remoteParty()); |
507 } else if ( event.number().length() > 0 ) { |
524 } else if ( event.number().length() > 0 ) { |
612 // |
629 // |
613 // ----------------------------------------------------------------------------- |
630 // ----------------------------------------------------------------------------- |
614 // |
631 // |
615 QString LogsMatchesModelItemContainer::number() const |
632 QString LogsMatchesModelItemContainer::number() const |
616 { |
633 { |
617 QString num; |
634 QString number; |
618 if ( mEvent ){ |
635 if ( mEvent ){ |
619 num = mEvent->getNumberForCalling(); |
636 number = mEvent->getNumberForCalling(); |
620 } else if ( mContactId > 0 ) { |
637 } else if ( mContactId > 0 ) { |
621 QContact contact = LogsCommonData::getInstance().contactManager().contact( mContactId ); |
638 number = mContactNumber; |
622 QContactPhoneNumber contactNum = |
639 } |
623 contact.detail( QContactPhoneNumber::DefinitionName ); |
640 return number; |
624 num = contactNum.value(QContactPhoneNumber::FieldNumber); |
|
625 } |
|
626 return num; |
|
627 } |
641 } |
628 |
642 |
629 // ----------------------------------------------------------------------------- |
643 // ----------------------------------------------------------------------------- |
630 // |
644 // |
631 // ----------------------------------------------------------------------------- |
645 // ----------------------------------------------------------------------------- |