connect(myOperationMgr, SIGNAL(operationStarted()), SLOT(onOperationStarted()));
connect(myOperationMgr, SIGNAL(operationResumed()), SLOT(onOperationStarted()));
connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), SLOT(onOperationStopped(ModuleBase_Operation*)));
+ connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
connect(myOperationMgr, SIGNAL(operationStarted()), myActionsMgr, SLOT(update()));
connect(myOperationMgr, SIGNAL(operationStopped()), myActionsMgr, SLOT(update()));
connect(this, SIGNAL(errorOccurred(const QString&)), myErrorDlg, SLOT(addError(const QString&)));
// Process creation of Part
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_CREATED)) {
const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- FeaturePtr aFeature = aUpdMsg->feature();
- if (aFeature->getKind() == "Part") {
+ std::set<FeaturePtr> aFeatures = aUpdMsg->features();
+
+ std::set<FeaturePtr>::const_iterator aIt;
+ bool aHasPart = false;
+ for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
+ FeaturePtr aFeature = (*aIt);
+ if (aFeature->getKind() == "Part") {
+ aHasPart = true;
+ break;
+ }
+ }
+ if (aHasPart) {
//The created part will be created in Object Browser later and we have to activate it
// only when it is created everywere
QTimer::singleShot(50, this, SLOT(activateLastPart()));
{
const Model_FeatureUpdatedMessage* anUpdateMsg =
dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- FeaturePtr aNewFeature = anUpdateMsg->feature();
+ std::set<FeaturePtr> aFeatures = anUpdateMsg->features();
+
FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature();
- if(aNewFeature == aCurrentFeature) {
- myPropertyPanel->updateContentWidget(aCurrentFeature);
+ std::set<FeaturePtr>::const_iterator aIt;
+ for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
+ FeaturePtr aNewFeature = (*aIt);
+ if(aNewFeature == aCurrentFeature) {
+ myPropertyPanel->updateContentWidget(aCurrentFeature);
+ break;
+ }
}
}
//An operation passed by message. Start it, process and commit.
tr("The document is modified, save before exit?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
if(anAnswer == QMessageBox::Save) {
- onSave();
+ bool saved = onSave();
+ if(!saved) {
+ return;
+ }
} else if (anAnswer == QMessageBox::Cancel) {
return;
}
}
//******************************************************
-void XGUI_Workshop::onSave()
+bool XGUI_Workshop::onSave()
{
if(myCurrentDir.isEmpty()) {
- onSaveAs();
- return;
+ return onSaveAs();
}
saveDocument(myCurrentDir);
updateCommandStatus();
+ return true;
}
//******************************************************
-void XGUI_Workshop::onSaveAs()
+bool XGUI_Workshop::onSaveAs()
{
QFileDialog dialog(mainWindow());
dialog.setWindowTitle(tr("Select directory to save files..."));
dialog.setViewMode(QFileDialog::Detail);
if(!dialog.exec()) {
- return;
+ return false;
}
QString aTempDir = dialog.selectedFiles().first();
QDir aDir(aTempDir);
QString(),
tr("The folder already contains some files, save anyway?"),
QMessageBox::Save|QMessageBox::Cancel);
- if(answer == QMessageBox::Cancel)
- return;
+ if(answer == QMessageBox::Cancel) {
+ return false;
+ }
}
myCurrentDir = aTempDir;
- onSave();
+ return onSave();
}
//******************************************************