[SMS app] Mask regex special characters in search box

Summary: QSortFilterProxyModel filters based on a regex. When the user inserts regex special characters things go bad.

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: apol, broulik, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D14642
This commit is contained in:
Nicolas Fella 2018-08-06 13:06:54 +02:00
parent b789b33448
commit 372f23b103

View file

@ -58,6 +58,7 @@ Kirigami.ScrollablePage
model: QSortFilterProxyModel {
sortOrder: Qt.DescendingOrder
sortRole: ConversationListModel.DateRole
filterCaseSensitivity: Qt.CaseInsensitive
sourceModel: ConversationListModel {
deviceId: device ? device.id() : ""
}
@ -68,7 +69,7 @@ Kirigami.ScrollablePage
placeholderText: i18n("Filter...")
width: parent.width
onTextChanged: {
view.model.filterRegExp = new RegExp(filter.text, "i")
view.model.setFilterFixedString(filter.text);
view.currentIndex = 0
}
Keys.onUpPressed: view.currentIndex = Math.max(view.currentIndex-1, 0)