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:
@@ -94,12 +94,11 @@ bool TaskFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
deleteLater();
|
||||
return true;
|
||||
}
|
||||
return open(errorString, filePath().toString(), filePath().toString());
|
||||
return load(errorString, filePath().toString());
|
||||
}
|
||||
|
||||
bool TaskFile::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
bool TaskFile::load(QString *errorString, const QString &fileName)
|
||||
{
|
||||
Q_UNUSED(realFileName)
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
return TaskListPlugin::loadFile(errorString, m_baseDir, fileName);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
|
||||
|
||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
bool load(QString *errorString, const QString &fileName);
|
||||
|
||||
QString baseDir() const;
|
||||
void setBaseDir(const QString &base);
|
||||
|
||||
@@ -177,7 +177,7 @@ IDocument *TaskListPlugin::openTasks(const QString &base, const QString &fileNam
|
||||
file->setBaseDir(base);
|
||||
|
||||
QString errorString;
|
||||
if (!file->open(&errorString, fileName, fileName)) {
|
||||
if (!file->load(&errorString, fileName)) {
|
||||
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString);
|
||||
delete file;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user