Commit 84707907 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some foreach

parent e658a11c
Pipeline #73932 passed with stage
in 14 minutes and 55 seconds
......@@ -125,7 +125,8 @@ static Mailbox mailbox(const UserID &uid)
static std::vector<Mailbox> extractMailboxes(const Key &key)
{
std::vector<Mailbox> res;
Q_FOREACH (const UserID &id, key.userIDs()) {
const auto userIDs{key.userIDs()};
for (const UserID &id : userIDs) {
const Mailbox mbox = mailbox(id);
if (!mbox.addrSpec().isEmpty()) {
res.push_back(mbox);
......@@ -318,7 +319,8 @@ static bool IsGoodOrValid(const Signature &sig)
static UserID findUserIDByMailbox(const Key &key, const Mailbox &mbox)
{
Q_FOREACH (const UserID &id, key.userIDs())
const auto userIDs{key.userIDs()};
for (const UserID &id : userIDs)
if (mailbox_equal(mailbox(id), mbox, Qt::CaseInsensitive)) {
return id;
}
......
......@@ -494,7 +494,7 @@ static std::vector<SumFile> find_sums_by_input_files(const QStringList &files, Q
const QDir &dir = it->first;
Q_FOREACH (const QString &sumFileName, it->second) {
for (const QString &sumFileName : std::as_const(it->second)) {
const std::vector<File> summedfiles = parse_sum_file(dir.absoluteFilePath(sumFileName));
QStringList files;
......
......@@ -1669,13 +1669,16 @@ QString KeyCreationPage::createGnupgKeyParms() const
} else {
keyParameters.setDN(dn());
keyParameters.setEmail(email());
Q_FOREACH (const QString &email, additionalEMailAddresses()) {
const auto addesses{additionalEMailAddresses()};
for (const QString &email : addesses) {
keyParameters.addEmail(email);
}
Q_FOREACH (const QString &dns, dnsNames()) {
const auto dnsN{dnsNames()};
for (const QString &dns : dnsN) {
keyParameters.addDomainName(dns);
}
Q_FOREACH (const QString &uri, uris()) {
const auto urisList{uris()};
for (const QString &uri : urisList) {
keyParameters.addURI(uri);
}
}
......
......@@ -200,7 +200,7 @@ void DecryptVerifyCommandEMailBase::Private::verificationResult(const Verificati
{
try {
const std::vector<Signature> sigs = vResult.signatures();
Q_FOREACH (const Signature &sig, sigs) {
for (const Signature &sig : sigs) {
const QString s = signatureToString(sig, sig.key(true, true));
const char *color = summaryToString(sig.summary());
q->sendStatusEncoded("SIGSTATUS",
......
......@@ -157,7 +157,8 @@ void SelectCertificateCommand::Private::slotDialogAccepted()
{
try {
QByteArray data;
Q_FOREACH (const Key &key, dialog->selectedCertificates()) {
const auto selectedCertificates(dialog->selectedCertificates());
for (const Key &key : selectedCertificates) {
data += key.primaryFingerprint();
data += '\n';
}
......
......@@ -84,7 +84,8 @@ void Kleo::recursivelyRemovePath(const QString &path)
const QFileInfo fi(path);
if (fi.isDir()) {
QDir dir(path);
Q_FOREACH (const QString &fname, dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot)) {
const auto dirs{dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot)};
for (const QString &fname : dirs) {
recursivelyRemovePath(dir.filePath(fname));
}
const QString dirName = fi.fileName();
......
......@@ -665,7 +665,7 @@ void KeyListController::Private::slotCommandFinished()
void KeyListController::enableDisableActions(const QItemSelectionModel *sm) const
{
const Command::Restrictions restrictionsMask = d->calculateRestrictionsMask(sm);
Q_FOREACH (const Private::action_item &ai, d->actions)
for (const Private::action_item &ai : std::as_const(d->actions))
if (ai.action) {
ai.action->setEnabled(ai.restrictions == (ai.restrictions & restrictionsMask));
}
......
Markdown is supported
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