smsapp/conversationlistmodel: Port to QRegularExpression

In Qt5, setFilterFixedString does not change the filterRegularExpression property.
Meaning we need to keep it in the Qt5 build
This commit is contained in:
Alexander Lohnau 2023-04-17 21:45:18 +02:00
parent 5a87000e3b
commit f759877336

View file

@ -50,7 +50,7 @@ bool ConversationsSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QM
if (filterRole() == ConversationListModel::ConversationIdRole) { if (filterRole() == ConversationListModel::ConversationIdRole) {
return sourceModel()->data(index, ConversationListModel::ConversationIdRole) != INVALID_THREAD_ID; return sourceModel()->data(index, ConversationListModel::ConversationIdRole) != INVALID_THREAD_ID;
} else { } else {
if (sourceModel()->data(index, Qt::DisplayRole).toString().contains(filterRegExp())) { if (sourceModel()->data(index, Qt::DisplayRole).toString().contains(filterRegularExpression())) {
return true; return true;
} }
@ -58,7 +58,11 @@ bool ConversationsSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QM
const QList<ConversationAddress> addressList = sourceModel()->data(index, ConversationListModel::AddressesRole).value<QList<ConversationAddress>>(); const QList<ConversationAddress> addressList = sourceModel()->data(index, ConversationListModel::AddressesRole).value<QList<ConversationAddress>>();
for (const ConversationAddress &address : addressList) { for (const ConversationAddress &address : addressList) {
QString canonicalAddress = SmsHelper::canonicalizePhoneNumber(address.address()); QString canonicalAddress = SmsHelper::canonicalizePhoneNumber(address.address());
#if QT_VERSION_MAJOR < 6
if (canonicalAddress.contains(filterRegExp())) { if (canonicalAddress.contains(filterRegExp())) {
#else
if (canonicalAddress.contains(filterRegularExpression())) {
#endif
return true; return true;
} }
} }