aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qml/ChatlistPage.qml6
-rw-r--r--qml/ComposePane.qml22
-rw-r--r--qml/Message.qml19
-rw-r--r--qml/SettingsPage.qml20
-rw-r--r--qml/main.qml144
5 files changed, 186 insertions, 25 deletions
diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml
index 2ee7e83..42ceb64 100644
--- a/qml/ChatlistPage.qml
+++ b/qml/ChatlistPage.qml
@@ -94,7 +94,9 @@ Kirigami.ScrollablePage {
contextualActions: [
Kirigami.Action {
text: "Settings"
- iconName: "configure"
+ tooltip: "Shift+Tab"
+ iconName: "system-run"
+ shortcut: "Shift+Tab"
onTriggered: {
let settingsPageComponent = Qt.createComponent("qrc:/qml/SettingsPage.qml");
if (settingsPageComponent.status == Component.Ready) {
@@ -162,6 +164,8 @@ Kirigami.ScrollablePage {
mainAction: Kirigami.Action {
text: "New chat"
iconName: "list-add"
+ shortcut: "Ctrl+N"
+ tooltip: "Ctrl+N"
onTriggered: {
let newChatPageComponent = Qt.createComponent("qrc:/qml/NewChatPage.qml");
if (newChatPageComponent.status == Component.Ready) {
diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml
index f80b249..19d2da9 100644
--- a/qml/ComposePane.qml
+++ b/qml/ComposePane.qml
@@ -51,6 +51,9 @@ Pane {
visible: root.canSend
text: attachFileUrl.length > 0 ? qsTr("Detach") : qsTr("Attach")
+ hoverEnabled: true
+ ToolTip.visible: hovered
+ ToolTip.text: attachFileUrl.length > 0 ? "Ctrl+O<br>Attached file is <b>" + attachFileUrl + "</b>" : "Ctrl+O"
Layout.alignment: Qt.AlignBottom
icon.name: "mail-attachment"
onClicked: {
@@ -59,6 +62,12 @@ Pane {
else
attachFileDialog.open();
}
+
+ action: Action {
+ shortcut: "Ctrl+O"
+ onTriggered: attachButton.click()
+ }
+
}
TextArea {
@@ -89,6 +98,9 @@ Pane {
Button {
id: sendButton
+ hoverEnabled: true
+ ToolTip.visible: hovered
+ ToolTip.text: "Ctrl+S"
visible: root.canSend
Layout.alignment: Qt.AlignBottom
icon.name: "document-send"
@@ -101,6 +113,16 @@ Pane {
messageField.text = "";
root.context.setDraft(chatId, null);
}
+
+ action: Action {
+ shortcut: "Ctrl+S"
+ onTriggered: {
+ if (sendButton.enabled == true)
+ sendButton.click();
+
+ }
+ }
+
}
Button {
diff --git a/qml/Message.qml b/qml/Message.qml
index fc69e8f..86ae397 100644
--- a/qml/Message.qml
+++ b/qml/Message.qml
@@ -128,7 +128,12 @@ RowLayout {
source: Qt.resolvedUrl("file:" + root.message.file)
onError: console.log("Audio MediaPlayer error: " + errorString)
- onPlaybackStateChanged: playbackState == 1 ? audioBtn.text = "pause" : audioBtn.text = "play"
+ onPlaybackStateChanged: {
+ if (playbackState == 1)
+ audioBtn.text = "\u23F8 pause";
+ else
+ audioBtn.text = "\u25B6 play";
+ }
}
Label {
@@ -141,8 +146,13 @@ RowLayout {
Button {
id: audioBtn
- text: "play"
- onPressed: player.playbackState == 1 ? player.pause() : player.play()
+ text: "\u25B6 play"
+ onPressed: {
+ if (player.playbackState == 1)
+ player.pause();
+ else
+ player.play();
+ }
}
}
@@ -217,8 +227,7 @@ RowLayout {
Button {
padding: 5
- icon.name: "document-save-as"
- text: "Save attachment"
+ text: "<h1>\u2B07</h1> Save attachment"
onClicked: saveAsDialog.open()
}
diff --git a/qml/SettingsPage.qml b/qml/SettingsPage.qml
index e0cee5f..1e28917 100644
--- a/qml/SettingsPage.qml
+++ b/qml/SettingsPage.qml
@@ -130,33 +130,33 @@ Kirigami.ScrollablePage {
Switch {
text: "SOCKS5 enabled"
- checked: settingsPageRoot.context.getConfig("socks5_enabled") == "1"
- onToggled: settingsPageRoot.context.setConfig("socks5_enabled", checked ? "1" : "0")
+ checked: root.context.getConfig("socks5_enabled") == "1"
+ onToggled: root.context.setConfig("socks5_enabled", checked ? "1" : "0")
}
TextField {
Kirigami.FormData.label: "SOCKS5 host: "
- text: settingsPageRoot.context.getConfig("socks5_host")
- onEditingFinished: settingsPageRoot.context.setConfig("socks5_host", text)
+ text: root.context.getConfig("socks5_host")
+ onEditingFinished: root.context.setConfig("socks5_host", text)
}
TextField {
Kirigami.FormData.label: "SOCKS5 port: "
- text: settingsPageRoot.context.getConfig("socks5_port")
- onEditingFinished: settingsPageRoot.context.setConfig("socks5_port", text)
+ text: root.context.getConfig("socks5_port")
+ onEditingFinished: root.context.setConfig("socks5_port", text)
}
TextField {
Kirigami.FormData.label: "SOCKS5 username: "
- text: settingsPageRoot.context.getConfig("socks5_user")
- onEditingFinished: settingsPageRoot.context.setConfig("socks5_user", text)
+ text: root.context.getConfig("socks5_user")
+ onEditingFinished: root.context.setConfig("socks5_user", text)
}
TextField {
Kirigami.FormData.label: "SOCKS5 password: "
echoMode: TextInput.PasswordEchoOnEdit
- text: settingsPageRoot.context.getConfig("socks5_password")
- onEditingFinished: settingsPageRoot.context.setConfig("socks5_password", text)
+ text: root.context.getConfig("socks5_password")
+ onEditingFinished: root.context.setConfig("socks5_password", text)
}
}
diff --git a/qml/main.qml b/qml/main.qml
index 1b7e1a4..f1a04f0 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -9,6 +9,10 @@ Kirigami.ApplicationWindow {
property DcAccountsEventEmitter eventEmitter
title: qsTr("Delta Chat")
+ onClosing: {
+ // Cancel all tasks that may block the termination of event loop.
+ dcAccounts.stopIo();
+ }
Component.onCompleted: {
console.log('starting');
// Create an account if there is none.
@@ -32,11 +36,6 @@ Kirigami.ApplicationWindow {
"eventEmitter": eventEmitter
});
}
- dcAccounts.startIo();
- }
- onClosing: {
- // Cancel all tasks that may block the termination of event loop.
- dcAccounts.stopIo();
}
Component {
@@ -51,29 +50,133 @@ Kirigami.ApplicationWindow {
id: dcAccounts
}
+ Shortcut {
+ sequence: 'Esc'
+ onActivated: {
+ while (pageStack.layers.depth > 1)
+ pageStack.layers.pop();
+
+ }
+ }
+
+ // Make Ctrl+Q works even when popup
+ // windows are opened
+ // Quit application
+ Shortcut {
+ sequence: 'Ctrl+Q'
+ onActivated: root.close()
+ context: Qt.ApplicationShortcut
+ }
+
+ // Show sidebar with 'Work offline', 'Switch
+ // accounts' options
+ Shortcut {
+ sequence: 'Ctrl+Tab'
+ onActivated: sideBar.drawerOpen = true
+ }
+
+ // Refresh network connectivity. Can be used
+ // to retry fetching messages
+ Shortcut {
+ sequence: 'F5'
+ onActivated: dcAccounts.maybeNetwork()
+ }
+
+ // Show a popup listing keyboards shortcuts
+ // for KDeltaChat
+ Shortcut {
+ //context: Qt.ApplicationShortcut
+
+ sequence: "F1"
+ onActivated: helpPopup.open()
+ }
+
+ Controls.Popup {
+ id: workNetwNotif
+
+ modal: false
+ focus: activeFocus ? false : false
+ dim: false
+ width: 150
+ height: 50
+ x: Math.round((parent.width - width) / 2)
+ padding: 10
+ contentChildren: [
+ Text {
+ text: "Network status :"
+ bottomPadding: 10
+ font.bold: true
+ font.pixelSize: 14
+ },
+ Text {
+ text: offlineSwitch.checked ? "We can work offline now." : "We can work online now."
+ font.pixelSize: 9
+ topPadding: 20
+ leftPadding: 10
+ bottomPadding: 20
+ }
+ ]
+ }
+
+ Controls.Popup {
+ id: helpPopup
+
+ modal: true
+ focus: true
+ anchors.centerIn: parent
+ width: 200
+ height: 200
+ padding: 10
+ contentChildren: [
+ Text {
+ text: "Shortcuts :"
+ bottomPadding: 10
+ font.bold: true
+ font.pixelSize: 14
+ },
+ Text {
+ text: "<b>F1</b>: Displays this" + "<br><b>F2</b>: Work on/offline" + "<br><b>F5</b>: Network check" + "<br><b>Shift+S</b>: Account settings" + "<br><b>Alt+C</b>: Clear search" + "<br><b>Alt+Tab</b>: Switch accounts" + "<br><b>Ctrl+F</b>: Search contacts" + "<br><b>Ctrl+N</b>: New chat" + "<br><b>Ctrl+S</b>: Send message" + "<br><b>Ctrl+Tab</b>: Show sidebar" + "<br><b>Ctrl+Q</b>: Quit"
+ topPadding: 20
+ leftPadding: 10
+ bottomPadding: 20
+ }
+ ]
+ }
+
pageStack.initialPage: Kirigami.Page {
}
globalDrawer: Kirigami.GlobalDrawer {
+ id: sideBar
+
actions: [
Kirigami.Action {
text: "Maybe network"
+ tooltip: "F5"
iconName: "view-refresh"
onTriggered: dcAccounts.maybeNetwork()
},
Kirigami.Action {
+ shortcut: "Alt+Tab"
text: "Switch account"
- iconName: "system-switch-user"
+ tooltip: "Alt+Tab"
+ iconName: "system-users"
onTriggered: {
- while (pageStack.layers.depth > 1)
- pageStack.layers.pop();
-
+ while (pageStack.layers.depth > 1)pageStack.layers.pop()
pageStack.layers.push(accountsPage);
}
+ },
+ Kirigami.Action {
+ text: "Shortcuts"
+ tooltip: "F1"
+ iconName: "preferences-desktop-keyboard"
+ onTriggered: helpPopup.open()
}
]
header: Controls.Switch {
+ id: offlineSwitch
+
text: "Work offline"
onCheckedChanged: {
if (checked)
@@ -81,6 +184,29 @@ Kirigami.ApplicationWindow {
else
dcAccounts.startIo();
}
+
+ action: Kirigami.Action {
+ id: workOff
+
+ shortcut: "F2"
+ tooltip: "F2"
+ onTriggered: {
+ if (offlineSwitch.state == "on") {
+ offlineSwitch.checked = false;
+ offlineSwitch.state = "off";
+ workNetwNotif.close();
+ workNetwNotif.open();
+ console.log("Work online");
+ } else {
+ offlineSwitch.checked = true;
+ offlineSwitch.state = "on";
+ workNetwNotif.close();
+ workNetwNotif.open();
+ console.log("Work offline");
+ }
+ }
+ }
+
}
}