aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-10-27 09:16:23 +0300
committerlink2xt <link2xt@testrun.org>2021-10-27 09:16:28 +0300
commite1201cdcce4311061643d90cc0132745023a82d2 (patch)
tree3c34dfe1a7558cd68586475f999fc2ef19035f64
parentc16edbc50f119c9705ca4339e07b3efab3a61ac7 (diff)
downloadkdeltachat-master.tar.gz
kdeltachat-master.zip
qmlformatHEADmaster
-rw-r--r--qml/ComposePane.qml33
-rw-r--r--qml/SettingsPage.qml14
2 files changed, 22 insertions, 25 deletions
diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml
index f8f3b6b..f80b249 100644
--- a/qml/ComposePane.qml
+++ b/qml/ComposePane.qml
@@ -1,8 +1,8 @@
import DeltaChat 1.0
import QtQuick 2.12
import QtQuick.Controls 2.12
-import QtQuick.Layouts 1.12
import QtQuick.Dialogs 1.3
+import QtQuick.Layouts 1.12
Pane {
id: root
@@ -17,13 +17,12 @@ Pane {
function createMessage() {
let DC_MSG_TEXT = 10;
let DC_MSG_FILE = 60;
-
if (attachFileUrl.length > 0) {
var msg = root.context.newMessage(DC_MSG_FILE);
- msg.setFile(attachFileUrl)
- } else
+ msg.setFile(attachFileUrl);
+ } else {
var msg = root.context.newMessage(DC_MSG_TEXT);
-
+ }
msg.setText(messageField.text);
return msg;
}
@@ -32,14 +31,14 @@ Pane {
FileDialog {
id: attachFileDialog
+
title: "Attach"
folder: shortcuts.home
-
onAccepted: {
- var url = attachFileDialog.fileUrl.toString()
+ var url = attachFileDialog.fileUrl.toString();
if (url.startsWith("file://")) {
- attachFileUrl = url.substring(7)
- console.log("Attaching " + attachFileUrl)
+ attachFileUrl = url.substring(7);
+ console.log("Attaching " + attachFileUrl);
}
}
}
@@ -49,19 +48,16 @@ Pane {
Button {
id: attachButton
+
visible: root.canSend
text: attachFileUrl.length > 0 ? qsTr("Detach") : qsTr("Attach")
-
Layout.alignment: Qt.AlignBottom
-
icon.name: "mail-attachment"
-
onClicked: {
- if (attachFileUrl.length > 0) {
- attachFileUrl = ""
- } else {
- attachFileDialog.open()
- }
+ if (attachFileUrl.length > 0)
+ attachFileUrl = "";
+ else
+ attachFileDialog.open();
}
}
@@ -100,8 +96,7 @@ Pane {
enabled: messageField.length > 0 | attachFileUrl.length > 0
onClicked: {
let msg = root.createMessage();
- root.context.sendMessage(root.chatId, msg)
-
+ root.context.sendMessage(root.chatId, msg);
attachFileUrl = "";
messageField.text = "";
root.context.setDraft(chatId, null);
diff --git a/qml/SettingsPage.qml b/qml/SettingsPage.qml
index d0f8065..9aebbeb 100644
--- a/qml/SettingsPage.qml
+++ b/qml/SettingsPage.qml
@@ -15,28 +15,30 @@ Kirigami.ScrollablePage {
Kirigami.FormLayout {
Image {
id: pfp
+
Kirigami.FormData.label: "Avatar: "
source: "file:" + root.context.getConfig("selfavatar")
}
- FileDialog{
+ FileDialog {
id: changePfpDialog
+
folder: shortcuts.pictures
- nameFilters: [ "Image files (*.jpg *.png *.gif)" ]
+ 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")
+ 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