aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-02-28 00:11:07 +0300
committerlink2xt <link2xt@testrun.org>2021-02-28 00:11:07 +0300
commit3931e2843bd01740a861e98c39cd8f133867b989 (patch)
treeab249d5b54fff997d5aea8ce72f85d892ee2a2e2
parent078bb839ea328e137a97576ded8717cca68135c7 (diff)
downloadkdeltachat-3931e2843bd01740a861e98c39cd8f133867b989.tar.gz
kdeltachat-3931e2843bd01740a861e98c39cd8f133867b989.zip
Add Settings page
-rw-r--r--qml.qrc1
-rw-r--r--qml/ChatlistPage.qml14
-rw-r--r--qml/SettingsPage.qml30
3 files changed, 45 insertions, 0 deletions
diff --git a/qml.qrc b/qml.qrc
index d2bf225..e7b5fa9 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -6,6 +6,7 @@
<file>qml/ChatPage.qml</file>
<file>qml/ChatlistPage.qml</file>
<file>qml/ConfigurePage.qml</file>
+ <file>qml/SettingsPage.qml</file>
<file>qml/Message.qml</file>
<file>qtquickcontrols2.conf</file>
</qresource>
diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml
index ce81602..a025015 100644
--- a/qml/ChatlistPage.qml
+++ b/qml/ChatlistPage.qml
@@ -30,6 +30,20 @@ Kirigami.Page {
updateChatlist()
}
+ contextualActions: [
+ Kirigami.Action {
+ text: "Settings"
+ iconName: "configure"
+ onTriggered: {
+ let settingsPageComponent = Qt.createComponent("qrc:/qml/SettingsPage.qml")
+ if (settingsPageComponent.status == Component.Ready) {
+ let settingsPage = settingsPageComponent.createObject(chatlistPage, {context: chatlistPage.context})
+ pageStack.layers.push(settingsPage)
+ }
+ }
+ }
+ ]
+
ListModel {
id: chatlistModel
}
diff --git a/qml/SettingsPage.qml b/qml/SettingsPage.qml
new file mode 100644
index 0000000..a7490fe
--- /dev/null
+++ b/qml/SettingsPage.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.12
+import QtQuick.Layouts 1.12
+import org.kde.kirigami 2.12 as Kirigami
+
+import DeltaChat 1.0
+
+Kirigami.Page {
+ id: settingsPageRoot
+
+ title: "Settings"
+
+ required property DcContext context
+
+ ColumnLayout {
+ anchors.fill: parent
+
+ Switch {
+ text: "Prefer end-to-end encryption"
+ checked: settingsPageRoot.context.getConfig("e2ee_enabled") == "1"
+ onToggled: settingsPageRoot.context.setConfig("e2ee_enabled", checked ? "1" : "0")
+ }
+
+ Switch {
+ text: "Read receipts"
+ checked: settingsPageRoot.context.getConfig("mdns_enabled") == "1"
+ onToggled: settingsPageRoot.context.setConfig("mdns_enabled", checked ? "1" : "0")
+ }
+ }
+}