Move "open" from IEditor to IDocument

For non-editor documents it currently is not used, but for editors it
makes more sense to have that on the document instead of the editor.
Most actual implementations of "open" were done in the documents already
anyhow, because it is needed for reloading.

Change-Id: I29d4df2078995cbe80172b51a9bebeecb3afad3c
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-06-02 17:14:48 +02:00
parent c916d250b3
commit 4f927e4c87
36 changed files with 123 additions and 122 deletions

View File

@@ -65,11 +65,6 @@ AndroidManifestEditor::AndroidManifestEditor(AndroidManifestEditorWidget *editor
setWidget(editorWidget);
}
bool AndroidManifestEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
return widget()->open(errorString, fileName, realFileName);
}
QWidget *AndroidManifestEditor::toolBar()
{
return m_toolBar;

View File

@@ -54,7 +54,6 @@ class AndroidManifestEditor : public Core::IEditor
public:
explicit AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget);
bool open(QString *errorString, const QString &fileName, const QString &realFileName) override;
QWidget *toolBar() override;
AndroidManifestEditorWidget *widget() const override;
Core::IDocument *document() override;

View File

@@ -123,6 +123,8 @@ AndroidManifestEditorWidget::AndroidManifestEditorWidget()
connect(m_textEditorWidget->document(), SIGNAL(contentsChanged()),
this, SLOT(startParseCheck()));
connect(m_textEditorWidget->textDocument(), &TextEditor::TextDocument::reloadFinished,
this, [this](bool success) { if (success) updateAfterFileLoad(); });
connect(m_textEditorWidget->textDocument(), &TextEditor::TextDocument::openFinishedSuccessfully,
this, &AndroidManifestEditorWidget::updateAfterFileLoad);
}
@@ -502,18 +504,8 @@ void AndroidManifestEditorWidget::updateTargetComboBox()
m_targetLineEdit->addItems(items);
}
bool AndroidManifestEditorWidget::open(QString *errorString, const QString &fileName, const QString &realFileName)
void AndroidManifestEditorWidget::updateAfterFileLoad()
{
bool result = m_textEditorWidget->open(errorString, fileName, realFileName);
updateAfterFileLoad(result);
return result;
}
void AndroidManifestEditorWidget::updateAfterFileLoad(bool success)
{
if (!success)
return;
QString error;
int errorLine;
int errorColumn;

View File

@@ -96,8 +96,6 @@ public:
explicit AndroidManifestEditorWidget();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
bool isModified() const;
EditorPage activePage() const;
@@ -135,7 +133,7 @@ private:
bool syncToWidgets();
void syncToWidgets(const QDomDocument &doc);
void syncToEditor();
void updateAfterFileLoad(bool success);
void updateAfterFileLoad();
bool checkDocument(const QDomDocument &doc, QString *errorMessage,
int *errorLine, int *errorColumn);