]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for PAL11177( A new quick directory is not saved if there's no "<empty>" line ).
authormzn <mzn@opencascade.com>
Fri, 10 Feb 2006 12:59:25 +0000 (12:59 +0000)
committermzn <mzn@opencascade.com>
Fri, 10 Feb 2006 12:59:25 +0000 (12:59 +0000)
src/Qtx/QtxDirListEditor.cxx
src/Qtx/QtxDirListEditor.h

index 0532cd77fcea0a98e4246faeaf154aff5dfa43ad..9ddfd7c3dcaca982a5096a9cd25c9a49f1d1d048 100644 (file)
@@ -206,6 +206,18 @@ QtxDirListEditor::~QtxDirListEditor()
 */
 void QtxDirListEditor::getPathList(QStringList& list)
 {
+  // Finish the path editing
+  if (myEdit) {
+    validate(true);
+    
+    myEdit->deleteLater();
+    myBtn->deleteLater();
+    myEdit = 0;
+    myBtn  = 0;
+    myEdited = false;
+    myDirList->setFocus();
+  }
+
   list.clear();
   for (unsigned i = 0; i < myDirList->count()-1; i++)
     list.append(myDirList->text(i));
@@ -224,11 +236,11 @@ void QtxDirListEditor::setPathList(const QStringList& list) {
 /*!
   Validates entered path, returns true if OK
 */
-bool QtxDirListEditor::validate()
+bool QtxDirListEditor::validate( const bool quietMode )
 {
   if ( myEdited )
   {
-    QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).absFilePath();
+    QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).filePath();
 /*
 #ifndef WNT
     if ( dirPath.startsWith( "~") ) {
@@ -285,20 +297,21 @@ bool QtxDirListEditor::validate()
       if (found) {
         if (found != myLastSelected) {
           // it is forbidden to add directory more then once
-         QMessageBox::critical(this, 
-                               tr("Error"),
-                               tr("Directory already specified."), 
-                               tr("Ok"));
+         if ( !quietMode )
+           QMessageBox::critical(this, 
+                                 tr("Error"),
+                                 tr("Directory already specified."), 
+                                 tr("Ok"));
          myEdit->setFocus();
           return false;
         }
       }
       else {
         if (!dir.exists()) {
-         if ( QMessageBox::information(this, 
-                                       tr("Warning"),
-                                       tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
-                                       tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
+         if ( !quietMode && QMessageBox::information(this, 
+                                                     tr("Warning"),
+                                                     tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
+                                                     tr("Yes"), tr("No"), QString::null, 1, 1) == 1) {
            myEdit->setFocus();
             return false;
          }
index 95e84228ec8c4e8dbf2a342a005be7774c6d4c5f..7851fc83a555e66b3c0f198cf71f1d730cc8da7a 100644 (file)
@@ -74,7 +74,7 @@ protected:
    * \brief Validates entered path
    * \retval bool - returns status (true if OK)
    */
-  bool          validate();
+  bool          validate( const bool quietMode = false );
 
   /*!
    * \brief Appends/changes path