Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsentry.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "sendcoinsentry.h" | #include <qt/forms/ui_sendcoinsentry.h> | ||||
#include "ui_sendcoinsentry.h" | #include <qt/sendcoinsentry.h> | ||||
#include "addressbookpage.h" | #include <config.h> | ||||
#include "addresstablemodel.h" | #include <qt/addressbookpage.h> | ||||
#include "config.h" | #include <qt/addresstablemodel.h> | ||||
#include "guiutil.h" | #include <qt/guiutil.h> | ||||
#include "optionsmodel.h" | #include <qt/optionsmodel.h> | ||||
#include "platformstyle.h" | #include <qt/platformstyle.h> | ||||
#include "walletmodel.h" | #include <qt/walletmodel.h> | ||||
#include <QApplication> | #include <QApplication> | ||||
#include <QClipboard> | #include <QClipboard> | ||||
SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, | SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, | ||||
QWidget *parent) | QWidget *parent) | ||||
: QStackedWidget(parent), ui(new Ui::SendCoinsEntry), model(0), | : QStackedWidget(parent), ui(new Ui::SendCoinsEntry), model(0), | ||||
platformStyle(_platformStyle) { | platformStyle(_platformStyle) { | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
void SendCoinsEntry::deleteClicked() { | void SendCoinsEntry::deleteClicked() { | ||||
Q_EMIT removeEntry(this); | Q_EMIT removeEntry(this); | ||||
} | } | ||||
void SendCoinsEntry::useAvailableBalanceClicked() { | void SendCoinsEntry::useAvailableBalanceClicked() { | ||||
Q_EMIT useAvailableBalance(this); | Q_EMIT useAvailableBalance(this); | ||||
} | } | ||||
bool SendCoinsEntry::validate() { | bool SendCoinsEntry::validate(interfaces::Node &node) { | ||||
if (!model) { | if (!model) { | ||||
return false; | return false; | ||||
} | } | ||||
// Check input validity | // Check input validity | ||||
bool retval = true; | bool retval = true; | ||||
// Skip checks for payment request | // Skip checks for payment request | ||||
Show All 12 Lines | bool SendCoinsEntry::validate(interfaces::Node &node) { | ||||
// Sending a zero amount is invalid | // Sending a zero amount is invalid | ||||
if (ui->payAmount->value(0) <= Amount::zero()) { | if (ui->payAmount->value(0) <= Amount::zero()) { | ||||
ui->payAmount->setValid(false); | ui->payAmount->setValid(false); | ||||
retval = false; | retval = false; | ||||
} | } | ||||
// Reject dust outputs: | // Reject dust outputs: | ||||
if (retval && GUIUtil::isDust(ui->payTo->text(), ui->payAmount->value(), | if (retval && | ||||
GUIUtil::isDust(node, ui->payTo->text(), ui->payAmount->value(), | |||||
model->getChainParams())) { | model->getChainParams())) { | ||||
ui->payAmount->setValid(false); | ui->payAmount->setValid(false); | ||||
retval = false; | retval = false; | ||||
} | } | ||||
return retval; | return retval; | ||||
} | } | ||||
SendCoinsRecipient SendCoinsEntry::getValue() { | SendCoinsRecipient SendCoinsEntry::getValue() { | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |