diff options
| author | Calvin Morrison <calvin@pobox.com> | 2026-01-25 15:23:07 -0500 |
|---|---|---|
| committer | Calvin Morrison <calvin@pobox.com> | 2026-01-25 15:23:07 -0500 |
| commit | 2c204cd94e2d30aee136fbb0f14b64d5cc29b266 (patch) | |
| tree | 78bf415477414f129ff034423ed4319391d53f33 /cashflow.cpp | |
| parent | 9094e0ea4a49626188f79642bff22d57d6732899 (diff) | |
Diffstat (limited to 'cashflow.cpp')
| -rw-r--r-- | cashflow.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cashflow.cpp b/cashflow.cpp index 6df01a9..2af4319 100644 --- a/cashflow.cpp +++ b/cashflow.cpp @@ -2,6 +2,7 @@ #include "ui_cashflow.h" #include "settingsdialog.h" #include "multiselectcombobox.h" +#include "importdialog.h" #include <QMessageBox> #include <QDebug> #include <QDir> @@ -188,6 +189,7 @@ void CashFlow::setupConnections() { connect(ui->actionNew, &QAction::triggered, this, &CashFlow::onNewFile); connect(ui->actionOpen, &QAction::triggered, this, &CashFlow::onOpenFile); connect(ui->actionSaveAs, &QAction::triggered, this, &CashFlow::onSaveAs); + connect(ui->actionImportCSV, &QAction::triggered, this, &CashFlow::onImportCSV); connect(ui->actionExportCSV, &QAction::triggered, this, &CashFlow::onExportCSV); connect(ui->actionQuit, &QAction::triggered, this, &CashFlow::onQuit); @@ -2031,6 +2033,18 @@ void CashFlow::onExportCSV() { QMessageBox::information(this, "Success", QString("Exported %1 rows to CSV.").arg(rowCount)); } +void CashFlow::onImportCSV() { + ImportDialog dialog(database, this); + if (dialog.exec() == QDialog::Accepted) { + QList<Transaction> imported = dialog.getImportedTransactions(); + for (const Transaction &t : imported) { + database->addTransaction(t); + } + refreshView(); + QMessageBox::information(this, "Success", QString("Imported %1 transactions.").arg(imported.size())); + } +} + void CashFlow::onQuit() { QApplication::quit(); } |
