add button to create a new zaddr
This commit is contained in:
@@ -147,8 +147,9 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||
// Connect the dialog's closing to updating the label address completor
|
||||
QObject::connect(&d, &QDialog::finished, [=] (auto) { parent->updateLabels(); });
|
||||
|
||||
Controller* rpc = parent->getRPC();
|
||||
QObject::connect(ab.newZaddr, &QPushButton::clicked, [&] () {
|
||||
|
||||
Controller* rpc = parent->getRPC();
|
||||
bool sapling = true;
|
||||
try
|
||||
{
|
||||
@@ -174,6 +175,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||
|
||||
qDebug() << QString("Caught something nasty with myZaddr Addressbook");
|
||||
}
|
||||
});
|
||||
|
||||
// model.updateUi(); //todo fix updating gui after adding
|
||||
|
||||
@@ -193,7 +195,6 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||
|
||||
|
||||
QString avatar = QString(":/icons/res/") + ab.comboBoxAvatar->currentText() + QString(".png");
|
||||
qDebug()<<"AVATAR NAME : " << avatar;
|
||||
|
||||
if (addr.isEmpty() || newLabel.isEmpty())
|
||||
{
|
||||
@@ -394,20 +395,15 @@ void AddressBook::readFromStorage()
|
||||
QDataStream in(&file); // read the data serialized from the file
|
||||
QString version;
|
||||
in >> version;
|
||||
// qDebug() << "Detected old addressbook format";
|
||||
// Convert old addressbook format v1 to v2
|
||||
QList<QList<QString>> stuff;
|
||||
QList<QList<QString>> stuff;
|
||||
in >> stuff;
|
||||
//qDebug() << "Stuff: " << stuff;
|
||||
|
||||
|
||||
for (int i=0; i < stuff.size(); i++)
|
||||
{
|
||||
//qDebug() << "0:" << stuff[i][0];
|
||||
//qDebug() << "1:" << stuff[i][1];
|
||||
//qDebug() << "2:" << stuff[i][2];
|
||||
|
||||
ContactItem contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3],stuff[i][4]);
|
||||
//qDebug() << "contact=" << contact.toQTString();
|
||||
// main->addLabel(stuff[i][2], stuff[i][1]);
|
||||
|
||||
allLabels.push_back(contact);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,43 @@
|
||||
<string>Address Book</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnImport">
|
||||
<property name="text">
|
||||
<string>Import Address Book</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTableView" name="addresses">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
@@ -51,17 +88,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="right">Avatar :</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="addr_chat"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Conversation ID:</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLineEdit" name="cid"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="addNew">
|
||||
<property name="text">
|
||||
<string>Add to Address Book</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxAvatar">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -195,63 +242,23 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Conversation ID (editable):</p></body></html></string>
|
||||
<string><html><head/><body><p align="right">Avatar :</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLineEdit" name="cid"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="addNew">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="newZaddr">
|
||||
<property name="text">
|
||||
<string>Add to Address Book</string>
|
||||
<string>Create a new HushChat zaddr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTableView" name="addresses">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnImport">
|
||||
<property name="text">
|
||||
<string>Import Address Book</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@@ -708,6 +708,7 @@ void::MainWindow::addContact()
|
||||
request.setupUi(&dialog);
|
||||
Settings::saveRestore(&dialog);
|
||||
|
||||
QObject::connect(request.newZaddr, &QPushButton::clicked, [&] () {
|
||||
try
|
||||
{
|
||||
bool sapling = true;
|
||||
@@ -725,6 +726,7 @@ void::MainWindow::addContact()
|
||||
|
||||
qDebug() << QString("Caught something nasty with myZaddr Contact");
|
||||
}
|
||||
});
|
||||
|
||||
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
||||
|
||||
@@ -823,8 +825,6 @@ void MainWindow::ContactRequest() {
|
||||
|
||||
if (contactRequest.getReceiverAddress().isEmpty() || contactRequest.getMemo().isEmpty()) {
|
||||
|
||||
// auto addr = "";
|
||||
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
|
||||
QMessageBox msg(QMessageBox::Critical, tr("You have to select a contact and insert a Memo"),
|
||||
tr("You have selected no Contact from Contactlist,\n") + tr("\nor your Memo is empty"),
|
||||
QMessageBox::Ok, this);
|
||||
@@ -833,6 +833,16 @@ 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();
|
||||
|
||||
@@ -34,140 +34,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QComboBox" name="comboBoxAvatar">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SDLogo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/SDLogo.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Duke</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Duke.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Berg</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Berg.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stag</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sharpee</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Sharpee.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Garfield</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Garfield.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Snoopy</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Snoopy.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Popey</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Popey.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pinguin</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Pinguin.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mickey</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Mickey.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="labelRequest">
|
||||
<property name="maxLength">
|
||||
@@ -329,6 +195,147 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="comboBoxAvatar">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SDLogo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/SDLogo.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Duke</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Duke.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Berg</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Berg.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stag</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sharpee</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Sharpee.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Garfield</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Garfield.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Snoopy</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Snoopy.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Popey</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Popey.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pinguin</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Pinguin.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mickey</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Mickey.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="newZaddr">
|
||||
<property name="text">
|
||||
<string>Create new Hushchat address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@@ -1202,9 +1202,6 @@ void Controller::refreshTransactions() {
|
||||
contactname = "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
qDebug()<<"Name :" << contactname;
|
||||
|
||||
bool isNotarized;
|
||||
|
||||
@@ -1361,11 +1358,7 @@ void Controller::refreshTransactions() {
|
||||
isNotarized,
|
||||
isContact
|
||||
);
|
||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||
qDebug()<<"requestZaddrt? :"<<requestZaddr;
|
||||
qDebug()<<"Ist Kontakt? :"<<isContact;
|
||||
qDebug()<<"Memo :"<<memo;
|
||||
|
||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user