From 4efd1207ee7bb9c99fb114b6de73ddbe58de87e0 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Tue, 3 Aug 2021 20:44:22 +0200 Subject: [PATCH] Some more clazy fixes --- src/actionshandler.cpp | 20 ++++++++++---------- src/notificationsmanager.cpp | 4 ++-- src/roomlistmodel.cpp | 2 +- src/webshortcutmodel.cpp | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/actionshandler.cpp b/src/actionshandler.cpp index 5b91b9bee..d2173d768 100644 --- a/src/actionshandler.cpp +++ b/src/actionshandler.cpp @@ -126,8 +126,8 @@ void ActionsHandler::postMessage(const QString &text, static const QString lennyPrefix = QStringLiteral("/lenny"); static const QString tableflipPrefix = QStringLiteral("/tableflip"); static const QString unflipPrefix = QStringLiteral("/unflip"); - static const QString plainPrefix = QStringLiteral("/plain "); // TODO - static const QString htmlPrefix = QStringLiteral("/html "); // TODO + //static const QString plainPrefix = QStringLiteral("/plain "); // TODO + //static const QString htmlPrefix = QStringLiteral("/html "); // TODO static const QString rainbowPrefix = QStringLiteral("/rainbow "); static const QString rainbowmePrefix = QStringLiteral("/rainbowme "); static const QString spoilerPrefix = QStringLiteral("/spoiler "); @@ -135,12 +135,12 @@ void ActionsHandler::postMessage(const QString &text, static const QString noticePrefix = QStringLiteral("/notice "); // Actions commands - static const QString ddgPrefix = QStringLiteral("/ddg "); // TODO - static const QString nickPrefix = QStringLiteral("/nick "); // TODO - static const QString meroomnickPrefix = QStringLiteral("/myroomnick "); // TODO - static const QString roomavatarPrefix = QStringLiteral("/roomavatar "); // TODO - static const QString myroomavatarPrefix = QStringLiteral("/myroomavatar "); // TODO - static const QString myavatarPrefix = QStringLiteral("/myavatar "); // TODO + //static const QString ddgPrefix = QStringLiteral("/ddg "); // TODO + //static const QString nickPrefix = QStringLiteral("/nick "); // TODO + //static const QString meroomnickPrefix = QStringLiteral("/myroomnick "); // TODO + //static const QString roomavatarPrefix = QStringLiteral("/roomavatar "); // TODO + //static const QString myroomavatarPrefix = QStringLiteral("/myroomavatar "); // TODO + //static const QString myavatarPrefix = QStringLiteral("/myavatar "); // TODO static const QString invitePrefix = QStringLiteral("/invite "); static const QString joinPrefix = QStringLiteral("/join "); static const QString joinShortPrefix = QStringLiteral("/j "); @@ -148,8 +148,8 @@ void ActionsHandler::postMessage(const QString &text, static const QString leavePrefix = QStringLiteral("/leave"); static const QString ignorePrefix = QStringLiteral("/ignore "); static const QString unignorePrefix = QStringLiteral("/unignore "); - static const QString queryPrefix = QStringLiteral("/query "); // TODO - static const QString msgPrefix = QStringLiteral("/msg "); // TODO + //static const QString queryPrefix = QStringLiteral("/query "); // TODO + //static const QString msgPrefix = QStringLiteral("/msg "); // TODO static const QString reactPrefix = QStringLiteral("/react "); // Admin commands diff --git a/src/notificationsmanager.cpp b/src/notificationsmanager.cpp index 9c48ff99b..1e694d413 100644 --- a/src/notificationsmanager.cpp +++ b/src/notificationsmanager.cpp @@ -55,7 +55,7 @@ void NotificationsManager::postNotification(NeoChatRoom *room, notification->setPixmap(img); notification->setDefaultAction(i18n("Open NeoChat in this room")); - connect(notification, &KNotification::defaultActivated, this, [this, room]() { + connect(notification, &KNotification::defaultActivated, this, [&]() { RoomManager::instance().enterRoom(room); Q_EMIT Controller::instance().showWindow(); }); @@ -63,7 +63,7 @@ void NotificationsManager::postNotification(NeoChatRoom *room, #if KNOTIFICATIONS_VERSION >= QT_VERSION_CHECK(5, 81, 0) std::unique_ptr replyAction(new KNotificationReplyAction(i18n("Reply"))); replyAction->setPlaceholderText(i18n("Reply...")); - QObject::connect(replyAction.get(), &KNotificationReplyAction::replied, [room, replyEventId](const QString &text) { + connect(replyAction.get(), &KNotificationReplyAction::replied, this, [room, replyEventId](const QString &text) { room->postMessage(text, room->preprocessText(text), RoomMessageEvent::MsgType::Text, replyEventId, QString()); }); notification->setReplyAction(std::move(replyAction)); diff --git a/src/roomlistmodel.cpp b/src/roomlistmodel.cpp index b131ba123..b9612413d 100644 --- a/src/roomlistmodel.cpp +++ b/src/roomlistmodel.cpp @@ -477,7 +477,7 @@ bool RoomListModel::categoryVisible(int category) const NeoChatRoom *RoomListModel::roomByAliasOrId(const QString &aliasOrId) { - for (const auto &room : m_rooms) { + for (const auto &room : qAsConst(m_rooms)) { if (room->aliases().contains(aliasOrId) || room->id() == aliasOrId) { return room; } diff --git a/src/webshortcutmodel.cpp b/src/webshortcutmodel.cpp index 50f292367..eb1690ccd 100644 --- a/src/webshortcutmodel.cpp +++ b/src/webshortcutmodel.cpp @@ -84,6 +84,7 @@ void KWebShortcutModel::setSelectedText(const QString &selectedText) int KWebShortcutModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); #ifdef HAVE_KIO if (d->selectedText.count() > 0) { return d->searchProviders.count();