From: Harald Eilertsen Date: Sun, 27 Sep 2020 11:13:21 +0000 (+0200) Subject: gui/folder: Replace foreach (#2219) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~137^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=677997b2b31a3e27c46dc28753c42334ea0f6501;p=nextcloud-desktop.git gui/folder: Replace foreach (#2219) Signed-off-by: Harald Eilertsen --- diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 47870d99e..85bfcee4d 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -441,7 +441,7 @@ int Folder::slotDiscardDownloadProgress() QSet keep_nothing; const QVector deleted_infos = _journal.getAndDeleteStaleDownloadInfos(keep_nothing); - foreach (const SyncJournalDb::DownloadInfo &deleted_info, deleted_infos) { + for (const auto &deleted_info : deleted_infos) { const QString tmppath = folderpath.filePath(deleted_info._tmpfile); qCInfo(lcFolder) << "Deleting temporary file: " << tmppath; FileSystem::remove(tmppath); @@ -528,14 +528,12 @@ void Folder::saveToSettings() const // This ensures that older clients will not read a configuration // where two folders for different accounts point at the same // local folders. - bool oneAccountOnly = true; - foreach (Folder *other, FolderMan::instance()->map()) { - if (other != this && other->cleanPath() == this->cleanPath()) { - oneAccountOnly = false; - break; - } - } + const auto &folderMap = FolderMan::instance()->map(); + const auto it = std::find_if(folderMap.cbegin(), folderMap.cend(), [this](const auto *other) { + return other != this && other->cleanPath() == this->cleanPath(); + }); + bool oneAccountOnly = it == folderMap.cend(); bool compatible = _saveBackwardsCompatible || oneAccountOnly; if (compatible) {