Commit b533e94d authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Updated import work orders so that when undone, their items are removed from...

Updated import work orders so that when undone, their items are removed from project tree. Fixes #4597.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce_FY17-Sprint1@7624 41f8697f-d340-4b68-9986-7bafba869bb8
parent 18e93c43
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@
#include "IException.h"
#include "Progress.h"
#include "Project.h"
#include "ProjectItem.h"
#include "ProjectItemModel.h"

namespace Isis {

@@ -173,12 +175,12 @@ namespace Isis {
  void ImportControlNetWorkOrder::undoExecution() {
    if (m_watcher->isFinished()) {
      ControlList *list = project()->controls().last();
      // Remove the controls from disk.
      list->deleteFromDisk(project());
      foreach (Control *control, *list) {
        delete control;
      }
      
      delete list;
      // Remove the controls from the model, which updates the tree view.
      ProjectItem *currentItem =
          project()->directory()->model()->findItemData(QVariant::fromValue(list));
      project()->directory()->model()->removeItem(currentItem);
    }
  }

+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ namespace Isis {
   *                           execute to setupExecution, and renamed postSyncRedo to postExecution
   *                           and undoSyncRedo to undoExecution. This was done to match the 
   *                           WorkOrder redesign. Fixes #4716.
   *   @history 2017-05-01 Ian Humphrey - Updated undoExecution() so when undone, the imported
   *                           cnet(s) are removed from the project tree. Fixes #4597. 
   */
  class ImportControlNetWorkOrder : public WorkOrder {
      Q_OBJECT
+9 −1
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@
#include "CubeAttribute.h"
#include "FileName.h"
#include "Project.h"
#include "ProjectItem.h"
#include "ProjectItemModel.h"
#include "SaveProjectWorkOrder.h"
#include "TextFile.h"

@@ -185,7 +187,13 @@ namespace Isis {
   */
  void ImportImagesWorkOrder::undoExecution() {
    project()->waitForImageReaderFinished();
    project()->images().last()->deleteFromDisk(project());
    ImageList *list = project()->images().last();
    // Remove the images from disk.
    list->deleteFromDisk(project());
    // Remove the images from the model, which updates the tree view.
    ProjectItem *currentItem =
        project()->directory()->model()->findItemData(QVariant::fromValue(list));
    project()->directory()->model()->removeItem(currentItem);
  }


+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ namespace Isis {
   *   @history 2017-04-11 Ian Humphrey - Removed isSynchronous() and instead set inherited member
   *                           m_isSynchronous to false in constructor to indicate this is an
   *                           asynchronous work order. Updated documentation. References #4732.
   *   @history 2017-05-01 Ian Humphrey - Updated undoExecution() so that when undo, imported
   *                           images are removed from the project tree. Fixes #4597.
   */
  class ImportImagesWorkOrder : public WorkOrder {
      Q_OBJECT
+11 −3
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@
#include "CubeAttribute.h"
#include "FileName.h"
#include "Project.h"
#include "ProjectItem.h"
#include "ProjectItemModel.h"
#include "SaveProjectWorkOrder.h"
#include "TextFile.h"

@@ -139,7 +141,13 @@ namespace Isis {
    */
  void ImportShapesWorkOrder::undoExecution() {
    project()->waitForShapeReaderFinished();
    project()->shapes().last()->deleteFromDisk(project());
    ShapeList *list = project()->shapes().last();
    // Remove the shapes from disk.
    list->deleteFromDisk(project());
    // Remove the shapes from the model, which updates the tree view.
    ProjectItem *currentItem =
        project()->directory()->model()->findItemData(QVariant::fromValue(list));
    project()->directory()->model()->removeItem(currentItem);
  }

  /**
Loading