]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix for bug PAL11367: on Debian Sarge QFileDialog's dirPath() function returns wrong...
authorasv <asv@opencascade.com>
Thu, 26 Jan 2006 11:50:40 +0000 (11:50 +0000)
committerasv <asv@opencascade.com>
Thu, 26 Jan 2006 11:50:40 +0000 (11:50 +0000)
The fix: QAD_FileDlg redefines dirPath() function.  The implementation returns dirPath of the selected file if it exists.

src/SALOMEGUI/QAD_FileDlg.cxx
src/SALOMEGUI/QAD_FileDlg.h

index 3f35d228eb7950ce6e05b0bcbfed94df24aeb65d..dd6a89c5fca40c210c58f3c673ddce869c958e0d 100644 (file)
@@ -416,3 +416,14 @@ QString QAD_FileDlg::getExistingDirectory ( QWidget*       parent,
   return dirname;
 }
 
+/*!
+  QFileDialog::dirPath() has a bug on Linux Debian (1 level up from correct
+  directory is returned).  This function fixes the bug. 
+*/
+QString QAD_FileDlg::dirPath() const
+{
+  if ( !mySelectedFile.isNull() )
+    return QFileInfo( mySelectedFile ).dirPath();
+  
+  return QFileDialog::dirPath();
+}
index 71b19cfe25099bd8547d1391c452a1f15a796e03..1c410d0f55c4b9134df1c4111f62b73166f43cd5 100644 (file)
@@ -34,6 +34,9 @@ public:
 
     void               setValidator( QAD_FileValidator* );
 
+    QString            dirPath() const; // QFileDialog::dirPath() has a bug on Linux Debian (1 level up from correct 
+                                        // directory is returned).  This redefinition fixes the bug.  
+
     static QString     getFileName( QWidget*           parent, 
                                    const QString&     initial, 
                                    const QStringList& filters,