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

@@ -117,6 +117,26 @@ Id IDocument::id() const
return d->id;
}
/*!
* Used to load a file if this document is part of an IEditor implementation, when the editor
* is opened.
* If the editor is opened from an auto save file, \a realFileName is the name of the auto save
* that should be loaded, and \a fileName is the file name of the resulting file.
* In that case, the contents of the auto save file should be loaded, the file name of the
* IDocument should be set to \a fileName, and the document state be set to modified.
* If the editor is opened from a regular file, \a fileName and \a realFileName are the same.
* Use \a errorString to return an error message, if this document can not handle the
* file contents.
* Returns true on success, false if an error occurred.
*/
bool IDocument::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
Q_UNUSED(errorString)
Q_UNUSED(fileName)
Q_UNUSED(realFileName)
return false;
}
/*!
Used for example by EditorManager::openEditorWithContents() to set the contents
of this document.