Wrong case is that the "Detach" action tried to abort all operations. This is a regression, which happens after "Abort previous operation by Edit of Parameter" (5 hours ago).
return anError;
}
+void ModuleBase_IModule::grantedOperationIds(ModuleBase_Operation* theOperation,
+ QStringList& theIds) const
+{
+}
+
ModuleBase_Operation* ModuleBase_IModule::getNewOperation(const std::string& theFeatureId)
{
return new ModuleBase_OperationFeature(theFeatureId.c_str(), this);
//! \return string value\r
virtual QString getFeatureError(const FeaturePtr& theFeature);\r
\r
+ /// Returns list of granted operation indices\r
+ virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;\r
+\r
signals:\r
/// Signal which is emitted when operation is launched\r
void operationLaunched();\r
// the active nested sketch operation should be aborted unconditionally
// the Delete action should be additionally granted for the Sketch operation
// in order to do not abort/commit it
- if (!anOpMgr->canStartOperation(anOpAction->id(), isSketchOp/*granted*/))
+ if (!anOpMgr->canStartOperation(tr("Detach")))
return; // the objects are processed but can not be deleted
anOpMgr->startOperation(anOpAction);
anOpAction = new ModuleBase_OperationAction(anAction->text(), myModule);
bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation);
- if (!anOpMgr->canStartOperation(anOpAction->id(), isSketchOp/*granted*/))
+ if (!anOpMgr->canStartOperation(anOpAction->id()))
return; // the objects are processed but can not be deleted
anOpMgr->startOperation(anOpAction);
if (isNewTransaction) aMgr->finishOperation();
}
+void PartSet_MenuMgr::grantedOperationIds(ModuleBase_Operation* theOperation,
+ QStringList& theIds) const
+{
+ if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
+ theIds.append(tr("Detach"));
+ theIds.append(tr("Auxiliary"));
+ }
+}
+
void PartSet_MenuMgr::onEdit(bool)
{
QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
#include <QList>
#include <QColor>
+class ModuleBase_Operation;
class PartSet_Module;
class QAction;
class QMenu;
/// Activates a PartSet document
void activatePartSet() const;
+ /// Returns list of granted operation indices
+ virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;
+
public slots:
/// Processes the context menu action click
/// \param isChecked a state of toggle if the action is checkable
return anError;
}
+void PartSet_Module::grantedOperationIds(ModuleBase_Operation* theOperation,
+ QStringList& theIds) const
+{
+ myMenuMgr->grantedOperationIds(theOperation, theIds);
+
+ if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+
+ theIds.append(aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text());
+ }
+}
+
void PartSet_Module::activeSelectionModes(QIntList& theModes)
{
theModes.clear();
// the active nested sketch operation should be aborted unconditionally
// the Delete action should be additionally granted for the Sketch operation
// in order to do not abort/commit it
- if (!anOpMgr->canStartOperation(anOpAction->id(), isSketchOp/*granted*/))
+ if (!anOpMgr->canStartOperation(anOpAction->id()))
return true; // the objects are processed but can not be deleted
anOpMgr->startOperation(anOpAction);
//! \return string value
virtual QString getFeatureError(const FeaturePtr& theFeature);
+ /// Returns list of granted operation indices
+ virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;
+
public slots:
/// SLOT, that is called by no more widget signal emitted by property panel
/// Set a specific flag to restart the sketcher operation
ModuleBase_Operation* aPreviousOperation = 0;
while (anIt.hasPrevious()) {
ModuleBase_Operation* anOp = anIt.previous();
- if (anOp->id() == theId) {
- if (anIt.hasPrevious())
- aPreviousOperation = anIt.previous();
- break;
- }
+ if (anOp)
+ isGranted = anOp->isGranted(theId);
}
- if (aPreviousOperation)
- isGranted = aPreviousOperation->isGranted(theId);
-
return isGranted;
}
aMgr->finishOperation();
}
-bool XGUI_OperationMgr::canStartOperation(const QString& theId, const bool isAdditionallyGranted)
+bool XGUI_OperationMgr::canStartOperation(const QString& theId)
{
bool aCanStart = true;
ModuleBase_Operation* aCurrentOp = currentOperation();
if (aCurrentOp) {
- bool aGranted = aCurrentOp->isGranted(theId) || isAdditionallyGranted;
+ bool aGranted = aCurrentOp->isGranted(theId);
// the started operation is granted for the current one,
// e.g. current - Sketch, started - Line
if (aGranted) {
/// Returns whether the operation can be started. Check if there is already started operation and
/// the granted parameter of the launched operation
/// \param theId id of the operation which is going to start
- /// \param isAdditionallyGranted a boolean flag whether the id operation is granted in the previous one
- bool canStartOperation(const QString& theId, const bool isAdditionallyGranted = false);
+ bool canStartOperation(const QString& theId);
/// Aborts the parameter operation if it is current, else abort operations from the stack
/// of operations until the operation is found. All operations upper the parameter one are
else
aGrantedIds = myActionsMgr->nestedCommands(theOperation->id());
+ ModuleBase_IModule* aModule = module();
+ if (aModule)
+ aModule->grantedOperationIds(theOperation, aGrantedIds);
+
aFOperation->setGrantedOperationIds(aGrantedIds);
}