Multi Directory import support. This may cause delays starting the import dialog on windows (again).

This commit is contained in:
Mark Watkins 2011-11-25 16:56:39 +10:00
parent a5a6bbf90f
commit 54fd38bf96

View File

@ -16,6 +16,7 @@
#include <QSettings>
#include <QPixmap>
#include <QDesktopWidget>
#include <QListView>
#include "mainwindow.h"
#include "ui_mainwindow.h"
@ -246,16 +247,34 @@ void MainWindow::on_action_Import_Data_triggered()
}
if (asknew) {
newdir=QFileDialog::getExistingDirectory(this,"Select a folder to import","",QFileDialog::ShowDirsOnly);
if (newdir.isEmpty()) {
// inform the user or just abort?
QFileDialog w;
w.setFileMode(QFileDialog::DirectoryOnly);
w.setOption(QFileDialog::DontUseNativeDialog,false);
QListView *l = w.findChild<QListView*>("listView");
if (l) {
l->setSelectionMode(QAbstractItemView::MultiSelection);
}
QTreeView *t = w.findChild<QTreeView*>();
if (t) {
t->setSelectionMode(QAbstractItemView::MultiSelection);
}
if (w.exec()!=QDialog::Accepted) {
return;
}
for (int i=0;i<w.selectedFiles().size();i++) {
QString newdir=w.selectedFiles().at(i);
if (!importLocations.contains(newdir)) {
importLocations.append(newdir);
addnew=true;
}
}
/*newdir=QFileDialog::getExistingDirectory(this,"Select a folder to import","",QFileDialog::ShowDirsOnly);
if (newdir.isEmpty()) {
// inform the user or just abort?
return;
} */
}
int successful=false;
for (int i=0;i<importLocations.size();i++) {