Changeset View
Changeset View
Standalone View
Standalone View
sidebar/package/contents/ui/CategoriesPage.qml
Show All 14 Lines | 1 | /* | |||
---|---|---|---|---|---|
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
16 | Boston, MA 02110-1301, USA. | 16 | Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.3 | 19 | import QtQuick 2.3 | ||
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Controls 1.0 as QtControls | 21 | import QtQuick.Controls 1.0 as QtControls | ||
22 | import QtQuick.Controls 2.0 as QtControls2 | 22 | import QtQuick.Controls 2.0 as QtControls2 | ||
23 | import org.kde.kirigami 2.1 as Kirigami | 23 | import org.kde.kirigami 2.7 as Kirigami | ||
24 | 24 | | |||
25 | 25 | | |||
26 | Kirigami.ScrollablePage { | 26 | Kirigami.ScrollablePage { | ||
27 | id: mainColumn | 27 | id: mainColumn | ||
28 | Component.onCompleted: searchField.forceActiveFocus() | 28 | Component.onCompleted: searchField.forceActiveFocus() | ||
29 | 29 | | |||
30 | header: Rectangle { | 30 | header: Rectangle { | ||
31 | color: Kirigami.Theme.backgroundColor | 31 | color: Kirigami.Theme.backgroundColor | ||
Show All 13 Lines | 41 | QtControls.ToolButton { | |||
45 | Layout.maximumHeight: width | 45 | Layout.maximumHeight: width | ||
46 | Keys.onBacktabPressed: { | 46 | Keys.onBacktabPressed: { | ||
47 | root.focusPreviousRequest() | 47 | root.focusPreviousRequest() | ||
48 | } | 48 | } | ||
49 | menu: ActionMenu { | 49 | menu: ActionMenu { | ||
50 | actions: ["configure", "help_contents", "help_about_app", "help_about_kde"] | 50 | actions: ["configure", "help_contents", "help_about_app", "help_about_kde"] | ||
51 | } | 51 | } | ||
52 | } | 52 | } | ||
53 | QtControls2.TextField { | 53 | Kirigami.ActionTextField { | ||
54 | id: searchField | 54 | id: searchField | ||
55 | focus: true | 55 | focus: true | ||
56 | Layout.minimumHeight: Layout.maximumHeight | 56 | Layout.minimumHeight: Layout.maximumHeight | ||
57 | Layout.maximumHeight: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 | 57 | Layout.maximumHeight: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 | ||
58 | Layout.fillWidth: true | 58 | Layout.fillWidth: true | ||
59 | placeholderText: i18n("Search...") | 59 | placeholderText: i18n("Search...") | ||
60 | onTextChanged: { | 60 | onTextChanged: { | ||
61 | systemsettings.categoryModel.filterRegExp = text; | 61 | systemsettings.categoryModel.filterRegExp = text; | ||
62 | } | 62 | } | ||
63 | MouseArea { | 63 | rightActions: [ | ||
64 | anchors { | 64 | Kirigami.Action { | ||
65 | right: parent.right | 65 | iconName: LayoutMirroring.enabled ? "edit-clear-rtl" : "edit-clear" | ||
66 | verticalCenter: parent.verticalCenter | 66 | visible: searchField.text.length !== 0 | ||
67 | rightMargin: y | 67 | onTriggered: searchField.text = "" | ||
68 | } | | |||
69 | opacity: searchField.text.length > 0 ? 1 : 0 | | |||
70 | width: Kirigami.Units.iconSizes.small | | |||
71 | height: width | | |||
72 | onClicked: searchField.text = "" | | |||
73 | Kirigami.Icon { | | |||
74 | anchors.fill: parent | | |||
75 | source: LayoutMirroring.enabled ? "edit-clear-rtl" : "edit-clear" | | |||
76 | } | | |||
77 | Behavior on opacity { | | |||
78 | OpacityAnimator { | | |||
79 | duration: Kirigami.Units.longDuration | | |||
80 | easing.type: Easing.InOutQuad | | |||
81 | } | | |||
82 | } | | |||
83 | } | 68 | } | ||
69 | ] | ||||
84 | } | 70 | } | ||
85 | } | 71 | } | ||
86 | Kirigami.Separator { | 72 | Kirigami.Separator { | ||
87 | anchors { | 73 | anchors { | ||
88 | left: parent.left | 74 | left: parent.left | ||
89 | right: parent.right | 75 | right: parent.right | ||
90 | top: parent.bottom | 76 | top: parent.bottom | ||
91 | } | 77 | } | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |