diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-02-17 15:26:20 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-02-17 15:32:51 +0100 |
commit | 23b3cf9d10b8e999c46238631239005f2367a5f9 (patch) | |
tree | 80108137c3922024f5f7779ae5436ada4b803a23 /src/qt/guiutil.cpp | |
parent | 39231e91052bff032525d99dbe890f742b6180fe (diff) |
Restructure IPC URL handling (fixes #851)
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r-- | src/qt/guiutil.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 29ef554ac3..02fc3b6700 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -49,15 +49,15 @@ void GUIUtil::setupAmountWidget(QLineEdit *widget, QWidget *parent) widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter); } -bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out) +bool GUIUtil::parseBitcoinURL(const QUrl &url, SendCoinsRecipient *out) { - if(url->scheme() != QString("bitcoin")) + if(url.scheme() != QString("bitcoin")) return false; SendCoinsRecipient rv; - rv.address = url->path(); + rv.address = url.path(); rv.amount = 0; - QList<QPair<QString, QString> > items = url->queryItems(); + QList<QPair<QString, QString> > items = url.queryItems(); for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; @@ -94,6 +94,20 @@ 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); +} + QString GUIUtil::HtmlEscape(const QString& str, bool fMultiLine) { QString escaped = Qt::escape(str); |