Commit 93ccf4f2 authored by hjk's avatar hjk
Browse files

IDocument: Make mimeType a value member



Change-Id: I2e90ccf0a45ae8d00bcd00ec77fe0d9776f2f119
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 777b9e88
......@@ -42,6 +42,7 @@ QmlProjectFile::QmlProjectFile(QmlProject *parent, QString fileName)
QTC_CHECK(m_project);
QTC_CHECK(!fileName.isEmpty());
setId("Qml.ProjectFile");
setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
setFilePath(fileName);
}
......@@ -64,11 +65,6 @@ QString QmlProjectFile::suggestedFileName() const
return QString();
}
QString QmlProjectFile::mimeType() const
{
return QLatin1String(Constants::QMLPROJECT_MIMETYPE);
}
bool QmlProjectFile::isModified() const
{
return false;
......
......@@ -50,7 +50,6 @@ public:
virtual QString defaultPath() const;
virtual QString suggestedFileName() const;
virtual QString mimeType() const;
virtual bool isModified() const;
virtual bool isSaveAsAllowed() const;
......
......@@ -49,6 +49,7 @@ BarDescriptorDocument::BarDescriptorDocument(QObject *parent)
: Core::TextDocument(parent)
{
setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID);
setMimeType(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
// blackberry-nativepackager requires the XML file to be in UTF-8 encoding,
// force if possible
if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8"))
......@@ -102,11 +103,6 @@ QString BarDescriptorDocument::suggestedFileName() const
return fi.fileName();
}
QString BarDescriptorDocument::mimeType() const
{
return QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE);
}
bool BarDescriptorDocument::shouldAutoSave() const
{
return false;
......
......@@ -91,7 +91,6 @@ public:
QString defaultPath() const;
QString suggestedFileName() const;
QString mimeType() const;
bool shouldAutoSave() const;
bool isModified() const;
......
......@@ -62,22 +62,16 @@ enum { debugResourceEditorW = 0 };
ResourceEditorDocument::ResourceEditorDocument(ResourceEditorW *parent) :
IDocument(parent),
m_mimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE)),
m_blockDirtyChanged(false),
m_parent(parent)
{
setId(ResourceEditor::Constants::RESOURCEEDITOR_ID);
setMimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE));
setFilePath(parent->m_resourceEditor->fileName());
if (debugResourceEditorW)
qDebug() << "ResourceEditorFile::ResourceEditorFile()";
}
QString ResourceEditorDocument::mimeType() const
{
return m_mimeType;
}
ResourceEditorW::ResourceEditorW(const Core::Context &context,
ResourceEditorPlugin *plugin,
QWidget *parent)
......
......@@ -62,7 +62,6 @@ public:
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
QString defaultPath() const;
QString suggestedFileName() const;
QString mimeType() const;
void setFilePath(const QString &newName);
void setBlockDirtyChanged(bool value);
......@@ -70,7 +69,6 @@ public slots:
void dirtyChanged(bool);
private:
const QString m_mimeType;
bool m_blockDirtyChanged;
ResourceEditorW *m_parent;
};
......
......@@ -441,6 +441,7 @@ ResourceFileWatcher::ResourceFileWatcher(ResourceTopLevelNode *node)
: IDocument(node), m_node(node)
{
setId("ResourceNodeWatcher");
setMimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE));
setFilePath(node->path());
}
......@@ -462,11 +463,6 @@ QString ResourceFileWatcher::suggestedFileName() const
return QString();
}
QString ResourceFileWatcher::mimeType() const
{
return QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE);
}
bool ResourceFileWatcher::isModified() const
{
return false;
......
......@@ -122,7 +122,6 @@ public:
virtual QString defaultPath() const;
virtual QString suggestedFileName() const;
virtual QString mimeType() const;
virtual bool isModified() const;
virtual bool isSaveAsAllowed() const;
......
......@@ -64,11 +64,6 @@ QString TaskFile::suggestedFileName() const
return QString();
}
QString TaskFile::mimeType() const
{
return QString();
}
bool TaskFile::isModified() const
{
return false;
......
......@@ -47,7 +47,6 @@ public:
QString defaultPath() const;
QString suggestedFileName() const;
QString mimeType() const;
bool isModified() const;
bool isSaveAsAllowed() const;
......
......@@ -80,7 +80,6 @@ public slots:
public:
QString m_defaultPath;
QString m_suggestedFileName;
QString m_mimeType;
TypingSettings m_typingSettings;
StorageSettings m_storageSettings;
TabSettings m_tabSettings;
......@@ -231,19 +230,6 @@ QChar BaseTextDocument::characterAt(int pos) const
return document()->characterAt(pos);
}
QString BaseTextDocument::mimeType() const
{
return d->m_mimeType;
}
void BaseTextDocument::setMimeType(const QString &mt)
{
if (d->m_mimeType != mt) {
d->m_mimeType = mt;
emit mimeTypeChanged();
}
}
void BaseTextDocument::setTypingSettings(const TypingSettings &typingSettings)
{
d->m_typingSettings = typingSettings;
......
......@@ -92,8 +92,6 @@ public:
bool isSaveAsAllowed() const;
void checkPermissions();
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
QString mimeType() const;
void setMimeType(const QString &mt);
void setFilePath(const QString &newName);
QString defaultPath() const;
......
......@@ -47,11 +47,11 @@ using namespace VcsBase::Internal;
SubmitEditorFile::SubmitEditorFile(const VcsBaseSubmitEditorParameters *parameters, VcsBaseSubmitEditor *parent) :
Core::IDocument(parent),
m_mimeType(QLatin1String(parameters->mimeType)),
m_modified(false),
m_editor(parent)
{
setId(parameters->id);
setMimeType(QLatin1String(parameters->mimeType));
setTemporary(true);
}
......@@ -86,11 +86,6 @@ bool SubmitEditorFile::save(QString *errorString, const QString &fileName, bool
return true;
}
QString SubmitEditorFile::mimeType() const
{
return m_mimeType;
}
Core::IDocument::ReloadBehavior SubmitEditorFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
{
Q_UNUSED(state)
......
......@@ -51,7 +51,6 @@ public:
QString suggestedFileName() const { return QString(); }
bool isModified() const { return m_modified; }
QString mimeType() const;
bool isSaveAsAllowed() const { return false; }
bool save(QString *errorString, const QString &fileName, bool autoSave);
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
......@@ -60,7 +59,6 @@ public:
void setModified(bool modified = true);
private:
const QString m_mimeType;
bool m_modified;
VcsBaseSubmitEditor *m_editor;
};
......
Markdown is supported
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