Browse Source

qt: rework "receive coins" workflow

0.10
Wladimir J. van der Laan 11 years ago
parent
commit
74fb765e29
  1. 4
      contrib/bitcoin-qt.pro
  2. 16
      src/qt/Makefile.am
  3. 52
      src/qt/addressbookpage.cpp
  4. 4
      src/qt/addressbookpage.h
  5. 26
      src/qt/bitcoingui.cpp
  6. 6
      src/qt/bitcoingui.h
  7. 13
      src/qt/forms/addressbookpage.ui
  8. 164
      src/qt/forms/receivecoinsdialog.ui
  9. 151
      src/qt/forms/receiverequestdialog.ui
  10. 105
      src/qt/receivecoinsdialog.cpp
  11. 38
      src/qt/receivecoinsdialog.h
  12. 91
      src/qt/receiverequestdialog.cpp
  13. 11
      src/qt/receiverequestdialog.h
  14. 2
      src/qt/sendcoinsentry.cpp
  15. 4
      src/qt/signverifymessagedialog.cpp
  16. 21
      src/qt/walletframe.cpp
  17. 7
      src/qt/walletframe.h
  18. 41
      src/qt/walletview.cpp
  19. 12
      src/qt/walletview.h

4
contrib/bitcoin-qt.pro

@ -11,7 +11,9 @@ FORMS += \ @@ -11,7 +11,9 @@ FORMS += \
../src/qt/forms/editaddressdialog.ui \
../src/qt/forms/askpassphrasedialog.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 += \
../src/qt/bitcoin.qrc

16
src/qt/Makefile.am

@ -34,7 +34,8 @@ QT_TS = locale/bitcoin_ach.ts locale/bitcoin_af_ZA.ts locale/bitcoin_ar.ts \ @@ -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 \
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/signverifymessagedialog.ui forms/transactiondescdialog.ui
@ -46,7 +47,8 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \ @@ -46,7 +47,8 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \
moc_intro.cpp moc_macdockiconhandler.cpp moc_macnotificationhandler.cpp \
moc_monitoreddatamapper.cpp moc_notificator.cpp moc_optionsdialog.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_signverifymessagedialog.cpp moc_splashscreen.cpp moc_trafficgraphwidget.cpp moc_transactiondesc.cpp \
moc_transactiondescdialog.cpp moc_transactionfilterproxy.cpp \
@ -54,7 +56,6 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \ @@ -54,7 +56,6 @@ QT_MOC_CPP = moc_aboutdialog.cpp moc_addressbookpage.cpp \
moc_walletmodel.cpp moc_walletview.cpp
BITCOIN_MM = macdockiconhandler.mm macnotificationhandler.mm
QR_CPP = qrcodedialog.cpp
QT_MOC = intro.moc overviewpage.moc rpcconsole.moc
@ -71,7 +72,8 @@ BITCOIN_QT_H = aboutdialog.h addressbookpage.h addresstablemodel.h \ @@ -71,7 +72,8 @@ BITCOIN_QT_H = aboutdialog.h addressbookpage.h addresstablemodel.h \
editaddressdialog.h guiconstants.h guiutil.h intro.h macdockiconhandler.h \
macnotificationhandler.h monitoreddatamapper.h notificator.h optionsdialog.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 \
trafficgraphwidget.h transactiondescdialog.h transactiondesc.h transactionfilterproxy.h \
transactionrecord.h transactiontablemodel.h transactionview.h walletframe.h \
@ -101,6 +103,7 @@ BITCOIN_QT_CPP = aboutdialog.cpp addressbookpage.cpp \ @@ -101,6 +103,7 @@ BITCOIN_QT_CPP = aboutdialog.cpp addressbookpage.cpp \
guiutil.cpp intro.cpp monitoreddatamapper.cpp notificator.cpp \
optionsdialog.cpp optionsmodel.cpp overviewpage.cpp paymentrequestplus.cpp \
paymentserver.cpp qvalidatedlineedit.cpp qvaluecombobox.cpp \
receivecoinsdialog.cpp receiverequestdialog.cpp \
rpcconsole.cpp sendcoinsdialog.cpp sendcoinsentry.cpp \
signverifymessagedialog.cpp splashscreen.cpp trafficgraphwidget.cpp transactiondesc.cpp \
transactiondescdialog.cpp transactionfilterproxy.cpp transactionrecord.cpp \
@ -135,9 +138,6 @@ endif @@ -135,9 +138,6 @@ endif
if TARGET_WINDOWS
libbitcoinqt_a_SOURCES += $(BITCOIN_RC)
endif
if USE_QRCODE
libbitcoinqt_a_SOURCES += $(QR_CPP)
endif
#
# bitcoin-qt binary #
@ -159,7 +159,7 @@ QT_QM=$(QT_TS:.ts=.qm) @@ -159,7 +159,7 @@ QT_QM=$(QT_TS:.ts=.qm)
bitcoinstrings.cpp: FORCE
$(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"
@$(LUPDATE) $^ -locations relative -no-obsolete -ts locale/bitcoin_en.ts

52
src/qt/addressbookpage.cpp

@ -12,10 +12,6 @@ @@ -12,10 +12,6 @@
#include "csvmodelwriter.h"
#include "guiutil.h"
#ifdef USE_QRCODE
#include "qrcodedialog.h"
#endif
#include <QSortFilterProxyModel>
#include <QClipboard>
#include <QMessageBox>
@ -40,20 +36,25 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : @@ -40,20 +36,25 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
ui->exportButton->setIcon(QIcon());
#endif
#ifndef USE_QRCODE
ui->showQRCode->setVisible(false);
#endif
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()));
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setFocus();
ui->exportButton->hide();
break;
case ForEditing:
ui->buttonBox->setVisible(false);
switch(tab)
{
case SendingTab: setWindowTitle(tr("Sending addresses")); break;
case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break;
}
break;
}
switch(tab)
@ -64,7 +65,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : @@ -64,7 +65,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
ui->signMessage->setVisible(false);
break;
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->signMessage->setVisible(true);
break;
@ -75,7 +76,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : @@ -75,7 +76,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QAction *copyLabelAction = new QAction(tr("Copy &Label"), 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);
@ -90,9 +90,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : @@ -90,9 +90,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
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)
@ -104,7 +101,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : @@ -104,7 +101,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction()));
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()));
@ -295,12 +291,10 @@ void AddressBookPage::selectionChanged() @@ -295,12 +291,10 @@ void AddressBookPage::selectionChanged()
break;
}
ui->copyAddress->setEnabled(true);
ui->showQRCode->setEnabled(true);
}
else
{
ui->deleteAddress->setEnabled(false);
ui->showQRCode->setEnabled(false);
ui->copyAddress->setEnabled(false);
ui->signMessage->setEnabled(false);
ui->verifyMessage->setEnabled(false);
@ -312,9 +306,6 @@ void AddressBookPage::done(int retval) @@ -312,9 +306,6 @@ void AddressBookPage::done(int retval)
QTableView *table = ui->tableView;
if(!table->selectionModel() || !table->model())
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
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
@ -358,25 +349,6 @@ void AddressBookPage::on_exportButton_clicked() @@ -358,25 +349,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)
{
QModelIndex index = ui->tableView->indexAt(point);

4
src/qt/addressbookpage.h

@ -30,7 +30,7 @@ public: @@ -30,7 +30,7 @@ public:
};
enum Mode {
ForSending, /**< Open address book to pick address for sending */
ForSelection, /**< Open address book to pick address */
ForEditing /**< Open address book for editing */
};
@ -69,8 +69,6 @@ private slots: @@ -69,8 +69,6 @@ private slots:
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) */
void onCopyLabelAction();
/** Edit currently selected address entry (no button) */

26
src/qt/bitcoingui.cpp

@ -207,13 +207,6 @@ void BitcoinGUI::createActions(bool fIsTestnet) @@ -207,13 +207,6 @@ void BitcoinGUI::createActions(bool fIsTestnet)
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
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(gotoOverviewPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@ -222,8 +215,6 @@ void BitcoinGUI::createActions(bool fIsTestnet) @@ -222,8 +215,6 @@ void BitcoinGUI::createActions(bool fIsTestnet)
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
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->setStatusTip(tr("Quit application"));
@ -266,6 +257,11 @@ void BitcoinGUI::createActions(bool fIsTestnet) @@ -266,6 +257,11 @@ void BitcoinGUI::createActions(bool fIsTestnet)
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
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(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
@ -276,6 +272,8 @@ void BitcoinGUI::createActions(bool fIsTestnet) @@ -276,6 +272,8 @@ void BitcoinGUI::createActions(bool fIsTestnet)
connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses()));
connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
}
void BitcoinGUI::createMenuBar()
@ -294,6 +292,9 @@ void BitcoinGUI::createMenuBar() @@ -294,6 +292,9 @@ void BitcoinGUI::createMenuBar()
file->addAction(signMessageAction);
file->addAction(verifyMessageAction);
file->addSeparator();
file->addAction(usedSendingAddressesAction);
file->addAction(usedReceivingAddressesAction);
file->addSeparator();
file->addAction(quitAction);
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
@ -317,7 +318,6 @@ void BitcoinGUI::createToolBars() @@ -317,7 +318,6 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
}
void BitcoinGUI::setClientModel(ClientModel *clientModel)
@ -457,12 +457,6 @@ void BitcoinGUI::gotoHistoryPage() @@ -457,12 +457,6 @@ void BitcoinGUI::gotoHistoryPage()
if (walletFrame) walletFrame->gotoHistoryPage();
}
void BitcoinGUI::gotoAddressBookPage()
{
addressBookAction->setChecked(true);
if (walletFrame) walletFrame->gotoAddressBookPage();
}
void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);

6
src/qt/bitcoingui.h

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

13
src/qt/forms/addressbookpage.ui

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Address Book</string>
<string></string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@ -82,17 +82,6 @@ @@ -82,17 +82,6 @@
</property>
</widget>
</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">

164
src/qt/forms/receivecoinsdialog.ui

@ -0,0 +1,164 @@ @@ -0,0 +1,164 @@
<?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" native="true">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</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"/>
</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"/>
</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="text">
<string>R&amp;euse an existing receiving address</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>

151
src/qt/forms/qrcodedialog.ui → src/qt/forms/receiverequestdialog.ui

@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QRCodeDialog</class>
<widget class="QDialog" name="QRCodeDialog">
<class>ReceiveRequestDialog</class>
<widget class="QDialog" name="ReceiveRequestDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>530</height>
<width>487</width>
<height>597</height>
</rect>
</property>
<property name="windowTitle">
<string>QR Code Dialog</string>
<string>Request coins</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
@ -39,6 +39,37 @@ @@ -39,6 +39,37 @@
</property>
</widget>
</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 Image...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Bitcoin URI:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="outUri">
<property name="sizePolicy">
@ -61,25 +92,22 @@ @@ -61,25 +92,22 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Payment information:</string>
</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">
<item row="2" column="0">
<widget class="QLabel" name="lblLabel">
<property name="text">
<string>Label:</string>
@ -95,10 +123,17 @@ @@ -95,10 +123,17 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lnLabel"/>
<item row="2" column="1">
<widget class="QLineEdit" name="lnLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="lblMessage">
<property name="text">
<string>Message:</string>
@ -114,10 +149,17 @@ @@ -114,10 +149,17 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lnMessage"/>
<item row="3" column="1">
<widget class="QLineEdit" name="lnMessage">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="lblAmount">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@ -139,10 +181,10 @@ @@ -139,10 +181,10 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="BitcoinAmountField" name="lnReqAmount">
<item row="1" column="1">
<widget class="BitcoinAmountField" name="lnReqAmount" native="true">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
@ -150,29 +192,31 @@ @@ -150,29 +192,31 @@
<height>0</height>
</size>
</property>
<property name="readOnly" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Address:</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>reqAddress</cstring>
</property>
</spacer>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSaveAs">
<property name="text">
<string>&amp;Save As...</string>
<item row="0" column="1">
<widget class="QLineEdit" name="lnAddress">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
@ -186,27 +230,10 @@ @@ -186,27 +230,10 @@
<customwidgets>
<customwidget>
<class>BitcoinAmountField</class>
<extends>QLineEdit</extends>
<extends>QWidget</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>
<connections/>
</ui>

105
src/qt/receivecoinsdialog.cpp

@ -0,0 +1,105 @@ @@ -0,0 +1,105 @@
#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, "");
}
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(address, label,
ui->reqAmount->value(), ui->reqMessage->text(), this);
dialog->setModel(model->getOptionsModel());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
clear();
}

38
src/qt/receivecoinsdialog.h

@ -0,0 +1,38 @@ @@ -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

91
src/qt/qrcodedialog.cpp → src/qt/receiverequestdialog.cpp

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
#include "qrcodedialog.h"
#include "ui_qrcodedialog.h"
#include "receiverequestdialog.h"
#include "ui_receiverequestdialog.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
@ -11,35 +11,46 @@ @@ -11,35 +11,46 @@
#include <QUrl>
#endif
#include "bitcoin-config.h" /* for USE_QRCODE */
#ifdef USE_QRCODE
#include <qrencode.h>
#endif
QRCodeDialog::QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent) :
ReceiveRequestDialog::ReceiveRequestDialog(const QString &addr, const QString &label, quint64 amount, const QString &message, QWidget *parent) :
QDialog(parent),
ui(new Ui::QRCodeDialog),
ui(new Ui::ReceiveRequestDialog),
model(0),
address(addr)
{
ui->setupUi(this);
setWindowTitle(QString("%1").arg(address));
ui->chkReqPayment->setVisible(enableReq);
ui->lblAmount->setVisible(enableReq);
ui->lnReqAmount->setVisible(enableReq);
QString target = label;
if(target.isEmpty())
target = addr;
setWindowTitle(tr("Request payment to %1").arg(target));
ui->lnAddress->setText(addr);
if(amount)
ui->lnReqAmount->setValue(amount);
ui->lnReqAmount->setReadOnly(true);
ui->lnLabel->setText(label);
ui->lnMessage->setText(message);
ui->btnSaveAs->setEnabled(false);
#ifndef USE_QRCODE
ui->btnSaveAs->setVisible(false);
ui->lblQRCode->setVisible(false);
#endif
genCode();
}
QRCodeDialog::~QRCodeDialog()
ReceiveRequestDialog::~ReceiveRequestDialog()
{
delete ui;
}
void QRCodeDialog::setModel(OptionsModel *model)
void ReceiveRequestDialog::setModel(OptionsModel *model)
{
this->model = model;
@ -50,10 +61,12 @@ void QRCodeDialog::setModel(OptionsModel *model) @@ -50,10 +61,12 @@ void QRCodeDialog::setModel(OptionsModel *model)
updateDisplayUnit();
}
void QRCodeDialog::genCode()
void ReceiveRequestDialog::genCode()
{
QString uri = getURI();
ui->btnSaveAs->setEnabled(false);
ui->outUri->setPlainText(uri);
#ifdef USE_QRCODE
if (uri != "")
{
ui->lblQRCode->setText("");
@ -78,32 +91,21 @@ void QRCodeDialog::genCode() @@ -78,32 +91,21 @@ void QRCodeDialog::genCode()
QRcode_free(code);
ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300));
ui->outUri->setPlainText(uri);
ui->btnSaveAs->setEnabled(true);
}
#endif
}
QString QRCodeDialog::getURI()
QString ReceiveRequestDialog::getURI()
{
QString ret = QString("bitcoin:%1").arg(address);
int paramCount = 0;
ui->outUri->clear();
if (ui->chkReqPayment->isChecked())
if (ui->lnReqAmount->validate())
{
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("");
}
// 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++;
}
if (!ui->lnLabel->text().isEmpty())
@ -120,50 +122,41 @@ QString QRCodeDialog::getURI() @@ -120,50 +122,41 @@ QString QRCodeDialog::getURI()
paramCount++;
}
// limit URI length to prevent a DoS against the QR-Code dialog
// limit URI length
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()
void ReceiveRequestDialog::on_lnReqAmount_textChanged()
{
genCode();
}
void QRCodeDialog::on_lnLabel_textChanged()
void ReceiveRequestDialog::on_lnLabel_textChanged()
{
genCode();
}
void QRCodeDialog::on_lnMessage_textChanged()
void ReceiveRequestDialog::on_lnMessage_textChanged()
{
genCode();
}
void QRCodeDialog::on_btnSaveAs_clicked()
void ReceiveRequestDialog::on_btnSaveAs_clicked()
{
#ifdef USE_QRCODE
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);
#endif
}
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()
void ReceiveRequestDialog::updateDisplayUnit()
{
if (model)
{

11
src/qt/qrcodedialog.h → src/qt/receiverequestdialog.h

@ -5,17 +5,17 @@ @@ -5,17 +5,17 @@
#include <QImage>
namespace Ui {
class QRCodeDialog;
class ReceiveRequestDialog;
}
class OptionsModel;
class QRCodeDialog : public QDialog
class ReceiveRequestDialog : public QDialog
{
Q_OBJECT
public:
explicit QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent = 0);
~QRCodeDialog();
explicit ReceiveRequestDialog(const QString &addr, const QString &label, quint64 amount, const QString &message, QWidget *parent = 0);
~ReceiveRequestDialog();
void setModel(OptionsModel *model);
@ -24,12 +24,11 @@ private slots: @@ -24,12 +24,11 @@ private slots:
void on_lnLabel_textChanged();
void on_lnMessage_textChanged();
void on_btnSaveAs_clicked();
void on_chkReqPayment_toggled(bool fChecked);
void updateDisplayUnit();
private:
Ui::QRCodeDialog *ui;
Ui::ReceiveRequestDialog *ui;
OptionsModel *model;
QString address;
QImage myImage;

2
src/qt/sendcoinsentry.cpp

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

4
src/qt/signverifymessagedialog.cpp

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

21
src/qt/walletframe.cpp

@ -115,13 +115,6 @@ void WalletFrame::gotoHistoryPage() @@ -115,13 +115,6 @@ void WalletFrame::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()
{
QMap<QString, WalletView*>::const_iterator i;
@ -184,3 +177,17 @@ void WalletFrame::setEncryptionStatus() @@ -184,3 +177,17 @@ void WalletFrame::setEncryptionStatus()
if (walletView)
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();
}

7
src/qt/walletframe.h

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

41
src/qt/walletview.cpp

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "sendcoinsdialog.h"
#include "receivecoinsdialog.h"
#include "signverifymessagedialog.h"
#include "clientmodel.h"
#include "walletmodel.h"
@ -53,13 +54,11 @@ WalletView::WalletView(QWidget *parent): @@ -53,13 +54,11 @@ WalletView::WalletView(QWidget *parent):
vbox->addLayout(hbox_buttons);
transactionsPage->setLayout(vbox);
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
sendCoinsPage = new SendCoinsDialog();
receiveCoinsPage = new ReceiveCoinsDialog(gui);
sendCoinsPage = new SendCoinsDialog(gui);
addWidget(overviewPage);
addWidget(transactionsPage);
addWidget(addressBookPage);
addWidget(receiveCoinsPage);
addWidget(sendCoinsPage);
@ -69,10 +68,6 @@ WalletView::WalletView(QWidget *parent): @@ -69,10 +68,6 @@ WalletView::WalletView(QWidget *parent):
// Double-clicking on a transaction on the transaction history page shows details
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
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
// Clicking on "Export" allows to export the transaction list
@ -98,8 +93,6 @@ void WalletView::setClientModel(ClientModel *clientModel) @@ -98,8 +93,6 @@ void WalletView::setClientModel(ClientModel *clientModel)
if (clientModel)
{
overviewPage->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
}
}
@ -114,8 +107,7 @@ void WalletView::setWalletModel(WalletModel *walletModel) @@ -114,8 +107,7 @@ void WalletView::setWalletModel(WalletModel *walletModel)
// Put transaction list in tabs
transactionView->setModel(walletModel);
overviewPage->setWalletModel(walletModel);
addressBookPage->setModel(walletModel->getAddressTableModel());
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
receiveCoinsPage->setModel(walletModel);
sendCoinsPage->setModel(walletModel);
setEncryptionStatus();
@ -156,11 +148,6 @@ void WalletView::gotoHistoryPage() @@ -156,11 +148,6 @@ void WalletView::gotoHistoryPage()
setCurrentWidget(transactionsPage);
}
void WalletView::gotoAddressBookPage()
{
setCurrentWidget(addressBookPage);
}
void WalletView::gotoReceiveCoinsPage()
{
setCurrentWidget(receiveCoinsPage);
@ -270,3 +257,23 @@ void WalletView::unlockWallet() @@ -270,3 +257,23 @@ void WalletView::unlockWallet()
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();
}

12
src/qt/walletview.h

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

Loading…
Cancel
Save