aboutsummaryrefslogtreecommitdiff
path: root/src/qt/paymentserver.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2013-08-31 01:11:12 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2013-09-09 12:36:04 +0200
commitd78900cc1bb188a29dfb23b1f41b00f35ceb69f7 (patch)
tree4d17c023e872e61a6011ab5fd9b92a682dd3f716 /src/qt/paymentserver.cpp
parent4c723841e25650f045ed55b1e6a619d6d43398d5 (diff)
downloadbitcoin-d78900cc1bb188a29dfb23b1f41b00f35ceb69f7.tar.xz
fix some cosmetic glitches in the codebase
- rename URL into URI in paymentserver where correct - add some missing Qt-coding-stuff in paymentserver - change QSpinBox to QLineEdit as base for BitcoinAmountField in .ui files (as this is the result when converting the BAF back into base) - remove some c_str() and replace with QString::fromStdString() - remove several new-lines - remove unneeded spaces - indentation fixes
Diffstat (limited to 'src/qt/paymentserver.cpp')
-rw-r--r--src/qt/paymentserver.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index 6c10d8a04d..72f75b42e6 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -44,8 +44,6 @@
#include "wallet.h"
#include "walletmodel.h"
-using namespace boost;
-
const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds
const QString BITCOIN_IPC_PREFIX("bitcoin:");
const char* BITCOIN_REQUEST_MIMETYPE = "application/bitcoin-paymentrequest";
@@ -73,14 +71,14 @@ static QString ipcServerName()
// Append a simple hash of the datadir
// Note that GetDataDir(true) returns a different path
// for -testnet versus main net
- QString ddir(GetDataDir(true).string().c_str());
+ QString ddir(QString::fromStdString(GetDataDir(true).string()));
name.append(QString::number(qHash(ddir)));
return name;
}
//
-// We store payment URLs and requests received before
+// We store payment URIs and requests received before
// the main GUI window is up and ready to ask the user
// to send payment.
@@ -250,8 +248,7 @@ bool PaymentServer::ipcSendCommandLine(int argc, char* argv[])
return fResult;
}
-PaymentServer::PaymentServer(QObject* parent,
- bool startLocalServer) : QObject(parent), saveURIs(true)
+PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : QObject(parent), saveURIs(true)
{
// Verify that the version of the library that we linked against is
// compatible with the version of the headers we compiled against.
@@ -286,12 +283,12 @@ PaymentServer::~PaymentServer()
}
//
-// OSX-specific way of handling bitcoin uris and
+// OSX-specific way of handling bitcoin: URIs and
// PaymentRequest mime types
//
bool PaymentServer::eventFilter(QObject *, QEvent *event)
{
- // clicking on bitcoin: URLs creates FileOpen events on the Mac:
+ // clicking on bitcoin: URIs creates FileOpen events on the Mac:
if (event->type() == QEvent::FileOpen)
{
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
@@ -356,13 +353,13 @@ void PaymentServer::handleURIOrFile(const QString& s)
if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin:
{
#if QT_VERSION >= 0x050000
- QUrlQuery url((QUrl(s)));
+ QUrlQuery uri((QUrl(s)));
#else
- QUrl url(s);
+ QUrl uri(s);
#endif
- if (url.hasQueryItem("request"))
+ if (uri.hasQueryItem("request"))
{
- QByteArray temp; temp.append(url.queryItemValue("request"));
+ QByteArray temp; temp.append(uri.queryItemValue("request"));
QString decoded = QUrl::fromPercentEncoding(temp);
QUrl fetchUrl(decoded, QUrl::StrictMode);
@@ -436,9 +433,7 @@ bool PaymentServer::readPaymentRequest(const QString& filename, PaymentRequestPl
return request.parse(data);
}
-bool
-PaymentServer::processPaymentRequest(PaymentRequestPlus& request,
- QList<SendCoinsRecipient>& recipients)
+bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, QList<SendCoinsRecipient>& recipients)
{
if (!optionsModel)
return false;
@@ -493,7 +488,7 @@ PaymentServer::processPaymentRequest(PaymentRequestPlus& request,
// Insecure payments to custom bitcoin addresses are not supported
// (there is no good way to tell the user where they are paying in a way
// they'd have a chance of understanding).
- emit reportError(tr("Payment request error"),
+ emit reportError(tr("Payment request error"),
tr("Insecure requests to custom payment scripts unsupported"),
CClientUIInterface::MODAL);
return false;
@@ -504,8 +499,7 @@ PaymentServer::processPaymentRequest(PaymentRequestPlus& request,
return true;
}
-void
-PaymentServer::fetchRequest(const QUrl& url)
+void PaymentServer::fetchRequest(const QUrl& url)
{
QNetworkRequest netRequest;
netRequest.setAttribute(QNetworkRequest::User, "PaymentRequest");
@@ -515,8 +509,7 @@ PaymentServer::fetchRequest(const QUrl& url)
netManager->get(netRequest);
}
-void
-PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction)
+void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction)
{
const payments::PaymentDetails& details = recipient.paymentRequest.getDetails();
if (!details.has_payment_url())
@@ -571,8 +564,7 @@ PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QB
}
}
-void
-PaymentServer::netRequestFinished(QNetworkReply* reply)
+void PaymentServer::netRequestFinished(QNetworkReply* reply)
{
reply->deleteLater();
if (reply->error() != QNetworkReply::NoError)
@@ -617,9 +609,10 @@ PaymentServer::netRequestFinished(QNetworkReply* reply)
}
}
-void
-PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError> &errs)
+void PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError> &errs)
{
+ Q_UNUSED(reply);
+
QString errString;
foreach (const QSslError& err, errs) {
qDebug() << "PaymentServer::reportSslErrors : " << err;