enter key now works, fix room highlighting and add overlay

This commit is contained in:
Jedi18 2021-02-23 00:18:31 +05:30
parent 3f4ad1dd8b
commit b1dec6f6ac
7 changed files with 30 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -72,7 +72,6 @@ Page {
id: quickSwitcherComponent
QuickSwitcher {
id: quickSwitcher
}
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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
{

View file

@ -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);