Commit b9d6a400 authored by Nicolas Fella's avatar Nicolas Fella

Use std::any_of

Summary: Makes for more idiomatic code. Bumps the required C++ standard to 14 to allow auto in lambdas. Requiring 14 should be fine, KWin alrady requires it.

Reviewers: #plasma, jgrulich

Reviewed By: jgrulich

Subscribers: davidre, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28696
parent 9e032bf5
......@@ -8,6 +8,9 @@ set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.14.0")
set(KF5_MIN_VERSION "5.66.0")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED On)
################# set KDE specific information #################
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
......
......@@ -35,6 +35,8 @@
#include <QIcon>
#include <QTimer>
#include <algorithm>
Notification::Notification(QObject *parent) :
QObject(parent)
{
......@@ -569,13 +571,13 @@ void Notification::onCheckActiveConnectionOnResume()
m_activeConnectionsBeforeSleep.clear();
const auto &connections = NetworkManager::activeConnections();
for (const auto &connection : connections) {
if (connection->state() == NetworkManager::ActiveConnection::State::Activated ||
connection->state() == NetworkManager::ActiveConnection::State::Activating) {
// we have an active or activating connection, don't tell the user we're no longer connected
return;
}
const auto ac = NetworkManager::activeConnections();
if (std::any_of(ac.constBegin(), ac.constEnd(), [](const auto &connection) {
return connection->state() == NetworkManager::ActiveConnection::State::Activated
|| connection->state() == NetworkManager::ActiveConnection::State::Activating;
})) {
// we have an active or activating connection, don't tell the user we're no longer connected
return;
}
KNotification *notify = new KNotification(QStringLiteral("NoLongerConnected"), KNotification::CloseOnTimeout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment