X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSUIT%2FSUIT_PreferenceMgr.cxx;h=7e5678266611b584318bc981e97110dd7925640a;hb=HEAD;hp=1d08111800e8cfd8d54f494c214145788a4d140c;hpb=c47605c13ccf37a7b3fcb9cb6c8baf38d3643f77;p=modules%2Fgui.git diff --git a/src/SUIT/SUIT_PreferenceMgr.cxx b/src/SUIT/SUIT_PreferenceMgr.cxx old mode 100755 new mode 100644 index 1d0811180..7e5678266 --- a/src/SUIT/SUIT_PreferenceMgr.cxx +++ b/src/SUIT/SUIT_PreferenceMgr.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,7 @@ // Author: Sergey TELKOV // #include "SUIT_PreferenceMgr.h" +#include "SUIT_PagePrefShortcutTreeItem.h" SUIT_PreferenceMgr::SUIT_PreferenceMgr( QtxResourceMgr* resMgr, QWidget* parent ) : QtxPagePrefMgr( resMgr, parent ), @@ -70,23 +71,26 @@ int SUIT_PreferenceMgr::addItem( const QString& title, const int pId, const SUIT_PreferenceMgr::PrefItemType type, const QString& sect, const QString& param ) { - QtxPreferenceItem* parent = pId == -1 ? this : findItem( pId, true ); + QtxPreferenceItem* parent = 0; + if ( pId == -1 ) + { + if ( !myRoot ) + myRoot = new QtxPagePrefListItem( QString( "root" ), this ); + parent = myRoot; + } + else + { + parent = findItem( pId, true ); + } if ( !parent ) return -1; - QtxPreferenceItem* item = parent->findItem( title, true ); + QtxPreferenceItem* item = parent->findItem( title, false ); if ( item && item->depth() < 5 ) return item->id(); - if ( pId == -1 ) - { - if ( !myRoot ) - myRoot = new QtxPagePrefListItem( QString( "root" ), this ); - parent = myRoot; - } - switch( type ) { case Auto: @@ -148,14 +152,14 @@ int SUIT_PreferenceMgr::addItem( const QString& title, const int pId, case File: item = new QtxPagePrefPathItem( Qtx::PT_OpenFile, title, parent, sect, param ); break; + case Directory: + item = new QtxPagePrefPathItem( Qtx::PT_Directory, title, parent, sect, param ); + break; case DirList: item = new QtxPagePrefPathListItem( Qtx::PT_Directory, title, parent, sect, param ); break; - case Shortcut: - item = new QtxPagePrefShortcutBtnsItem( title, parent, sect, param ); - break; case ShortcutTree: - item = new QtxPagePrefShortcutTreeItem( title, parent, sect, param ); + item = new SUIT_PagePrefShortcutTreeItem( parent ); break; case BiColor: item = new QtxPagePrefBiColorItem( title, parent, sect, param ); @@ -171,6 +175,18 @@ int SUIT_PreferenceMgr::addItem( const QString& title, const int pId, return item ? item->id() : -1; } +void SUIT_PreferenceMgr::removeItem( const QString& title ) +{ + if ( myRoot ) + { + QtxPreferenceItem* item = myRoot->findItem( title, false ); + if ( item ) { + QtxPagePrefMgr::removeItem( item ); + delete item; + } + } +} + QVariant SUIT_PreferenceMgr::optionValue( const QString& name ) const { QVariant val = QtxPagePrefMgr::optionValue( name ); @@ -185,3 +201,8 @@ void SUIT_PreferenceMgr::setOptionValue( const QString& name, const QVariant& va if ( myRoot ) myRoot->setOption( name, val ); } + +QtxPreferenceItem* SUIT_PreferenceMgr::root() const +{ + return myRoot; +}