forked from qt-creator/qt-creator
Editor manager: Abort with a single message if file is not readable.
We show a dialog that offers opening a file in a different editor type if opening a file fails, but we should not do that if opening the file fails because it is not readable. With this change, documents now specify if they failed to open a file because reading failed, or because they could not handle the file contents. Task-number: QTCREATORBUG-14495 Change-Id: I5d4b7cfa74b87ef21b9b55bc30b3ebe2f8238dfa Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
This commit is contained in:
@@ -117,6 +117,19 @@ Id IDocument::id() const
|
||||
return d->id;
|
||||
}
|
||||
|
||||
/*!
|
||||
\enum IDocument::OpenResult
|
||||
The OpenResult enum describes whether a file was successfully opened.
|
||||
|
||||
\value Success
|
||||
The file was read successfully and can be handled by this document type.
|
||||
\value ReadError
|
||||
The file could not be opened for reading, either because it does not exist or
|
||||
because of missing permissions.
|
||||
\value CannotHandle
|
||||
This document type could not handle the file content.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Used to load a file if this document is part of an IEditor implementation, when the editor
|
||||
* is opened.
|
||||
@@ -127,14 +140,14 @@ Id IDocument::id() const
|
||||
* 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.
|
||||
* Returns whether the file was opened and read successfully.
|
||||
*/
|
||||
bool IDocument::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
{
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(realFileName)
|
||||
return false;
|
||||
return OpenResult::CannotHandle;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user