From: Claudio Cambra Date: Mon, 21 Oct 2024 06:54:34 +0000 (+0800) Subject: Store fetched folder as private member in filedetails X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~5^2~26^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=20a4915e7ce329194e19c563215f6b9eda75c39f;p=nextcloud-desktop.git Store fetched folder as private member in filedetails Signed-off-by: Claudio Cambra --- 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;