#include "importdialog.h" #include "ui_importdialog.h" #include #include #include #include #include "data/postdata.h" #include "postregister-odb.hxx" #include "importprogressform.h" ImportDialog::ImportDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ImportDialog) { ui->setupUi(this); } ImportDialog::~ImportDialog() { delete ui; } void ImportDialog::on_buttonBox_accepted() { QString fileName = ui->editFile->text(); Service service; PostData pd; CsvImporter importer(pd.metaObject()); importer.setImportFile(fileName); importer.setSeparator(ui->editSparator->text()); ImportProgressForm *progress = new ImportProgressForm(); progress->move(QApplication::desktop()->screen()->rect().center() - progress->rect().center()); progress->setWindowModality(Qt::ApplicationModal); progress->show(); service.importData(&importer, progress); } void ImportDialog::on_btnFile_clicked() { QString file = QFileDialog::getOpenFileName(this, tr("Import file"), "", tr("All Files (*.*)")); ui->editFile->setText(file); }