forked from qt-creator/qt-creator
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:
@@ -94,11 +94,12 @@ bool TaskFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
deleteLater();
|
||||
return true;
|
||||
}
|
||||
return open(errorString, filePath().toString());
|
||||
return open(errorString, filePath().toString(), filePath().toString());
|
||||
}
|
||||
|
||||
bool TaskFile::open(QString *errorString, const QString &fileName)
|
||||
bool TaskFile::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||
{
|
||||
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);
|
||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||
|
||||
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)) {
|
||||
if (!file->open(&errorString, fileName, fileName)) {
|
||||
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString);
|
||||
delete file;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user