auto create hushchat zaddr at contact request

This commit is contained in:
DenioD
2020-06-13 00:40:42 +02:00
parent da2ea0fbf5
commit 05004478d1
5 changed files with 28 additions and 32 deletions

View File

@@ -710,8 +710,8 @@ void::MainWindow::addContact()
request.setupUi(&dialog);
Settings::saveRestore(&dialog);
QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
try
try
{
bool sapling = true;
rpc->createNewZaddr(sapling, [=] (json reply) {
@@ -720,6 +720,9 @@ QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
request.myzaddr->setText(myAddr);
ui->listReceiveAddresses->insertItem(0, myAddr);
ui->listReceiveAddresses->setCurrentIndex(0);
DataStore::getChatDataStore()->setSendZaddr(myAddr);
qDebug()<<"Zaddr: "<<myAddr;
});
}catch(...)
@@ -728,7 +731,7 @@ QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
qDebug() << QString("Caught something nasty with myZaddr Contact");
}
});
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
@@ -751,6 +754,9 @@ QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
});
QObject::connect(request.sendRequestButton, &QPushButton::clicked, this, &MainWindow::saveandsendContact);
// QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
dialog.exec();
@@ -778,7 +784,7 @@ Tx MainWindow::createTxForSafeContactRequest()
totalAmt = totalAmt + amt;
QString cid = contactRequest.getCid();
QString myAddr = contactRequest.getSenderAddress();
QString myAddr = DataStore::getChatDataStore()->getSendZaddr();
QString type = "Cont";
QString addr = contactRequest.getReceiverAddress();
@@ -835,16 +841,6 @@ void MainWindow::ContactRequest() {
return;
}
if (contactRequest.getSenderAddress().size() > 80) {
QMessageBox msg(QMessageBox::Critical, tr("Missing HushChat Address"),
tr("You have to create your HushChat address to send a contact request,\n"),
QMessageBox::Ok, this);
msg.exec();
return;
}
int max = 235;
QString chattext = contactRequest.getMemo();;
int size = chattext.size();