mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
selecting room in quickswitcher now works, added completionSelected signal
This commit is contained in:
parent
0922a8e4c7
commit
3f4ad1dd8b
2 changed files with 30 additions and 2 deletions
|
@ -15,6 +15,7 @@ Popup {
|
|||
property alias count: listView.count
|
||||
|
||||
signal completionClicked(string completion)
|
||||
signal completionSelected(string id)
|
||||
|
||||
function up() {
|
||||
if (bottomToTop)
|
||||
|
@ -91,7 +92,12 @@ Popup {
|
|||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPositionChanged: popup.currentIndex = model.index
|
||||
onClicked: popup.completionClicked(completer.completionAt(model.index))
|
||||
onClicked: {
|
||||
popup.completionClicked(completer.completionAt(model.index))
|
||||
if(popup.completerName == "room") {
|
||||
popup.completionSelected(model.roomid)
|
||||
}
|
||||
}
|
||||
|
||||
Ripple {
|
||||
rippleTarget: mouseArea
|
||||
|
@ -171,7 +177,10 @@ Popup {
|
|||
height: 24
|
||||
width: 24
|
||||
url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
|
||||
onClicked: popup.completionClicked(completer.completionAt(model.index))
|
||||
onClicked: {
|
||||
popup.completionClicked(completer.completionAt(model.index))
|
||||
popup.completionSelected(model.roomid)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
|
@ -3,6 +3,7 @@ import QtQuick.Controls 2.3
|
|||
import im.nheko 1.0
|
||||
|
||||
Popup {
|
||||
id: quickSwitcher
|
||||
x: parent.width / 2 - width / 2
|
||||
y: parent.height / 4 - height / 2
|
||||
width: parent.width / 2
|
||||
|
@ -20,6 +21,16 @@ Popup {
|
|||
onTextEdited: {
|
||||
completerPopup.completer.setSearchString(text)
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.key == Qt.Key_Up && completerPopup.opened) {
|
||||
event.accepted = true;
|
||||
completerPopup.up();
|
||||
} else if (event.key == Qt.Key_Down && completerPopup.opened) {
|
||||
event.accepted = true;
|
||||
completerPopup.down();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Completer {
|
||||
|
@ -43,4 +54,12 @@ Popup {
|
|||
onClosed: {
|
||||
completerPopup.close()
|
||||
}
|
||||
|
||||
Connections {
|
||||
onCompletionSelected: {
|
||||
TimelineManager.setHistoryView(id)
|
||||
quickSwitcher.close()
|
||||
}
|
||||
target: completerPopup
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue