fix "send coins" via context menu in address book

- the send coins context menu entry was not working anymore, because
  a non current version of #2220 was merged onto current master
- also removes some unneeded spaces and adds a comment to
  WalletModel::getNumTransactions()
This commit is contained in:
Philip Kaufmann 2013-04-01 14:43:50 +02:00
parent 71fcfbe79b
commit abf11f79ae
9 changed files with 31 additions and 24 deletions

View File

@ -475,9 +475,9 @@ void BitcoinGUI::gotoReceiveCoinsPage()
if (walletFrame) walletFrame->gotoReceiveCoinsPage(); if (walletFrame) walletFrame->gotoReceiveCoinsPage();
} }
void BitcoinGUI::gotoSendCoinsPage() void BitcoinGUI::gotoSendCoinsPage(QString addr)
{ {
if (walletFrame) walletFrame->gotoSendCoinsPage(); if (walletFrame) walletFrame->gotoSendCoinsPage(addr);
} }
void BitcoinGUI::gotoSignMessageTab(QString addr) void BitcoinGUI::gotoSignMessageTab(QString addr)

View File

@ -162,7 +162,7 @@ private slots:
/** Switch to receive coins page */ /** Switch to receive coins page */
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */
void gotoSendCoinsPage(); void gotoSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */ /** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = ""); void gotoSignMessageTab(QString addr = "");

View File

@ -88,9 +88,9 @@ void WalletFrame::gotoReceiveCoinsPage()
walletStack->gotoReceiveCoinsPage(); walletStack->gotoReceiveCoinsPage();
} }
void WalletFrame::gotoSendCoinsPage() void WalletFrame::gotoSendCoinsPage(QString addr)
{ {
walletStack->gotoSendCoinsPage(); walletStack->gotoSendCoinsPage(addr);
} }
void WalletFrame::gotoSignMessageTab(QString addr) void WalletFrame::gotoSignMessageTab(QString addr)

View File

@ -47,7 +47,7 @@ public slots:
/** Switch to receive coins page */ /** Switch to receive coins page */
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */
void gotoSendCoinsPage(); void gotoSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */ /** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = ""); void gotoSignMessageTab(QString addr = "");

View File

@ -56,6 +56,8 @@ int WalletModel::getNumTransactions() const
int numTransactions = 0; int numTransactions = 0;
{ {
LOCK(wallet->cs_wallet); LOCK(wallet->cs_wallet);
// the size of mapWallet contains the number of unique transaction IDs
// (e.g. payments to yourself generate 2 transactions, but both share the same transaction ID)
numTransactions = wallet->mapWallet.size(); numTransactions = wallet->mapWallet.size();
} }
return numTransactions; return numTransactions;

View File

@ -97,11 +97,11 @@ void WalletStack::gotoReceiveCoinsPage()
i.value()->gotoReceiveCoinsPage(); i.value()->gotoReceiveCoinsPage();
} }
void WalletStack::gotoSendCoinsPage() void WalletStack::gotoSendCoinsPage(QString addr)
{ {
QMap<QString, WalletView*>::const_iterator i; QMap<QString, WalletView*>::const_iterator i;
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i)
i.value()->gotoSendCoinsPage(); i.value()->gotoSendCoinsPage(addr);
} }
void WalletStack::gotoSignMessageTab(QString addr) void WalletStack::gotoSignMessageTab(QString addr)

View File

@ -76,7 +76,7 @@ public slots:
/** Switch to receive coins page */ /** Switch to receive coins page */
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */
void gotoSendCoinsPage(); void gotoSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */ /** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = ""); void gotoSignMessageTab(QString addr = "");

View File

@ -74,9 +74,11 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
// 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 "Verify Message" in the address book sends you to the verify message tab // 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))); connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
// Clicking on "Sign Message" in the receive coins page sends you to the sign message tab // 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)));
gotoOverviewPage(); gotoOverviewPage();
@ -257,13 +259,16 @@ void WalletView::gotoReceiveCoinsPage()
connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked())); connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
} }
void WalletView::gotoSendCoinsPage() void WalletView::gotoSendCoinsPage(QString addr)
{ {
sendCoinsAction->setChecked(true); sendCoinsAction->setChecked(true);
setCurrentWidget(sendCoinsPage); setCurrentWidget(sendCoinsPage);
exportAction->setEnabled(false); exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0); disconnect(exportAction, SIGNAL(triggered()), 0, 0);
if(!addr.isEmpty())
sendCoinsPage->setAddress(addr);
} }
void WalletView::gotoSignMessageTab(QString addr) void WalletView::gotoSignMessageTab(QString addr)

View File

@ -105,7 +105,7 @@ public slots:
/** Switch to receive coins page */ /** Switch to receive coins page */
void gotoReceiveCoinsPage(); void gotoReceiveCoinsPage();
/** Switch to send coins page */ /** Switch to send coins page */
void gotoSendCoinsPage(); void gotoSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */ /** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = ""); void gotoSignMessageTab(QString addr = "");