diff --git a/TODO.md b/TODO.md index 9506c8da..695a26ca 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ # TODO +- `i <= 1000` resp - highlight messages being responded to - highlight messages with mention - add room members loading indicator diff --git a/src/backend/user_files.py b/src/backend/user_files.py index a24279c6..40fe18d7 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -324,6 +324,7 @@ class UISettings(JSONDataFile): "removeFocusedOrSelectedMessages": ["Ctrl+R", "Alt+Del"], "replyToFocusedOrLastMessage": ["Ctrl+Q"], # Q for Quote "debugFocusedMessage": ["Ctrl+Shift+D"], + "openMessagesLinks": ["Ctrl+O"], "clearRoomMessages": ["Ctrl+L"], "sendFile": ["Alt+S"], diff --git a/src/gui/Pages/Chat/Timeline/EventList.qml b/src/gui/Pages/Chat/Timeline/EventList.qml index ce9a02e1..214e1be5 100644 --- a/src/gui/Pages/Chat/Timeline/EventList.qml +++ b/src/gui/Pages/Chat/Timeline/EventList.qml @@ -125,6 +125,33 @@ Rectangle { } } + HShortcut { + sequences: window.settings.keys.openMessagesLinks + onActivated: { + let events = [] + + if (eventList.selectedCount) { + events = eventList.getSortedChecked() + } else if (eventList.currentIndex !== -1) { + events = [eventList.model.get(eventList.currentIndex)] + } else { + // Find most recent event containing links + for (let i = 0; i < eventList.model.count && i <= 1000; i++) { + const ev = eventList.model.get(i) + + if (JSON.parse(ev.links).length) { + events = [ev] + break + } + } + } + + for (const event of events) { + for (const link of JSON.parse(event.links)) + Qt.openUrlExternally(link) + } + } + } HShortcut { active: eventList.currentItem