From 509a119c0495db6f16384770f513277eb38fbb15 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 21 Apr 2008 08:11:28 +0000 Subject: [PATCH] PAL19566; the file dialog box should treat the directory of passed initial file as current directory of the dialog --- src/SUIT/SUIT_FileDlg.cxx | 15 +++++++++++++++ src/SUIT/SUIT_FileDlg.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index f984a9740..1a026be1b 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -953,3 +953,18 @@ QString SUIT_FileDlg::getExistingDirectory( QWidget* parent, const QString& init return dirname; } + +/*! + \brief Selects current file + + This version of selectFile() methods works similar to Qt version 3.x: + it selects the given file as current and it changes the current file dialog's directory + to the directory of the file + + \param f - new current file name +*/ +void SUIT_FileDlg::selectFile( const QString& f ) +{ + QFileDialog::selectFile( f ); + setDirectory( QFileInfo( f ).absoluteDir() ); +} diff --git a/src/SUIT/SUIT_FileDlg.h b/src/SUIT/SUIT_FileDlg.h index c863dbf12..832a28e13 100755 --- a/src/SUIT/SUIT_FileDlg.h +++ b/src/SUIT/SUIT_FileDlg.h @@ -54,6 +54,8 @@ public: QStringList selectedFiles() const; QString selectedFile() const; + void selectFile( const QString& ); + static QString getLastVisitedDirectory(); static QString getFileName( QWidget*, -- 2.39.2