Merge pull request #3099 from laanwj/2013_10_new_receive_flow

qt: improve "receive coins" workflow
This commit is contained in:
Wladimir J. van der Laan 2013-10-25 04:27:05 -07:00
commit 081c0cdeb2
29 changed files with 876 additions and 667 deletions

View File

@ -11,7 +11,9 @@ FORMS += \
../src/qt/forms/editaddressdialog.ui \ ../src/qt/forms/editaddressdialog.ui \
../src/qt/forms/askpassphrasedialog.ui \ ../src/qt/forms/askpassphrasedialog.ui \
../src/qt/forms/addressbookpage.ui \ ../src/qt/forms/addressbookpage.ui \
../src/qt/forms/aboutdialog.ui ../src/qt/forms/aboutdialog.ui \
../src/qt/forms/receivecoinsdialog.ui \
../src/qt/forms/receiverequestdialog.ui
RESOURCES += \ RESOURCES += \
../src/qt/bitcoin.qrc ../src/qt/bitcoin.qrc

View File

@ -34,7 +34,8 @@ QT_TS = locale/bitcoin_ach.ts locale/bitcoin_af_ZA.ts locale/bitcoin_ar.ts \
QT_FORMS_UI = forms/aboutdialog.ui forms/addressbookpage.ui \ QT_FORMS_UI = forms/aboutdialog.ui forms/addressbookpage.ui \
forms/askpassphrasedialog.ui forms/editaddressdialog.ui forms/intro.ui \ forms/askpassphrasedialog.ui forms/editaddressdialog.ui forms/intro.ui \
forms/optionsdialog.ui forms/overviewpage.ui forms/qrcodedialog.ui \ forms/optionsdialog.ui forms/overviewpage.ui forms/receiverequestdialog.ui \
forms/receivecoinsdialog.ui \
forms/rpcconsole.ui forms/sendcoinsdialog.ui forms/sendcoinsentry.ui \ forms/rpcconsole.ui forms/sendcoinsdialog.ui forms/sendcoinsentry.ui \
forms/signverifymessagedialog.ui forms/transactiondescdialog.ui forms/signverifymessagedialog.ui forms/transactiondescdialog.ui
@ -46,7 +47,8 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \
moc_intro.cpp moc_macdockiconhandler.cpp moc_macnotificationhandler.cpp \ moc_intro.cpp moc_macdockiconhandler.cpp moc_macnotificationhandler.cpp \
moc_monitoreddatamapper.cpp moc_notificator.cpp moc_optionsdialog.cpp \ moc_monitoreddatamapper.cpp moc_notificator.cpp moc_optionsdialog.cpp \
moc_optionsmodel.cpp moc_overviewpage.cpp moc_paymentserver.cpp \ moc_optionsmodel.cpp moc_overviewpage.cpp moc_paymentserver.cpp \
moc_qrcodedialog.cpp moc_qvalidatedlineedit.cpp moc_qvaluecombobox.cpp \ moc_receiverequestdialog.cpp moc_qvalidatedlineedit.cpp moc_qvaluecombobox.cpp \
moc_receivecoinsdialog.cpp \
moc_rpcconsole.cpp moc_sendcoinsdialog.cpp moc_sendcoinsentry.cpp \ moc_rpcconsole.cpp moc_sendcoinsdialog.cpp moc_sendcoinsentry.cpp \
moc_signverifymessagedialog.cpp moc_splashscreen.cpp moc_trafficgraphwidget.cpp moc_transactiondesc.cpp \ moc_signverifymessagedialog.cpp moc_splashscreen.cpp moc_trafficgraphwidget.cpp moc_transactiondesc.cpp \
moc_transactiondescdialog.cpp moc_transactionfilterproxy.cpp \ moc_transactiondescdialog.cpp moc_transactionfilterproxy.cpp \
@ -54,7 +56,6 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \
moc_walletmodel.cpp moc_walletview.cpp moc_walletmodel.cpp moc_walletview.cpp
BITCOIN_MM = macdockiconhandler.mm macnotificationhandler.mm BITCOIN_MM = macdockiconhandler.mm macnotificationhandler.mm
QR_CPP = qrcodedialog.cpp
QT_MOC = intro.moc overviewpage.moc rpcconsole.moc QT_MOC = intro.moc overviewpage.moc rpcconsole.moc
@ -71,7 +72,8 @@ BITCOIN_QT_H = aboutdialog.h addressbookpage.h addresstablemodel.h \
editaddressdialog.h guiconstants.h guiutil.h intro.h macdockiconhandler.h \ editaddressdialog.h guiconstants.h guiutil.h intro.h macdockiconhandler.h \
macnotificationhandler.h monitoreddatamapper.h notificator.h optionsdialog.h \ macnotificationhandler.h monitoreddatamapper.h notificator.h optionsdialog.h \
optionsmodel.h overviewpage.h paymentrequestplus.h paymentserver.h \ optionsmodel.h overviewpage.h paymentrequestplus.h paymentserver.h \
qrcodedialog.h qvalidatedlineedit.h qvaluecombobox.h rpcconsole.h \ receivecoinsdialog.h \
receiverequestdialog.h qvalidatedlineedit.h qvaluecombobox.h rpcconsole.h \
sendcoinsdialog.h sendcoinsentry.h signverifymessagedialog.h splashscreen.h \ sendcoinsdialog.h sendcoinsentry.h signverifymessagedialog.h splashscreen.h \
trafficgraphwidget.h transactiondescdialog.h transactiondesc.h transactionfilterproxy.h \ trafficgraphwidget.h transactiondescdialog.h transactiondesc.h transactionfilterproxy.h \
transactionrecord.h transactiontablemodel.h transactionview.h walletframe.h \ transactionrecord.h transactiontablemodel.h transactionview.h walletframe.h \
@ -101,6 +103,7 @@ BITCOIN_QT_CPP = aboutdialog.cpp addressbookpage.cpp \
guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \ guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \
optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \ optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \
paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \ paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \
receivecoinsdialog.cpp receiverequestdialog.cpp \
rpcconsole.cpp sendcoinsdialog.cpp sendcoinsentry.cpp \ rpcconsole.cpp sendcoinsdialog.cpp sendcoinsentry.cpp \
signverifymessagedialog.cpp splashscreen.cpp trafficgraphwidget.cpp transactiondesc.cpp \ signverifymessagedialog.cpp splashscreen.cpp trafficgraphwidget.cpp transactiondesc.cpp \
transactiondescdialog.cpp transactionfilterproxy.cpp transactionrecord.cpp \ transactiondescdialog.cpp transactionfilterproxy.cpp transactionrecord.cpp \
@ -135,9 +138,6 @@ endif
if TARGET_WINDOWS if TARGET_WINDOWS
libbitcoinqt_a_SOURCES += $(BITCOIN_RC) libbitcoinqt_a_SOURCES += $(BITCOIN_RC)
endif endif
if USE_QRCODE
libbitcoinqt_a_SOURCES += $(QR_CPP)
endif
# #
# bitcoin-qt binary # # bitcoin-qt binary #
@ -159,7 +159,7 @@ QT_QM=$(QT_TS:.ts=.qm)
bitcoinstrings.cpp: FORCE bitcoinstrings.cpp: FORCE
$(MAKE) -C $(top_srcdir)/src qt/bitcoinstrings.cpp $(MAKE) -C $(top_srcdir)/src qt/bitcoinstrings.cpp
translate: bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) $(QR_CPP) translate: bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
@test -n $(LUPDATE) || echo "lupdate is required for updating translations" @test -n $(LUPDATE) || echo "lupdate is required for updating translations"
@$(LUPDATE) $^ -locations relative -no-obsolete -ts locale/bitcoin_en.ts @$(LUPDATE) $^ -locations relative -no-obsolete -ts locale/bitcoin_en.ts

View File

@ -12,10 +12,6 @@
#include "csvmodelwriter.h" #include "csvmodelwriter.h"
#include "guiutil.h" #include "guiutil.h"
#ifdef USE_QRCODE
#include "qrcodedialog.h"
#endif
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <QClipboard> #include <QClipboard>
#include <QMessageBox> #include <QMessageBox>
@ -35,25 +31,29 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
ui->newAddress->setIcon(QIcon()); ui->newAddress->setIcon(QIcon());
ui->copyAddress->setIcon(QIcon()); ui->copyAddress->setIcon(QIcon());
ui->deleteAddress->setIcon(QIcon()); ui->deleteAddress->setIcon(QIcon());
ui->verifyMessage->setIcon(QIcon());
ui->signMessage->setIcon(QIcon());
ui->exportButton->setIcon(QIcon()); ui->exportButton->setIcon(QIcon());
#endif #endif
#ifndef USE_QRCODE
ui->showQRCode->setVisible(false);
#endif
switch(mode) switch(mode)
{ {
case ForSending: case ForSelection:
switch(tab)
{
case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break;
case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break;
}
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept())); connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setFocus(); ui->tableView->setFocus();
ui->closeButton->setText(tr("C&hoose"));
ui->exportButton->hide(); ui->exportButton->hide();
break; break;
case ForEditing: case ForEditing:
ui->buttonBox->setVisible(false); switch(tab)
{
case SendingTab: setWindowTitle(tr("Sending addresses")); break;
case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break;
}
break; break;
} }
switch(tab) switch(tab)
@ -61,12 +61,10 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
case SendingTab: case SendingTab:
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.")); ui->labelExplanation->setText(tr("These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins."));
ui->deleteAddress->setVisible(true); ui->deleteAddress->setVisible(true);
ui->signMessage->setVisible(false);
break; break;
case ReceivingTab: case ReceivingTab:
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.")); ui->labelExplanation->setText(tr("These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction."));
ui->deleteAddress->setVisible(false); ui->deleteAddress->setVisible(false);
ui->signMessage->setVisible(true);
break; break;
} }
@ -74,10 +72,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QAction *copyAddressAction = new QAction(ui->copyAddress->text(), this); QAction *copyAddressAction = new QAction(ui->copyAddress->text(), this);
QAction *copyLabelAction = new QAction(tr("Copy &Label"), this); QAction *copyLabelAction = new QAction(tr("Copy &Label"), this);
QAction *editAction = new QAction(tr("&Edit"), this); QAction *editAction = new QAction(tr("&Edit"), this);
QAction *sendCoinsAction = new QAction(tr("Send &Coins"), this);
QAction *showQRCodeAction = new QAction(ui->showQRCode->text(), this);
QAction *signMessageAction = new QAction(ui->signMessage->text(), this);
QAction *verifyMessageAction = new QAction(ui->verifyMessage->text(), this);
deleteAction = new QAction(ui->deleteAddress->text(), this); deleteAction = new QAction(ui->deleteAddress->text(), this);
// Build context menu // Build context menu
@ -88,30 +82,16 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
if(tab == SendingTab) if(tab == SendingTab)
contextMenu->addAction(deleteAction); contextMenu->addAction(deleteAction);
contextMenu->addSeparator(); contextMenu->addSeparator();
if(tab == SendingTab)
contextMenu->addAction(sendCoinsAction);
#ifdef USE_QRCODE
contextMenu->addAction(showQRCodeAction);
#endif
if(tab == ReceivingTab)
contextMenu->addAction(signMessageAction);
else if(tab == SendingTab)
contextMenu->addAction(verifyMessageAction);
// Connect signals for context menu actions // Connect signals for context menu actions
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyAddress_clicked())); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyAddress_clicked()));
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction()));
connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction())); connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction()));
connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteAddress_clicked())); connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteAddress_clicked()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(onSendCoinsAction()));
connect(showQRCodeAction, SIGNAL(triggered()), this, SLOT(on_showQRCode_clicked()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(on_signMessage_clicked()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(on_verifyMessage_clicked()));
connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
// Pass through accept action from button box connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
} }
AddressBookPage::~AddressBookPage() AddressBookPage::~AddressBookPage()
@ -197,42 +177,6 @@ void AddressBookPage::onEditAction()
dlg.exec(); dlg.exec();
} }
void AddressBookPage::on_signMessage_clicked()
{
QTableView *table = ui->tableView;
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
foreach (QModelIndex index, indexes)
{
QString address = index.data().toString();
emit signMessage(address);
}
}
void AddressBookPage::on_verifyMessage_clicked()
{
QTableView *table = ui->tableView;
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
foreach (QModelIndex index, indexes)
{
QString address = index.data().toString();
emit verifyMessage(address);
}
}
void AddressBookPage::onSendCoinsAction()
{
QTableView *table = ui->tableView;
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
foreach (QModelIndex index, indexes)
{
QString address = index.data().toString();
emit sendCoins(address);
}
}
void AddressBookPage::on_newAddress_clicked() void AddressBookPage::on_newAddress_clicked()
{ {
if(!model) if(!model)
@ -278,32 +222,20 @@ void AddressBookPage::selectionChanged()
ui->deleteAddress->setEnabled(true); ui->deleteAddress->setEnabled(true);
ui->deleteAddress->setVisible(true); ui->deleteAddress->setVisible(true);
deleteAction->setEnabled(true); deleteAction->setEnabled(true);
ui->signMessage->setEnabled(false);
ui->signMessage->setVisible(false);
ui->verifyMessage->setEnabled(true);
ui->verifyMessage->setVisible(true);
break; break;
case ReceivingTab: case ReceivingTab:
// Deleting receiving addresses, however, is not allowed // Deleting receiving addresses, however, is not allowed
ui->deleteAddress->setEnabled(false); ui->deleteAddress->setEnabled(false);
ui->deleteAddress->setVisible(false); ui->deleteAddress->setVisible(false);
deleteAction->setEnabled(false); deleteAction->setEnabled(false);
ui->signMessage->setEnabled(true);
ui->signMessage->setVisible(true);
ui->verifyMessage->setEnabled(false);
ui->verifyMessage->setVisible(false);
break; break;
} }
ui->copyAddress->setEnabled(true); ui->copyAddress->setEnabled(true);
ui->showQRCode->setEnabled(true);
} }
else else
{ {
ui->deleteAddress->setEnabled(false); ui->deleteAddress->setEnabled(false);
ui->showQRCode->setEnabled(false);
ui->copyAddress->setEnabled(false); ui->copyAddress->setEnabled(false);
ui->signMessage->setEnabled(false);
ui->verifyMessage->setEnabled(false);
} }
} }
@ -312,9 +244,6 @@ void AddressBookPage::done(int retval)
QTableView *table = ui->tableView; QTableView *table = ui->tableView;
if(!table->selectionModel() || !table->model()) if(!table->selectionModel() || !table->model())
return; return;
// 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 // Figure out which address was selected, and return it
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address); QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
@ -339,7 +268,7 @@ void AddressBookPage::on_exportButton_clicked()
// CSV is currently the only supported format // CSV is currently the only supported format
QString filename = GUIUtil::getSaveFileName( QString filename = GUIUtil::getSaveFileName(
this, this,
tr("Export Address Book Data"), QString(), tr("Export Address List"), QString(),
tr("Comma separated file (*.csv)")); tr("Comma separated file (*.csv)"));
if (filename.isNull()) return; if (filename.isNull()) return;
@ -358,25 +287,6 @@ void AddressBookPage::on_exportButton_clicked()
} }
} }
void AddressBookPage::on_showQRCode_clicked()
{
#ifdef USE_QRCODE
QTableView *table = ui->tableView;
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
foreach (QModelIndex index, indexes)
{
QString address = index.data().toString();
QString label = index.sibling(index.row(), 0).data(Qt::EditRole).toString();
QRCodeDialog *dialog = new QRCodeDialog(address, label, tab == ReceivingTab, this);
dialog->setModel(optionsModel);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
#endif
}
void AddressBookPage::contextualMenu(const QPoint &point) void AddressBookPage::contextualMenu(const QPoint &point)
{ {
QModelIndex index = ui->tableView->indexAt(point); QModelIndex index = ui->tableView->indexAt(point);

View File

@ -30,7 +30,7 @@ public:
}; };
enum Mode { enum Mode {
ForSending, /**< Open address book to pick address for sending */ ForSelection, /**< Open address book to pick address */
ForEditing /**< Open address book for editing */ ForEditing /**< Open address book for editing */
}; };
@ -63,14 +63,6 @@ private slots:
void on_newAddress_clicked(); void on_newAddress_clicked();
/** Copy address of currently selected address entry to clipboard */ /** Copy address of currently selected address entry to clipboard */
void on_copyAddress_clicked(); void on_copyAddress_clicked();
/** Open the sign message tab in the Sign/Verify Message dialog with currently selected address */
void on_signMessage_clicked();
/** Open the verify message tab in the Sign/Verify Message dialog with currently selected address */
void on_verifyMessage_clicked();
/** Open send coins dialog for currently selected address (no button) */
void onSendCoinsAction();
/** Generate a QR Code from the currently selected address */
void on_showQRCode_clicked();
/** Copy label of currently selected address entry to clipboard (no button) */ /** Copy label of currently selected address entry to clipboard (no button) */
void onCopyLabelAction(); void onCopyLabelAction();
/** Edit currently selected address entry (no button) */ /** Edit currently selected address entry (no button) */
@ -86,8 +78,6 @@ private slots:
void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/); void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);
signals: signals:
void signMessage(QString addr);
void verifyMessage(QString addr);
void sendCoins(QString addr); void sendCoins(QString addr);
}; };

View File

@ -207,13 +207,6 @@ void BitcoinGUI::createActions(bool fIsTestnet)
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction); tabGroup->addAction(historyAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Addresses"), this);
addressBookAction->setStatusTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setToolTip(addressBookAction->statusTip());
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@ -222,8 +215,6 @@ void BitcoinGUI::createActions(bool fIsTestnet)
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application")); quitAction->setStatusTip(tr("Quit application"));
@ -266,6 +257,11 @@ void BitcoinGUI::createActions(bool fIsTestnet)
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Used sending addresses..."), this);
usedSendingAddressesAction->setStatusTip(tr("Edit the list of used sending addresses and labels"));
usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("Used &receiving addresses..."), this);
usedReceivingAddressesAction->setStatusTip(tr("Edit the list of used receiving addresses and labels"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
@ -276,6 +272,8 @@ void BitcoinGUI::createActions(bool fIsTestnet)
connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase())); connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses()));
connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
} }
void BitcoinGUI::createMenuBar() void BitcoinGUI::createMenuBar()
@ -294,6 +292,9 @@ void BitcoinGUI::createMenuBar()
file->addAction(signMessageAction); file->addAction(signMessageAction);
file->addAction(verifyMessageAction); file->addAction(verifyMessageAction);
file->addSeparator(); file->addSeparator();
file->addAction(usedSendingAddressesAction);
file->addAction(usedReceivingAddressesAction);
file->addSeparator();
file->addAction(quitAction); file->addAction(quitAction);
QMenu *settings = appMenuBar->addMenu(tr("&Settings")); QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
@ -317,7 +318,6 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(sendCoinsAction); toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction); toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction); toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
} }
void BitcoinGUI::setClientModel(ClientModel *clientModel) void BitcoinGUI::setClientModel(ClientModel *clientModel)
@ -457,12 +457,6 @@ void BitcoinGUI::gotoHistoryPage()
if (walletFrame) walletFrame->gotoHistoryPage(); if (walletFrame) walletFrame->gotoHistoryPage();
} }
void BitcoinGUI::gotoAddressBookPage()
{
addressBookAction->setChecked(true);
if (walletFrame) walletFrame->gotoAddressBookPage();
}
void BitcoinGUI::gotoReceiveCoinsPage() void BitcoinGUI::gotoReceiveCoinsPage()
{ {
receiveCoinsAction->setChecked(true); receiveCoinsAction->setChecked(true);

View File

@ -13,7 +13,6 @@ class WalletModel;
class WalletStack; class WalletStack;
class TransactionView; class TransactionView;
class OverviewPage; class OverviewPage;
class AddressBookPage;
class SendCoinsDialog; class SendCoinsDialog;
class SendCoinsRecipient; class SendCoinsRecipient;
class SignVerifyMessageDialog; class SignVerifyMessageDialog;
@ -83,7 +82,8 @@ private:
QAction *historyAction; QAction *historyAction;
QAction *quitAction; QAction *quitAction;
QAction *sendCoinsAction; QAction *sendCoinsAction;
QAction *addressBookAction; QAction *usedSendingAddressesAction;
QAction *usedReceivingAddressesAction;
QAction *signMessageAction; QAction *signMessageAction;
QAction *verifyMessageAction; QAction *verifyMessageAction;
QAction *aboutAction; QAction *aboutAction;
@ -156,8 +156,6 @@ private slots:
void gotoOverviewPage(); void gotoOverviewPage();
/** Switch to history (transactions) page */ /** Switch to history (transactions) page */
void gotoHistoryPage(); void gotoHistoryPage();
/** Switch to address book page */
void gotoAddressBookPage();
/** Switch to receive coins page */ /** Switch to receive coins page */
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Address Book</string> <string/>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@ -60,7 +60,7 @@
<string>Create a new address</string> <string>Create a new address</string>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;New Address</string> <string>&amp;New</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../bitcoin.qrc"> <iconset resource="../bitcoin.qrc">
@ -74,7 +74,7 @@
<string>Copy the currently selected address to the system clipboard</string> <string>Copy the currently selected address to the system clipboard</string>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Copy Address</string> <string>&amp;Copy</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../bitcoin.qrc"> <iconset resource="../bitcoin.qrc">
@ -82,45 +82,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="showQRCode">
<property name="text">
<string>Show &amp;QR Code</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/qrcode</normaloff>:/icons/qrcode</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="signMessage">
<property name="toolTip">
<string>Sign a message to prove you own a Bitcoin address</string>
</property>
<property name="text">
<string>Sign &amp;Message</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/edit</normaloff>:/icons/edit</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="verifyMessage">
<property name="toolTip">
<string>Verify a message to ensure it was signed with a specified Bitcoin address</string>
</property>
<property name="text">
<string>&amp;Verify Message</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/transaction_0</normaloff>:/icons/transaction_0</iconset>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="deleteAddress"> <widget class="QPushButton" name="deleteAddress">
<property name="toolTip"> <property name="toolTip">
@ -163,15 +124,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QPushButton" name="closeButton">
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <string>C&amp;lose</string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -32,7 +32,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="labelEdit"> <widget class="QLineEdit" name="labelEdit">
<property name="toolTip"> <property name="toolTip">
<string>The label associated with this address book entry</string> <string>The label associated with this address list entry</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -49,7 +49,7 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="addressEdit"> <widget class="QLineEdit" name="addressEdit">
<property name="toolTip"> <property name="toolTip">
<string>The address associated with this address book entry. This can only be modified for sending addresses.</string> <string>The address associated with this address list entry. This can only be modified for sending addresses.</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -1,212 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QRCodeDialog</class>
<widget class="QDialog" name="QRCodeDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>530</height>
</rect>
</property>
<property name="windowTitle">
<string>QR Code Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="lblQRCode">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="outUri">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="chkReqPayment">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Request Payment</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="lblLabel">
<property name="text">
<string>Label:</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>lnLabel</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lnLabel"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblMessage">
<property name="text">
<string>Message:</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>lnMessage</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lnMessage"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblAmount">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Amount:</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>lnReqAmount</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="BitcoinAmountField" name="lnReqAmount">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnSaveAs">
<property name="text">
<string>&amp;Save As...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BitcoinAmountField</class>
<extends>QLineEdit</extends>
<header>bitcoinamountfield.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>chkReqPayment</sender>
<signal>clicked(bool)</signal>
<receiver>lnReqAmount</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>92</x>
<y>285</y>
</hint>
<hint type="destinationlabel">
<x>98</x>
<y>311</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ReceiveCoinsDialog</class>
<widget class="QWidget" name="ReceiveCoinsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>776</width>
<height>343</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Amount:</string>
</property>
<property name="buddy">
<cstring>reqAmount</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="BitcoinAmountField" name="reqAmount">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>The amount to request</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Label:</string>
</property>
<property name="buddy">
<cstring>reqLabel</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="reqLabel">
<property name="toolTip">
<string>The label to associate with the receiving address</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;Message:</string>
</property>
<property name="buddy">
<cstring>reqMessage</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="reqMessage">
<property name="toolTip">
<string>The message to attach to payment request</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="reuseAddress">
<property name="toolTip">
<string>Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before.</string>
</property>
<property name="text">
<string>R&amp;euse an existing receiving address (not recommended)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Use this form to request payments. All fields are optional.</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Remove all transaction fields</string>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset>
</property>
<property name="autoRepeatDelay">
<number>300</number>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="receiveButton">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&amp;Request payment</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/receiving_addresses</normaloff>:/icons/receiving_addresses</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BitcoinAmountField</class>
<extends>QLineEdit</extends>
<header>bitcoinamountfield.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../bitcoin.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ReceiveRequestDialog</class>
<widget class="QDialog" name="ReceiveRequestDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>487</width>
<height>597</height>
</rect>
</property>
<property name="windowTitle">
<string>Request coins</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRImageWidget" name="lblQRCode">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="toolTip">
<string>QR Code</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="outUri">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnCopyURI">
<property name="text">
<string>Copy &amp;URI</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCopyAddress">
<property name="text">
<string>Copy &amp;Address</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCopyImage">
<property name="text">
<string>&amp;Copy Image</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSaveAs">
<property name="text">
<string>&amp;Save Image...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QRImageWidget</class>
<extends>QLabel</extends>
<header>receiverequestdialog.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ReceiveRequestDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>452</x>
<y>573</y>
</hint>
<hint type="destinationlabel">
<x>243</x>
<y>298</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ReceiveRequestDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>452</x>
<y>573</y>
</hint>
<hint type="destinationlabel">
<x>243</x>
<y>298</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -87,7 +87,7 @@
<item> <item>
<widget class="QToolButton" name="addressBookButton"> <widget class="QToolButton" name="addressBookButton">
<property name="toolTip"> <property name="toolTip">
<string>Choose address from address book</string> <string>Choose previously used address</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -137,7 +137,7 @@
<item row="4" column="1"> <item row="4" column="1">
<widget class="QValidatedLineEdit" name="addAsLabel"> <widget class="QValidatedLineEdit" name="addAsLabel">
<property name="toolTip"> <property name="toolTip">
<string>Enter a label for this address to add it to your address book</string> <string>Enter a label for this address to add it to the list of used addresses</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -674,7 +674,6 @@
<class>BitcoinAmountField</class> <class>BitcoinAmountField</class>
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
<header>bitcoinamountfield.h</header> <header>bitcoinamountfield.h</header>
<container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>QValidatedLineEdit</class> <class>QValidatedLineEdit</class>

View File

@ -20,7 +20,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabSignMessage"> <widget class="QWidget" name="tabSignMessage">
<attribute name="title"> <attribute name="title">
@ -58,7 +58,7 @@
<item> <item>
<widget class="QPushButton" name="addressBookButton_SM"> <widget class="QPushButton" name="addressBookButton_SM">
<property name="toolTip"> <property name="toolTip">
<string>Choose an address from the address book</string> <string>Choose previously used address</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -271,7 +271,7 @@
<item> <item>
<widget class="QPushButton" name="addressBookButton_VM"> <widget class="QPushButton" name="addressBookButton_VM">
<property name="toolTip"> <property name="toolTip">
<string>Choose an address from the address book</string> <string>Choose previously used address</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>

View File

@ -112,6 +112,11 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
rv.label = i->second; rv.label = i->second;
fShouldReturnFalse = false; fShouldReturnFalse = false;
} }
if (i->first == "message")
{
rv.message = i->second;
fShouldReturnFalse = false;
}
else if (i->first == "amount") else if (i->first == "amount")
{ {
if(!i->second.isEmpty()) if(!i->second.isEmpty())
@ -148,6 +153,34 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
return parseBitcoinURI(uriInstance, out); return parseBitcoinURI(uriInstance, out);
} }
QString formatBitcoinURI(const SendCoinsRecipient &info)
{
QString ret = QString("bitcoin:%1").arg(info.address);
int paramCount = 0;
if (info.amount)
{
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, info.amount));
paramCount++;
}
if (!info.label.isEmpty())
{
QString lbl(QUrl::toPercentEncoding(info.label));
ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl);
paramCount++;
}
if (!info.message.isEmpty())
{
QString msg(QUrl::toPercentEncoding(info.message));;
ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg);
paramCount++;
}
return ret;
}
bool isDust(const QString& address, qint64 amount) bool isDust(const QString& address, qint64 amount)
{ {
CTxDestination dest = CBitcoinAddress(address.toStdString()).Get(); CTxDestination dest = CBitcoinAddress(address.toStdString()).Get();

View File

@ -35,6 +35,7 @@ namespace GUIUtil
// See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0 // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out); bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out); bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
QString formatBitcoinURI(const SendCoinsRecipient &info);
// Returns true if given address+amount meets "dust" definition // Returns true if given address+amount meets "dust" definition
bool isDust(const QString& address, qint64 amount); bool isDust(const QString& address, qint64 amount);

View File

@ -1,173 +0,0 @@
#include "qrcodedialog.h"
#include "ui_qrcodedialog.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include <QPixmap>
#if QT_VERSION < 0x050000
#include <QUrl>
#endif
#include <qrencode.h>
QRCodeDialog::QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent) :
QDialog(parent),
ui(new Ui::QRCodeDialog),
model(0),
address(addr)
{
ui->setupUi(this);
setWindowTitle(QString("%1").arg(address));
ui->chkReqPayment->setVisible(enableReq);
ui->lblAmount->setVisible(enableReq);
ui->lnReqAmount->setVisible(enableReq);
ui->lnLabel->setText(label);
ui->btnSaveAs->setEnabled(false);
genCode();
}
QRCodeDialog::~QRCodeDialog()
{
delete ui;
}
void QRCodeDialog::setModel(OptionsModel *model)
{
this->model = model;
if (model)
connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
// update the display unit, to not use the default ("BTC")
updateDisplayUnit();
}
void QRCodeDialog::genCode()
{
QString uri = getURI();
if (uri != "")
{
ui->lblQRCode->setText("");
QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1);
if (!code)
{
ui->lblQRCode->setText(tr("Error encoding URI into QR Code."));
return;
}
myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
myImage.fill(0xffffff);
unsigned char *p = code->data;
for (int y = 0; y < code->width; y++)
{
for (int x = 0; x < code->width; x++)
{
myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff));
p++;
}
}
QRcode_free(code);
ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300));
ui->outUri->setPlainText(uri);
}
}
QString QRCodeDialog::getURI()
{
QString ret = QString("bitcoin:%1").arg(address);
int paramCount = 0;
ui->outUri->clear();
if (ui->chkReqPayment->isChecked())
{
if (ui->lnReqAmount->validate())
{
// even if we allow a non BTC unit input in lnReqAmount, we generate the URI with BTC as unit (as defined in BIP21)
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, ui->lnReqAmount->value()));
paramCount++;
}
else
{
ui->btnSaveAs->setEnabled(false);
ui->lblQRCode->setText(tr("The entered amount is invalid, please check."));
return QString("");
}
}
if (!ui->lnLabel->text().isEmpty())
{
QString lbl(QUrl::toPercentEncoding(ui->lnLabel->text()));
ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl);
paramCount++;
}
if (!ui->lnMessage->text().isEmpty())
{
QString msg(QUrl::toPercentEncoding(ui->lnMessage->text()));
ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg);
paramCount++;
}
// limit URI length to prevent a DoS against the QR-Code dialog
if (ret.length() > MAX_URI_LENGTH)
{
ui->btnSaveAs->setEnabled(false);
ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message."));
return QString("");
}
ui->btnSaveAs->setEnabled(true);
return ret;
}
void QRCodeDialog::on_lnReqAmount_textChanged()
{
genCode();
}
void QRCodeDialog::on_lnLabel_textChanged()
{
genCode();
}
void QRCodeDialog::on_lnMessage_textChanged()
{
genCode();
}
void QRCodeDialog::on_btnSaveAs_clicked()
{
QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Images (*.png)"));
if (!fn.isEmpty())
myImage.scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE).save(fn);
}
void QRCodeDialog::on_chkReqPayment_toggled(bool fChecked)
{
if (!fChecked)
// if chkReqPayment is not active, don't display lnReqAmount as invalid
ui->lnReqAmount->setValid(true);
genCode();
}
void QRCodeDialog::updateDisplayUnit()
{
if (model)
{
// Update lnReqAmount with the current unit
ui->lnReqAmount->setDisplayUnit(model->getDisplayUnit());
}
}

View File

@ -1,41 +0,0 @@
#ifndef QRCODEDIALOG_H
#define QRCODEDIALOG_H
#include <QDialog>
#include <QImage>
namespace Ui {
class QRCodeDialog;
}
class OptionsModel;
class QRCodeDialog : public QDialog
{
Q_OBJECT
public:
explicit QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent = 0);
~QRCodeDialog();
void setModel(OptionsModel *model);
private slots:
void on_lnReqAmount_textChanged();
void on_lnLabel_textChanged();
void on_lnMessage_textChanged();
void on_btnSaveAs_clicked();
void on_chkReqPayment_toggled(bool fChecked);
void updateDisplayUnit();
private:
Ui::QRCodeDialog *ui;
OptionsModel *model;
QString address;
QImage myImage;
void genCode();
QString getURI();
};
#endif // QRCODEDIALOG_H

View File

@ -0,0 +1,107 @@
#include "receivecoinsdialog.h"
#include "ui_receivecoinsdialog.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "addressbookpage.h"
#include "optionsmodel.h"
#include "guiutil.h"
#include "receiverequestdialog.h"
#include "addresstablemodel.h"
#include <QMessageBox>
#include <QTextDocument>
#include <QScrollBar>
ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ReceiveCoinsDialog),
model(0)
{
ui->setupUi(this);
#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
ui->clearButton->setIcon(QIcon());
ui->receiveButton->setIcon(QIcon());
#endif
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
}
void ReceiveCoinsDialog::setModel(WalletModel *model)
{
this->model = model;
if(model && model->getOptionsModel())
{
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
updateDisplayUnit();
}
}
ReceiveCoinsDialog::~ReceiveCoinsDialog()
{
delete ui;
}
void ReceiveCoinsDialog::clear()
{
ui->reqAmount->clear();
ui->reqLabel->setText("");
ui->reqMessage->setText("");
ui->reuseAddress->setChecked(false);
updateDisplayUnit();
}
void ReceiveCoinsDialog::reject()
{
clear();
}
void ReceiveCoinsDialog::accept()
{
clear();
}
void ReceiveCoinsDialog::updateDisplayUnit()
{
if(model && model->getOptionsModel())
{
ui->reqAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
}
}
void ReceiveCoinsDialog::on_receiveButton_clicked()
{
if(!model || !model->getOptionsModel() || !model->getAddressTableModel())
return;
QString address;
QString label = ui->reqLabel->text();
if(ui->reuseAddress->isChecked())
{
/* Choose existing receiving address */
AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::ReceivingTab, this);
dlg.setModel(model->getAddressTableModel());
if(dlg.exec())
{
address = dlg.getReturnValue();
if(label.isEmpty()) /* If no label provided, use the previously used label */
{
label = model->getAddressTableModel()->labelForAddress(address);
}
} else {
return;
}
} else {
/* Generate new receiving address */
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "");
}
SendCoinsRecipient info(address, label,
ui->reqAmount->value(), ui->reqMessage->text());
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
dialog->setModel(model->getOptionsModel());
dialog->setInfo(info);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
clear();
}

View File

@ -0,0 +1,38 @@
#ifndef RECEIVECOINSDIALOG_H
#define RECEIVECOINSDIALOG_H
#include <QDialog>
#include <QVariant>
namespace Ui {
class ReceiveCoinsDialog;
}
class WalletModel;
class OptionsModel;
/** Dialog for requesting payment of bitcoins */
class ReceiveCoinsDialog : public QDialog
{
Q_OBJECT
public:
explicit ReceiveCoinsDialog(QWidget *parent = 0);
~ReceiveCoinsDialog();
void setModel(WalletModel *model);
public slots:
void clear();
void reject();
void accept();
private:
Ui::ReceiveCoinsDialog *ui;
WalletModel *model;
private slots:
void on_receiveButton_clicked();
void updateDisplayUnit();
};
#endif // RECEIVECOINSDIALOG_H

View File

@ -0,0 +1,183 @@
#include "receiverequestdialog.h"
#include "ui_receiverequestdialog.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include <QPixmap>
#include <QClipboard>
#include <QMouseEvent>
#include <QDrag>
#include <QMimeData>
#if QT_VERSION < 0x050000
#include <QUrl>
#endif
#include "bitcoin-config.h" /* for USE_QRCODE */
#ifdef USE_QRCODE
#include <qrencode.h>
#endif
QRImageWidget::QRImageWidget(QWidget *parent):
QLabel(parent)
{
setContextMenuPolicy(Qt::ActionsContextMenu);
QAction *saveImageAction = new QAction(tr("&Save Image..."), this);
connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage()));
addAction(saveImageAction);
QAction *copyImageAction = new QAction(tr("&Copy Image"), this);
connect(copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage()));
addAction(copyImageAction);
}
QImage QRImageWidget::exportImage()
{
return pixmap()->toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE);
}
void QRImageWidget::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
event->accept();
QMimeData *mimeData = new QMimeData;
mimeData->setImageData(exportImage());
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->exec();
} else {
QLabel::mousePressEvent(event);
}
}
void QRImageWidget::saveImage()
{
QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Images (*.png)"));
if (!fn.isEmpty())
{
exportImage().save(fn);
}
}
void QRImageWidget::copyImage()
{
QApplication::clipboard()->setImage(exportImage());
}
ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ReceiveRequestDialog),
model(0)
{
ui->setupUi(this);
#ifndef USE_QRCODE
ui->btnSaveAs->setVisible(false);
ui->btnCopyImage->setVisible(false);
ui->lblQRCode->setVisible(false);
#endif
connect(ui->btnSaveAs, SIGNAL(clicked()), ui->lblQRCode, SLOT(saveImage()));
connect(ui->btnCopyImage, SIGNAL(clicked()), ui->lblQRCode, SLOT(copyImage()));
}
ReceiveRequestDialog::~ReceiveRequestDialog()
{
delete ui;
}
void ReceiveRequestDialog::setModel(OptionsModel *model)
{
this->model = model;
if (model)
connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(update()));
// update the display unit if necessary
update();
}
void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &info)
{
this->info = info;
update();
}
void ReceiveRequestDialog::update()
{
if(!model)
return;
QString target = info.label;
if(target.isEmpty())
target = info.address;
setWindowTitle(tr("Request payment to %1").arg(target));
QString uri = GUIUtil::formatBitcoinURI(info);
ui->btnSaveAs->setEnabled(false);
QString html;
html += "<html><font face='verdana, arial, helvetica, sans-serif'>";
html += "<b>"+tr("Payment information")+"</b><br>";
html += "<b>"+tr("URI")+"</b>: ";
html += "<a href=\""+uri+"\">" + GUIUtil::HtmlEscape(uri) + "</a><br>";
html += "<b>"+tr("Address")+"</b>: " + GUIUtil::HtmlEscape(info.address) + "<br>";
if(info.amount)
html += "<b>"+tr("Amount")+"</b>: " + BitcoinUnits::formatWithUnit(model->getDisplayUnit(), info.amount) + "<br>";
if(!info.label.isEmpty())
html += "<b>"+tr("Label")+"</b>: " + GUIUtil::HtmlEscape(info.label) + "<br>";
if(!info.message.isEmpty())
html += "<b>"+tr("Message")+"</b>: " + GUIUtil::HtmlEscape(info.message) + "<br>";
ui->outUri->setText(html);
#ifdef USE_QRCODE
ui->lblQRCode->setText("");
if(!uri.isEmpty())
{
// limit URI length
if (uri.length() > MAX_URI_LENGTH)
{
ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message."));
} else {
QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1);
if (!code)
{
ui->lblQRCode->setText(tr("Error encoding URI into QR Code."));
return;
}
QImage myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
myImage.fill(0xffffff);
unsigned char *p = code->data;
for (int y = 0; y < code->width; y++)
{
for (int x = 0; x < code->width; x++)
{
myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff));
p++;
}
}
QRcode_free(code);
ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300));
ui->btnSaveAs->setEnabled(true);
}
}
#endif
}
void ReceiveRequestDialog::on_btnCopyURI_clicked()
{
QString uri = GUIUtil::formatBitcoinURI(info);
QApplication::clipboard()->setText(uri, QClipboard::Clipboard);
QApplication::clipboard()->setText(uri, QClipboard::Selection);
}
void ReceiveRequestDialog::on_btnCopyAddress_clicked()
{
QApplication::clipboard()->setText(info.address, QClipboard::Clipboard);
QApplication::clipboard()->setText(info.address, QClipboard::Selection);
}

View File

@ -0,0 +1,57 @@
#ifndef QRCODEDIALOG_H
#define QRCODEDIALOG_H
#include "walletmodel.h"
#include <QDialog>
#include <QImage>
#include <QLabel>
namespace Ui {
class ReceiveRequestDialog;
}
class OptionsModel;
/* Label widget for QR code. This image can be dragged, dropped, copied and saved
* to disk.
*/
class QRImageWidget : public QLabel
{
Q_OBJECT
public:
explicit QRImageWidget(QWidget *parent = 0);
QImage exportImage();
public slots:
void saveImage();
void copyImage();
protected:
virtual void mousePressEvent(QMouseEvent *event);
};
class ReceiveRequestDialog : public QDialog
{
Q_OBJECT
public:
explicit ReceiveRequestDialog(QWidget *parent = 0);
~ReceiveRequestDialog();
void setModel(OptionsModel *model);
void setInfo(const SendCoinsRecipient &info);
private slots:
void on_btnCopyURI_clicked();
void on_btnCopyAddress_clicked();
void update();
private:
Ui::ReceiveRequestDialog *ui;
OptionsModel *model;
SendCoinsRecipient info;
};
#endif // QRCODEDIALOG_H

View File

@ -49,7 +49,7 @@ void SendCoinsEntry::on_addressBookButton_clicked()
{ {
if(!model) if(!model)
return; return;
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this); AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel()); dlg.setModel(model->getAddressTableModel());
if(dlg.exec()) if(dlg.exec())
{ {

View File

@ -86,7 +86,7 @@ void SignVerifyMessageDialog::on_addressBookButton_SM_clicked()
{ {
if (model && model->getAddressTableModel()) if (model && model->getAddressTableModel())
{ {
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::ReceivingTab, this); AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::ReceivingTab, this);
dlg.setModel(model->getAddressTableModel()); dlg.setModel(model->getAddressTableModel());
if (dlg.exec()) if (dlg.exec())
{ {
@ -178,7 +178,7 @@ void SignVerifyMessageDialog::on_addressBookButton_VM_clicked()
{ {
if (model && model->getAddressTableModel()) if (model && model->getAddressTableModel())
{ {
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this); AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel()); dlg.setModel(model->getAddressTableModel());
if (dlg.exec()) if (dlg.exec())
{ {

View File

@ -50,9 +50,8 @@ void URITests::uriTests()
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W")); QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.label == QString()); QVERIFY(rv.label == QString());
// We currently don't implement the message parameter (ok, yea, we break spec...)
uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?req-message=Wikipedia Example Address")); uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?req-message=Wikipedia Example Address"));
QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv)); QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1,000&label=Wikipedia Example")); uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1,000&label=Wikipedia Example"));
QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv)); QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));

View File

@ -115,13 +115,6 @@ void WalletFrame::gotoHistoryPage()
i.value()->gotoHistoryPage(); i.value()->gotoHistoryPage();
} }
void WalletFrame::gotoAddressBookPage()
{
QMap<QString, WalletView*>::const_iterator i;
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i)
i.value()->gotoAddressBookPage();
}
void WalletFrame::gotoReceiveCoinsPage() void WalletFrame::gotoReceiveCoinsPage()
{ {
QMap<QString, WalletView*>::const_iterator i; QMap<QString, WalletView*>::const_iterator i;
@ -184,3 +177,17 @@ void WalletFrame::setEncryptionStatus()
if (walletView) if (walletView)
walletView->setEncryptionStatus(); walletView->setEncryptionStatus();
} }
void WalletFrame::usedSendingAddresses()
{
WalletView *walletView = (WalletView*)walletStack->currentWidget();
if (walletView)
walletView->usedSendingAddresses();
}
void WalletFrame::usedReceivingAddresses()
{
WalletView *walletView = (WalletView*)walletStack->currentWidget();
if (walletView)
walletView->usedReceivingAddresses();
}

View File

@ -52,8 +52,6 @@ public slots:
void gotoOverviewPage(); void gotoOverviewPage();
/** Switch to history (transactions) page */ /** Switch to history (transactions) page */
void gotoHistoryPage(); void gotoHistoryPage();
/** Switch to address book page */
void gotoAddressBookPage();
/** Switch to receive coins page */ /** Switch to receive coins page */
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */
@ -73,6 +71,11 @@ public slots:
/** Ask for passphrase to unlock wallet temporarily */ /** Ask for passphrase to unlock wallet temporarily */
void unlockWallet(); void unlockWallet();
/** Show used sending addresses */
void usedSendingAddresses();
/** Show used receiving addresses */
void usedReceivingAddresses();
/** Set the encryption status as shown in the UI. /** Set the encryption status as shown in the UI.
@param[in] status current encryption status @param[in] status current encryption status
@see WalletModel::EncryptionStatus @see WalletModel::EncryptionStatus

View File

@ -21,11 +21,14 @@ QT_END_NAMESPACE
class SendCoinsRecipient class SendCoinsRecipient
{ {
public: public:
SendCoinsRecipient() : amount(0) { } explicit SendCoinsRecipient() : amount(0) { }
explicit SendCoinsRecipient(const QString &addr, const QString &label, quint64 amount, const QString &message):
address(addr), label(label), amount(amount), message(message) {}
QString address; QString address;
QString label; QString label;
qint64 amount; qint64 amount;
QString message;
// If from a payment request, paymentRequest.IsInitialized() will be true // If from a payment request, paymentRequest.IsInitialized() will be true
PaymentRequestPlus paymentRequest; PaymentRequestPlus paymentRequest;

View File

@ -9,6 +9,7 @@
#include "transactiontablemodel.h" #include "transactiontablemodel.h"
#include "addressbookpage.h" #include "addressbookpage.h"
#include "sendcoinsdialog.h" #include "sendcoinsdialog.h"
#include "receivecoinsdialog.h"
#include "signverifymessagedialog.h" #include "signverifymessagedialog.h"
#include "clientmodel.h" #include "clientmodel.h"
#include "walletmodel.h" #include "walletmodel.h"
@ -53,13 +54,11 @@ WalletView::WalletView(QWidget *parent):
vbox->addLayout(hbox_buttons); vbox->addLayout(hbox_buttons);
transactionsPage->setLayout(vbox); transactionsPage->setLayout(vbox);
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab); receiveCoinsPage = new ReceiveCoinsDialog(gui);
receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab); sendCoinsPage = new SendCoinsDialog(gui);
sendCoinsPage = new SendCoinsDialog();
addWidget(overviewPage); addWidget(overviewPage);
addWidget(transactionsPage); addWidget(transactionsPage);
addWidget(addressBookPage);
addWidget(receiveCoinsPage); addWidget(receiveCoinsPage);
addWidget(sendCoinsPage); addWidget(sendCoinsPage);
@ -69,10 +68,6 @@ WalletView::WalletView(QWidget *parent):
// Double-clicking on a transaction on the transaction history page shows details // Double-clicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
// Clicking on "Send Coins" in the address book sends you to the send coins tab
connect(addressBookPage, SIGNAL(sendCoins(QString)), this, SLOT(gotoSendCoinsPage(QString)));
// Clicking on "Verify Message" in the address book opens the verify message tab in the Sign/Verify Message dialog
connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
// Clicking on "Sign Message" in the receive coins page opens the sign message tab in the Sign/Verify Message dialog // Clicking on "Sign Message" in the receive coins page opens the sign message tab in the Sign/Verify Message dialog
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString))); connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
// Clicking on "Export" allows to export the transaction list // Clicking on "Export" allows to export the transaction list
@ -98,8 +93,6 @@ void WalletView::setClientModel(ClientModel *clientModel)
if (clientModel) if (clientModel)
{ {
overviewPage->setClientModel(clientModel); overviewPage->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
} }
} }
@ -114,8 +107,7 @@ void WalletView::setWalletModel(WalletModel *walletModel)
// Put transaction list in tabs // Put transaction list in tabs
transactionView->setModel(walletModel); transactionView->setModel(walletModel);
overviewPage->setWalletModel(walletModel); overviewPage->setWalletModel(walletModel);
addressBookPage->setModel(walletModel->getAddressTableModel()); receiveCoinsPage->setModel(walletModel);
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
sendCoinsPage->setModel(walletModel); sendCoinsPage->setModel(walletModel);
setEncryptionStatus(); setEncryptionStatus();
@ -156,11 +148,6 @@ void WalletView::gotoHistoryPage()
setCurrentWidget(transactionsPage); setCurrentWidget(transactionsPage);
} }
void WalletView::gotoAddressBookPage()
{
setCurrentWidget(addressBookPage);
}
void WalletView::gotoReceiveCoinsPage() void WalletView::gotoReceiveCoinsPage()
{ {
setCurrentWidget(receiveCoinsPage); setCurrentWidget(receiveCoinsPage);
@ -270,3 +257,23 @@ void WalletView::unlockWallet()
dlg.exec(); dlg.exec();
} }
} }
void WalletView::usedSendingAddresses()
{
if(!walletModel)
return;
AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
dlg->setModel(walletModel->getAddressTableModel());
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->show();
}
void WalletView::usedReceivingAddresses()
{
if(!walletModel)
return;
AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
dlg->setModel(walletModel->getAddressTableModel());
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->show();
}

View File

@ -14,8 +14,8 @@ class ClientModel;
class WalletModel; class WalletModel;
class TransactionView; class TransactionView;
class OverviewPage; class OverviewPage;
class AddressBookPage;
class SendCoinsDialog; class SendCoinsDialog;
class ReceiveCoinsDialog;
class SendCoinsRecipient; class SendCoinsRecipient;
class SignVerifyMessageDialog; class SignVerifyMessageDialog;
class RPCConsole; class RPCConsole;
@ -61,8 +61,7 @@ private:
OverviewPage *overviewPage; OverviewPage *overviewPage;
QWidget *transactionsPage; QWidget *transactionsPage;
AddressBookPage *addressBookPage; ReceiveCoinsDialog *receiveCoinsPage;
AddressBookPage *receiveCoinsPage;
SendCoinsDialog *sendCoinsPage; SendCoinsDialog *sendCoinsPage;
TransactionView *transactionView; TransactionView *transactionView;
@ -72,8 +71,6 @@ public slots:
void gotoOverviewPage(); void gotoOverviewPage();
/** Switch to history (transactions) page */ /** Switch to history (transactions) page */
void gotoHistoryPage(); void gotoHistoryPage();
/** Switch to address book page */
void gotoAddressBookPage();
/** Switch to receive coins page */ /** Switch to receive coins page */
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */
@ -98,6 +95,11 @@ public slots:
/** Ask for passphrase to unlock wallet temporarily */ /** Ask for passphrase to unlock wallet temporarily */
void unlockWallet(); void unlockWallet();
/** Show used sending addresses */
void usedSendingAddresses();
/** Show used receiving addresses */
void usedReceivingAddresses();
void setEncryptionStatus(); void setEncryptionStatus();
signals: signals: