Add keybind to open links in messages
Ctrl+O by default. Opens externally all links in selecteds, focused or the last message that has links. Can't open files (media events) yet.
This commit is contained in:
parent
bbd845c040
commit
6c7335e5db
1
TODO.md
1
TODO.md
|
@ -1,5 +1,6 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
- `i <= 1000` resp
|
||||||
- highlight messages being responded to
|
- highlight messages being responded to
|
||||||
- highlight messages with mention
|
- highlight messages with mention
|
||||||
- add room members loading indicator
|
- add room members loading indicator
|
||||||
|
|
|
@ -324,6 +324,7 @@ class UISettings(JSONDataFile):
|
||||||
"removeFocusedOrSelectedMessages": ["Ctrl+R", "Alt+Del"],
|
"removeFocusedOrSelectedMessages": ["Ctrl+R", "Alt+Del"],
|
||||||
"replyToFocusedOrLastMessage": ["Ctrl+Q"], # Q for Quote
|
"replyToFocusedOrLastMessage": ["Ctrl+Q"], # Q for Quote
|
||||||
"debugFocusedMessage": ["Ctrl+Shift+D"],
|
"debugFocusedMessage": ["Ctrl+Shift+D"],
|
||||||
|
"openMessagesLinks": ["Ctrl+O"],
|
||||||
"clearRoomMessages": ["Ctrl+L"],
|
"clearRoomMessages": ["Ctrl+L"],
|
||||||
|
|
||||||
"sendFile": ["Alt+S"],
|
"sendFile": ["Alt+S"],
|
||||||
|
|
|
@ -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 {
|
HShortcut {
|
||||||
active: eventList.currentItem
|
active: eventList.currentItem
|
||||||
|
|
Loading…
Reference in New Issue
Block a user