mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix completions in plain text mode
This commit is contained in:
parent
0619120ab5
commit
6fd485a74a
2 changed files with 18 additions and 6 deletions
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "Cache_p.h"
|
#include "Cache_p.h"
|
||||||
#include "CompletionModelRoles.h"
|
#include "CompletionModelRoles.h"
|
||||||
|
#include "UserSettingsPage.h"
|
||||||
|
|
||||||
RoomsModel::RoomsModel(bool showOnlyRoomWithAliases, QObject *parent)
|
RoomsModel::RoomsModel(bool showOnlyRoomWithAliases, QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
|
@ -55,9 +56,14 @@ RoomsModel::data(const QModelIndex &index, int role) const
|
||||||
if (hasIndex(index.row(), index.column(), index.parent())) {
|
if (hasIndex(index.row(), index.column(), index.parent())) {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case CompletionModel::CompletionRole: {
|
case CompletionModel::CompletionRole: {
|
||||||
QString percentEncoding = QUrl::toPercentEncoding(roomAliases[index.row()]);
|
if (UserSettings::instance()->markdown()) {
|
||||||
return QString("[%1](https://matrix.to/#/%2)")
|
QString percentEncoding =
|
||||||
.arg(roomAliases[index.row()], percentEncoding);
|
QUrl::toPercentEncoding(roomAliases[index.row()]);
|
||||||
|
return QString("[%1](https://matrix.to/#/%2)")
|
||||||
|
.arg(roomAliases[index.row()], percentEncoding);
|
||||||
|
} else {
|
||||||
|
return roomAliases[index.row()];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case CompletionModel::SearchRole:
|
case CompletionModel::SearchRole:
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
|
|
|
@ -4,8 +4,11 @@
|
||||||
|
|
||||||
#include "UsersModel.h"
|
#include "UsersModel.h"
|
||||||
|
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
#include "CompletionModelRoles.h"
|
#include "CompletionModelRoles.h"
|
||||||
|
#include "UserSettingsPage.h"
|
||||||
|
|
||||||
UsersModel::UsersModel(const std::string &roomId, QObject *parent)
|
UsersModel::UsersModel(const std::string &roomId, QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
|
@ -37,9 +40,12 @@ UsersModel::data(const QModelIndex &index, int role) const
|
||||||
if (hasIndex(index.row(), index.column(), index.parent())) {
|
if (hasIndex(index.row(), index.column(), index.parent())) {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case CompletionModel::CompletionRole:
|
case CompletionModel::CompletionRole:
|
||||||
return QString("[%1](https://matrix.to/#/%2)")
|
if (UserSettings::instance()->markdown())
|
||||||
.arg(displayNames[index.row()])
|
return QString("[%1](https://matrix.to/#/%2)")
|
||||||
.arg(userids[index.row()]);
|
.arg(displayNames[index.row()])
|
||||||
|
.arg(QString(QUrl::toPercentEncoding(userids[index.row()])));
|
||||||
|
else
|
||||||
|
return displayNames[index.row()];
|
||||||
case CompletionModel::SearchRole:
|
case CompletionModel::SearchRole:
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
case Roles::DisplayName:
|
case Roles::DisplayName:
|
||||||
|
|
Loading…
Reference in a new issue