update: text and some fixes

This commit is contained in:
MrMirDan
2025-12-23 14:10:19 +02:00
parent 4c082654f9
commit 452150bfff
10 changed files with 119 additions and 56 deletions

View File

@@ -123,8 +123,6 @@ void SettingsController::exportLogsFile(const QString &fileName)
AndroidController::instance()->exportLogsFile(fileName);
#else
SystemController::saveFile(fileName, Logger::getLogFile());
if (m_settings->isFileEncryption())
SystemController::encryptFile(fileName, m_settings->getPassword(), m_settings->getHint());
#endif
}
@@ -134,8 +132,6 @@ void SettingsController::exportServiceLogsFile(const QString &fileName)
AndroidController::instance()->exportLogsFile(fileName);
#else
SystemController::saveFile(fileName, Logger::getServiceLogFile());
if (m_settings->isFileEncryption())
SystemController::encryptFile(fileName, m_settings->getPassword(), m_settings->getHint());
#endif
}

View File

@@ -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(" <a href=\"learnMore\" style=\"text-decoration:none; color:%1\">Learn more</a>").arg(AmneziaStyle.color.goldenApricot)
: root.textString
textFormat: Text.RichText
color: root.textColor
onLinkActivated: function(link) {
if (link === "learnMore") {
console.log("Learn more pressed")
}
}
}
}
}

View File

@@ -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
}
}

View File

@@ -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"

View File

@@ -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, "
+ "<a href=\"appSettings\" style=\"text-decoration:none; color:%1;\">settings must be reset</a>."
+ "\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()
}
}
}
}
}
}

View File

@@ -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"
}
}

View File

@@ -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")
}
}

View File

@@ -195,8 +195,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() {

View File

@@ -76,8 +76,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"
}
}

View File

@@ -298,6 +298,7 @@ PageType {
id: indicator
visible: SettingsController.isFileEncryptionEnabled()
linkEnabled: true
textString: qsTr("Encryption enabled. Learn more")
iconPath: "qrc:/images/controls/lock-locked.svg"