mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 18:18:35 +05:00
Forbid renaming of the objects "in place" by default.
This commit is contained in:
parent
aa5b2185c9
commit
205001b2a0
@ -2179,6 +2179,25 @@ void GeometryGUI::onViewAboutToShow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Check if this object is can't be renamed in place
|
||||||
|
|
||||||
|
This method can be re-implemented in the subclasses.
|
||||||
|
Return true in case if object isn't reference or component (module root).
|
||||||
|
|
||||||
|
\param id column id
|
||||||
|
\return \c true if the item can be renamed by the user in place (e.g. in the Object browser)
|
||||||
|
*/
|
||||||
|
bool GeometryGUI::renameAllowed( const QString& entry) const {
|
||||||
|
|
||||||
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
|
||||||
|
SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
|
||||||
|
|
||||||
|
return (app && appStudy && obj && !appStudy->isComponent(entry) && !obj->isReference());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Rename object by entry.
|
Rename object by entry.
|
||||||
\param entry entry of the object
|
\param entry entry of the object
|
||||||
@ -2187,10 +2206,6 @@ void GeometryGUI::onViewAboutToShow()
|
|||||||
*/
|
*/
|
||||||
bool GeometryGUI::renameObject( const QString& entry, const QString& name) {
|
bool GeometryGUI::renameObject( const QString& entry, const QString& name) {
|
||||||
|
|
||||||
bool appRes = SalomeApp_Module::renameObject(entry,name);
|
|
||||||
if( !appRes )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
|
||||||
@ -2204,6 +2219,12 @@ bool GeometryGUI::renameObject( const QString& entry, const QString& name) {
|
|||||||
if(!aStudy)
|
if(!aStudy)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
|
||||||
|
if ( aLocked ) {
|
||||||
|
SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
_PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) );
|
_PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) );
|
||||||
_PTR(GenericAttribute) anAttr;
|
_PTR(GenericAttribute) anAttr;
|
||||||
if ( obj ) {
|
if ( obj ) {
|
||||||
@ -2220,3 +2241,4 @@ bool GeometryGUI::renameObject( const QString& entry, const QString& name) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ public:
|
|||||||
void ActiveWorkingPlane();
|
void ActiveWorkingPlane();
|
||||||
|
|
||||||
virtual bool renameObject( const QString&, const QString& );
|
virtual bool renameObject( const QString&, const QString& );
|
||||||
|
virtual bool renameAllowed( const QString& ) const;
|
||||||
|
|
||||||
virtual void windows( QMap<int, int>& ) const;
|
virtual void windows( QMap<int, int>& ) const;
|
||||||
virtual void viewManagers( QStringList& ) const;
|
virtual void viewManagers( QStringList& ) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user