21 #include <QMessageBox>
23 #include <QTextDocument>
32 #ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
51 QAction *clipboardQuantityAction =
new QAction(tr(
"Copy quantity"),
this);
52 QAction *clipboardAmountAction =
new QAction(tr(
"Copy amount"),
this);
53 QAction *clipboardFeeAction =
new QAction(tr(
"Copy fee"),
this);
54 QAction *clipboardAfterFeeAction =
new QAction(tr(
"Copy after fee"),
this);
55 QAction *clipboardBytesAction =
new QAction(tr(
"Copy bytes"),
this);
56 QAction *clipboardPriorityAction =
new QAction(tr(
"Copy priority"),
this);
57 QAction *clipboardLowOutputAction =
new QAction(tr(
"Copy low output"),
this);
58 QAction *clipboardChangeAction =
new QAction(tr(
"Copy change"),
this);
85 for(
int i = 0; i <
ui->
entries->count(); ++i)
96 connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64, qint64, qint64)),
this, SLOT(
setBalance(qint64, qint64, qint64, qint64, qint64, qint64)));
118 QList<SendCoinsRecipient> recipients;
121 for(
int i = 0; i <
ui->
entries->count(); ++i)
128 recipients.append(entry->
getValue());
137 if(!valid || recipients.isEmpty())
143 QStringList formatted;
148 amount.append(
"</b>");
150 QString address =
"<span style='font-family: monospace;'>" + rcp.
address;
151 address.append(
"</span>");
153 QString recipientElement;
157 if(rcp.
label.length() > 0)
160 recipientElement.append(QString(
" (%1)").arg(address));
164 recipientElement = tr(
"%1 to %2").arg(amount, address);
173 recipientElement = tr(
"%1 to %2").arg(amount, address);
176 formatted.append(recipientElement);
208 QString questionString = tr(
"Are you sure you want to send?");
209 questionString.append(
"<br /><br />%1");
214 questionString.append(
"<hr /><span style='color:#aa0000;'>");
216 questionString.append(
"</span> ");
217 questionString.append(tr(
"added as transaction fee"));
221 questionString.append(
"<hr />");
223 QStringList alternativeUnits;
229 questionString.append(tr(
"Total Amount %1 (= %2)")
231 .arg(alternativeUnits.join(
" " + tr(
"or") +
" ")));
233 QMessageBox::StandardButton retval = QMessageBox::question(
this, tr(
"Confirm send coins"),
234 questionString.arg(formatted.join(
"<br />")),
235 QMessageBox::Yes | QMessageBox::Cancel,
236 QMessageBox::Cancel);
238 if(retval != QMessageBox::Yes)
263 ui->
entries->takeAt(0)->widget()->deleteLater();
294 qApp->processEvents();
297 bar->setSliderPosition(bar->maximum());
315 entry->deleteLater();
322 for(
int i = 0; i <
ui->
entries->count(); ++i)
382 QString strSendCoins = tr(
"Send Coins");
388 emit
message(strSendCoins, tr(
"Payment request expired"),
395 if (!address.IsValid()) {
396 emit
message(strSendCoins, tr(
"Invalid payment address %1").arg(rv.
address),
407 qint64 watchBalance, qint64 watchUnconfirmedBalance, qint64 watchImmatureBalance)
409 Q_UNUSED(unconfirmedBalance);
410 Q_UNUSED(immatureBalance);
411 Q_UNUSED(watchBalance);
412 Q_UNUSED(watchUnconfirmedBalance);
413 Q_UNUSED(watchImmatureBalance);
428 QPair<QString, CClientUIInterface::MessageBoxFlags> msgParams;
435 switch(sendCoinsReturn.
status)
438 msgParams.first = tr(
"The recipient address is not valid, please recheck.");
441 msgParams.first = tr(
"The amount to pay must be larger than 0.");
444 msgParams.first = tr(
"The amount exceeds your balance.");
447 msgParams.first = tr(
"The total exceeds your balance when the %1 transaction fee is included.").arg(msgArg);
450 msgParams.first = tr(
"Duplicate address found, can only send to each address once per send operation.");
453 msgParams.first = tr(
"Transaction creation failed!");
457 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.");
466 emit
message(tr(
"Send Coins"), msgParams.first, msgParams.second);
522 if (!checked &&
model)
541 if (state == Qt::Unchecked)
587 if (!associatedLabel.isEmpty())
606 for(
int i = 0; i <
ui->
entries->count(); ++i)
QLabel * labelCoinControlChange
void removeEntry(SendCoinsEntry *entry)
QLabel * labelCoinControlAmount
static QList< Unit > availableUnits()
Get list of units, for drop-down box.
void setValue(const SendCoinsRecipient &value)
PaymentRequestPlus paymentRequest
bool IsInitialized() const
void coinControlClipboardPriority()
qint64 getImmatureBalance() const
static CCoinControl * coinControl
QLabel * labelCoinControlPriority
SendCoinsRecipient getValue()
static QString formatWithUnit(int unit, qint64 amount, bool plussign=false)
Format as string (with unit)
QWidget * widgetCoinControl
UnlockContext requestUnlock()
QPushButton * clearButton
SendCoinsDialog(QWidget *parent=0)
void coinControlClipboardQuantity()
void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance, qint64 watchOnlyBalance, qint64 watchUnconfBalance, qint64 watchImmatureBalance)
void coinControlClipboardAfterFee()
void setAddress(const QString &address)
QLabel * labelCoinControlFee
qint64 getTransactionFee()
QValidatedLineEdit * lineEditCoinControlChange
CTxDestination Get() const
qint64 getWatchUnconfirmedBalance() const
inline::google::protobuf::uint64 expires() const
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
bool GetKeyID(CKeyID &keyID) const
QString HtmlEscape(const QString &str, bool fMultiLine)
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
QLabel * labelCoinControlAfterFee
AddressTableModel * getAddressTableModel()
QLabel * labelCoinControlQuantity
A single entry in the dialog for sending anoncoins.
QLabel * labelCoinControlLowOutput
QPushButton * pushButtonCoinControl
QLabel * labelCoinControlAutomaticallySelected
void coinControlFeatureChanged(bool)
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)
qint64 getWatchImmatureBalance() const
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
base58-encoded Anoncoin addresses.
Dialog for sending anoncoins.
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
void setModel(WalletModel *model)
QString labelForAddress(const QString &address) const
void updateTabsAndLabels()
Interface to Anoncoin 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()
qint64 getWatchBalance() const
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 coinControlChangeChecked(int)