Skip to content
Snippets Groups Projects
Commit 24d40136 authored by Loren Burkholder's avatar Loren Burkholder
Browse files

Always open the invite dialog properly from the member list

parent f3ab0aba
No related branches found
No related tags found
No related merge requests found
......@@ -268,8 +268,6 @@ Pane {
var component = Qt.createComponent("qrc:/qml/dialogs/InviteDialog.qml")
if (component.status == Component.Ready) {
var dialog = component.createObject(timelineRoot, {
"roomId": Rooms.currentRoom.roomId,
"plainRoomName": Rooms.currentRoom.plainRoomName,
"invitees": invitees
});
dialog.show();
......
......@@ -12,8 +12,6 @@ import im.nheko 1.0
ApplicationWindow {
id: inviteDialogRoot
property string roomId
property string plainRoomName
property InviteesModel invitees
property var friendsCompleter
property var profile
......@@ -39,7 +37,7 @@ ApplicationWindow {
close();
}
title: qsTr("Invite users to %1").arg(plainRoomName)
title: qsTr("Invite users to %1").arg(invitees.room.plainRoomName)
height: 380
width: 340
palette: Nheko.colors
......
......@@ -9,8 +9,9 @@
#include "MatrixClient.h"
#include "mtx/responses/profile.hpp"
InviteesModel::InviteesModel(QObject *parent)
: QAbstractListModel{parent}
InviteesModel::InviteesModel(TimelineModel *room, QObject *parent)
: QAbstractListModel{parent},
room_{room}
{
}
......
......@@ -8,6 +8,8 @@
#include <QAbstractListModel>
#include <QVector>
class TimelineModel;
class Invitee final : public QObject
{
Q_OBJECT
......@@ -34,6 +36,7 @@ class InviteesModel final : public QAbstractListModel
Q_OBJECT
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
Q_PROPERTY(TimelineModel * room READ room CONSTANT)
public:
enum Roles
......@@ -43,7 +46,9 @@ public:
AvatarUrl,
};
InviteesModel(QObject *parent = nullptr);
InviteesModel(TimelineModel *room, QObject *parent = nullptr);
TimelineModel *room() const { return room_; }
Q_INVOKABLE void addUser(QString mxid, QString displayName = "", QString avatarUrl = "");
Q_INVOKABLE void removeUser(QString mxid);
......@@ -63,6 +68,7 @@ signals:
private:
QVector<Invitee *> invitees_;
TimelineModel *room_;
};
#endif // INVITEESMODEL_H
......@@ -180,7 +180,7 @@ TimelineViewManager::openRoomSettings(QString room_id)
void
TimelineViewManager::openInviteUsers(QString roomId)
{
InviteesModel *model = new InviteesModel{};
InviteesModel *model = new InviteesModel{rooms_->getRoomById(roomId).data()};
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
emit inviteUsers(roomId, model->mxids());
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment