aboutsummaryrefslogtreecommitdiff
path: root/src/qt/sendcoinsdialog.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2013-11-22 13:53:05 +0100
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2013-11-24 16:30:14 +0100
commit84b695cc9d4dc90b1ccb99e2d92e1e76e138d911 (patch)
tree70576340fb9a7ff88c2448111ba032fa74565297 /src/qt/sendcoinsdialog.cpp
parentd4cda964d29e370a4b433334b7fe4dcd9fe8b0c6 (diff)
[Qt] allow deletion of payment-requests in sendcoins
- this adds a delete button for insecure and secure payment requests in the sendcoins dialog - it also enables the delete button even for single and empty entries, as this is much easier to handle and doesn't need to special case single entries - big parts of the ui file were changed, because I copied the delete button and had to delete the layout too and created it from scratch (which seems to cleanup the rows and colums in the layout also, which is nice IMHO)
Diffstat (limited to 'src/qt/sendcoinsdialog.cpp')
-rw-r--r--src/qt/sendcoinsdialog.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index fa8da1c8dd..6c3535b2fb 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("<br />")),
@@ -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<SendCoinsEntry*>(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();
}
}
-