mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Instantiate FileTagModel in FileDetails
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
c6d29e7d77
commit
791eb87afc
@ -14,6 +14,7 @@
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
#include "accountstate.h"
|
||||
#include "filedetails.h"
|
||||
#include "folderman.h"
|
||||
|
||||
@ -71,6 +72,7 @@ void FileDetails::setLocalPath(const QString &localPath)
|
||||
|
||||
_filelockState = _fileRecord._lockstate;
|
||||
updateLockExpireString();
|
||||
updateFileTagModel(file, folder);
|
||||
|
||||
Q_EMIT fileChanged();
|
||||
}
|
||||
@ -153,4 +155,19 @@ bool FileDetails::isFolder() const
|
||||
return _fileInfo.isDir();
|
||||
}
|
||||
|
||||
FileTagModel *FileDetails::fileTagModel() const
|
||||
{
|
||||
return _fileTagModel.get();
|
||||
}
|
||||
|
||||
void FileDetails::updateFileTagModel(const QString &serverRelPath, const Folder * const folder)
|
||||
{
|
||||
Q_ASSERT(folder);
|
||||
const auto account = folder->accountState()->account();
|
||||
Q_ASSERT(account);
|
||||
|
||||
_fileTagModel = std::make_unique<FileTagModel>(serverRelPath, account);
|
||||
Q_EMIT fileTagModelChanged();
|
||||
}
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
@ -21,8 +21,12 @@
|
||||
|
||||
#include "common/syncjournalfilerecord.h"
|
||||
|
||||
#include "gui/filetagmodel.h"
|
||||
|
||||
namespace OCC {
|
||||
|
||||
class Folder;
|
||||
|
||||
class FileDetails : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -33,6 +37,7 @@ class FileDetails : public QObject
|
||||
Q_PROPERTY(QString iconUrl READ iconUrl NOTIFY fileChanged)
|
||||
Q_PROPERTY(QString lockExpireString READ lockExpireString NOTIFY lockExpireStringChanged)
|
||||
Q_PROPERTY(bool isFolder READ isFolder NOTIFY isFolderChanged)
|
||||
Q_PROPERTY(FileTagModel* fileTagModel READ fileTagModel NOTIFY fileTagModelChanged)
|
||||
|
||||
public:
|
||||
explicit FileDetails(QObject *parent = nullptr);
|
||||
@ -44,6 +49,7 @@ public:
|
||||
[[nodiscard]] QString iconUrl() const;
|
||||
[[nodiscard]] QString lockExpireString() const;
|
||||
[[nodiscard]] bool isFolder() const;
|
||||
[[nodiscard]] FileTagModel *fileTagModel() const;
|
||||
|
||||
public slots:
|
||||
void setLocalPath(const QString &localPath);
|
||||
@ -53,10 +59,12 @@ signals:
|
||||
void fileChanged();
|
||||
void lockExpireStringChanged();
|
||||
void isFolderChanged();
|
||||
void fileTagModelChanged();
|
||||
|
||||
private slots:
|
||||
void refreshFileDetails();
|
||||
void updateLockExpireString();
|
||||
void updateFileTagModel(const QString &serverRelPath, const Folder * const folder);
|
||||
|
||||
private:
|
||||
QString _localPath;
|
||||
@ -70,6 +78,8 @@ private:
|
||||
QTimer _filelockStateUpdateTimer;
|
||||
|
||||
QLocale _locale;
|
||||
|
||||
std::unique_ptr<FileTagModel> _fileTagModel;
|
||||
};
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
Loading…
Reference in New Issue
Block a user