mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 18:22:57 +02:00
Restructure IPC URL handling (fixes #851)
This commit is contained in:
committed by
Luke Dashjr
parent
82705af1eb
commit
33e0c3a866
@@ -72,3 +72,17 @@ bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GUIUtil::parseBitcoinURL(QString url, SendCoinsRecipient *out)
|
||||
{
|
||||
// Convert bitcoin:// to bitcoin:
|
||||
//
|
||||
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
|
||||
// which will lowercase it (and thus invalidate the address).
|
||||
if(url.startsWith("bitcoin://"))
|
||||
{
|
||||
url.replace(0, 10, "bitcoin:");
|
||||
}
|
||||
QUrl urlInstance(url);
|
||||
return parseBitcoinURL(&urlInstance, out);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
// Parse "bitcoin:" URL into recipient object, return true on succesful parsing
|
||||
// See Bitcoin URL definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
|
||||
static bool parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out);
|
||||
static bool parseBitcoinURL(QString url, SendCoinsRecipient *out);
|
||||
};
|
||||
|
||||
#endif // GUIUTIL_H
|
||||
|
||||
@@ -265,6 +265,16 @@ void SendCoinsDialog::handleURL(const QUrl *url)
|
||||
pasteEntry(rv);
|
||||
}
|
||||
|
||||
void SendCoinsDialog::handleURL(const QString &url)
|
||||
{
|
||||
SendCoinsRecipient rv;
|
||||
if(!GUIUtil::parseBitcoinURL(url, &rv))
|
||||
{
|
||||
return;
|
||||
}
|
||||
pasteEntry(rv);
|
||||
}
|
||||
|
||||
void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance)
|
||||
{
|
||||
Q_UNUSED(unconfirmedBalance);
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
|
||||
void pasteEntry(const SendCoinsRecipient &rv);
|
||||
void handleURL(const QUrl *url);
|
||||
void handleURL(const QString &url);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user