Commit cb9bc178 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

ResourceEditor: Properly support contents()



Change-Id: I1953153de66a1228ab98d6f3295696b2d8f1facb
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent e6f60265
......@@ -552,6 +552,8 @@ ResourceModel::ResourceModel(QObject *parent)
void ResourceModel::setDirty(bool b)
{
if (b)
emit contentsChanged();
if (b == m_dirty)
return;
......
......@@ -268,6 +268,7 @@ private:
signals:
void dirtyChanged(bool b);
void contentsChanged();
private:
ResourceFile m_resource_file;
......
......@@ -64,6 +64,8 @@ ResourceEditorDocument::ResourceEditorDocument(QObject *parent) :
setMimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE));
connect(m_model, &RelativeResourceModel::dirtyChanged,
this, &ResourceEditorDocument::dirtyChanged);
connect(m_model, &ResourceModel::contentsChanged,
this, &IDocument::contentsChanged);
if (debugResourceEditorW)
qDebug() << "ResourceEditorFile::ResourceEditorFile()";
......@@ -182,6 +184,11 @@ QString ResourceEditorDocument::plainText() const
return m_model->contents();
}
QByteArray ResourceEditorDocument::contents() const
{
return m_model->contents().toUtf8();
}
bool ResourceEditorDocument::setContents(const QByteArray &contents)
{
TempFileSaver saver;
......
......@@ -56,6 +56,7 @@ public:
const QString &realFileName) override;
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
QString plainText() const;
QByteArray contents() const override;
bool setContents(const QByteArray &contents) override;
bool shouldAutoSave() const override;
bool isModified() const override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment