20 #include <QMessageBox>
22 #include <QTextDocument>
31 #ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
50 QAction *clipboardQuantityAction =
new QAction(tr(
"Copy quantity"),
this);
51 QAction *clipboardAmountAction =
new QAction(tr(
"Copy amount"),
this);
52 QAction *clipboardFeeAction =
new QAction(tr(
"Copy fee"),
this);
53 QAction *clipboardAfterFeeAction =
new QAction(tr(
"Copy after fee"),
this);
54 QAction *clipboardBytesAction =
new QAction(tr(
"Copy bytes"),
this);
55 QAction *clipboardPriorityAction =
new QAction(tr(
"Copy priority"),
this);
56 QAction *clipboardLowOutputAction =
new QAction(tr(
"Copy low output"),
this);
57 QAction *clipboardChangeAction =
new QAction(tr(
"Copy change"),
this);
84 for(
int i = 0; i <
ui->
entries->count(); ++i)
94 connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)),
this, SLOT(
setBalance(qint64, qint64, qint64)));
116 QList<SendCoinsRecipient> recipients;
119 for(
int i = 0; i <
ui->
entries->count(); ++i)
126 recipients.append(entry->
getValue());
135 if(!valid || recipients.isEmpty())
141 QStringList formatted;
146 amount.append(
"</b>");
148 QString address =
"<span style='font-family: monospace;'>" + rcp.
address;
149 address.append(
"</span>");
151 QString recipientElement;
155 if(rcp.
label.length() > 0)
158 recipientElement.append(QString(
" (%1)").arg(address));
162 recipientElement = tr(
"%1 to %2").arg(amount, address);
171 recipientElement = tr(
"%1 to %2").arg(amount, address);
174 formatted.append(recipientElement);
206 QString questionString = tr(
"Are you sure you want to send?");
207 questionString.append(
"<br /><br />%1");
212 questionString.append(
"<hr /><span style='color:#aa0000;'>");
214 questionString.append(
"</span> ");
215 questionString.append(tr(
"added as transaction fee"));
219 questionString.append(
"<hr />");
221 QStringList alternativeUnits;
227 questionString.append(tr(
"Total Amount %1 (= %2)")
229 .arg(alternativeUnits.join(
" " + tr(
"or") +
" ")));
231 QMessageBox::StandardButton retval = QMessageBox::question(
this, tr(
"Confirm send coins"),
232 questionString.arg(formatted.join(
"<br />")),
233 QMessageBox::Yes | QMessageBox::Cancel,
234 QMessageBox::Cancel);
236 if(retval != QMessageBox::Yes)
261 ui->
entries->takeAt(0)->widget()->deleteLater();
292 qApp->processEvents();
295 bar->setSliderPosition(bar->maximum());
313 entry->deleteLater();
320 for(
int i = 0; i <
ui->
entries->count(); ++i)
380 QString strSendCoins = tr(
"Send Coins");
386 emit
message(strSendCoins, tr(
"Payment request expired"),
393 if (!address.IsValid()) {
394 emit
message(strSendCoins, tr(
"Invalid payment address %1").arg(rv.
address),
406 Q_UNUSED(unconfirmedBalance);
407 Q_UNUSED(immatureBalance);
422 QPair<QString, CClientUIInterface::MessageBoxFlags> msgParams;
429 switch(sendCoinsReturn.
status)
432 msgParams.first = tr(
"The recipient address is not valid, please recheck.");
435 msgParams.first = tr(
"The amount to pay must be larger than 0.");
438 msgParams.first = tr(
"The amount exceeds your balance.");
441 msgParams.first = tr(
"The total exceeds your balance when the %1 transaction fee is included.").arg(msgArg);
444 msgParams.first = tr(
"Duplicate address found, can only send to each address once per send operation.");
447 msgParams.first = tr(
"Transaction creation failed!");
451 msgParams.first = tr(
"The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
460 emit
message(tr(
"Send Coins"), msgParams.first, msgParams.second);
516 if (!checked &&
model)
535 if (state == Qt::Unchecked)
581 if (!associatedLabel.isEmpty())
600 for(
int i = 0; i <
ui->
entries->count(); ++i)
QLabel * labelCoinControlChange
void removeEntry(SendCoinsEntry *entry)
QLabel * labelCoinControlAmount
void setValue(const SendCoinsRecipient &value)
PaymentRequestPlus paymentRequest
bool IsInitialized() const
static QString formatWithUnit(int unit, qint64 amount, bool plussign=false)
Format as string (with unit)
void coinControlClipboardPriority()
qint64 getImmatureBalance() const
static CCoinControl * coinControl
QLabel * labelCoinControlPriority
SendCoinsRecipient getValue()
QWidget * widgetCoinControl
UnlockContext requestUnlock()
QPushButton * clearButton
SendCoinsDialog(QWidget *parent=0)
void coinControlClipboardQuantity()
void coinControlClipboardAfterFee()
void setAddress(const QString &address)
QLabel * labelCoinControlFee
qint64 getTransactionFee()
QValidatedLineEdit * lineEditCoinControlChange
inline::google::protobuf::uint64 expires() const
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
QString HtmlEscape(const QString &str, bool fMultiLine)
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
base58-encoded Bitcoin addresses.
QLabel * labelCoinControlAfterFee
AddressTableModel * getAddressTableModel()
CTxDestination Get() const
QLabel * labelCoinControlQuantity
A single entry in the dialog for sending bitcoins.
QLabel * labelCoinControlLowOutput
QPushButton * pushButtonCoinControl
QLabel * labelCoinControlAutomaticallySelected
void coinControlFeatureChanged(bool)
bool GetKeyID(CKeyID &keyID) const
QWidget * setupTabChain(QWidget *prev)
Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://...
bool getCoinControlFeatures()
qint64 getTotalTransactionAmount()
QWidget * setupTabChain(QWidget *prev)
Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://...
void on_sendButton_clicked()
SendCoinsEntry * addEntry()
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
void setAddress(const QString &address)
void coinControlClipboardChange()
void setClipboard(const QString &str)
CTxDestination destChange
qint64 getUnconfirmedBalance() const
An encapsulated public key.
bool getPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
Dialog for sending bitcoins.
QCheckBox * checkBoxCoinControlChange
void coinControlChangeEdited(const QString &)
static void updateLabels(WalletModel *, QDialog *)
const payments::PaymentDetails & getDetails() const
void coinControlUpdateLabels()
void setModel(WalletModel *model)
void setupUi(QDialog *SendCoinsDialog)
bool isClear()
Return whether the entry is still empty and unedited.
void coinControlClipboardLowOutput()
QLabel * labelCoinControlChangeLabel
QWidget * scrollAreaWidgetContents
static QList< Unit > availableUnits()
Get list of units, for drop-down box.
void setModel(WalletModel *model)
QString labelForAddress(const QString &address) const
void updateTabsAndLabels()
Interface to Bitcoin wallet from Qt view code.
QLabel * labelCoinControlBytes
A reference to a CKey: the Hash160 of its serialized public key.
qint64 getBalance(const CCoinControl *coinControl=NULL) const
void setModel(WalletModel *model)
void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg=QString())
Data model for a walletmodel transaction.
static QList< qint64 > payAmounts
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const CCoinControl *coinControl=NULL)
void setEnabled(bool enabled)
void coinControlClipboardBytes()
QFrame * frameCoinControl
void coinControlClipboardAmount()
void pasteEntry(const SendCoinsRecipient &rv)
void message(const QString &title, const QString &message, unsigned int style)
QString authenticatedMerchant
bool fNewRecipientAllowed
void coinControlButtonClicked()
void coinControlClipboardFee()
OptionsModel * getOptionsModel()
QLabel * labelCoinControlInsuffFunds
void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)
void coinControlChangeChecked(int)