Fix showing of info bar in .ui text editor.

Removes another useless IEditorFactor::open implementation

Change-Id: I01d3c46131e8e3d6dcce1f0e338bc7d637153e98
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
Eike Ziller
2013-05-31 16:24:43 +02:00
parent 97915bbcea
commit 37c22861dc
2 changed files with 6 additions and 15 deletions

View File

@@ -66,23 +66,15 @@ QString FormEditorFactory::displayName() const
return qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME); return qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME);
} }
Core::IDocument *FormEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::EditorManager::openEditor(fileName, id());
if (!iface)
return 0;
if (qobject_cast<FormWindowEditor *>(iface)) {
Core::InfoBarEntry info(Core::Id(Constants::INFO_READ_ONLY),
tr("This file can only be edited in <b>Design</b> mode."));
info.setCustomButtonInfo(tr("Switch mode"), this, SLOT(designerModeClicked()));
iface->document()->infoBar()->addInfo(info);
}
return iface->document();
}
Core::IEditor *FormEditorFactory::createEditor(QWidget *parent) Core::IEditor *FormEditorFactory::createEditor(QWidget *parent)
{ {
const EditorData data = FormEditorW::instance()->createEditor(parent); const EditorData data = FormEditorW::instance()->createEditor(parent);
if (data.formWindowEditor) {
Core::InfoBarEntry info(Core::Id(Constants::INFO_READ_ONLY),
tr("This file can only be edited in <b>Design</b> mode."));
info.setCustomButtonInfo(tr("Switch mode"), this, SLOT(designerModeClicked()));
data.formWindowEditor->document()->infoBar()->addInfo(info);
}
return data.formWindowEditor; return data.formWindowEditor;
} }

View File

@@ -48,7 +48,6 @@ public:
QStringList mimeTypes() const; QStringList mimeTypes() const;
Core::Id id() const; Core::Id id() const;
QString displayName() const; QString displayName() const;
Core::IDocument *open(const QString &fileName);
Core::IEditor *createEditor(QWidget *parent); Core::IEditor *createEditor(QWidget *parent);
private slots: private slots: