this, &FolderStatusModel::slotFolderScheduleQueueChanged, Qt::UniqueConnection);
auto folders = FolderMan::instance()->map();
- foreach (auto f, folders) {
- if (!accountState)
+ for (const auto &folder : folders) {
+ if (!accountState) {
break;
- if (f->accountState() != accountState)
+ } else if (folder->accountState() != accountState) {
continue;
+ }
SubFolderInfo info;
- info._name = f->alias();
+ info._name = folder->alias();
info._path = "/";
- info._folder = f;
+ info._folder = folder;
info._checked = Qt::PartiallyChecked;
_folders << info;
- connect(f, &Folder::progressInfo, this, &FolderStatusModel::slotSetProgress, Qt::UniqueConnection);
- connect(f, &Folder::newBigFolderDiscovered, this, &FolderStatusModel::slotNewBigFolder, Qt::UniqueConnection);
+ connect(folder, &Folder::progressInfo, this, &FolderStatusModel::slotSetProgress, Qt::UniqueConnection);
+ connect(folder, &Folder::newBigFolderDiscovered, this, &FolderStatusModel::slotNewBigFolder, Qt::UniqueConnection);
}
// Sort by header text
auto parentInfo = infoForIndex(parent);
if (parentInfo && parentInfo->_checked != Qt::Checked) {
bool hasUnchecked = false;
- foreach (const auto &sub, parentInfo->_subs) {
+ for (const auto &sub : parentInfo->_subs) {
if (sub._checked != Qt::Checked) {
hasUnchecked = true;
break;
}
std::set<QString> selectiveSyncUndecidedSet; // not QSet because it's not sorted
- foreach (const QString &str, selectiveSyncUndecidedList) {
+ for (const auto &str : selectiveSyncUndecidedList) {
if (str.startsWith(parentInfo->_path) || parentInfo->_path == QLatin1String("/")) {
selectiveSyncUndecidedSet.insert(str);
}
QVector<SubFolderInfo> newSubs;
newSubs.reserve(sortedSubfolders.size());
- foreach (const QString &path, sortedSubfolders) {
+ for (const auto &path : sortedSubfolders) {
auto relativePath = path.mid(pathToRemove.size());
if (parentInfo->_folder->isFileExcludedRelative(relativePath)) {
continue;
} else if (parentInfo->_checked == Qt::Checked) {
newInfo._checked = Qt::Checked;
} else {
- foreach (const QString &str, selectiveSyncBlackList) {
+ for (const auto &str : selectiveSyncBlackList) {
if (str == relativePath || str == QLatin1String("/")) {
newInfo._checked = Qt::Unchecked;
break;
endInsertRows();
}
- for (int undecidedIndex : qAsConst(undecidedIndexes)) {
+ for (const auto undecidedIndex : qAsConst(undecidedIndexes)) {
emit suggestExpand(index(undecidedIndex, 0, idx));
}
/* Try to remove the the undecided lists the items that are not on the server. */
} else {
// We did not load from the server so we reuse the one from the old black list
const QString path = root._path;
- foreach (const QString &it, oldBlackList) {
+ for (const auto &it : oldBlackList) {
if (it.startsWith(path))
result += it;
}
}
//The part that changed should not be read from the DB on next sync because there might be new folders
// (the ones that are no longer in the blacklist)
- foreach (const auto &it, changes) {
+ for (const auto &it : changes) {
folder->journalDb()->schedulePathForRemoteDiscovery(it);
folder->schedulePathForLocalDiscovery(it);
}
quint64 estimatedUpBw = 0;
quint64 estimatedDownBw = 0;
QString allFilenames;
- foreach (const ProgressInfo::ProgressItem &citm, progress._currentItems) {
+ for (const auto &citm : progress._currentItems) {
if (curItemProgress == -1 || (ProgressInfo::isSizeDependent(citm._item)
&& biggerItemSize < citm._item._size)) {
curItemProgress = citm._progress.completed();
void FolderStatusModel::slotFolderScheduleQueueChanged()
{
// Update messages on waiting folders.
- foreach (Folder *f, FolderMan::instance()->map()) {
+ for (const auto f : FolderMan::instance()->map()) {
slotFolderSyncStateChange(f);
}
}
qCWarning(lcFolderStatus) << "Could not read selective sync list from db.";
return;
}
- foreach (const auto &undecidedFolder, undecidedList) {
+ for (const auto &undecidedFolder : undecidedList) {
blackList.removeAll(undecidedFolder);
}
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
}
// The part that changed should not be read from the DB on next sync because there might be new folders
// (the ones that are no longer in the blacklist)
- foreach (const auto &it, undecidedList) {
+ for (const auto &it : undecidedList) {
folder->journalDb()->schedulePathForRemoteDiscovery(it);
folder->schedulePathForLocalDiscovery(it);
}