mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Allow removing users from the invite dialog
This commit is contained in:
parent
e09af0b101
commit
b1c1274d96
3 changed files with 29 additions and 3 deletions
|
@ -116,6 +116,7 @@ ApplicationWindow {
|
||||||
spacing: Nheko.paddingMedium
|
spacing: Nheko.paddingMedium
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
x: parent.x + Nheko.paddingSmall
|
x: parent.x + Nheko.paddingSmall
|
||||||
|
width: del.width - Nheko.paddingSmall * 2
|
||||||
|
|
||||||
Avatar {
|
Avatar {
|
||||||
width: Nheko.avatarSize
|
width: Nheko.avatarSize
|
||||||
|
@ -148,11 +149,21 @@ ApplicationWindow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorShape {
|
Item {
|
||||||
anchors.fill: parent
|
Layout.fillWidth: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
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();
|
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>
|
QHash<int, QByteArray>
|
||||||
InviteesModel::roleNames() const
|
InviteesModel::roleNames() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
InviteesModel(QObject *parent = nullptr);
|
InviteesModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE void addUser(QString mxid);
|
Q_INVOKABLE void addUser(QString mxid);
|
||||||
|
Q_INVOKABLE void removeUser(QString mxid);
|
||||||
|
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
int rowCount(const QModelIndex & = QModelIndex()) const override
|
int rowCount(const QModelIndex & = QModelIndex()) const override
|
||||||
|
|
Loading…
Reference in a new issue