mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 19:49:28 +00:00
contacts: fill description on pay to
This commit is contained in:
parent
f58f8b66a5
commit
7c4bffe5dd
5 changed files with 11 additions and 6 deletions
|
@ -96,7 +96,8 @@ void ContactsWidget::copyName() {
|
||||||
void ContactsWidget::payTo() {
|
void ContactsWidget::payTo() {
|
||||||
QModelIndex index = ui->contacts->currentIndex();
|
QModelIndex index = ui->contacts->currentIndex();
|
||||||
QString address = index.model()->data(index.siblingAtColumn(AddressBookModel::Address), Qt::UserRole).toString();
|
QString address = index.model()->data(index.siblingAtColumn(AddressBookModel::Address), Qt::UserRole).toString();
|
||||||
emit fillAddress(address);
|
QString description = index.model()->data(index.siblingAtColumn(AddressBookModel::Description), Qt::UserRole).toString();
|
||||||
|
emit fill(address, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactsWidget::setShowFullAddresses(bool show) {
|
void ContactsWidget::setShowFullAddresses(bool show) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public slots:
|
||||||
void setSearchFilter(const QString &filter);
|
void setSearchFilter(const QString &filter);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fillAddress(QString &address);
|
void fill(QString &address, QString &description);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showHeaderMenu(const QPoint &position);
|
void showHeaderMenu(const QPoint &position);
|
||||||
|
|
|
@ -236,7 +236,9 @@ void MainWindow::initWidgets() {
|
||||||
m_historyWidget->setSearchText(text);
|
m_historyWidget->setSearchText(text);
|
||||||
ui->tabWidget->setCurrentIndex(this->findTab("History"));
|
ui->tabWidget->setCurrentIndex(this->findTab("History"));
|
||||||
});
|
});
|
||||||
connect(m_contactsWidget, &ContactsWidget::fillAddress, m_sendWidget, &SendWidget::fillAddress);
|
connect(m_contactsWidget, &ContactsWidget::fill, [this](const QString &address, const QString &description){
|
||||||
|
m_sendWidget->fill(address, description, 0, true);
|
||||||
|
});
|
||||||
|
|
||||||
// [Coins]
|
// [Coins]
|
||||||
m_coinsWidget = new CoinsWidget(m_wallet, this);
|
m_coinsWidget = new CoinsWidget(m_wallet, this);
|
||||||
|
|
|
@ -112,11 +112,13 @@ 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, bool overrideDescription) {
|
||||||
ui->lineAddress->setText(address);
|
ui->lineAddress->setText(address);
|
||||||
ui->lineAddress->moveCursor(QTextCursor::Start);
|
ui->lineAddress->moveCursor(QTextCursor::Start);
|
||||||
|
|
||||||
|
if (overrideDescription || ui->lineDescription->text().isEmpty()) {
|
||||||
ui->lineDescription->setText(description);
|
ui->lineDescription->setText(description);
|
||||||
|
}
|
||||||
|
|
||||||
if (amount > 0)
|
if (amount > 0)
|
||||||
ui->lineAmount->setText(QString::number(amount));
|
ui->lineAmount->setText(QString::number(amount));
|
||||||
|
|
|
@ -18,7 +18,7 @@ Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SendWidget(Wallet *wallet, QWidget *parent = nullptr);
|
explicit SendWidget(Wallet *wallet, QWidget *parent = nullptr);
|
||||||
void fill(const QString &address, const QString &description, double amount = 0);
|
void fill(const QString &address, const QString &description, double amount = 0, bool overrideDescription = true);
|
||||||
void fill(double amount);
|
void fill(double amount);
|
||||||
void clearFields();
|
void clearFields();
|
||||||
void payToMany();
|
void payToMany();
|
||||||
|
|
Loading…
Reference in a new issue