diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-08-04 21:31:47 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-08-04 21:36:14 +0200 |
commit | ffccb56914bd317c438bf055a32bc89dce690913 (patch) | |
tree | e57f81ab1256dddf6193215a0cf7ae2b9619de97 /src | |
parent | 2351a3fc9f32568a3e90b01f6d9ee9d0cc6b281e (diff) |
select new address immediately after creation
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/addressbookpage.cpp | 14 | ||||
-rw-r--r-- | src/qt/editaddressdialog.cpp | 11 | ||||
-rw-r--r-- | src/qt/editaddressdialog.h | 5 |
3 files changed, 24 insertions, 6 deletions
diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 063e510c30..a8ca635edd 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -116,7 +116,19 @@ void AddressBookPage::on_newAddressButton_clicked() 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() diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index a0b27e83bb..2b3d9bf0f0 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -54,9 +54,8 @@ void EditAddressDialog::loadRow(int row) mapper->setCurrentIndex(row); } -QString EditAddressDialog::saveCurrentRow() +bool EditAddressDialog::saveCurrentRow() { - QString address; switch(mode) { case NewReceivingAddress: @@ -74,12 +73,12 @@ QString EditAddressDialog::saveCurrentRow() } break; } - return address; + return !address.isEmpty(); } void EditAddressDialog::accept() { - if(saveCurrentRow().isEmpty()) + if(!saveCurrentRow()) { switch(model->getEditStatus()) { @@ -100,3 +99,7 @@ void EditAddressDialog::accept() QDialog::accept(); } +QString EditAddressDialog::getAddress() const +{ + return address; +} diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h index 6219961161..81086a45a8 100644 --- a/src/qt/editaddressdialog.h +++ b/src/qt/editaddressdialog.h @@ -32,13 +32,16 @@ public: void accept(); + QString getAddress() const; private: - QString saveCurrentRow(); + bool saveCurrentRow(); Ui::EditAddressDialog *ui; QDataWidgetMapper *mapper; Mode mode; AddressTableModel *model; + + QString address; }; #endif // EDITADDRESSDIALOG_H |