mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 11:39:25 +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() {
|
||||
QModelIndex index = ui->contacts->currentIndex();
|
||||
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) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public slots:
|
|||
void setSearchFilter(const QString &filter);
|
||||
|
||||
signals:
|
||||
void fillAddress(QString &address);
|
||||
void fill(QString &address, QString &description);
|
||||
|
||||
private slots:
|
||||
void showHeaderMenu(const QPoint &position);
|
||||
|
|
|
@ -236,7 +236,9 @@ void MainWindow::initWidgets() {
|
|||
m_historyWidget->setSearchText(text);
|
||||
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]
|
||||
m_coinsWidget = new CoinsWidget(m_wallet, this);
|
||||
|
|
|
@ -112,11 +112,13 @@ void SendWidget::fill(double 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->moveCursor(QTextCursor::Start);
|
||||
|
||||
ui->lineDescription->setText(description);
|
||||
if (overrideDescription || ui->lineDescription->text().isEmpty()) {
|
||||
ui->lineDescription->setText(description);
|
||||
}
|
||||
|
||||
if (amount > 0)
|
||||
ui->lineAmount->setText(QString::number(amount));
|
||||
|
|
|
@ -18,7 +18,7 @@ Q_OBJECT
|
|||
|
||||
public:
|
||||
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 clearFields();
|
||||
void payToMany();
|
||||
|
|
Loading…
Reference in a new issue