@@ -148,9 +148,9 @@ bool QgsAuthManager::init( const QString &pluginPath )
148
148
}
149
149
150
150
QgsDebugMsg ( " Prioritizing qca-ossl over all other QCA providers..." );
151
- QCA::ProviderList provds = QCA::providers ();
151
+ const QCA::ProviderList provds = QCA::providers ();
152
152
QStringList prlist;
153
- Q_FOREACH ( QCA::Provider *p, provds )
153
+ for ( QCA::Provider *p : provds )
154
154
{
155
155
QString pn = p->name ();
156
156
int pr = 0 ;
@@ -780,7 +780,8 @@ bool QgsAuthManager::registerCoreAuthMethods()
780
780
781
781
qDeleteAll ( mAuthMethods );
782
782
mAuthMethods .clear ();
783
- Q_FOREACH ( const QString &authMethodKey, QgsAuthMethodRegistry::instance ()->authMethodList () )
783
+ const QStringList methods = QgsAuthMethodRegistry::instance ()->authMethodList ();
784
+ for ( const auto &authMethodKey : methods )
784
785
{
785
786
mAuthMethods .insert ( authMethodKey, QgsAuthMethodRegistry::instance ()->authMethod ( authMethodKey ).release () );
786
787
}
@@ -2086,7 +2087,7 @@ void QgsAuthManager::dumpIgnoredSslErrorsCache_()
2086
2087
while ( i != mIgnoredSslErrorsCache .constEnd () )
2087
2088
{
2088
2089
QStringList errs;
2089
- Q_FOREACH ( QSslError::SslError err, i.value () )
2090
+ for ( auto err : i.value () )
2090
2091
{
2091
2092
errs << QgsAuthCertUtils::sslErrorEnumString ( err );
2092
2093
}
@@ -2150,7 +2151,7 @@ bool QgsAuthManager::updateIgnoredSslErrorsCache( const QString &shahostport, co
2150
2151
}
2151
2152
2152
2153
QSet<QSslError::SslError> errs;
2153
- Q_FOREACH ( const QSslError &error, errors )
2154
+ for ( const auto &error : errors )
2154
2155
{
2155
2156
if ( error.error () == QSslError::NoError )
2156
2157
continue ;
@@ -2240,7 +2241,7 @@ bool QgsAuthManager::storeCertAuthorities( const QList<QSslCertificate> &certs )
2240
2241
return false ;
2241
2242
}
2242
2243
2243
- Q_FOREACH ( const QSslCertificate &cert, certs )
2244
+ for ( const auto &cert : certs )
2244
2245
{
2245
2246
if ( !storeCertAuthority ( cert ) )
2246
2247
return false ;
@@ -2410,7 +2411,7 @@ const QList<QSslCertificate> QgsAuthManager::getExtraFileCAs()
2410
2411
filecerts = QgsAuthCertUtils::certsFromFile ( cafile );
2411
2412
}
2412
2413
// only CAs or certs capable of signing other certs are allowed
2413
- Q_FOREACH ( const QSslCertificate &cert, filecerts )
2414
+ for ( const auto &cert : qgsAsConst ( filecerts ) )
2414
2415
{
2415
2416
if ( !allowinvalid.toBool () && !cert.isValid () )
2416
2417
{
@@ -2547,7 +2548,7 @@ bool QgsAuthManager::removeCertTrustPolicies( const QList<QSslCertificate> &cert
2547
2548
return false ;
2548
2549
}
2549
2550
2550
- Q_FOREACH ( const QSslCertificate &cert, certs )
2551
+ for ( const auto &cert : certs )
2551
2552
{
2552
2553
if ( !removeCertTrustPolicy ( cert ) )
2553
2554
return false ;
@@ -2730,11 +2731,11 @@ bool QgsAuthManager::rebuildTrustedCaCertsCache()
2730
2731
const QByteArray QgsAuthManager::getTrustedCaCertsPemText ()
2731
2732
{
2732
2733
QByteArray capem;
2733
- QList<QSslCertificate> certs ( getTrustedCaCertsCache () );
2734
+ const QList<QSslCertificate> certs ( getTrustedCaCertsCache () );
2734
2735
if ( !certs.isEmpty () )
2735
2736
{
2736
2737
QStringList certslist;
2737
- Q_FOREACH ( const QSslCertificate &cert, certs )
2738
+ for ( const auto &cert : certs )
2738
2739
{
2739
2740
certslist << cert.toPem ();
2740
2741
}
@@ -2762,7 +2763,8 @@ void QgsAuthManager::clearAllCachedConfigs()
2762
2763
if ( isDisabled () )
2763
2764
return ;
2764
2765
2765
- Q_FOREACH ( QString authcfg, configIds () )
2766
+ const QStringList ids = configIds ();
2767
+ for ( const auto &authcfg : ids )
2766
2768
{
2767
2769
clearCachedConfig ( authcfg );
2768
2770
}
@@ -3307,7 +3309,8 @@ bool QgsAuthManager::reencryptAllAuthenticationConfigs( const QString &prevpass,
3307
3309
return false ;
3308
3310
3309
3311
bool res = true ;
3310
- Q_FOREACH ( QString configid, configIds () )
3312
+ const QStringList ids = configIds ();
3313
+ for ( const auto &configid : ids )
3311
3314
{
3312
3315
res = res && reencryptAuthenticationConfig ( configid, prevpass, prevciv );
3313
3316
}
@@ -3395,7 +3398,7 @@ bool QgsAuthManager::reencryptAllAuthenticationSettings( const QString &prevpass
3395
3398
QStringList encryptedsettings;
3396
3399
encryptedsettings << "";
3397
3400
3398
- Q_FOREACH ( const QString & sett, encryptedsettings )
3401
+ for ( const auto & sett, qgsAsConst( encryptedsettings ) )
3399
3402
{
3400
3403
if ( sett.isEmpty() || !existsAuthSetting( sett ) )
3401
3404
continue;
@@ -3468,7 +3471,8 @@ bool QgsAuthManager::reencryptAllAuthenticationIdentities( const QString &prevpa
3468
3471
return false ;
3469
3472
3470
3473
bool res = true ;
3471
- Q_FOREACH ( const QString &identid, getCertIdentityIds () )
3474
+ const QStringList ids = getCertIdentityIds ();
3475
+ for ( const auto &identid : ids )
3472
3476
{
3473
3477
res = res && reencryptAuthenticationIdentity ( identid, prevpass, prevciv );
3474
3478
}
@@ -3649,7 +3653,7 @@ bool QgsAuthManager::authDbTransactionQuery( QSqlQuery *query ) const
3649
3653
3650
3654
void QgsAuthManager::insertCaCertInCache ( QgsAuthCertUtils::CaCertSource source, const QList<QSslCertificate> &certs )
3651
3655
{
3652
- Q_FOREACH ( const QSslCertificate &cert, certs )
3656
+ for ( const auto &cert : certs )
3653
3657
{
3654
3658
mCaCertsCache .insert ( QgsAuthCertUtils::shaHexForCert ( cert ),
3655
3659
QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate>( source, cert ) );
0 commit comments