diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-25 04:27:05 -0700 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-25 04:27:05 -0700 |
commit | 081c0cdeb2b8c1e8db449f3b38837c4ca3b4ba73 (patch) | |
tree | 21559f88288cda3543659d5c06622613284dfa3f /src/qt/guiutil.cpp | |
parent | 48cc4fc326fa916954967580ca49c24044d55754 (diff) | |
parent | 70b14636cd60529c87b2cc61516f5d1bf49299a5 (diff) | |
download | bitcoin-081c0cdeb2b8c1e8db449f3b38837c4ca3b4ba73.tar.xz |
Merge pull request #3099 from laanwj/2013_10_new_receive_flow
qt: improve "receive coins" workflow
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r-- | src/qt/guiutil.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index b65348548b..9bb2fa7c99 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -112,6 +112,11 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) rv.label = i->second; fShouldReturnFalse = false; } + if (i->first == "message") + { + rv.message = i->second; + fShouldReturnFalse = false; + } else if (i->first == "amount") { if(!i->second.isEmpty()) @@ -148,6 +153,34 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out) return parseBitcoinURI(uriInstance, out); } +QString formatBitcoinURI(const SendCoinsRecipient &info) +{ + QString ret = QString("bitcoin:%1").arg(info.address); + int paramCount = 0; + + if (info.amount) + { + ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, info.amount)); + paramCount++; + } + + if (!info.label.isEmpty()) + { + QString lbl(QUrl::toPercentEncoding(info.label)); + ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl); + paramCount++; + } + + if (!info.message.isEmpty()) + { + QString msg(QUrl::toPercentEncoding(info.message));; + ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg); + paramCount++; + } + + return ret; +} + bool isDust(const QString& address, qint64 amount) { CTxDestination dest = CBitcoinAddress(address.toStdString()).Get(); |