diff options
Diffstat (limited to 'qml')
-rw-r--r-- | qml/ComposePane.qml | 33 | ||||
-rw-r--r-- | qml/SettingsPage.qml | 14 |
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 |