Escape html in topics and show line breaks in the settings
This commit is contained in:
parent
a792ea1465
commit
d6109b95fb
@ -72,7 +72,8 @@ Rectangle {
|
||||
font.pointSize: fontMetrics.font.pointSize * 1.1
|
||||
text: room ? room.roomName : qsTr("No room selected")
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
|
@ -62,10 +62,11 @@ RoomsModel::data(const QModelIndex &index, int role) const
|
||||
case CompletionModel::SearchRole:
|
||||
case Qt::DisplayRole:
|
||||
case Roles::RoomAlias:
|
||||
return roomAliases[index.row()];
|
||||
return roomAliases[index.row()].toHtmlEscaped();
|
||||
case CompletionModel::SearchRole2:
|
||||
case Roles::RoomName:
|
||||
return QString::fromStdString(roomInfos.at(roomids[index.row()]).name);
|
||||
return QString::fromStdString(roomInfos.at(roomids[index.row()]).name)
|
||||
.toHtmlEscaped();
|
||||
case Roles::AvatarUrl:
|
||||
return QString::fromStdString(
|
||||
roomInfos.at(roomids[index.row()]).avatar_url);
|
||||
|
@ -474,9 +474,13 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
||||
case RoomId:
|
||||
return QVariant(room_id_);
|
||||
case RoomName:
|
||||
return QVariant(QString::fromStdString(room_name(event)));
|
||||
return QVariant(
|
||||
utils::replaceEmoji(QString::fromStdString(room_name(event)).toHtmlEscaped()));
|
||||
case RoomTopic:
|
||||
return QVariant(QString::fromStdString(room_topic(event)));
|
||||
return QVariant(utils::replaceEmoji(
|
||||
utils::linkifyMessage(QString::fromStdString(room_topic(event))
|
||||
.toHtmlEscaped()
|
||||
.replace("\n", "<br>"))));
|
||||
case CallType:
|
||||
return QVariant(QString::fromStdString(call_type(event)));
|
||||
case Dump: {
|
||||
@ -1633,7 +1637,8 @@ TimelineModel::roomName() const
|
||||
if (!info.count(room_id_))
|
||||
return "";
|
||||
else
|
||||
return QString::fromStdString(info[room_id_].name);
|
||||
return utils::replaceEmoji(
|
||||
QString::fromStdString(info[room_id_].name).toHtmlEscaped());
|
||||
}
|
||||
|
||||
QString
|
||||
@ -1656,5 +1661,5 @@ TimelineModel::roomTopic() const
|
||||
return "";
|
||||
else
|
||||
return utils::replaceEmoji(utils::linkifyMessage(
|
||||
utils::escapeBlacklistedHtml(QString::fromStdString(info[room_id_].topic))));
|
||||
QString::fromStdString(info[room_id_].topic).toHtmlEscaped()));
|
||||
}
|
||||
|
@ -227,13 +227,14 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent)
|
||||
QString
|
||||
RoomSettings::roomName() const
|
||||
{
|
||||
return QString::fromStdString(info_.name);
|
||||
return utils::replaceEmoji(QString::fromStdString(info_.name).toHtmlEscaped());
|
||||
}
|
||||
|
||||
QString
|
||||
RoomSettings::roomTopic() const
|
||||
{
|
||||
return utils::linkifyMessage(QString::fromStdString(info_.topic).toHtmlEscaped());
|
||||
return utils::replaceEmoji(utils::linkifyMessage(
|
||||
QString::fromStdString(info_.topic).toHtmlEscaped().replace("\n", "<br>")));
|
||||
}
|
||||
|
||||
QString
|
||||
|
Loading…
Reference in New Issue
Block a user