X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fsendcoinsdialog.cpp;h=8050baff38f20e5baefa773d82533a706e36076a;hb=3479849dc47acd2fb1e191ea690a0c507a97bb73;hp=5c889b2347638ce77a758a067c3699b680ad3a6e;hpb=ef079e183bf1be9f5a61a05018ee4480db86bc45;p=novacoin.git diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 5c889b2..8050baf 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -3,7 +3,7 @@ #include "walletmodel.h" #include "guiutil.h" -#include "addressbookdialog.h" +#include "addressbookpage.h" #include "optionsmodel.h" #include @@ -11,6 +11,7 @@ #include #include #include +#include SendCoinsDialog::SendCoinsDialog(QWidget *parent, const QString &address) : QDialog(parent), @@ -18,7 +19,9 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent, const QString &address) : model(0) { ui->setupUi(this); - +#if QT_VERSION >= 0x040700 + ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book")); +#endif GUIUtil::setupAddressWidget(ui->payTo, this); // Set initial send-to address if provided @@ -56,10 +59,17 @@ void SendCoinsDialog::on_sendButton_clicked() return; } - if(ui->addToAddressBook->isChecked()) + // Add address to address book under label, if specified + label = ui->addAsLabel->text(); + + QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"), + tr("Are you sure you want to send %1 BTC to %2 (%3)?").arg(GUIUtil::formatMoney(payAmountParsed), label, ui->payTo->text()), + QMessageBox::Yes|QMessageBox::Cancel, + QMessageBox::Cancel); + + if(retval != QMessageBox::Yes) { - // Add address to address book under label, if specified - label = ui->addAsLabel->text(); + return; } switch(model->sendCoins(ui->payTo->text(), payAmountParsed, label)) @@ -103,11 +113,11 @@ void SendCoinsDialog::on_pasteButton_clicked() void SendCoinsDialog::on_addressBookButton_clicked() { - AddressBookDialog dlg(AddressBookDialog::ForSending); + AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab); dlg.setModel(model->getAddressTableModel()); - dlg.setTab(AddressBookDialog::SendingTab); dlg.exec(); ui->payTo->setText(dlg.getReturnValue()); + ui->payAmount->setFocus(); } void SendCoinsDialog::on_buttonBox_rejected() @@ -115,7 +125,25 @@ void SendCoinsDialog::on_buttonBox_rejected() reject(); } -void SendCoinsDialog::on_addToAddressBook_toggled(bool checked) +void SendCoinsDialog::on_payTo_textChanged(const QString &address) +{ + ui->addAsLabel->setText(model->labelForAddress(address)); +} + +void SendCoinsDialog::clear() +{ + ui->payTo->setText(QString()); + ui->addAsLabel->setText(QString()); + ui->payAmount->setText(QString()); + ui->payTo->setFocus(); +} + +void SendCoinsDialog::reject() +{ + clear(); +} + +void SendCoinsDialog::accept() { - ui->addAsLabel->setEnabled(checked); + clear(); }