Skip to content

Commit

Permalink
Merge pull request #1 from Infernoman/patch-1
Browse files Browse the repository at this point in the history
Fix Transaction Comments (Thanks to Infernoman)
  • Loading branch information
ahmedbodi authored and ahmedbodi committed Dec 31, 2015
2 parents 9e73a9a + 9c92ebe commit 7e91032
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ void SendCoinsDialog::on_sendButton_clicked()
if(!model || !model->getOptionsModel())
return;

QString txcomment = ui->editTxComment->text();

QList<SendCoinsRecipient> recipients;
bool valid = true;

Expand Down Expand Up @@ -172,9 +174,9 @@ void SendCoinsDialog::on_sendButton_clicked()
WalletModel::SendCoinsReturn sendstatus;

if (!model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
sendstatus = model->sendCoins(recipients);
sendstatus = model->sendCoins(txcomment, recipients);
else
sendstatus = model->sendCoins(recipients, CoinControlDialog::coinControl);
sendstatus = model->sendCoins(txcomment, recipients, CoinControlDialog::coinControl);

switch(sendstatus.status)
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/transactiondesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
if (!wtx.strTxComment.empty())
strHTML += "<b>" + tr("Transaction comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.strTxComment.c_str(), true) + "<br>";
strHTML += "<b>" + tr("Transaction comment") + ":</b><br>" + wtx.strTxComment.c_str() + "<br>";
strHTML += "<b>" + tr("Transaction ID") + ":</b> " + TransactionRecord::formatSubTxId(wtx.GetHash(), rec->idx) + "<br>";

if (wtx.IsCoinBase() || wtx.IsCoinStake())
Expand Down
2 changes: 1 addition & 1 deletion src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bool WalletModel::validateAddress(const QString &address)
return addressParsed.IsValid();
}

WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipient> &recipients, const CCoinControl *coinControl)
WalletModel::SendCoinsReturn WalletModel::sendCoins(const QString &txcomment, const QList<SendCoinsRecipient> &recipients, const CCoinControl *coinControl)
{
qint64 total = 0;
QSet<QString> setAddress;
Expand Down
4 changes: 3 additions & 1 deletion src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class WalletModel : public QObject
};

// Send coins to a list of recipients
SendCoinsReturn sendCoins(const QList<SendCoinsRecipient> &recipients, const CCoinControl *coinControl=NULL);
SendCoinsReturn sendCoins(const QString &txcomment, const QList<SendCoinsRecipient> &recipients, const CCoinControl *coinControl=NULL);

// Wallet encryption
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase);
Expand Down Expand Up @@ -146,6 +146,8 @@ class WalletModel : public QObject

QTimer *pollTimer;

QString txComment;

void subscribeToCoreSignals();
void unsubscribeFromCoreSignals();
void checkBalanceChanged();
Expand Down

0 comments on commit 7e91032

Please sign in to comment.