Changeset 935fb3c in subsurface


Ignore:
Timestamp:
Dec 21, 2017, 12:09:35 PM (5 weeks ago)
Author:
Lubomir I. Ivanov <neolit123@…>
Branches:
master
Children:
60e82cc
Parents:
e4530cd5
git-author:
Berthold Stoeger <bstoeger@…> (12/21/17 11:11:32)
git-committer:
Lubomir I. Ivanov <neolit123@…> (12/21/17 12:09:35)
Message:

Fix BuddyFilterModel?

Commit 6343515fedbc43be4fd2cb3f1b3fea384e362c59 introduced equality
instead of substring comparison for filters. This broke the buddy
filter in the case of more than one buddy, because in such a case
the buddy list is a comma-separated string.

Fix this by splitting the buddy string, trimming the individual
strings and search in the list.

Fixes #969

Reported-by: <yrevawerd@…>
Signed-off-by: Berthold Stoeger <bstoeger@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qt-models/filtermodels.cpp

    r24c72cb r935fb3c  
    229229        }
    230230        // Checked means 'Show', Unchecked means 'Hide'.
    231         QString diveBuddy(d->buddy);
    232         QString divemaster(d->divemaster);
     231        QString persons = QString(d->buddy) + "," + QString(d->divemaster);
     232        QStringList personsList = persons.split(',', QString::SkipEmptyParts);
     233        for (QString &s: personsList)
     234                s = s.trimmed();
    233235        // only show empty buddie dives if the user checked that.
    234         if (diveBuddy.isEmpty() && divemaster.isEmpty()) {
     236        if (personsList.isEmpty()) {
    235237                if (rowCount() > 0)
    236238                        return checkState[rowCount() - 1];
     
    243245        // Ignore last item, since this is the "Show Empty Tags" entry
    244246        for (int i = 0; i < rowCount() - 1; i++) {
    245                 if (checkState[i] && (diveBuddy == buddyList[i] || divemaster == buddyList[i]))
     247                if (checkState[i] && personsList.contains(buddyList[i], Qt::CaseInsensitive))
    246248                        return true;
    247249        }
Note: See TracChangeset for help on using the changeset viewer.