Commit 2a76e5f8 authored by dt's avatar dt Committed by dt

Fixes: Merge the saveAction() function in the unload function.

Details:  Found while reading the code. It was only used in that
function anyway, and this simplfies the code a little bit and
removes some dubious left over.
parent 75f2c01d
......@@ -685,28 +685,19 @@ void ProjectExplorerPlugin::loadAction()
updateActions();
}
bool ProjectExplorerPlugin::saveAction(Project *pro)
void ProjectExplorerPlugin::unloadProject()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::saveAction";
if (!pro)
pro = m_currentProject;
Q_ASSERT(pro);
Core::IFile *fi = pro->file();
qDebug() << "ProjectExplorerPlugin::unloadProject";
if (!fi) // TODO Why saving the session here????
fi = m_session->file();
Core::IFile *fi = m_currentProject->file();
if (!fi || fi->fileName().isEmpty()) //nothing to save?
return false;
return;
QList<Core::IFile*> filesToSave;
filesToSave << fi;
if (pro)
filesToSave << pro->dependencies();
filesToSave << pro->dependencies();
// check the number of modified files
int readonlycount = 0;
......@@ -721,20 +712,10 @@ bool ProjectExplorerPlugin::saveAction(Project *pro)
else
success = m_core->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty();
if (success)
addToRecentProjects(fi->fileName());
updateActions();
return success;
}
void ProjectExplorerPlugin::unloadProject()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::unloadProject";
if (!saveAction(m_currentProject))
if (!success)
return;
addToRecentProjects(fi->fileName());
m_session->removeProject(m_currentProject);
updateActions();
}
......
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