From 9e91ef791da984b36a18b486757ae7f63ff844e4 Mon Sep 17 00:00:00 2001 From: asv Date: Thu, 26 Jan 2006 09:24:24 +0000 Subject: [PATCH] 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. --- src/SUIT/SUIT_FileDlg.cxx | 12 ++++++++++++ src/SUIT/SUIT_FileDlg.h | 3 +++ 2 files changed, 15 insertions(+) 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(); -- 2.39.2