Fix new t-Addresses not showing up after generation (#148)
* Fix typo: recieve -> receive * Fix new t-Addresses not showing up after generation Refresh the address list, as when generating z-Addresses.
This commit is contained in:
@@ -109,7 +109,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
setupSendTab();
|
setupSendTab();
|
||||||
setupTransactionsTab();
|
setupTransactionsTab();
|
||||||
setupRecieveTab();
|
setupReceiveTab();
|
||||||
setupBalancesTab();
|
setupBalancesTab();
|
||||||
setupTurnstileDialog();
|
setupTurnstileDialog();
|
||||||
setupZcashdTab();
|
setupZcashdTab();
|
||||||
@@ -826,7 +826,7 @@ void MainWindow::payZcashURI(QString uri, QString myAddr) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Extract the address
|
// Extract the address
|
||||||
qDebug() << "Recieved URI " << uri;
|
qDebug() << "Received URI " << uri;
|
||||||
PaymentURI paymentInfo = Settings::parseURI(uri);
|
PaymentURI paymentInfo = Settings::parseURI(uri);
|
||||||
if (!paymentInfo.error.isEmpty()) {
|
if (!paymentInfo.error.isEmpty()) {
|
||||||
QMessageBox::critical(this, tr("Error paying zcash URI"),
|
QMessageBox::critical(this, tr("Error paying zcash URI"),
|
||||||
@@ -1222,8 +1222,8 @@ void MainWindow::addNewZaddr(bool sapling) {
|
|||||||
|
|
||||||
// Just double make sure the z-address is still checked
|
// Just double make sure the z-address is still checked
|
||||||
if ( sapling && ui->rdioZSAddr->isChecked() ) {
|
if ( sapling && ui->rdioZSAddr->isChecked() ) {
|
||||||
ui->listRecieveAddresses->insertItem(0, addr);
|
ui->listReceiveAddresses->insertItem(0, addr);
|
||||||
ui->listRecieveAddresses->setCurrentIndex(0);
|
ui->listReceiveAddresses->setCurrentIndex(0);
|
||||||
|
|
||||||
ui->statusBar->showMessage(QString::fromStdString("Created new zAddr") %
|
ui->statusBar->showMessage(QString::fromStdString("Created new zAddr") %
|
||||||
(sapling ? "(Sapling)" : "(Sprout)"),
|
(sapling ? "(Sapling)" : "(Sprout)"),
|
||||||
@@ -1239,14 +1239,14 @@ std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
|
|||||||
return [=] (bool checked) {
|
return [=] (bool checked) {
|
||||||
if (checked && this->rpc->getAllZAddresses() != nullptr) {
|
if (checked && this->rpc->getAllZAddresses() != nullptr) {
|
||||||
auto addrs = this->rpc->getAllZAddresses();
|
auto addrs = this->rpc->getAllZAddresses();
|
||||||
ui->listRecieveAddresses->clear();
|
ui->listReceiveAddresses->clear();
|
||||||
|
|
||||||
std::for_each(addrs->begin(), addrs->end(), [=] (auto addr) {
|
std::for_each(addrs->begin(), addrs->end(), [=] (auto addr) {
|
||||||
if ( (sapling && Settings::getInstance()->isSaplingAddress(addr)) ||
|
if ( (sapling && Settings::getInstance()->isSaplingAddress(addr)) ||
|
||||||
(!sapling && !Settings::getInstance()->isSaplingAddress(addr))) {
|
(!sapling && !Settings::getInstance()->isSaplingAddress(addr))) {
|
||||||
if (rpc->getAllBalances()) {
|
if (rpc->getAllBalances()) {
|
||||||
auto bal = rpc->getAllBalances()->value(addr);
|
auto bal = rpc->getAllBalances()->value(addr);
|
||||||
ui->listRecieveAddresses->addItem(addr, bal);
|
ui->listReceiveAddresses->addItem(addr, bal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1259,15 +1259,17 @@ std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupRecieveTab() {
|
void MainWindow::setupReceiveTab() {
|
||||||
auto addNewTAddr = [=] () {
|
auto addNewTAddr = [=] () {
|
||||||
rpc->newTaddr([=] (json reply) {
|
rpc->newTaddr([=] (json reply) {
|
||||||
QString addr = QString::fromStdString(reply.get<json::string_t>());
|
QString addr = QString::fromStdString(reply.get<json::string_t>());
|
||||||
|
// Make sure the RPC class reloads the t-addrs for future use
|
||||||
|
rpc->refreshAddresses();
|
||||||
|
|
||||||
// Just double make sure the t-address is still checked
|
// Just double make sure the t-address is still checked
|
||||||
if (ui->rdioTAddr->isChecked()) {
|
if (ui->rdioTAddr->isChecked()) {
|
||||||
ui->listRecieveAddresses->insertItem(0, addr);
|
ui->listReceiveAddresses->insertItem(0, addr);
|
||||||
ui->listRecieveAddresses->setCurrentIndex(0);
|
ui->listReceiveAddresses->setCurrentIndex(0);
|
||||||
|
|
||||||
ui->statusBar->showMessage(tr("Created new t-Addr"), 10 * 1000);
|
ui->statusBar->showMessage(tr("Created new t-Addr"), 10 * 1000);
|
||||||
}
|
}
|
||||||
@@ -1288,7 +1290,7 @@ void MainWindow::setupRecieveTab() {
|
|||||||
QObject::connect(ui->rdioZSAddr, &QRadioButton::toggled, addZAddrsToComboList(true));
|
QObject::connect(ui->rdioZSAddr, &QRadioButton::toggled, addZAddrsToComboList(true));
|
||||||
|
|
||||||
// Explicitly get new address button.
|
// Explicitly get new address button.
|
||||||
QObject::connect(ui->btnRecieveNewAddr, &QPushButton::clicked, [=] () {
|
QObject::connect(ui->btnReceiveNewAddr, &QPushButton::clicked, [=] () {
|
||||||
if (!rpc->getConnection())
|
if (!rpc->getConnection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1306,7 +1308,7 @@ void MainWindow::setupRecieveTab() {
|
|||||||
ui->rdioZSAddr->setChecked(true);
|
ui->rdioZSAddr->setChecked(true);
|
||||||
|
|
||||||
// And then select the first one
|
// And then select the first one
|
||||||
ui->listRecieveAddresses->setCurrentIndex(0);
|
ui->listReceiveAddresses->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1315,15 +1317,15 @@ void MainWindow::setupRecieveTab() {
|
|||||||
ui->rcvLabel->setValidator(v);
|
ui->rcvLabel->setValidator(v);
|
||||||
|
|
||||||
// Select item in address list
|
// Select item in address list
|
||||||
QObject::connect(ui->listRecieveAddresses,
|
QObject::connect(ui->listReceiveAddresses,
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged), [=] (int index) {
|
QOverload<int>::of(&QComboBox::currentIndexChanged), [=] (int index) {
|
||||||
QString addr = ui->listRecieveAddresses->itemText(index);
|
QString addr = ui->listReceiveAddresses->itemText(index);
|
||||||
if (addr.isEmpty()) {
|
if (addr.isEmpty()) {
|
||||||
// Draw empty stuff
|
// Draw empty stuff
|
||||||
|
|
||||||
ui->rcvLabel->clear();
|
ui->rcvLabel->clear();
|
||||||
ui->rcvBal->clear();
|
ui->rcvBal->clear();
|
||||||
ui->txtRecieve->clear();
|
ui->txtReceive->clear();
|
||||||
ui->qrcodeDisplay->clear();
|
ui->qrcodeDisplay->clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1338,7 +1340,7 @@ void MainWindow::setupRecieveTab() {
|
|||||||
|
|
||||||
ui->rcvLabel->setText(label);
|
ui->rcvLabel->setText(label);
|
||||||
ui->rcvBal->setText(Settings::getZECUSDDisplayFormat(rpc->getAllBalances()->value(addr)));
|
ui->rcvBal->setText(Settings::getZECUSDDisplayFormat(rpc->getAllBalances()->value(addr)));
|
||||||
ui->txtRecieve->setPlainText(addr);
|
ui->txtReceive->setPlainText(addr);
|
||||||
ui->qrcodeDisplay->setQrcodeString(addr);
|
ui->qrcodeDisplay->setQrcodeString(addr);
|
||||||
if (rpc->getUsedAddresses()->value(addr, false)) {
|
if (rpc->getUsedAddresses()->value(addr, false)) {
|
||||||
ui->rcvBal->setToolTip(tr("Address has been previously used"));
|
ui->rcvBal->setToolTip(tr("Address has been previously used"));
|
||||||
@@ -1350,7 +1352,7 @@ void MainWindow::setupRecieveTab() {
|
|||||||
|
|
||||||
// Receive tab add/update label
|
// Receive tab add/update label
|
||||||
QObject::connect(ui->rcvUpdateLabel, &QPushButton::clicked, [=]() {
|
QObject::connect(ui->rcvUpdateLabel, &QPushButton::clicked, [=]() {
|
||||||
QString addr = ui->listRecieveAddresses->currentText();
|
QString addr = ui->listReceiveAddresses->currentText();
|
||||||
if (addr.isEmpty())
|
if (addr.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1384,9 +1386,9 @@ void MainWindow::setupRecieveTab() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Recieve Export Key
|
// Receive Export Key
|
||||||
QObject::connect(ui->exportKey, &QPushButton::clicked, [=]() {
|
QObject::connect(ui->exportKey, &QPushButton::clicked, [=]() {
|
||||||
QString addr = ui->listRecieveAddresses->currentText();
|
QString addr = ui->listReceiveAddresses->currentText();
|
||||||
if (addr.isEmpty())
|
if (addr.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1397,7 +1399,7 @@ void MainWindow::setupRecieveTab() {
|
|||||||
void MainWindow::updateTAddrCombo(bool checked) {
|
void MainWindow::updateTAddrCombo(bool checked) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
auto utxos = this->rpc->getUTXOs();
|
auto utxos = this->rpc->getUTXOs();
|
||||||
ui->listRecieveAddresses->clear();
|
ui->listReceiveAddresses->clear();
|
||||||
|
|
||||||
// Maintain a set of addresses so we don't duplicate any.
|
// Maintain a set of addresses so we don't duplicate any.
|
||||||
QSet<QString> addrs;
|
QSet<QString> addrs;
|
||||||
@@ -1406,7 +1408,7 @@ void MainWindow::updateTAddrCombo(bool checked) {
|
|||||||
auto addr = utxo.address;
|
auto addr = utxo.address;
|
||||||
if (Settings::isTAddress(addr) && !addrs.contains(addr)) {
|
if (Settings::isTAddress(addr) && !addrs.contains(addr)) {
|
||||||
auto bal = rpc->getAllBalances()->value(addr);
|
auto bal = rpc->getAllBalances()->value(addr);
|
||||||
ui->listRecieveAddresses->addItem(addr, bal);
|
ui->listReceiveAddresses->addItem(addr, bal);
|
||||||
|
|
||||||
addrs.insert(addr);
|
addrs.insert(addr);
|
||||||
}
|
}
|
||||||
@@ -1420,7 +1422,7 @@ void MainWindow::updateTAddrCombo(bool checked) {
|
|||||||
std::for_each(allTaddrs->begin(), allTaddrs->end(), [=] (auto& taddr) {
|
std::for_each(allTaddrs->begin(), allTaddrs->end(), [=] (auto& taddr) {
|
||||||
// If the address is in the address book, add it.
|
// If the address is in the address book, add it.
|
||||||
if (labels.contains(taddr) && !addrs.contains(taddr)) {
|
if (labels.contains(taddr) && !addrs.contains(taddr)) {
|
||||||
ui->listRecieveAddresses->addItem(taddr, 0);
|
ui->listReceiveAddresses->addItem(taddr, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ private:
|
|||||||
|
|
||||||
void setupSendTab();
|
void setupSendTab();
|
||||||
void setupTransactionsTab();
|
void setupTransactionsTab();
|
||||||
void setupRecieveTab();
|
void setupReceiveTab();
|
||||||
void setupBalancesTab();
|
void setupBalancesTab();
|
||||||
void setupZcashdTab();
|
void setupZcashdTab();
|
||||||
|
|
||||||
|
|||||||
@@ -715,7 +715,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
<item>
|
<item>
|
||||||
<widget class="AddressCombo" name="listRecieveAddresses">
|
<widget class="AddressCombo" name="listReceiveAddresses">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -728,7 +728,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnRecieveNewAddr">
|
<widget class="QPushButton" name="btnReceiveNewAddr">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>New Address</string>
|
<string>New Address</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -784,7 +784,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="2">
|
<item row="0" column="1" colspan="2">
|
||||||
<widget class="QPlainTextEdit" name="txtRecieve">
|
<widget class="QPlainTextEdit" name="txtReceive">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -1221,9 +1221,9 @@
|
|||||||
<tabstop>cancelSendButton</tabstop>
|
<tabstop>cancelSendButton</tabstop>
|
||||||
<tabstop>rdioZSAddr</tabstop>
|
<tabstop>rdioZSAddr</tabstop>
|
||||||
<tabstop>rdioTAddr</tabstop>
|
<tabstop>rdioTAddr</tabstop>
|
||||||
<tabstop>listRecieveAddresses</tabstop>
|
<tabstop>listReceiveAddresses</tabstop>
|
||||||
<tabstop>btnRecieveNewAddr</tabstop>
|
<tabstop>btnReceiveNewAddr</tabstop>
|
||||||
<tabstop>txtRecieve</tabstop>
|
<tabstop>txtReceive</tabstop>
|
||||||
<tabstop>rcvLabel</tabstop>
|
<tabstop>rcvLabel</tabstop>
|
||||||
<tabstop>rcvUpdateLabel</tabstop>
|
<tabstop>rcvUpdateLabel</tabstop>
|
||||||
<tabstop>transactionsTable</tabstop>
|
<tabstop>transactionsTable</tabstop>
|
||||||
|
|||||||
Reference in New Issue
Block a user