Salome HOME
IPAL9008
authorasl <asl@opencascade.com>
Wed, 15 Jun 2005 09:12:40 +0000 (09:12 +0000)
committerasl <asl@opencascade.com>
Wed, 15 Jun 2005 09:12:40 +0000 (09:12 +0000)
src/SalomeApp/Makefile.in
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h
src/SalomeApp/SalomeApp_ListView.cxx [new file with mode: 0644]
src/SalomeApp/SalomeApp_ListView.h [new file with mode: 0644]
src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx [new file with mode: 0644]
src/SalomeApp/SalomeApp_StudyPropertiesDlg.h [new file with mode: 0644]
src/SalomeApp/resources/SalomeApp_msg_en.po

index 4b7ec7dd3b543fbd8d11bfb929df875a0b94391d..e40a5df401ffda3797a2f285cda8562f6a2d2d50 100755 (executable)
@@ -28,7 +28,7 @@ EXPORT_HEADERS= SalomeApp.h \
                SalomeApp_ExceptionHandler.h \
                SalomeApp_RootObject.h \
                SalomeApp_SelectionMgr.h \
-                SalomeApp_EventFilter.h \
+               SalomeApp_EventFilter.h \
                SalomeApp_PreferencesDlg.h \
                SalomeApp_Tools.h \
                SalomeApp_NameDlg.h \
@@ -37,7 +37,8 @@ EXPORT_HEADERS= SalomeApp.h \
                SalomeApp_Selection.h \
                SalomeApp_Filter.h \
                SalomeApp_TypeFilter.h \
-               SalomeApp_OBFilter.h            
+               SalomeApp_OBFilter.h \
+               SalomeApp_StudyPropertiesDlg.h
 
 # .po files to transform in .qm
 PO_FILES = SalomeApp_images.po \
@@ -60,7 +61,7 @@ LIB_SRC= SalomeApp_AboutDlg.cxx \
         SalomeApp_WidgetContainer.cxx \
         SalomeApp_ExceptionHandler.cxx \
         SalomeApp_SelectionMgr.cxx \
-         SalomeApp_EventFilter.cxx \
+        SalomeApp_EventFilter.cxx \
         SalomeApp_PreferencesDlg.cxx \
         SalomeApp_PyInterp.cxx \
         SalomeApp_Tools.cxx \
@@ -71,7 +72,9 @@ LIB_SRC= SalomeApp_AboutDlg.cxx \
         SalomeApp_Selection.cxx \
         SalomeApp_Filter.cxx \
         SalomeApp_TypeFilter.cxx \
-        SalomeApp_OBFilter.cxx
+        SalomeApp_OBFilter.cxx \
+        SalomeApp_StudyPropertiesDlg.cxx \
+        SalomeApp_ListView.cxx
 
 LIB_MOC = SalomeApp_AboutDlg.h \
           SalomeApp_Application.h \
@@ -82,11 +85,13 @@ LIB_MOC = SalomeApp_AboutDlg.h \
          SalomeApp_GLSelector.h \
          SalomeApp_Module.h \
          SalomeApp_Study.h \
-          SalomeApp_SelectionMgr.h \
+         SalomeApp_SelectionMgr.h \
          SalomeApp_WidgetContainer.h \
          SalomeApp_PreferencesDlg.h \
          SalomeApp_NameDlg.h \
-         SalomeApp_ModuleDlg.h
+         SalomeApp_ModuleDlg.h \
+         SalomeApp_StudyPropertiesDlg.h \
+         SalomeApp_ListView.h
 
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_Exception.idl \
index ffd325319d94928327607c654d29b20ef5045d08..3fee3dfad17184a3239f197a5d41896a186ab56c 100644 (file)
@@ -18,6 +18,7 @@
 #include "SalomeApp_AboutDlg.h"
 #include "SalomeApp_ModuleDlg.h"
 #include "SalomeApp_PreferencesDlg.h"
+#include "SalomeApp_StudyPropertiesDlg.h"
 
 #include "SalomeApp_GLSelector.h"
 #include "SalomeApp_OBSelector.h"
@@ -263,6 +264,12 @@ void SalomeApp_Application::createActions()
                0, desk, false, this, SLOT( onLoadScript() ) );
   int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
   createMenu( LoadScriptId, fileMenu, 10, -1 );
+
+  createAction( PropertiesId, tr( "TOT_DESK_FILE_PROPERTIES" ), QIconSet(),
+               tr( "MEN_DESK_FILE_PROPERTIES" ), tr( "PRP_DESK_FILE_PROPERTIES" ),
+               0, desk, false, this, SLOT( onProperties() ) );
+  createMenu( PropertiesId, fileMenu, 10, -1 );
+
   
   // default icon for neutral point ('SALOME' module)
   QPixmap defIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ) );
@@ -531,6 +538,10 @@ void SalomeApp_Application::updateCommandsStatus()
   QAction* a = action( LoadScriptId );
   if ( a )
     a->setEnabled( activeStudy() );
+  
+  a = action( PropertiesId );
+  if( a )
+    a->setEnabled( activeStudy() );
 }
 
 //=======================================================================
@@ -1092,3 +1103,22 @@ void SalomeApp_Application::activateWindows()
       itr.data()->activate( activeStudy()->id() );
   }
 }
+
+void SalomeApp_Application::onProperties()
+{
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+  if( !study )
+    return;
+
+  _PTR(StudyBuilder) SB = study->studyDS()->NewBuilder();
+  SB->NewCommand();
+
+  SalomeApp_StudyPropertiesDlg aDlg( desktop() );
+  int res = aDlg.exec();
+  if( res==QDialog::Accepted && aDlg.isChanged() )
+    SB->CommitCommand();
+  else
+    SB->AbortCommand();
+
+  //study->updateCaptions();
+}
index 6a7170acc78a49d4fb375564bf224c88cadda17d..e1d83d2b8c6969e83380c090c0917d35415f4458 100644 (file)
@@ -53,7 +53,7 @@ public:
   typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
 
   enum { ModulesListId = STD_Application::UserID, NewGLViewId,
-         NewPlot2dId, NewOCCViewId, NewVTKViewId, LoadScriptId, UserID };
+         NewPlot2dId, NewOCCViewId, NewVTKViewId, LoadScriptId, PropertiesId, UserID };
 
 public:
   SalomeApp_Application();
@@ -136,6 +136,7 @@ private slots:
   void                                onStudyClosed( SUIT_Study* );
   
   void                                onLoadScript(); 
+  void                                onProperties();
 
 private:
   void                                updateWindows();
diff --git a/src/SalomeApp/SalomeApp_ListView.cxx b/src/SalomeApp/SalomeApp_ListView.cxx
new file mode 100644 (file)
index 0000000..af9b7c5
--- /dev/null
@@ -0,0 +1,1498 @@
+//  SALOME SalomeApp 
+//
+//  Copyright (C) 2005  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : SalomeApp_ListView.cxx
+//  Author : Vadim SANDLER
+//  Module : SALOME
+//  $Header$
+
+#include "SalomeApp_ListView.h"
+#include "SalomeApp_Application.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include <qheader.h>
+#include <qvalidator.h>
+#include <qapplication.h>
+#include <qtoolbutton.h>
+
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
+
+#include "utilities.h"
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////
+// SalomeApp_ListView class implementation
+//////////////////////////////////////////////////////////////////////
+
+//================================================================
+// Function : computeEditGeometry
+// Purpose  : static function - used for resizing editing widget
+//================================================================
+void computeEditGeometry(SalomeApp_ListViewItem* theItem,
+                         SalomeApp_EntityEdit*   theWidget)  
+{
+  if (!theItem)
+    return;
+  QListView* aListView = theItem->listView();
+  int anEditColumn = theItem->getEditedColumn();
+  if (anEditColumn < 0)
+    return;
+  
+  int aX = 0, aY = 0, aW = 0, aH = 0;
+
+  QRect aRect = aListView->itemRect(theItem);
+  aListView->contentsToViewport(aListView->header()->sectionPos(anEditColumn), 0, aX, aY);
+  if (aX < 0)
+    aX = 0; // THIS CAN BE REMOVED
+  QSize aSize = theWidget->getControl()->sizeHint();
+  aH = QMAX(aSize.height() , aRect.height() );
+  aY = aRect.y() - ((aH - aRect.height()) / 2);
+  //aW = aListView->columnWidth(anEditColumn); // CAN SUBSTITUTE NEXT 3 ROWS
+  aW = aListView->viewport()->width() - aX;
+  if (aW < 0)
+    aW = 0;
+  theWidget->setGeometry(aX, aY, aW, aH);
+}
+
+//================================================================
+// Function : SalomeApp_ListView::SalomeApp_ListView
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListView::SalomeApp_ListView(QWidget *parent) :
+QListView(parent) 
+{
+  myMouseEnabled = true;
+  myEditingEnabled = false;
+  setSelectionMode(Single);
+  setSorting(-1);
+  setRootIsDecorated(false);
+  setAllColumnsShowFocus(false);
+//  header()->setClickEnabled(false);
+  header()->setMovingEnabled(false);
+
+  myEditedItem = 0;
+  myEdit = 0;
+
+  viewport()->installEventFilter(this);
+
+  connect(this, SIGNAL(selectionChanged()), 
+         this, SLOT(onSelectionChanged()));
+  connect(header(), SIGNAL(sizeChange(int, int, int)), 
+         this,     SLOT(onHeaderSizeChange(int, int, int)));
+}
+
+//================================================================
+// Function : SalomeApp_ListView::~SalomeApp_ListView
+// Purpose  : destructor
+//================================================================
+SalomeApp_ListView::~SalomeApp_ListView() 
+{
+  if (myEdit) {
+    delete myEdit;
+  }
+  myEdit = 0;
+  myEditedItem = 0;
+}
+
+//================================================================
+// Function : SalomeApp_ListView::updateViewer
+// Purpose  : updates all data viewer
+//================================================================
+void SalomeApp_ListView::updateViewer() 
+{
+  // temporary disconnecting selection changed SIGNAL
+  blockSignals(true);
+  SalomeApp_ListViewItem* aRoot = (SalomeApp_ListViewItem*)firstChild();
+  if (aRoot)
+    aRoot->updateAllLevels();
+  updateContents();
+  // connecting again selection changed SIGNAL
+  blockSignals(false);
+  emit selectionChanged();
+}
+
+//================================================================
+// Function : SalomeApp_ListView::updateSelected
+// Purpose  : updates currently selected item(s)
+//================================================================
+void SalomeApp_ListView::updateSelected() 
+{
+  // temporary disconnecting selection changed SIGNAL
+  blockSignals(true);
+  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)selectedItem();
+  if (aChild)
+    aChild->updateAllLevels();
+  updateContents();
+  // connecting again selection changed SIGNAL
+  blockSignals(false);
+  emit selectionChanged();
+}
+
+//================================================================
+// Function : SalomeApp_ListView::popupClientType
+// Purpose  : returns popup client type
+//================================================================
+QString SalomeApp_ListView::popupClientType() const
+{
+  return "SalomeApp_ListView";
+}
+
+//================================================================
+// Function : SalomeApp_ListView::contextMenuPopup
+// Purpose  : fills popup menu with items
+//================================================================
+void SalomeApp_ListView::contextMenuPopup( QPopupMenu* aPopup ) 
+{
+  if (aPopup) {
+    // add items here...
+  }
+}
+
+//================================================================
+// Function : SalomeApp_ListView::clear
+// Purpose  : clears view
+//================================================================
+void SalomeApp_ListView::clear() 
+{
+  if (myEdit) {
+    delete myEdit;
+    myEdit = 0;
+    myEditedItem = 0;
+  }
+  QListView::clear();
+}
+
+//================================================================
+// Function : SalomeApp_ListView::isMouseEnabled
+// Purpose  : returms true if mouse events are enabled
+//================================================================
+bool SalomeApp_ListView::isMouseEnabled() 
+{
+  return myMouseEnabled;
+}
+
+//================================================================
+// Function : SalomeApp_ListView::enableMouse
+// Purpose  : enabled/disables mouse events (excluding MouseMove)
+//================================================================
+void SalomeApp_ListView::enableMouse(bool enable) 
+{
+  myMouseEnabled = enable;
+}
+
+//================================================================
+// Function : SalomeApp_ListView::eventFilter
+// Purpose  : event filter
+//================================================================
+bool SalomeApp_ListView::eventFilter(QObject* object, QEvent* event) 
+{
+  if (object == viewport() &&
+       (event->type() == QEvent::MouseButtonPress   ||
+        event->type() == QEvent::MouseButtonRelease ||
+        event->type() == QEvent::MouseButtonDblClick)  &&
+      !isMouseEnabled())
+    return true;
+  else
+    return QListView::eventFilter(object, event);
+}
+
+//================================================================
+// Function : SalomeApp_ListView::enableEditing
+// Purpose  : setting editing of items availbale/not available
+//================================================================
+void SalomeApp_ListView::enableEditing(bool theFlag) 
+{
+  myEditingEnabled = theFlag;
+  if (!myEditingEnabled) {
+    if (myEdit) {
+      delete myEdit;
+      myEdit = 0;
+      myEditedItem = 0;
+    }
+  }
+}
+
+//================================================================
+// Function : SalomeApp_ListView::isEnableEditing
+// Purpose  : says if editing is enabled
+//================================================================
+bool SalomeApp_ListView::isEnableEditing() 
+{
+  return myEditingEnabled;
+}
+
+//================================================================
+// Function : SalomeApp_ListView::accept
+// Purpose  : calls finishEditing(true)...
+//================================================================
+void SalomeApp_ListView::accept() 
+{
+  finishEditing(true);
+}
+
+//================================================================
+// Function : QAD_ListView::onSelectionChanged
+// Purpose  : slot, called when selection changed in List Viewer
+//================================================================
+void SalomeApp_ListView::onSelectionChanged() 
+{
+  if (myEdit) {
+    finishEditing(true);
+    delete myEdit;
+    myEdit = 0;
+    if (myEditedItem && !myEditedItem->isAccepted()) {
+      delete myEditedItem;
+      updateContents();
+    }
+    myEditedItem = 0;
+  } 
+  // editing is allowed in Single Selection Mode only
+  if (selectionMode() != Single || !isEnableEditing())
+    return;
+  SalomeApp_ListViewItem* anItem = (SalomeApp_ListViewItem*)selectedItem();
+  if (anItem) {
+    if (!anItem->isEditable())
+      return;
+    myEdit = anItem->startEditing();
+    if (myEdit) {
+      connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditOk()));
+      connect(myEdit, SIGNAL(escapePressed()), this, SLOT(onEditCancel()));
+      myEditedItem = anItem;
+      myEdit->show();
+      myEdit->setFocus();
+    }
+  }
+}
+
+//================================================================
+// Function : SalomeApp_ListView::resizeEvent
+// Purpose  : called when Data Viewer is resized
+//================================================================
+void SalomeApp_ListView::resizeEvent( QResizeEvent * e) 
+{
+  QListView::resizeEvent(e);
+  int aW = columnWidth(columns()-1);
+  int aX = header()->sectionPos(columns()-1);
+  if (aW < width() - frameWidth() * 2 - aX - 1)
+    setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
+  updateContents();
+}
+
+//================================================================
+// Function : SalomeApp_ListView::onHeaderSizeChange
+// Purpose  : slot, called when columns sizes are changed
+//================================================================
+void SalomeApp_ListView::onHeaderSizeChange(int, int, int) 
+{
+  int aW = columnWidth(columns()-1);
+  int aX = header()->sectionPos(columns()-1);
+  if (aW < width() - frameWidth() * 2 - aX - 1)
+    setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
+}
+
+//================================================================
+// Function : SalomeApp_ListView::viewportPaintEvent
+// Purpose  : handler for paint event
+//================================================================
+void SalomeApp_ListView::viewportPaintEvent(QPaintEvent* e) 
+{
+  QListView::viewportPaintEvent(e);
+  if (myEditedItem && myEdit) {
+    computeEditGeometry(myEditedItem, myEdit);
+  }
+}
+
+//================================================================
+// Function : SalomeApp_ListView::onEditOk
+// Purpose  : called when user finishes in editing of item
+//================================================================
+void SalomeApp_ListView::onEditOk() 
+{
+  finishEditing(true);
+}
+  
+//================================================================
+// Function : SalomeApp_ListView::onEditCancel
+// Purpose  : called when user cancels item editing
+//================================================================
+void SalomeApp_ListView::onEditCancel() 
+{
+  finishEditing(false);
+}
+
+//================================================================
+// Function : SalomeApp_ListView::finishEditing
+// Purpose  : finishes editing of entity
+//================================================================
+UpdateType SalomeApp_ListView::finishEditing(bool ok) 
+{
+  UpdateType aNeedsUpdate = utCancel;
+  if (myEditedItem && myEdit)
+  {
+    disconnect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditOk()));
+    disconnect(myEdit, SIGNAL(escapePressed()), this, SLOT(onEditCancel()));
+    myEditedItem->setAccepted(true);
+    if (ok) {
+      aNeedsUpdate = myEditedItem->finishEditing(myEdit);
+      if (aNeedsUpdate == utCancel) {
+       // something to do here on Cancel...
+      }
+      else {
+       // something to do here on OK...
+      }
+      // updating contents
+      switch (aNeedsUpdate) {
+      case utUpdateItem:
+        {
+          if (myEditedItem)
+            myEditedItem->updateAllLevels();
+          break;
+        }
+      case utUpdateParent:
+        {
+          if (myEditedItem) {
+            SalomeApp_ListViewItem* aParent = (SalomeApp_ListViewItem*)(myEditedItem->parent());
+            if (aParent)
+              aParent->updateAllLevels();
+            else 
+              myEditedItem->updateAllLevels();
+          }
+          break;
+        }
+      case utUpdateViewer:
+        {
+          updateViewer();
+          break;
+        }
+      case utUpdateAll:
+        {
+          // doing the same as for utUpdateViewer here
+          // descendants can add extra processing
+          updateViewer();
+          break;
+        }
+      default:
+        break;
+      }
+    }
+  }
+
+  // hide <myEdit> widget
+  if (myEdit) {
+    myEdit->hide();
+  }
+
+  return aNeedsUpdate;
+}
+
+//================================================================
+// Function : SalomeApp_ListView::tip
+// Purpose  : gets current tooltip for list view
+//            returns valid rect in success
+//================================================================
+QRect SalomeApp_ListView::tip(QPoint aPos, 
+                       QString& aText, 
+                       QRect& dspRect, 
+                       QFont& dspFnt) const 
+{
+  QRect result( -1, -1, -1, -1 );
+  SalomeApp_ListViewItem* aItem = (SalomeApp_ListViewItem*)itemAt( aPos );
+  if ( aItem ) {
+    for (int i = 0; i < columns(); i++) {
+      QRect aItemRect = aItem->itemRect(i);
+      QRect aTextRect = aItem->textRect(i);
+      if ( !aItem->text(i).isEmpty() &&
+          ( aItemRect.width()  > header()->sectionSize(i) ||
+            aTextRect.left()   < 0 || 
+             aTextRect.top()    < 0 ||
+             aTextRect.right()  > viewport()->width() ||
+             aTextRect.bottom() > viewport()->height() ) ) {
+        // calculating tip data
+        aText   = aItem->tipText();
+       dspRect = aItem->tipRect();
+       dspFnt  = font();
+        if (dspRect.isValid()) {
+          result  = QRect(QPoint(0, aItemRect.top()), 
+                          QSize(viewport()->width(), aItemRect.height()));
+        }
+      }
+    }
+  }
+  return result;
+}
+
+//////////////////////////////////////////////////////////////////////
+// SalomeApp_ListViewItem Class Implementation
+//////////////////////////////////////////////////////////////////////
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent) :
+QListViewItem( parent ) 
+{
+  init();
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
+                                  SalomeApp_ListViewItem* after) :
+QListViewItem( parent, after ) 
+{
+  init();
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
+                                  const QString&    theName,
+                                  const bool        theEditable) :
+QListViewItem(parent, theName) 
+{
+  init();
+  setEditable(theEditable);
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
+                                  const QString&    theName,
+                                  const QString&    theValue,
+                                  const bool        theEditable) :
+QListViewItem(parent, theName, theValue) 
+{
+  init();
+  setEditable(theEditable);
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
+                                  const QString&    theName,
+                                  const bool        theEditable) :
+QListViewItem(parent, theName)
+{
+  init();
+  setEditable(theEditable);
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
+                                  SalomeApp_ListViewItem* after, 
+                                  const QString&    theName,
+                                  const bool        theEditable) :
+QListViewItem(parent, after, theName)
+{
+  init();
+  setEditable(theEditable);
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
+                                  SalomeApp_ListViewItem* after, 
+                                  const QString&    theName,
+                                  const bool        theEditable) :
+QListViewItem(parent, after, theName)
+{
+  init();
+  setEditable(theEditable);
+}
+
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
+                                  const QString&    theName,
+                                  const QString&    theValue,
+                                  const bool        theEditable) :
+QListViewItem(parent, theName, theValue)
+{
+  init();
+  setEditable(theEditable);
+}
+
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, 
+                                  SalomeApp_ListViewItem* after, 
+                                  const QString&    theName,
+                                  const QString&    theValue,
+                                  const bool        theEditable) :
+QListViewItem(parent, after, theName, theValue)
+{
+  init();
+  setEditable(theEditable);
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
+// Purpose  : constructor
+//================================================================
+SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView*     parent, 
+                                  SalomeApp_ListViewItem* after, 
+                                  const QString&    theName,
+                                  const QString&    theValue,
+                                  const bool        theEditable) :
+QListViewItem(parent, after, theName, theValue)
+{
+  init();
+  setEditable(theEditable);
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::~SalomeApp_ListViewItem
+// Purpose  : destructor
+//================================================================
+SalomeApp_ListViewItem::~SalomeApp_ListViewItem() 
+{
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::init
+// Purpose  : initialization
+//================================================================
+void SalomeApp_ListViewItem::init() 
+{
+  myEditable    = false;
+  myAccepted    = true;
+  myEditingType = (int)SalomeApp_EntityEdit::etLineEdit;
+  myValueType   = (int)SalomeApp_EntityEdit::vtString;
+  myButtons     = 0;
+  myUserType    = -1;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getName
+// Purpose  : as default returns text in the first column
+//================================================================
+QString SalomeApp_ListViewItem::getName() const 
+{
+  return ( listView()->columns() > 0 ) ? text(0) : QString("");
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::setName
+// Purpose  : as default sets text in the first column
+//================================================================
+UpdateType SalomeApp_ListViewItem::setName(const QString& theName) 
+{
+  UpdateType aNeedsUpdate = utCancel;
+  if (listView()->columns() > 0) {
+    setText(0, theName);
+    aNeedsUpdate = utNone;
+  }
+  return aNeedsUpdate;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getValue
+// Purpose  : as default returns text in the second column
+//================================================================
+QString SalomeApp_ListViewItem::getValue() const 
+{
+  return ( listView()->columns() > 1 ) ? text(1) : QString("");
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::setValue
+// Purpose  : as default sets text in the second column
+//================================================================
+UpdateType SalomeApp_ListViewItem::setValue(const QString& theValue) 
+{
+  UpdateType aNeedsUpdate = utCancel;
+  if (listView()->columns() > 1) {
+    setText(1, theValue);
+    aNeedsUpdate = utNone;
+  }
+  return aNeedsUpdate;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::fullName
+// Purpose  : returns full path to the entity from the root
+//================================================================
+QString SalomeApp_ListViewItem::fullName() 
+{
+  QString aFullName = getName();
+  SalomeApp_ListViewItem* aParent = (SalomeApp_ListViewItem*)parent();
+  while(aParent != NULL) {
+    aFullName = aParent->getName() + QString(".") + aFullName;
+    aParent = (SalomeApp_ListViewItem*)(aParent->parent());
+  }
+  return aFullName;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::openAllLevels
+// Purpose  : expands all entities beginning from this level
+//================================================================
+void SalomeApp_ListViewItem::openAllLevels() 
+{
+  setOpen(true);
+  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
+  while( aChild ) {
+    aChild->openAllLevels();
+    aChild = (SalomeApp_ListViewItem*)(aChild->nextSibling());
+  }
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::updateAllLevels
+// Purpose  : update all entites beginning from this level
+//================================================================
+void SalomeApp_ListViewItem::updateAllLevels() 
+{
+  SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
+  while( aChild ) {
+    aChild->updateAllLevels();
+    aChild = (SalomeApp_ListViewItem*)(aChild->nextSibling());
+  }
+}
+
+//================================================================
+// Function : SalomeApp_EditBox::isEditable
+// Purpose  : return true if entity is editable
+//================================================================
+bool SalomeApp_ListViewItem::isEditable() const 
+{
+  return myEditable;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::setEditable
+// Purpose  : sets editable flag fo the entity
+//================================================================
+void SalomeApp_ListViewItem::setEditable(bool theEditable) 
+{
+  myEditable = theEditable;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::isAccepted
+// Purpose  : returns true if entitiy is accepted after editing
+//================================================================
+bool SalomeApp_ListViewItem::isAccepted() const 
+{
+  return myAccepted;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::setAccepted
+// Purpose  : set entitiy accepted or not after editing
+//================================================================
+void SalomeApp_ListViewItem::setAccepted(bool theAccepted) 
+{
+  myAccepted = theAccepted;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getEditingType
+// Purpose  : returns type of edit control (0 - edit box, 1 - combo box, 
+//            2 - editable combo box),  default is edit box
+//================================================================
+int SalomeApp_ListViewItem::getEditingType() 
+{
+  return myEditingType;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::setEditingType
+// Purpose  : sets type of edit control (0 - edit box, 1 - combo box, 
+//            2 - editable combo box), negative value means none
+//================================================================
+void SalomeApp_ListViewItem::setEditingType(const int type) 
+{
+  myEditingType = type;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getEditedColumn
+// Purpose  : returns edited column, default is last column
+//            negative value means there are no editable columns
+//================================================================
+int SalomeApp_ListViewItem::getEditedColumn() 
+{
+  return listView()->columns()-1;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getValueType
+// Purpose  : returns type of edited value (string, int, double)
+//            default is string
+//================================================================
+int SalomeApp_ListViewItem::getValueType() 
+{
+  return myValueType;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::setValueType
+// Purpose  : sets type of edited value
+//================================================================
+void SalomeApp_ListViewItem::setValueType(const int valueType) 
+{
+  myValueType = valueType;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getUserType
+// Purpose  : sets type of edited value
+//================================================================
+int SalomeApp_ListViewItem::getUserType() 
+{
+  return myUserType;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::setUserType
+// Purpose  : sets type of edited value
+//================================================================
+void SalomeApp_ListViewItem::setUserType(const int userType) 
+{
+  myUserType = userType;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getButtons
+// Purpose  : returns buttons for editing widget (Apply (V), Cancel (X))
+//            default is both buttons
+//================================================================
+int SalomeApp_ListViewItem::getButtons() 
+{
+  return myButtons;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::getButtons
+// Purpose  : sets buttons for editing widget (Apply (V), Cancel (X))
+//================================================================
+void SalomeApp_ListViewItem::setButtons(const int buttons) 
+{
+  myButtons = buttons;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::startEditing
+// Purpose  : creates control for editing and fills it with values
+//================================================================
+SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing() 
+{
+  SalomeApp_EntityEdit* aWidget = 0;
+  QListView* aListView = listView();
+  if (aListView) {
+    if (!isEditable())
+      return 0;
+    int anEditType   = getEditingType();
+    int aValueType   = getValueType();
+    int aButtons     = getButtons();
+    int anEditColumn = getEditedColumn();
+    if (anEditColumn < 0 || anEditType < 0)
+      return 0;
+    aWidget = new SalomeApp_EntityEdit(aListView->viewport(), 
+                                 anEditType, 
+                                aValueType, 
+                                aButtons & SalomeApp_EntityEdit::btApply,
+                                aButtons & SalomeApp_EntityEdit::btCancel);
+    computeEditGeometry(this, aWidget);
+
+    fillWidgetWithValues(aWidget);
+  }
+  return aWidget;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::fillWidgetWithValues
+// Purpose  : fills widget with initial values (list or single value)
+//================================================================
+void SalomeApp_ListViewItem::fillWidgetWithValues(SalomeApp_EntityEdit* theWidget) 
+{
+  int anEditColumn = getEditedColumn();
+  if (theWidget && anEditColumn >= 0 && !text(anEditColumn).isEmpty())
+    theWidget->insertItem(text(anEditColumn), true);
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::finishEditing
+// Purpose  : finishes editing of entity
+//================================================================
+UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget) 
+{
+  UpdateType aNeedsUpdate = utCancel;
+  try {
+    if (theWidget) {
+      int anEditColumn = getEditedColumn();
+      switch (anEditColumn) {
+      case 0:
+        aNeedsUpdate = setName(theWidget->getText());
+        break;
+      case 1:
+        aNeedsUpdate = setValue(theWidget->getText());
+        break;
+      default: 
+        break;
+      }
+    } 
+  }
+  catch (...) {
+    MESSAGE( "System error has been caught - SalomeApp_ListViewItem::finishEditing" )
+  }
+  return aNeedsUpdate;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::tipRect
+// Purpose  : calculates rectangle which should contain item's tip
+//================================================================
+QRect SalomeApp_ListViewItem::tipRect() 
+{
+  QRect aRect = QRect(-1, -1, -1, -1);
+  QRect aItemRect = listView()->itemRect(this);
+  if ( !aItemRect.isValid() )
+    return aItemRect;
+
+  QString aTip = tipText();
+  if (!aTip.isEmpty()) {
+    QRect aRect0 = textRect(0);
+    QFont aFont(listView()->font());
+    QFontMetrics fm(aFont);
+    int iw = fm.width(aTip);
+    aRect = QRect(QPoint(aRect0.x() < 0 ? 0 : aRect0.x(), 
+                         aRect0.y()), 
+                  QSize (iw,         
+                         aRect0.height()));
+  }
+  return aRect;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::tipText
+// Purpose  : returns text for tooltip
+//================================================================
+QString SalomeApp_ListViewItem::tipText() 
+{
+  QString aText = getName();
+  if (!getValue().isEmpty())
+    aText += QString(" : ") + getValue();
+  return aText;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::textRect
+// Purpose  : calculates rect of item text in viewport coordinates
+//================================================================
+QRect SalomeApp_ListViewItem::textRect(const int column) const
+{
+  QRect aItemRect = listView()->itemRect( this );
+  if ( !aItemRect.isValid() )
+    return aItemRect;
+  
+  QFont aFont(listView()->font());
+  QFontMetrics fm(aFont);
+  
+  int decorWidth  = ( listView()->rootIsDecorated() ) ? 
+                    ( listView()->treeStepSize() * (depth() + 1) ) :
+                    ( listView()->treeStepSize() *  depth() );
+  int pixmapWidth = ( pixmap(column) ) ? 
+                      pixmap(column)->width() +  listView()->itemMargin() * 2 : 
+                      listView()->itemMargin();
+  int prevWidth = 0;
+  for (int i = 0; i < column; i++)
+    prevWidth += listView()->header()->sectionSize(i);
+  int ix = prevWidth   +
+           pixmapWidth + 
+           ((column == 0) ? decorWidth : 0);
+  int iy = aItemRect.y();
+  int iw = fm.width(text(column));
+  int ih = aItemRect.height();
+  if (pixmap(column)) {
+    iy += listView()->itemMargin();
+    ih -= listView()->itemMargin() * 2;
+  }
+  ix -= listView()->contentsX();
+
+  QRect theResult(QPoint(ix, iy), QSize(iw, ih));
+  return theResult;
+}
+
+//================================================================
+// Function : SalomeApp_ListViewItem::itemRect
+// Purpose  : calculates rect of item data in viewport coordinates
+//================================================================
+QRect SalomeApp_ListViewItem::itemRect(const int column) const
+{
+  QRect aItemRect = listView()->itemRect( this );
+  if ( !aItemRect.isValid() )
+    return aItemRect;
+  
+  QFont aFont(listView()->font());
+  QFontMetrics fm(aFont);
+  
+  int decorWidth  = ( listView()->rootIsDecorated() ) ? 
+                    ( listView()->treeStepSize() * (depth() + 1) ) :
+                    ( listView()->treeStepSize() *  depth() );
+  int pixmapWidth = ( pixmap(column) ) ? 
+                      pixmap(column)->width() +  listView()->itemMargin() * 2 : 
+                      0;
+  int prevWidth = 0;
+  for (int i = 0; i < column; i++)
+    prevWidth += listView()->header()->sectionSize(i);
+  int ix = prevWidth;
+  int iy = aItemRect.y();
+  int iw = pixmapWidth + 
+           listView()->itemMargin() * 2 + 
+           ((column == 0) ? decorWidth : 0) + 
+           fm.width(text(column));
+  int ih = aItemRect.height();
+  ix -= listView()->contentsX();
+
+  QRect theResult(QPoint(ix, iy), QSize(iw, ih));
+  return theResult;
+}
+
+//////////////////////////////////////////////////////////////////////
+// SalomeApp_EditBox class implementation
+//////////////////////////////////////////////////////////////////////
+
+//================================================================
+// Function : SalomeApp_EditBox::SalomeApp_EditBox
+// Purpose  : constructor
+//================================================================
+SalomeApp_EditBox::SalomeApp_EditBox(QWidget* parent) :
+QLineEdit(parent) 
+{
+}
+
+//================================================================
+// Function : SalomeApp_EditBox::keyPressEvent
+// Purpose  : event filter for key pressing
+//================================================================
+void SalomeApp_EditBox::keyPressEvent( QKeyEvent *e ) 
+{
+  if ( e->key() == Key_Escape )
+    emit escapePressed();
+  else
+    QLineEdit::keyPressEvent( e );
+  e->accept();
+}
+
+//////////////////////////////////////////////////////////////////////
+// SalomeApp_ComboBox class implementation
+//////////////////////////////////////////////////////////////////////
+
+//================================================================
+// Function : SalomeApp_ComboBox::SalomeApp_ComboBox
+// Purpose  : constructor
+//================================================================
+SalomeApp_ComboBox::SalomeApp_ComboBox(bool rw, QWidget* parent, const char* name) :
+QComboBox(rw, parent, name) 
+{
+}
+
+//================================================================
+// Function : SalomeApp_ComboBox::findItem
+// Purpose  : searches item in list and returns its index
+//================================================================
+int SalomeApp_ComboBox::findItem(const QString& theText) 
+{
+  for (int i = 0; i < count(); i++) 
+    if (text(i) == theText)
+      return i;
+  return -1;
+}
+
+//================================================================
+// Function : SalomeApp_ComboBox::insertItem
+// Purpose  : adds item in combo box
+//================================================================
+void SalomeApp_ComboBox::insertItem(const QString& theValue,
+                             int            theIndex) 
+{
+  if (duplicatesEnabled() || findItem(theValue) < 0)
+    QComboBox::insertItem(theValue, theIndex);
+}
+
+//================================================================
+// Function : SalomeApp_ComboBox::insertList
+// Purpose  : adds list of items in combo box
+//================================================================
+void SalomeApp_ComboBox::insertList(const QStringList& theList) 
+{
+  for (unsigned i = 0; i < theList.count(); i++)
+    insertItem(theList[i]);
+}
+
+//================================================================
+// Function : SalomeApp_ComboBox::insertItem
+// Purpose  : adds item in combo box
+//================================================================
+void SalomeApp_ComboBox::insertItem(const int theValue) 
+{
+  int aNum;
+  bool bOk;
+  for (int i = 0; i < count(); i++) {
+    aNum = text(i).toInt(&bOk);
+    if (bOk) {
+      if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
+        insertItem(QString::number(theValue), i);
+        return;
+      }
+    }
+  }
+  insertItem(QString::number(theValue));
+}
+
+//================================================================
+// Function : SalomeApp_ComboBox::insertList
+// Purpose  : adds list of items in combo box
+//================================================================
+void SalomeApp_ComboBox::insertList(const TColStd_ListOfInteger& theList) 
+{
+  for (TColStd_ListIteratorOfListOfInteger aIter(theList); aIter.More(); aIter.Next())
+    insertItem(aIter.Value());
+}
+
+//================================================================
+// Function : SalomeApp_ComboBox::insertItem
+// Purpose  : adds item in combo box
+//================================================================
+void SalomeApp_ComboBox::insertItem(const double theValue) 
+{
+  double aNum;
+  bool bOk;
+  for (int i = 0; i < count(); i++) {
+    aNum = text(i).toDouble(&bOk);
+    if (bOk) {
+      if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
+        insertItem(QString::number(theValue), i);
+        return;
+      }
+    }
+  }
+  insertItem(QString::number(theValue));
+}
+
+//================================================================
+// Function : SalomeApp_ComboBox::insertList
+// Purpose  : adds list of items in combo box
+//================================================================
+void SalomeApp_ComboBox::insertList(const TColStd_ListOfReal& theList) 
+{
+  for (TColStd_ListIteratorOfListOfReal aIter(theList); aIter.More(); aIter.Next())
+    insertItem(aIter.Value());
+}
+
+//////////////////////////////////////////////////////////////////////
+// SalomeApp_EntityEdit class implementation
+//////////////////////////////////////////////////////////////////////
+
+#include <qlayout.h>
+
+#define MIN_COMBO_WIDTH     1
+#define MIN_EDIT_WIDTH      1
+
+//================================================================
+// Function : SalomeApp_EntityEdit::SalomeApp_EntityEdit
+// Purpose  : constructor
+//================================================================
+SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent, 
+                              int      controlType,
+                              int      valueType,
+                              bool     butApply, 
+                              bool     butCancel) :
+QWidget(parent),
+myEdit(0),
+myCombo(0),
+myApplyBtn(0),
+myCancelBtn(0) 
+{
+  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  SUIT_ResourceMgr* mgr = app ? app->resourceMgr() : NULL;
+
+  QHBoxLayout* aTopLayout = new QHBoxLayout(this);
+  aTopLayout->setAlignment( Qt::AlignTop );
+  aTopLayout->setSpacing( 0 );
+  aTopLayout->setMargin( 1 );
+  if (controlType != etLineEdit && 
+      controlType != etComboBox && 
+      controlType != etComboEdit)
+    controlType = etLineEdit;
+  if (controlType == etComboBox || controlType == etComboEdit) {
+    // this is an editable combo box
+    myCombo = new SalomeApp_ComboBox(controlType == etComboEdit, this);
+    myCombo->setMinimumSize(MIN_COMBO_WIDTH, 0);
+    myCombo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
+                                       QSizePolicy::Fixed));
+    // no insertions
+    myCombo->setInsertionPolicy(QComboBox::NoInsertion);
+    // no duplicates enabled by default
+    myCombo->setDuplicatesEnabled(false);
+    aTopLayout->addWidget(myCombo);
+    // connect signals
+    connect(myCombo, SIGNAL(activated(const QString&)), this, SLOT(onComboActivated(const QString&)));
+    connect(myCombo, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));
+  }
+  else {
+    // and this is an edit box
+    myEdit = new SalomeApp_EditBox(this);
+    myEdit->setMinimumSize(MIN_EDIT_WIDTH, 0);
+    myEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
+                                      QSizePolicy::Fixed));
+    aTopLayout->addWidget(myEdit);
+    connect(myEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));
+    connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onApply()));
+    connect(myEdit, SIGNAL(escapePressed()), this, SLOT(onCancel()));
+  }
+  if (valueType != vtString && 
+      valueType != vtInteger && 
+      valueType != vtDouble)
+    valueType = vtString;
+  if (valueType == vtInteger)
+    setValidator(new QIntValidator(this));
+  else if (valueType == vtDouble)
+    setValidator(new QDoubleValidator(this));
+  if (butApply) {
+    // Apply button (V)
+    myApplyBtn = new QToolButton(this);
+    
+    QPixmap anIcon;
+    if( mgr )
+      anIcon = mgr->loadPixmap( "STD", tr( "ICON_APPLY" ) );
+
+    myApplyBtn->setPixmap(anIcon);
+    myApplyBtn->setEnabled(false);
+    myApplyBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+    myApplyBtn->setMinimumSize(16, 16);
+    myApplyBtn->setMaximumSize(16, 20);
+    aTopLayout->addWidget(myApplyBtn);
+    connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
+  }
+  if (butCancel) {
+    // Cancel button (X)
+    myCancelBtn = new QToolButton(this);
+    QPixmap anIcon;
+    if( mgr )
+      anIcon = mgr->loadPixmap( "STD", tr( "ICON_CANCEL" ) );
+    myCancelBtn->setPixmap(anIcon);
+    myCancelBtn->setEnabled(false);
+    myCancelBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+    myCancelBtn->setMinimumSize(16, 16);
+    myCancelBtn->setMaximumSize(16, 20);
+    aTopLayout->addWidget(myCancelBtn);
+    connect(myCancelBtn, SIGNAL(clicked()), this, SLOT(onCancel()));
+  }
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::~SalomeApp_EntityEdit
+// Purpose  : destructor
+//================================================================
+SalomeApp_EntityEdit::~SalomeApp_EntityEdit() 
+{
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::clear
+// Purpose  : clears edit/combo box
+//================================================================
+void SalomeApp_EntityEdit::clear() 
+{
+  if (myEdit)
+    myEdit->clear();
+  if (myCombo)
+    myCombo->clear();
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::getText
+// Purpose  : returns current text in edit box or combo box
+//================================================================
+QString SalomeApp_EntityEdit::getText() 
+{
+  if (myEdit)
+    return myEdit->text();
+  else if (myCombo)
+    return myCombo->currentText();
+  else
+    return "";
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::setText
+// Purpose  : sets text
+//================================================================
+void SalomeApp_EntityEdit::setText(const QString& theText) 
+{
+  myString = theText;
+  if (myEdit)
+    myEdit->setText(theText);
+  if (myCombo) {
+    int aFound = myCombo->findItem(theText);
+    if (aFound >= 0) {
+      myCombo->setCurrentItem(aFound);
+      onTextChanged(theText);
+    }
+  }
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::insertItem
+// Purpose  : adds item in combo box, 
+//            sets it current if theSetCurrent is true
+//================================================================
+void SalomeApp_EntityEdit::insertItem(const QString& theValue, 
+                               bool           theSetCurrent,
+                               int            theOrder) 
+{
+  if (myCombo) {
+    int aIndexAt = -1;
+    if (theOrder == atTop)
+      aIndexAt = 0;
+    else if (theOrder == atBeforeCurrent && myCombo->count() > 0)
+      aIndexAt = myCombo->currentItem();
+    else if (theOrder == atAfterCurrent && 
+             myCombo->count() > 0 && 
+             myCombo->currentItem() < myCombo->count()-1)
+      aIndexAt = myCombo->currentItem() + 1;
+    myCombo->insertItem(theValue, aIndexAt);
+  }
+  if (theSetCurrent)
+    setText(theValue);
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::insertList
+// Purpose  : adds items in combo box, 
+//            sets item theCurrent as current
+//================================================================
+void SalomeApp_EntityEdit::insertList(const QStringList& theList, 
+                               const int          theCurrent) 
+{
+  if (myCombo)
+    myCombo->insertList(theList);
+  if (theCurrent >= 0 && theCurrent < (int)theList.count())
+    setText(theList[theCurrent]);
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::insertItem
+// Purpose  : adds item in combo box, 
+//            sets it current if theSetCurrent is true
+//================================================================
+void SalomeApp_EntityEdit::insertItem(const int theValue, 
+                               bool      theSetCurrent) 
+{
+  if (myCombo) {
+    myCombo->insertItem(theValue);
+  }
+  if (theSetCurrent)
+    setText(QString::number(theValue));
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::insertList
+// Purpose  : adds items in combo box, 
+//            sets item theCurrent as current
+//================================================================
+void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList, 
+                               const int                    theCurrent) 
+{
+  if (myCombo)
+    myCombo->insertList(theList);
+
+  TColStd_ListIteratorOfListOfInteger aIter(theList);
+  for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
+    if (theCurrent == i) {
+      setText(QString::number(aIter.Value()));
+      break;
+    }
+  }
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::insertItem
+// Purpose  : adds item in combo box, 
+//            sets it current if theSetCurrent is true
+//================================================================
+void SalomeApp_EntityEdit::insertItem(const double theValue, 
+                               bool         theSetCurrent) 
+{
+  if (myCombo) {
+    myCombo->insertItem(theValue);
+  }
+  if (theSetCurrent)
+    setText(QString::number(theValue));
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::insertList
+// Purpose  : adds items in combo box, 
+//            sets item theCurrent as current
+//================================================================
+void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList, 
+                               const int                 theCurrent) 
+{
+  if (myCombo)
+    myCombo->insertList(theList);
+  
+  TColStd_ListIteratorOfListOfReal aIter(theList);
+  for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
+    if (theCurrent == i) {
+      setText(QString::number(aIter.Value()));
+      break;
+    }
+  }
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::getControl
+// Purpose  : gets actual widget
+//================================================================
+QWidget* SalomeApp_EntityEdit::getControl() 
+{
+  if (myEdit)
+    return myEdit;
+  else if (myCombo)
+    return myCombo;
+  else
+    return 0;
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::setFocus
+// Purpose  : redirect focus to corresponding widget
+//================================================================
+void SalomeApp_EntityEdit::setFocus() 
+{
+  if (myEdit) {
+    myEdit->setFocus();
+    //myEdit->selectAll();
+  }
+  else if (myCombo && myCombo->editable()) {
+    myCombo->setFocus();
+    //myCombo->lineEdit()->selectAll();
+  }
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::setValidator
+// Purpose  : sets validator for the control
+//================================================================
+void SalomeApp_EntityEdit::setValidator(const QValidator* theValidator) 
+{
+  if (myEdit)
+    myEdit->setValidator(theValidator);
+  if (myCombo)
+    myCombo->setValidator(theValidator);
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::keyPressEvent
+// Purpose  : event filter for KeyPress event
+//================================================================
+void SalomeApp_EntityEdit::keyPressEvent( QKeyEvent * e) 
+{
+  if ( (e->key() == Key_Enter ||
+        e->key() == Key_Return ) )
+    onApply();
+  else if (e->key() == Key_Escape)
+    onCancel();
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::onComboActivated
+// Purpose  : called when item activated in combo box
+//================================================================
+void SalomeApp_EntityEdit::onComboActivated(const QString& theText) 
+{
+  onTextChanged(theText);
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::onTextChanged
+// Purpose  : slot, called when text changed in line edit
+//================================================================
+void SalomeApp_EntityEdit::onTextChanged(const QString& theText) 
+{
+  if (myApplyBtn)
+    myApplyBtn->setEnabled(!(theText == myString));
+  if (myCancelBtn)
+    myCancelBtn->setEnabled(!(theText == myString));
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::onCancel
+// Purpose  : slot, called when user presses Cancel button
+//================================================================
+void SalomeApp_EntityEdit::onCancel() 
+{
+  setText(myString);
+  if (myApplyBtn)
+    myApplyBtn->setEnabled(false);
+  if (myCancelBtn)
+    myCancelBtn->setEnabled(false);
+  emit escapePressed();
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::onApply
+// Purpose  : slot, called when user presses Apply button
+//================================================================
+void SalomeApp_EntityEdit::onApply() 
+{
+  myString = getText();
+  if (myApplyBtn)
+    myApplyBtn->setEnabled(false);
+  if (myCancelBtn)
+    myCancelBtn->setEnabled(false);
+  emit returnPressed();
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::showButtons
+// Purpose  : shows/hides buttons
+//================================================================
+void SalomeApp_EntityEdit::showButtons(bool show) 
+{
+  if (myApplyBtn)
+    show ? myApplyBtn->show()  : myApplyBtn->hide();
+  if (myCancelBtn)
+    show ? myCancelBtn->show() : myCancelBtn->hide();
+}
+
+//================================================================
+// Function : SalomeApp_EntityEdit::setDuplicatesEnabled
+// Purpose  : enables/disables data duplication (for combo box)
+//================================================================
+void SalomeApp_EntityEdit::setDuplicatesEnabled(bool enabled)
+{
+  if (myCombo)
+    myCombo->setDuplicatesEnabled(enabled);
+}
diff --git a/src/SalomeApp/SalomeApp_ListView.h b/src/SalomeApp/SalomeApp_ListView.h
new file mode 100644 (file)
index 0000000..89c7cbc
--- /dev/null
@@ -0,0 +1,340 @@
+//  SALOME SalomeApp
+//
+//  Copyright (C) 2005  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : SalomeApp_ListView.h
+//  Author : Vadim SANDLER
+//  Module : SALOME
+//  $Header$
+
+#ifndef SALOMEAPP_LISTVIEW_H
+#define SALOMEAPP_LISTVIEW_H
+
+#include <qlistview.h>
+#include <qlist.h>
+#include <qstring.h>
+#include <qpixmap.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+
+//VRV: porting on Qt 3.0.5
+#if QT_VERSION >= 0x030005
+#include <qtoolbutton.h> 
+#endif
+//VRV: porting on Qt 3.0.5
+
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListOfReal.hxx>
+
+#include <SUIT_PopupClient.h>
+
+// enumeration for ListView updating mode
+enum UpdateType {
+  utCancel        = -1,           // cancel updating
+  utNone          =  0,           // needs no any update
+  utUpdateItem,                   // update one item
+  utUpdateParent,                 // update parent item too
+  utUpdateViewer,                 // update all viewer
+  utUpdateAll                     // strong update
+};
+
+class SalomeApp_ListViewItem;
+class SalomeApp_EntityEdit;
+
+//================================================================
+// Class        : SalomeApp_ListView
+// Description  : parent class for Data Viewer and Properties Viewer
+//================================================================
+class SalomeApp_ListView : public QListView , public SUIT_PopupClient  {
+  
+  Q_OBJECT
+    
+public:
+// constructor  
+  SalomeApp_ListView(QWidget *parent);
+// destructor  
+  virtual ~SalomeApp_ListView();
+
+// updates list viewer
+  virtual void updateViewer();
+// updtes currently selected item(s)
+  virtual void updateSelected();
+
+// fills popup with items
+  virtual QString popupClientType() const;
+  virtual void    contextMenuPopup( QPopupMenu* );
+
+// setting editing of items availbale/not available
+  void enableEditing(bool theFlag);
+// says if editing is enabled
+  bool isEnableEditing();
+// accepts user input by calling finishEditing(true)
+  void accept();
+
+// clears view
+  void clear();
+
+// event filter
+  bool eventFilter(QObject* object, QEvent* event) ;
+
+// gets current tooltip for list view
+// returns valid rect in success
+  QRect tip(QPoint aPos, QString& aText, QRect& dspRect, QFont& dspFnt) const;
+
+protected:
+// handler for resize event
+  void resizeEvent(QResizeEvent* e);
+// handler for paint event
+  void viewportPaintEvent(QPaintEvent* e);
+// finishes editing of entity
+  virtual UpdateType finishEditing(bool ok);
+
+// returns true if mouse events are enabled
+  bool isMouseEnabled();
+// enables/disables mouse events (excluding MouseMove)
+  void enableMouse(bool enable);
+  
+protected slots:
+// called when selection changed in list
+  virtual void onSelectionChanged();
+// called when user finishes in editing of item
+  void onEditOk();
+// called when user cancels item editing
+  void onEditCancel();
+// called when columns sizes are changed
+  void onHeaderSizeChange(int, int, int);
+
+protected:
+  SalomeApp_EntityEdit*   myEdit;
+  SalomeApp_ListViewItem* myEditedItem;
+  bool                    myEditingEnabled;
+  bool                    myMouseEnabled;
+};
+
+
+class SalomeApp_EditBox: public QLineEdit
+{
+  Q_OBJECT
+
+public:
+  SalomeApp_EditBox(QWidget* parent);
+protected:
+  void keyPressEvent(QKeyEvent* e);
+  
+signals:
+  void escapePressed();
+};
+
+class SalomeApp_ComboBox: public QComboBox 
+{
+  Q_OBJECT
+
+public:
+  SalomeApp_ComboBox(bool rw, QWidget* parent = 0, const char* name = 0);
+
+  int findItem(const QString& theText);
+  void insertItem(const QString& theValue, int theIndex = -1);
+  void insertList(const QStringList& theList);
+  void insertItem(const int theValue);
+  void insertList(const TColStd_ListOfInteger& theList);
+  void insertItem(const double theValue);
+  void insertList(const TColStd_ListOfReal& theList);
+};
+
+class SalomeApp_EntityEdit : public QWidget 
+{
+  Q_OBJECT
+
+public:
+  // enum for edit control type
+  enum {
+    etLineEdit,           // simple edit box
+    etComboBox,           // non-editable combo box
+    etComboEdit           // editable combo box
+  };
+  // enum for value type
+  enum {
+    vtString,             // string
+    vtInteger,            // integer value
+    vtDouble              // double value
+  };
+  // enum for insertion order
+  enum {
+    atBottom,
+    atTop,
+    atBeforeCurrent,
+    atAfterCurrent
+  };
+  // enum for edit box buttons (Apply = Cancel)
+  enum {
+    btApply  = 0x0001,
+    btCancel = 0x0002
+  };
+
+public:
+  SalomeApp_EntityEdit( QWidget* parent, 
+                       int      controlType = etLineEdit, 
+                       int      valueType   = vtString,
+                       bool     butApply    = false, 
+                       bool     butCancel   = false);
+  ~SalomeApp_EntityEdit();
+
+  void finishEditing();
+  void clear();
+  QString getText();
+  void setText(const QString& theText );
+  void insertItem( const QString& theValue, 
+                  bool           theSetCurrent = false,
+                  int            theOrder = atBottom );
+  void insertList( const QStringList& theList, 
+                  const int          theCurrent = -1 );
+  void insertItem( const int theValue, 
+                  bool  theSetCurrent = false );
+  void insertList( const TColStd_ListOfInteger& theList, 
+                  const int                    theCurrent = -1 );
+  void insertItem( const double theValue, 
+                  bool         theSetCurrent = false );
+  void insertList( const TColStd_ListOfReal& theList, 
+                  const int                 theCurrent = -1 );
+  QWidget* getControl();
+  void setFocus();
+  void setValidator(const QValidator*);
+  void showButtons(bool show);
+  void setDuplicatesEnabled(bool enabled);
+
+protected:
+  void keyPressEvent ( QKeyEvent * e);
+
+private slots:
+  void onComboActivated(const QString&);
+  void onTextChanged(const QString&);
+  void onApply();
+  void onCancel();
+signals:
+  void returnPressed();
+  void escapePressed();
+
+private:
+  // Widgets
+  SalomeApp_EditBox*   myEdit;
+  SalomeApp_ComboBox*  myCombo;
+  QToolButton*         myApplyBtn;
+  QToolButton*         myCancelBtn;
+  QString              myString;
+};
+
+class SalomeApp_ListViewItem : public QListViewItem
+{
+public:
+  SalomeApp_ListViewItem( SalomeApp_ListView* );
+  SalomeApp_ListViewItem( SalomeApp_ListView*, 
+                         SalomeApp_ListViewItem* );
+  SalomeApp_ListViewItem( SalomeApp_ListView*,
+                         const QString&,
+                         const bool = false );
+  SalomeApp_ListViewItem( SalomeApp_ListView*,
+                         const QString& theName,
+                         const QString& theValue, 
+                         const bool = false );
+  SalomeApp_ListViewItem( SalomeApp_ListViewItem* theParent,
+                         const QString&,
+                         const bool = false );
+  SalomeApp_ListViewItem( SalomeApp_ListView*,
+                         SalomeApp_ListViewItem*,
+                         const QString&,
+                         const bool = false );
+  SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
+                         SalomeApp_ListViewItem*,
+                         const QString&,
+                         const bool = false);
+  SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
+                         const QString& theName,
+                         const QString& theValue, 
+                         const bool = false);
+  SalomeApp_ListViewItem( SalomeApp_ListView*,
+                         SalomeApp_ListViewItem*,
+                         const QString& theName,
+                         const QString& theValue, 
+                         const bool = false);
+  SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
+                         SalomeApp_ListViewItem*,
+                         const QString&,
+                         const QString&, 
+                         const bool = false);
+  ~SalomeApp_ListViewItem();
+
+  QString            fullName();
+  void               openAllLevels();
+  virtual void       updateAllLevels();
+  bool               isEditable() const;
+  void               setEditable(bool theEditable);
+
+  // returns true if entitiy is accepted after editing
+  bool               isAccepted() const;
+  // set entity accepted or not after editing
+  void               setAccepted(bool theAccepted);
+
+  // returns name of entity (as default it is text in first column)
+  virtual QString    getName() const;
+  // sets name of entity (as default it is text in first column)
+  virtual UpdateType setName(const QString& theName);
+
+  // returns value of entity (as default it is text in second column)
+  virtual QString    getValue() const;
+  // sets value of entity (as default it is text in second column)
+  virtual UpdateType setValue(const QString& theValue);
+
+  // creates control for editing and fills it with values
+  SalomeApp_EntityEdit*    startEditing();
+  // fills widget with initial values (list or single value)
+  virtual void       fillWidgetWithValues(SalomeApp_EntityEdit* theWidget);
+  // finishes editing of entity
+  virtual UpdateType finishEditing(SalomeApp_EntityEdit* theWidget);
+
+  // returns type of edit control (0 - edit box, 1 - combo box, 2 - editable combo box)
+  virtual int        getEditingType();
+  // sets type of edit control (0 - edit box, 1 - combo box, 2 - editable combo box)
+  virtual void       setEditingType(const int);
+  // returns edited column
+  virtual int        getEditedColumn();
+  // returns type of edited value (string, int, double)
+  virtual int        getValueType();
+  // sets type of edited value (string, int, double)
+  virtual void       setValueType(const int);
+
+  // gets user type 
+  virtual int        getUserType();
+  // sets user type 
+  virtual void       setUserType(const int);
+
+  // returns buttons for editing widget
+  virtual int        getButtons();
+  // sets  buttons for editing widget
+  virtual void       setButtons(const int);
+  // returns text for tooltip
+  QString            tipText();
+  // calculates rectangle which should contain items tip
+  QRect              tipRect();
+  // calculates rect of item text in viewport coordinates
+  QRect              textRect(const int column) const;
+  // calculates full rect of item data in viewport coordinates
+  QRect              itemRect(const int column) const;
+
+protected:
+  // initialization
+  void               init();
+
+private:
+  bool myEditable;
+  bool myAccepted;
+  int  myEditingType;
+  int  myValueType;
+  int  myButtons;
+  int  myUserType; // user are welcome to put additional data here and use it in fillWidgetWithValues()
+};
+
+
+#endif
diff --git a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx b/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx
new file mode 100644 (file)
index 0000000..89c042e
--- /dev/null
@@ -0,0 +1,296 @@
+//  SALOME SalomeApp
+//
+//  Copyright (C) 2005  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : SalomeApp_StudyPropertiesDlg.cxx
+//  Author : Sergey ANIKIN
+//  Module : SALOME
+//  $Header$
+
+#include "SalomeApp_StudyPropertiesDlg.h"
+#include "SalomeApp_ListView.h"
+#include "SalomeApp_Study.h"
+
+#include "SUIT_Session.h"
+
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include <qpushbutton.h>
+#include <qlayout.h>
+using namespace std;
+
+#define  DEFAULT_MARGIN 11
+#define DEFAULT_SPACING 6
+#define     SPACER_SIZE 5
+#define MIN_LIST_WIDTH  300
+#define MIN_LIST_HEIGHT 150
+
+class SalomeApp_PropItem : public SalomeApp_ListViewItem
+{
+public:
+// constructor  
+  SalomeApp_PropItem(SalomeApp_ListView* parent,
+                    const QString       theName,
+                    const bool          theEditable,
+                    const int           theUserType) :
+  SalomeApp_ListViewItem( parent, theName, theEditable )
+  {
+    setUserType(theUserType);
+  }
+// constructor
+  SalomeApp_PropItem(SalomeApp_ListView*     parent,
+                    SalomeApp_ListViewItem* after,
+                    const QString     theName,
+                    const bool        theEditable,
+                    const int         theUserType) :
+  SalomeApp_ListViewItem( parent, after, theName, theEditable )
+  {
+    setUserType(theUserType);
+  }
+// fills widget with initial values (list or single value)
+  void fillWidgetWithValues( SalomeApp_EntityEdit* theWidget )
+  {
+    QStringList list;
+    switch(getUserType()) {
+    case SalomeApp_StudyPropertiesDlg::prpModeId:
+      {
+       list << QObject::tr("PRP_MODE_FROM_SCRATCH") << 
+               QObject::tr("PRP_MODE_FROM_COPYFROM");
+       theWidget->insertList(list);
+       break;
+      }
+    case SalomeApp_StudyPropertiesDlg::prpLockedId:
+      {
+       list << QObject::tr("PRP_NO") << QObject::tr("PRP_YES");
+       theWidget->insertList(list, getValue() == QObject::tr("PRP_NO") ? 0 : 1);    
+       break;
+      }
+    case SalomeApp_StudyPropertiesDlg::prpModificationsId:
+      {
+       SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+       if (study) { 
+         _PTR(Study) studyDoc = study->studyDS();
+         _PTR(AttributeStudyProperties) propAttr;
+         if ( studyDoc ) {
+           propAttr = studyDoc->GetProperties();
+           if ( propAttr ) {
+             std::vector<std::string> aUsers;
+             std::vector<int>  aMins, aHours, aDays, aMonths, aYears;
+             propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false);
+             int aCnt = aUsers.size();
+             for ( int i = 0; i < aCnt; i++ ) {
+               QString val;
+               val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d", 
+                           aDays  [i], 
+                           aMonths[i], 
+                           aYears [i], 
+                           aHours [i], 
+                           aMins  [i]);
+               val = val + " : " + QString(aUsers[i]);
+               list.prepend(val);
+             }
+             theWidget->setDuplicatesEnabled(true);
+             theWidget->insertList(list);    
+           }
+         }
+       }
+       break;
+      }
+    default:
+      {
+       SalomeApp_ListViewItem::fillWidgetWithValues(theWidget);
+       break;
+      }
+    }
+  }
+// finishes editing of entity
+  virtual UpdateType finishEditing( SalomeApp_EntityEdit* theWidget ) {
+    if ( getUserType() == SalomeApp_StudyPropertiesDlg::prpModificationsId )
+      return utCancel;
+    else
+      return SalomeApp_ListViewItem::finishEditing(theWidget);
+  }
+};
+
+SalomeApp_StudyPropertiesDlg::SalomeApp_StudyPropertiesDlg(QWidget* parent)
+     : QDialog(parent, "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+       myChanged( false )
+{
+  setCaption(tr("TLT_STUDY_PROPERTIES"));
+  setSizeGripEnabled( true );
+
+  clearWFlags(Qt::WStyle_ContextHelp);
+
+  QGridLayout* mainLayout = new QGridLayout(this);
+  mainLayout->setMargin(DEFAULT_MARGIN);
+  mainLayout->setSpacing(DEFAULT_SPACING);
+  
+  myPropList = new SalomeApp_ListView(this);
+  myPropList->addColumn("");
+  myPropList->addColumn("");
+  myPropList->enableEditing(TRUE);
+  myPropList->setMinimumSize(MIN_LIST_WIDTH, MIN_LIST_HEIGHT);
+  mainLayout->addMultiCellWidget(myPropList, 0, 0, 0, 2);
+
+  myOKBtn = new QPushButton(tr("BUT_OK"), this);
+  mainLayout->addWidget(myOKBtn, 1, 0);
+
+  myCancelBtn = new QPushButton(tr("BUT_CANCEL"), this);
+  mainLayout->addWidget(myCancelBtn, 1, 2);
+
+  QSpacerItem* spacer1 = new QSpacerItem(SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum);
+  mainLayout->addItem(spacer1, 1, 1);
+
+  // Display study properties
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+  if (study)
+    myStudyDoc = study->studyDS();
+
+  initData();
+
+  connect(myOKBtn,     SIGNAL(clicked()), this, SLOT(onOK()));
+  connect(myCancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+SalomeApp_StudyPropertiesDlg::~SalomeApp_StudyPropertiesDlg()
+{
+}
+
+void SalomeApp_StudyPropertiesDlg::initData()
+{
+  bool hasData = myStudyDoc;
+  _PTR(AttributeStudyProperties) propAttr;
+  if (hasData) 
+    propAttr = myStudyDoc->GetProperties();
+  hasData = hasData && propAttr;
+
+  // Study author's name
+  SalomeApp_PropItem* item = new SalomeApp_PropItem(myPropList, tr("PRP_AUTHOR")+":", true, prpAuthorId);
+  if (hasData)
+    item->setValue(propAttr->GetUserName());
+
+  // Date of creation
+  item = new SalomeApp_PropItem(myPropList, item, tr("PRP_DATE")+":", false, prpDateId);
+  if (hasData) {
+    int minutes, hours, day, month, year;
+    if (propAttr->GetCreationDate(minutes, hours, day, month, year)) {
+      QString strDate;
+      strDate.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d", day, month, year, hours, minutes);
+      item->setValue(strDate);
+    }
+  }
+  
+  // Creation mode
+//  item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODE")+":", true, prpModeId);
+//  item->setEditingType( SalomeApp_EntityEdit::etComboBox);
+//  if (hasData) item->setValue(propAttr->GetCreationMode());
+
+  // Locked or not
+  item = new SalomeApp_PropItem(myPropList, item, tr("PRP_LOCKED")+":", true, prpLockedId);
+  item->setEditingType( SalomeApp_EntityEdit::etComboBox);  
+  if (hasData) (propAttr->IsLocked()) ? item->setValue(tr("PRP_YES")) : item->setValue(tr("PRP_NO"));
+
+  // Saved or not
+  item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODIFIED")+":", false, prpSavedId);
+  if (hasData) {
+    if (propAttr->IsModified())
+      item->setValue(tr("PRP_YES"));
+    else
+      item->setValue(tr("PRP_NO"));
+  }
+
+  // Modifications list
+  item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODIFICATIONS")+":", true, prpModificationsId); 
+  item->setEditingType( SalomeApp_EntityEdit::etComboBox);  
+  if (hasData) { 
+    std::vector<std::string> aUsers;
+    std::vector<int> aMins, aHours, aDays, aMonths, aYears;
+    propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false);
+    int aLast = aUsers.size()-1;
+    if (aLast >= 0) {
+      QString val;
+      val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d", 
+                 aDays  [aLast], 
+                 aMonths[aLast], 
+                 aYears [aLast], 
+                 aHours [aLast], 
+                 aMins  [aLast]);
+      val = val + " : " + QString(aUsers[aUsers.size()-1]);
+      item->setValue(val);
+    }
+  }
+
+  myOKBtn->setEnabled(hasData);
+}
+
+bool SalomeApp_StudyPropertiesDlg::acceptData()
+{
+  return TRUE;
+}
+
+void SalomeApp_StudyPropertiesDlg::onOK()
+{
+  myPropList->accept();
+
+  if (acceptData()) {
+    _PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties();
+    myChanged = propChanged();
+    if ( propAttr && myChanged ) {
+      QListViewItemIterator it( myPropList );
+      // iterate through all items of the listview
+      for ( ; it.current(); ++it ) {
+       SalomeApp_PropItem* item = (SalomeApp_PropItem*)(it.current());
+       switch (item->getUserType()) {
+       case prpAuthorId:
+         propAttr->SetUserName(item->getValue().stripWhiteSpace().latin1());
+         break;
+       case prpModeId:
+         propAttr->SetCreationMode(item->getValue().stripWhiteSpace().latin1());
+         break;
+       case prpLockedId:
+         propAttr->SetLocked(item->getValue().compare(tr("PRP_YES")) == 0);
+         break;
+       default:
+         break;
+       }
+      }
+    }
+    accept();
+  }
+}
+
+bool SalomeApp_StudyPropertiesDlg::propChanged() {
+  _PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties();
+  if ( propAttr ) {
+    QListViewItemIterator it( myPropList );
+    // iterate through all items of the listview
+    for ( ; it.current(); ++it ) {
+      SalomeApp_PropItem* item = (SalomeApp_PropItem*)(it.current());
+      switch (item->getUserType()) {
+      case prpAuthorId:
+       if ( QString( propAttr->GetUserName() ) != item->getValue().stripWhiteSpace() ) {
+         return true;
+       }
+       break;
+      case prpModeId:
+       if ( QString( propAttr->GetCreationMode() ) != item->getValue().stripWhiteSpace() ) {
+         return true;
+        }
+       break;
+      case prpLockedId:
+       {
+         bool bLocked = item->getValue().compare( tr( "PRP_YES" ) ) == 0;
+         if ( propAttr->IsLocked() != bLocked ) {
+           return true;
+         }
+         break;
+       }
+      default:
+       break;
+      }
+    }
+  }
+  return false;
+}
diff --git a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.h b/src/SalomeApp/SalomeApp_StudyPropertiesDlg.h
new file mode 100644 (file)
index 0000000..556a3d3
--- /dev/null
@@ -0,0 +1,69 @@
+//  SALOME SalomeApp
+//
+//  Copyright (C) 2005  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : SalomeApp_StudyPropertiesDlg.h
+//  Author : Sergey ANIKIN
+//  Module : SALOME
+//  $Header$
+
+#ifndef SALOMEAPP_STUDY_PROPERTIES_DLG_H
+#define SALOMEAPP_STUDY_PROPERTIES_DLG_H
+
+#include "SalomeApp.h"
+#include <SALOMEDSClient_definitions.hxx>
+#include <qdialog.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <qlistview.h>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+#include <SALOMEDSClient_Study.hxx>
+
+class SalomeApp_ListView;
+class QPushButton;
+class QToolButton;
+
+class SALOMEAPP_EXPORT SalomeApp_StudyPropertiesDlg : public QDialog
+{ 
+  Q_OBJECT
+
+public:
+  enum {
+    prpAuthorId,
+    prpModeId,
+    prpDateId,
+    prpSavedId,
+    prpLockedId,
+    prpModificationsId,
+    prpLastId
+  };
+
+public:
+  SalomeApp_StudyPropertiesDlg( QWidget* parent = 0 );
+  ~SalomeApp_StudyPropertiesDlg();
+
+  bool isChanged() { return myChanged; } 
+
+public slots:
+  void onOK();
+
+private:
+  void initData(); 
+  bool acceptData(); 
+  bool propChanged(); 
+  
+private:
+  SalomeApp_ListView* myPropList;
+  QPushButton*        myOKBtn;
+  QPushButton*        myCancelBtn;
+  bool                myChanged;  
+
+  _PTR(Study)         myStudyDoc;
+};
+#endif // SALOMEAPP_STUDY_PROPERTIES_DLG_H
index 2fd30fbe56a354b7d6a88e465c6408d852387bab..eca1a8dc84d40696a2ca0b69c23bff1324e24082 100644 (file)
@@ -155,3 +155,49 @@ msgstr "Load script..."
 
 msgid "PRP_DESK_FILE_LOAD_SCRIPT"
 msgstr "Loads python script from file"
+
+msgid "TOT_DESK_FILE_PROPERTIES"
+msgstr "Study properties"
+
+msgid "MEN_DESK_FILE_PROPERTIES"
+msgstr "Properties..."
+
+msgid "PRP_DESK_FILE_PROPERTIES"
+msgstr "Edits study properties"
+
+
+
+## SalomeApp_StudyPropertiesDlg
+msgid "PRP_MODE_FROM_SCRATCH"
+msgstr "from scratch"
+
+msgid "PRP_MODE_FROM_COPYFROM"
+msgstr "copy from"
+
+msgid "PRP_NO"
+msgstr "No"
+
+msgid "PRP_YES"
+msgstr "Yes"
+
+msgid "TLT_STUDY_PROPERTIES"
+msgstr "Study Properties"
+
+msgid "PRP_AUTHOR"
+msgstr "Author"
+
+msgid "PRP_DATE"
+msgstr "Date"
+
+msgid "PRP_MODE"
+msgstr "Mode"
+
+msgid "PRP_LOCKED"
+msgstr "LOCKED"
+
+msgid "PRP_MODIFIED"
+msgstr "MODIFIED"
+
+msgid "PRP_MODIFICATIONS"
+msgstr "Modifications"
+