From: asv Date: Thu, 26 Jan 2006 09:24:24 +0000 (+0000) Subject: Fix for bug PAL11367: on Debian Sarge QFileDialog's dirPath() function returns wrong... X-Git-Tag: SPDev_start~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e91ef791da984b36a18b486757ae7f63ff844e4;p=modules%2Fgui.git Fix for bug PAL11367: on Debian Sarge QFileDialog's dirPath() function returns wrong directory (one level up from the selected). The fix: SUIT_FileDlg redefines dirPath() function. The implementation returns dirPath of the selected file if it exists. --- diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index 80a6ad589..9032af17b 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -521,3 +521,15 @@ QString SUIT_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 SUIT_FileDlg::dirPath() const +{ + if ( !mySelectedFile.isNull() ) + return QFileInfo( mySelectedFile ).dirPath(); + + return QFileDialog::dirPath(); +} diff --git a/src/SUIT/SUIT_FileDlg.h b/src/SUIT/SUIT_FileDlg.h index bb9ae4e3f..48416b44b 100755 --- a/src/SUIT/SUIT_FileDlg.h +++ b/src/SUIT/SUIT_FileDlg.h @@ -62,6 +62,9 @@ private: void addExtension(); bool processPath( const QString& path ); + QString dirPath() const; // QFileDialog::dirPath() has a bug on Linux Debian (1 level up from correct + // directory is returned). This redefinition fixes the bug. + protected slots: void accept(); void reject();