switch(mode)
{
case ForSending:
- connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_buttonBox_accepted()));
+ connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
+ ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setFocus();
break;
case ForEditing:
case ReceivingTab:
break;
}
+ ui->tableView->setTabKeyNavigation(false);
+
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
}
AddressBookPage::~AddressBookPage()
}
}
-void AddressBookPage::on_buttonBox_accepted()
-{
- QTableView *table = getCurrentTable();
- QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
-
- foreach (QModelIndex index, indexes)
- {
- QVariant address = table->model()->data(index);
- returnValue = address.toString();
- }
- if(!returnValue.isEmpty())
- {
- accept();
- }
- else
- {
- reject();
- }
-}
-
void AddressBookPage::selectionChanged()
{
// Set button states based on selected tab and selection
// When this is a tab/widget and not a model dialog, ignore "done"
if(mode == ForEditing)
return;
+
+ // Figure out which address was selected, and return it
+ QTableView *table = getCurrentTable();
+ QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
+
+ foreach (QModelIndex index, indexes)
+ {
+ QVariant address = table->model()->data(index);
+ returnValue = address.toString();
+ }
+
+ if(returnValue.isEmpty())
+ {
+ retval = Rejected;
+ }
+
QDialog::done(retval);
}
void SendCoinsDialog::on_addressBookButton_clicked()
{
- AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab);
+ AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel());
- dlg.exec();
- ui->payTo->setText(dlg.getReturnValue());
- ui->payAmount->setFocus();
+ if(dlg.exec())
+ {
+ ui->payTo->setText(dlg.getReturnValue());
+ ui->payAmount->setFocus();
+ }
}
void SendCoinsDialog::on_buttonBox_rejected()