Salome HOME
Porting to Qt4 and autotools
[modules/multipr.git] / src / MULTIPRGUI / MULTIPR_GUI.cxx
index 466a8daacb8b0d0bf67227d9e385c2aee81bae5f..d635228860c26ec03a3cff6ceb8321ff5087c1b7 100644 (file)
 #include <SALOME_LifeCycleCORBA.hxx>
 #include <SALOMEDS_Study.hxx>
 
-#include <SALOME_Event.hxx>
+#include <SALOME_Event.h>
 
 #include <QtxPopupMgr.h>
 
 // QT Includes
-#include <qapplication.h>
-#include <qinputdialog.h>
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qgroupbox.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
-#include <qlabel.h>
-#include <qcombobox.h>
-#include <qvariant.h>
-#include <qlineedit.h>
-#include <qspinbox.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qmessagebox.h>
-#include <qaction.h>
-#include <qtimer.h>
-#include <qthread.h>
-
+#include <QApplication>
+#include <QInputDialog>
+#include <QLayout>
+#include <QPushButton>
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QButtonGroup>
+#include <QLabel>
+#include <QComboBox>
+#include <QVariant>
+#include <QLineEdit>
+#include <QSpinBox>
+#include <QToolTip>
+#include <QWhatsThis>
+#include <QImage>
+#include <QPixmap>
+#include <QMessageBox>
+#include <QAction>
+#include <QTimer>
+#include <QThread>
+//#include <QPtrList>
+#include <QListIterator>
 #include <stdexcept>
 
 using namespace std;
 
-
 //*****************************************************************************
 // Global variable
 //*****************************************************************************
@@ -95,10 +95,11 @@ public:
   virtual void Execute()
   {
     if (myIsError) {
-      SUIT_MessageBox::error1(myApp->desktop(),
-                              "Save distributed MED file error", 
-                              "Error while writing distributed MED file", 
-                              myApp->tr("MULTIPR_BUT_OK"));
+      SUIT_MessageBox::critical((QWidget*) MULTIPR_GUI::desktop(),
+                            QObject::tr("SAVE_DISTMED_ERROR"),
+//                           QString("Save distributed MED file error"), 
+                              QObject::tr("WRIT_DISTMED_ERROR"));
+//                            QString("Error while writing distributed MED file"));
     }
     else {
       myApp->updateObjectBrowser();
@@ -131,7 +132,7 @@ void MULTIPR_GUI_SaveThread::run()
 {
   try
   {
-    mObj->save(mPath);
+    mObj->save(mPath.toLatin1());
   }
   catch(...)
   {
@@ -147,20 +148,19 @@ void MULTIPR_GUI_SaveThread::run()
 //*****************************************************************************
 
 // singleton
-MULTIPR_ORB::MULTIPR_Gen_ptr GetMultiprGen (const CAM_Module* theModule)
+MULTIPR_ORB::MULTIPR_Gen_ptr GetMultiprGen (SalomeApp_Application* app)
 {
     static MULTIPR_ORB::MULTIPR_Gen_ptr aGen = NULL;
 
     if (!aGen)
     {
         SALOME_LifeCycleCORBA aLCC (SalomeApp_Application::namingService());
-        Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer", "MULTIPR");
-        aGen = MULTIPR_ORB::MULTIPR_Gen::_narrow(aComponent);
+        Engines::Component_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","MULTIPR" );
+        aGen = MULTIPR_ORB::MULTIPR_Gen::_narrow(comp);
         if (!CORBA::is_nil(aGen))
         {
           // Set current study
-          SalomeApp_Study* aSAStudy =
-            dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy());
+          SalomeApp_Study* aSAStudy =dynamic_cast<SalomeApp_Study*>(app->activeStudy());
           _PTR(Study) aStudy = aSAStudy->studyDS();
           SALOMEDS::Study_ptr aStudyDS;
           if (aStudy)
@@ -182,6 +182,7 @@ MULTIPR_ORB::MULTIPR_Gen_ptr GetMultiprGen (const CAM_Module* theModule)
 
 MULTIPR_GUI::MULTIPR_GUI()
   : SalomeApp_Module("MULTIPR"),
+    LightApp_Module( "MULTIPR" ),
     //mMULTIPRObj(NULL),
     mMEDFileName(""),
     mProgress(NULL)
@@ -221,9 +222,9 @@ void MULTIPR_GUI::initialize(CAM_Application* app)
 {
     SalomeApp_Module::initialize(app);
     
-    GetMultiprGen(this);
+    GetMultiprGen(dynamic_cast<SalomeApp_Application*>( app ));
     
-    QWidget* aParent = app->desktop();
+    QWidget* aParent = (QWidget*) application()->desktop();
     SUIT_ResourceMgr* aResourceMgr = app->resourceMgr();
     
     //-------------------------------------------------------------------------
@@ -234,10 +235,10 @@ void MULTIPR_GUI::initialize(CAM_Application* app)
     createAction( 
         ACTION_IMPORT_MED, 
         tr("MULTIPR_TLT_IMPORT_FROM_MED_FILE"), 
-        QIconSet(aPixmapImportFromMEDFile), 
+        QIcon(aPixmapImportFromMEDFile), 
         tr("MULTIPR_MEN_IMPORT_FROM_MED_FILE"), 
         tr("MULTIPR_STS_IMPORT_FROM_MED_FILE"), 
-        (CTRL + Key_I),
+        (Qt::CTRL + Qt::Key_I),
         aParent, 
         false,
         this, 
@@ -246,7 +247,7 @@ void MULTIPR_GUI::initialize(CAM_Application* app)
     createAction( 
         ACTION_SPLIT, 
         tr("MULTIPR_TLT_SPLIT"), 
-        QIconSet(), 
+        QIcon(), 
         tr("MULTIPR_MEN_SPLIT"), 
         tr("MULTIPR_STS_SPLIT"), 
         0,
@@ -258,7 +259,7 @@ void MULTIPR_GUI::initialize(CAM_Application* app)
     createAction( 
         ACTION_DECIMATE, 
         tr("MULTIPR_TLT_DECIMATE"), 
-        QIconSet(), 
+        QIcon(), 
         tr("MULTIPR_MEN_DECIMATE"), 
         tr("MULTIPR_STS_DECIMATE"), 
         0,
@@ -270,7 +271,7 @@ void MULTIPR_GUI::initialize(CAM_Application* app)
     createAction( 
         ACTION_REMOVE, 
         tr("MULTIPR_TLT_REMOVE"), 
-        QIconSet(), 
+        QIcon(), 
         tr("MULTIPR_MEN_REMOVE"), 
         tr("MULTIPR_STS_REMOVE"), 
         0,
@@ -284,7 +285,7 @@ void MULTIPR_GUI::initialize(CAM_Application* app)
     createAction( 
         ACTION_SAVE, 
         tr("MULTIPR_TLT_SAVE"), 
-        QIconSet(aPixmapSaveMEDFile), 
+        QIcon(aPixmapSaveMEDFile), 
         tr("MULTIPR_MEN_SAVE"), 
         tr("MULTIPR_STS_SAVE"), 
         0,
@@ -326,10 +327,10 @@ void MULTIPR_GUI::initialize(CAM_Application* app)
     mgr->insert( action(ACTION_SAVE), -1, -1, -1 );
     
     QString aRule = "client='ObjectBrowser' and selcount>=1"; // $type in {'VISU::TMESH'}";
-    mgr->setRule(action(ACTION_SPLIT), aRule, true);
-    mgr->setRule(action(ACTION_DECIMATE), aRule, true);
-    mgr->setRule(action(ACTION_REMOVE), aRule, true);
-    mgr->setRule(action(ACTION_SAVE), aRule, true);
+    mgr->setRule(action(ACTION_SPLIT), aRule);
+    mgr->setRule(action(ACTION_DECIMATE), aRule);
+    mgr->setRule(action(ACTION_REMOVE), aRule);
+    mgr->setRule(action(ACTION_SAVE), aRule);
     
     //-------------------------------------------------------------------------
     // set progress dialog
@@ -352,7 +353,8 @@ CAM_DataModel* MULTIPR_GUI::createDataModel()
 
 QString MULTIPR_GUI::engineIOR() const
 {
-    CORBA::String_var anIOR = getApp()->orb()->object_to_string(GetMultiprGen(this));
+//   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(this);
+    CORBA::String_var anIOR = getApp()->orb()->object_to_string(GetMultiprGen(getApp()));
     return QString(anIOR.in());
 }
 
@@ -363,10 +365,10 @@ bool MULTIPR_GUI::activateModule(SUIT_Study* theStudy)
     setMenuShown(true);
     setToolShown(true);
 
-    action(ACTION_IMPORT_MED)->setAccel(QKeySequence(CTRL + Key_I));
+    action(ACTION_IMPORT_MED)->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_I));
 
     // Set current study
-    MULTIPR_ORB::MULTIPR_Gen_ptr aGen = GetMultiprGen(this);
+    MULTIPR_ORB::MULTIPR_Gen_ptr aGen = GetMultiprGen(dynamic_cast<SalomeApp_Application*>(this));
     SalomeApp_Study* aSAStudy = dynamic_cast<SalomeApp_Study*>(theStudy);
     _PTR(Study) aStudy = aSAStudy->studyDS();
     SALOMEDS::Study_ptr aStudyDS;
@@ -375,7 +377,7 @@ bool MULTIPR_GUI::activateModule(SUIT_Study* theStudy)
     aGen->SetCurrentStudy(aStudyDS);
 
     // Init mMULTIPRObj
-    _PTR(SComponent) aSComp = aStudy->FindComponent(name());
+    _PTR(SComponent) aSComp = aStudy->FindComponent(name().toStdString());
     if (aSComp) {
       _PTR(ChildIterator) it (aStudy->NewChildIterator(aSComp));
       if (it->More()) {
@@ -398,7 +400,7 @@ bool MULTIPR_GUI::deactivateModule(SUIT_Study* theStudy)
     setToolShown(false);
 
     // Unset actions accelerator keys
-    action(ACTION_IMPORT_MED)->setAccel(QKeySequence());
+    action(ACTION_IMPORT_MED)->setShortcut(QKeySequence());
 
     mMULTIPRObj = MULTIPR_ORB::MULTIPR_Obj::_nil();
 
@@ -409,8 +411,8 @@ bool MULTIPR_GUI::deactivateModule(SUIT_Study* theStudy)
 void MULTIPR_GUI::windows(QMap<int, int>& theMap) const
 {
     theMap.clear();
-    theMap.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft);
-    theMap.insert(SalomeApp_Application::WT_PyConsole,     Qt::DockBottom);
+    theMap.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea);
+    theMap.insert(SalomeApp_Application::WT_PyConsole,     Qt::BottomDockWidgetArea);
 }
 
 
@@ -446,11 +448,11 @@ void MULTIPR_GUI::OnImportFromMEDFile()
     aFilter.append(tr("MULTIPR_FLT_ALL_FILES"));
     
     SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg(
-        this->application()->desktop(), 
+        (QWidget*) MULTIPR_GUI::desktop(), 
         true, 
         tr("") );
         
-    fd->setCaption(tr("MULTIPR_MEN_IMPORT_FROM_MED_FILE"));
+    fd->setWindowTitle(tr("MULTIPR_MEN_IMPORT_FROM_MED_FILE"));
     fd->setFilters(aFilter);
     if (fd->exec() == QDialog::Rejected)
     {
@@ -467,7 +469,7 @@ void MULTIPR_GUI::OnImportFromMEDFile()
 
     mMEDFileName = aFileInfo.filePath();
 
-    QApplication::setOverrideCursor(Qt::waitCursor);
+    QApplication::setOverrideCursor(Qt::WaitCursor);
 
     // Delete previous MULTIPR object.
     //if (mMULTIPRObj != NULL)
@@ -476,19 +478,20 @@ void MULTIPR_GUI::OnImportFromMEDFile()
         mMULTIPRObj->reset();
     }
 
-    MULTIPR_ORB::MULTIPR_Gen_ptr multiprgen = GetMultiprGen(this);
+    MULTIPR_ORB::MULTIPR_Gen_ptr multiprgen = GetMultiprGen(dynamic_cast<SalomeApp_Application*>( this ));
 
     try
     {
-      mMULTIPRObj = multiprgen->getObject(mMEDFileName.latin1());
+      mMULTIPRObj = multiprgen->getObject(mMEDFileName.toLatin1());
     }
     catch(...)
     {
-        SUIT_MessageBox::error1( 
-            getApp()->desktop(),
-            "Import MED file error", 
-            "Invalid MED file (not recognized by MULTIPR)", 
-            tr("MULTIPR_BUT_OK") );
+        SUIT_MessageBox::critical( 
+            (QWidget*) MULTIPR_GUI::desktop(),
+            QObject::tr("IMPORT_MED_ERROR"), 
+//            "Import MED file error", 
+            QObject::tr("INVALID_MED_FILE"));
+//          "Invalid MED file (not recognized by MULTIPR)"); 
     }
     QApplication::restoreOverrideCursor();
     
@@ -534,12 +537,12 @@ void MULTIPR_GUI::OnPartition1()
 
     // Now we need to save the file.
     SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg(
-        this->application()->desktop(), 
+        (QWidget*) MULTIPR_GUI::desktop(), 
         true, 
         tr("") );
         
-    fd->setCaption(tr("Save distributed MED file - Destination directory"));
-    fd->setMode(QFileDialog::DirectoryOnly);
+    fd->setWindowTitle(tr("Save distributed MED file - Destination directory"));
+    fd->setFileMode(QFileDialog::DirectoryOnly);
     
     if (fd->exec() == QDialog::Rejected)
     {
@@ -554,7 +557,7 @@ void MULTIPR_GUI::OnPartition1()
         
     QString path = aFileInfo.filePath();
     
-    QApplication::setOverrideCursor(Qt::waitCursor);
+    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
     mMULTIPRObj->resetSaveProgress();
 
     MULTIPR_GUI_SaveThread* a = new MULTIPR_GUI_SaveThread (this, mMULTIPRObj, path);
@@ -564,7 +567,7 @@ void MULTIPR_GUI::OnPartition1()
     //mProgress = new MULTIPR_GUI_ProgressCallbackDlg (getApp()->desktop());
     //mProgress->start("Save mesh", 100);
     if (mProgress == NULL)
-        mProgress = new QProgressDialog ("Save mesh", "Cancel", /*totalSteps*/100, getApp()->desktop());
+        mProgress = new QProgressDialog ("Save mesh", "Cancel", 0,/*totalSteps*/100, (QWidget*) MULTIPR_GUI::desktop());
     //mProgress->setProgress(0);
     //mProgress->init(100);
     //mTimer->start(500); // 0.5 seconds timer
@@ -587,11 +590,12 @@ void MULTIPR_GUI::OnPartition2()
     
     if (mSelectedParts.count() == 0)
     {
-        SUIT_MessageBox::warn1( 
-            getApp()->desktop(),
-            "Split warning", 
-            "No parts selected", 
-            tr("MULTIPR_BUT_OK") );
+        SUIT_MessageBox::warning( 
+            (QWidget*) MULTIPR_GUI::desktop(),
+            QObject::tr("SPLIT_WARN"), 
+//            "Split warning", 
+            QObject::tr("NO_PART_SELECTED")); 
+//            "No parts selected");
         return;
     }
     
@@ -621,11 +625,12 @@ void MULTIPR_GUI::OnDecimate()
     
     if (mSelectedParts.count() == 0)
     {
-        SUIT_MessageBox::warn1( 
-            getApp()->desktop(),
-            "Decimation warning", 
-            "No parts selected", 
-            tr("MULTIPR_BUT_OK") );
+        SUIT_MessageBox::warning( 
+            (QWidget*) MULTIPR_GUI::desktop(),
+            QObject::tr("DECIMATION_WARN"), 
+//           "Decimation warning", 
+            QObject::tr("NO_PART_SELECTED")); 
+//            "No parts selected"); 
         return;
     }
 
@@ -636,14 +641,15 @@ void MULTIPR_GUI::OnDecimate()
 
     const QStringList& partsList = this->getSelectedParts();
     QString allParts = partsList.join("|");
-    MULTIPR_ORB::string_array* listFields = this->getMULTIPRObj()->getFields(allParts.latin1());
+    MULTIPR_ORB::string_array* listFields = this->getMULTIPRObj()->getFields(allParts.toLatin1());
     if (listFields->length() == 0)
     {
-      SUIT_MessageBox::error1( 
-            this->getAppli()->desktop(),
-            "Decimation error", 
-            "No field for this part.", 
-            tr("OK") );
+      SUIT_MessageBox::critical( 
+            (QWidget*) MULTIPR_GUI::desktop(),
+            QObject::tr("DECIM_ERROR"), 
+//            "Decimation error", 
+            QObject::tr("NO_FIELD_ON_PART"));
+//          "No field for this part.",);
       return ;
     }
 
@@ -668,25 +674,28 @@ void MULTIPR_GUI::OnRemove()
     
     if (mSelectedParts.count() == 0)
     {
-        SUIT_MessageBox::warn1( 
-            getApp()->desktop(),
-            "Remove warning", 
-            "No parts selected", 
-            tr("MULTIPR_BUT_OK") );
+        SUIT_MessageBox::warning( 
+            (QWidget*) MULTIPR_GUI::desktop(),
+            QObject::tr("DEL_WARN"), 
+//            "Remove warning", 
+            QObject::tr("NO_PART_SELECTED"));
+//           "No parts selected"); 
         return;
     }
     
     if (QMessageBox::question(
-            getApp()->desktop(),
-            tr("Remove selected part(s)"),
-            tr("Do you want to remove selected part(s)?"),
-            tr("&Yes"), tr("&No"),
+            (QWidget*) MULTIPR_GUI::desktop(),
+            QObject::tr("DEL_SELECTED_PARTS"),
+//            QObject::tr("Remove selected part(s)"),
+            QObject::tr("DEL_SELECTED_PARTS_QUEST"),
+//           QObject::tr("Do you want to remove selected part(s)?"),
+            QObject::tr("&Yes"), tr("&No"),
             QString::null, 0, 1 ) )
     {
         return;
     }
 
-    QApplication::setOverrideCursor(Qt::waitCursor);
+    QApplication::setOverrideCursor(Qt::WaitCursor);
 
     try
     {
@@ -694,17 +703,18 @@ void MULTIPR_GUI::OnRemove()
       for (; it != last; it++)
       {
         const QString& partName = (*it);
-        cout << "Remove " << partName.latin1() << endl;
-        mMULTIPRObj->removeParts(partName.latin1());
+        cout << "Remove " << (const char*)partName.toLatin1() << endl;
+        mMULTIPRObj->removeParts(partName.toLatin1());
       }
     }
     catch(...)
     {
-        SUIT_MessageBox::error1( 
-            getApp()->desktop(),
-            "Remove error", 
-            "Error while removing selected part(s)", 
-            tr("MULTIPR_BUT_OK") );
+        SUIT_MessageBox::critical( 
+            (QWidget*) MULTIPR_GUI::desktop(),
+            QObject::tr("DEL_ERROR"), 
+//            "Remove error", 
+            QObject::tr("ERROR_DEL_PART"));
+//            "Error while removing selected part(s)"); 
     }
 
     QApplication::restoreOverrideCursor();
@@ -723,13 +733,10 @@ void MULTIPR_GUI::OnSave()
     return;
   }
 
-  SalomeApp_CheckFileDlg* fd =
-    new SalomeApp_CheckFileDlg(this->application()->desktop(),
-                               true,
-                               tr(""));
+    SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( (QWidget*) MULTIPR_GUI::desktop(), true,tr(""));
 
-  fd->setCaption(tr("Save distributed MED file - Destination directory"));
-  fd->setMode(QFileDialog::DirectoryOnly);
+  fd->setWindowTitle(tr("Save distributed MED file - Destination directory"));
+  fd->setFileMode(QFileDialog::DirectoryOnly);
 
   if (fd->exec() == QDialog::Rejected)
   {
@@ -740,7 +747,7 @@ void MULTIPR_GUI::OnSave()
   QFileInfo aFileInfo(fd->selectedFile());
   delete fd;
 
-  QApplication::setOverrideCursor(Qt::waitCursor);
+  QApplication::setOverrideCursor(Qt::WaitCursor);
 
   QString path = aFileInfo.filePath();
   mMULTIPRObj->resetSaveProgress();
@@ -752,7 +759,7 @@ void MULTIPR_GUI::OnSave()
   //mProgress = new MULTIPR_GUI_ProgressCallbackDlg (getApp()->desktop());
   //mProgress->start("Save mesh", 100);
   if (mProgress == NULL)
-    mProgress = new QProgressDialog ("Save mesh", "Cancel", /*totalSteps*/100, getApp()->desktop());
+    mProgress = new QProgressDialog ("Save mesh", "Cancel", 0,/*totalSteps*/100, (QWidget*) MULTIPR_GUI::desktop());
   //mProgress->setProgress(0);
   //mProgress->init(100);
   mTimer->start(500); // 0.5 seconds timer
@@ -764,7 +771,7 @@ void MULTIPR_GUI::timerDone()
 {
   int progress = mMULTIPRObj->getSaveProgress();
   if (mProgress != NULL) {
-    mProgress->setProgress(progress);
+    mProgress->setValue(progress);
 
     if (progress >= 100) {
       mTimer->stop();
@@ -781,7 +788,7 @@ void MULTIPR_GUI::retrieveSelectedParts()
     for (QStringList::const_iterator it = userSelection.begin(), last = userSelection.end(); it != last; it++)
     {
         const QString& str = (*it);
-        QStringList words = QStringList::split(":", str);
+        QStringList words = str.split(":");
         if (words.count() == 2)
         {
             if (words[0] == "MULTIPR_PART")
@@ -822,35 +829,37 @@ bool MULTIPR_GUI::removeLowerResolution()
         const QString& partName = (*it);
         QString partNameLow = partName + "_LOW";
         QString partNameMed = partName + "_MED";
-        const char* strPartNameLow = partNameLow.latin1();
-        const char* strPartNameMed = partNameMed.latin1();
+        const char* strPartNameLow = partNameLow.toLatin1();
+        const char* strPartNameMed = partNameMed.toLatin1();
         
         if (isPartExist(strPartNameLow))
         {
             partNameLowerResolution.push_back(partNameLow);
-            cout << "Part to be removed: " << partNameLow << endl;
+            cout << "Part to be removed: " << strPartNameLow << endl;
         }
         
         if (isPartExist(strPartNameMed))
         {
             partNameLowerResolution.push_back(partNameMed);
-            cout << "Part to be removed: " << partNameMed << endl;
+            cout << "Part to be removed: " << strPartNameMed << endl;
         }
     }
      
     if (partNameLowerResolution.count() > 0)
     {
         if (QMessageBox::question(
-                getApp()->desktop(),
-                tr("Remove previous results"),
-                tr("Do you want to remove previous results?"),
+                (QWidget*) MULTIPR_GUI::desktop(),
+                QObject::tr("DEL_PREV_RESULTS"),
+//                tr("Remove previous results"),
+                QObject::tr("DEL_PREV_RESULTS_QUEST"),
+//                tr("Do you want to remove previous results?"),
                 tr("&Yes"), tr("&No"),
                 QString::null, 0, 1 ) )
         {
             return false;
         }
     
-        QApplication::setOverrideCursor(Qt::waitCursor);
+        QApplication::setOverrideCursor(Qt::WaitCursor);
         
         try
         {
@@ -858,18 +867,19 @@ bool MULTIPR_GUI::removeLowerResolution()
                    last = partNameLowerResolution.end(); it != last; it++)
             {
                 const QString& partName = (*it);
-                cout << "Remove " << partName.latin1() << endl;
-                mMULTIPRObj->removeParts(partName.latin1());
+                cout << "Remove " << (const char*)partName.toLatin1() << endl;
+                mMULTIPRObj->removeParts(partName.toLatin1());
             }
             
         }
         catch(...)
         {
-            SUIT_MessageBox::error1( 
-                getApp()->desktop(),
-                "Remove error", 
-                "Error while removing previous results", 
-                tr("MULTIPR_BUT_OK") );
+            SUIT_MessageBox::critical( 
+                (QWidget*) MULTIPR_GUI::desktop(),
+                QObject::tr("DEL_ERROR"),
+//                "Remove error", 
+                QObject::tr("ERROR_DEL_PREV_RESULT")); 
+//                "Error while removing previous results", 
         }
         
         QApplication::restoreOverrideCursor();
@@ -881,6 +891,15 @@ bool MULTIPR_GUI::removeLowerResolution()
     return true;
 }
 
+SUIT_Desktop*  MULTIPR_GUI::desktop()
+{
+  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  if( app )
+    return app->desktop();
+  else
+    return 0;
+}
+
 
 //*****************************************************************************
 // Super class Data Object implementation
@@ -931,14 +950,17 @@ QString MULTIPR_GUI_DataObject::toolTip() const
 // Class Data Object Module implementation
 //*****************************************************************************
 
+
 MULTIPR_GUI_DataObject_Module::MULTIPR_GUI_DataObject_Module (CAM_DataModel* dm,
                                                               SUIT_DataObject* parent,
                                                               const char* name)
   : MULTIPR_GUI_DataObject(parent, name),
-    LightApp_ModuleObject(dm, parent),
+//    LightApp_DataObject(dm, parent),
     CAM_DataObject(parent)
 {
     // do nothing!
+    mDm = dm;
+    mParent = parent;
 }
 
 
@@ -956,7 +978,8 @@ QString MULTIPR_GUI_DataObject_Module::entry() const
 
 QString MULTIPR_GUI_DataObject_Module::name() const
 {
-  return CAM_RootObject::name();
+  CAM_ModuleObject cam(mDm,mParent);
+  return cam.name();
 }
 
 
@@ -1114,7 +1137,7 @@ QString MULTIPR_GUI_DataObject_Resolution::toolTip() const
 //*****************************************************************************
 
 MULTIPR_GUI_DataModel::MULTIPR_GUI_DataModel(CAM_Module* module)
-  //: LightApp_DataModel(module)
+// : LightApp_DataModel(module)
   : SalomeApp_DataModel(module)
 {
     mMULTIPR_GUI = dynamic_cast<MULTIPR_GUI*>(module);
@@ -1125,17 +1148,18 @@ MULTIPR_GUI_DataModel::~MULTIPR_GUI_DataModel()
     // do nothing!
 }
 
-
 void MULTIPR_GUI_DataModel::update (LightApp_DataObject*, LightApp_Study* theStudy)
 {
   LightApp_ModuleObject* modelRoot = dynamic_cast<LightApp_ModuleObject*>( root() );
   DataObjectList ch;
+  //QListIterator<SUIT_DataObject> it1,it2;
   QMap<SUIT_DataObject*,int> aMap;
   if( modelRoot )
   {
     ch = modelRoot->children();
-    for ( DataObjectListIterator it( ch ); it.current(); ++it )
-      it.current()->setParent( 0 );
+    DataObjectList::const_iterator it = ch.begin(), it_last = ch.end();
+    for (; it != it_last; it++)
+        (*it)->setParent( 0);
   }
 
   buildAll(theStudy);
@@ -1144,15 +1168,16 @@ void MULTIPR_GUI_DataModel::update (LightApp_DataObject*, LightApp_Study* theStu
   if( modelRoot )
   {
     DataObjectList new_ch = modelRoot->children();
-    for ( DataObjectListIterator it1( new_ch ); it1.current(); ++it1 )
-      aMap.insert( it1.current(), 0 );
+    DataObjectList::const_iterator it1 = new_ch.begin(), it1_last = new_ch.end();
+    for (; it1 != it1_last; it1++)
+      aMap.insert((*it1),0);
   }
 
   updateWidgets();
-
-  for( DataObjectListIterator it( ch ); it.current(); ++it )
-    if( !aMap.contains( it.current() ) )
-      delete it.current();
+  DataObjectList::const_iterator it_del = ch.begin(), it_del_last = ch.end();
+  for (; it_del != it_del_last; it_del++)
+    if( !aMap.contains( (*it_del) ) )
+      delete (*it_del);
 }
 
 void MULTIPR_GUI_DataModel::build()
@@ -1180,7 +1205,7 @@ void MULTIPR_GUI_DataModel::buildAll (LightApp_Study* theStudy)
     // find SObject in Study
     MULTIPR_ORB::MULTIPR_Obj_ptr obj = MULTIPR_ORB::MULTIPR_Obj::_nil();
 
-    _PTR(SComponent) aSComp = aSAStudy->studyDS()->FindComponent(module()->name());
+    _PTR(SComponent) aSComp = aSAStudy->studyDS()->FindComponent(module()->name().toStdString());
     if (aSComp)
     {
       _PTR(ChildIterator) it (aSAStudy->studyDS()->NewChildIterator(aSComp));