255 |
255 |
256 // ---------------------------------------------------------------------------- |
256 // ---------------------------------------------------------------------------- |
257 // LogsEvent::setEventType |
257 // LogsEvent::setEventType |
258 // ---------------------------------------------------------------------------- |
258 // ---------------------------------------------------------------------------- |
259 // |
259 // |
260 void LogsEvent::setEventType( LogsEventType eventType ) |
260 bool LogsEvent::setEventType( LogsEventType eventType ) |
261 { |
261 { |
|
262 bool changed( mEventType != eventType ); |
262 mEventType = eventType; |
263 mEventType = eventType; |
|
264 return changed; |
263 } |
265 } |
264 |
266 |
265 // ---------------------------------------------------------------------------- |
267 // ---------------------------------------------------------------------------- |
266 // LogsEvent::ALS() |
268 // LogsEvent::ALS() |
267 // ---------------------------------------------------------------------------- |
269 // ---------------------------------------------------------------------------- |
517 phoneFilter.setDetailDefinitionName( QContactOnlineAccount::DefinitionName, |
519 phoneFilter.setDetailDefinitionName( QContactOnlineAccount::DefinitionName, |
518 QContactOnlineAccount::FieldAccountUri); |
520 QContactOnlineAccount::FieldAccountUri); |
519 phoneFilter.setValue(mLogsEventData->remoteUrl()); |
521 phoneFilter.setValue(mLogsEventData->remoteUrl()); |
520 phoneFilter.setMatchFlags(QContactFilter::MatchExactly); |
522 phoneFilter.setMatchFlags(QContactFilter::MatchExactly); |
521 } else if ( !mNumber.isEmpty() ){ |
523 } else if ( !mNumber.isEmpty() ){ |
522 // remove non-significant parts from number for better matching |
|
523 phoneFilter.setDetailDefinitionName( QContactPhoneNumber::DefinitionName, |
524 phoneFilter.setDetailDefinitionName( QContactPhoneNumber::DefinitionName, |
524 QContactPhoneNumber::FieldNumber); |
525 QContactPhoneNumber::FieldNumber); |
525 phoneFilter.setValue(stripPhoneNumber(mNumber)); |
526 phoneFilter.setValue(mNumber); |
526 phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); |
527 phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); |
527 } else { |
528 } else { |
528 // Searching not possible |
529 // Searching not possible |
529 return QString(); |
530 return QString(); |
530 } |
531 } |
551 } |
552 } |
552 } |
553 } |
553 return contactNameStr; |
554 return contactNameStr; |
554 } |
555 } |
555 |
556 |
556 |
|
557 // ---------------------------------------------------------------------------- |
|
558 // LogsEvent::stripPhoneNumber |
|
559 // ---------------------------------------------------------------------------- |
|
560 // |
|
561 QString LogsEvent::stripPhoneNumber(const QString& num) |
|
562 { |
|
563 // Remove international part from beginning if starts with '+' |
|
564 // and leading digit can be removed if doesn't start with '+' |
|
565 // NOTE: since international part is not fixed length, this |
|
566 // approach is not bulletproof (i.e. if international part is |
|
567 // only one digit long, part of group identification code is ignored |
|
568 // which might lead to incorrect matching in case where user |
|
569 // would have two contacts with same subscriber number part but for |
|
570 // different operator (quite unlikely). |
|
571 |
|
572 if ( num.length() == 0 ){ |
|
573 return num; |
|
574 } |
|
575 QString modifiedNum( num ); |
|
576 if ( modifiedNum.at(0) == '+' ) { |
|
577 // QString handles automatically case of removing too much |
|
578 const int removePlusAndInternationalPart = 4; |
|
579 modifiedNum.remove( 0, removePlusAndInternationalPart ); |
|
580 } |
|
581 else { |
|
582 const int removeFirstDigit = 1; |
|
583 modifiedNum.remove( 0, removeFirstDigit ); |
|
584 } |
|
585 |
|
586 return modifiedNum; |
|
587 } |
|
588 |
|
589 // ---------------------------------------------------------------------------- |
557 // ---------------------------------------------------------------------------- |
590 // LogsEvent::parseContactName |
558 // LogsEvent::parseContactName |
591 // ---------------------------------------------------------------------------- |
559 // ---------------------------------------------------------------------------- |
592 // |
560 // |
593 QString LogsEvent::parseContactName(const QContactName& name) |
561 QString LogsEvent::parseContactName(const QContactName& name) |