#include <QLocale>
#include <QDebug>
-#include "util.h"
-#include "base58.h"
-
SendCoinsDialog::SendCoinsDialog(QWidget *parent, const QString &address) :
QDialog(parent),
ui(new Ui::SendCoinsDialog),
ui->setupUi(this);
GUIUtil::setupAddressWidget(ui->payTo, this);
- GUIUtil::setupAmountWidget(ui->payAmount, this);
- /* Set initial address if provided */
+ // Set initial send-to address if provided
if(!address.isEmpty())
{
ui->payTo->setText(address);
{
bool valid;
QString payAmount = ui->payAmount->text();
+ QString label;
qint64 payAmountParsed;
- valid = ParseMoney(payAmount.toStdString(), payAmountParsed);
+ valid = GUIUtil::parseMoney(payAmount, &payAmountParsed);
if(!valid)
{
return;
}
- switch(model->sendCoins(ui->payTo->text(), payAmountParsed))
+ if(ui->addToAddressBook->isChecked())
+ {
+ // Add address to address book under label, if specified
+ label = ui->addAsLabel->text();
+ }
+
+ switch(model->sendCoins(ui->payTo->text(), payAmountParsed, label))
{
case ClientModel::InvalidAddress:
QMessageBox::warning(this, tr("Send Coins"),
case ClientModel::AmountWithFeeExceedsBalance:
QMessageBox::warning(this, tr("Send Coins"),
tr("Total exceeds your balance when the %1 transaction fee is included").
- arg(QString::fromStdString(FormatMoney(model->getOptionsModel()->getTransactionFee()))),
+ arg(GUIUtil::formatMoney(model->getOptionsModel()->getTransactionFee())),
QMessageBox::Ok, QMessageBox::Ok);
ui->payAmount->setFocus();
break;
void SendCoinsDialog::on_pasteButton_clicked()
{
- /* Paste text from clipboard into recipient field */
+ // Paste text from clipboard into recipient field
ui->payTo->setText(QApplication::clipboard()->text());
}
{
reject();
}
+
+void SendCoinsDialog::on_addToAddressBook_toggled(bool checked)
+{
+ ui->addAsLabel->setEnabled(checked);
+}