From 2c74e45d0d9d365d17d772c975847d06d00d6acc Mon Sep 17 00:00:00 2001
From: Elliot Oram <Elliot.Oram@stfc.ac.uk>
Date: Wed, 26 Aug 2015 14:23:42 +0100
Subject: [PATCH] Added Save functionality to the Convfit Tab

Refs #12419
---
 .../CustomInterfaces/src/Indirect/ConvFit.cpp   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp
index 7e29c2075e4..e11dfdc2a74 100644
--- a/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp
+++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp
@@ -238,6 +238,10 @@ void ConvFit::run() {
   int maxIterations =
       static_cast<int>(m_dblManager->value(m_properties["MaxIterations"]));
   QString temperature = m_uiForm.leTempCorrection->text();
+  QString plot = m_uiForm.cbPlotType->currentText();
+  const bool save = m_uiForm.ckSave->isChecked();
+
+  // Run ConvolutionFitSequential Algorithm
   auto cfs = AlgorithmManager::Instance().create("ConvolutionFitSequential");
   cfs->setProperty("InputWorkspace", m_cfInputWS->getName());
   cfs->setProperty("Function", function);
@@ -257,6 +261,19 @@ void ConvFit::run() {
                    minimizerString("$outputname_$wsindex").toStdString());
   cfs->setProperty("MaxIterations", maxIterations);
   cfs->execute();
+
+  if (save) {
+    QString saveDir = QString::fromStdString(
+        Mantid::Kernel::ConfigService::Instance().getString(
+            "defaultsave.directory"));
+    // Check validity of save path
+    QString resultWsName =
+        QString::fromStdString(cfs->getProperty("OutputWorkspace"));
+	QString fullPath = saveDir.append(resultWsName).append(".nxs");
+    addSaveWorkspaceToQueue(resultWsName, fullPath);
+	
+  }
+  m_batchAlgoRunner->executeBatchAsync();
   updatePlot();
 }
 
-- 
GitLab