summaryrefslogtreecommitdiff
path: root/src/plugins/genericprojectmanager/genericprojectmanager.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2013-05-27 11:17:47 +0200
committerTobias Hunger <tobias.hunger@digia.com>2013-05-27 13:16:50 +0200
commita52063ee398a042a83e50fdfa79dd972b29d91b7 (patch)
tree1fffd5bdf4c496ff8801f02ab106dfd3b572331a /src/plugins/genericprojectmanager/genericprojectmanager.cpp
parent711e67ad65e22a68ac8b2e9be96bd1272f87e639 (diff)
downloadqt-creator-a52063ee398a042a83e50fdfa79dd972b29d91b7.tar.gz
Projects: Improve opening of projects
Move logic to detect already open projects into ProjectExplorer itself, along with some check for the canonicalFilePath. Remove the same logic from the individual projectmanagers. Put check that the path is a file into project managers. So far all of them assume the project file to be a file (e.g. a xcode project manager would expect a directory though). Task-number: QTCREATORBUG-9350 Change-Id: I3901958395e3c594c8cfba9a85dc7d3ec3334afb Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/genericprojectmanager/genericprojectmanager.cpp')
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.cpp b/src/plugins/genericprojectmanager/genericprojectmanager.cpp
index 329eb9f682..2ae768efa4 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.cpp
@@ -51,21 +51,14 @@ QString Manager::mimeType() const
ProjectExplorer::Project *Manager::openProject(const QString &fileName, QString *errorString)
{
- if (!QFileInfo(fileName).isFile())
+ if (!QFileInfo(fileName).isFile()) {
+ if (errorString)
+ *errorString = tr("Failed opening project '%1': Project is not a file")
+ .arg(fileName);
return 0;
-
- ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
- foreach (ProjectExplorer::Project *pi, projectExplorer->session()->projects()) {
- if (fileName == pi->document()->fileName()) {
- if (errorString)
- *errorString = tr("Failed opening project '%1': Project already open")
- .arg(QDir::toNativeSeparators(fileName));
- return 0;
- }
}
- GenericProject *project = new GenericProject(this, fileName);
- return project;
+ return new GenericProject(this, fileName);
}
void Manager::registerProject(GenericProject *project)