src/mainwindow.cpp
// Pay the Zcash URI by showing a confirmation window. If the URI parameter is empty, the UI
// will prompt for one. If the myAddr is empty, then the default from address is used to send
// the transaction.
Pay the Zcash URI by showing a confirmation window. If the URI parameter is empty, the UI
will prompt for one. If the myAddr is empty, then the default from address is used to send
the transaction.
Pay the Zcash URI by showing a confirmation window . If the URI parameter is empty the UI will prompt for one . If the myAddr is empty then the default from address is used to send the transaction .
void MainWindow::payZcashURI(QString uri, QString myAddr) {
    if (!uiPaymentsReady) {
        qDebug() << "Payment UI not ready, waiting for UI to pay URI";
        pendingURIPayment = uri;
        return;
    }
    if (uri.isEmpty()) {
        uri = QInputDialog::getText(this, tr("Paste HUSH URI"),
            "HUSH URI" + QString(" ").repeated(180));
    }
    if (uri.isEmpty())
        return;
    qDebug() << "Received URI " << uri;
    PaymentURI paymentInfo = Settings::parseURI(uri);
    if (!paymentInfo.error.isEmpty()) {
        QMessageBox::critical(this, tr("Error paying Hush URI"),
                tr("URI should be of the form 'hush:<addr>?amt=x&memo=y") + "\n" + paymentInfo.error);
        return;
    }
    removeExtraAddresses();
    if (!myAddr.isEmpty()) {
        ui->inputsCombo->setCurrentText(myAddr);
    }
    ui->Address1->setText(paymentInfo.addr);
    ui->Address1->setCursorPosition(0);
    ui->Amount1->setText(Settings::getDecimalString(paymentInfo.amt.toDouble()));
    ui->MemoTxt1->setText(paymentInfo.memo);
    ui->tabWidget->setCurrentIndex(1);
    raise();
    if (paymentInfo.amt > 0) {
        sendButton();
    }
}
void MainWindow :: payZcashURI ( QString uri , QString myAddr ) { if ( ! uiPaymentsReady ) { qDebug ( ) << " " ; pendingURIPayment = uri ; return ; } if ( uri . isEmpty ( ) ) { uri = QInputDialog :: getText ( this , tr ( " " ) , " " + QString ( " " ) . repeated ( 180 ) ) ; } if ( uri . isEmpty ( ) ) return ; qDebug ( ) << " " << uri ; PaymentURI paymentInfo = Settings :: parseURI ( uri ) ; if ( ! paymentInfo . error . isEmpty ( ) ) { QMessageBox :: critical ( this , tr ( " " ) , tr ( " " ) + " \n " + paymentInfo . error ) ; return ; } removeExtraAddresses ( ) ; if ( ! myAddr . isEmpty ( ) ) { ui -> inputsCombo -> setCurrentText ( myAddr ) ; } ui -> Address1 -> setText ( paymentInfo . addr ) ; ui -> Address1 -> setCursorPosition ( 0 ) ; ui -> Amount1 -> setText ( Settings :: getDecimalString ( paymentInfo . amt . toDouble ( ) ) ) ; ui -> MemoTxt1 -> setText ( paymentInfo . memo ) ; ui -> tabWidget -> setCurrentIndex ( 1 ) ; raise ( ) ; if ( paymentInfo . amt > 0 ) { sendButton ( ) ; } }
Pay the Zcash URI by showing a confirmation window.
Pay the Zcash URI by showing a confirmation window .
// If the Payments UI is not ready (i.e, all balances have not loaded), defer the payment URI // If there was no URI passed, ask the user for one. // If there's no URI, just exit // Extract the address // Now, set the fields on the send tab // And switch to the send tab. // And click the send button if the amount is > 0, to validate everything. If everything is OK, it will show the confirm box // else, show the error message;