Commit 21e1e8c5 authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

Removed undoExecution() and added the default of setting an active control...

Removed undoExecution() and added the default of setting an active control when one control net is imported.
parent f626f22b
Loading
Loading
Loading
Loading
+5 −22
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ namespace Isis {
    m_isSynchronous = false;
    m_list = NULL;
    m_watcher = NULL;
    m_isUndoable = false;

    QAction::setText(tr("Import &Control Networks..."));

@@ -206,32 +207,14 @@ namespace Isis {
    }
    m_status = WorkOrderFinished;
    m_readProgresses.clear();
  }


  /**
   * @brief Deletes the control network
   *
   * This method deletes the control network from the project. This method is was
   * renamed from undoSyncRedo() to undoExecution().
   */
  void ImportControlNetWorkOrder::undoExecution() {
    if (m_list && project()->controls().size() > 0 && m_watcher->isFinished()) {
      // Remove the controls from disk.
      m_list->deleteFromDisk( project() );
      // Remove the controls from the model, which updates the tree view.
      ProjectItem *currentItem =
          project()->directory()->model()->findItemData( QVariant::fromValue(m_list) );
      project()->directory()->model()->removeItem(currentItem);

      foreach (Control *control, *m_list) {
        delete control;
      }
      delete m_list;
    // If one control network was imported, then activeControl() will set the
    // active control to that control network
    if (project()->controls().count() == 1) {
      project()->activeControl();
    }
  }


  /**
   * CreateControlsFunctor constructor
   *
+3 −1
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ namespace Isis {
   *                           Control is created Fixes #5026
   *   @histroy 2017-10-24 Adam Goins - Removed the undoStack() call that occurred when a
   *                           Failed cnet is imported. Fixes #5186
   *   @histroy 2018-06-13 Kaitlyn Lee - Removed undoExecution() because we should not want to undo
   *                           an import. In postExecution(), added the ability to set an active
   *                           control network when one control network is imported.
   */
  class ImportControlNetWorkOrder : public WorkOrder {
      Q_OBJECT
@@ -80,7 +83,6 @@ namespace Isis {
      void execute();

    protected:
      void undoExecution();
      void postExecution();

    private slots: