From bfd698af36a0dd39e9df677e9af5ee014b462253 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 20 Jun 2016 09:09:49 +0200 Subject: [PATCH] Fix issues detected by clazy Don't use for(:) on Qt containers. It detaches without need. --- core/kdeconnectconfig.cpp | 2 +- plugins/notifications/notificationsdbusinterface.cpp | 2 +- plugins/pausemusic/pausemusicplugin.cpp | 1 - plugins/sendnotifications/notificationslistener.cpp | 4 ++-- tests/testnotificationlistener.cpp | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/kdeconnectconfig.cpp b/core/kdeconnectconfig.cpp index d109308ef..12d3cf2fc 100644 --- a/core/kdeconnectconfig.cpp +++ b/core/kdeconnectconfig.cpp @@ -114,7 +114,7 @@ KdeConnectConfig::KdeConnectConfig() QFile cert(certPath); if (cert.exists() && cert.open(QIODevice::ReadOnly)) { - d->certificate = QSslCertificate::fromPath(certPath).first(); + d->certificate = QSslCertificate::fromPath(certPath).at(0); } else { diff --git a/plugins/notifications/notificationsdbusinterface.cpp b/plugins/notifications/notificationsdbusinterface.cpp index 34bd373e8..471aae5bc 100644 --- a/plugins/notifications/notificationsdbusinterface.cpp +++ b/plugins/notifications/notificationsdbusinterface.cpp @@ -69,7 +69,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np) id = id.mid(id.indexOf("::") + 2); removeNotification(id); } else if (np.get("isRequest")) { - for (const auto& n: mNotifications) { + foreach (const auto& n, mNotifications) { NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST); np.set("id", n->internalId()); np.set("appName", n->appName()); diff --git a/plugins/pausemusic/pausemusicplugin.cpp b/plugins/pausemusic/pausemusicplugin.cpp index 85ef74e0a..3ff2c2861 100644 --- a/plugins/pausemusic/pausemusicplugin.cpp +++ b/plugins/pausemusic/pausemusicplugin.cpp @@ -125,7 +125,6 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np) //Calling play does not work for Spotify //mprisInterface->call(QDBus::Block,"Play"); //Workaround: Using playpause instead (checking first if it is already playing) - QString status = mprisInterface.property("PlaybackStatus").toString(); mprisInterface.asyncCall("PlayPause"); //End of workaround } diff --git a/plugins/sendnotifications/notificationslistener.cpp b/plugins/sendnotifications/notificationslistener.cpp index f0ea77e63..f907de699 100644 --- a/plugins/sendnotifications/notificationslistener.cpp +++ b/plugins/sendnotifications/notificationslistener.cpp @@ -96,7 +96,7 @@ void NotificationsListener::loadApplications() { applications.clear(); QVariantList list = mPlugin->config()->getList("applications"); - for (const auto& a: list) { + foreach (const auto& a, list) { NotifyingApplication app = a.value(); if (!applications.contains(app.name)) applications.insert(app.name, app); @@ -129,7 +129,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId, applications.insert(app.name, app); // update config: QVariantList list; - for (const auto& a: applications.values()) + foreach (const auto& a, applications) list << QVariant::fromValue(a); mPlugin->config()->setList("applications", list); //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app; diff --git a/tests/testnotificationlistener.cpp b/tests/testnotificationlistener.cpp index 59367f97d..35ddedb61 100644 --- a/tests/testnotificationlistener.cpp +++ b/tests/testnotificationlistener.cpp @@ -328,7 +328,7 @@ void TestNotificationListener::testNotify() // icon synchronization: int count = 0; - for (const auto& iconName: KIconLoader::global()->queryIcons(-KIconLoader::SizeEnormous, KIconLoader::Application)) { + foreach (const auto& iconName, KIconLoader::global()->queryIcons(-KIconLoader::SizeEnormous, KIconLoader::Application)) { if (!iconName.endsWith(".png")) continue; if (count++ > 3) // max 3 iterations