void FileDetails::updateFileTagModel(const AccountPtr &account)
{
- Q_ASSERT(account);
-
- const auto serverRelPath = QString(folder->remotePathTrailingSlash() + name());
-
- _fileTagModel = std::make_unique<FileTagModel>(serverRelPath, account);
+ _fileTagModel = std::make_unique<FileTagModel>(_fileRecord, _folder, account);
Q_EMIT fileTagModelChanged();
}
namespace OCC {
-FileTagModel::FileTagModel(const QString &serverRelativePath,
+FileTagModel::FileTagModel(const SyncJournalFileRecord &fileRecord,
+ const Folder * const syncFolder,
const AccountPtr &account,
QObject * const parent)
: QAbstractListModel(parent)
- , _serverRelativePath(serverRelativePath)
, _account(account)
{
+ _serverRelativePath = syncFolder->remotePathTrailingSlash() + fileRecord.path();
+
+ if (const auto vfsMode = syncFolder->vfs().mode(); fileRecord.isVirtualFile() && vfsMode == Vfs::WithSuffix) {
+ if (const auto suffix = syncFolder->vfs().fileSuffix(); !suffix.isEmpty() && _serverRelativePath.endsWith(suffix)) {
+ _serverRelativePath.chop(suffix.length());
+ }
+ }
+
fetchFileTags();
}
#include <QAbstractListModel>
+#include "common/syncjournalfilerecord.h"
+#include "gui/folder.h"
#include "libsync/account.h"
namespace OCC {
Q_PROPERTY(QString overflowTagsString READ overflowTagsString NOTIFY overflowTagsStringChanged)
public:
- explicit FileTagModel(const QString &serverRelativePath, const AccountPtr &account, QObject * const parent = nullptr);
+ explicit FileTagModel(const SyncJournalFileRecord &fileRecord,
+ const Folder *const syncFolder,
+ const AccountPtr &account,
+ QObject *const parent = nullptr);
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
[[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;