+
+/*!
+ \brief Switch read only mode for the Object Browser.
+ \param theIsReadOnly if true - read only mode will be turned on
+*/
+void HYDROGUI_DataBrowser::setReadOnly( const bool theIsReadOnly )
+{
+ //TODO: to be reimplemented
+
+ // Enable/disable edit triggers
+ foreach ( QTreeView* aView, findChildren<QTreeView*>() ) {
+ aView->setDragEnabled ( !theIsReadOnly );
+ aView->setEditTriggers ( theIsReadOnly ?
+ QAbstractItemView::NoEditTriggers :
+ QAbstractItemView::DoubleClicked );
+ }
+
+ // Enable/disable rename shortcut
+ QList<QShortcut*> aShortcuts = findChildren<QShortcut*>();
+ QShortcut* aShortcut;
+ foreach( aShortcut, aShortcuts ) {
+ if ( aShortcut->key() == QKeySequence( shortcutKey( RenameShortcut ) ) ) {
+ aShortcut->setEnabled( !theIsReadOnly );
+ }
+ }
+}
+
+void HYDROGUI_DataBrowser::createPopupMenu( QMenu* theMenu )
+{
+ theMenu->clear();
+ DataObjectList aSelection = getSelected();
+ bool isOnlyZones = aSelection.size() > 0;
+ foreach( SUIT_DataObject* anObj, aSelection )
+ {
+ HYDROGUI_DataObject* aHydroObj = dynamic_cast<HYDROGUI_DataObject*>( anObj );
+ if( aHydroObj )
+ {
+ Handle(HYDROData_Entity) aModelObj = aHydroObj->modelObject();
+ if( !aModelObj.IsNull() )
+ {
+ isOnlyZones = aModelObj->GetKind()==KIND_ZONE;
+ if( !isOnlyZones )
+ break;
+ }
+ else
+ {
+ isOnlyZones = false;
+ break;
+ }
+ }
+ else
+ {
+ isOnlyZones = false;
+ break;
+ }
+ }
+
+ if( isOnlyZones )
+ theMenu->addAction( tr( "ZONE_TO_NEW_REGION" ), this, SIGNAL( newRegion() ) );
+}