~ci-train-bot/history-service/history-service-ubuntu-yakkety-landing-052

« back to all changes in this revision

Viewing changes to historyprivate/contactmatcher.cpp

  • Committer: CI Train Bot
  • Author(s): Tiago Salem Herrmann
  • Date: 2015-10-20 20:21:15 UTC
  • mfrom: (199.4.2 set-max-count)
  • Revision ID: ci-train-bot@canonical.com-20151020202115-0pp8f3bzr261g409
- Set max count hint
- Don't use fallback to tel to avoid queries to the address-book-service with null filters
Approved by: PS Jenkins bot, Gustavo Pichorim Boiko

Show diffs side-by-side

added added

removed removed

Lines of Context:
279
279
 
280
280
void ContactMatcher::requestContactInfo(const QString &accountId, const QString &identifier)
281
281
{
282
 
    bool phoneCompare = addressableFields(accountId).contains("tel");
 
282
    QStringList addressableVCardFields = addressableFields(accountId);
 
283
    if (addressableVCardFields.isEmpty()) {
 
284
        // FIXME: add support for generic accounts
 
285
        return;
 
286
    }
 
287
 
 
288
    bool phoneCompare = addressableVCardFields.contains("tel");
283
289
 
284
290
    // check if there is a request already going on for the given contact
285
291
    Q_FOREACH(const RequestInfo &info, mRequests.values()) {
297
303
 
298
304
    QContactFetchRequest *request = new QContactFetchRequest(this);
299
305
    QContactFetchHint hint;
 
306
    hint.setMaxCountHint(1);
300
307
    // FIXME: maybe we need to fetch the full contact?
301
308
    hint.setDetailTypesHint(QList<QContactDetail::DetailType>() << QContactDetail::TypeDisplayLabel
302
309
                                                                << QContactDetail::TypePhoneNumber
305
312
    request->setFetchHint(hint);
306
313
 
307
314
    QContactUnionFilter topLevelFilter;
308
 
    Q_FOREACH(const QString &field, addressableFields(accountId)) {
 
315
    Q_FOREACH(const QString &field, addressableVCardFields) {
309
316
        if (field == "tel") {
310
317
            topLevelFilter.append(QContactPhoneNumber::match(identifier));
311
318
        } else {
414
421
    if (!account.isNull()) {
415
422
        fields = account->protocolInfo().addressableVCardFields();
416
423
        mAddressableFields[accountId] = fields;
417
 
    } else {
418
 
        // use phonenumber as a fallback
419
 
        fields << "tel";
420
424
    }
421
425
 
422
426
    return fields;