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);
if (!paymentInfo.error.isEmpty()) {
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;
}

6
src/requestdialog.cpp

@ -48,7 +48,7 @@ void RequestDialog::showPaymentConfirmation(MainWindow* main, QString paymentURI
PaymentURI payInfo = Settings::parseURI(paymentURI);
if (!payInfo.error.isEmpty()) {
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;
}
@ -124,11 +124,11 @@ void RequestDialog::showRequestZcash(MainWindow* main) {
if (d.exec() == QDialog::Accepted) {
// 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())
+ "&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"
+ "&memo=" + QUrl::toPercentEncoding(memoURI);

4
src/settings.cpp

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

4
src/txtablemodel.cpp

@ -139,7 +139,7 @@ void TxTableModel::updateAllData() {
if (role == Qt::ToolTipRole) {
switch (index.column()) {
case 0: {
if (dat.memo.startsWith("pirate:")) {
if (dat.memo.startsWith("hush:")) {
return Settings::paymentURIPretty(Settings::parseURI(dat.memo));
} else {
return modeldata->at(index.row()).type +
@ -161,7 +161,7 @@ void TxTableModel::updateAllData() {
if (role == Qt::DecorationRole && index.column() == 0) {
if (!dat.memo.isEmpty()) {
// 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");
return QVariant(icon.pixmap(16, 16));
} else {

Loading…
Cancel
Save