qt: move export button to tabs

Having the export button at the top was confusing people into thinking
the entire wallet was exported.

This commit moves the export button to the address book, receiving
addresses and transaction tabs separately.
This commit is contained in:
Wladimir J. van der Laan
2013-04-12 12:24:41 +02:00
parent 2aa462ec30
commit 45155d3010
6 changed files with 31 additions and 30 deletions

View File

@@ -23,6 +23,7 @@
#include <QAction>
#include <QDesktopServices>
#include <QFileDialog>
#include <QPushButton>
WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
QStackedWidget(parent),
@@ -35,8 +36,17 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
transactionsPage = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
QHBoxLayout *hbox_buttons = new QHBoxLayout();
transactionView = new TransactionView(this);
vbox->addWidget(transactionView);
QPushButton *exportButton = new QPushButton("&Export", this);
exportButton->setToolTip(tr("Export the data in the current tab to a file"));
#ifndef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
exportButton->setIcon(QIcon(":/icons/export"));
#endif
hbox_buttons->addStretch();
hbox_buttons->addWidget(exportButton);
vbox->addLayout(hbox_buttons);
transactionsPage->setLayout(vbox);
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
@@ -66,6 +76,8 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
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
connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));
gotoOverviewPage();
}
@@ -142,39 +154,24 @@ void WalletView::gotoOverviewPage()
{
gui->getOverviewAction()->setChecked(true);
setCurrentWidget(overviewPage);
gui->getExportAction()->setEnabled(false);
disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
}
void WalletView::gotoHistoryPage()
{
gui->getHistoryAction()->setChecked(true);
setCurrentWidget(transactionsPage);
gui->getExportAction()->setEnabled(true);
disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
connect(gui->getExportAction(), SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
}
void WalletView::gotoAddressBookPage()
{
gui->getAddressBookAction()->setChecked(true);
setCurrentWidget(addressBookPage);
gui->getExportAction()->setEnabled(true);
disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
connect(gui->getExportAction(), SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
}
void WalletView::gotoReceiveCoinsPage()
{
gui->getReceiveCoinsAction()->setChecked(true);
setCurrentWidget(receiveCoinsPage);
gui->getExportAction()->setEnabled(true);
disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
connect(gui->getExportAction(), SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
}
void WalletView::gotoSendCoinsPage(QString addr)
@@ -182,9 +179,6 @@ void WalletView::gotoSendCoinsPage(QString addr)
gui->getSendCoinsAction()->setChecked(true);
setCurrentWidget(sendCoinsPage);
gui->getExportAction()->setEnabled(false);
disconnect(gui->getExportAction(), SIGNAL(triggered()), 0, 0);
if (!addr.isEmpty())
sendCoinsPage->setAddress(addr);
}