Fix issues detected by clazy

Don't use for(:) on Qt containers. It detaches without need.
This commit is contained in:
Aleix Pol 2016-06-20 09:09:49 +02:00
parent 596e4484f4
commit bfd698af36
5 changed files with 5 additions and 6 deletions

View file

@ -114,7 +114,7 @@ KdeConnectConfig::KdeConnectConfig()
QFile cert(certPath); QFile cert(certPath);
if (cert.exists() && cert.open(QIODevice::ReadOnly)) { if (cert.exists() && cert.open(QIODevice::ReadOnly)) {
d->certificate = QSslCertificate::fromPath(certPath).first(); d->certificate = QSslCertificate::fromPath(certPath).at(0);
} else { } else {

View file

@ -69,7 +69,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
id = id.mid(id.indexOf("::") + 2); id = id.mid(id.indexOf("::") + 2);
removeNotification(id); removeNotification(id);
} else if (np.get<bool>("isRequest")) { } else if (np.get<bool>("isRequest")) {
for (const auto& n: mNotifications) { foreach (const auto& n, mNotifications) {
NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST); NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST);
np.set("id", n->internalId()); np.set("id", n->internalId());
np.set("appName", n->appName()); np.set("appName", n->appName());

View file

@ -125,7 +125,6 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
//Calling play does not work for Spotify //Calling play does not work for Spotify
//mprisInterface->call(QDBus::Block,"Play"); //mprisInterface->call(QDBus::Block,"Play");
//Workaround: Using playpause instead (checking first if it is already playing) //Workaround: Using playpause instead (checking first if it is already playing)
QString status = mprisInterface.property("PlaybackStatus").toString();
mprisInterface.asyncCall("PlayPause"); mprisInterface.asyncCall("PlayPause");
//End of workaround //End of workaround
} }

View file

@ -96,7 +96,7 @@ void NotificationsListener::loadApplications()
{ {
applications.clear(); applications.clear();
QVariantList list = mPlugin->config()->getList("applications"); QVariantList list = mPlugin->config()->getList("applications");
for (const auto& a: list) { foreach (const auto& a, list) {
NotifyingApplication app = a.value<NotifyingApplication>(); NotifyingApplication app = a.value<NotifyingApplication>();
if (!applications.contains(app.name)) if (!applications.contains(app.name))
applications.insert(app.name, app); applications.insert(app.name, app);
@ -129,7 +129,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId,
applications.insert(app.name, app); applications.insert(app.name, app);
// update config: // update config:
QVariantList list; QVariantList list;
for (const auto& a: applications.values()) foreach (const auto& a, applications)
list << QVariant::fromValue<NotifyingApplication>(a); list << QVariant::fromValue<NotifyingApplication>(a);
mPlugin->config()->setList("applications", list); mPlugin->config()->setList("applications", list);
//qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app; //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app;

View file

@ -328,7 +328,7 @@ void TestNotificationListener::testNotify()
// icon synchronization: // icon synchronization:
int count = 0; 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")) if (!iconName.endsWith(".png"))
continue; continue;
if (count++ > 3) // max 3 iterations if (count++ > 3) // max 3 iterations