diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2017-12-14 16:39:07 +0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2017-12-14 16:39:07 +0300 |
commit | 82c07236c1368cc0fedd71936f0d89b19d64070f (patch) | |
tree | 799109fc5ea60bc6a38ccd1791bdc8321b8020cb /src/gui/folderstatusmodel.cpp | |
parent | c592871f9469e4798a18fd3fced82d9b843b84cd (diff) |
[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.
Diffstat (limited to 'src/gui/folderstatusmodel.cpp')
-rw-r--r-- | src/gui/folderstatusmodel.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 28616d2f6..0bf3a1f9e 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -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 { if (!f) { |