aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-07-07 18:25:27 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-07-07 18:25:27 +0200
commit94fe42a945bc9a5e7091149eb43d90d77165d5a2 (patch)
tree3a37b816de19a30b88ae875985e3f57c19c1f5b3 /src/qt
parent3479849dc47acd2fb1e191ea690a0c507a97bb73 (diff)
Selection/tab navigation fixes
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/addressbookpage.cpp42
-rw-r--r--src/qt/addressbookpage.h1
-rw-r--r--src/qt/sendcoinsdialog.cpp10
-rw-r--r--src/qt/transactionview.cpp1
4 files changed, 28 insertions, 26 deletions
diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp
index 67ed0fecca..5127eb6009 100644
--- a/src/qt/addressbookpage.cpp
+++ b/src/qt/addressbookpage.cpp
@@ -19,7 +19,8 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
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:
@@ -34,6 +35,9 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
case ReceivingTab:
break;
}
+ ui->tableView->setTabKeyNavigation(false);
+
+ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
}
AddressBookPage::~AddressBookPage()
@@ -127,26 +131,6 @@ void AddressBookPage::on_deleteButton_clicked()
}
}
-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
@@ -177,5 +161,21 @@ void AddressBookPage::done(int retval)
// 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);
}
diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h
index f25bbc990b..c4039523af 100644
--- a/src/qt/addressbookpage.h
+++ b/src/qt/addressbookpage.h
@@ -47,7 +47,6 @@ private:
QTableView *getCurrentTable();
private slots:
- void on_buttonBox_accepted();
void on_deleteButton_clicked();
void on_newAddressButton_clicked();
void on_copyToClipboard_clicked();
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 8050baff38..2265f88cb0 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -113,11 +113,13 @@ void SendCoinsDialog::on_pasteButton_clicked()
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()
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index 037dfbb3ed..5a383da2b8 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -89,6 +89,7 @@ TransactionView::TransactionView(QWidget *parent) :
hlayout->addSpacing(width);
// Always show scroll bar
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+ view->setTabKeyNavigation(false);
transactionView = view;