Changeset View
Changeset View
Standalone View
Standalone View
src/qt/receivecoinsdialog.cpp
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | |||||
ReceiveCoinsDialog::~ReceiveCoinsDialog() { | ReceiveCoinsDialog::~ReceiveCoinsDialog() { | ||||
delete ui; | delete ui; | ||||
} | } | ||||
void ReceiveCoinsDialog::clear() { | void ReceiveCoinsDialog::clear() { | ||||
ui->reqAmount->clear(); | ui->reqAmount->clear(); | ||||
ui->reqLabel->setText(""); | ui->reqLabel->setText(""); | ||||
ui->reqMessage->setText(""); | ui->reqMessage->setText(""); | ||||
ui->reuseAddress->setChecked(false); | |||||
updateDisplayUnit(); | updateDisplayUnit(); | ||||
} | } | ||||
void ReceiveCoinsDialog::reject() { | void ReceiveCoinsDialog::reject() { | ||||
clear(); | clear(); | ||||
} | } | ||||
void ReceiveCoinsDialog::accept() { | void ReceiveCoinsDialog::accept() { | ||||
Show All 9 Lines | |||||
void ReceiveCoinsDialog::on_receiveButton_clicked() { | void ReceiveCoinsDialog::on_receiveButton_clicked() { | ||||
if (!model || !model->getOptionsModel() || !model->getAddressTableModel() || | if (!model || !model->getOptionsModel() || !model->getAddressTableModel() || | ||||
!model->getRecentRequestsTableModel()) | !model->getRecentRequestsTableModel()) | ||||
return; | return; | ||||
QString address; | QString address; | ||||
QString label = ui->reqLabel->text(); | QString label = ui->reqLabel->text(); | ||||
if (ui->reuseAddress->isChecked()) { | |||||
/* Choose existing receiving address */ | |||||
AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection, | |||||
AddressBookPage::ReceivingTab, this); | |||||
dlg.setModel(model->getAddressTableModel()); | |||||
if (dlg.exec()) { | |||||
address = dlg.getReturnValue(); | |||||
// If no label provided, use the previously used label | |||||
if (label.isEmpty()) { | |||||
label = model->getAddressTableModel()->labelForAddress(address); | |||||
} | |||||
} else { | |||||
return; | |||||
} | |||||
} else { | |||||
/* Generate new receiving address */ | /* Generate new receiving address */ | ||||
address = model->getAddressTableModel()->addRow( | address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, | ||||
AddressTableModel::Receive, label, ""); | label, ""); | ||||
} | |||||
SendCoinsRecipient info(address, label, ui->reqAmount->value(), | SendCoinsRecipient info(address, label, ui->reqAmount->value(), | ||||
ui->reqMessage->text()); | ui->reqMessage->text()); | ||||
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(config, this); | ReceiveRequestDialog *dialog = new ReceiveRequestDialog(config, this); | ||||
dialog->setAttribute(Qt::WA_DeleteOnClose); | dialog->setAttribute(Qt::WA_DeleteOnClose); | ||||
dialog->setModel(model); | dialog->setModel(model); | ||||
dialog->setInfo(info); | dialog->setInfo(info); | ||||
dialog->show(); | dialog->show(); | ||||
clear(); | clear(); | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |