diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 95c1ffab642..50b8420618b 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1281,7 +1281,7 @@ void ProjectExplorerPlugin::openProjectWelcomePage(const QString &fileName) QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); } -bool ProjectExplorerPlugin::openProject(const QString &fileName, QString *errorString) +Project *ProjectExplorerPlugin::openProject(const QString &fileName, QString *errorString) { if (debug) qDebug() << "ProjectExplorerPlugin::openProject"; @@ -1290,9 +1290,9 @@ bool ProjectExplorerPlugin::openProject(const QString &fileName, QString *errorS if (!list.isEmpty()) { addToRecentProjects(fileName, list.first()->displayName()); d->m_session->setStartupProject(list.first()); - return true; + return list.first(); } - return false; + return 0; } static inline QList allProjectManagers() diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 70e8a5a4736..8e61dbc71f8 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -80,7 +80,7 @@ public: static ProjectExplorerPlugin *instance(); - bool openProject(const QString &fileName, QString *error); + Project *openProject(const QString &fileName, QString *error); QList openProjects(const QStringList &fileNames, QString *error); Q_SLOT void openProjectWelcomePage(const QString &fileName); diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index 3f347cb3bca..0aae7088728 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -40,9 +40,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -406,23 +408,17 @@ void ExamplesWelcomePage::openProject(const QString &projectFile, const QStringL // don't try to load help and files if loading the help request is being cancelled QString errorMessage; ProjectExplorer::ProjectExplorerPlugin *peplugin = ProjectExplorer::ProjectExplorerPlugin::instance(); - if (!proFile.isEmpty() && peplugin->openProject(proFile, &errorMessage)) { + if (proFile.isEmpty()) + return; + if (ProjectExplorer::Project *project = peplugin->openProject(proFile, &errorMessage)) { Core::ICore::openFiles(filesToOpen); + if (project->needsConfiguration()) + project->configureAsExampleProject(platforms); + Core::ModeManager::activateModeType(QLatin1String(Core::Constants::MODE_EDIT_TYPE)); Core::ICore::helpManager()->handleHelpRequest(help.toString()+QLatin1String("?view=split")); } if (!errorMessage.isEmpty()) QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); - // Configure project for building - ProjectExplorer::Project *project = 0; - foreach (ProjectExplorer::Project *pro, peplugin->session()->projects()) { - if (pro->rootProjectNode()->path() == proFile) { - project = pro; - break; - } - } - if (project && project->needsConfiguration()) - project->configureAsExampleProject(platforms); - } void ExamplesWelcomePage::updateTagsModel()