gui/accountstate: Replace foreach (#2219)
authorHarald Eilertsen <haraldei@anduin.net>
Sun, 27 Sep 2020 11:07:34 +0000 (13:07 +0200)
committerHarald Eilertsen <haraldei@anduin.net>
Tue, 29 Sep 2020 17:31:23 +0000 (19:31 +0200)
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
src/gui/accountsettings.cpp

index 517d452d2e64a090d9bf707f2711bab643854ebc..62491c5dbe5ed1e9394ef6027cc84ec3a7c97716 100644 (file)
@@ -761,8 +761,8 @@ void AccountSettings::slotAccountStateChanged()
         AccountPtr account = _accountState->account();
         QUrl safeUrl(account->url());
         safeUrl.setPassword(QString()); // Remove the password from the URL to avoid showing it in the UI
-        FolderMan *folderMan = FolderMan::instance();
-        foreach (Folder *folder, folderMan->map().values()) {
+        const auto &folders = FolderMan::instance()->map().values();
+        for (Folder *folder : folders) {
             _model->slotUpdateFolderState(folder);
         }
 
@@ -894,15 +894,16 @@ void AccountSettings::refreshSelectiveSyncStatus()
 
     QString msg;
     int cnt = 0;
-    foreach (Folder *folder, FolderMan::instance()->map().values()) {
+    const auto &folders = FolderMan::instance()->map().values();
+    for (Folder *folder : folders) {
         if (folder->accountState() != _accountState) {
             continue;
         }
 
         bool ok = false;
-        auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok);
+        const auto &undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok);
         QString p;
-        foreach (const auto &it, undecidedList) {
+        for (const auto &it : undecidedList) {
             // FIXME: add the folder alias in a hoover hint.
             // folder->alias() + QLatin1String("/")
             if (cnt++) {