forked from qt-creator/qt-creator
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.
This commit is contained in:
@@ -685,28 +685,19 @@ void ProjectExplorerPlugin::loadAction()
|
||||
updateActions();
|
||||
}
|
||||
|
||||
bool ProjectExplorerPlugin::saveAction(Project *pro)
|
||||
void ProjectExplorerPlugin::unloadProject()
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << "ProjectExplorerPlugin::saveAction";
|
||||
qDebug() << "ProjectExplorerPlugin::unloadProject";
|
||||
|
||||
if (!pro)
|
||||
pro = m_currentProject;
|
||||
Q_ASSERT(pro);
|
||||
|
||||
Core::IFile *fi = pro->file();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user