Commit 854fbd1e authored by Daniel Teske's avatar Daniel Teske

Rename SessionManager::clear() to closeAllProjects()

Also move the editor closing out of the function. It isn't needed on
shutdown as all editors are already closed then.

Change-Id: Ie50a238e0a0382a99b0a267b286f9ed9484f26f6
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent aa7efa41
......@@ -172,7 +172,7 @@ struct ProjectExplorerPluginPrivate {
QAction *m_newAction;
QAction *m_loadAction;
Utils::ParameterAction *m_unloadAction;
QAction *m_clearSession;
QAction *m_closeAllProjects;
QAction *m_buildProjectOnlyAction;
Utils::ParameterAction *m_buildAction;
Utils::ParameterAction *m_buildActionContextMenu;
......@@ -645,8 +645,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
// unload session action
d->m_clearSession = new QAction(tr("Close All Projects"), this);
cmd = am->registerAction(d->m_clearSession, Constants::CLEARSESSION, globalcontext);
d->m_closeAllProjects = new QAction(tr("Close All Projects"), this);
cmd = am->registerAction(d->m_closeAllProjects, Constants::CLEARSESSION, globalcontext);
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
......@@ -983,7 +983,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(d->m_runWithoutDeployAction, SIGNAL(triggered()), this, SLOT(runProjectWithoutDeploy()));
connect(d->m_cancelBuildAction, SIGNAL(triggered()), this, SLOT(cancelBuild()));
connect(d->m_unloadAction, SIGNAL(triggered()), this, SLOT(unloadProject()));
connect(d->m_clearSession, SIGNAL(triggered()), this, SLOT(clearSession()));
connect(d->m_closeAllProjects, SIGNAL(triggered()), this, SLOT(closeAllProjects()));
connect(d->m_addNewFileAction, SIGNAL(triggered()), this, SLOT(addNewFile()));
connect(d->m_addExistingFilesAction, SIGNAL(triggered()), this, SLOT(addExistingFiles()));
connect(d->m_addNewSubprojectAction, SIGNAL(triggered()), this, SLOT(addNewSubproject()));
......@@ -1098,13 +1098,15 @@ void ProjectExplorerPlugin::unloadProject()
updateActions();
}
void ProjectExplorerPlugin::clearSession()
void ProjectExplorerPlugin::closeAllProjects()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::clearSession";
qDebug() << "ProjectExplorerPlugin::closeAllProject";
if (!d->m_session->clear())
if (!ICore::editorManager()->closeAllEditors())
return; // Action has been cancelled
d->m_session->closeAllProjects();
updateActions();
}
......@@ -1158,7 +1160,7 @@ void ProjectExplorerPlugin::updateRunWithoutDeployMenu()
ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
{
d->m_proWindow->aboutToShutdown(); // disconnect from session
d->m_session->clear();
d->m_session->closeAllProjects();
d->m_projectsMode = 0;
// Attempt to synchronously shutdown all run controls.
// If that fails, fall back to asynchronous shutdown (Debugger run controls
......@@ -1719,7 +1721,7 @@ void ProjectExplorerPlugin::updateActions()
d->m_cleanProjectOnlyAction->setToolTip(buildActionState.second);
// Session actions
d->m_clearSession->setEnabled(!d->m_session->projects().isEmpty());
d->m_closeAllProjects->setEnabled(!d->m_session->projects().isEmpty());
d->m_buildSessionAction->setEnabled(buildSessionState.first);
d->m_rebuildSessionAction->setEnabled(buildSessionState.first);
......
......@@ -372,31 +372,15 @@ bool SessionManager::save()
return result;
}
/*!
\fn bool SessionManager::clear()
\fn bool SessionManager::closeAllProjects()
Returns whether the clear operation has been not cancelled & all projects could be closed.
Closes all projects
*/
bool SessionManager::clear()
void SessionManager::closeAllProjects()
{
if (debug)
qDebug() << "SessionManager - clearing session ...";
bool success = ICore::editorManager()->closeAllEditors();
if (success) {
if (debug)
qDebug() << "SessionManager - Removing projects ...";
setStartupProject(0);
removeProjects(projects());
}
if (debug)
qDebug() << "SessionManager - clearing session result is " << success;
return success;
setStartupProject(0);
removeProjects(projects());
}
const QList<Project *> &SessionManager::projects() const
......
......@@ -84,7 +84,7 @@ public:
bool loadSession(const QString &session);
bool save();
bool clear();
void closeAllProjects();
void addProject(Project *project);
void addProjects(const QList<Project*> &projects);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment