diff --git a/src/python/config_files.py b/src/python/config_files.py index a0d28036..ec63a396 100644 --- a/src/python/config_files.py +++ b/src/python/config_files.py @@ -142,6 +142,7 @@ class UISettings(JSONConfigFile): ], "clearRoomMessages": ["Ctrl+L"], + "sendFile": ["Alt+F"], }, } diff --git a/src/qml/Chat/Composer.qml b/src/qml/Chat/Composer.qml index d61e2c3f..6510fac2 100644 --- a/src/qml/Chat/Composer.qml +++ b/src/qml/Chat/Composer.qml @@ -216,6 +216,7 @@ Rectangle { SendFilePicker { id: sendFilePicker + userId: chatPage.userId roomId: chatPage.roomId } } diff --git a/src/qml/Dialogs/HFileDialogOpener.qml b/src/qml/Dialogs/HFileDialogOpener.qml index 16161b6b..74d22adb 100644 --- a/src/qml/Dialogs/HFileDialogOpener.qml +++ b/src/qml/Dialogs/HFileDialogOpener.qml @@ -7,6 +7,7 @@ Item { signal filePicked() + signal cancelled() property bool fill: true @@ -66,6 +67,10 @@ Item { opener.file = file opener.filePicked(file) } - onRejected: { selectedFile = ""; file = ""} + onRejected: { + selectedFile = "" + file = "" + cancelled() + } } } diff --git a/src/qml/Shortcuts.qml b/src/qml/Shortcuts.qml index ea106016..9a43b28f 100644 --- a/src/qml/Shortcuts.qml +++ b/src/qml/Shortcuts.qml @@ -132,4 +132,19 @@ HShortcutHandler { } ) } + + HShortcut { + enabled: window.uiState.page == "Chat/Chat.qml" + sequences: settings.keys.sendFile + onPressed: Utils.makeObject( + "Dialogs/SendFilePicker.qml", + mainUI, + { + userId: window.uiState.pageProperties.userId, + roomId: window.uiState.pageProperties.roomId, + destroyWhenDone: true, + }, + picker => { picker.dialog.open() } + ) + } }