return QVariant();
}
case SubFolder: {
- const auto &x = static_cast<SubFolderInfo *>(index.internalPointer())->_subs[index.row()];
+ const auto &x = static_cast<SubFolderInfo *>(index.internalPointer())->_subs.at(index.row());
switch (role) {
case Qt::DisplayRole:
//: Example text: "File.txt (23KB)"
}
// also check all the children
for (int i = 0; i < info->_subs.count(); ++i) {
- if (info->_subs[i]._checked != Qt::Checked) {
+ if (info->_subs.at(i)._checked != Qt::Checked) {
setData(this->index(i, 0, index), Qt::Checked, Qt::CheckStateRole);
}
}
// Uncheck all the children
for (int i = 0; i < info->_subs.count(); ++i) {
- if (info->_subs[i]._checked != Qt::Unchecked) {
+ if (info->_subs.at(i)._checked != Qt::Unchecked) {
setData(this->index(i, 0, index), Qt::Unchecked, Qt::CheckStateRole);
}
}
const SubFolderInfo *info = &_folders[pathIdx.at(0)];
while (i < pathIdx.count() - 1) {
ASSERT(pathIdx.at(i) < info->_subs.count());
- info = &info->_subs[pathIdx.at(i)];
+ info = &info->_subs.at(pathIdx.at(i));
++i;
}
return createIndex(pathIdx.at(i), 0, const_cast<SubFolderInfo *>(info));
}
}
-QStringList FolderStatusModel::createBlackList(FolderStatusModel::SubFolderInfo *root,
+QStringList FolderStatusModel::createBlackList(const FolderStatusModel::SubFolderInfo &root,
const QStringList &oldBlackList) const
{
- if (!root)
- return QStringList();
-
- switch (root->_checked) {
+ switch (root._checked) {
case Qt::Unchecked:
- return QStringList(root->_path);
+ return QStringList(root._path);
case Qt::Checked:
return QStringList();
case Qt::PartiallyChecked:
}
QStringList result;
- if (root->_fetched) {
- for (int i = 0; i < root->_subs.count(); ++i) {
- result += createBlackList(&root->_subs[i], oldBlackList);
+ if (root._fetched) {
+ for (int i = 0; i < root._subs.count(); ++i) {
+ result += createBlackList(root._subs.at(i), oldBlackList);
}
} else {
// We did not load from the server so we re-use the one from the old black list
- QString path = root->_path;
+ const QString path = root._path;
foreach (const QString &it, oldBlackList) {
if (it.startsWith(path))
result += it;
qCWarning(lcFolderStatus) << "Could not read selective sync list from db.";
continue;
}
- QStringList blackList = createBlackList(&_folders[i], oldBlackList);
+ QStringList blackList = createBlackList(_folders.at(i), oldBlackList);
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
auto blackListSet = blackList.toSet();