diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-10 20:06:59 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-10 20:06:59 +0200 |
commit | c30075142f72058bd55d96057377e31a96e32b79 (patch) | |
tree | 01bfcbdd57ae31594813a8d24bf059e75d44c22a | |
parent | 66d536ed0765c6369738c2b35dd528dac3f5ee67 (diff) |
address book edit: edit the right row
-rw-r--r-- | gui/src/addressbookdialog.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gui/src/addressbookdialog.cpp b/gui/src/addressbookdialog.cpp index eaab66a202..90950a6441 100644 --- a/gui/src/addressbookdialog.cpp +++ b/gui/src/addressbookdialog.cpp @@ -82,7 +82,7 @@ void AddressBookDialog::on_copyToClipboard_clicked() foreach (QModelIndex index, indexes) { - QVariant address = table->model()->data(index); + QVariant address = index.data(); QApplication::clipboard()->setText(address.toString()); } } @@ -94,6 +94,9 @@ void AddressBookDialog::on_editButton_clicked() { return; } + /* Map selected index to source address book model */ + QAbstractProxyModel *proxy_model = static_cast<QAbstractProxyModel*>(getCurrentTable()->model()); + QModelIndex selected = proxy_model->mapToSource(indexes.at(0)); /* Double click also triggers edit button */ EditAddressDialog dlg( @@ -101,7 +104,7 @@ void AddressBookDialog::on_editButton_clicked() EditAddressDialog::EditSendingAddress : EditAddressDialog::EditReceivingAddress); dlg.setModel(model); - dlg.loadRow(indexes.at(0).row()); + dlg.loadRow(selected.row()); if(dlg.exec()) { dlg.saveCurrentRow(); |