Fix wrong tags in context menu

This commit is contained in:
Nicolas Werner 2021-06-14 23:40:06 +02:00
parent 019bcf5f5c
commit 84434433f2
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 11 additions and 1 deletions

View file

@ -70,7 +70,7 @@ Page {
}
Instantiator {
model: Communities.tags
model: Communities.tagsWithDefault
onObjectAdded: roomContextMenu.insertItem(index + 2, object)
onObjectRemoved: roomContextMenu.removeItem(object)

View file

@ -17,6 +17,7 @@ class CommunitiesModel : public QAbstractListModel
Q_PROPERTY(QString currentTagId READ currentTagId WRITE setCurrentTagId NOTIFY
currentTagIdChanged RESET resetCurrentTagId)
Q_PROPERTY(QStringList tags READ tags NOTIFY tagsChanged)
Q_PROPERTY(QStringList tagsWithDefault READ tagsWithDefault NOTIFY tagsChanged)
public:
enum Roles
@ -50,6 +51,15 @@ public slots:
emit currentTagIdChanged(currentTagId_);
}
QStringList tags() const { return tags_; }
QStringList tagsWithDefault() const
{
QStringList tagsWD = tags_;
tagsWD.prepend("m.lowpriority");
tagsWD.prepend("m.favourite");
tagsWD.removeOne("m.server_notice");
tagsWD.removeDuplicates();
return tagsWD;
}
void toggleTagId(QString tagId);
signals: