Simplify file tag model updating in filedetails, only require folder pointer
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 12 Apr 2023 03:37:01 +0000 (11:37 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 16 May 2023 10:23:33 +0000 (18:23 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/filedetails.cpp
src/gui/filedetails/filedetails.h

index f2243e84096a1dec6c513d544a072a7646d5c861..37ef696c60840c694cd952f1bbf050767eb6a402 100644 (file)
@@ -72,7 +72,7 @@ void FileDetails::setLocalPath(const QString &localPath)
 
     _filelockState = _fileRecord._lockstate;
     updateLockExpireString();
-    updateFileTagModel(file, folder);
+    updateFileTagModel(folder);
 
     Q_EMIT fileChanged();
 }
@@ -160,12 +160,14 @@ FileTagModel *FileDetails::fileTagModel() const
     return _fileTagModel.get();
 }
 
-void FileDetails::updateFileTagModel(const QString &serverRelPath, const Folder * const folder)
+void FileDetails::updateFileTagModel(const Folder * const folder)
 {
     Q_ASSERT(folder);
     const auto account = folder->accountState()->account();
     Q_ASSERT(account);
 
+    const auto serverRelPath = QString(folder->remotePathTrailingSlash() + name());
+
     _fileTagModel = std::make_unique<FileTagModel>(serverRelPath, account);
     Q_EMIT fileTagModelChanged();
 }
index d2d3243236460527f35f5c86afbd3bee6fff3a20..a1fbf9ac57cd9f7efc6286139727f6d0657a84e8 100644 (file)
@@ -64,7 +64,7 @@ signals:
 private slots:
     void refreshFileDetails();
     void updateLockExpireString();
-    void updateFileTagModel(const QString &serverRelPath, const Folder * const folder);
+    void updateFileTagModel(const OCC::Folder * const folder);
 
 private:
     QString _localPath;