From 5d4840dcd86472840377dec8ada82c48e0ac4341 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 10 Nov 2019 08:32:17 -0400 Subject: [PATCH] Add shortcut to add new chats --- src/python/config_files.py | 13 +++++++------ src/qml/Pages/AddChat/CreateRoom.qml | 1 - src/qml/Shortcuts.qml | 6 ++++++ src/qml/SidePane/SidePaneList.qml | 9 +++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/python/config_files.py b/src/python/config_files.py index 7dba7316..8288a26f 100644 --- a/src/python/config_files.py +++ b/src/python/config_files.py @@ -117,9 +117,9 @@ class UISettings(JSONConfigFile): "startMuted": False, }, "keys": { - "startPythonDebugger": "Alt+Shift+D", - "toggleDebugConsole": "Alt+Shift+C", - "reloadConfig": "Alt+Shift+R", + "startPythonDebugger": ["Alt+Shift+D"], + "toggleDebugConsole": ["Alt+Shift+C"], + "reloadConfig": ["Alt+Shift+R"], "scrollUp": ["Alt+Up", "Alt+K"], "scrollDown": ["Alt+Down", "Alt+J"], @@ -130,9 +130,10 @@ class UISettings(JSONConfigFile): "scrollToBottom": ["Alt+Ctrl+Shift+Down", "Alt+Ctrl+Shift+J", "End"], - "focusSidePane": ["Alt+S", "Ctrl+S"], - "clearRoomFilter": ["Alt+Shift+S", "Ctrl+Shift+S"], - "addNewAccount": ["Alt+N"], + "focusSidePane": ["Alt+S", "Ctrl+S"], + "clearRoomFilter": ["Alt+Shift+S", "Ctrl+Shift+S"], + "addNewChat": ["Alt+A"], + "addNewAccount": ["Alt+Shift+A"], "goToLastPage": ["Ctrl+Tab"], "goToPreviousRoom": ["Alt+Shift+Up", "Alt+Shift+K"], diff --git a/src/qml/Pages/AddChat/CreateRoom.qml b/src/qml/Pages/AddChat/CreateRoom.qml index af24f64a..231f8897 100644 --- a/src/qml/Pages/AddChat/CreateRoom.qml +++ b/src/qml/Pages/AddChat/CreateRoom.qml @@ -54,7 +54,6 @@ HBox { HRoomAvatar { - // TODO: click to change the avatar id: avatar clientUserId: userId displayName: nameField.text diff --git a/src/qml/Shortcuts.qml b/src/qml/Shortcuts.qml index d20d1df3..ddd8e8b7 100644 --- a/src/qml/Shortcuts.qml +++ b/src/qml/Shortcuts.qml @@ -104,6 +104,12 @@ HShortcutHandler { onPressed: mainUI.sidePane.toolBar.addAccountButton.clicked() } + HShortcut { + enabled: mainUI.accountsPresent + sequences: settings.keys.addNewChat + onPressed: mainUI.sidePane.sidePaneList.addNewChat() + } + HShortcut { enabled: mainUI.accountsPresent sequences: settings.keys.goToPreviousRoom diff --git a/src/qml/SidePane/SidePaneList.qml b/src/qml/SidePane/SidePaneList.qml index 3148c0ad..81d80352 100644 --- a/src/qml/SidePane/SidePaneList.qml +++ b/src/qml/SidePane/SidePaneList.qml @@ -72,6 +72,15 @@ HListView { currentItem.item.activated() } + function addNewChat() { + if (! currentItem) incrementCurrentIndex() + + pageLoader.showPage( + "AddChat/AddChat", + {userId: currentItem.item.delegateModel.user_id}, + ) + } + function toggleCollapseAccount() { if (! currentItem || filter) return