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:
@@ -50,6 +50,12 @@ class CORE_EXPORT IDocument : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class OpenResult {
|
||||
Success,
|
||||
ReadError,
|
||||
CannotHandle
|
||||
};
|
||||
|
||||
// This enum must match the indexes of the reloadBehavior widget
|
||||
// in generalsettings.ui
|
||||
enum ReloadSetting {
|
||||
@@ -86,7 +92,7 @@ public:
|
||||
Id id() const;
|
||||
|
||||
// required to be re-implemented for documents of IEditors
|
||||
virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
virtual OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
|
||||
virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false) = 0;
|
||||
virtual bool setContents(const QByteArray &contents);
|
||||
|
||||
Reference in New Issue
Block a user