Changeset View
Changeset View
Standalone View
Standalone View
applets/kimpanel/backend/ibus/emojier/ui/CategoryPage.qml
Show All 23 Lines | |||||
24 | import QtQuick.Controls 2.11 as QQC2 | 24 | import QtQuick.Controls 2.11 as QQC2 | ||
25 | import org.kde.plasma.emoji 1.0 | 25 | import org.kde.plasma.emoji 1.0 | ||
26 | 26 | | |||
27 | Kirigami.ScrollablePage | 27 | Kirigami.ScrollablePage | ||
28 | { | 28 | { | ||
29 | id: view | 29 | id: view | ||
30 | property alias model: emojiModel.sourceModel | 30 | property alias model: emojiModel.sourceModel | ||
31 | property alias category: filter.category | 31 | property alias category: filter.category | ||
32 | property bool showSearch: false | ||||
32 | leftPadding: 0 | 33 | leftPadding: 0 | ||
33 | rightPadding: 0 | 34 | rightPadding: 0 | ||
34 | 35 | | |||
35 | actions.main: Kirigami.Action { | | |||
36 | icon.name: "search" | | |||
37 | tooltip: i18n("Search...") | | |||
38 | shortcut: StandardKey.Find | | |||
39 | onTriggered: { | | |||
40 | checked = !checked | | |||
41 | } | | |||
42 | } | | |||
43 | | ||||
44 | titleDelegate: RowLayout { | 36 | titleDelegate: RowLayout { | ||
45 | Layout.fillWidth: true | 37 | Layout.fillWidth: true | ||
46 | Layout.preferredWidth: view.width | 38 | Layout.preferredWidth: view.width | ||
47 | Kirigami.Heading { | 39 | Kirigami.Heading { | ||
48 | text: view.title | 40 | text: view.title | ||
49 | Layout.fillWidth: true | 41 | Layout.fillWidth: true | ||
50 | } | 42 | } | ||
51 | 43 | | |||
52 | QQC2.TextField { | 44 | QQC2.TextField { | ||
53 | id: searchField | 45 | id: searchField | ||
54 | Layout.fillWidth: true | 46 | Layout.fillWidth: true | ||
55 | placeholderText: i18n("Search...") | 47 | placeholderText: i18n("Search...") | ||
48 | visible: view.showSearch | ||||
56 | onTextChanged: { | 49 | onTextChanged: { | ||
57 | emojiModel.search = text | 50 | emojiModel.search = text | ||
58 | if (emojiView.currentIndex < 0) { | 51 | if (emojiView.currentIndex < 0) { | ||
59 | emojiView.currentIndex = 0 | 52 | emojiView.currentIndex = 0 | ||
60 | } | 53 | } | ||
61 | } | 54 | } | ||
62 | onAccepted: { | 55 | onAccepted: { | ||
63 | if (emojiView.currentItem) | 56 | if (emojiView.currentItem) | ||
64 | emojiView.currentItem.reportEmoji() | 57 | emojiView.currentItem.reportEmoji() | ||
65 | } | 58 | } | ||
66 | visible: view.actions.main.checked | 59 | Component.onCompleted: if (visible) Qt.callLater(forceActiveFocus) | ||
67 | onVisibleChanged: if (visible) forceActiveFocus() | | |||
68 | Keys.onEscapePressed: { | 60 | Keys.onEscapePressed: { | ||
69 | text = "" | 61 | selectAll() | ||
70 | view.actions.main.checked = false | | |||
71 | } | 62 | } | ||
72 | } | 63 | } | ||
73 | } | 64 | } | ||
74 | 65 | | |||
75 | GridView { | 66 | GridView { | ||
76 | id: emojiView | 67 | id: emojiView | ||
77 | 68 | | |||
78 | readonly property real desiredSize: Kirigami.Units.gridUnit * 3 | 69 | readonly property real desiredSize: Kirigami.Units.gridUnit * 3 | ||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |