From aa9962f81c6cfb11fcca4047dfbb8a01070f4842 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 20 Jun 2005 05:55:26 +0000 Subject: [PATCH] Add getOpenFileNames() method to get the list of files selected by user --- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 15 ++++++--------- src/SalomeApp/SalomeApp_Application.cxx | 9 +++++++++ src/SalomeApp/SalomeApp_Application.h | 4 +++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 3fd124529..e898ec84c 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -752,9 +752,8 @@ public: myCaption( caption ), myOpen ( open ) {} virtual void Execute() { - if ( /*SalomeApp_Study* aStudy = */getActiveStudy() ) { - // VSR: TODO - // myResult = QAD_FileDlg::getFileName(parent, initial, filters, caption, open); + if ( SalomeApp_Application* anApp = getApplication() ) { + myResult = anApp->getFileName( myOpen, myInitial, myFilters.join(";;"), myCaption, myParent ); } } }; @@ -788,9 +787,8 @@ public: myFilters( filters ), myCaption( caption ) {} virtual void Execute() { - if ( /*SalomeApp_Study* aStudy = */getActiveStudy() ) { - // VSR: TODO - // myResult = QAD_FileDlg::getOpenFileNames(parent, initial, filters, caption); + if ( SalomeApp_Application* anApp = getApplication() ) { + myResult = anApp->getOpenFileNames( myInitial, myFilters.join(";;"), myCaption, myParent ); } } }; @@ -820,9 +818,8 @@ public: myInitial( initial ), myCaption( caption ) {} virtual void Execute() { - if ( /*SalomeApp_Study* aStudy = */getActiveStudy() ) { - // VSR: TODO - // myResult = QAD_FileDlg::getExistingDirectory(parent, initial, caption); + if ( SalomeApp_Application* anApp = getApplication() ) { + myResult = anApp->getDirectory( myInitial, myCaption, myParent ); } } }; diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 4a5c18854..56161bd59 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -1384,6 +1384,15 @@ QString SalomeApp_Application::getDirectory( const QString& initial, const QStri return SUIT_FileDlg::getExistingDirectory( parent, initial, caption, true ); } +QStringList SalomeApp_Application::getOpenFileNames( const QString& initial, const QString& filters, + const QString& caption, QWidget* parent ) +{ + if ( !parent ) + parent = desktop(); + QStringList fls = QStringList::split( ";;", filters, false ); + return SUIT_FileDlg::getOpenFileNames( parent, initial, fls, caption, true ); +} + void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title ) { CAM_Application::contextMenuPopup( type, thePopup, title ); diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 266ef4f0d..0da12339c 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -78,7 +78,9 @@ public: virtual QString getFileFilter() const; virtual QString getFileName( bool open, const QString& initial, const QString& filters, const QString& caption, QWidget* parent ); - QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ); + virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ); + virtual QStringList getOpenFileNames( const QString& initial, const QString& filters, + const QString& caption, QWidget* parent ); SUIT_ViewManager* getViewManager( const QString&, const bool ); -- 2.39.2