Commit 2df6dd40 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Fix filtering of certificates by a text pattern

This is a really bad incompatibility between QRegExp and QRegularExpression
in QSortFilterProxyModel.
KeyListSortFilterProxyModel now uses filterRegularExpression() which
returns the regular expression set with setFilterRegularExpression().
Setting a filter pattern with setFilterFixedString() internally sets
a QRegExp, but not a QRegularExpression. Therefore, our filter model
used an empty QRegularExpression for filtering.
Setting the filter pattern with
setFilterRegularExpression(QRegularExpression::escape(...))
instead of setFilterFixedString(...) fixes this incompatibility.

GnuPG-bug-id: 6086
parent 3e82c3fd
......@@ -406,7 +406,7 @@ void CertificateLineEdit::Private::updateKey()
if (mailText.isEmpty()) {
mStatus = Status::Empty;
} else {
mFilterModel->setFilterFixedString(mailText);
mFilterModel->setFilterRegularExpression(QRegularExpression::escape(mailText));
if (mFilterModel->rowCount() > 1) {
// keep current key or group if they still match
if (!mKey.isNull()) {
......
......@@ -363,7 +363,7 @@ void KeyTreeView::init()
}
}
m_proxy->setFilterFixedString(m_stringFilter);
m_proxy->setFilterRegularExpression(QRegularExpression::escape(m_stringFilter));
m_proxy->setKeyFilter(m_keyFilter);
m_proxy->setSortCaseSensitivity(Qt::CaseInsensitive);
......@@ -613,7 +613,7 @@ void KeyTreeView::setStringFilter(const QString &filter)
return;
}
m_stringFilter = filter;
m_proxy->setFilterFixedString(filter);
m_proxy->setFilterRegularExpression(QRegularExpression::escape(filter));
Q_EMIT stringFilterChanged(filter);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment