|
|
|
@ -40,6 +40,24 @@ MainWindow::MainWindow()
|
|
|
|
|
setSaleModel(); |
|
|
|
|
|
|
|
|
|
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::quit); |
|
|
|
|
connect(ui_.newAction, &QAction::triggered, this, [=]() { |
|
|
|
|
if (marketplace_->getSellers().size() == 0 && marketplace_->getSales().size() == 0) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
auto dlgResult = |
|
|
|
|
QMessageBox(QMessageBox::Icon::Warning, "Sind Sie sicher?", |
|
|
|
|
"Möchten Sie wirklich alle gespeicherten Daten verwerfen?", |
|
|
|
|
QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, this) |
|
|
|
|
.exec(); |
|
|
|
|
|
|
|
|
|
if (dlgResult == QMessageBox::No) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
delete ui_.salesView->model(); |
|
|
|
|
dynamic_cast<BasketModel*>(ui_.basketView->model())->cancelSale(); |
|
|
|
|
marketplace_->clear(); |
|
|
|
|
setSaleModel(); |
|
|
|
|
}); |
|
|
|
|
connect(ui_.actionEditSeller, &QAction::triggered, this, |
|
|
|
|
&MainWindow::onActionEditSellerTriggered); |
|
|
|
|
connect(ui_.sellerNoEdit, &QLineEdit::returnPressed, this, |
|
|
|
@ -61,7 +79,9 @@ MainWindow::MainWindow()
|
|
|
|
|
auto locations = QStandardPaths::standardLocations(QStandardPaths::DataLocation); |
|
|
|
|
for (auto location : locations) { |
|
|
|
|
if (QFile::exists(location + QString("/Benutzerhandbuch.pdf"))) { |
|
|
|
|
QDesktopServices::openUrl(QUrl(QString("file:///") + location + QString("/Benutzerhandbuch.pdf"), QUrl::TolerantMode)); |
|
|
|
|
QDesktopServices::openUrl( |
|
|
|
|
QUrl(QString("file:///") + location + QString("/Benutzerhandbuch.pdf"), |
|
|
|
|
QUrl::TolerantMode)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -298,6 +318,9 @@ void MainWindow::onImportSellerExcelActionTriggered()
|
|
|
|
|
auto filename = QFileDialog::getOpenFileName(this, "Verkäufer importieren", QString(), |
|
|
|
|
"Excel Dateien (*.xlsx *.xls)"); |
|
|
|
|
|
|
|
|
|
if (filename.isEmpty()) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
ExcelReader::readSellersFromFile(filename.toStdString(), marketplace_.get()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|