Browse Source

Migrate to hush:// payment URLs everywhere

pull/45/head
Jonathan "Duke" Leto 5 years ago
parent
commit
c1101af2e2
  1. 2
      src/mainwindow.cpp
  2. 6
      src/requestdialog.cpp
  3. 4
      src/settings.cpp
  4. 4
      src/txtablemodel.cpp

2
src/mainwindow.cpp

@ -820,7 +820,7 @@ void MainWindow::payZcashURI(QString uri, QString myAddr) {
PaymentURI paymentInfo = Settings::parseURI(uri); PaymentURI paymentInfo = Settings::parseURI(uri);
if (!paymentInfo.error.isEmpty()) { if (!paymentInfo.error.isEmpty()) {
QMessageBox::critical(this, tr("Error paying pirate URI"), QMessageBox::critical(this, tr("Error paying pirate URI"),
tr("URI should be of the form 'pirate:<addr>?amt=x&memo=y") + "\n" + paymentInfo.error); tr("URI should be of the form 'hush:<addr>?amt=x&memo=y") + "\n" + paymentInfo.error);
return; return;
} }

6
src/requestdialog.cpp

@ -48,7 +48,7 @@ void RequestDialog::showPaymentConfirmation(MainWindow* main, QString paymentURI
PaymentURI payInfo = Settings::parseURI(paymentURI); PaymentURI payInfo = Settings::parseURI(paymentURI);
if (!payInfo.error.isEmpty()) { if (!payInfo.error.isEmpty()) {
QMessageBox::critical(main, tr("Error paying HUSH URI"), QMessageBox::critical(main, tr("Error paying HUSH URI"),
tr("URI should be of the form 'pirate:<addr>?amt=x&memo=y") + "\n" + payInfo.error); tr("URI should be of the form 'hush:<addr>?amt=x&memo=y") + "\n" + payInfo.error);
return; return;
} }
@ -124,11 +124,11 @@ void RequestDialog::showRequestZcash(MainWindow* main) {
if (d.exec() == QDialog::Accepted) { if (d.exec() == QDialog::Accepted) {
// Construct a zcash Payment URI with the data and pay it immediately. // Construct a zcash Payment URI with the data and pay it immediately.
QString memoURI = "pirate:" + req.cmbMyAddress->currentText() QString memoURI = "hush:" + req.cmbMyAddress->currentText()
+ "?amt=" + Settings::getDecimalString(req.txtAmount->text().toDouble()) + "?amt=" + Settings::getDecimalString(req.txtAmount->text().toDouble())
+ "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText()); + "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText());
QString sendURI = "pirate:" + AddressBook::addressFromAddressLabel(req.txtFrom->text()) QString sendURI = "hush:" + AddressBook::addressFromAddressLabel(req.txtFrom->text())
+ "?amt=0.0001" + "?amt=0.0001"
+ "&memo=" + QUrl::toPercentEncoding(memoURI); + "&memo=" + QUrl::toPercentEncoding(memoURI);

4
src/settings.cpp

@ -296,12 +296,12 @@ QString Settings::paymentURIPretty(PaymentURI uri) {
PaymentURI Settings::parseURI(QString uri) { PaymentURI Settings::parseURI(QString uri) {
PaymentURI ans; PaymentURI ans;
if (!uri.startsWith("pirate:")) { if (!uri.startsWith("hush:")) {
ans.error = "Not a HUSH payment URI"; ans.error = "Not a HUSH payment URI";
return ans; return ans;
} }
uri = uri.right(uri.length() - QString("pirate:").length()); uri = uri.right(uri.length() - QString("hush:").length());
QRegExp re("([a-zA-Z0-9]+)"); QRegExp re("([a-zA-Z0-9]+)");
int pos; int pos;

4
src/txtablemodel.cpp

@ -139,7 +139,7 @@ void TxTableModel::updateAllData() {
if (role == Qt::ToolTipRole) { if (role == Qt::ToolTipRole) {
switch (index.column()) { switch (index.column()) {
case 0: { case 0: {
if (dat.memo.startsWith("pirate:")) { if (dat.memo.startsWith("hush:")) {
return Settings::paymentURIPretty(Settings::parseURI(dat.memo)); return Settings::paymentURIPretty(Settings::parseURI(dat.memo));
} else { } else {
return modeldata->at(index.row()).type + return modeldata->at(index.row()).type +
@ -161,7 +161,7 @@ void TxTableModel::updateAllData() {
if (role == Qt::DecorationRole && index.column() == 0) { if (role == Qt::DecorationRole && index.column() == 0) {
if (!dat.memo.isEmpty()) { if (!dat.memo.isEmpty()) {
// If the memo is a Payment URI, then show a payment request icon // If the memo is a Payment URI, then show a payment request icon
if (dat.memo.startsWith("pirate:")) { if (dat.memo.startsWith("hush:")) {
QIcon icon(":/icons/res/paymentreq.gif"); QIcon icon(":/icons/res/paymentreq.gif");
return QVariant(icon.pixmap(16, 16)); return QVariant(icon.pixmap(16, 16));
} else { } else {

Loading…
Cancel
Save