summary refs log tree commit diff
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-23 00:18:31 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-23 00:18:31 +0530
commitb1dec6f6acec929495f66ef7d0fcb3cac9ee25e3 (patch)
tree835ae4d880c4eda53fe1d6f26b25c11f51ec72c7
parentselecting room in quickswitcher now works, added completionSelected signal (diff)
downloadnheko-b1dec6f6acec929495f66ef7d0fcb3cac9ee25e3.tar.xz
enter key now works, fix room highlighting and add overlay
-rw-r--r--resources/qml/Completer.qml7
-rw-r--r--resources/qml/QuickSwitcher.qml9
-rw-r--r--resources/qml/TimelineView.qml1
-rw-r--r--src/ChatPage.cpp6
-rw-r--r--src/ChatPage.h1
-rw-r--r--src/timeline/TimelineViewManager.cpp6
-rw-r--r--src/timeline/TimelineViewManager.h1
7 files changed, 30 insertions, 1 deletions
diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml

index a4f81e6e..cef19fbf 100644 --- a/resources/qml/Completer.qml +++ b/resources/qml/Completer.qml
@@ -52,6 +52,12 @@ Popup { return null; } + function finishCompletion() { + if(popup.completerName == "room") { + popup.completionSelected(listView.itemAtIndex(currentIndex).modelData.roomid) + } + } + onCompleterNameChanged: { if (completerName) { if (completerName == "user") { @@ -85,6 +91,7 @@ Popup { color: model.index == popup.currentIndex ? colors.highlight : colors.base height: chooser.childrenRect.height + 4 implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4 + property variant modelData: model MouseArea { id: mouseArea diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml
index b94fc0e2..609c443f 100644 --- a/resources/qml/QuickSwitcher.qml +++ b/resources/qml/QuickSwitcher.qml
@@ -11,6 +11,10 @@ Popup { closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside parent: Overlay.overlay + Overlay.modal: Rectangle { + color: "#aa1E1E1E" + } + TextInput { id: roomTextInput @@ -29,6 +33,9 @@ Popup { } else if (event.key == Qt.Key_Down && completerPopup.opened) { event.accepted = true; completerPopup.down(); + } else if (event.matches(StandardKey.InsertParagraphSeparator)) { + completerPopup.finishCompletion() + event.accepted = true; } } } @@ -57,7 +64,9 @@ Popup { Connections { onCompletionSelected: { + console.log(id) TimelineManager.setHistoryView(id) + TimelineManager.highlightRoom(id) quickSwitcher.close() } target: completerPopup diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index f575e133..8c84c145 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -72,7 +72,6 @@ Page { id: quickSwitcherComponent QuickSwitcher { - id: quickSwitcher } } diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 9c814bd1..b862e129 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp
@@ -1429,3 +1429,9 @@ ChatPage::handleMatrixUri(const QUrl &uri) { handleMatrixUri(uri.toString(QUrl::ComponentFormattingOption::FullyEncoded).toUtf8()); } + +void +ChatPage::highlightRoom(const QString &room_id) +{ + room_list_->highlightSelectedRoom(room_id); +} \ No newline at end of file diff --git a/src/ChatPage.h b/src/ChatPage.h
index 917bd785..47acd807 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h
@@ -116,6 +116,7 @@ public slots: void startChat(QString userid); void leaveRoom(const QString &room_id); void createRoom(const mtx::requests::CreateRoom &req); + void highlightRoom(const QString &room_id); void joinRoom(const QString &room); void joinRoomVia(const std::string &room_id, const std::vector<std::string> &via); diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 74d416bb..49072ef4 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp
@@ -333,6 +333,12 @@ TimelineViewManager::setHistoryView(const QString &room_id) } } +void +TimelineViewManager::highlightRoom(const QString &room_id) +{ + ChatPage::instance()->highlightRoom(room_id); +} + QString TimelineViewManager::escapeEmoji(QString str) const { diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index d6383806..dfc2e386 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h
@@ -100,6 +100,7 @@ public slots: } void setHistoryView(const QString &room_id); + void highlightRoom(const QString &room_id); TimelineModel *getHistoryView(const QString &room_id) { auto room = models.find(room_id);