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

Allow removing users from the invite dialog

parent e09af0b1
No related branches found
No related tags found
No related merge requests found
......@@ -116,6 +116,7 @@ ApplicationWindow {
spacing: Nheko.paddingMedium
anchors.verticalCenter: parent.verticalCenter
x: parent.x + Nheko.paddingSmall
width: del.width - Nheko.paddingSmall * 2
Avatar {
width: Nheko.avatarSize
......@@ -148,11 +149,21 @@ ApplicationWindow {
}
CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
ImageButton {
image: ":/icons/icons/ui/remove-symbol.png"
onClicked: invitees.removeUser(model.mxid)
}
}
CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}
}
......
......@@ -30,6 +30,20 @@ InviteesModel::addUser(QString mxid)
emit countChanged();
}
void
InviteesModel::removeUser(QString mxid)
{
for (int i = 0; i < invitees_.length(); ++i) {
if (invitees_[i]->mxid_ == mxid) {
beginRemoveRows(QModelIndex(), i, i);
invitees_.removeAt(i);
endRemoveRows();
emit countChanged();
break;
}
}
}
QHash<int, QByteArray>
InviteesModel::roleNames() const
{
......
......@@ -43,6 +43,7 @@ public:
InviteesModel(QObject *parent = nullptr);
Q_INVOKABLE void addUser(QString mxid);
Q_INVOKABLE void removeUser(QString mxid);
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex & = QModelIndex()) const override
......
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