1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
import DeltaChat 1.0
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.12
import org.kde.kirigami 2.12 as Kirigami
Kirigami.ScrollablePage {
id: root
required property DcContext context
property int bannedListHeight: 0
title: "Settings"
Kirigami.FormLayout {
Image {
id: pfp
Kirigami.FormData.label: "Avatar: "
source: "file:" + root.context.getConfig("selfavatar")
}
ListModel {
id: bannedList
}
FileDialog {
id: changePfpDialog
folder: shortcuts.pictures
nameFilters: ["Image files (*.jpg *.png *.gif)"]
onAccepted: {
var url = changePfpDialog.fileUrl.toString();
if (url.startsWith("file://") && url.length > 0) {
var filename = url.substring(7);
console.log("Set avatar to : " + filename);
root.context.setConfig("selfavatar", filename);
pfp.source = "file:" + root.context.getConfig("selfavatar");
}
}
}
Button {
id: changePfpBtn
text: "Change avatar"
icon.name: "avatar-default"
hoverEnabled: true
anchors.horizontalCenter: parent.horizontalCenter
onClicked: changePfpDialog.open()
}
TextField {
id: displayNameField
Kirigami.FormData.label: "Name: "
text: root.context.getConfig("displayname")
onEditingFinished: root.context.setConfig("displayname", text)
}
TextArea {
Kirigami.FormData.label: "Signature: "
text: root.context.getConfig("selfstatus")
onEditingFinished: root.context.setConfig("selfstatus", text)
selectByMouse: true
}
TextArea {
Kirigami.FormData.label: "Videochat instance: "
text: root.context.getConfig("webrtc_instance")
onEditingFinished: root.context.setConfig("webrtc_instance", text)
selectByMouse: true
}
Switch {
text: "Prefer end-to-end encryption"
checked: root.context.getConfig("e2ee_enabled") == "1"
onToggled: root.context.setConfig("e2ee_enabled", checked ? "1" : "0")
}
Switch {
text: "Read receipts"
checked: root.context.getConfig("mdns_enabled") == "1"
onToggled: root.context.setConfig("mdns_enabled", checked ? "1" : "0")
}
Switch {
text: "Watch Inbox"
checked: root.context.getConfig("inbox_watch") == "1"
onToggled: root.context.setConfig("inbox_watch", checked ? "1" : "0")
}
Switch {
text: "Watch Sent"
checked: root.context.getConfig("sentbox_watch") == "1"
onToggled: root.context.setConfig("sentbox_watch", checked ? "1" : "0")
}
Switch {
text: "Watch DeltaChat"
checked: root.context.getConfig("mvbox_watch") == "1"
onToggled: root.context.setConfig("mvbox_watch", checked ? "1" : "0")
}
Switch {
text: "Send copy to self"
checked: root.context.getConfig("bcc_self") == "1"
onToggled: root.context.setConfig("bcc_self", checked ? "1" : "0")
}
Switch {
text: "Move to DeltaChat"
checked: root.context.getConfig("mvbox_move") == "1"
onToggled: root.context.setConfig("mvbox_move", checked ? "1" : "0")
}
Button {
id: blockedUsers
text: "View blocked users"
icon.name: "avatar-default"
hoverEnabled: true
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
bannedList.clear()
let banListObj = root.context.getBlockedContacts()
for (var addr in banListObj){
let chatId = banListObj[addr]
console.log("Chat ID " + chatId + " is " + addr)
bannedList.append({"email": addr, "bannedContactId": chatId});
}
bannedListHeight = 0
}
}
Rectangle {
id: listContainer
height: bannedListHeight
Layout.preferredHeight: height
radius: 10
data: ListView {
id: blocked
currentIndex: -1
anchors.fill: parent
model: bannedList
delegate: RowLayout {
Button {
id: unblockBtn
text: "X"
ToolTip.text: "Click to unblock"
ToolTip.visible: hovered
hoverEnabled: true
onClicked: {
root.context.blockContact(bannedContactId, 0);
console.log("Unblocking " + email + "(contact id "+ bannedContactId + ")")
blockedUsers.clicked();
updateChatlist()
}
}
TextEdit {
selectByMouse: true
readOnly: true
text: email
padding: 4
}
Component.onCompleted: bannedListHeight += height
}
}
}
ComboBox {
Kirigami.FormData.label: "Show classic emails: "
Layout.preferredWidth: 250
textRole: "text"
currentIndex: root.context.getConfig("show_emails")
onActivated: root.context.setConfig("show_emails", currentIndex)
model: ListModel {
id: certificateChecksModel
ListElement {
text: "No, chats only"
}
ListElement {
text: "For accepted contacts"
}
ListElement {
text: "All"
}
}
}
Switch {
text: "SOCKS5 enabled"
checked: root.context.getConfig("socks5_enabled") == "1"
onToggled: root.context.setConfig("socks5_enabled", checked ? "1" : "0")
}
TextField {
Kirigami.FormData.label: "SOCKS5 host: "
text: root.context.getConfig("socks5_host")
onEditingFinished: root.context.setConfig("socks5_host", text)
}
TextField {
Kirigami.FormData.label: "SOCKS5 port: "
text: root.context.getConfig("socks5_port")
onEditingFinished: root.context.setConfig("socks5_port", text)
}
TextField {
Kirigami.FormData.label: "SOCKS5 username: "
text: root.context.getConfig("socks5_user")
onEditingFinished: root.context.setConfig("socks5_user", text)
}
TextField {
Kirigami.FormData.label: "SOCKS5 password: "
echoMode: TextInput.PasswordEchoOnEdit
text: root.context.getConfig("socks5_password")
onEditingFinished: root.context.setConfig("socks5_password", text)
}
}
}
|