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

@ -205,7 +205,7 @@ void BitcoinGUI::createActions()
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(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); 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"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
@ -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)
@ -700,7 +700,7 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
void BitcoinGUI::incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address) void BitcoinGUI::incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address)
{ {
// On new transaction, make an info balloon // On new transaction, make an info balloon
message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"), message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"),
tr("Date: %1\n" tr("Date: %1\n"
"Amount: %2\n" "Amount: %2\n"

View File

@ -94,7 +94,7 @@ private:
QAction *changePassphraseAction; QAction *changePassphraseAction;
QAction *aboutQtAction; QAction *aboutQtAction;
QAction *openRPCConsoleAction; QAction *openRPCConsoleAction;
QSystemTrayIcon *trayIcon; QSystemTrayIcon *trayIcon;
Notificator *notificator; Notificator *notificator;
TransactionView *transactionView; TransactionView *transactionView;
@ -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

@ -25,7 +25,7 @@ public:
bool addWallet(const QString& name, WalletModel *walletModel); bool addWallet(const QString& name, WalletModel *walletModel);
bool setCurrentWallet(const QString& name); bool setCurrentWallet(const QString& name);
void removeAllWallets(); void removeAllWallets();
bool handleURI(const QString &uri); bool handleURI(const QString &uri);
@ -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

@ -45,16 +45,16 @@ public:
~WalletStack(); ~WalletStack();
void setBitcoinGUI(BitcoinGUI *gui) { this->gui = gui; } void setBitcoinGUI(BitcoinGUI *gui) { this->gui = gui; }
void setClientModel(ClientModel *clientModel) { this->clientModel = clientModel; } void setClientModel(ClientModel *clientModel) { this->clientModel = clientModel; }
bool addWallet(const QString& name, WalletModel *walletModel); bool addWallet(const QString& name, WalletModel *walletModel);
bool removeWallet(const QString& name); bool removeWallet(const QString& name);
void removeAllWallets(); void removeAllWallets();
bool handleURI(const QString &uri); bool handleURI(const QString &uri);
void showOutOfSyncWarning(bool fShow); void showOutOfSyncWarning(bool fShow);
private: private:
@ -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

@ -49,9 +49,9 @@ public:
functionality. functionality.
*/ */
void setWalletModel(WalletModel *walletModel); void setWalletModel(WalletModel *walletModel);
bool handleURI(const QString &uri); bool handleURI(const QString &uri);
void showOutOfSyncWarning(bool fShow); void showOutOfSyncWarning(bool fShow);
private: private:
@ -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 = "");
@ -125,7 +125,7 @@ public slots:
void changePassphrase(); void changePassphrase();
/** Ask for passphrase to unlock wallet temporarily */ /** Ask for passphrase to unlock wallet temporarily */
void unlockWallet(); void unlockWallet();
void setEncryptionStatus(); void setEncryptionStatus();
}; };