From bd62615aab2f2dde8d69c7fbd4781ac0eb231820 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Thu, 23 Jul 2020 12:40:58 +0200 Subject: [PATCH] Clazy: Fix some warnigns --- src/gui/accountsettings.cpp | 3 +-- src/gui/folderman.cpp | 2 +- src/gui/folderman.h | 2 +- src/gui/folderstatusmodel.cpp | 10 +++++----- test/stubremotewipe.cpp | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 694400186..79c44d205 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -684,7 +684,7 @@ void AccountSettings::slotEnableVfsCurrentFolder() // Wipe selective sync blacklist bool ok = false; - auto oldBlacklist = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); + const auto oldBlacklist = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, {}); // Change the folder vfs mode and load the plugin @@ -1171,7 +1171,6 @@ void AccountSettings::refreshSelectiveSyncStatus() bool ok = false; const auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok); - QString p; for (const auto &it : undecidedList) { // FIXME: add the folder alias in a hoover hint. // folder->alias() + QLatin1String("/") diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index aaf303c41..3ee51b955 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -90,7 +90,7 @@ FolderMan::~FolderMan() _instance = nullptr; } -OCC::Folder::Map FolderMan::map() +const OCC::Folder::Map &FolderMan::map() const { return _folderMap; } diff --git a/src/gui/folderman.h b/src/gui/folderman.h index 75cbd2307..7c72eb953 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -74,7 +74,7 @@ public: */ static void backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringList *ignoreKeys); - OCC::Folder::Map map(); + const Folder::Map &map() const; /** Adds a folder for an account, ensures the journal is gone and saves it in the settings. */ diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 5f853cd8a..e6cf4de3d 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -828,12 +828,12 @@ void FolderStatusModel::slotUpdateFolderState(Folder *folder) void FolderStatusModel::slotApplySelectiveSync() { - for (int i = 0; i < _folders.count(); ++i) { - if (!_folders[i]._fetched) { - _folders[i]._folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList()); + for (const auto &folderInfo : qAsConst(_folders)) { + if (!folderInfo._fetched) { + folderInfo._folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList()); continue; } - auto folder = _folders.at(i)._folder; + const auto folder = folderInfo._folder; bool ok = false; auto oldBlackList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); @@ -841,7 +841,7 @@ void FolderStatusModel::slotApplySelectiveSync() qCWarning(lcFolderStatus) << "Could not read selective sync list from db."; continue; } - QStringList blackList = createBlackList(_folders.at(i), oldBlackList); + QStringList blackList = createBlackList(folderInfo, oldBlackList); folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList); auto blackListSet = blackList.toSet(); diff --git a/test/stubremotewipe.cpp b/test/stubremotewipe.cpp index e434424fd..545e6a56e 100644 --- a/test/stubremotewipe.cpp +++ b/test/stubremotewipe.cpp @@ -21,7 +21,7 @@ QString OCC::FolderMan::unescapeAlias(QString const&){ return QString(); } QString OCC::FolderMan::escapeAlias(QString const&){ return QString(); } void OCC::FolderMan::scheduleFolder(OCC::Folder*){ } OCC::SocketApi *OCC::FolderMan::socketApi(){ return new SocketApi; } -OCC::Folder::Map OCC::FolderMan::map() { return OCC::Folder::Map(); } +const OCC::Folder::Map &OCC::FolderMan::map() const { return OCC::Folder::Map(); } void OCC::FolderMan::setSyncEnabled(bool) { } void OCC::FolderMan::slotSyncOnceFileUnlocks(QString const&) { } void OCC::FolderMan::slotScheduleETagJob(QString const&, OCC::RequestEtagJob*){ }