mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 05:37:21 -05:00
Do not allow rename of top surface folder
This commit is contained in:
@@ -51,6 +51,7 @@ CAF_PDM_SOURCE_INIT( RimSurfaceCollection, "SurfaceCollection" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSurfaceCollection::RimSurfaceCollection()
|
||||
: m_isTopLevelFolder( false )
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Surfaces", ":/ReservoirSurfaces16x16.png" );
|
||||
|
||||
@@ -81,7 +82,9 @@ RimSurfaceCollection::~RimSurfaceCollection()
|
||||
void RimSurfaceCollection::setAsTopmostFolder()
|
||||
{
|
||||
m_collectionName.uiCapability()->setUiHidden( true );
|
||||
m_collectionName.xmlCapability()->disableIO();
|
||||
setDeletable( false );
|
||||
m_isTopLevelFolder = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -97,7 +100,10 @@ QString RimSurfaceCollection::collectionName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceCollection::setCollectionName( const QString name )
|
||||
{
|
||||
return m_collectionName.setValue( name );
|
||||
if ( !m_isTopLevelFolder )
|
||||
{
|
||||
m_collectionName.setValue( name );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -105,7 +111,12 @@ void RimSurfaceCollection::setCollectionName( const QString name )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimSurfaceCollection::userDescriptionField()
|
||||
{
|
||||
return &m_collectionName;
|
||||
if ( !m_isTopLevelFolder )
|
||||
{
|
||||
return &m_collectionName;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -81,4 +81,6 @@ private:
|
||||
caf::PdmField<QString> m_collectionName;
|
||||
caf::PdmChildArrayField<RimSurface*> m_surfaces;
|
||||
caf::PdmChildArrayField<RimSurfaceCollection*> m_subCollections;
|
||||
|
||||
bool m_isTopLevelFolder;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user