@@ -54,11 +54,11 @@ QgsAuthOAuth2Method::QgsAuthOAuth2Method()
5454 << QStringLiteral ( " wcs" )
5555 << QStringLiteral ( " wms" ) );
5656
57- QStringList cachedirpaths;
58- cachedirpaths << QgsAuthOAuth2Config::tokenCacheDirectory ()
59- << QgsAuthOAuth2Config::tokenCacheDirectory ( true );
57+ const QStringList cachedirpaths = QStringList ()
58+ << QgsAuthOAuth2Config::tokenCacheDirectory ()
59+ << QgsAuthOAuth2Config::tokenCacheDirectory ( true );
6060
61- Q_FOREACH ( const QString &cachedirpath, cachedirpaths )
61+ for ( const QString &cachedirpath : cachedirpaths )
6262 {
6363 QDir cachedir ( cachedirpath );
6464 if ( !cachedir.mkpath ( cachedirpath ) )
@@ -71,10 +71,10 @@ QgsAuthOAuth2Method::QgsAuthOAuth2Method()
7171QgsAuthOAuth2Method::~QgsAuthOAuth2Method ()
7272{
7373 QDir tempdir ( QgsAuthOAuth2Config::tokenCacheDirectory ( true ) );
74- QStringList dirlist = tempdir.entryList ( QDir::Files | QDir::NoDotAndDotDot );
75- Q_FOREACH ( const QString &f, dirlist )
74+ const QStringList dirlist = tempdir.entryList ( QDir::Files | QDir::NoDotAndDotDot );
75+ for ( const QString &f : dirlist )
7676 {
77- QString tempfile ( tempdir.path () + QStringLiteral ( " / " ) + f );
77+ QString tempfile ( tempdir.path () + ' / ' + f );
7878 if ( !QFile::remove ( tempfile ) )
7979 {
8080 QgsDebugMsg ( QStringLiteral ( " FAILED to delete temp token cache file: %1" ).arg ( tempfile ) );
@@ -343,7 +343,8 @@ void QgsAuthOAuth2Method::onLinkingSucceeded()
343343 if ( !extraTokens.isEmpty () )
344344 {
345345 QString msg = QStringLiteral ( " Extra tokens in response:\n " );
346- Q_FOREACH ( const QString &key, extraTokens.keys () )
346+ const QStringList extraTokenKeys = extraTokens.keys ();
347+ for ( const QString &key : extraTokenKeys )
347348 {
348349 // don't expose the values in a log (unless they are only 3 chars long, of course)
349350 msg += QStringLiteral ( " %1:%2…\n " ).arg ( key, extraTokens.value ( key ).toString ().left ( 3 ) );
@@ -371,7 +372,8 @@ void QgsAuthOAuth2Method::onCloseBrowser()
371372 // Bring focus back to QGIS app
372373 if ( qobject_cast<QApplication *>( qApp ) )
373374 {
374- Q_FOREACH ( QWidget *topwdgt, QgsApplication::topLevelWidgets () )
375+ const QList<QWidget *> widgets = QgsApplication::topLevelWidgets ();
376+ for ( QWidget *topwdgt : widgets )
375377 {
376378 if ( topwdgt->objectName () == QStringLiteral ( " MainWindow" ) )
377379 {
0 commit comments