diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp index b6ab3db6..8a6651ba 100644 --- a/lang/qt/src/qgpgmekeyformailboxjob.cpp +++ b/lang/qt/src/qgpgmekeyformailboxjob.cpp @@ -86,12 +86,12 @@ static QGpgMEKeyForMailboxJob::result_type do_work(Context *ctx, const QString & // See: https://bugs.gnupg.org/gnupg/issue2359 Key keyC; UserID uidC; - Q_FOREACH (const Key k, keys) { + for (const Key &k : keys) { if (canEncrypt && !k.canEncrypt()) { continue; } /* First get the uid that matches the mailbox */ - Q_FOREACH (const UserID u, k.userIDs()) { + for (const UserID &u : k.userIDs()) { if (QString::fromUtf8(u.email()).toLower() == mailbox.toLower()) { if (uidC.isNull()) { keyC = k; @@ -103,13 +103,13 @@ static QGpgMEKeyForMailboxJob::result_type do_work(Context *ctx, const QString & } else if (uidC.validity() == u.validity() && uidIsOk(u)) { /* Both are the same check which one is newer. */ time_t oldTime = 0; - Q_FOREACH (const Subkey s, keyC.subkeys()) { + for (const Subkey &s : keyC.subkeys()) { if ((canEncrypt && s.canEncrypt()) && subkeyIsOk(s)) { oldTime = s.creationTime(); } } time_t newTime = 0; - Q_FOREACH (const Subkey s, k.subkeys()) { + for (const Subkey &s : k.subkeys()) { if ((canEncrypt && s.canEncrypt()) && subkeyIsOk(s)) { newTime = s.creationTime(); } diff --git a/lang/qt/src/qgpgmekeylistjob.cpp b/lang/qt/src/qgpgmekeylistjob.cpp index 295e612d..706d2575 100644 --- a/lang/qt/src/qgpgmekeylistjob.cpp +++ b/lang/qt/src/qgpgmekeylistjob.cpp @@ -152,7 +152,7 @@ KeyListResult QGpgMEKeyListJob::exec(const QStringList &patterns, bool secretOnl void QGpgMEKeyListJob::resultHook(const result_type &tuple) { mResult = std::get<0>(tuple); - Q_FOREACH (const Key &key, std::get<1>(tuple)) { + for (const Key &key : std::get<1>(tuple)) { Q_EMIT nextKey(key); } } diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp index 94e3fb2b..15d50b4a 100644 --- a/lang/qt/src/qgpgmenewcryptoconfig.cpp +++ b/lang/qt/src/qgpgmenewcryptoconfig.cpp @@ -97,7 +97,7 @@ void QGpgMENewCryptoConfig::reloadConfiguration(bool) KMessageBox::error(0, wmsg); } #endif - Q_FOREACH(const Component & c, components) { + for (const Component &c : components) { const std::shared_ptr comp(new QGpgMENewCryptoConfigComponent); comp->setComponent(c); m_componentsByName[ comp->name() ] = comp; @@ -127,8 +127,9 @@ QGpgMENewCryptoConfigComponent *QGpgMENewCryptoConfig::component(const QString & void QGpgMENewCryptoConfig::sync(bool runtime) { - Q_FOREACH(const std::shared_ptr &c, m_componentsByName) - c->sync(runtime); + for (const std::shared_ptr &c : qAsConst(m_componentsByName)) { + c->sync(runtime); + } } void QGpgMENewCryptoConfig::clear() @@ -156,19 +157,20 @@ void QGpgMENewCryptoConfigComponent::setComponent(const Component &component) std::shared_ptr group; const std::vector