Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | bool parseBitcoinURI(const QString &scheme, const QUrl &uri, | ||||
} else { | } else { | ||||
// strip out uri scheme for base58 encoded addresses | // strip out uri scheme for base58 encoded addresses | ||||
rv.address = uri.path(); | rv.address = uri.path(); | ||||
} | } | ||||
// Trim any following forward slash which may have been added by the OS | // Trim any following forward slash which may have been added by the OS | ||||
if (rv.address.endsWith("/")) { | if (rv.address.endsWith("/")) { | ||||
rv.address.truncate(rv.address.length() - 1); | rv.address.truncate(rv.address.length() - 1); | ||||
} | } | ||||
rv.amount = 0; | rv.amount = Amount(0); | ||||
#if QT_VERSION < 0x050000 | #if QT_VERSION < 0x050000 | ||||
QList<QPair<QString, QString>> items = uri.queryItems(); | QList<QPair<QString, QString>> items = uri.queryItems(); | ||||
#else | #else | ||||
QUrlQuery uriQuery(uri); | QUrlQuery uriQuery(uri); | ||||
QList<QPair<QString, QString>> items = uriQuery.queryItems(); | QList<QPair<QString, QString>> items = uriQuery.queryItems(); | ||||
#endif | #endif | ||||
for (QList<QPair<QString, QString>>::iterator i = items.begin(); | for (QList<QPair<QString, QString>>::iterator i = items.begin(); | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
QString formatBitcoinURI(const Config &cfg, const SendCoinsRecipient &info) { | QString formatBitcoinURI(const Config &cfg, const SendCoinsRecipient &info) { | ||||
QString ret = info.address; | QString ret = info.address; | ||||
if (!cfg.UseCashAddrEncoding()) { | if (!cfg.UseCashAddrEncoding()) { | ||||
// prefix address with uri scheme for base58 encoded addresses. | // prefix address with uri scheme for base58 encoded addresses. | ||||
ret = (URI_SCHEME + ":%1").arg(ret); | ret = (URI_SCHEME + ":%1").arg(ret); | ||||
} | } | ||||
int paramCount = 0; | int paramCount = 0; | ||||
if (info.amount != 0) { | if (info.amount != Amount(0)) { | ||||
ret += | ret += | ||||
QString("?amount=%1") | QString("?amount=%1") | ||||
.arg(BitcoinUnits::format(BitcoinUnits::BCH, info.amount, false, | .arg(BitcoinUnits::format(BitcoinUnits::BCH, info.amount, false, | ||||
BitcoinUnits::separatorNever)); | BitcoinUnits::separatorNever)); | ||||
paramCount++; | paramCount++; | ||||
} | } | ||||
if (!info.label.isEmpty()) { | if (!info.label.isEmpty()) { | ||||
▲ Show 20 Lines • Show All 752 Lines • Show Last 20 Lines |