add quick switcher qml file and moved completerFor from inputbar to timeline view class
4 files changed, 60 insertions, 1 deletions
diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml
index f77f50e9..ec5030e7 100644
--- a/resources/qml/Completer.qml
+++ b/resources/qml/Completer.qml
@@ -52,7 +52,11 @@ Popup {
onCompleterNameChanged: {
if (completerName) {
- completer = TimelineManager.timeline.input.completerFor(completerName);
+ if (completerName == "user") {
+ completer = TimelineManager.completerFor(completerName, TimelineManager.timeline.roomId());
+ } else {
+ completer = TimelineManager.completerFor(completerName);
+ }
completer.setSearchString("");
} else {
completer = undefined;
diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml
new file mode 100644
index 00000000..317c96b3
--- /dev/null
+++ b/resources/qml/QuickSwitcher.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.9
+import QtQuick.Controls 2.3
+import im.nheko 1.0
+
+Popup {
+ x: parent.width / 2 - width / 2
+ y: parent.height / 4 - height / 2
+ width: parent.width / 2
+ height: 100
+ modal: true
+ focus: true
+ closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
+ parent: Overlay.overlay
+
+ TextInput {
+ id: roomTextInput
+
+ anchors.fill: parent
+ focus: true
+
+ onTextEdited: {
+ completerPopup.completer.setSearchString(text)
+ }
+ }
+
+ Completer {
+ id: completerPopup
+
+ x: roomTextInput.x + 100
+ y: roomTextInput.y - 20
+ completerName: "room"
+ bottomToTop: true
+ }
+
+ onOpened: {
+ completerPopup.open()
+ }
+}
\ No newline at end of file
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 7db9d041..f575e133 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -68,6 +68,22 @@ Page {
}
+ Component {
+ id: quickSwitcherComponent
+
+ QuickSwitcher {
+ id: quickSwitcher
+ }
+ }
+
+ Shortcut {
+ sequence: "Ctrl+L"
+ onActivated: {
+ var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
+ quickSwitch.open();
+ }
+ }
+
Menu {
id: messageContextMenu
diff --git a/resources/res.qrc b/resources/res.qrc
index 12d098c0..d30d6e18 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -139,6 +139,7 @@
<file>qml/StatusIndicator.qml</file>
<file>qml/TimelineRow.qml</file>
<file>qml/TopBar.qml</file>
+ <file>qml/QuickSwitcher.qml</file>
<file>qml/TypingIndicator.qml</file>
<file>qml/RoomSettings.qml</file>
<file>qml/emoji/EmojiButton.qml</file>
|