From 7a4712932a1a2916bc769b4e94ee72979d0086de Mon Sep 17 00:00:00 2001 From: Joan CiberSheep Date: Sat, 30 Nov 2019 04:04:19 +0100 Subject: [PATCH] Small Fix for Theme Changer --- qml/Components/ChooserLength.qml | 1 + qml/Components/ChooserTheme.qml | 21 ++++++- qml/Components/ExpandableListItem.qml | 7 +++ qml/Components/KeyToEdit.qml | 84 ++++++++++++++------------- qml/Components/PageEditAddKey.qml | 8 +-- qml/Components/PageSettings.qml | 4 +- 6 files changed, 76 insertions(+), 49 deletions(-) diff --git a/qml/Components/ChooserLength.qml b/qml/Components/ChooserLength.qml index ea84fe8..363d6c3 100644 --- a/qml/Components/ChooserLength.qml +++ b/qml/Components/ChooserLength.qml @@ -46,6 +46,7 @@ Item { title.text: model.text icon.name: "ok" icon.visible: selectedLeng === model.text + onClicked: { selectedLeng = model.text; lengSetting.toggleExpansion(); diff --git a/qml/Components/ChooserTheme.qml b/qml/Components/ChooserTheme.qml index fd2eae6..a082049 100644 --- a/qml/Components/ChooserTheme.qml +++ b/qml/Components/ChooserTheme.qml @@ -31,6 +31,8 @@ Item { ? "Ambiance" : "Suru Dark" + property string themeToBe + ListModel { id: themeModel Component.onCompleted: initialize() @@ -44,19 +46,34 @@ Item { ExpandableListItem { id: themeSetting - listViewHeight: themeModel.count*units.gu(6.1) + listViewHeight: themeModel.count * units.gu(6.1) model: themeModel title.text: selectedTheme delegate: StandardListItem { + id: rrr title.text: model.text icon.name: "ok" icon.visible: selectedTheme === model.text + onClicked: { + themeToBe = model.theme; selectedTheme = model.text; - theming.themeName = model.theme; themeSetting.toggleExpansion(); + themeTimer.start() } } } + + Timer { + id: themeTimer + //intervall needs to be a minimum of 200, otherwise toggleExpansion is not entirely finished + interval: 175 + running: false + repeat: false + + onTriggered: { + theming.themeName = themeToBe + } + } } diff --git a/qml/Components/ExpandableListItem.qml b/qml/Components/ExpandableListItem.qml index afb997e..da71465 100644 --- a/qml/Components/ExpandableListItem.qml +++ b/qml/Components/ExpandableListItem.qml @@ -42,6 +42,7 @@ ListItem { height: expandableHeader.height + divider.height divider.visible: false expansion.height: contentColumn.height + onClicked: toggleExpansion() function toggleExpansion() { @@ -89,5 +90,11 @@ ListItem { delegate: expandableListItem.delegate } } + + Connections { + target: bottomEdge + + onCollapseStarted: expansion.expanded = false; + } } diff --git a/qml/Components/KeyToEdit.qml b/qml/Components/KeyToEdit.qml index 9905539..91a6a9a 100644 --- a/qml/Components/KeyToEdit.qml +++ b/qml/Components/KeyToEdit.qml @@ -112,59 +112,65 @@ Column { } } - Row { + Column { width: parent.width - spacing: units.gu(2) - Text { - anchors.top:parent.top - anchors.topMargin: units.gu(2) - id: algTxt - text: i18n.tr("Algorithm") - color: theme.palette.normal.overlayText - } + Row { + width: parent.width + spacing: units.gu(2) - ListItem { - id: algTF - width: parent.width - units.gu(2) - algTxt.width - height: cAlg.height > 0 ? cAlg.height : units.gu(7) - divider.visible: false + Text { + anchors.top: parent.top + anchors.topMargin: units.gu(2) + id: algTxt + text: i18n.tr("Algorithm") + color: theme.palette.normal.overlayText + } - property string algorithm: "SHA1" + ListItem { + id: algTF + width: parent.width - units.gu(2) - algTxt.width + height: cAlg.height > 0 ? cAlg.height : units.gu(7) + divider.visible: false - ChooserAlgorithm { - id: cAlg - width: parent.width + property string algorithm: "SHA1" + + ChooserAlgorithm { + id: cAlg + width: parent.width - onSelectedAlgChanged: algTF.algorithm = selectedAlg + onSelectedAlgChanged: algTF.algorithm = selectedAlg + } } } - } - Row { - width: parent.width - spacing: units.gu(2) - Text { - anchors.verticalCenter: parent.verticalCenter - id: passLenTxt - text: i18n.tr("Password Length") - color: theme.palette.normal.overlayText - } + Row { + width: parent.width + spacing: units.gu(2) - ListItem { - id: lengTF - width: parent.width - units.gu(2) - passLenTxt.width - height: cLeng.height > 0 ? cLeng.height : units.gu(7) - divider.visible: false + Text { + anchors.top: parent.top + anchors.topMargin: units.gu(2) + id: passLenTxt + text: i18n.tr("Password Length") + color: theme.palette.normal.overlayText + } - property string passwordLength: "6" + ListItem { + id: lengTF + width: parent.width - units.gu(2) - passLenTxt.width + height: cLeng.height > 0 ? cLeng.height : units.gu(7) + divider.visible: false - ChooserLength { - id: cLeng - width: parent.width + property string passwordLength: "6" + + ChooserLength { + id: cLeng + width: parent.width - onSelectedLengChanged: lengTF.passwordLength = selectedLeng + onSelectedLengChanged: lengTF.passwordLength = selectedLeng + } } } } diff --git a/qml/Components/PageEditAddKey.qml b/qml/Components/PageEditAddKey.qml index 60d1a0c..ffc4440 100644 --- a/qml/Components/PageEditAddKey.qml +++ b/qml/Components/PageEditAddKey.qml @@ -11,16 +11,10 @@ Page { id: editAddKeyPage property var uriJson - /* - property string authType: keyPeriod.visible - ? "TOTP" - : "HTOP"*/ - //title: i18n.tr("Add Authenticator Key") - //text: i18n.tr("%1 authenticator key").arg(authType) + header: HeaderBase { id: pageHeader title: i18n.tr("Key Information") - //flickable: editAddFlickable } ScrollView { diff --git a/qml/Components/PageSettings.qml b/qml/Components/PageSettings.qml index 95489be..8448e7c 100644 --- a/qml/Components/PageSettings.qml +++ b/qml/Components/PageSettings.qml @@ -49,7 +49,9 @@ Page { ListItem { id: themeTF width: parent.width - height: cTheme.height > 0 ? cTheme.height : units.gu(7) + height: cTheme.height > 0 + ? cTheme.height + : units.gu(7) divider.visible: false property string themeName: "TOTP" -- GitLab