diff --git a/shop/shopform.cpp b/shop/shopform.cpp index e2cc34a..a6c74bf 100644 --- a/shop/shopform.cpp +++ b/shop/shopform.cpp @@ -15,6 +15,9 @@ ShopForm::ShopForm(QWidget *parent) : { ui->setupUi(this); m_itemsModel = NULL; + + ui->temporarySaveButton->setEnabled(false); + ui->saveButton->setEnabled(false); } ShopForm::~ShopForm() @@ -43,6 +46,8 @@ void ShopForm::loadLast() connectItemSignals(); ui->total->setText(QString::number(m_voucher->totalPrice().toDouble(), 'f', 2)); + ui->temporarySaveButton->setEnabled(true); + ui->saveButton->setEnabled(true); } } @@ -119,6 +124,8 @@ void ShopForm::onCountChanged() ShopService srv; srv.calculate(m_voucher); ui->total->setText(QString::number(m_voucher->totalPrice().toDouble(), 'f', 2)); + ui->temporarySaveButton->setEnabled(!m_voucher->items().isEmpty()); + ui->saveButton->setEnabled(!m_voucher->items().isEmpty()); if (m_voucher->status() == Voucher::NEW && m_voucher->id() == 0) { @@ -158,6 +165,8 @@ void ShopForm::doTempSave(bool comboChanged) { m_voucher = srv.createVoucher(); ui->total->setText("0"); + ui->temporarySaveButton->setEnabled(false); + ui->saveButton->setEnabled(false); } fillRaceiptCombo(); @@ -181,6 +190,9 @@ void ShopForm::changeReceipt() m_itemsModel->setData(m_voucher->items()); ui->total->setText(m_voucher->totalPrice().toString()); + ui->temporarySaveButton->setEnabled(true); + ui->saveButton->setEnabled(true); + fillRaceiptCombo(); }