Keep existing address selected in recieve dropdown
This commit is contained in:
@@ -1258,6 +1258,9 @@ 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();
|
||||||
|
|
||||||
|
// Save the current address, so we can update it later
|
||||||
|
auto zaddr = ui->listReceiveAddresses->currentText();
|
||||||
ui->listReceiveAddresses->clear();
|
ui->listReceiveAddresses->clear();
|
||||||
|
|
||||||
std::for_each(addrs->begin(), addrs->end(), [=] (auto addr) {
|
std::for_each(addrs->begin(), addrs->end(), [=] (auto addr) {
|
||||||
@@ -1270,6 +1273,10 @@ std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!zaddr.isEmpty() && Settings::isZAddress(zaddr)) {
|
||||||
|
ui->listReceiveAddresses->setCurrentText(zaddr);
|
||||||
|
}
|
||||||
|
|
||||||
// If z-addrs are empty, then create a new one.
|
// If z-addrs are empty, then create a new one.
|
||||||
if (addrs->isEmpty()) {
|
if (addrs->isEmpty()) {
|
||||||
addNewZaddr(sapling);
|
addNewZaddr(sapling);
|
||||||
@@ -1461,6 +1468,10 @@ void MainWindow::setupReceiveTab() {
|
|||||||
void MainWindow::updateTAddrCombo(bool checked) {
|
void MainWindow::updateTAddrCombo(bool checked) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
auto utxos = this->rpc->getUTXOs();
|
auto utxos = this->rpc->getUTXOs();
|
||||||
|
|
||||||
|
// Save the current address so we can restore it later
|
||||||
|
auto currentTaddr = ui->listReceiveAddresses->currentText();
|
||||||
|
|
||||||
ui->listReceiveAddresses->clear();
|
ui->listReceiveAddresses->clear();
|
||||||
|
|
||||||
// Maintain a set of addresses so we don't duplicate any, because we'll be adding
|
// Maintain a set of addresses so we don't duplicate any, because we'll be adding
|
||||||
@@ -1502,6 +1513,16 @@ void MainWindow::updateTAddrCombo(bool checked) {
|
|||||||
ui->listReceiveAddresses->addItem(addr, 0);
|
ui->listReceiveAddresses->addItem(addr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4. Add the previously selected t-address
|
||||||
|
if (!currentTaddr.isEmpty() && Settings::isTAddress(currentTaddr)) {
|
||||||
|
// Make sure the current taddr is in the list
|
||||||
|
if (!addrs.contains(currentTaddr)) {
|
||||||
|
auto bal = rpc->getAllBalances()->value(currentTaddr);
|
||||||
|
ui->listReceiveAddresses->addItem(currentTaddr, bal);
|
||||||
|
}
|
||||||
|
ui->listReceiveAddresses->setCurrentText(currentTaddr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user