From ecc94ef48a0b500ca764775bfe9c47bde376a2f5 Mon Sep 17 00:00:00 2001 From: MrMirDan Date: Tue, 23 Dec 2025 14:10:19 +0200 Subject: [PATCH] update: text and some fixes --- .../ui/controllers/settingsUiController.cpp | 4 - .../ui/qml/Components/EncryptionIndicator.qml | 33 +++---- client/ui/qml/Components/PasswordDrawer.qml | 6 +- .../Pages2/PageSettingsApiNativeConfigs.qml | 1 + .../qml/Pages2/PageSettingsAppEncryption.qml | 85 +++++++++++++------ .../ui/qml/Pages2/PageSettingsAppPassword.qml | 34 +++++++- .../Pages2/PageSettingsAppPasswordConfirm.qml | 4 +- .../ui/qml/Pages2/PageSettingsApplication.qml | 4 +- client/ui/qml/Pages2/PageSettingsBackup.qml | 3 +- client/ui/qml/Pages2/PageShare.qml | 1 + 10 files changed, 119 insertions(+), 56 deletions(-) diff --git a/client/ui/controllers/settingsUiController.cpp b/client/ui/controllers/settingsUiController.cpp index 023fb9512..3e49ac247 100644 --- a/client/ui/controllers/settingsUiController.cpp +++ b/client/ui/controllers/settingsUiController.cpp @@ -110,8 +110,6 @@ void SettingsUiController::exportLogsFile(const QString &fileName) if (!SystemController::saveFile(fileName, Logger::getLogFile())) { qInfo() << "SettingsUiController::exportLogsFile: save or share was cancelled or failed"; } - if (isFileEncryptionEnabled()) - SystemController::encryptFile(fileName, getPassword(), getHint()); #endif } @@ -123,8 +121,6 @@ void SettingsUiController::exportServiceLogsFile(const QString &fileName) if (!SystemController::saveFile(fileName, Logger::getServiceLogFile())) { qInfo() << "SettingsUiController::exportServiceLogsFile: save or share was cancelled or failed"; } - if (isFileEncryptionEnabled()) - SystemController::encryptFile(fileName, getPassword(), getHint()); #endif } diff --git a/client/ui/qml/Components/EncryptionIndicator.qml b/client/ui/qml/Components/EncryptionIndicator.qml index ca4c29a72..35883c7c1 100644 --- a/client/ui/qml/Components/EncryptionIndicator.qml +++ b/client/ui/qml/Components/EncryptionIndicator.qml @@ -7,12 +7,13 @@ import Style 1.0 import "../Controls2" import "../Controls2/TextTypes" - import "../Config" Rectangle { id: root + property bool linkEnabled: false + property string textColor: AmneziaStyle.color.paleGray property string textString @@ -33,23 +34,15 @@ Rectangle { RowLayout { id: content - width: parent.width - anchors.fill: parent - - anchors.leftMargin: content.width / 4 - anchors.rightMargin: content.width / 4 - anchors.topMargin: 4 - anchors.bottomMargin: 4 + anchors.centerIn: parent spacing: 0 Image { - Layout.alignment: Qt.AlignTop + width: root.iconWidth + height: root.iconHeight - width: iconWidth - height: iconHeight - - source: iconPath + source: root.iconPath } CaptionTextType { @@ -58,9 +51,17 @@ Rectangle { Layout.fillWidth: true Layout.leftMargin: 8 - text: textString - textFormat: root.textFormat - color: textColor + text: root.linkEnabled ? root.textString + + qsTr(" Learn more").arg(AmneziaStyle.color.goldenApricot) + : root.textString + textFormat: Text.RichText + color: root.textColor + + onLinkActivated: function(link) { + if (link === "learnMore") { + console.log("Learn more pressed") + } + } } } } \ No newline at end of file diff --git a/client/ui/qml/Components/PasswordDrawer.qml b/client/ui/qml/Components/PasswordDrawer.qml index 22bade27d..55b8f4e9b 100644 --- a/client/ui/qml/Components/PasswordDrawer.qml +++ b/client/ui/qml/Components/PasswordDrawer.qml @@ -54,7 +54,7 @@ DrawerType2 { Layout.fillWidth: true Layout.bottomMargin: 8 - text: qsTr("Enter password to continue") + text: qsTr("Password required") } TextFieldWithHeaderType { @@ -110,12 +110,12 @@ DrawerType2 { clickedFunc: function() { if (fromOutside) { if (!SystemController.isPasswordValid(fileName, passwordField.textField.text)) { - passwordField.errorText = qsTr("Incorrect password") + passwordField.errorText = qsTr("Invalid password") return } } else { if (passwordField.textField.text !== SettingsController.getPassword()) { - passwordField.errorText = qsTr("Incorrect password") + passwordField.errorText = qsTr("Invalid password") return } } diff --git a/client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml b/client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml index d96f71a86..3b5daddc9 100644 --- a/client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml +++ b/client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml @@ -65,6 +65,7 @@ PageType { id: indicator visible: SettingsController.isFileEncryptionEnabled() + linkEnabled: true textString: qsTr("Encryption enabled. Learn more") iconPath: "qrc:/images/controls/lock-locked.svg" diff --git a/client/ui/qml/Pages2/PageSettingsAppEncryption.qml b/client/ui/qml/Pages2/PageSettingsAppEncryption.qml index d9137d46e..a24b9f423 100644 --- a/client/ui/qml/Pages2/PageSettingsAppEncryption.qml +++ b/client/ui/qml/Pages2/PageSettingsAppEncryption.qml @@ -22,8 +22,9 @@ PageType { function onFileEncryptionStateChanged() { PageController.showBusyIndicator(true) PageController.closePage() - PageController.goToPage(PageEnum.PageSettingsAppEncryption) + SettingsController.isFileEncryptionEnabled() ? PageController.goToPage(PageEnum.PageSettingsAppEncryption) : PageController.goToPage(PageEnum.PageSettingsAppPassword) PageController.showBusyIndicator(false) + PageController.showNotificationMessage(SettingsController.isFileEncryptionEnabled() ? qsTr("Encryption enabled") : qsTr("Encryption disabled")) } } @@ -64,33 +65,56 @@ PageType { Layout.fillWidth: true Layout.leftMargin: 16 Layout.rightMargin: 16 - Layout.bottomMargin: 16 - headerText: qsTr("File encryption") - descriptionText: qsTr("For encrypting backups, configuration files, subscription keys, and logs") + headerText: qsTr("Password & Encryption") + descriptionText: qsTr("Password protection for backups and configuration files.\nRequired to restore or import encrypted files.") + } + + BasicButtonType { + Layout.leftMargin: 8 + Layout.bottomMargin: 16 + implicitHeight: 16 + + defaultColor: AmneziaStyle.color.transparent + hoveredColor: AmneziaStyle.color.translucentWhite + pressedColor: AmneziaStyle.color.sheerWhite + disabledColor: AmneziaStyle.color.mutedGray + textColor: AmneziaStyle.color.goldenApricot + + text: qsTr("Learn more") + + clickedFunc: function() { + // TODO: add link + } } EncryptionIndicator { id: indicator - textString: SettingsController.isFileEncryptionEnabled() ? qsTr("Password set. Encryption on") : qsTr("Password not set. Encryption off") - iconPath: SettingsController.isFileEncryptionEnabled() ? "qrc:/images/controls/lock-locked.svg" : "qrc:/images/controls/lock-unlocked.svg" + textString: qsTr("Password set. Encryption enabled") + iconPath: "qrc:/images/controls/lock-locked.svg" } BasicButtonType { - id: switchEncryptionButton + id: disableEncryptionButton Layout.fillWidth: true Layout.topMargin: 16 Layout.leftMargin: 16 Layout.rightMargin: 16 - text: SettingsController.isFileEncryptionEnabled() ? qsTr("Turn off encryption") : qsTr("Turn on encryption") + text: qsTr("Disable encryption") clickedFunc: function() { - SettingsController.isFileEncryptionEnabled() ? SettingsController.toggleFileEncryption(false) - : SettingsController.toggleFileEncryption(true) + passwordDrawer.securedFunc = function() { + PageController.showBusyIndicator(true) + SettingsController.toggleFileEncryption(false) + SettingsController.setPassword("") + SettingsController.setHint("") + PageController.showBusyIndicator(false) + } + passwordDrawer.openTriggered() } } @@ -109,9 +133,17 @@ PageType { text: qsTr("Change password") - signal changingPassword - clickedFunc: function() { + passwordDrawer.securedFunc = function() { + root.isChangingPassword = true + + PageController.showBusyIndicator(true) + PageController.closePage() + PageController.goToPage(PageEnum.PageSettingsAppPassword) + PageController.showBusyIndicator(false) + + SettingsController.changingPassword() + } passwordDrawer.openTriggered() } } @@ -125,17 +157,6 @@ PageType { anchors.fill: parent expandedHeight: root.height * 0.45 - - securedFunc: function() { - root.isChangingPassword = true - - PageController.showBusyIndicator(true) - PageController.closePage() - PageController.goToPage(PageEnum.PageSettingsAppPassword) - PageController.showBusyIndicator(false) - - SettingsController.changingPassword() - } } } @@ -143,8 +164,24 @@ PageType { footer: ColumnLayout { width: listView.width + CaptionTextType { + Layout.fillWidth: true + Layout.topMargin: 16 - // TODO: add text + horizontalAlignment: Text.AlignHCenter + textFormat: Text.RichText + + text: qsTr("If the password is forgotten, it can be recovered. To reset the password, " + + "settings must be reset." + + "\nEncrypted files can only be opened with password used to encrypt them").arg(AmneziaStyle.color.goldenApricot) + color: AmneziaStyle.color.mutedGray + + onLinkActivated: function(link) { + if (link === "appSettings") { + PageController.closePage() + } + } + } } } } \ No newline at end of file diff --git a/client/ui/qml/Pages2/PageSettingsAppPassword.qml b/client/ui/qml/Pages2/PageSettingsAppPassword.qml index ae05a3423..b96e61bea 100644 --- a/client/ui/qml/Pages2/PageSettingsAppPassword.qml +++ b/client/ui/qml/Pages2/PageSettingsAppPassword.qml @@ -61,11 +61,37 @@ PageType { Layout.fillWidth: true Layout.leftMargin: 16 Layout.rightMargin: 16 - Layout.bottomMargin: 16 - headerText: root.isChangingPassword ? qsTr("Password changing") : qsTr("File encryption") - descriptionText: root.isChangingPassword ? qsTr("Files encrypted with old password will stay encrypted with old password") - : qsTr("For encrypting backups, configuration files, subscription keys, and logs") + headerText: root.isChangingPassword ? qsTr("Change password") : qsTr("Password & Encryption") + descriptionText: root.isChangingPassword ? qsTr("Existing encrypted files will still require the old password.\nThe new password will be used for new encrypted files.") + : qsTr("Password protection for backups and configuration files.\nRequired to restore or import encrypted files.") + } + + BasicButtonType { + Layout.leftMargin: 8 + Layout.bottomMargin: 16 + implicitHeight: 16 + + defaultColor: AmneziaStyle.color.transparent + hoveredColor: AmneziaStyle.color.translucentWhite + pressedColor: AmneziaStyle.color.sheerWhite + disabledColor: AmneziaStyle.color.mutedGray + textColor: AmneziaStyle.color.goldenApricot + + text: qsTr("Learn more") + + clickedFunc: function() { + // TODO: add link + } + } + + EncryptionIndicator { + id: indicator + + visible: !root.isChangingPassword + + textString: qsTr("Password not set. Encryption disabled") + iconPath: "qrc:/images/controls/lock-unlocked.svg" } } diff --git a/client/ui/qml/Pages2/PageSettingsAppPasswordConfirm.qml b/client/ui/qml/Pages2/PageSettingsAppPasswordConfirm.qml index 52886b62c..cd282f148 100644 --- a/client/ui/qml/Pages2/PageSettingsAppPasswordConfirm.qml +++ b/client/ui/qml/Pages2/PageSettingsAppPasswordConfirm.qml @@ -55,8 +55,8 @@ PageType { Layout.rightMargin: 16 headerText: root.isChangingPassword ? qsTr("Confirm new password") : qsTr("Confirm password") - descriptionText: qsTr("If you forget your password, you'll have to reset all app settings to reset it." - + " Encrypted files will remain encrypted") + descriptionText: root.isChangingPassword ? qsTr("") : qsTr("If you forget your password, you'll have to reset all app settings to reset it." + + " Encrypted files will remain encrypted") } } diff --git a/client/ui/qml/Pages2/PageSettingsApplication.qml b/client/ui/qml/Pages2/PageSettingsApplication.qml index bb1f9f49c..1d4921844 100644 --- a/client/ui/qml/Pages2/PageSettingsApplication.qml +++ b/client/ui/qml/Pages2/PageSettingsApplication.qml @@ -218,8 +218,8 @@ PageType { Layout.fillWidth: true - text: qsTr("File encryption") - descriptionText: qsTr("For encrypting backups, configuration files, subscription keys, and logs") + text: qsTr("Password & Encryption") + descriptionText: qsTr("Password protection for backups and configuration files") rightImageSource: "qrc:/images/controls/chevron-right.svg" clickedFunction: function() { diff --git a/client/ui/qml/Pages2/PageSettingsBackup.qml b/client/ui/qml/Pages2/PageSettingsBackup.qml index 7c798ded4..4b3cbf0bc 100644 --- a/client/ui/qml/Pages2/PageSettingsBackup.qml +++ b/client/ui/qml/Pages2/PageSettingsBackup.qml @@ -72,8 +72,9 @@ PageType { id: indicator visible: SettingsController.isFileEncryptionEnabled() + linkEnabled: true - textString: qsTr("Encryption enabled. Learn more") + textString: qsTr("Encryption enabled.") iconPath: "qrc:/images/controls/lock-locked.svg" } } diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml index 56845df30..bacde37d7 100644 --- a/client/ui/qml/Pages2/PageShare.qml +++ b/client/ui/qml/Pages2/PageShare.qml @@ -275,6 +275,7 @@ PageType { id: indicator visible: SettingsController.isFileEncryptionEnabled() + linkEnabled: true textString: qsTr("Encryption enabled. Learn more") iconPath: "qrc:/images/controls/lock-locked.svg"