From a7333e506562ba6a77ef5cffbb687d0c70081aa0 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 2 Jul 2021 18:01:11 +0200 Subject: [PATCH] Send: focus amount field on fill --- src/MainWindow.cpp | 4 ++-- src/SendWidget.cpp | 10 ++++------ src/SendWidget.h | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 703443c..920a318 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -885,8 +885,8 @@ void MainWindow::payToMany() { "A maximum of 16 addresses may be specified."); } -void MainWindow::showSendScreen(const CCSEntry &entry) { - m_sendWidget->fill(entry); +void MainWindow::showSendScreen(const CCSEntry &entry) { // TODO: rename this function + m_sendWidget->fill(entry.address, QString("CCS: %1").arg(entry.title)); ui->tabWidget->setCurrentIndex(Tabs::SEND); } diff --git a/src/SendWidget.cpp b/src/SendWidget.cpp index 32dbda0..1d24138 100644 --- a/src/SendWidget.cpp +++ b/src/SendWidget.cpp @@ -87,22 +87,20 @@ void SendWidget::amountEdited(const QString &text) { this->updateConversionLabel(); } -void SendWidget::fill(const CCSEntry &entry) { - this->fill(entry.address, QString("CCS: %1").arg(entry.title), 0.0); -} - void SendWidget::fill(double amount) { ui->lineAmount->setText(QString::number(amount)); } void SendWidget::fill(const QString &address, const QString &description, double amount) { - ui->lineDescription->setText(description); ui->lineAddress->setText(address); - ui->lineAddress->moveCursor(QTextCursor::Start); + ui->lineDescription->setText(description); + if (amount > 0) ui->lineAmount->setText(QString::number(amount)); + ui->lineAmount->setFocus(); + this->updateConversionLabel(); } diff --git a/src/SendWidget.h b/src/SendWidget.h index 3f340fc..7826318 100644 --- a/src/SendWidget.h +++ b/src/SendWidget.h @@ -19,8 +19,7 @@ Q_OBJECT public: explicit SendWidget(QSharedPointer ctx, QWidget *parent = nullptr); - void fill(const CCSEntry &entry); - void fill(const QString &address, const QString& description, double amount = 0); + void fill(const QString &address, const QString &description, double amount = 0); void fill(double amount); void clearFields(); void payToMany();