Commit 777c179b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some foreach

parent a0883f36
Pipeline #82296 passed with stage
in 17 minutes and 9 seconds
......@@ -465,8 +465,9 @@ static void handleOwnerTrust(const std::vector<GpgME::ImportResult> &results)
}
QStringList uids;
uids.reserve(toTrustOwner.userIDs().size());
Q_FOREACH (const UserID &uid, toTrustOwner.userIDs()) {
const auto toTrustOwnerUserIDs{toTrustOwner.userIDs()};
uids.reserve(toTrustOwnerUserIDs.size());
for (const UserID &uid : toTrustOwnerUserIDs) {
uids << Formatting::prettyNameAndEMail(uid);
}
......
......@@ -372,7 +372,7 @@ void DecryptVerifyEMailController::start()
const std::shared_ptr<TaskCollection> coll(new TaskCollection);
std::vector<std::shared_ptr<Task> > tsks;
Q_FOREACH (const std::shared_ptr<Task> &i, d->m_runnableTasks) {
for (std::shared_ptr<Task> i : std::as_const(d->m_runnableTasks)) {
connectTask(i);
tsks.push_back(i);
}
......
......@@ -91,7 +91,8 @@ void NewResultPage::Private::allDone()
m_progressBar->setRange(0, 100);
m_progressBar->setValue(100);
m_collections.clear();
Q_FOREACH (const QString &i, m_progressLabelByTag.keys()) {
const auto progressLabelByTagKeys{m_progressLabelByTag.keys()};
for (const QString &i : progressLabelByTagKeys) {
if (!i.isEmpty()) {
m_progressLabelByTag.value(i)->setText(i18n("%1: All operations completed.", i));
} else {
......
......@@ -637,7 +637,8 @@ void ResolveRecipientsPage::Private::selectionChanged()
void ResolveRecipientsPage::Private::removeSelectedEntries()
{
Q_FOREACH (const QString &i, m_listWidget->selectedEntries()) {
const auto selectedEntries{m_listWidget->selectedEntries()};
for (const QString &i : selectedEntries) {
m_listWidget->removeEntry(i);
}
Q_EMIT q->completeChanged();
......@@ -670,7 +671,8 @@ void ResolveRecipientsPage::Private::writeSelectedCertificatesToPreferences()
return;
}
Q_FOREACH (const QString &i, m_listWidget->identifiers()) {
const auto identifiers{m_listWidget->identifiers()};
for (const QString &i : identifiers) {
const Mailbox mbox = m_listWidget->mailbox(i);
if (!mbox.hasAddress()) {
continue;
......
......@@ -89,7 +89,8 @@ void ResultPage::Private::allDone()
m_progressBar->setRange(0, 100);
m_progressBar->setValue(100);
m_tasks.reset();
Q_FOREACH (const QString &i, m_progressLabelByTag.keys()) {
const auto progressLabelByTagKeys{m_progressLabelByTag.keys()};
for (const QString &i : progressLabelByTagKeys) {
if (!i.isEmpty()) {
m_progressLabelByTag.value(i)->setText(i18n("%1: All operations completed.", i));
} else {
......
......@@ -308,7 +308,7 @@ private:
const QObject *const s = q->sender();
const Protocol proto = q->selectedProtocol();
QPointer<CertificateSelectionDialog> dlg;
Q_FOREACH (const CertificateSelectionLine &l, ui.signers)
for (const CertificateSelectionLine &l : std::as_const(ui.signers))
if (s == l.toolButton()) {
dlg = create_signing_certificate_selection_dialog(q, proto, l.mailboxText());
if (dlg->exec()) {
......@@ -317,7 +317,7 @@ private:
// ### switch to key.protocol(), in case proto == UnknownProtocol
break;
}
Q_FOREACH (const CertificateSelectionLine &l, ui.recipients)
for (const CertificateSelectionLine &l : std::as_const(ui.recipients))
if (s == l.toolButton()) {
dlg = create_encryption_certificate_selection_dialog(q, proto, l.mailboxText());
if (dlg->exec()) {
......
......@@ -657,7 +657,7 @@ void VerifyChecksumsController::Private::run()
const quint64 factor = total / std::numeric_limits<int>::max() + 1;
quint64 done = 0;
Q_FOREACH (const SumFile &sumFile, sumfiles) {
for (const SumFile &sumFile : sumfiles) {
Q_EMIT progress(done / factor, total / factor,
i18n("Verifying checksums (%2) in %1", sumFile.checksumDefinition->label(), sumFile.dir.path()));
bool fatal = false;
......
......@@ -965,7 +965,7 @@ AssuanServerConnection::Private::Private(assuan_fd_t fd_, const std::vector< std
throw Exception(err, "register \"FILE\" handler");
// register user-defined commands:
Q_FOREACH (std::shared_ptr<AssuanCommandFactory> fac, factories)
for (std::shared_ptr<AssuanCommandFactory> fac : std::as_const(factories))
#ifndef HAVE_ASSUAN2
if (const gpg_error_t err = assuan_register_command(ctx.get(), fac->name(), fac->_handler()))
#else
......
......@@ -919,7 +919,8 @@ void TabWidget::saveViews(KConfig *config) const
if (!config) {
return;
}
Q_FOREACH (const QString &group, extractViewGroups(config)) {
const auto extraView{extractViewGroups(config)};
for (const QString &group : extraView) {
config->deleteGroup(group);
}
unsigned int vg = 0;
......
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