forked from qt-creator/qt-creator
Tasklist: reload tasks when open task file again
Fixes: QTCREATORBUG-25108 Change-Id: Ib1096a098ab2b06ab384b31715ca32a0fd710781 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/task.h>
|
#include <projectexplorer/task.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
#include <projectexplorer/taskhub.h>
|
||||||
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -165,14 +166,13 @@ static bool parseTaskFile(QString *errorString, const FilePath &name)
|
|||||||
|
|
||||||
IDocument *TaskListPlugin::openTasks(const FilePath &fileName)
|
IDocument *TaskListPlugin::openTasks(const FilePath &fileName)
|
||||||
{
|
{
|
||||||
foreach (TaskFile *doc, d->m_openFiles) {
|
TaskFile *file = Utils::findOrDefault(d->m_openFiles, Utils::equal(&TaskFile::filePath, fileName));
|
||||||
if (doc->filePath() == fileName)
|
|
||||||
return doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto file = new TaskFile(this);
|
|
||||||
|
|
||||||
QString errorString;
|
QString errorString;
|
||||||
|
if (file) {
|
||||||
|
file->load(&errorString, fileName);
|
||||||
|
} else {
|
||||||
|
file = new TaskFile(this);
|
||||||
|
|
||||||
if (!file->load(&errorString, fileName)) {
|
if (!file->load(&errorString, fileName)) {
|
||||||
QMessageBox::critical(ICore::dialogParent(), tr("File Error"), errorString);
|
QMessageBox::critical(ICore::dialogParent(), tr("File Error"), errorString);
|
||||||
delete file;
|
delete file;
|
||||||
@@ -183,7 +183,7 @@ IDocument *TaskListPlugin::openTasks(const FilePath &fileName)
|
|||||||
|
|
||||||
// Register with filemanager:
|
// Register with filemanager:
|
||||||
DocumentManager::addDocument(file);
|
DocumentManager::addDocument(file);
|
||||||
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user