diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index 051c3fb35..b6cec5baf 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -16,9 +16,6 @@ false - - 0 - This is a normal payment. @@ -33,20 +30,7 @@ 12 - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount - - - - + Pay &To: @@ -59,23 +43,7 @@ - - - - - - - &Label: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - addAsLabel - - - - + 0 @@ -85,9 +53,6 @@ The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) - - 34 - @@ -127,7 +92,7 @@ - Remove this recipient + Remove this entry @@ -140,13 +105,42 @@ - + + + + &Label: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + addAsLabel + + + + Enter a label for this address to add it to the list of used addresses + + + + A&mount: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + payAmount + + + + + + @@ -581,27 +575,7 @@ 12 - - - - Memo: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Amount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + Pay To: @@ -611,14 +585,7 @@ - - - - false - - - - + 0 @@ -626,15 +593,59 @@ + + + + Remove this entry + + + + + + + :/icons/remove:/icons/remove + + + - + + + + Memo: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + Qt::PlainText + + + + A&mount: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + payAmount_is + + + + + + + false + + + @@ -1096,27 +1107,7 @@ 12 - - - - Memo: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Amount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + Pay To: @@ -1126,14 +1117,7 @@ - - - - false - - - - + 0 @@ -1145,30 +1129,86 @@ + + + + Remove this entry + + + + + + + :/icons/remove:/icons/remove + + + - + + + + Memo: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + Qt::PlainText + + + + A&mount: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + payAmount_s + + + + + + + false + + + - - BitcoinAmountField - QLineEdit -
bitcoinamountfield.h
-
QValidatedLineEdit QLineEdit
qvalidatedlineedit.h
+ + BitcoinAmountField + QLineEdit +
bitcoinamountfield.h
+
+ + payTo + addressBookButton + pasteButton + deleteButton + addAsLabel + payAmount + payAmount_is + deleteButton_is + payAmount_s + deleteButton_s + diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index fa8da1c8d..6c3535b2f 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -227,8 +227,8 @@ void SendCoinsDialog::on_sendButton_clicked() alternativeUnits.append(BitcoinUnits::formatWithUnit(u, totalAmount)); } questionString.append(tr("Total Amount %1 (= %2)") - .arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)) - .arg(alternativeUnits.join(" "+tr("or")+" "))); + .arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)) + .arg(alternativeUnits.join(" " + tr("or") + " "))); QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"), questionString.arg(formatted.join("
")), @@ -264,9 +264,7 @@ void SendCoinsDialog::clear() } addEntry(); - updateRemoveEnabled(); - - ui->sendButton->setDefault(true); + updateTabsAndLabels(); } void SendCoinsDialog::reject() @@ -287,7 +285,7 @@ SendCoinsEntry *SendCoinsDialog::addEntry() connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*))); connect(entry, SIGNAL(payAmountChanged()), this, SLOT(coinControlUpdateLabels())); - updateRemoveEnabled(); + updateTabsAndLabels(); // Focus the field, so that entry can start immediately entry->clear(); @@ -300,27 +298,21 @@ SendCoinsEntry *SendCoinsDialog::addEntry() return entry; } -void SendCoinsDialog::updateRemoveEnabled() +void SendCoinsDialog::updateTabsAndLabels() { - // Remove buttons are enabled as soon as there is more than one send-entry - bool enabled = (ui->entries->count() > 1); - for(int i = 0; i < ui->entries->count(); ++i) - { - SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget()); - if(entry) - { - entry->setRemoveEnabled(enabled); - } - } setupTabChain(0); - coinControlUpdateLabels(); } void SendCoinsDialog::removeEntry(SendCoinsEntry* entry) { delete entry; - updateRemoveEnabled(); + + // If the last entry was removed add an empty one + if (!ui->entries->count()) + addEntry(); + + updateTabsAndLabels(); } QWidget *SendCoinsDialog::setupTabChain(QWidget *prev) @@ -379,7 +371,7 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv) } entry->setValue(rv); - coinControlUpdateLabels(); + updateTabsAndLabels(); } bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv) @@ -619,4 +611,3 @@ void SendCoinsDialog::coinControlUpdateLabels() ui->labelCoinControlInsuffFunds->hide(); } } - diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 4327e8e38..fcae26c72 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -46,7 +46,7 @@ public slots: void reject(); void accept(); SendCoinsEntry *addEntry(); - void updateRemoveEnabled(); + void updateTabsAndLabels(); void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance); private: diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 2641a66af..4be8bf9eb 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -75,15 +75,13 @@ void SendCoinsEntry::setModel(WalletModel *model) connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); connect(ui->payAmount, SIGNAL(textChanged()), this, SIGNAL(payAmountChanged())); + connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked())); + connect(ui->deleteButton_is, SIGNAL(clicked()), this, SLOT(deleteClicked())); + connect(ui->deleteButton_s, SIGNAL(clicked()), this, SLOT(deleteClicked())); clear(); } -void SendCoinsEntry::setRemoveEnabled(bool enabled) -{ - ui->deleteButton->setEnabled(enabled); -} - void SendCoinsEntry::clear() { // clear UI elements for normal payment @@ -105,7 +103,7 @@ void SendCoinsEntry::clear() updateDisplayUnit(); } -void SendCoinsEntry::on_deleteButton_clicked() +void SendCoinsEntry::deleteClicked() { emit removeEntry(this); } diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 1c4ddaa8e..2b696c77f 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -46,7 +46,6 @@ public: void setFocus(); public slots: - void setRemoveEnabled(bool enabled); void clear(); signals: @@ -54,7 +53,7 @@ signals: void payAmountChanged(); private slots: - void on_deleteButton_clicked(); + void deleteClicked(); void on_payTo_textChanged(const QString &address); void on_addressBookButton_clicked(); void on_pasteButton_clicked();