try catch myZaddr
This commit is contained in:
@@ -144,22 +144,35 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
|||||||
// Connect the dialog's closing to updating the label address completor
|
// Connect the dialog's closing to updating the label address completor
|
||||||
QObject::connect(&d, &QDialog::finished, [=] (auto) { parent->updateLabels(); });
|
QObject::connect(&d, &QDialog::finished, [=] (auto) { parent->updateLabels(); });
|
||||||
|
|
||||||
|
|
||||||
Controller* rpc = parent->getRPC();
|
Controller* rpc = parent->getRPC();
|
||||||
bool sapling = true;
|
bool sapling = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
rpc->createNewZaddr(sapling, [=] (json reply) {
|
rpc->createNewZaddr(sapling, [=] (json reply) {
|
||||||
QString myAddr = QString::fromStdString(reply.get<json::array_t>()[0]);
|
QString myAddr = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
QString message = QString("New Chat Address for your partner: ") + myAddr;
|
QString message = QString("New Chat Address for your partner: ") + myAddr;
|
||||||
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
||||||
|
|
||||||
|
rpc->refreshAddresses();
|
||||||
|
|
||||||
parent->ui->listReceiveAddresses->insertItem(0, myAddr);
|
parent->ui->listReceiveAddresses->insertItem(0, myAddr);
|
||||||
parent->ui->listReceiveAddresses->setCurrentIndex(0);
|
parent->ui->listReceiveAddresses->setCurrentIndex(0);
|
||||||
|
|
||||||
qDebug() << "new generated myAddr" << myAddr;
|
qDebug() << " new Addr in Addressbook" << myAddr;
|
||||||
ab.cid->setText(cid);
|
ab.cid->setText(cid);
|
||||||
ab.addr_chat->setText(myAddr);
|
ab.addr_chat->setText(myAddr);
|
||||||
});
|
});
|
||||||
model.updateUi(); //todo fix updating gui after adding
|
}
|
||||||
//rpc->refresh(true);
|
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
qDebug() << QString("Caught something nasty with myZaddr Addressbook");
|
||||||
|
}
|
||||||
|
|
||||||
|
// model.updateUi(); //todo fix updating gui after adding
|
||||||
|
|
||||||
// If there is a target then make it the addr for the "Add to" button
|
// If there is a target then make it the addr for the "Add to" button
|
||||||
if (target != nullptr && Settings::isValidAddress(target->text()))
|
if (target != nullptr && Settings::isValidAddress(target->text()))
|
||||||
|
|||||||
Reference in New Issue
Block a user