From 2a76e5f85ea434a563f2400fb4348937021ab7be Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Wed, 3 Dec 2008 13:58:40 +0100
Subject: [PATCH] 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.
---
 .../projectexplorer/projectexplorer.cpp       | 33 ++++---------------
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index e04553763a3..c3a3fb3064d 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -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();
 }
-- 
GitLab