Mercurial > hg > bitcoin
changeset 1251:3d004b475420 draft
select new address immediately after creation
author | Wladimir J. van der Laan <laanwj@gmail.com> |
---|---|
date | Thu, 04 Aug 2011 21:31:47 +0200 |
parents | 0574aa6d8add |
children | 3263a457d299 |
files | src/qt/addressbookpage.cpp src/qt/editaddressdialog.cpp src/qt/editaddressdialog.h |
diffstat | 3 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -116,7 +116,19 @@ EditAddressDialog::NewSendingAddress : EditAddressDialog::NewReceivingAddress); dlg.setModel(model); - dlg.exec(); + if(dlg.exec()) + { + // Select row for newly created address + QString address = dlg.getAddress(); + QModelIndexList lst = proxyModel->match(proxyModel->index(0, + AddressTableModel::Address, QModelIndex()), + Qt::EditRole, address, 1, Qt::MatchExactly); + if(!lst.isEmpty()) + { + ui->tableView->setFocus(); + ui->tableView->selectRow(lst.at(0).row()); + } + } } void AddressBookPage::on_deleteButton_clicked()
--- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -54,9 +54,8 @@ mapper->setCurrentIndex(row); } -QString EditAddressDialog::saveCurrentRow() +bool EditAddressDialog::saveCurrentRow() { - QString address; switch(mode) { case NewReceivingAddress: @@ -74,12 +73,12 @@ } break; } - return address; + return !address.isEmpty(); } void EditAddressDialog::accept() { - if(saveCurrentRow().isEmpty()) + if(!saveCurrentRow()) { switch(model->getEditStatus()) { @@ -100,3 +99,7 @@ QDialog::accept(); } +QString EditAddressDialog::getAddress() const +{ + return address; +}
--- a/src/qt/editaddressdialog.h +++ b/src/qt/editaddressdialog.h @@ -32,13 +32,16 @@ void accept(); + QString getAddress() const; private: - QString saveCurrentRow(); + bool saveCurrentRow(); Ui::EditAddressDialog *ui; QDataWidgetMapper *mapper; Mode mode; AddressTableModel *model; + + QString address; }; #endif // EDITADDRESSDIALOG_H