Verified Commit 5af99607 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Move everything to the settings which makes sense there

* Add the necessary infrastructure to support multi page settings
parent b9e01331
Pipeline #25362 passed with stages
in 26 minutes and 6 seconds
......@@ -49,23 +49,6 @@ Kirigami.Page {
topPadding: 0
bottomPadding: 0
contextualActions: [
// action to open a page for removing the password from the QR code or
// from the plain text view
Kirigami.Action {
text: qsTr("Remove password")
icon.name: "delete"
visible: Kaidan.passwordVisibility !== Kaidan.PasswordInvisible
onTriggered: {
if (Kaidan.passwordVisibility === Kaidan.PasswordVisible)
pageStack.layers.push(passwordRemovalPage)
else
pageStack.layers.push(passwordRemovalFromPlainTextAndQrCodeConfirmationPage)
}
}
]
QrCodeGenerator {
id: qrCodeGenerator
}
......
......@@ -91,18 +91,13 @@ Kirigami.GlobalDrawer {
}
},
Kirigami.Action {
text: qsTr("Transfer account")
text: qsTr("Switch device")
icon.name: "send-to-symbolic"
onTriggered: {
pageStack.layers.push(accountTransferPage)
pageStack.layers.push("AccountTransfer.qml")
}
},
Kirigami.Action {
text: qsTr("Delete account")
icon.name: "delete"
onTriggered: Kaidan.serverFeaturesCache.inBandRegistrationSupported ? pageStack.layers.push(accountDeletionPage) : pageStack.layers.push(accountDeletionFromClientConfirmationPage)
},
Kirigami.Action {
text: qsTr("Settings")
icon.name: "settings-configure"
......
......@@ -187,8 +187,8 @@ Kirigami.Page {
sourceSize.height: parent.height
visible: explanation.visible
fillMode: Image.PreserveAspectFit
Layout.fillWidth: true
Layout.fillHeight: true
Layout.fillWidth: true
}
// placeholder for the explanation text and image when they are invisible
......
......@@ -77,6 +77,7 @@ Kirigami.Page {
label.text: topAction.text
icon.name: topAction.icon.name
onClicked: topAction.trigger()
enabled: topAction.enabled
}
// button for the top action as main action
......@@ -85,6 +86,7 @@ Kirigami.Page {
label.text: topAction.text
icon.name: topAction.icon.name
onClicked: topAction.trigger()
enabled: topAction.enabled
}
// horizontal line to separate the two actions
......@@ -99,6 +101,7 @@ Kirigami.Page {
label.text: bottomAction.text
icon.name: bottomAction.icon.name
onClicked: bottomAction.trigger()
enabled: bottomAction.enabled
}
// description for the bottom action
......
......@@ -42,8 +42,10 @@ BinaryDecisionPage {
bottomImageSource: "dialog-cancel"
topActionAsMainAction: true
signal canceled
bottomAction: Kirigami.Action {
text: qsTr("Cancel")
onTriggered: pageStack.layers.pop()
onTriggered: canceled()
}
}
......@@ -35,7 +35,6 @@ import StatusBar 0.1
import im.kaidan.kaidan 1.0
import "account-transfer"
import "elements"
import "registration"
import "settings"
......@@ -51,6 +50,10 @@ Kirigami.ApplicationWindow {
readonly property int largeButtonWidth: Kirigami.Units.gridUnit * 25
// This is an alias for use in settings ONLY
// it is only used on mobile, on desktop another item overrides the id "stack"
property QtObject stack: pageStack.layers
StatusBar {
color: Material.Material.color(Material.Material.Green, Material.Material.Shade700)
}
......@@ -90,13 +93,6 @@ Kirigami.ApplicationWindow {
Component {id: settingsPage; SettingsPage {}}
Component {id: qrCodeScannerPage; QrCodeScannerPage {}}
Component {id: userProfilePage; UserProfilePage {}}
Component {id: accountTransferPage; AccountTransferPage {}}
Component {id: passwordRemovalPage; PasswordRemovalPage {}}
Component {id: passwordRemovalFromPlainTextConfirmationPage; PasswordRemovalFromPlainTextConfirmationPage {}}
Component {id: passwordRemovalFromPlainTextAndQrCodeConfirmationPage; PasswordRemovalFromPlainTextAndQrCodeConfirmationPage {}}
Component {id: accountDeletionPage; AccountDeletionPage {}}
Component {id: accountDeletionFromClientConfirmationPage; AccountDeletionFromClientConfirmationPage {}}
Component {id: accountDeletionFromClientAndServerConfirmationPage; AccountDeletionFromClientAndServerConfirmationPage {}}
function raiseWindow() {
if (!active) {
......
<RCC>
<qresource prefix="/qml/">
<file>AccountTransferPage.qml</file>
<file>main.qml</file>
<file>StartPage.qml</file>
<file>RegistrationLoginDecisionPage.qml</file>
......@@ -12,14 +13,6 @@
<file>GlobalDrawer.qml</file>
<file>QrCodeScannerPage.qml</file>
<file>UserProfilePage.qml</file>
<file>AccountDeletionPage.qml</file>
<file>AccountDeletionFromClientConfirmationPage.qml</file>
<file>AccountDeletionFromClientAndServerConfirmationPage.qml</file>
<file>AccountTransferPage.qml</file>
<file>account-transfer/PasswordRemovalPage.qml</file>
<file>account-transfer/PasswordRemovalFromPlainTextConfirmationPage.qml</file>
<file>account-transfer/PasswordRemovalFromPlainTextAndQrCodeConfirmationPage.qml</file>
<file>elements/ChatMessageContextMenu.qml</file>
<file>elements/SubRequestAcceptSheet.qml</file>
......@@ -88,5 +81,11 @@
<file>settings/SettingsContent.qml</file>
<file>settings/ChangePassword.qml</file>
<file>settings/MultimediaSettings.qml</file>
<file>settings/AccountSecurity.qml</file>
<file>settings/PasswordRemovalPage.qml</file>
<file>settings/DisablePlainTextPasswordDisplay.qml</file>
<file>settings/DisablePasswordDisplay.qml</file>
<file>settings/LocalAccountRemoval.qml</file>
<file>settings/RemoteAccountDeletion.qml</file>
</qresource>
</RCC>
......@@ -29,32 +29,26 @@
*/
import QtQuick 2.12
import org.kde.kirigami 2.8 as Kirigami
import "../elements"
import im.kaidan.kaidan 1.0
import "elements"
/**
* This page is used for deleting an account.
*
* An account can be deleted only from the client or from the client and the server.
*/
BinaryDecisionPage {
title: qsTr("Delete account")
topDescription: qsTr("You can remove your account <b>%1</b> only from this app or delete it completely. If you delete your account completely, you won't be able to use it with another app because it is also removed from the server.").arg(Kaidan.jid)
topImageSource: Utils.getResourcePath("images/account-deletion-from-client.svg")
bottomImageSource: Utils.getResourcePath("images/account-deletion-from-client-and-server.svg")
title: qsTr("Account Security")
topDescription: qsTr("Allow to add new devices using a QR-Code, but never show the password as text. This action can not be undone, so consider storing the password in another way before using it.")
topAction: Kirigami.Action {
text: qsTr("Remove from this app")
onTriggered: pageStack.layers.push(accountDeletionFromClientConfirmationPage)
text: qsTr("Disable showing the password")
enabled: Kaidan.passwordVisibility === Kaidan.PasswordVisible
onTriggered: stack.push("DisablePlainTextPasswordDisplay.qml")
}
bottomDescription: qsTr("Don't expose the password in any form. This action can not be undone.")
bottomAction: Kirigami.Action {
text: qsTr("Delete completely")
onTriggered: pageStack.layers.push(accountDeletionFromClientAndServerConfirmationPage)
text: qsTr("Disable showing the QR-Code and password")
enabled: Kaidan.passwordVisibility !== Kaidan.PasswordInvisible
onTriggered: stack.push("DisablePasswordDisplay.qml")
}
}
......@@ -37,6 +37,7 @@ import im.kaidan.kaidan 1.0
import "../elements"
Kirigami.Page {
title: qsTr("Change password")
topPadding: 0
Controls.BusyIndicator {
......
......@@ -43,20 +43,15 @@ ConfirmationPage {
topDescription: qsTr("Your password will not be included in the QR code anymore.\nYou won't be able to use the login via QR code without entering your password again because this action cannot be undone!\nMake sure that you backed it up if you want to use your account later.")
onCanceled: stack.pop()
topAction: Kirigami.Action {
text: qsTr("Remove password")
onTriggered: {
Kaidan.accountTransferPasswordVisibility = Kaidan.PasswordInvisible
// If this page was pushed by the passwordRemovalPage, pop that page too.
// If this page was directly pushed by the accountTransferPage, pop only this page.
// That is the case when the password was already removed from the plain text and thus the password removal page skipped.
if (popPasswordRemovalPageOnClosing)
popLayers(2)
else
popLayers(1)
Kaidan.passwordVisibility = Kaidan.PasswordInvisible
stack.pop()
stack.pop()
}
}
property bool popPasswordRemovalPageOnClosing: false
}
......@@ -43,11 +43,14 @@ ConfirmationPage {
topDescription: qsTr("Your password will not be shown as text anymore.\nYou won't be able to see your password as text again because this action cannot be undone!\nMake sure that you backed it up if you want to use your account later.")
onCanceled: stack.pop()
topAction: Kirigami.Action {
text: qsTr("Do not show password")
onTriggered: {
Kaidan.accountTransferPasswordVisibility = Kaidan.PasswordVisibleQr
popLayers(2)
Kaidan.passwordVisibility = Kaidan.PasswordVisibleQrOnly
stack.pop()
stack.pop()
}
}
}
......@@ -33,7 +33,7 @@ import org.kde.kirigami 2.8 as Kirigami
import im.kaidan.kaidan 1.0
import "elements"
import "../elements"
/**
* This page is used for confirming the deletion of an account from the client.
......@@ -41,10 +41,16 @@ import "elements"
ConfirmationPage {
title: qsTr("Remove account from this app")
topDescription: qsTr("Your account will be removed from this app.\nYou won't be able to get your credentials back!\nMake sure that you have backed up those if you want to use your account later.")
topDescription: qsTr("Your account will be removed from this app.\nYour password will be deleted, make sure it is stored in a password manager or you know it!")
onCanceled: stack.pop()
topAction: Kirigami.Action {
text: qsTr("Remove")
onTriggered: Kaidan.deleteAccountFromClient()
onTriggered: {
Kaidan.deleteAccountFromClient()
settingsSheet.close()
stack.initialItem && stack.pop(stack.initialItem)
}
}
}
......@@ -47,13 +47,13 @@ BinaryDecisionPage {
topAction: Kirigami.Action {
text: qsTr("Do not show password as text")
enabled: Kaidan.accountTransferPasswordVisibility !== Kaidan.PasswordVisibleQr
enabled: Kaidan.passwordVisibility !== Kaidan.PasswordVisibleQrOnly
onTriggered: pageStack.layers.push(passwordRemovalFromPlainTextConfirmationPage)
}
bottomAction: Kirigami.Action {
text: qsTr("Remove completely")
enabled: Kaidan.accountTransferPasswordVisibility !== Kaidan.PasswordInvisible
enabled: Kaidan.passwordVisibility !== Kaidan.PasswordInvisible
onTriggered: pageStack.layers.push(passwordRemovalFromPlainTextAndQrCodeConfirmationPage).popPasswordRemovalPageOnClosing = true
}
}
......@@ -33,7 +33,7 @@ import org.kde.kirigami 2.8 as Kirigami
import im.kaidan.kaidan 1.0
import "elements"
import "../elements"
/**
* This page is used for confirming the deletion of an account from the client and server.
......@@ -43,8 +43,14 @@ ConfirmationPage {
topDescription: qsTr("Your account will be deleted completely, which means from this app and from the server.\nYou will not be able to use your account again!")
onCanceled: stack.pop()
topAction: Kirigami.Action {
text: qsTr("Delete")
onTriggered: Kaidan.deleteAccountFromClientAndServer()
onTriggered: {
Kaidan.deleteAccountFromClientAndServer()
settingsSheet.close()
stack.initialItem && stack.pop(stack.initialItem)
}
}
}
......@@ -39,35 +39,40 @@ import im.kaidan.kaidan 1.0
*
* It is used on a new layer on mobile and inside of a Sheet on desktop.
*/
ColumnLayout {
Controls.StackView {
Layout.fillHeight: true
Layout.fillWidth: true
Column {
property string title: qsTr("Settings")
spacing: 0
height: root.height * 0.9
id: stack
Layout.preferredHeight: currentItem.height
initialItem: settingsContent
clip: true
SettingsItem {
name: qsTr("Change password")
description: qsTr("Changes your account's password. You will need to re-enter it on your other devices.")
visible: Kaidan.serverFeaturesCache.inBandRegistrationSupported
onClicked: stack.push("ChangePassword.qml")
icon: "lock"
}
Component {
id: settingsContent
Column {
height: root.height * 0.9
spacing: 0
SettingsItem {
name: qsTr("Change password")
description: qsTr("Changes your account's password. You will need to re-enter it on your other devices.")
visible: Kaidan.serverFeaturesCache.inBandRegistrationSupported
onClicked: stack.push("ChangePassword.qml")
icon: "lock"
}
SettingsItem {
name: qsTr("Multimedia Settings")
description: qsTr("Configure photo, video and audio recording settings")
onClicked: stack.push("MultimediaSettings.qml")
icon: "settings-configure"
}
}
SettingsItem {
name: qsTr("Multimedia Settings")
description: qsTr("Configure photo, video and audio recording settings")
onClicked: stack.push("MultimediaSettings.qml")
icon: "settings-configure"
}
SettingsItem {
name: qsTr("Account security")
description: qsTr("configure whether this device can be used to log in on a new device")
icon: "security-high-symbolic"
onClicked: stack.push("AccountSecurity.qml")
}
SettingsItem {
name: qsTr("Remove account from Kaidan")
description: qsTr("Remove account from this app")
icon: "system-log-out"
onClicked: stack.push("LocalAccountRemoval.qml")
}
SettingsItem {
name: qsTr("Delete account")
description: qsTr("Delete account from the server")
icon: "delete"
onClicked: stack.push("RemoteAccountDeletion.qml")
}
}
......@@ -38,10 +38,34 @@ import org.kde.kirigami 2.8 as Kirigami
* fill the complete width, so it looks a bit nicer on large screens.
*/
Kirigami.OverlaySheet {
header: Kirigami.Heading {
text: qsTr("Settings")
id: settingsSheet
header: Row {
spacing: 1
Layout.fillWidth: true
Controls.ToolButton {
id: backButton
enabled: stack.currentItem !== stack.initialItem
icon.name: "draw-arrow-back"
onClicked: stack.pop()
}
Kirigami.Heading {
height: backButton.height
text: stack.currentItem.title
}
}
contentItem: SettingsContent {
ColumnLayout {
Controls.StackView {
Layout.fillHeight: true
Layout.fillWidth: true
id: stack
Layout.preferredHeight: currentItem.height
initialItem: SettingsContent {}
clip: true
}
Layout.preferredWidth: Layout.maximumWidth
Layout.maximumWidth: 600
id: settingsPage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment