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,27 +685,18 @@ void ProjectExplorerPlugin::loadAction()
|
|||||||
updateActions();
|
updateActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectExplorerPlugin::saveAction(Project *pro)
|
void ProjectExplorerPlugin::unloadProject()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "ProjectExplorerPlugin::saveAction";
|
qDebug() << "ProjectExplorerPlugin::unloadProject";
|
||||||
|
|
||||||
if (!pro)
|
Core::IFile *fi = m_currentProject->file();
|
||||||
pro = m_currentProject;
|
|
||||||
Q_ASSERT(pro);
|
|
||||||
|
|
||||||
Core::IFile *fi = pro->file();
|
|
||||||
|
|
||||||
if (!fi) // TODO Why saving the session here????
|
|
||||||
fi = m_session->file();
|
|
||||||
|
|
||||||
if (!fi || fi->fileName().isEmpty()) //nothing to save?
|
if (!fi || fi->fileName().isEmpty()) //nothing to save?
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
QList<Core::IFile*> filesToSave;
|
QList<Core::IFile*> filesToSave;
|
||||||
|
|
||||||
filesToSave << fi;
|
filesToSave << fi;
|
||||||
if (pro)
|
|
||||||
filesToSave << pro->dependencies();
|
filesToSave << pro->dependencies();
|
||||||
|
|
||||||
// check the number of modified files
|
// check the number of modified files
|
||||||
@@ -721,20 +712,10 @@ bool ProjectExplorerPlugin::saveAction(Project *pro)
|
|||||||
else
|
else
|
||||||
success = m_core->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty();
|
success = m_core->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty();
|
||||||
|
|
||||||
if (success)
|
if (!success)
|
||||||
addToRecentProjects(fi->fileName());
|
|
||||||
updateActions();
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectExplorerPlugin::unloadProject()
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
qDebug() << "ProjectExplorerPlugin::unloadProject";
|
|
||||||
|
|
||||||
if (!saveAction(m_currentProject))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
addToRecentProjects(fi->fileName());
|
||||||
m_session->removeProject(m_currentProject);
|
m_session->removeProject(m_currentProject);
|
||||||
updateActions();
|
updateActions();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user