Examples: Fix showing documentation in side bar.

Opening the project jumped to project mode, which doesn't have a help
side bar. We now configure the example project and jump to edit mode
before opening the documentation.

Change-Id: Ic87d3fd0856862ac9297d43307037f994664acdc
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
Eike Ziller
2012-03-21 11:12:11 +01:00
parent d3e25481f9
commit dffbc4407a
3 changed files with 12 additions and 16 deletions

View File

@@ -1281,7 +1281,7 @@ void ProjectExplorerPlugin::openProjectWelcomePage(const QString &fileName)
QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); 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) if (debug)
qDebug() << "ProjectExplorerPlugin::openProject"; qDebug() << "ProjectExplorerPlugin::openProject";
@@ -1290,9 +1290,9 @@ bool ProjectExplorerPlugin::openProject(const QString &fileName, QString *errorS
if (!list.isEmpty()) { if (!list.isEmpty()) {
addToRecentProjects(fileName, list.first()->displayName()); addToRecentProjects(fileName, list.first()->displayName());
d->m_session->setStartupProject(list.first()); d->m_session->setStartupProject(list.first());
return true; return list.first();
} }
return false; return 0;
} }
static inline QList<IProjectManager*> allProjectManagers() static inline QList<IProjectManager*> allProjectManagers()

View File

@@ -80,7 +80,7 @@ public:
static ProjectExplorerPlugin *instance(); static ProjectExplorerPlugin *instance();
bool openProject(const QString &fileName, QString *error); Project *openProject(const QString &fileName, QString *error);
QList<Project *> openProjects(const QStringList &fileNames, QString *error); QList<Project *> openProjects(const QStringList &fileNames, QString *error);
Q_SLOT void openProjectWelcomePage(const QString &fileName); Q_SLOT void openProjectWelcomePage(const QString &fileName);

View File

@@ -40,9 +40,11 @@
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreplugin.h> #include <coreplugin/coreplugin.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
#include <coreplugin/modemanager.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
@@ -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 // don't try to load help and files if loading the help request is being cancelled
QString errorMessage; QString errorMessage;
ProjectExplorer::ProjectExplorerPlugin *peplugin = ProjectExplorer::ProjectExplorerPlugin::instance(); 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); 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")); Core::ICore::helpManager()->handleHelpRequest(help.toString()+QLatin1String("?view=split"));
} }
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); 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() void ExamplesWelcomePage::updateTagsModel()