diff --git a/src/addressbook.cpp b/src/addressbook.cpp index 68ead74..11dc0c4 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -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> stuff; + QList> 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); } diff --git a/src/addressbook.ui b/src/addressbook.ui index cd98ad9..08b2356 100644 --- a/src/addressbook.ui +++ b/src/addressbook.ui @@ -14,6 +14,43 @@ Address Book + + + + + + Import Address Book + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close|QDialogButtonBox::Ok + + + + + + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + false + + + @@ -51,17 +88,27 @@ - - + + + + + - <html><head/><body><p align="right">Avatar :</p></body></html> + <html><head/><body><p>Conversation ID:</p></body></html> - - + + - + + + + Add to Address Book + + + + @@ -195,63 +242,23 @@ - - + + - <html><head/><body><p>Conversation ID (editable):</p></body></html> + <html><head/><body><p align="right">Avatar :</p></body></html> - - - - - + + - Add to Address Book + Create a new HushChat zaddr - - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - true - - - false - - - - - - - - - Import Address Book - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Ok - - - - - diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 694908c..7fda03a 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -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(); diff --git a/src/contactrequest.ui b/src/contactrequest.ui index 43900d9..eb231ee 100644 --- a/src/contactrequest.ui +++ b/src/contactrequest.ui @@ -34,140 +34,6 @@ - - - - - SDLogo - - - - :/icons/res/SDLogo.png - - - - - - Duke - - - - :/icons/res/Duke.png - - - - - - Denio - - - - :/icons/res/Denio.png - - - - - - Berg - - - - :/icons/res/Berg.png - - - - - - Stag - - - - :/icons/res/Stag.png - - - - - - Sharpee - - - - :/icons/res/Sharpee.png - - - - - - Elsa - - - - :/icons/res/Elsa.png - - - - - - Yoda - - - - :/icons/res/Yoda.png - - - - - - Garfield - - - - :/icons/res/Garfield.png - - - - - - Snoopy - - - - :/icons/res/Snoopy.png - - - - - - Popey - - - - :/icons/res/Popey.png - - - - - - Pinguin - - - - :/icons/res/Pinguin.png - - - - - - Mickey - - - - :/icons/res/Mickey.png - - - - - @@ -329,6 +195,147 @@ + + + + + SDLogo + + + + :/icons/res/SDLogo.png + + + + + + Duke + + + + :/icons/res/Duke.png + + + + + + Denio + + + + :/icons/res/Denio.png + + + + + + Berg + + + + :/icons/res/Berg.png + + + + + + Stag + + + + :/icons/res/Stag.png + + + + + + Sharpee + + + + :/icons/res/Sharpee.png + + + + + + Elsa + + + + :/icons/res/Elsa.png + + + + + + Yoda + + + + :/icons/res/Yoda.png + + + + + + Garfield + + + + :/icons/res/Garfield.png + + + + + + Snoopy + + + + :/icons/res/Snoopy.png + + + + + + Popey + + + + :/icons/res/Popey.png + + + + + + Pinguin + + + + :/icons/res/Pinguin.png + + + + + + Mickey + + + + :/icons/res/Mickey.png + + + + + + + + + Create new Hushchat address + + + diff --git a/src/controller.cpp b/src/controller.cpp index a8ea783..495ee7d 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -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? :"<setData(ChatIDGenerator::getInstance()->generateID(item), item); } } }