Commit 3e6b64e6 authored by Nate Graham's avatar Nate Graham 🔩 Committed by Aleix Pol Gonzalez
Browse files

[Emoji panel] search when the user begins typing

Right now you need to hit Ctrl + F to start searching. This patch
additionally makes the
search start as soon as you start typing.

It's a bit slow though, not sure why?

FEATURE: 419716
FIXED-IN: 5.19.0
parent c8eeee48
......@@ -28,11 +28,18 @@ Kirigami.ScrollablePage
{
id: view
property alias model: emojiModel.sourceModel
property string searchText: ""
property alias category: filter.category
property bool showSearch: false
leftPadding: 0
rightPadding: 0
Keys.onPressed: {
if(event.text.length > 0 && !view.showSearch && event.modifiers === Qt.NoModifier) {
window.startSearch(event.text)
}
}
titleDelegate: RowLayout {
Layout.fillWidth: true
Layout.preferredWidth: view.width
......@@ -44,6 +51,7 @@ Kirigami.ScrollablePage
QQC2.TextField {
id: searchField
Layout.fillWidth: true
text: view.searchText
placeholderText: i18n("Search...")
visible: view.showSearch
onTextChanged: {
......
......@@ -50,6 +50,10 @@ Kirigami.ApplicationWindow
window.showPassiveNotification(i18n("%1 copied to the clipboard", thing))
}
function startSearch(typedText) {
window.pageStack.replace(categoryComponent, {title: i18n("Search"), category: "", model: emoji, showSearch: true, searchText: typedText})
}
onVisibilityChanged: {
if (visible)
globalDrawer.actions[recentEmojiModel.count === 0 ? 1 : 0].trigger()
......
Markdown is supported
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