selecting room in quickswitcher now works, added completionSelected signal
2 files changed, 30 insertions, 2 deletions
diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml
index 76e08e7e..a4f81e6e 100644
--- a/resources/qml/Completer.qml
+++ b/resources/qml/Completer.qml
@@ -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 {
diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml
index ca7a5eeb..b94fc0e2 100644
--- a/resources/qml/QuickSwitcher.qml
+++ b/resources/qml/QuickSwitcher.qml
@@ -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
+ }
}
\ No newline at end of file
|