Open room members when member info label clicked

This commit is contained in:
Loren Burkholder 2021-07-21 10:08:04 -04:00
parent d33538316c
commit b17002929c
5 changed files with 16 additions and 6 deletions

View file

@ -4,7 +4,7 @@
import "./ui"
import Qt.labs.platform 1.1 as Platform
import QtQuick 2.9
import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.3
@ -105,6 +105,16 @@ ApplicationWindow {
MatrixText {
text: qsTr("%1 member(s)").arg(roomSettings.memberCount)
Layout.alignment: Qt.AlignHCenter
TapHandler {
onTapped: Rooms.currentRoom.openRoomMembers(roomSettings.roomId)
}
CursorShape {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
}
}
}

View file

@ -22,7 +22,7 @@
#include "timeline/TimelineViewManager.h"
#include "ui/Avatar.h"
MemberList::MemberList(const QString &room_id, QWidget *parent)
MemberList::MemberList(const QString &room_id, QObject *parent)
: QAbstractListModel{parent}
, room_id_{room_id}
{

View file

@ -25,7 +25,7 @@ public:
DisplayName,
AvatarUrl,
};
MemberList(const QString &room_id, QWidget *parent = nullptr);
MemberList(const QString &room_id, QObject *parent = nullptr);
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override

View file

@ -1067,9 +1067,9 @@ TimelineModel::openUserProfile(QString userid)
}
void
TimelineModel::openRoomMembers()
TimelineModel::openRoomMembers(QString room_id)
{
MemberList *memberList = new MemberList(roomId());
MemberList *memberList = new MemberList(room_id == QString() ? roomId() : room_id, this);
emit openRoomMembersDialog(memberList);
}

View file

@ -239,7 +239,7 @@ public:
Q_INVOKABLE void forwardMessage(QString eventId, QString roomId);
Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
Q_INVOKABLE void openUserProfile(QString userid);
Q_INVOKABLE void openRoomMembers();
Q_INVOKABLE void openRoomMembers(QString room_id = QString());
Q_INVOKABLE void openRoomSettings(QString room_id = QString());
Q_INVOKABLE void openInviteUsers(QString roomId = QString());
Q_INVOKABLE void editAction(QString id);