auto create hushchat zaddr at contact request
This commit is contained in:
@@ -39,6 +39,18 @@ QString ChatDataStore::getPassword()
|
||||
return _password;
|
||||
}
|
||||
|
||||
QString ChatDataStore::getSendZaddr()
|
||||
{
|
||||
|
||||
return _zaddr;
|
||||
}
|
||||
|
||||
void ChatDataStore::setSendZaddr(QString zaddr)
|
||||
{
|
||||
|
||||
_zaddr = zaddr;
|
||||
}
|
||||
|
||||
void ChatDataStore::setPassword(QString password)
|
||||
{
|
||||
|
||||
|
||||
@@ -26,9 +26,13 @@ class ChatDataStore
|
||||
std::map<QString, ChatItem> getAllOldContactRequests();
|
||||
std::map<QString, ChatItem> getAllMemos();
|
||||
QString getPassword();
|
||||
QString getSendZaddr();
|
||||
|
||||
void setPassword(QString Password);
|
||||
void setSendZaddr(QString Password);
|
||||
QString _password;
|
||||
|
||||
void setPassword(QString zaddr);
|
||||
QString _zaddr;
|
||||
|
||||
QString dump();
|
||||
|
||||
|
||||
@@ -439,7 +439,7 @@ void AddressBook::readFromStorage()
|
||||
in >> stuff;
|
||||
|
||||
//////////////found old addrbook, and rename it to .bak
|
||||
if (version != "v2")
|
||||
if (version == "v1")
|
||||
{
|
||||
auto filename = QStringLiteral("addresslabels.dat");
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -122,22 +122,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newZaddr">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create New Address</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user