diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-13 12:07:32 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-06-13 12:07:32 +0200 |
commit | e83474f2ebbae84394f0b86cfea977d3024bd33f (patch) | |
tree | 79beb7a74419dcf099df5f4bb03d0c780c6a1c49 /src/qt | |
parent | 249300aebe682dc1a7398794b14f0d6ebde0aee7 (diff) |
Address book: select action (edit/select) based on context
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/addressbookdialog.cpp | 16 | ||||
-rw-r--r-- | src/qt/addressbookdialog.h | 15 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 4 | ||||
-rw-r--r-- | src/qt/forms/addressbookdialog.ui | 37 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 2 |
5 files changed, 30 insertions, 44 deletions
diff --git a/src/qt/addressbookdialog.cpp b/src/qt/addressbookdialog.cpp index 90950a6441..c716cd3eea 100644 --- a/src/qt/addressbookdialog.cpp +++ b/src/qt/addressbookdialog.cpp @@ -8,12 +8,24 @@ #include <QClipboard> #include <QDebug> -AddressBookDialog::AddressBookDialog(QWidget *parent) : +AddressBookDialog::AddressBookDialog(Mode mode, QWidget *parent) : QDialog(parent), ui(new Ui::AddressBookDialog), model(0) { ui->setupUi(this); + + switch(mode) + { + case ForSending: + connect(ui->receiveTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_buttonBox_accepted())); + connect(ui->sendTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_buttonBox_accepted())); + break; + case ForEditing: + connect(ui->receiveTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_editButton_clicked())); + connect(ui->sendTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_editButton_clicked())); + break; + } } AddressBookDialog::~AddressBookDialog() @@ -126,6 +138,7 @@ void AddressBookDialog::on_newAddressButton_clicked() void AddressBookDialog::on_tabWidget_currentChanged(int index) { + // Enable/disable buttons based on selected tab switch(index) { case SendingTab: @@ -166,3 +179,4 @@ void AddressBookDialog::on_buttonBox_accepted() reject(); } } + diff --git a/src/qt/addressbookdialog.h b/src/qt/addressbookdialog.h index bf7c2a65a6..25b8839cd6 100644 --- a/src/qt/addressbookdialog.h +++ b/src/qt/addressbookdialog.h @@ -17,13 +17,18 @@ class AddressBookDialog : public QDialog Q_OBJECT public: - explicit AddressBookDialog(QWidget *parent = 0); - ~AddressBookDialog(); - - enum { + enum Tabs { SendingTab = 0, ReceivingTab = 1 - } Tabs; + }; + + enum Mode { + ForSending, // Pick address for sending + ForEditing // Open address book for editing + }; + + explicit AddressBookDialog(Mode mode, QWidget *parent = 0); + ~AddressBookDialog(); void setModel(AddressTableModel *model); void setTab(int tab); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 3a24c76ab4..05ac66fe1b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -285,7 +285,7 @@ void BitcoinGUI::sendcoinsClicked() void BitcoinGUI::addressbookClicked() { - AddressBookDialog dlg; + AddressBookDialog dlg(AddressBookDialog::ForEditing); dlg.setModel(model->getAddressTableModel()); dlg.setTab(AddressBookDialog::SendingTab); dlg.exec(); @@ -293,7 +293,7 @@ void BitcoinGUI::addressbookClicked() void BitcoinGUI::receivingAddressesClicked() { - AddressBookDialog dlg; + AddressBookDialog dlg(AddressBookDialog::ForEditing); dlg.setModel(model->getAddressTableModel()); dlg.setTab(AddressBookDialog::ReceivingTab); dlg.exec(); diff --git a/src/qt/forms/addressbookdialog.ui b/src/qt/forms/addressbookdialog.ui index 2b3c69fb97..2fc6ca785c 100644 --- a/src/qt/forms/addressbookdialog.ui +++ b/src/qt/forms/addressbookdialog.ui @@ -17,7 +17,7 @@ <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="sendTab"> <property name="toolTip"> @@ -159,38 +159,5 @@ </layout> </widget> <resources/> - <connections> - <connection> - <sender>receiveTableView</sender> - <signal>doubleClicked(QModelIndex)</signal> - <receiver>editButton</receiver> - <slot>click()</slot> - <hints> - <hint type="sourcelabel"> - <x>334</x> - <y>249</y> - </hint> - <hint type="destinationlabel"> - <x>333</x> - <y>326</y> - </hint> - </hints> - </connection> - <connection> - <sender>sendTableView</sender> - <signal>doubleClicked(QModelIndex)</signal> - <receiver>editButton</receiver> - <slot>click()</slot> - <hints> - <hint type="sourcelabel"> - <x>329</x> - <y>261</y> - </hint> - <hint type="destinationlabel"> - <x>332</x> - <y>326</y> - </hint> - </hints> - </connection> - </connections> + <connections/> </ui> diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 721ab14108..1c11944e2c 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -100,7 +100,7 @@ void SendCoinsDialog::on_pasteButton_clicked() void SendCoinsDialog::on_addressBookButton_clicked() { - AddressBookDialog dlg; + AddressBookDialog dlg(AddressBookDialog::ForSending); dlg.setModel(model->getAddressTableModel()); dlg.setTab(AddressBookDialog::SendingTab); dlg.exec(); |