From b7f48f7b75951944351659daea6894b0bc38d570 Mon Sep 17 00:00:00 2001 From: asv Date: Thu, 26 Jan 2006 11:50:40 +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: QAD_FileDlg redefines dirPath() function. The implementation returns dirPath of the selected file if it exists. --- src/SALOMEGUI/QAD_FileDlg.cxx | 11 +++++++++++ src/SALOMEGUI/QAD_FileDlg.h | 3 +++ 2 files changed, 14 insertions(+) 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, -- 2.39.2