aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoin.cpp22
-rw-r--r--src/qt/bitcoingui.cpp12
-rw-r--r--src/qt/bitcoingui.h2
-rw-r--r--src/qt/guiutil.cpp18
-rw-r--r--src/qt/guiutil.h8
-rw-r--r--src/qt/qtipcserver.cpp13
-rw-r--r--src/qt/qtipcserver.h2
-rw-r--r--src/qt/sendcoinsdialog.cpp4
-rw-r--r--src/qt/sendcoinsdialog.h2
-rw-r--r--src/qt/test/test_main.cpp4
-rw-r--r--src/qt/test/uritests.cpp (renamed from src/qt/test/urltests.cpp)48
-rw-r--r--src/qt/test/uritests.h15
-rw-r--r--src/qt/test/urltests.h15
-rw-r--r--src/ui_interface.h2
14 files changed, 85 insertions, 82 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 394e4a7661..bfb49cbcab 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -74,13 +74,13 @@ bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption)
return payFee;
}
-void ThreadSafeHandleURL(const std::string& strURL)
+void ThreadSafeHandleURI(const std::string& strURI)
{
if(!guiref)
return;
- QMetaObject::invokeMethod(guiref, "handleURL", GUIUtil::blockingGUIThreadConnection(),
- Q_ARG(QString, QString::fromStdString(strURL)));
+ QMetaObject::invokeMethod(guiref, "handleURI", GUIUtil::blockingGUIThreadConnection(),
+ Q_ARG(QString, QString::fromStdString(strURI)));
}
void MainFrameRepaint()
@@ -133,10 +133,10 @@ int main(int argc, char *argv[])
{
if (strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0)
{
- const char *strURL = argv[i];
+ const char *strURI = argv[i];
try {
- boost::interprocess::message_queue mq(boost::interprocess::open_only, "BitcoinURL");
- if(mq.try_send(strURL, strlen(strURL), 0))
+ boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
+ if(mq.try_send(strURI, strlen(strURI), 0))
exit(0);
else
break;
@@ -248,21 +248,21 @@ int main(int argc, char *argv[])
window.show();
}
- // Place this here as guiref has to be defined if we dont want to lose URLs
+ // Place this here as guiref has to be defined if we dont want to lose URIs
ipcInit();
#if !defined(MAC_OSX) && !defined(WIN32)
// TODO: implement qtipcserver.cpp for Mac and Windows
- // Check for URL in argv
+ // Check for URI in argv
for (int i = 1; i < argc; i++)
{
if (strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0)
{
- const char *strURL = argv[i];
+ const char *strURI = argv[i];
try {
- boost::interprocess::message_queue mq(boost::interprocess::open_only, "BitcoinURL");
- mq.try_send(strURL, strlen(strURL), 0);
+ boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
+ mq.try_send(strURI, strlen(strURI), 0);
}
catch (boost::interprocess::interprocess_exception &ex) {
}
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index a60b585225..70a3313309 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -715,7 +715,7 @@ void BitcoinGUI::gotoMessagePage(QString addr)
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
- // Accept only URLs
+ // Accept only URIs
if(event->mimeData()->hasUrls())
event->acceptProposedAction();
}
@@ -725,20 +725,20 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
if(event->mimeData()->hasUrls())
{
gotoSendCoinsPage();
- QList<QUrl> urls = event->mimeData()->urls();
- foreach(const QUrl &url, urls)
+ QList<QUrl> uris = event->mimeData()->urls();
+ foreach(const QUrl &uri, uris)
{
- sendCoinsPage->handleURL(url.toString());
+ sendCoinsPage->handleURI(uri.toString());
}
}
event->acceptProposedAction();
}
-void BitcoinGUI::handleURL(QString strURL)
+void BitcoinGUI::handleURI(QString strURI)
{
gotoSendCoinsPage();
- sendCoinsPage->handleURL(strURL);
+ sendCoinsPage->handleURI(strURI);
if(!isActiveWindow())
activateWindow();
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index c684d7cc3a..46e0fb1be2 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -125,7 +125,7 @@ public slots:
@param[out] payFee true to pay the fee, false to not pay the fee
*/
void askFee(qint64 nFeeRequired, bool *payFee);
- void handleURL(QString strURL);
+ void handleURI(QString strURI);
void gotoMessagePage();
void gotoMessagePage(QString);
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index ad530a78e4..2a3063ba35 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -52,15 +52,15 @@ void GUIUtil::setupAmountWidget(QLineEdit *widget, QWidget *parent)
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
}
-bool GUIUtil::parseBitcoinURL(const QUrl &url, SendCoinsRecipient *out)
+bool GUIUtil::parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
- if(url.scheme() != QString("bitcoin"))
+ if(uri.scheme() != QString("bitcoin"))
return false;
SendCoinsRecipient rv;
- rv.address = url.path();
+ rv.address = uri.path();
rv.amount = 0;
- QList<QPair<QString, QString> > items = url.queryItems();
+ QList<QPair<QString, QString> > items = uri.queryItems();
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
{
bool fShouldReturnFalse = false;
@@ -97,18 +97,18 @@ bool GUIUtil::parseBitcoinURL(const QUrl &url, SendCoinsRecipient *out)
return true;
}
-bool GUIUtil::parseBitcoinURL(QString url, SendCoinsRecipient *out)
+bool GUIUtil::parseBitcoinURI(QString uri, 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://"))
+ if(uri.startsWith("bitcoin://"))
{
- url.replace(0, 10, "bitcoin:");
+ uri.replace(0, 10, "bitcoin:");
}
- QUrl urlInstance(url);
- return parseBitcoinURL(urlInstance, out);
+ QUrl uriInstance(uri);
+ return parseBitcoinURI(uriInstance, out);
}
QString GUIUtil::HtmlEscape(const QString& str, bool fMultiLine)
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 06426d76bc..3b5bc384ae 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -29,10 +29,10 @@ public:
static void setupAddressWidget(QLineEdit *widget, QWidget *parent);
static void setupAmountWidget(QLineEdit *widget, QWidget *parent);
- // 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);
+ // Parse "bitcoin:" URI into recipient object, return true on succesful parsing
+ // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
+ static bool parseBitcoinURI(const QUrl &, SendCoinsRecipient *out);
+ static bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
// HTML escaping for rich text controls
static QString HtmlEscape(const QString& str, bool fMultiLine=false);
diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp
index 8b9270e178..3c7889ca71 100644
--- a/src/qt/qtipcserver.cpp
+++ b/src/qt/qtipcserver.cpp
@@ -8,6 +8,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include "headers.h"
+#include "qtipcserver.h"
using namespace boost::interprocess;
using namespace boost::posix_time;
@@ -16,7 +17,7 @@ using namespace std;
void ipcShutdown()
{
- message_queue::remove("BitcoinURL");
+ message_queue::remove(BITCOINURI_QUEUE_NAME);
}
void ipcThread(void* parg)
@@ -30,7 +31,7 @@ void ipcThread(void* parg)
ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100);
if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d))
{
- ThreadSafeHandleURL(std::string(strBuf, nSize));
+ ThreadSafeHandleURI(std::string(strBuf, nSize));
Sleep(1000);
}
if (fShutdown)
@@ -60,7 +61,7 @@ void ipcInit()
size_t nSize;
unsigned int nPriority;
try {
- mq = new message_queue(open_or_create, "BitcoinURL", 2, 256);
+ mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, 256);
// Make sure we don't lose any bitcoin: URIs
for (int i = 0; i < 2; i++)
@@ -68,15 +69,15 @@ void ipcInit()
ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1);
if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d))
{
- ThreadSafeHandleURL(std::string(strBuf, nSize));
+ ThreadSafeHandleURI(std::string(strBuf, nSize));
}
else
break;
}
// Make sure only one bitcoin instance is listening
- message_queue::remove("BitcoinURL");
- mq = new message_queue(open_or_create, "BitcoinURL", 2, 256);
+ message_queue::remove(BITCOINURI_QUEUE_NAME);
+ mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, 256);
}
catch (interprocess_exception &ex) {
return;
diff --git a/src/qt/qtipcserver.h b/src/qt/qtipcserver.h
index 1de0334afd..fcff10d8da 100644
--- a/src/qt/qtipcserver.h
+++ b/src/qt/qtipcserver.h
@@ -1,2 +1,4 @@
+#define BITCOINURI_QUEUE_NAME "BitcoinURI"
+
void ipcInit();
void ipcShutdown();
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 964313ea81..592ae6f45a 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -265,10 +265,10 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
}
-void SendCoinsDialog::handleURL(const QString &url)
+void SendCoinsDialog::handleURI(const QString &uri)
{
SendCoinsRecipient rv;
- if(!GUIUtil::parseBitcoinURL(url, &rv))
+ if(!GUIUtil::parseBitcoinURI(uri, &rv))
{
return;
}
diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h
index 4dc3f08bc5..5dcbfbeb61 100644
--- a/src/qt/sendcoinsdialog.h
+++ b/src/qt/sendcoinsdialog.h
@@ -30,7 +30,7 @@ public:
QWidget *setupTabChain(QWidget *prev);
void pasteEntry(const SendCoinsRecipient &rv);
- void handleURL(const QString &url);
+ void handleURI(const QString &uri);
public slots:
void clear();
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp
index 0a08eafa1e..5b11e39ea3 100644
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -1,11 +1,11 @@
#include <QTest>
#include <QObject>
-#include "urltests.h"
+#include "uritests.h"
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
- URLTests test1;
+ URITests test1;
QTest::qExec(&test1);
}
diff --git a/src/qt/test/urltests.cpp b/src/qt/test/uritests.cpp
index 1f11795a9b..70c20be0ea 100644
--- a/src/qt/test/urltests.cpp
+++ b/src/qt/test/uritests.cpp
@@ -1,4 +1,4 @@
-#include "urltests.h"
+#include "uritests.h"
#include "../guiutil.h"
#include "../walletmodel.h"
@@ -13,59 +13,59 @@ struct SendCoinsRecipient
};
*/
-void URLTests::urlTests()
+void URITests::uriTests()
{
SendCoinsRecipient rv;
- QUrl url;
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?req-dontexist="));
- QVERIFY(!GUIUtil::parseBitcoinURL(url, &rv));
+ QUrl uri;
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?req-dontexist="));
+ QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?dontexist="));
- QVERIFY(GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?dontexist="));
+ QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.label == QString());
QVERIFY(rv.amount == 0);
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?label=Wikipedia Example Address"));
- QVERIFY(GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?label=Wikipedia Example Address"));
+ QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.label == QString("Wikipedia Example Address"));
QVERIFY(rv.amount == 0);
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=0.001"));
- QVERIFY(GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=0.001"));
+ QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.label == QString());
QVERIFY(rv.amount == 100000);
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1.001"));
- QVERIFY(GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1.001"));
+ QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.label == QString());
QVERIFY(rv.amount == 100100000);
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=100&label=Wikipedia Example"));
- QVERIFY(GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=100&label=Wikipedia Example"));
+ QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.amount == 10000000000);
QVERIFY(rv.label == QString("Wikipedia Example"));
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address"));
- QVERIFY(GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address"));
+ QVERIFY(GUIUtil::parseBitcoinURI(uri, &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.label == QString());
- QVERIFY(GUIUtil::parseBitcoinURL("bitcoin://175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address", &rv));
+ QVERIFY(GUIUtil::parseBitcoinURI("bitcoin://175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?message=Wikipedia Example Address", &rv));
QVERIFY(rv.address == QString("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"));
QVERIFY(rv.label == QString());
// We currently dont implement the message paramenter (ok, yea, we break spec...)
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?req-message=Wikipedia Example Address"));
- QVERIFY(!GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?req-message=Wikipedia Example Address"));
+ QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1,000&label=Wikipedia Example"));
- QVERIFY(!GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1,000&label=Wikipedia Example"));
+ QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
- url.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1,000.0&label=Wikipedia Example"));
- QVERIFY(!GUIUtil::parseBitcoinURL(url, &rv));
+ uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1,000.0&label=Wikipedia Example"));
+ QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv));
}
diff --git a/src/qt/test/uritests.h b/src/qt/test/uritests.h
new file mode 100644
index 0000000000..1237516e5f
--- /dev/null
+++ b/src/qt/test/uritests.h
@@ -0,0 +1,15 @@
+#ifndef URITESTS_H
+#define URITESTS_H
+
+#include <QTest>
+#include <QObject>
+
+class URITests : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void uriTests();
+};
+
+#endif // URITESTS_H
diff --git a/src/qt/test/urltests.h b/src/qt/test/urltests.h
deleted file mode 100644
index 393c511390..0000000000
--- a/src/qt/test/urltests.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef URLTESTS_H
-#define URLTESTS_H
-
-#include <QTest>
-#include <QObject>
-
-class URLTests : public QObject
-{
- Q_OBJECT
-
-private slots:
- void urlTests();
-};
-
-#endif // URLTESTS_H
diff --git a/src/ui_interface.h b/src/ui_interface.h
index 2e29f2af16..514768086d 100644
--- a/src/ui_interface.h
+++ b/src/ui_interface.h
@@ -40,7 +40,7 @@
extern int ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style=wxOK);
extern bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption);
-extern void ThreadSafeHandleURL(const std::string& strURL);
+extern void ThreadSafeHandleURI(const std::string& strURI);
extern void MainFrameRepaint();
extern void AddressBookRepaint();
extern void QueueShutdown();