Commit 2d26a219 authored by Laurent Montel's avatar Laurent Montel
Browse files

Use std::as_const

parent 708a39db
Pipeline #140444 passed with stage
in 1 minute and 26 seconds
......@@ -303,7 +303,7 @@ void ConnectionEditorBase::initialize()
// Re-check validation
bool valid = true;
for (SettingWidget *widget : qAsConst(m_settingWidgets)) {
for (SettingWidget *widget : std::as_const(m_settingWidgets)) {
valid = valid && widget->isValid();
connect(widget, &SettingWidget::validChanged, this, &ConnectionEditorBase::validChanged);
}
......@@ -421,7 +421,7 @@ void ConnectionEditorBase::initialize()
}
}
} else {
for (const QString &secret : qAsConst(requiredSecrets)) {
for (const QString &secret : std::as_const(requiredSecrets)) {
if (setting.contains(secret + QLatin1String("-flags"))) {
NetworkManager::Setting::SecretFlagType secretFlag =
(NetworkManager::Setting::SecretFlagType)setting.value(secret + QLatin1String("-flags")).toInt();
......@@ -466,7 +466,7 @@ void ConnectionEditorBase::replyFinished(QDBusPendingCallWatcher *watcher)
NetworkManager::Setting::Ptr setting = m_connection->setting(NetworkManager::Setting::typeFromString(key));
if (setting) {
setting->secretsFromMap(secrets.value(key));
for (SettingWidget *widget : qAsConst(m_settingWidgets)) {
for (SettingWidget *widget : std::as_const(m_settingWidgets)) {
const QString type = widget->type();
if (type == settingName
|| (settingName == NetworkManager::Setting::typeAsString(NetworkManager::Setting::Security8021x)
......@@ -501,7 +501,7 @@ void ConnectionEditorBase::validChanged(bool valid)
Q_EMIT validityChanged(false);
return;
} else {
for (SettingWidget *widget : qAsConst(m_settingWidgets)) {
for (SettingWidget *widget : std::as_const(m_settingWidgets)) {
if (!widget->isValid()) {
m_valid = false;
Q_EMIT validityChanged(false);
......
......@@ -113,7 +113,7 @@ void SsidComboBox::addSsidsToCombo(const QList<NetworkManager::WirelessNetwork::
continue;
}
for (const NetworkManager::WirelessDevice::Ptr &wifiDev : qAsConst(wifiDevices)) {
for (const NetworkManager::WirelessDevice::Ptr &wifiDev : std::as_const(wifiDevices)) {
if (wifiDev->findNetwork(network->ssid()) == network) {
if (!empty) {
insertSeparator(count());
......
......@@ -234,7 +234,7 @@ void CreatableConnectionsModel::populateModel()
return QString::localeAwareCompare(left.name(), right.name()) <= 0;
});
for (const auto &service : qAsConst(plugins)) {
for (const auto &service : std::as_const(plugins)) {
const QString vpnType = service.value(QStringLiteral("X-NetworkManager-Services"));
const QString vpnSubType = service.value(QStringLiteral("X-NetworkManager-Services-Subtype"));
const QString vpnDescription = service.description();
......
......@@ -33,7 +33,7 @@ L2tpWidget::L2tpWidget(const NetworkManager::VpnSetting::Ptr &setting, QWidget *
// around the filesystem, also if it is a .p12 file, set the other URLs to that .p12 file.
QList<const KUrlRequester *> requesters;
requesters << m_ui->userCA << m_ui->userCert << m_ui->userKey;
for (const KUrlRequester *requester : qAsConst(requesters)) {
for (const KUrlRequester *requester : std::as_const(requesters)) {
connect(requester, &KUrlRequester::urlSelected, this, &L2tpWidget::updateStartDirUrl);
}
......@@ -228,7 +228,7 @@ void L2tpWidget::updateStartDirUrl(const QUrl &url)
requesters << m_ui->userCA << m_ui->userCert << m_ui->userKey;
bool isP12 = url.toString().endsWith(QLatin1String(".p12"));
for (KUrlRequester *requester : qAsConst(requesters)) {
for (KUrlRequester *requester : std::as_const(requesters)) {
requester->setStartDir(url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash));
if (isP12) {
requester->setUrl(url);
......
......@@ -642,7 +642,7 @@ NMVariantMapMap OpenVpnUiPlugin::importConnectionSettings(const QString &fileNam
list << ipRoute;
}
QList<QList<uint>> dbusRoutes;
for (const NetworkManager::IpRoute &route : qAsConst(list)) {
for (const NetworkManager::IpRoute &route : std::as_const(list)) {
QList<uint> dbusRoute;
dbusRoute << htonl(route.ip().toIPv4Address()) << route.prefixLength() << htonl(route.nextHop().toIPv4Address()) << route.metric();
dbusRoutes << dbusRoute;
......
......@@ -59,7 +59,7 @@ void OpenVpnAuthWidget::readSecrets()
if (!m_hints.isEmpty()) {
QString passwordType;
QString prompt;
for (const QString &hint : qAsConst(m_hints)) {
for (const QString &hint : std::as_const(m_hints)) {
const QString vpnMessage = QStringLiteral("x-vpn-message:");
if (hint.startsWith(vpnMessage)) {
prompt = hint.right(hint.length() - vpnMessage.length());
......
......@@ -275,7 +275,7 @@ void OpenVpnSettingWidget::updateStartDir(const QUrl &url)
QList<KUrlRequester *> requesters;
requesters << d->ui.x509CaFile << d->ui.x509Cert << d->ui.x509Key << d->ui.pskSharedKey << d->ui.passCaFile << d->ui.x509PassCaFile << d->ui.x509PassCert
<< d->ui.x509PassKey;
for (KUrlRequester *requester : qAsConst(requesters)) {
for (KUrlRequester *requester : std::as_const(requesters)) {
requester->setStartDir(url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash));
}
}
......
......@@ -268,7 +268,7 @@ NMVariantMapMap VpncUiPlugin::importConnectionSettings(const QString &fileName)
list << ipRoute;
}
QList<QList<uint>> dbusRoutes;
for (const NetworkManager::IpRoute &route : qAsConst(list)) {
for (const NetworkManager::IpRoute &route : std::as_const(list)) {
QList<uint> dbusRoute;
dbusRoute << htonl(route.ip().toIPv4Address()) << route.prefixLength() << htonl(route.nextHop().toIPv4Address()) << route.metric();
dbusRoutes << dbusRoute;
......
Supports Markdown
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