if (anOperation->isModified()) {
int anAnswer = QMessageBox::question(
qApp->activeWindow(), tr("Operation launch"),
- tr("Previous operation is not finished and will be aborted"), QMessageBox::Ok,
+ tr("Previous operation is not finished, abort it?"),
+ QMessageBox::Abort | QMessageBox::Cancel,
QMessageBox::Cancel);
- return anAnswer == QMessageBox::Ok;
+ return anAnswer == QMessageBox::Abort;
}
}
return true;
//******************************************************
void XGUI_Workshop::onOpen()
{
+ if(!myOperationMgr->abortOperation())
+ return;
//save current file before close if modified
- SessionPtr aMgr = ModelAPI_Session::get();
- if (aMgr->isModified()) {
+ SessionPtr aSession = ModelAPI_Session::get();
+ if (aSession->isModified()) {
//TODO(sbh): re-launch the app?
int anAnswer = QMessageBox::question(
myMainWindow, tr("Save current file"),
} else if (anAnswer == QMessageBox::Cancel) {
return;
}
- aMgr->moduleDocument()->close();
+ aSession->moduleDocument()->close();
myCurrentDir = "";
}
return;
}
QApplication::setOverrideCursor(Qt::WaitCursor);
- aMgr->load(myCurrentDir.toLatin1().constData());
+ aSession->load(myCurrentDir.toLatin1().constData());
myObjectBrowser->rebuildDataTree();
displayAllResults();
updateCommandStatus();
//******************************************************
bool XGUI_Workshop::onSave()
{
+ if(!myOperationMgr->abortOperation())
+ return false;
if (myCurrentDir.isEmpty()) {
return onSaveAs();
}
//******************************************************
bool XGUI_Workshop::onSaveAs()
{
+ if(!myOperationMgr->abortOperation())
+ return false;
QFileDialog dialog(mainWindow());
dialog.setWindowTitle(tr("Select directory to save files..."));
dialog.setFileMode(QFileDialog::Directory);