Skip to content

Commit 081c0cd

Browse files
committed
Merge pull request #3099 from laanwj/2013_10_new_receive_flow
qt: improve "receive coins" workflow
2 parents 48cc4fc + 70b1463 commit 081c0cd

29 files changed

+876
-667
lines changed

contrib/bitcoin-qt.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ FORMS += \
1111
../src/qt/forms/editaddressdialog.ui \
1212
../src/qt/forms/askpassphrasedialog.ui \
1313
../src/qt/forms/addressbookpage.ui \
14-
../src/qt/forms/aboutdialog.ui
14+
../src/qt/forms/aboutdialog.ui \
15+
../src/qt/forms/receivecoinsdialog.ui \
16+
../src/qt/forms/receiverequestdialog.ui
1517

1618
RESOURCES += \
1719
../src/qt/bitcoin.qrc

src/qt/Makefile.am

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ QT_TS = locale/bitcoin_ach.ts locale/bitcoin_af_ZA.ts locale/bitcoin_ar.ts \
3434

3535
QT_FORMS_UI = forms/aboutdialog.ui forms/addressbookpage.ui \
3636
forms/askpassphrasedialog.ui forms/editaddressdialog.ui forms/intro.ui \
37-
forms/optionsdialog.ui forms/overviewpage.ui forms/qrcodedialog.ui \
37+
forms/optionsdialog.ui forms/overviewpage.ui forms/receiverequestdialog.ui \
38+
forms/receivecoinsdialog.ui \
3839
forms/rpcconsole.ui forms/sendcoinsdialog.ui forms/sendcoinsentry.ui \
3940
forms/signverifymessagedialog.ui forms/transactiondescdialog.ui
4041

@@ -46,15 +47,15 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \
4647
moc_intro.cpp moc_macdockiconhandler.cpp moc_macnotificationhandler.cpp \
4748
moc_monitoreddatamapper.cpp moc_notificator.cpp moc_optionsdialog.cpp \
4849
moc_optionsmodel.cpp moc_overviewpage.cpp moc_paymentserver.cpp \
49-
moc_qrcodedialog.cpp moc_qvalidatedlineedit.cpp moc_qvaluecombobox.cpp \
50+
moc_receiverequestdialog.cpp moc_qvalidatedlineedit.cpp moc_qvaluecombobox.cpp \
51+
moc_receivecoinsdialog.cpp \
5052
moc_rpcconsole.cpp moc_sendcoinsdialog.cpp moc_sendcoinsentry.cpp \
5153
moc_signverifymessagedialog.cpp moc_splashscreen.cpp moc_trafficgraphwidget.cpp moc_transactiondesc.cpp \
5254
moc_transactiondescdialog.cpp moc_transactionfilterproxy.cpp \
5355
moc_transactiontablemodel.cpp moc_transactionview.cpp moc_walletframe.cpp \
5456
moc_walletmodel.cpp moc_walletview.cpp
5557

5658
BITCOIN_MM = macdockiconhandler.mm macnotificationhandler.mm
57-
QR_CPP = qrcodedialog.cpp
5859

5960
QT_MOC = intro.moc overviewpage.moc rpcconsole.moc
6061

@@ -71,7 +72,8 @@ BITCOIN_QT_H = aboutdialog.h addressbookpage.h addresstablemodel.h \
7172
editaddressdialog.h guiconstants.h guiutil.h intro.h macdockiconhandler.h \
7273
macnotificationhandler.h monitoreddatamapper.h notificator.h optionsdialog.h \
7374
optionsmodel.h overviewpage.h paymentrequestplus.h paymentserver.h \
74-
qrcodedialog.h qvalidatedlineedit.h qvaluecombobox.h rpcconsole.h \
75+
receivecoinsdialog.h \
76+
receiverequestdialog.h qvalidatedlineedit.h qvaluecombobox.h rpcconsole.h \
7577
sendcoinsdialog.h sendcoinsentry.h signverifymessagedialog.h splashscreen.h \
7678
trafficgraphwidget.h transactiondescdialog.h transactiondesc.h transactionfilterproxy.h \
7779
transactionrecord.h transactiontablemodel.h transactionview.h walletframe.h \
@@ -101,6 +103,7 @@ BITCOIN_QT_CPP = aboutdialog.cpp addressbookpage.cpp \
101103
guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \
102104
optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \
103105
paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \
106+
receivecoinsdialog.cpp receiverequestdialog.cpp \
104107
rpcconsole.cpp sendcoinsdialog.cpp sendcoinsentry.cpp \
105108
signverifymessagedialog.cpp splashscreen.cpp trafficgraphwidget.cpp transactiondesc.cpp \
106109
transactiondescdialog.cpp transactionfilterproxy.cpp transactionrecord.cpp \
@@ -135,9 +138,6 @@ endif
135138
if TARGET_WINDOWS
136139
libbitcoinqt_a_SOURCES += $(BITCOIN_RC)
137140
endif
138-
if USE_QRCODE
139-
libbitcoinqt_a_SOURCES += $(QR_CPP)
140-
endif
141141
#
142142

143143
# bitcoin-qt binary #
@@ -159,7 +159,7 @@ QT_QM=$(QT_TS:.ts=.qm)
159159
bitcoinstrings.cpp: FORCE
160160
$(MAKE) -C $(top_srcdir)/src qt/bitcoinstrings.cpp
161161

162-
translate: bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) $(QR_CPP)
162+
translate: bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
163163
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
164164
@$(LUPDATE) $^ -locations relative -no-obsolete -ts locale/bitcoin_en.ts
165165

src/qt/addressbookpage.cpp

Lines changed: 15 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
#include "csvmodelwriter.h"
1313
#include "guiutil.h"
1414

15-
#ifdef USE_QRCODE
16-
#include "qrcodedialog.h"
17-
#endif
18-
1915
#include <QSortFilterProxyModel>
2016
#include <QClipboard>
2117
#include <QMessageBox>
@@ -35,49 +31,47 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
3531
ui->newAddress->setIcon(QIcon());
3632
ui->copyAddress->setIcon(QIcon());
3733
ui->deleteAddress->setIcon(QIcon());
38-
ui->verifyMessage->setIcon(QIcon());
39-
ui->signMessage->setIcon(QIcon());
4034
ui->exportButton->setIcon(QIcon());
4135
#endif
4236

43-
#ifndef USE_QRCODE
44-
ui->showQRCode->setVisible(false);
45-
#endif
46-
4737
switch(mode)
4838
{
49-
case ForSending:
39+
case ForSelection:
40+
switch(tab)
41+
{
42+
case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break;
43+
case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break;
44+
}
5045
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
5146
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
5247
ui->tableView->setFocus();
48+
ui->closeButton->setText(tr("C&hoose"));
5349
ui->exportButton->hide();
5450
break;
5551
case ForEditing:
56-
ui->buttonBox->setVisible(false);
52+
switch(tab)
53+
{
54+
case SendingTab: setWindowTitle(tr("Sending addresses")); break;
55+
case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break;
56+
}
5757
break;
5858
}
5959
switch(tab)
6060
{
6161
case SendingTab:
6262
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins."));
6363
ui->deleteAddress->setVisible(true);
64-
ui->signMessage->setVisible(false);
6564
break;
6665
case ReceivingTab:
67-
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you."));
66+
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction."));
6867
ui->deleteAddress->setVisible(false);
69-
ui->signMessage->setVisible(true);
7068
break;
7169
}
7270

7371
// Context menu actions
7472
QAction *copyAddressAction = new QAction(ui->copyAddress->text(), this);
7573
QAction *copyLabelAction = new QAction(tr("Copy &Label"), this);
7674
QAction *editAction = new QAction(tr("&Edit"), this);
77-
QAction *sendCoinsAction = new QAction(tr("Send &Coins"), this);
78-
QAction *showQRCodeAction = new QAction(ui->showQRCode->text(), this);
79-
QAction *signMessageAction = new QAction(ui->signMessage->text(), this);
80-
QAction *verifyMessageAction = new QAction(ui->verifyMessage->text(), this);
8175
deleteAction = new QAction(ui->deleteAddress->text(), this);
8276

8377
// Build context menu
@@ -88,30 +82,16 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
8882
if(tab == SendingTab)
8983
contextMenu->addAction(deleteAction);
9084
contextMenu->addSeparator();
91-
if(tab == SendingTab)
92-
contextMenu->addAction(sendCoinsAction);
93-
#ifdef USE_QRCODE
94-
contextMenu->addAction(showQRCodeAction);
95-
#endif
96-
if(tab == ReceivingTab)
97-
contextMenu->addAction(signMessageAction);
98-
else if(tab == SendingTab)
99-
contextMenu->addAction(verifyMessageAction);
10085

10186
// Connect signals for context menu actions
10287
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyAddress_clicked()));
10388
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction()));
10489
connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction()));
10590
connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteAddress_clicked()));
106-
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(onSendCoinsAction()));
107-
connect(showQRCodeAction, SIGNAL(triggered()), this, SLOT(on_showQRCode_clicked()));
108-
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(on_signMessage_clicked()));
109-
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(on_verifyMessage_clicked()));
11091

11192
connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
11293

113-
// Pass through accept action from button box
114-
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
94+
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(accept()));
11595
}
11696

11797
AddressBookPage::~AddressBookPage()
@@ -197,42 +177,6 @@ void AddressBookPage::onEditAction()
197177
dlg.exec();
198178
}
199179

200-
void AddressBookPage::on_signMessage_clicked()
201-
{
202-
QTableView *table = ui->tableView;
203-
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
204-
205-
foreach (QModelIndex index, indexes)
206-
{
207-
QString address = index.data().toString();
208-
emit signMessage(address);
209-
}
210-
}
211-
212-
void AddressBookPage::on_verifyMessage_clicked()
213-
{
214-
QTableView *table = ui->tableView;
215-
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
216-
217-
foreach (QModelIndex index, indexes)
218-
{
219-
QString address = index.data().toString();
220-
emit verifyMessage(address);
221-
}
222-
}
223-
224-
void AddressBookPage::onSendCoinsAction()
225-
{
226-
QTableView *table = ui->tableView;
227-
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
228-
229-
foreach (QModelIndex index, indexes)
230-
{
231-
QString address = index.data().toString();
232-
emit sendCoins(address);
233-
}
234-
}
235-
236180
void AddressBookPage::on_newAddress_clicked()
237181
{
238182
if(!model)
@@ -278,32 +222,20 @@ void AddressBookPage::selectionChanged()
278222
ui->deleteAddress->setEnabled(true);
279223
ui->deleteAddress->setVisible(true);
280224
deleteAction->setEnabled(true);
281-
ui->signMessage->setEnabled(false);
282-
ui->signMessage->setVisible(false);
283-
ui->verifyMessage->setEnabled(true);
284-
ui->verifyMessage->setVisible(true);
285225
break;
286226
case ReceivingTab:
287227
// Deleting receiving addresses, however, is not allowed
288228
ui->deleteAddress->setEnabled(false);
289229
ui->deleteAddress->setVisible(false);
290230
deleteAction->setEnabled(false);
291-
ui->signMessage->setEnabled(true);
292-
ui->signMessage->setVisible(true);
293-
ui->verifyMessage->setEnabled(false);
294-
ui->verifyMessage->setVisible(false);
295231
break;
296232
}
297233
ui->copyAddress->setEnabled(true);
298-
ui->showQRCode->setEnabled(true);
299234
}
300235
else
301236
{
302237
ui->deleteAddress->setEnabled(false);
303-
ui->showQRCode->setEnabled(false);
304238
ui->copyAddress->setEnabled(false);
305-
ui->signMessage->setEnabled(false);
306-
ui->verifyMessage->setEnabled(false);
307239
}
308240
}
309241

@@ -312,9 +244,6 @@ void AddressBookPage::done(int retval)
312244
QTableView *table = ui->tableView;
313245
if(!table->selectionModel() || !table->model())
314246
return;
315-
// When this is a tab/widget and not a model dialog, ignore "done"
316-
if(mode == ForEditing)
317-
return;
318247

319248
// Figure out which address was selected, and return it
320249
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
@@ -339,7 +268,7 @@ void AddressBookPage::on_exportButton_clicked()
339268
// CSV is currently the only supported format
340269
QString filename = GUIUtil::getSaveFileName(
341270
this,
342-
tr("Export Address Book Data"), QString(),
271+
tr("Export Address List"), QString(),
343272
tr("Comma separated file (*.csv)"));
344273

345274
if (filename.isNull()) return;
@@ -358,25 +287,6 @@ void AddressBookPage::on_exportButton_clicked()
358287
}
359288
}
360289

361-
void AddressBookPage::on_showQRCode_clicked()
362-
{
363-
#ifdef USE_QRCODE
364-
QTableView *table = ui->tableView;
365-
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
366-
367-
foreach (QModelIndex index, indexes)
368-
{
369-
QString address = index.data().toString();
370-
QString label = index.sibling(index.row(), 0).data(Qt::EditRole).toString();
371-
372-
QRCodeDialog *dialog = new QRCodeDialog(address, label, tab == ReceivingTab, this);
373-
dialog->setModel(optionsModel);
374-
dialog->setAttribute(Qt::WA_DeleteOnClose);
375-
dialog->show();
376-
}
377-
#endif
378-
}
379-
380290
void AddressBookPage::contextualMenu(const QPoint &point)
381291
{
382292
QModelIndex index = ui->tableView->indexAt(point);

src/qt/addressbookpage.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AddressBookPage : public QDialog
3030
};
3131

3232
enum Mode {
33-
ForSending, /**< Open address book to pick address for sending */
33+
ForSelection, /**< Open address book to pick address */
3434
ForEditing /**< Open address book for editing */
3535
};
3636

@@ -63,14 +63,6 @@ private slots:
6363
void on_newAddress_clicked();
6464
/** Copy address of currently selected address entry to clipboard */
6565
void on_copyAddress_clicked();
66-
/** Open the sign message tab in the Sign/Verify Message dialog with currently selected address */
67-
void on_signMessage_clicked();
68-
/** Open the verify message tab in the Sign/Verify Message dialog with currently selected address */
69-
void on_verifyMessage_clicked();
70-
/** Open send coins dialog for currently selected address (no button) */
71-
void onSendCoinsAction();
72-
/** Generate a QR Code from the currently selected address */
73-
void on_showQRCode_clicked();
7466
/** Copy label of currently selected address entry to clipboard (no button) */
7567
void onCopyLabelAction();
7668
/** Edit currently selected address entry (no button) */
@@ -86,8 +78,6 @@ private slots:
8678
void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);
8779

8880
signals:
89-
void signMessage(QString addr);
90-
void verifyMessage(QString addr);
9181
void sendCoins(QString addr);
9282
};
9383

0 commit comments

Comments
 (0)