Send: focus amount field on fill

This commit is contained in:
tobtoht 2021-07-02 18:01:11 +02:00
parent a49a31ad86
commit a7333e5065
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
3 changed files with 7 additions and 10 deletions

View file

@ -885,8 +885,8 @@ void MainWindow::payToMany() {
"A maximum of 16 addresses may be specified."); "A maximum of 16 addresses may be specified.");
} }
void MainWindow::showSendScreen(const CCSEntry &entry) { void MainWindow::showSendScreen(const CCSEntry &entry) { // TODO: rename this function
m_sendWidget->fill(entry); m_sendWidget->fill(entry.address, QString("CCS: %1").arg(entry.title));
ui->tabWidget->setCurrentIndex(Tabs::SEND); ui->tabWidget->setCurrentIndex(Tabs::SEND);
} }

View file

@ -87,22 +87,20 @@ void SendWidget::amountEdited(const QString &text) {
this->updateConversionLabel(); 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) { void SendWidget::fill(double amount) {
ui->lineAmount->setText(QString::number(amount)); ui->lineAmount->setText(QString::number(amount));
} }
void SendWidget::fill(const QString &address, const QString &description, double amount) { void SendWidget::fill(const QString &address, const QString &description, double amount) {
ui->lineDescription->setText(description);
ui->lineAddress->setText(address); ui->lineAddress->setText(address);
ui->lineAddress->moveCursor(QTextCursor::Start); ui->lineAddress->moveCursor(QTextCursor::Start);
ui->lineDescription->setText(description);
if (amount > 0) if (amount > 0)
ui->lineAmount->setText(QString::number(amount)); ui->lineAmount->setText(QString::number(amount));
ui->lineAmount->setFocus();
this->updateConversionLabel(); this->updateConversionLabel();
} }

View file

@ -19,8 +19,7 @@ Q_OBJECT
public: public:
explicit SendWidget(QSharedPointer<AppContext> ctx, QWidget *parent = nullptr); explicit SendWidget(QSharedPointer<AppContext> 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 fill(double amount);
void clearFields(); void clearFields();
void payToMany(); void payToMany();