diff --git a/application/mainwindow.cpp b/application/mainwindow.cpp
index fdd86ba..e7327da 100644
--- a/application/mainwindow.cpp
+++ b/application/mainwindow.cpp
@@ -178,3 +178,13 @@ void MainWindow::on_actionCountry_register_triggered()
}
}
+
+void MainWindow::on_actionAbout_Qt_triggered()
+{
+ QMessageBox::aboutQt(this);
+}
+
+void MainWindow::on_actionAbout_triggered()
+{
+ QMessageBox::about(this, tr("About prodejna"), tr("Modular cash register software under GPL license.\n(C) 2015 - 2017 Josef Rokos, Zdenek Jonák"));
+}
diff --git a/application/mainwindow.h b/application/mainwindow.h
index 543e84d..717f073 100644
--- a/application/mainwindow.h
+++ b/application/mainwindow.h
@@ -39,6 +39,10 @@ private slots:
void on_actionCountry_register_triggered();
+ void on_actionAbout_Qt_triggered();
+
+ void on_actionAbout_triggered();
+
private:
Ui::MainWindow *ui;
LoginDialog *m_loginDialog;
diff --git a/application/mainwindow.ui b/application/mainwindow.ui
index ce35d2f..886c2be 100644
--- a/application/mainwindow.ui
+++ b/application/mainwindow.ui
@@ -60,7 +60,7 @@
0
0
1000
- 20
+ 25
+
+
@@ -126,12 +134,22 @@
- Post register
+ &Post register
- Country register
+ &Country register
+
+
+
+
+ About
+
+
+
+
+ About Qt
diff --git a/camp/campform.ui b/camp/campform.ui
index 359af06..6a03d53 100644
--- a/camp/campform.ui
+++ b/camp/campform.ui
@@ -1,21 +1,19 @@
+
-
-
-
CampForm
0
0
- 400
- 300
+ 462
+ 403
Form
-
+
diff --git a/camp/settings/campsettingsform.cpp b/camp/settings/campsettingsform.cpp
index c4e43af..7cdd305 100644
--- a/camp/settings/campsettingsform.cpp
+++ b/camp/settings/campsettingsform.cpp
@@ -4,6 +4,7 @@
#include
#include
+#include
CampSettingsForm::CampSettingsForm(QWidget *parent) :
FormBinder(parent),
@@ -58,13 +59,47 @@ bool CampSettingsForm::saveRecord()
Service personSrv;
Service saleSrv;
+ bool ret = true;
+
+ connect(&personSrv, &IService::dbErrorDelete, [&ret, this](QString){
+ QMessageBox::critical(this, tr("Cannot delete"), tr("Price already used"));
+ ret = false;
+ });
foreach (PersonPricePtr p, personSrv.all()) {
- personSrv.erase(p);
+ bool found = false;
+ foreach (PersonPricePtr price, m_personPriceModel->list()) {
+ if (price->id() == p->id())
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ personSrv.erase(p);
+ }
}
foreach (PersonPricePtr p, m_personPriceModel->list()) {
- personSrv.save(p);
+ bool found = false;
+ foreach (PersonPricePtr price, personSrv.all()) {
+ if (price->id() == p->id())
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ personSrv.save(p);
+ }
+ else
+ {
+ personSrv.update(p);
+ }
}
foreach (SalePtr s, saleSrv.all()) {
@@ -75,7 +110,7 @@ bool CampSettingsForm::saveRecord()
saleSrv.save(s);
}
- return true;
+ return ret;
}
void CampSettingsForm::loadEntity()
diff --git a/core/gridform.h b/core/gridform.h
index 1823f25..2f833d4 100644
--- a/core/gridform.h
+++ b/core/gridform.h
@@ -173,7 +173,7 @@ private slots:
// IGridForm interface
protected:
- void handleNewRecord() override
+ virtual void handleNewRecord() override
{
if (m_form == NULL)
{
@@ -186,7 +186,7 @@ protected:
m_formHandler->showForm(m_form);
}
- void handleEditRecord() override
+ virtual void handleEditRecord() override
{
if (m_form == NULL || m_tableModel == NULL || tableView()->currentIndex().row() < 0)
{