|
|
@@ -188,7 +188,8 @@ int FolderMan::setupFolders()
|
|
|
|
|
|
qCInfo(lcFolderMan) << "Setup folders from settings file";
|
|
|
|
|
|
- for (const auto &account : AccountManager::instance()->accounts()) {
|
|
|
+ const auto accounts = AccountManager::instance()->accounts();
|
|
|
+ for (const auto &account : accounts) {
|
|
|
const auto id = account->account()->id();
|
|
|
if (!accountsWithSettings.contains(id)) {
|
|
|
continue;
|
|
|
@@ -219,7 +220,7 @@ int FolderMan::setupFolders()
|
|
|
|
|
|
emit folderListChanged(_folderMap);
|
|
|
|
|
|
- for (const auto folder : _folderMap) {
|
|
|
+ for (const auto folder : qAsConst(_folderMap)) {
|
|
|
folder->processSwitchedToVirtualFiles();
|
|
|
}
|
|
|
|
|
|
@@ -228,7 +229,8 @@ int FolderMan::setupFolders()
|
|
|
|
|
|
void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account, const QStringList &ignoreKeys, bool backwardsCompatible, bool foldersWithPlaceholders)
|
|
|
{
|
|
|
- for (const auto &folderAlias : settings.childGroups()) {
|
|
|
+ const auto settingsChildGroups = settings.childGroups();
|
|
|
+ for (const auto &folderAlias : settingsChildGroups) {
|
|
|
// Skip folders with too-new version
|
|
|
settings.beginGroup(folderAlias);
|
|
|
if (ignoreKeys.contains(settings.group())) {
|
|
|
@@ -392,7 +394,8 @@ void FolderMan::backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringLi
|
|
|
settings->endGroup();
|
|
|
};
|
|
|
|
|
|
- for (const auto &accountId : settings->childGroups()) {
|
|
|
+ const auto settingsChildGroups = settings->childGroups();
|
|
|
+ for (const auto &accountId : settingsChildGroups) {
|
|
|
settings->beginGroup(accountId);
|
|
|
processSubgroup("Folders");
|
|
|
processSubgroup("Multifolders");
|
|
|
@@ -598,7 +601,8 @@ Folder *FolderMan::folder(const QString &alias)
|
|
|
|
|
|
void FolderMan::scheduleAllFolders()
|
|
|
{
|
|
|
- for (Folder *f : _folderMap.values()) {
|
|
|
+ const auto folderMapValues = _folderMap.values();
|
|
|
+ for (Folder *f : folderMapValues) {
|
|
|
if (f && f->canSync()) {
|
|
|
scheduleFolder(f);
|
|
|
}
|
|
|
@@ -741,7 +745,8 @@ void FolderMan::slotAccountStateChanged()
|
|
|
if (accountState->isConnected()) {
|
|
|
qCInfo(lcFolderMan) << "Account" << accountName << "connected, scheduling its folders";
|
|
|
|
|
|
- for (Folder *f : _folderMap.values()) {
|
|
|
+ const auto folderMapValues = _folderMap.values();
|
|
|
+ for (Folder *f : folderMapValues) {
|
|
|
if (f
|
|
|
&& f->canSync()
|
|
|
&& f->accountState() == accountState) {
|
|
|
@@ -781,7 +786,7 @@ void FolderMan::setSyncEnabled(bool enabled)
|
|
|
}
|
|
|
_syncEnabled = enabled;
|
|
|
// force a redraw in case the network connect status changed
|
|
|
- emit(folderSyncStateChange(nullptr));
|
|
|
+ emit folderSyncStateChange(nullptr);
|
|
|
}
|
|
|
|
|
|
void FolderMan::startScheduledSyncSoon()
|
|
|
@@ -837,7 +842,7 @@ void FolderMan::startScheduledSyncSoon()
|
|
|
void FolderMan::slotStartScheduledFolderSync()
|
|
|
{
|
|
|
if (isAnySyncRunning()) {
|
|
|
- for (auto f : _folderMap) {
|
|
|
+ for (auto f : qAsConst(_folderMap)) {
|
|
|
if (f->isSyncRunning())
|
|
|
qCInfo(lcFolderMan) << "Currently folder " << f->remoteUrl().toString() << " is running, wait for finish!";
|
|
|
}
|
|
|
@@ -1223,7 +1228,8 @@ QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const Acco
|
|
|
if (!serverPath.startsWith('/'))
|
|
|
serverPath.prepend('/');
|
|
|
|
|
|
- for (Folder *folder : this->map().values()) {
|
|
|
+ const auto mapValues = map().values();
|
|
|
+ for (Folder *folder : mapValues) {
|
|
|
if (acc && folder->accountState()->account() != acc) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -1421,7 +1427,8 @@ void FolderMan::slotWipeFolderForAccount(AccountState *accountState)
|
|
|
|
|
|
void FolderMan::setDirtyProxy()
|
|
|
{
|
|
|
- for (const Folder *f : _folderMap.values()) {
|
|
|
+ const auto folderMapValues = _folderMap.values();
|
|
|
+ for (const Folder *f : folderMapValues) {
|
|
|
if (f) {
|
|
|
if (f->accountState() && f->accountState()->account()
|
|
|
&& f->accountState()->account()->networkAccessManager()) {
|
|
|
@@ -1435,7 +1442,8 @@ void FolderMan::setDirtyProxy()
|
|
|
|
|
|
void FolderMan::setDirtyNetworkLimits()
|
|
|
{
|
|
|
- for (Folder *f : _folderMap.values()) {
|
|
|
+ const auto folderMapValues = _folderMap.values();
|
|
|
+ for (Folder *f : folderMapValues) {
|
|
|
// set only in busy folders. Otherwise they read the config anyway.
|
|
|
if (f && f->isBusy()) {
|
|
|
f->setDirtyNetworkLimits();
|
|
|
@@ -1784,7 +1792,7 @@ void FolderMan::slotProcessFilesPushNotification(Account *account)
|
|
|
{
|
|
|
qCInfo(lcFolderMan) << "Got files push notification for account" << account;
|
|
|
|
|
|
- for (auto folder : _folderMap) {
|
|
|
+ for (auto folder : qAsConst(_folderMap)) {
|
|
|
// Just run on the folders that belong to this account
|
|
|
if (folder->accountState()->account() != account) {
|
|
|
continue;
|