]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
You can now select folders in the input files list.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Thu, 21 Dec 2017 16:09:30 +0000 (17:09 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Thu, 21 Dec 2017 16:09:30 +0000 (17:09 +0100)
src/genericgui/BL_CreateJobWizard.cxx

index f14ade824e9c8abe9648135b34ac498407f557d1..ed7acdf37bb82313289dc1e59b5892cf5168cc95 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QFileDialog>
 #include <QMessageBox>
+#include <QTreeView>
 
 #ifndef WNT
 #include <unistd.h>
@@ -1095,13 +1096,29 @@ FilesPage::isComplete() const
 void
 FilesPage::choose_input_files()
 {
-  QStringList files = QFileDialog::getOpenFileNames(this,
-                                                    tr("Add input files"), "",
-                                                    tr("All Files (*)"));
-  for (int i = 0; i < files.size(); ++i) 
+  // We need to be able to select both files and folders.
+  // Standard QFileDialog cannot do it.
+  QFileDialog w(this, tr("Select input files"),
+              "", tr("All files and folders(*)")) ;
+  w.setOption(QFileDialog::DontUseNativeDialog,true);
+  QListView *l = w.findChild<QListView*>("listView");
+  if (l)
+  {
+    l->setSelectionMode(QAbstractItemView::MultiSelection);
+  }
+  QTreeView *t = w.findChild<QTreeView*>();
+  if (t)
   {
-    if (ui->input_files_list->findItems(files.at(i), Qt::MatchFixedString).size() == 0)
-      ui->input_files_list->addItem(files.at(i));
+    t->setSelectionMode(QAbstractItemView::MultiSelection);
+  }
+  if(w.exec())
+  {
+    QStringList files = w.selectedFiles();
+    for (int i = 0; i < files.size(); ++i)
+    {
+      if (ui->input_files_list->findItems(files.at(i), Qt::MatchFixedString).size() == 0)
+        ui->input_files_list->addItem(files.at(i));
+    }
   }
 }