Merge branch 'master' of https://git.bukova.info/repos/git/prodejna
This commit is contained in:
@@ -45,15 +45,9 @@ ReceiptSaveForm::ReceiptSaveForm(QSharedPointer<Voucher> voucher, QWidget *paren
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty());
|
||||
});
|
||||
|
||||
m_binder.setData(new Voucher);
|
||||
AddressBookService srvAdb;
|
||||
QList<ComboData> comboData;
|
||||
foreach (QSharedPointer<AddressbookData> adb, srvAdb.all()) {
|
||||
comboData << ComboData(adb);
|
||||
}
|
||||
|
||||
m_voucher = voucher;
|
||||
m_binder.setData(m_voucher.data());
|
||||
m_binder.registerBinding(ui->contact, comboData);
|
||||
m_binder.registerBinding(ui->contact, ComboData::createComboData(srvAdb.all()));
|
||||
m_binder.registerBinding(ui->name);
|
||||
m_binder.registerBinding(ui->description);
|
||||
m_binder.bindToUi();
|
||||
@@ -106,27 +100,3 @@ void ReceiptSaveForm::on_radioAdd_toggled(bool checked)
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!ui->name->text().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
void ReceiptSaveForm::accept()
|
||||
{
|
||||
ShopService srv;
|
||||
m_binder.bindToData();
|
||||
if (m_saveAsNew)
|
||||
{
|
||||
m_voucher->setStatus(Voucher::NOT_PAID);
|
||||
srv.updateVoucher(m_voucher);
|
||||
}
|
||||
else
|
||||
{
|
||||
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(ui->tabVouchers->currentIndex());
|
||||
foreach (QSharedPointer<VoucherItem> item, m_voucher->items()) {
|
||||
voucher->addItem(item);
|
||||
}
|
||||
|
||||
srv.calculate(voucher);
|
||||
srv.updateVoucher(voucher);
|
||||
srv.erase(m_voucher);
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user