Isis 3.0 Programmer Reference
Back | Home
OpenRecentProjectWorkOrder.cpp
Go to the documentation of this file.
1 
24 
25 #include <QCoreApplication>
26 #include <QDebug>
27 #include <QMessageBox>
28 
29 #include "FileName.h"
30 #include "Project.h"
31 
32 namespace Isis {
33 
40  WorkOrder(project) {
41  QAction::setText(tr("Open &Recent Project") );
43  }
44 
45 
52  WorkOrder(other) {
53  }
54 
55 
60 
61  }
62 
63 
69  return new OpenRecentProjectWorkOrder(*this);
70  }
71 
72 
78  bool OpenRecentProjectWorkOrder::isExecutable(QString projectFileName) {
79  FileName fname = projectFileName;
80  if (!fname.fileExists() )
81  return false;
82 
83  return true;
84  }
85 
86 
92  bool success = WorkOrder::execute();
93 
94  // We dislike the progress bar
95  // delete progressBar();
96 
97  // If more than this work order is in the history, don't allow this operation
98  if (success && project()->workOrderHistory().count()) {
99  QMessageBox::critical(NULL, tr("Unable To Open a Project"),
100  tr("If you have modified your current project, you cannot open a new "
101  "project because this is not yet implemented"));
102  success = false;
103  }
104  else if (success) {
105  QString projectName = QAction::text();
106 
107  if (!projectName.isEmpty() ) {
108  project()->open(projectName);
109  }
110  else {
111  success = false;
112  }
113  }
114 
115  return success;
116  }
117 }
The main project for cnetsuite.
Definition: Project.h:105
File name manipulation and expansion.
Definition: FileName.h:111
void open(QString)
Open the project at the given path.
Definition: Project.cpp:838
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1116
This is a child of class WorkOrder which is used for anything that performs an action in a Project...
bool execute()
Attempts to open the recent project.
OpenRecentProjectWorkOrder(Project *project)
Constructor which creates a WorkOrder that will open a recent project.
virtual bool isExecutable(QString projectFileName)
This function determines if the given project file name can be opened.
Parent class for anything that performs an action in Project.
Definition: WorkOrder.h:104
virtual OpenRecentProjectWorkOrder * clone() const
Returns a copy of this OpenRecentProjectWorkOrder instance.
virtual bool execute()
The (child) implementation of this method should prompt the user/gather state by any means necessary...
Definition: WorkOrder.cpp:1078
void setCreatesCleanState(bool createsCleanState)
Declare that this work order is saving the project.
Definition: WorkOrder.cpp:1520

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:25:02