[CSE] Add new method "infoForFolderId"

we need to query the model for the subfolderinfo, but we don't
have the model index, we have the folder id. this returns it.
This commit is contained in:
Tomaz Canabrava 2017-12-14 14:39:07 +01:00
parent c592871f94
commit 82c07236c1
2 changed files with 13 additions and 1 deletions

View file

@ -396,6 +396,18 @@ FolderStatusModel::SubFolderInfo *FolderStatusModel::infoForIndex(const QModelIn
} }
} }
FolderStatusModel::SubFolderInfo *FolderStatusModel::infoForFileId(const QByteArray& fileId) const
{
for(int i = 0, end = _folders.size(); i < end; i++) {
auto *info = const_cast<SubFolderInfo *>(&_folders[i]);
if (info->_fileId == fileId) {
return info;
}
}
return nullptr;
}
QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) const QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) const
{ {
if (!f) { if (!f) {

View file

@ -120,7 +120,7 @@ public:
FetchLabel }; FetchLabel };
ItemType classify(const QModelIndex &index) const; ItemType classify(const QModelIndex &index) const;
SubFolderInfo *infoForIndex(const QModelIndex &index) const; SubFolderInfo *infoForIndex(const QModelIndex &index) const;
SubFolderInfo *infoForFileId(const QByteArray &fileId) const;
// If the selective sync check boxes were changed // If the selective sync check boxes were changed
bool isDirty() { return _dirty; } bool isDirty() { return _dirty; }