From 7458507c9bcdec782ae69cdbadd8a006c3facf3b Mon Sep 17 00:00:00 2001 From: Quentin Rouland Date: Sat, 16 Mar 2019 10:08:41 +0100 Subject: [PATCH] Add search bar --- po/utpass.qrouland.pot | 24 ++++++++++++------------ qml/components/Search.qml | 12 ++++++++++++ qml/components/qmldir | 3 ++- qml/pages/headers/MainHeader.qml | 29 ++++++++++++++++++++++------- qml/pages/headers/StackHeader.qml | 11 +++++++++++ 5 files changed, 59 insertions(+), 20 deletions(-) create mode 100644 qml/components/Search.qml diff --git a/po/utpass.qrouland.pot b/po/utpass.qrouland.pot index 35f663e..94db92e 100644 --- a/po/utpass.qrouland.pot +++ b/po/utpass.qrouland.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: utpass.qrouland\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-03-15 17:28+0000\n" +"POT-Creation-Date: 2019-03-16 09:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,8 +17,9 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../qml/pages/Settings.qml:8 ../qml/pages/headers/MainHeader.qml:28 -msgid "Settings" +#: ../qml/components/Search.qml:6 ../qml/pages/headers/MainHeader.qml:23 +#: ../qml/pages/headers/MainHeader.qml:36 +msgid "Search" msgstr "" #: ../qml/pages/PasswordList.qml:17 @@ -29,20 +30,19 @@ msgstr "" msgid "No password found in the current folder" msgstr "" -#: ../qml/pages/Info.qml:9 ../qml/pages/headers/MainHeader.qml:35 -msgid "Info" +#: ../qml/pages/Settings.qml:8 ../qml/pages/headers/MainHeader.qml:44 +msgid "Settings" msgstr "" -#: ../qml/pages/Info.qml:43 ../qml/pages/headers/MainHeader.qml:8 -#: ../qml/pages/headers/StackHeader.qml:7 UTPass.desktop.in.h:1 +#: ../qml/pages/headers/MainHeader.qml:8 ../qml/pages/headers/StackHeader.qml:8 +#: ../qml/pages/Info.qml:43 UTPass.desktop.in.h:1 msgid "UTPass" msgstr "" +#: ../qml/pages/headers/MainHeader.qml:51 ../qml/pages/Info.qml:9 +msgid "Info" +msgstr "" + #: ../qml/pages/Info.qml:53 msgid "Suggest improvement(s) or report a bug(s)" msgstr "" - -#: ../qml/pages/headers/MainHeader.qml:15 -#: ../qml/pages/headers/MainHeader.qml:19 -msgid "Search" -msgstr "" diff --git a/qml/components/Search.qml b/qml/components/Search.qml new file mode 100644 index 0000000..24a5231 --- /dev/null +++ b/qml/components/Search.qml @@ -0,0 +1,12 @@ +import QtQuick 2.4 + +Item { + TextField { + id: searchBar + placeholderText: i18n.tr("Search") + height: units.gu(4) + visible: false + anchors.verticalCenter: parent.verticalCenter + } + Component.onCompleted: ; +} diff --git a/qml/components/qmldir b/qml/components/qmldir index dc821f9..75a27c8 100644 --- a/qml/components/qmldir +++ b/qml/components/qmldir @@ -1,2 +1,3 @@ FileDir 1.0 FileDir.qml -Link 1.0 Link.qml \ No newline at end of file +Link 1.0 Link.qml +Search 1.0 Search.qml \ No newline at end of file diff --git a/qml/pages/headers/MainHeader.qml b/qml/pages/headers/MainHeader.qml index a9061ee..289206a 100644 --- a/qml/pages/headers/MainHeader.qml +++ b/qml/pages/headers/MainHeader.qml @@ -7,6 +7,26 @@ PageHeader { height: units.gu(6) title: i18n.tr("UTPass") + contents: Item { + height : parent.height + width: parent.width + Label { + id : labelTitle + text: mainHeader.title + anchors.verticalCenter: parent.verticalCenter + visible: true + } + TextField { + id: searchBar + anchors.right : parent.right + anchors.left : parent.left + placeholderText: i18n.tr("Search") + height: units.gu(4) + visible: false + anchors.verticalCenter: parent.verticalCenter + } + } + trailingActionBar.height: units.gu(4) trailingActionBar.numberOfSlots: 2 trailingActionBar.actions: [ @@ -14,13 +34,8 @@ PageHeader { iconName: "search" text: i18n.tr("Search") onTriggered: { - mainHeader.contents = TextField { - id: searchBar - placeholderText: i18n.tr("Search") - height: units.gu(4) - visible: false - anchors.verticalCenter: parent.verticalCenter - } + searchBar.visible = searchBar.visible ? false : true; + labelTitle.visible = labelTitle.visible ? false : true; } }, Action { diff --git a/qml/pages/headers/StackHeader.qml b/qml/pages/headers/StackHeader.qml index a274986..5ac1c74 100644 --- a/qml/pages/headers/StackHeader.qml +++ b/qml/pages/headers/StackHeader.qml @@ -2,10 +2,21 @@ import QtQuick 2.4 import Ubuntu.Components 1.3 PageHeader { + id: stackHeader width: parent.width height: units.gu(6) title: i18n.tr("UTPass") + contents: Item { + height : parent.height + width: parent.width + Label { + id : labelTitle + text: stackHeader.title + anchors.verticalCenter: parent.verticalCenter + } + } + leadingActionBar.height: units.gu(4) leadingActionBar.actions: [ Action {