From 31f44b2aa9a2d8534a9a57bfb59277df466ebcb3 Mon Sep 17 00:00:00 2001 From: mzn Date: Tue, 29 Apr 2008 13:13:59 +0000 Subject: [PATCH] Additional fix for bug NPAL19028 (see remarks from Olivier Giorgis). --- src/SUIT/SUIT_FileDlg.cxx | 8 ++++++++ src/SUIT/SUIT_FileDlg.h | 2 ++ src/SalomeApp/SalomeApp_Application.cxx | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index 7fb1ee7c6..ec7bc547f 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -522,6 +522,14 @@ QString SUIT_FileDlg::getExistingDirectory( QWidget* parent, } +/*! + Returns the last visited path. [ static ] +*/ +QString SUIT_FileDlg::getLastVisitedPath() +{ + return myLastVisitedPath; +} + /*! QFileDialog::dirPath() has a bug on Linux Debian (1 level up from correct directory is returned). This function fixes the bug. diff --git a/src/SUIT/SUIT_FileDlg.h b/src/SUIT/SUIT_FileDlg.h index 044188003..3a3a26b83 100755 --- a/src/SUIT/SUIT_FileDlg.h +++ b/src/SUIT/SUIT_FileDlg.h @@ -57,6 +57,8 @@ public: static QString getExistingDirectory( QWidget* parent, const QString& initial, const QString& caption, const bool showQuickDir = true ); + static QString getLastVisitedPath(); + public slots: void polish(); diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 4fbe1d0b9..894ca64fd 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -773,7 +773,11 @@ void SalomeApp_Application::onLoadScript( ) filtersList.append(tr("PYTHON_FILES_FILTER")); filtersList.append(tr("ALL_FILES_FILTER")); - QString aFile = SUIT_FileDlg::getFileName( desktop(), QDir::currentDirPath(), filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true ); + QString anInitialPath = ""; + if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) + anInitialPath = QDir::currentDirPath(); + + QString aFile = SUIT_FileDlg::getFileName( desktop(), anInitialPath, filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true ); if ( !aFile.isEmpty() ) { -- 2.39.2