auto create hushchat zaddr at contact request
This commit is contained in:
@@ -39,6 +39,18 @@ QString ChatDataStore::getPassword()
|
|||||||
return _password;
|
return _password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ChatDataStore::getSendZaddr()
|
||||||
|
{
|
||||||
|
|
||||||
|
return _zaddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatDataStore::setSendZaddr(QString zaddr)
|
||||||
|
{
|
||||||
|
|
||||||
|
_zaddr = zaddr;
|
||||||
|
}
|
||||||
|
|
||||||
void ChatDataStore::setPassword(QString password)
|
void ChatDataStore::setPassword(QString password)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,13 @@ class ChatDataStore
|
|||||||
std::map<QString, ChatItem> getAllOldContactRequests();
|
std::map<QString, ChatItem> getAllOldContactRequests();
|
||||||
std::map<QString, ChatItem> getAllMemos();
|
std::map<QString, ChatItem> getAllMemos();
|
||||||
QString getPassword();
|
QString getPassword();
|
||||||
|
QString getSendZaddr();
|
||||||
|
|
||||||
void setPassword(QString Password);
|
void setSendZaddr(QString Password);
|
||||||
QString _password;
|
QString _password;
|
||||||
|
|
||||||
|
void setPassword(QString zaddr);
|
||||||
|
QString _zaddr;
|
||||||
|
|
||||||
QString dump();
|
QString dump();
|
||||||
|
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ void AddressBook::readFromStorage()
|
|||||||
in >> stuff;
|
in >> stuff;
|
||||||
|
|
||||||
//////////////found old addrbook, and rename it to .bak
|
//////////////found old addrbook, and rename it to .bak
|
||||||
if (version != "v2")
|
if (version == "v1")
|
||||||
{
|
{
|
||||||
auto filename = QStringLiteral("addresslabels.dat");
|
auto filename = QStringLiteral("addresslabels.dat");
|
||||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||||
|
|||||||
@@ -710,8 +710,8 @@ void::MainWindow::addContact()
|
|||||||
request.setupUi(&dialog);
|
request.setupUi(&dialog);
|
||||||
Settings::saveRestore(&dialog);
|
Settings::saveRestore(&dialog);
|
||||||
|
|
||||||
QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool sapling = true;
|
bool sapling = true;
|
||||||
rpc->createNewZaddr(sapling, [=] (json reply) {
|
rpc->createNewZaddr(sapling, [=] (json reply) {
|
||||||
@@ -720,6 +720,9 @@ QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
|
|||||||
request.myzaddr->setText(myAddr);
|
request.myzaddr->setText(myAddr);
|
||||||
ui->listReceiveAddresses->insertItem(0, myAddr);
|
ui->listReceiveAddresses->insertItem(0, myAddr);
|
||||||
ui->listReceiveAddresses->setCurrentIndex(0);
|
ui->listReceiveAddresses->setCurrentIndex(0);
|
||||||
|
DataStore::getChatDataStore()->setSendZaddr(myAddr);
|
||||||
|
|
||||||
|
qDebug()<<"Zaddr: "<<myAddr;
|
||||||
});
|
});
|
||||||
|
|
||||||
}catch(...)
|
}catch(...)
|
||||||
@@ -728,7 +731,7 @@ QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
|
|||||||
|
|
||||||
qDebug() << QString("Caught something nasty with myZaddr Contact");
|
qDebug() << QString("Caught something nasty with myZaddr Contact");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
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.sendRequestButton, &QPushButton::clicked, this, &MainWindow::saveandsendContact);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
|
// QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
|
||||||
|
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
@@ -778,7 +784,7 @@ Tx MainWindow::createTxForSafeContactRequest()
|
|||||||
totalAmt = totalAmt + amt;
|
totalAmt = totalAmt + amt;
|
||||||
|
|
||||||
QString cid = contactRequest.getCid();
|
QString cid = contactRequest.getCid();
|
||||||
QString myAddr = contactRequest.getSenderAddress();
|
QString myAddr = DataStore::getChatDataStore()->getSendZaddr();
|
||||||
QString type = "Cont";
|
QString type = "Cont";
|
||||||
QString addr = contactRequest.getReceiverAddress();
|
QString addr = contactRequest.getReceiverAddress();
|
||||||
|
|
||||||
@@ -835,16 +841,6 @@ void MainWindow::ContactRequest() {
|
|||||||
return;
|
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;
|
int max = 235;
|
||||||
QString chattext = contactRequest.getMemo();;
|
QString chattext = contactRequest.getMemo();;
|
||||||
int size = chattext.size();
|
int size = chattext.size();
|
||||||
|
|||||||
@@ -122,22 +122,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|||||||
Reference in New Issue
Block a user