sync to chat

This commit is contained in:
DenioD
2020-05-30 23:43:12 +02:00
12 changed files with 81 additions and 121 deletions

View File

@@ -239,17 +239,15 @@ void MainWindow::renderContactRequest(){
qDebug()<<"Beginn kopiert" <<cid << addr << newLabel << myAddr;
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
rpc->refreshContacts(
ui->listContactWidget);
QMessageBox::information(this, "Added Contact","successfully added your new contact. You can now Chat with this contact");
QMessageBox::information(this, "Added Contact","successfully added your new contact. You can now Chat with this contact");
});
dialog.exec();
rpc->refreshContacts(
ui->listContactWidget
);
}
void ChatModel::addCid(QString tx, QString cid)
@@ -776,7 +774,8 @@ void::MainWindow::addContact()
request.setupUi(&dialog);
Settings::saveRestore(&dialog);
try
{
bool sapling = true;
rpc->createNewZaddr(sapling, [=] (json reply) {
QString myAddr = QString::fromStdString(reply.get<json::array_t>()[0]);
@@ -786,11 +785,15 @@ void::MainWindow::addContact()
ui->listReceiveAddresses->setCurrentIndex(0);
qDebug() << "new generated myAddr add Contact" << myAddr;
});
}catch(...)
{
qDebug() << QString("Caught something nasty with myZaddr Contact");
}
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
QObject::connect(request.sendRequestButton, &QPushButton::clicked, [&] () {
@@ -940,7 +943,10 @@ void MainWindow::ContactRequest() {
delete d;
});
QString addr = contactRequest.getReceiverAddress();
/////Add this contact after we sent the request
QString addr = contactRequest.getReceiverAddress();
QString newLabel = contactRequest.getLabel();
QString myAddr = contactRequest.getSenderAddress();
QString cid = contactRequest.getCid();
@@ -973,17 +979,22 @@ void MainWindow::ContactRequest() {
////// Success, so show it
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
rpc->refreshContacts(
ui->listContactWidget);
QMessageBox::information(
this,
QObject::tr("Added Contact"),
QObject::tr("successfully added your new contact").arg(newLabel),
QMessageBox::Ok
);
return;
// Force a UI update so we get the unconfirmed Tx
// rpc->refresh(true);
ui->memoTxtChat->clear();
rpc->refresh(true);
rpc->refreshContacts(
ui->listContactWidget);
},
// Errored out