diff --git a/src/core/jsonutil.cpp b/src/core/jsonutil.cpp index dc7e4dc..873bb7b 100644 --- a/src/core/jsonutil.cpp +++ b/src/core/jsonutil.cpp @@ -25,7 +25,7 @@ void JsonUtil::exportSellers(const std::filesystem::path& filePath, Marketplace* file << root.dump(4) << std::endl; } -std::size_t JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market) +void JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market) { for (auto& seller : market->getSellers()) { seller->setState(Seller::State::DELETE); @@ -56,9 +56,8 @@ std::size_t JsonUtil::importSellers(const std::filesystem::path& filePath, Marke } market->sortSellers(); - market->storeToDb(); - return market->getSellers().size() - 1; // minus 1 because we don't count the "special" seller + market->storeToDb(); } void JsonUtil::exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo) diff --git a/src/core/jsonutil.h b/src/core/jsonutil.h index 4d06ace..3663dcc 100644 --- a/src/core/jsonutil.h +++ b/src/core/jsonutil.h @@ -10,7 +10,7 @@ class JsonUtil { public: static void exportSellers(const std::filesystem::path& filePath, Marketplace* market); - static std::size_t importSellers(const std::filesystem::path& filePath, Marketplace* market); + static void importSellers(const std::filesystem::path& filePath, Marketplace* market); static void exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo); static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo); }; diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 0df9658..a39fbbd 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -508,18 +508,8 @@ void MainWindow::onImportSellerJsonActionTriggered() fs::path filePath(filename.toStdString()); #endif - std::size_t numImported{}; - numImported = JsonUtil::importSellers(filePath, marketplace_.get()); - + JsonUtil::importSellers(filePath, marketplace_.get()); updateStatLabel(); - - using namespace std::string_literals; - std::ostringstream msg; - msg << "Aus der JSON-Datei wurden "s << std::to_string(numImported) - << " Verkäufer importiert."; - QMessageBox(QMessageBox::Icon::Information, "Verkäufer erfolgreich importiert", - msg.str().c_str(), QMessageBox::StandardButton::Ok, this) - .exec(); } void MainWindow::onExportSellerJsonActionTriggered() @@ -530,11 +520,7 @@ void MainWindow::onExportSellerJsonActionTriggered() if (filename.isEmpty()) return; -#if defined(_WIN64) || defined(_WIN32) fs::path filePath(filename.toStdWString()); -#else - fs::path filePath(filename.toStdString()); -#endif JsonUtil::exportSellers(filePath, marketplace_.get()); } diff --git a/src/gui/sellerdialog.cpp b/src/gui/sellerdialog.cpp index 9ecf63f..1c4ef97 100644 --- a/src/gui/sellerdialog.cpp +++ b/src/gui/sellerdialog.cpp @@ -60,8 +60,7 @@ void SellerDialog::on_deleteButton_clicked() auto dlgResult = QMessageBox(QMessageBox::Icon::Warning, "Sind Sie sicher?", - "Löschen wirkt sich sofort auf die Datenbank aus. Sie können den " - "Vorgang nicht rückgängig machen. Möchten Sie fortfahren?", + "Löschen wirkt sich direkt auf die Datenbank aus. Möchten Sie fortfahren?", QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, this) .exec(); if (dlgResult == QMessageBox::No)