Commit 5c1fc38e authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

emojier: usability improvements when searching

parent 9d0377cb
...@@ -34,9 +34,18 @@ Kirigami.ScrollablePage ...@@ -34,9 +34,18 @@ Kirigami.ScrollablePage
id: searchField id: searchField
Layout.fillWidth: true Layout.fillWidth: true
placeholderText: i18n("Search...") placeholderText: i18n("Search...")
onTextChanged: emojiModel.search = text onTextChanged: {
emojiModel.search = text
if (emojiView.currentIndex < 0) {
emojiView.currentIndex = 0
}
}
onEditingFinished: {
emojiView.currentItem.reportEmoji()
}
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
visible: false visible: false
Keys.onEscapePressed: visible = false
} }
actions.main: Kirigami.Action { actions.main: Kirigami.Action {
...@@ -50,6 +59,7 @@ Kirigami.ScrollablePage ...@@ -50,6 +59,7 @@ Kirigami.ScrollablePage
} }
GridView { GridView {
id: emojiView
cellWidth: 64 cellWidth: 64
cellHeight: cellWidth cellHeight: cellWidth
model: CategoryModelFilter { model: CategoryModelFilter {
...@@ -64,7 +74,6 @@ Kirigami.ScrollablePage ...@@ -64,7 +74,6 @@ Kirigami.ScrollablePage
Kirigami.Theme.colorSet: Kirigami.Theme.Selection Kirigami.Theme.colorSet: Kirigami.Theme.Selection
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor
z: -1 z: -1
visible: ListView.isCurrent
} }
currentIndex: -1 currentIndex: -1
...@@ -81,14 +90,18 @@ Kirigami.ScrollablePage ...@@ -81,14 +90,18 @@ Kirigami.ScrollablePage
opacity: mouse.containsMouse ? 0.7 : 1 opacity: mouse.containsMouse ? 0.7 : 1
Keys.onReturnPressed: { Keys.onReturnPressed: {
mouse.clicked(null) reportEmoji()
}
function reportEmoji() {
window.report(model.display, model.toolTip)
} }
MouseArea { MouseArea {
id: mouse id: mouse
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: window.report(model.display, model.toolTip) onClicked: reportEmoji()
} }
} }
} }
......
...@@ -38,6 +38,8 @@ Kirigami.ApplicationWindow ...@@ -38,6 +38,8 @@ Kirigami.ApplicationWindow
} }
function report(thing, description) { function report(thing, description) {
if (!visible)
return;
console.log("Copied to clipboard:", thing) console.log("Copied to clipboard:", thing)
CopyHelper.copyTextToClipboard(thing) CopyHelper.copyTextToClipboard(thing)
recentEmojiModel.includeRecent(thing, description); recentEmojiModel.includeRecent(thing, description);
......
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