Fix many clazy warnings
This commit is contained in:
committed by
Tobias Fella
parent
c08693c508
commit
9cad195704
@@ -121,7 +121,7 @@ void Server::start()
|
||||
QFile key(QStringLiteral(DATA_DIR) + u"/localhost.key"_s);
|
||||
void(key.open(QFile::ReadOnly));
|
||||
config.setPrivateKey(QSslKey(&key, QSsl::Rsa));
|
||||
config.setLocalCertificate(QSslCertificate::fromPath(QStringLiteral(DATA_DIR) + u"/localhost.crt"_s).front());
|
||||
config.setLocalCertificate(QSslCertificate::fromPath(QStringLiteral(DATA_DIR) + u"/localhost.crt"_s).constFirst());
|
||||
m_sslServer.setSslConfiguration(config);
|
||||
if (!m_sslServer.listen(QHostAddress::LocalHost, 1234) || !m_server.bind(&m_sslServer)) {
|
||||
qFatal() << "Server failed to listen on a port.";
|
||||
@@ -227,7 +227,8 @@ void Server::sync(const QHttpServerRequest &request, QHttpServerResponder &respo
|
||||
QJsonObject joinRooms;
|
||||
auto token = request.query().queryItemValue(u"since"_s).toInt();
|
||||
|
||||
for (const auto &change : m_state.mid(token)) {
|
||||
const auto changes = m_state.mid(token);
|
||||
for (const auto &change : changes) {
|
||||
for (const auto &newRoom : change.newRooms) {
|
||||
QJsonArray stateEvents;
|
||||
stateEvents += QJsonObject{
|
||||
@@ -272,7 +273,7 @@ void Server::sync(const QHttpServerRequest &request, QHttpServerResponder &respo
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &change : m_state.mid(token)) {
|
||||
for (const auto &change : changes) {
|
||||
for (const auto &invitation : change.invitations) {
|
||||
// TODO: The invitation could be for a room we haven't joined yet. Shouldn't be necessary for now, though.
|
||||
auto stateEvents = joinRooms[invitation.roomId][u"state"_s][u"events"_s].toArray();
|
||||
@@ -299,7 +300,7 @@ void Server::sync(const QHttpServerRequest &request, QHttpServerResponder &respo
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &change : m_state.mid(token)) {
|
||||
for (const auto &change : changes) {
|
||||
for (const auto &ban : change.bans) {
|
||||
// TODO: The ban could be for a room we haven't joined yet. Shouldn't be necessary for now, though.
|
||||
auto stateEvents = joinRooms[ban.roomId][u"state"_s][u"events"_s].toArray();
|
||||
@@ -326,7 +327,7 @@ void Server::sync(const QHttpServerRequest &request, QHttpServerResponder &respo
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &change : m_state.mid(token)) {
|
||||
for (const auto &change : changes) {
|
||||
for (const auto &join : change.joins) {
|
||||
// TODO: The join could be for a room we haven't joined yet. Shouldn't be necessary for now, though.
|
||||
auto stateEvents = joinRooms[join.roomId][u"state"_s][u"events"_s].toArray();
|
||||
@@ -353,7 +354,7 @@ void Server::sync(const QHttpServerRequest &request, QHttpServerResponder &respo
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &change : m_state.mid(token)) {
|
||||
for (const auto &change : changes) {
|
||||
for (const auto &state : change.stateEvents) {
|
||||
const auto &roomId = state.fullJson[u"room_id"_s].toString();
|
||||
// TODO: The join could be for a room we haven't joined yet. Shouldn't be necessary for now, though.
|
||||
@@ -365,7 +366,7 @@ void Server::sync(const QHttpServerRequest &request, QHttpServerResponder &respo
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &change : m_state.mid(token)) {
|
||||
for (const auto &change : changes) {
|
||||
for (const auto &event : change.events) {
|
||||
// TODO the room might be in a different join state.
|
||||
auto timeline = joinRooms[event.fullJson[u"room_id"_s].toString()][u"timeline"_s][u"events"_s].toArray();
|
||||
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
*
|
||||
* @sa Quotient::UriResolverBase::visitResource()
|
||||
*/
|
||||
Q_INVOKABLE void resolveResource(Uri uri, const QString &action = {});
|
||||
Q_INVOKABLE void resolveResource(Quotient::Uri uri, const QString &action = {});
|
||||
|
||||
bool hasOpenRoom() const;
|
||||
|
||||
@@ -235,7 +235,7 @@ public:
|
||||
* @brief Show a context menu for the given event.
|
||||
*/
|
||||
Q_INVOKABLE void
|
||||
viewEventMenu(QObject *parent, const RoomEvent *event, NeoChatRoom *room, const QString &selectedText = {}, const QString &hoveredLink = {});
|
||||
viewEventMenu(QObject *parent, const Quotient::RoomEvent *event, NeoChatRoom *room, const QString &selectedText = {}, const QString &hoveredLink = {});
|
||||
|
||||
/**
|
||||
* @brief Set a URL to be loaded as the initial room.
|
||||
@@ -316,7 +316,7 @@ Q_SIGNALS:
|
||||
const QString &plainText,
|
||||
const QString &richtText,
|
||||
const QString &mimeType,
|
||||
const FileTransferInfo &progressInfo,
|
||||
const Quotient::FileTransferInfo &progressInfo,
|
||||
const QString &selectedText,
|
||||
const QString &hoveredLink);
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ Quotient::AccountRegistry *AccountManager::accounts()
|
||||
|
||||
void AccountManager::loadAccountsFromCache()
|
||||
{
|
||||
for (const auto &accountId : Quotient::SettingsGroup("Accounts"_L1).childGroups()) {
|
||||
const auto accounts = Quotient::SettingsGroup("Accounts"_L1).childGroups();
|
||||
for (const auto &accountId : accounts) {
|
||||
Quotient::AccountSettings account{accountId};
|
||||
m_accountsLoading += accountId;
|
||||
Q_EMIT accountsLoadingChanged();
|
||||
@@ -57,14 +58,14 @@ void AccountManager::loadAccountsFromCache()
|
||||
m_connectionsLoading[accountId] = connection;
|
||||
connect(connection, &NeoChatConnection::connected, this, [this, connection, accountId] {
|
||||
connection->loadState();
|
||||
if (connection->allRooms().size() == 0 || connection->allRooms()[0]->currentState().get<Quotient::RoomCreateEvent>()) {
|
||||
if (connection->allRooms().size() == 0 || connection->allRooms().at(0)->currentState().get<Quotient::RoomCreateEvent>()) {
|
||||
addConnection(connection);
|
||||
m_accountsLoading.removeAll(connection->userId());
|
||||
m_connectionsLoading.remove(accountId);
|
||||
Q_EMIT accountsLoadingChanged();
|
||||
} else {
|
||||
connect(
|
||||
connection->allRooms()[0],
|
||||
connection->allRooms().at(0),
|
||||
&NeoChatRoom::baseStateLoaded,
|
||||
this,
|
||||
[this, connection, accountId]() {
|
||||
|
||||
@@ -38,7 +38,7 @@ void ChatBarSyntaxHighlighter::highlightBlock(const QString &text)
|
||||
m_errors.clear();
|
||||
m_checker->setText(text);
|
||||
}
|
||||
for (const auto &error : m_errors) {
|
||||
for (const auto &error : std::as_const(m_errors)) {
|
||||
setFormat(error.first, error.second.size(), m_errorFormat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
*
|
||||
* @sa Parameter
|
||||
*/
|
||||
Q_INVOKABLE static QString parameterName(Parameter parameter)
|
||||
Q_INVOKABLE static QString parameterName(RoomSortParameter::Parameter parameter)
|
||||
{
|
||||
switch (parameter) {
|
||||
case Parameter::AlphabeticalAscending:
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
*
|
||||
* @sa Parameter
|
||||
*/
|
||||
Q_INVOKABLE static QString parameterDescription(Parameter parameter)
|
||||
Q_INVOKABLE static QString parameterDescription(RoomSortParameter::Parameter parameter)
|
||||
{
|
||||
switch (parameter) {
|
||||
case Parameter::AlphabeticalAscending:
|
||||
|
||||
@@ -56,7 +56,7 @@ void CustomEmojiModel::fetchEmojis()
|
||||
|
||||
const auto e = emoji.startsWith(":"_L1) ? emoji : (u":"_s + emoji + u":"_s);
|
||||
|
||||
m_emojis << CustomEmoji{e, data.toObject()["url"_L1].toString(), QRegularExpression(e)};
|
||||
m_emojis << CustomEmoji{e, data.toObject().value("url"_L1).toString(), QRegularExpression(e)};
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
/**
|
||||
* @brief Return a list of emojis for the given category.
|
||||
*/
|
||||
Q_INVOKABLE QVariantList emojis(Category category) const;
|
||||
Q_INVOKABLE QVariantList emojis(EmojiModel::Category category) const;
|
||||
|
||||
/**
|
||||
* @brief Return a list of emoji tones for the given base emoji.
|
||||
|
||||
@@ -72,7 +72,7 @@ void NeoChatConnection::connectSignals()
|
||||
}
|
||||
});
|
||||
connect(this, &NeoChatConnection::requestFailed, this, [this](BaseJob *job) {
|
||||
if (dynamic_cast<DownloadFileJob *>(job) && job->jsonData()["errcode"_L1].toString() == "M_TOO_LARGE"_L1) {
|
||||
if (dynamic_cast<DownloadFileJob *>(job) && job->jsonData().value("errcode"_L1).toString() == "M_TOO_LARGE"_L1) {
|
||||
Q_EMIT showMessage(MessageType::Warning, i18n("File too large to download.<br />Contact your matrix server administrator for support."));
|
||||
}
|
||||
});
|
||||
@@ -168,7 +168,8 @@ int NeoChatConnection::badgeNotificationCount() const
|
||||
void NeoChatConnection::refreshBadgeNotificationCount()
|
||||
{
|
||||
int count = 0;
|
||||
for (const auto &r : allRooms()) {
|
||||
const auto rooms = allRooms();
|
||||
for (const auto &r : rooms) {
|
||||
if (const auto room = static_cast<NeoChatRoom *>(r)) {
|
||||
count += room->contextAwareNotificationCount();
|
||||
|
||||
@@ -287,7 +288,7 @@ void NeoChatConnection::setLabel(const QString &label)
|
||||
|
||||
QString NeoChatConnection::label() const
|
||||
{
|
||||
return accountDataJson("org.kde.neochat.account_label"_L1)["account_label"_L1].toString();
|
||||
return accountDataJson("org.kde.neochat.account_label"_L1).value("account_label"_L1).toString();
|
||||
}
|
||||
|
||||
void NeoChatConnection::deactivateAccount(const QString &password, const bool erase)
|
||||
@@ -416,7 +417,8 @@ qsizetype NeoChatConnection::directChatNotifications() const
|
||||
{
|
||||
qsizetype notifications = 0;
|
||||
QStringList added; // The same ID can be in the list multiple times.
|
||||
for (const auto &chatId : directChats()) {
|
||||
const auto roomIds = directChats();
|
||||
for (const auto &chatId : roomIds) {
|
||||
if (!added.contains(chatId)) {
|
||||
if (const auto chat = room(chatId)) {
|
||||
notifications += dynamic_cast<NeoChatRoom *>(chat)->contextAwareNotificationCount();
|
||||
@@ -429,7 +431,8 @@ qsizetype NeoChatConnection::directChatNotifications() const
|
||||
|
||||
bool NeoChatConnection::directChatsHaveHighlightNotifications() const
|
||||
{
|
||||
for (const auto &childId : directChats()) {
|
||||
const auto roomIds = directChats();
|
||||
for (const auto &childId : roomIds) {
|
||||
if (const auto child = static_cast<NeoChatRoom *>(room(childId))) {
|
||||
if (child->highlightCount() > 0) {
|
||||
return true;
|
||||
@@ -444,7 +447,8 @@ qsizetype NeoChatConnection::homeNotifications() const
|
||||
qsizetype notifications = 0;
|
||||
QStringList added;
|
||||
const auto &spaceHierarchyCache = SpaceHierarchyCache::instance();
|
||||
for (const auto &r : allRooms()) {
|
||||
const auto rooms = allRooms();
|
||||
for (const auto &r : rooms) {
|
||||
if (const auto room = static_cast<NeoChatRoom *>(r)) {
|
||||
if (!added.contains(room->id()) && !room->isDirectChat() && !spaceHierarchyCache.isChild(room->id())) {
|
||||
notifications += dynamic_cast<NeoChatRoom *>(room)->contextAwareNotificationCount();
|
||||
@@ -458,7 +462,8 @@ qsizetype NeoChatConnection::homeNotifications() const
|
||||
bool NeoChatConnection::homeHaveHighlightNotifications() const
|
||||
{
|
||||
const auto &spaceHierarchyCache = SpaceHierarchyCache::instance();
|
||||
for (const auto &r : allRooms()) {
|
||||
const auto rooms = allRooms();
|
||||
for (const auto &r : rooms) {
|
||||
if (const auto room = static_cast<NeoChatRoom *>(r)) {
|
||||
if (!room->isDirectChat() && !spaceHierarchyCache.isChild(room->id()) && room->highlightCount() > 0) {
|
||||
return true;
|
||||
@@ -641,7 +646,7 @@ void NeoChatConnection::setNoteForUser(const QString &userId, const QString ¬
|
||||
|
||||
bool NeoChatConnection::blockAllInvites() const
|
||||
{
|
||||
return accountDataJson("m.invite_permission_config"_L1)["default_action"_L1].toString() == "block"_L1;
|
||||
return accountDataJson("m.invite_permission_config"_L1).value("default_action"_L1).toString() == "block"_L1;
|
||||
}
|
||||
|
||||
void NeoChatConnection::setBlockAllInvites(bool block)
|
||||
|
||||
@@ -146,7 +146,7 @@ NeoChatRoom::NeoChatRoom(Connection *c, QString roomId, JoinState joinState)
|
||||
connect(this, &Room::changed, this, [this]() {
|
||||
Q_EMIT defaultUrlPreviewStateChanged();
|
||||
});
|
||||
connect(this, &Room::accountDataChanged, this, [this](QString type) {
|
||||
connect(this, &Room::accountDataChanged, this, [this](const QString &type) {
|
||||
if (type == "org.matrix.room.preview_urls"_L1) {
|
||||
Q_EMIT urlPreviewEnabledChanged();
|
||||
}
|
||||
@@ -348,7 +348,7 @@ void NeoChatRoom::forget()
|
||||
}
|
||||
|
||||
const auto neochatConnection = dynamic_cast<NeoChatConnection *>(connection());
|
||||
for (const auto &id : roomIds) {
|
||||
for (const auto &id : std::as_const(roomIds)) {
|
||||
neochatConnection->forgetRoom(id);
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,8 @@ QUrl NeoChatRoom::avatarMediaUrl() const
|
||||
}
|
||||
|
||||
// Use the first (excluding self) user's avatar for direct chats
|
||||
for (const auto &member : directChatMembers()) {
|
||||
const auto members = directChatMembers();
|
||||
for (const auto &member : members) {
|
||||
if (member != localMember()) {
|
||||
return member.avatarUrl();
|
||||
}
|
||||
@@ -763,7 +764,7 @@ bool NeoChatRoom::hasParent() const
|
||||
|
||||
QList<QString> NeoChatRoom::parentIds() const
|
||||
{
|
||||
auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
const auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
QList<QString> parentIds;
|
||||
for (const auto &parentEvent : parentEvents) {
|
||||
if (parentEvent->contentJson().contains("via"_L1) && !parentEvent->contentPart<QJsonArray>("via"_L1).isEmpty()) {
|
||||
@@ -776,7 +777,7 @@ QList<QString> NeoChatRoom::parentIds() const
|
||||
QList<NeoChatRoom *> NeoChatRoom::parentObjects(bool multiLevel) const
|
||||
{
|
||||
QList<NeoChatRoom *> parentObjects;
|
||||
QList<QString> parentIds = this->parentIds();
|
||||
const auto parentIds = this->parentIds();
|
||||
for (const auto &parentId : parentIds) {
|
||||
if (auto parentObject = static_cast<NeoChatRoom *>(connection()->room(parentId))) {
|
||||
parentObjects += parentObject;
|
||||
@@ -790,7 +791,7 @@ QList<NeoChatRoom *> NeoChatRoom::parentObjects(bool multiLevel) const
|
||||
|
||||
QString NeoChatRoom::canonicalParent() const
|
||||
{
|
||||
auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
const auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
for (const auto &parentEvent : parentEvents) {
|
||||
if (parentEvent->contentJson().contains("via"_L1) && !parentEvent->contentPart<QJsonArray>("via"_L1).isEmpty()) {
|
||||
if (parentEvent->contentPart<bool>("canonical"_L1)) {
|
||||
@@ -815,7 +816,7 @@ void NeoChatRoom::setCanonicalParent(const QString &parentId)
|
||||
}
|
||||
|
||||
// Only one canonical parent can exist so make sure others are set false.
|
||||
auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
const auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
for (const auto &parentEvent : parentEvents) {
|
||||
if (parentEvent->contentPart<bool>("canonical"_L1) && parentEvent->stateKey() != parentId) {
|
||||
auto content = parentEvent->contentJson();
|
||||
@@ -858,7 +859,7 @@ void NeoChatRoom::addParent(const QString &parentId, bool canonical, bool setPar
|
||||
}
|
||||
if (canonical) {
|
||||
// Only one canonical parent can exist so make sure others are set false.
|
||||
auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
const auto parentEvents = currentState().eventsOfType("m.space.parent"_L1);
|
||||
for (const auto &parentEvent : parentEvents) {
|
||||
if (parentEvent->contentPart<bool>("canonical"_L1)) {
|
||||
auto content = parentEvent->contentJson();
|
||||
@@ -938,7 +939,7 @@ void NeoChatRoom::addChild(const QString &childId, bool setChildParent, bool can
|
||||
return;
|
||||
}
|
||||
// Only one canonical parent can exist so make sure others are set to false.
|
||||
auto parentEvents = child->currentState().eventsOfType("m.space.parent"_L1);
|
||||
const auto parentEvents = child->currentState().eventsOfType("m.space.parent"_L1);
|
||||
for (const auto &parentEvent : parentEvents) {
|
||||
if (!parentEvent->contentPart<bool>("canonical"_L1)) {
|
||||
continue;
|
||||
@@ -1048,7 +1049,7 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
|
||||
|
||||
// For default and mute check for a room rule and remove if found.
|
||||
if (state == PushNotificationState::Default || state == PushNotificationState::Mute) {
|
||||
QJsonArray roomRuleArray = accountData["global"_L1].toObject()["room"_L1].toArray();
|
||||
const auto roomRuleArray = accountData["global"_L1].toObject()["room"_L1].toArray();
|
||||
for (const auto &i : roomRuleArray) {
|
||||
QJsonObject roomRule = i.toObject();
|
||||
if (roomRule["rule_id"_L1] == id()) {
|
||||
@@ -1059,7 +1060,7 @@ void NeoChatRoom::setPushNotificationState(PushNotificationState::State state)
|
||||
|
||||
// For default, all and @mentions and keywords check for an override rule and remove if found.
|
||||
if (state == PushNotificationState::Default || state == PushNotificationState::All || state == PushNotificationState::MentionKeyword) {
|
||||
QJsonArray overrideRuleArray = accountData["global"_L1].toObject()["override"_L1].toArray();
|
||||
const auto overrideRuleArray = accountData["global"_L1].toObject()["override"_L1].toArray();
|
||||
for (const auto &i : overrideRuleArray) {
|
||||
QJsonObject overrideRule = i.toObject();
|
||||
if (overrideRule["rule_id"_L1] == id()) {
|
||||
@@ -1191,7 +1192,7 @@ void NeoChatRoom::updatePushNotificationState(QString type)
|
||||
QJsonObject accountData = connection()->accountDataJson("m.push_rules"_L1);
|
||||
|
||||
// First look for a room rule with the room id
|
||||
QJsonArray roomRuleArray = accountData["global"_L1].toObject()["room"_L1].toArray();
|
||||
const auto roomRuleArray = accountData["global"_L1].toObject()["room"_L1].toArray();
|
||||
for (const auto &i : roomRuleArray) {
|
||||
QJsonObject roomRule = i.toObject();
|
||||
if (roomRule["rule_id"_L1] == id()) {
|
||||
@@ -1214,7 +1215,7 @@ void NeoChatRoom::updatePushNotificationState(QString type)
|
||||
}
|
||||
|
||||
// Check for an override rule with the room id
|
||||
QJsonArray overrideRuleArray = accountData["global"_L1].toObject()["override"_L1].toArray();
|
||||
const auto overrideRuleArray = accountData["global"_L1].toObject()["override"_L1].toArray();
|
||||
for (const auto &i : overrideRuleArray) {
|
||||
QJsonObject overrideRule = i.toObject();
|
||||
if (overrideRule["rule_id"_L1] == id()) {
|
||||
@@ -1577,7 +1578,8 @@ void NeoChatRoom::setCanonicalAlias(const QString &newAlias)
|
||||
int NeoChatRoom::maxRoomVersion() const
|
||||
{
|
||||
int maxVersion = 0;
|
||||
for (auto roomVersion : connection()->availableRoomVersions()) {
|
||||
const auto availableVersions = connection()->availableRoomVersions();
|
||||
for (const auto &roomVersion : availableVersions) {
|
||||
if (roomVersion.id.toInt() > maxVersion) {
|
||||
maxVersion = roomVersion.id.toInt();
|
||||
}
|
||||
@@ -1591,7 +1593,7 @@ NeochatRoomMember *NeoChatRoom::directChatRemoteMember()
|
||||
qWarning() << "No other member available in this room";
|
||||
return {};
|
||||
}
|
||||
return new NeochatRoomMember(this, directChatMembers()[0].id());
|
||||
return new NeochatRoomMember(this, directChatMembers().at(0).id());
|
||||
}
|
||||
|
||||
void NeoChatRoom::sendLocation(float lat, float lon, const QString &description)
|
||||
@@ -1898,7 +1900,7 @@ void NeoChatRoom::sortAllMembers()
|
||||
// Build up a temporary cache, because we may be checking the same member over and over while sorting.
|
||||
QHash<QString, int> effectivePowerLevels;
|
||||
effectivePowerLevels.reserve(m_sortedMemberIds.size());
|
||||
for (const auto &member : m_sortedMemberIds) {
|
||||
for (const auto &member : std::as_const(m_sortedMemberIds)) {
|
||||
effectivePowerLevels[member] = memberEffectivePowerLevel(member);
|
||||
}
|
||||
|
||||
@@ -2002,7 +2004,7 @@ QString NeoChatRoom::getFormattedSelectedMessages() const
|
||||
QString formattedContent;
|
||||
formattedContent.reserve(events.size() * 256); // estimate an average of 256 characters per message
|
||||
|
||||
for (const RoomEvent *event : events) {
|
||||
for (const RoomEvent *event : std::as_const(events)) {
|
||||
formattedContent += EventHandler::authorDisplayName(this, event);
|
||||
formattedContent += u" — "_s;
|
||||
formattedContent += EventHandler::dateTime(this, event).shortDateTime();
|
||||
@@ -2017,7 +2019,7 @@ QString NeoChatRoom::getFormattedSelectedMessages() const
|
||||
void NeoChatRoom::deleteSelectedMessages(const QString &reason)
|
||||
{
|
||||
QStringList events;
|
||||
for (const auto &eventId : m_selectedMessageIds) {
|
||||
for (const auto &eventId : std::as_const(m_selectedMessageIds)) {
|
||||
const auto eventIt = findInTimeline(eventId);
|
||||
if (eventIt == historyEdge()) {
|
||||
continue;
|
||||
|
||||
@@ -46,14 +46,14 @@ ChatBarMessageContentModel::ChatBarMessageContentModel(QObject *parent)
|
||||
m_keyHelper->setTextItem(focusedTextItem());
|
||||
});
|
||||
connect(this, &ChatBarMessageContentModel::roomChanged, this, [this]() {
|
||||
for (const auto &component : m_components) {
|
||||
for (const auto &component : std::as_const(m_components)) {
|
||||
if (const auto textItem = textItemForComponent(component)) {
|
||||
textItem->setRoom(m_room);
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(this, &ChatBarMessageContentModel::typeChanged, this, [this](ChatBarType::Type oldType) {
|
||||
for (const auto &component : m_components) {
|
||||
for (const auto &component : std::as_const(m_components)) {
|
||||
if (const auto textItem = textItemForComponent(component)) {
|
||||
textItem->setType(m_type);
|
||||
}
|
||||
@@ -361,7 +361,7 @@ void ChatBarMessageContentModel::addAttachment(const QUrl &path)
|
||||
}
|
||||
|
||||
QString plainText;
|
||||
for (const auto &component : m_components) {
|
||||
for (const auto &component : std::as_const(m_components)) {
|
||||
if (const auto textItem = textItemForComponent(component)) {
|
||||
plainText += u"%1%2"_s.arg(plainText.isEmpty() ? u""_s : u"\n"_s, textItem->plainText());
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ void RoomTreeModel::resetModel()
|
||||
m_rootItem->insertChild(std::make_unique<RoomTreeItem>(NeoChatRoomType::Types(i), m_rootItem.get()));
|
||||
}
|
||||
|
||||
for (const auto &r : m_connection->allRooms()) {
|
||||
const auto rooms = m_connection->allRooms();
|
||||
for (const auto &r : rooms) {
|
||||
const auto room = dynamic_cast<NeoChatRoom *>(r);
|
||||
const auto type = NeoChatRoomType::typeForRoom(room);
|
||||
const auto categoryItem = m_rootItem->child(type);
|
||||
|
||||
@@ -57,7 +57,8 @@ bool SortFilterRoomTreeModel::lessThan(const QModelIndex &source_left, const QMo
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto sortRole : RoomSortParameter::currentParameterList()) {
|
||||
const auto parameters = RoomSortParameter::currentParameterList();
|
||||
for (const auto sortRole : parameters) {
|
||||
auto result = RoomSortParameter::compareParameter(sortRole, leftRoom, rightRoom);
|
||||
|
||||
if (result != 0) {
|
||||
|
||||
@@ -70,7 +70,6 @@ public:
|
||||
|
||||
Q_SIGNALS:
|
||||
void searchTextChanged();
|
||||
void roomChanged();
|
||||
void searchingChanged();
|
||||
void senderIdChanged();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user