diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-08-30 12:35:27 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-08-30 12:36:14 +0200 |
commit | 06a8ef6ebed5962117121486059ba46dc7f6d4f9 (patch) | |
tree | c2557b9ca8818ed93f520286d132a321c838b894 | |
parent | f005f3b69651bd6d6f58879804e1281f6c08177a (diff) | |
download | libquotient-06a8ef6ebed5962117121486059ba46dc7f6d4f9.tar.gz libquotient-06a8ef6ebed5962117121486059ba46dc7f6d4f9.zip |
Room: displayNameForHtml
This is useful for cases when the room display name is returned to QML
that doesn't have an equivalent of QString::toHtmlEscaped().
-rw-r--r-- | lib/room.cpp | 5 | ||||
-rw-r--r-- | lib/room.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index 45f1af53..890da13d 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -549,6 +549,11 @@ QString Room::canonicalAlias() const QString Room::displayName() const { return d->displayname; } +QString Room::displayNameForHtml() const +{ + return displayName().toHtmlEscaped(); +} + void Room::refreshDisplayName() { d->updateDisplayname(); } QString Room::topic() const @@ -85,6 +85,7 @@ class Room : public QObject { Q_PROPERTY(QStringList altAliases READ altAliases NOTIFY namesChanged) Q_PROPERTY(QString canonicalAlias READ canonicalAlias NOTIFY namesChanged) Q_PROPERTY(QString displayName READ displayName NOTIFY displaynameChanged) + Q_PROPERTY(QString displayNameForHtml READ displayNameForHtml NOTIFY displaynameChanged) Q_PROPERTY(QString topic READ topic NOTIFY topicChanged) Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false) @@ -183,6 +184,7 @@ public: //! Get a list of both canonical and alternative aliases QStringList aliases() const; QString displayName() const; + QString displayNameForHtml() const; QString topic() const; QString avatarMediaId() const; QUrl avatarUrl() const; |