From: asv Date: Thu, 26 Jan 2006 11:50:40 +0000 (+0000) Subject: Fix for bug PAL11367: on Debian Sarge QFileDialog's dirPath() function returns wrong... X-Git-Tag: T2_2_9pre~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b7f48f7b75951944351659daea6894b0bc38d570;p=modules%2Fkernel.git Fix for bug PAL11367: on Debian Sarge QFileDialog's dirPath() function returns wrong directory (one level up from the selected). The fix: QAD_FileDlg redefines dirPath() function. The implementation returns dirPath of the selected file if it exists. --- diff --git a/src/SALOMEGUI/QAD_FileDlg.cxx b/src/SALOMEGUI/QAD_FileDlg.cxx index 3f35d228e..dd6a89c5f 100644 --- a/src/SALOMEGUI/QAD_FileDlg.cxx +++ b/src/SALOMEGUI/QAD_FileDlg.cxx @@ -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(); +} diff --git a/src/SALOMEGUI/QAD_FileDlg.h b/src/SALOMEGUI/QAD_FileDlg.h index 71b19cfe2..1c410d0f5 100644 --- a/src/SALOMEGUI/QAD_FileDlg.h +++ b/src/SALOMEGUI/QAD_FileDlg.h @@ -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,