aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-08-07 16:04:48 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-08-07 16:04:48 +0200
commitdb7f023417eeeb96eed35c9d06541544abcd7033 (patch)
tree2f10b47a3090b5a7b1ae2c54342d0a7ed70b6d3e /src/qt/guiutil.cpp
parent330c190958a31a126de7a7b12124070300b1567b (diff)
Accept "bitcoin:" URL drops from browsers
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r--src/qt/guiutil.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index ece069072f..3516d4f83a 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -1,5 +1,7 @@
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
+#include "walletmodel.h"
+#include "bitcoinunits.h"
#include "headers.h"
@@ -8,6 +10,7 @@
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
+#include <QUrl>
QString GUIUtil::DateTimeStr(qint64 nTime)
{
@@ -41,3 +44,22 @@ void GUIUtil::setupAmountWidget(QLineEdit *widget, QWidget *parent)
widget->setValidator(amountValidator);
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
}
+
+bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
+{
+ if(url->scheme() != QString("bitcoin"))
+ return false;
+
+ SendCoinsRecipient rv;
+ rv.address = url->path();
+ rv.label = url->queryItemValue("label");
+ if(!BitcoinUnits::parse(BitcoinUnits::BTC, url->queryItemValue("amount"), &rv.amount))
+ {
+ return false;
+ }
+ if(out)
+ {
+ *out = rv;
+ }
+ return true;
+}