|
|
|
@ -56,20 +56,37 @@ bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
@@ -56,20 +56,37 @@ bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
|
|
|
|
|
|
|
|
|
|
SendCoinsRecipient rv; |
|
|
|
|
rv.address = url->path(); |
|
|
|
|
rv.label = url->queryItemValue("label"); |
|
|
|
|
rv.amount = 0; |
|
|
|
|
QList<QPair<QString, QString> > items = url->queryItems(); |
|
|
|
|
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++) |
|
|
|
|
{ |
|
|
|
|
bool fShouldReturnFalse = false; |
|
|
|
|
if (i->first.startsWith("req-")) |
|
|
|
|
{ |
|
|
|
|
i->first.remove(0, 4); |
|
|
|
|
fShouldReturnFalse = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString amount = url->queryItemValue("amount"); |
|
|
|
|
if(amount.isEmpty()) |
|
|
|
|
if (i->first == "label") |
|
|
|
|
{ |
|
|
|
|
rv.amount = 0; |
|
|
|
|
rv.label = i->second; |
|
|
|
|
fShouldReturnFalse = false; |
|
|
|
|
} |
|
|
|
|
else // Amount is non-empty
|
|
|
|
|
else if (i->first == "amount") |
|
|
|
|
{ |
|
|
|
|
if(!BitcoinUnits::parse(BitcoinUnits::BTC, amount, &rv.amount)) |
|
|
|
|
if(!i->second.isEmpty()) |
|
|
|
|
{ |
|
|
|
|
if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount)) |
|
|
|
|
{ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
fShouldReturnFalse = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (fShouldReturnFalse) |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if(out) |
|
|
|
|
{ |
|
|
|
|
*out = rv; |
|
|
|
|