From 20a4915e7ce329194e19c563215f6b9eda75c39f Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 21 Oct 2024 14:54:34 +0800 Subject: [PATCH] Store fetched folder as private member in filedetails Signed-off-by: Claudio Cambra --- src/gui/filedetails/filedetails.cpp | 12 ++++++------ src/gui/filedetails/filedetails.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/filedetails/filedetails.cpp b/src/gui/filedetails/filedetails.cpp index 67ebb554c..e7897aaf5 100644 --- a/src/gui/filedetails/filedetails.cpp +++ b/src/gui/filedetails/filedetails.cpp @@ -61,15 +61,15 @@ void FileDetails::setLocalPath(const QString &localPath) _fileWatcher.addPath(localPath); connect(&_fileWatcher, &QFileSystemWatcher::fileChanged, this, &FileDetails::refreshFileDetails); - const auto folder = FolderMan::instance()->folderForPath(_localPath); - if (!folder) { + _folder = FolderMan::instance()->folderForPath(_localPath); + if (!_folder) { qCWarning(lcFileDetails) << "No folder found for path:" << _localPath << "will not load file details."; return; } - const auto file = _localPath.mid(folder->cleanPath().length() + 1); + const auto file = _localPath.mid(_folder->cleanPath().length() + 1); - if (!folder->journalDb()->getFileRecord(file, &_fileRecord)) { + if (!_folder->journalDb()->getFileRecord(file, &_fileRecord)) { qCWarning(lcFileDetails) << "Invalid file record for path:" << _localPath << "will not load file details."; @@ -77,9 +77,9 @@ void FileDetails::setLocalPath(const QString &localPath) _filelockState = _fileRecord._lockstate; updateLockExpireString(); - updateFileTagModel(folder); - _sharingAvailable = folder->accountState()->account()->capabilities().shareAPI(); + const auto account = _folder->accountState()->account(); + _sharingAvailable = account->capabilities().shareAPI(); Q_EMIT fileChanged(); } diff --git a/src/gui/filedetails/filedetails.h b/src/gui/filedetails/filedetails.h index 2834981af..a4dc7e593 100644 --- a/src/gui/filedetails/filedetails.h +++ b/src/gui/filedetails/filedetails.h @@ -73,6 +73,7 @@ private: QFileInfo _fileInfo; QFileSystemWatcher _fileWatcher; + Folder *_folder = nullptr; SyncJournalFileRecord _fileRecord; SyncJournalFileLockInfo _filelockState; QByteArray _numericFileId; -- 2.39.5