diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2020-07-23 13:40:58 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2020-07-30 10:08:21 +0300 |
commit | 474fe6b48820cdca4ede3869920f219b55a2336a (patch) | |
tree | 0bd10bd3502f4b5a8bedc50aa37ad3380c5fb920 | |
parent | c624b8c1f22a4763d1dc5115f889e543772f3d67 (diff) |
Clazy: Fix some warnigns
-rw-r--r-- | src/gui/accountsettings.cpp | 13 | ||||
-rw-r--r-- | src/gui/folderman.cpp | 2 | ||||
-rw-r--r-- | src/gui/folderman.h | 2 | ||||
-rw-r--r-- | src/gui/folderstatusmodel.cpp | 10 |
4 files changed, 13 insertions, 14 deletions
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 5bf8cfc82..3628afcea 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -570,7 +570,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 @@ -841,7 +841,7 @@ void AccountSettings::slotAccountStateChanged() 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()) { + for (Folder *folder : folderMan->map().values()) { _model->slotUpdateFolderState(folder); } @@ -979,15 +979,14 @@ void AccountSettings::refreshSelectiveSyncStatus() { QString msg; int cnt = 0; - foreach (Folder *folder, FolderMan::instance()->map().values()) { + for (Folder *folder : FolderMan::instance()->map().values()) { if (folder->accountState() != _accountState) { continue; } bool ok; - auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok); - QString p; - foreach (const auto &it, undecidedList) { + const auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok); + for (const auto &it : undecidedList) { // FIXME: add the folder alias in a hoover hint. // folder->alias() + QLatin1String("/") if (cnt++) { @@ -1046,7 +1045,7 @@ void AccountSettings::refreshSelectiveSyncStatus() auto anim = new QPropertyAnimation(ui->selectiveSyncStatus, "maximumHeight", ui->selectiveSyncStatus); anim->setEndValue(shouldBeVisible ? hint.height() : 0); anim->start(QAbstractAnimation::DeleteWhenStopped); - connect(anim, &QPropertyAnimation::finished, [this, shouldBeVisible]() { + connect(anim, &QPropertyAnimation::finished, this, [this, shouldBeVisible]() { ui->selectiveSyncStatus->setMaximumHeight(QWIDGETSIZE_MAX); if (!shouldBeVisible) { ui->selectiveSyncStatus->hide(); diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index c564b65b2..b7d42376f 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -95,7 +95,7 @@ FolderMan::~FolderMan() _instance = nullptr; } -OCC::Folder::Map FolderMan::map() const +const OCC::Folder::Map &FolderMan::map() const { return _folderMap; } diff --git a/src/gui/folderman.h b/src/gui/folderman.h index a685674d8..375ffe882 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -87,7 +87,7 @@ public: */ static void backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringList *ignoreKeys); - OCC::Folder::Map map() const; + const Folder::Map &map() const; QList<Folder *> list() 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 ec3391ad4..c013c336e 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -808,12 +808,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; auto oldBlackList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); @@ -821,7 +821,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(); |