Ask for confirmation before activating encryption in a room
This commit is contained in:
44
src/qml/Dialog/ConfirmEncryptionDialog.qml
Normal file
44
src/qml/Dialog/ConfirmEncryptionDialog.qml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
|
||||||
|
// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de>
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15 as QQC2
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
|
import org.kde.kirigami 2.15 as Kirigami
|
||||||
|
|
||||||
|
QQC2.Dialog {
|
||||||
|
id: confirmEncryptionDialog
|
||||||
|
|
||||||
|
property var room
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Kirigami.Heading {
|
||||||
|
text: i18n("Activate Encryption")
|
||||||
|
}
|
||||||
|
QQC2.Label {
|
||||||
|
text: i18n("It will not be possible to deactivate the encryption after it is enabled.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x: Math.round((parent.width - width) / 2)
|
||||||
|
y: Math.round((parent.height - height) / 2)
|
||||||
|
modal: true
|
||||||
|
|
||||||
|
footer: QQC2.DialogButtonBox {
|
||||||
|
QQC2.Button {
|
||||||
|
text: i18n("Cancel")
|
||||||
|
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
|
||||||
|
onClicked: confirmEncryptionDialog.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.Button {
|
||||||
|
text: i18n("Activate Encryption")
|
||||||
|
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
||||||
|
onClicked: {
|
||||||
|
confirmEncryptionDialog.room.activateEncryption()
|
||||||
|
confirmEncryptionDialog.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -154,7 +154,11 @@ Kirigami.OverlayDrawer {
|
|||||||
text: i18n("Enable encryption")
|
text: i18n("Enable encryption")
|
||||||
display: QQC2.AbstractButton.IconOnly
|
display: QQC2.AbstractButton.IconOnly
|
||||||
|
|
||||||
onClicked: roomDrawer.room.activateEncryption()
|
onClicked: {
|
||||||
|
let dialog = confirmEncryptionDialog.createObject(applicationWindow(), {room: roomDrawer.room});
|
||||||
|
roomDrawer.close();
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
QQC2.ToolTip {
|
QQC2.ToolTip {
|
||||||
text: encryptButton.text
|
text: encryptButton.text
|
||||||
@@ -357,4 +361,10 @@ Kirigami.OverlayDrawer {
|
|||||||
|
|
||||||
UserDetailDialog {}
|
UserDetailDialog {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: confirmEncryptionDialog
|
||||||
|
|
||||||
|
ConfirmEncryptionDialog {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,5 +90,6 @@
|
|||||||
<file alias="SonnetConfigPage.qml">qml/Settings/SonnetConfigPage.qml</file>
|
<file alias="SonnetConfigPage.qml">qml/Settings/SonnetConfigPage.qml</file>
|
||||||
<file alias="NetworkProxyPage.qml">qml/Settings/NetworkProxyPage.qml</file>
|
<file alias="NetworkProxyPage.qml">qml/Settings/NetworkProxyPage.qml</file>
|
||||||
<file alias="DevtoolsPage.qml">qml/Page/DevtoolsPage.qml</file>
|
<file alias="DevtoolsPage.qml">qml/Page/DevtoolsPage.qml</file>
|
||||||
|
<file alias="ConfirmEncryptionDialog.qml">qml/Dialog/ConfirmEncryptionDialog.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
Reference in New Issue
Block a user