Fix wrong tags in context menu

left-avatar
Nicolas Werner 3 years ago
parent 019bcf5f5c
commit 84434433f2
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 2
      resources/qml/RoomList.qml
  2. 10
      src/timeline/CommunitiesModel.h

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

@ -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:

Loading…
Cancel
Save