readContacts(QString file);
diff --git a/src/Model/ChatItem.cpp b/src/Model/ChatItem.cpp
index fff8f9a..6a30f56 100644
--- a/src/Model/ChatItem.cpp
+++ b/src/Model/ChatItem.cpp
@@ -5,7 +5,7 @@
ChatItem::ChatItem() {}
-ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations)
+ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact)
{
_timestamp = timestamp;
_address = address;
@@ -17,9 +17,11 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_txid = txid;
_confirmations = confirmations;
_outgoing = false;
+ _notarize = notarize;
+ _iscontact = iscontact;
}
-ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing)
+ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact)
{
_timestamp = timestamp;
_address = address;
@@ -31,6 +33,9 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_txid = txid;
_confirmations = confirmations;
_outgoing = outgoing;
+ _notarize = notarize;
+ _iscontact = iscontact;
+
}
long ChatItem::getTimestamp()
@@ -81,6 +86,16 @@ bool ChatItem::isOutgoing()
return _outgoing;
}
+bool ChatItem::isNotarized()
+{
+ return _notarize;
+}
+
+bool ChatItem::isContact()
+{
+ return _iscontact;
+}
+
void ChatItem::setTimestamp(long timestamp)
{
_timestamp = timestamp;
@@ -128,6 +143,15 @@ void ChatItem::toggleOutgo()
{
_outgoing = true;
}
+void ChatItem::notarized()
+{
+ _notarize = false;
+}
+
+void ChatItem::contact(bool iscontact)
+{
+ _iscontact = iscontact;
+}
QString ChatItem::toChatLine()
@@ -136,14 +160,25 @@ QString ChatItem::toChatLine()
QString lock;
myDateTime.setTime_t(_timestamp);
- if (_confirmations == 0){
+ if (_notarize == true)
+
+ {
+
+ lock = "
";
+
+ }else{
+
lock = "
";
- }else{
+ }
+ if ((_confirmations > 0) && (_notarize == false))
+
+ {
lock = "
";
+ }
+
- }
-
+qDebug()<<_notarize;
QString line = QString("") + myDateTime.toString("dd.MM.yyyy hh:mm");
line += QString(lock) + QString("");
line += QString("") + _memo.toHtmlEscaped() + QString("
");
diff --git a/src/Model/ChatItem.h b/src/Model/ChatItem.h
index be8a807..900c994 100644
--- a/src/Model/ChatItem.h
+++ b/src/Model/ChatItem.h
@@ -20,11 +20,13 @@ class ChatItem
QString _txid;
int _confirmations;
bool _outgoing = false;
+ bool _notarize = false;
+ bool _iscontact = false;
public:
ChatItem();
- ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations);
- ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing);
+ ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact);
+ ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact);
long getTimestamp();
QString getAddress();
QString getContact();
@@ -35,6 +37,9 @@ class ChatItem
QString getTxid();
int getConfirmations();
bool isOutgoing();
+ bool isdouble();
+ bool isNotarized();
+ bool isContact();
void setTimestamp(long timestamp);
void setAddress(QString address);
void setContact(QString contact);
@@ -45,6 +50,8 @@ class ChatItem
void setTxid(QString txid);
void setConfirmations(int confirmations);
void toggleOutgo();
+ void notarized();
+ void contact(bool iscontact);
QString toChatLine();
json toJson();
~ChatItem();
diff --git a/src/Model/ContactItem.cpp b/src/Model/ContactItem.cpp
index d38c1c5..d2321bd 100644
--- a/src/Model/ContactItem.cpp
+++ b/src/Model/ContactItem.cpp
@@ -1,4 +1,9 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
#include "ContactItem.h"
+#include "chatmodel.h"
+#include "Model/ChatItem.h"
+#include "controller.h"
ContactItem::ContactItem() {}
@@ -8,7 +13,7 @@ ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress
_myAddress = myAddress;
_partnerAddress = partnerAddress;
_cid = cid;
- _avatar = avatar;
+ _avatar = avatar;
}
QString ContactItem::getName() const
diff --git a/src/Model/ContactItem.h b/src/Model/ContactItem.h
index f066740..7eda17d 100644
--- a/src/Model/ContactItem.h
+++ b/src/Model/ContactItem.h
@@ -1,8 +1,11 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
#ifndef CONTACTITEM_H
#define CONTACTITEM_H
#include
#include
+#include "mainwindow.h"
using json = nlohmann::json;
class ContactItem
@@ -13,7 +16,7 @@ private:
QString _name;
QString _cid;
QString _avatar;
-
+
public:
ContactItem();
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar);
diff --git a/src/addressbook.cpp b/src/addressbook.cpp
index f51e279..808ca40 100644
--- a/src/addressbook.cpp
+++ b/src/addressbook.cpp
@@ -40,7 +40,10 @@ void AddressBookModel::loadData()
QSettings().value(
"addresstablegeometry"
).toByteArray()
+
+
);
+
}
void AddressBookModel::addNewLabel(QString label, QString addr, QString myAddr, QString cid, QString avatar)
diff --git a/src/addressbook.h b/src/addressbook.h
index 8e32fe8..fbd361b 100644
--- a/src/addressbook.h
+++ b/src/addressbook.h
@@ -23,6 +23,7 @@ public:
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
private:
@@ -32,7 +33,8 @@ private:
QTableView* parent;
//QList> labels;
QList labels;
- QStringList headers;
+ QStringList headers;
+
};
class AddressBook {
@@ -63,6 +65,10 @@ public:
QString get_avatar_name();
void set_avatar_name(QString avatar_name);
+
+
+
+
@@ -76,6 +82,7 @@ private:
QString writeableFile();
QList allLabels;
+
static AddressBook* instance;
};
diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp
index 91e46d5..ee3fe6d 100644
--- a/src/chatmodel.cpp
+++ b/src/chatmodel.cpp
@@ -8,7 +8,6 @@
#include "ui_mainwindow.h"
#include "ui_requestContactDialog.h"
#include "addressbook.h"
-#include "ui_memodialog.h"
#include "ui_contactrequest.h"
#include
#include
@@ -54,7 +53,6 @@ void ChatModel::clear()
void ChatModel::addMessage(ChatItem item)
{
QString key = ChatIDGenerator::getInstance()->generateID(item); //this->generateChatItemID(item);
- // qDebug() << "inserting chatitem with id: " << key;
this->chatItems[key] = item;
}
@@ -74,8 +72,26 @@ void ChatModel::showMessages()
}
+void ChatModel::addAddressbylabel(QString address, QString label)
+{
+ this->AddressbyLabelMap[address] = label;
+}
-
+QString ChatModel::Addressbylabel(QString address)
+{
+ for(auto& pair : this->AddressbyLabelMap)
+ {
+
+ }
+
+ if(this->AddressbyLabelMap.count(address) > 0)
+ {
+ return this->AddressbyLabelMap[address];
+ }
+
+ return QString("0xdeadbeef");
+}
+
void MainWindow::renderContactRequest(){
Ui_requestDialog requestContact;
@@ -83,27 +99,53 @@ void MainWindow::renderContactRequest(){
requestContact.setupUi(&dialog);
Settings::saveRestore(&dialog);
+ QString icon;
+ auto theme = Settings::getInstance()->get_theme_name();
+ if (theme == "dark" || theme == "midnight") {
+ icon = ":/icons/res/unknownWhite.png";
+ }else{
+ icon = ":/icons/res/unknownBlack.png";
+ }
+
+ QPixmap unknownWhite(icon);
+ QIcon addnewAddrIcon(unknownWhite);
+
+
+
+
QStandardItemModel* contactRequest = new QStandardItemModel();
for (auto &c : DataStore::getChatDataStore()->getAllNewContactRequests())
+
+
{
- QStandardItem* Items = new QStandardItem(c.second.getAddress());
+ QStandardItem* Items = new QStandardItem(QString("Unknown Sender"));
contactRequest->appendRow(Items);
requestContact.requestContact->setModel(contactRequest);
+
+ Items->setData(QIcon(addnewAddrIcon),Qt::DecorationRole);
+ requestContact.requestContact->setIconSize(QSize(40,50));
+ requestContact.requestContact->setUniformItemSizes(true);
requestContact.requestContact->show();
+ requestContact.zaddrnew->setVisible(false);
+ requestContact.zaddrnew->setText(c.second.getAddress());
+
}
QStandardItemModel* contactRequestOld = new QStandardItemModel();
+
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
for (auto &c : DataStore::getChatDataStore()->getAllOldContactRequests())
{
if (p.getPartnerAddress() == c.second.getRequestZaddr())
{
- QStandardItem* Items = new QStandardItem(c.second.getAddress());
+ QStandardItem* Items = new QStandardItem(p.getName());
contactRequestOld->appendRow(Items);
requestContact.requestContactOld->setModel(contactRequestOld);
+ requestContact.zaddrold->setVisible(false);
+ requestContact.zaddrold->setText(c.second.getAddress());
requestContact.requestContactOld->show();
}else{}
}
@@ -116,7 +158,7 @@ void MainWindow::renderContactRequest(){
QString label_contact = index.data(Qt::DisplayRole).toString();
QStandardItemModel* contactMemo = new QStandardItemModel();
- if ((c.second.isOutgoing() == false) && (label_contact == c.second.getAddress()) && (c.second.getType() != "Cont"))
+ if ((c.second.isOutgoing() == false) && (requestContact.zaddrnew->text() == c.second.getAddress()) && (c.second.getType() != "Cont"))
{
@@ -139,11 +181,11 @@ void MainWindow::renderContactRequest(){
QObject::connect(requestContact.requestContactOld, &QTableView::clicked, [&] () {
for (auto &c : DataStore::getChatDataStore()->getAllRawChatItems()){
- QModelIndex index = requestContact.requestContactOld->currentIndex();
- QString label_contactold = index.data(Qt::DisplayRole).toString();
+ /* QModelIndex index = requestContact.requestContactOld->currentIndex();
+ QString label_contactold = index.data(Qt::DisplayRole).toString();*/
QStandardItemModel* contactMemo = new QStandardItemModel();
- if ((c.second.isOutgoing() == false) && (label_contactold == c.second.getAddress()) && (c.second.getType() != "Cont"))
+ if ((c.second.isOutgoing() == false) && (requestContact.zaddrold->text() == c.second.getAddress()) && (c.second.getType() != "Cont"))
{
@@ -220,6 +262,11 @@ void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
this->requestZaddrMap[tx] = requestZaddr;
}
+void ChatModel::addconfirmations(QString tx, int confirmation)
+{
+ this->confirmationsMap[tx] = confirmation;
+}
+
QString ChatModel::getCidByTx(QString tx)
{
for(auto& pair : this->cidMap)
@@ -235,6 +282,21 @@ QString ChatModel::getCidByTx(QString tx)
return QString("0xdeadbeef");
}
+QString ChatModel::getConfirmationByTx(QString tx)
+{
+ for(auto& pair : this->confirmationsMap)
+ {
+
+ }
+
+ if(this->confirmationsMap.count(tx) > 0)
+ {
+ return this->confirmationsMap[tx];
+ }
+
+ return QString("0xdeadbeef");
+}
+
QString ChatModel::getrequestZaddrByTx(QString tx)
{
for(auto& pair : this->requestZaddrMap)
@@ -260,6 +322,11 @@ void ChatModel::killrequestZaddrCache()
this->requestZaddrMap.clear();
}
+void ChatModel::killConfirmationCache()
+{
+ this->confirmationsMap.clear();
+}
+
QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, int version=0, int headerNumber=1)
{
@@ -334,14 +401,12 @@ void MainWindow::sendChat() {
// Create a Tx from the values on the send tab. Note that this Tx object
// might not be valid yet.
-
- // Memos can only be used with zAddrs. So check that first
- // for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
-
+
+ QString Name = ui->contactNameMemo->text();
+ int sizename = Name.size();
+ qDebug()<< sizename;
if (ui->contactNameMemo->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().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);
@@ -350,6 +415,20 @@ void MainWindow::sendChat() {
return;
}
+ int max = 512;
+ QString chattext = ui->memoTxtChat->toPlainText();
+ int size = chattext.size();
+
+ if (size > max){
+
+ QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
+ tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
+ QMessageBox::Ok, this);
+
+ msg.exec();
+ return;
+ }
+
Tx tx = createTxFromChatPage();
QString error = doSendChatTxValidations(tx);
@@ -384,10 +463,11 @@ void MainWindow::sendChat() {
}
connD->status->setText(tr("Please wait..."));
- connD->statusDetail->setText(tr("Your Message will be send"));
+ connD->statusDetail->setText(tr("Your Message will be sent"));
d->show();
ui->memoTxtChat->clear();
+
// And send the Tx
rpc->executeTransaction(tx,
@@ -396,6 +476,7 @@ void MainWindow::sendChat() {
connD->status->setText(tr("Done!"));
connD->statusDetail->setText(txid);
+
QTimer::singleShot(1000, [=]() {
d->accept();
@@ -406,7 +487,7 @@ void MainWindow::sendChat() {
});
// Force a UI update so we get the unconfirmed Tx
- // rpc->refresh(true);
+ rpc->refresh(true);
ui->memoTxtChat->clear();
},
@@ -425,6 +506,8 @@ void MainWindow::sendChat() {
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
}
);
+
+ // rpc->refresh(true);
}
QString MainWindow::doSendChatTxValidations(Tx tx) {
@@ -450,7 +533,7 @@ QString MainWindow::doSendChatTxValidations(Tx tx) {
auto available = rpc->getModel()->getAvailableBalance();
if (available < total) {
- return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 3 confirmations before they can be spent")
+ return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
.arg(available.toDecimalhushString(), total.toDecimalhushString());
}
@@ -499,7 +582,7 @@ void::MainWindow::addContact()
});
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();
@@ -510,96 +593,7 @@ void::MainWindow::addContact()
void MainWindow::saveandsendContact()
{
this->ContactRequest();
- QString addr = contactRequest.getReceiverAddress();
- QString newLabel = contactRequest.getLabel();
- QString myAddr = contactRequest.getSenderAddress();
- QString cid = contactRequest.getCid();
- QString avatar = contactRequest.getAvatar();
- contactRequest.clear();
- if (addr.isEmpty() || newLabel.isEmpty())
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address or Label Error"),
- QObject::tr("Address or Label cannot be empty"),
- QMessageBox::Ok
- );
- return;
- }
-
- // Test if address is valid.
- if (!Settings::isValidAddress(addr))
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address Format Error"),
- QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
- QMessageBox::Ok
- );
- return;
- }
-
- ///////Todo: Test if label allready exist!
-
- ////// Success, so show it
- AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
- QMessageBox::information(
- this,
- QObject::tr("Added Contact"),
- QObject::tr("successfully added your new contact").arg(newLabel),
- QMessageBox::Ok
- );
- return;
-
-
-
-}
-
-void MainWindow::saveContact()
-{
-
- QString addr = contactRequest.getReceiverAddress();
- QString newLabel = contactRequest.getLabel();
- QString myAddr = contactRequest.getSenderAddress();
- QString cid = contactRequest.getCid();
- QString avatar = contactRequest.getAvatar();
-
- if (addr.isEmpty() || newLabel.isEmpty())
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address or Label Error"),
- QObject::tr("Address or Label cannot be empty"),
- QMessageBox::Ok
- );
- return;
- }
-
- // Test if address is valid.
- if (!Settings::isValidAddress(addr))
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address Format Error"),
- QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
- QMessageBox::Ok
- );
- return;
- }
-
- ///////Todo: Test if label allready exist!
-
- ////// Success, so show it
- AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
- QMessageBox::information(
- this,
- QObject::tr("Added Contact"),
- QObject::tr("successfully added your new contact").arg(newLabel),
- QMessageBox::Ok
- );
- return;
-
}
// Create a Tx for a contact Request
@@ -647,6 +641,22 @@ void MainWindow::ContactRequest() {
return;
}
+ int max = 512;
+ QString chattext = contactRequest.getMemo();;
+ int size = chattext.size();
+
+ if (size > max){
+
+ // auto addr = "";
+ // if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
+ QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
+ tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
+ QMessageBox::Ok, this);
+
+ msg.exec();
+ return;
+ }
+
Tx tx = createTxForSafeContactRequest();
QString error = doSendRequestTxValidations(tx);
@@ -681,7 +691,7 @@ void MainWindow::ContactRequest() {
}
connD->status->setText(tr("Please wait..."));
- connD->statusDetail->setText(tr("Your Contact will be send"));
+ connD->statusDetail->setText(tr("Your contact request will be sent"));
d->show();
ui->memoTxtChat->clear();
@@ -701,7 +711,46 @@ void MainWindow::ContactRequest() {
delete d;
});
-
+ QString addr = contactRequest.getReceiverAddress();
+ QString newLabel = contactRequest.getLabel();
+ QString myAddr = contactRequest.getSenderAddress();
+ QString cid = contactRequest.getCid();
+ QString avatar = contactRequest.getAvatar();
+
+ if (addr.isEmpty() || newLabel.isEmpty())
+ {
+ QMessageBox::critical(
+ this,
+ QObject::tr("Address or Label Error"),
+ QObject::tr("Address or Label cannot be empty"),
+ QMessageBox::Ok
+ );
+ return;
+ }
+
+ // Test if address is valid.
+ if (!Settings::isValidAddress(addr))
+ {
+ QMessageBox::critical(
+ this,
+ QObject::tr("Address Format Error"),
+ QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
+ QMessageBox::Ok
+ );
+ return;
+ }
+
+ ///////Todo: Test if label allready exist!
+
+ ////// Success, so show it
+ AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
+ 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();
@@ -750,9 +799,11 @@ QString MainWindow::doSendRequestTxValidations(Tx tx) {
auto available = rpc->getModel()->getAvailableBalance();
if (available < total) {
- return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 5 confirmations before they can be spent")
+ return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
.arg(available.toDecimalhushString(), total.toDecimalhushString());
}
return "";
}
+
+
diff --git a/src/chatmodel.h b/src/chatmodel.h
index e8bc3e7..1768b9f 100644
--- a/src/chatmodel.h
+++ b/src/chatmodel.h
@@ -20,6 +20,7 @@
#include "Chat/Helper/ChatDelegator.h"
#include "Chat/Helper/ChatIDGenerator.h"
+
namespace Ui {
class MainWindow;
}
@@ -32,7 +33,9 @@ class ChatModel
MainWindow* main;
std::map cidMap;
std::map requestZaddrMap;
+ std::map confirmationsMap;
std::map> sendrequestMap;
+ std::map AddressbyLabelMap;
public:
ChatModel() {};
@@ -45,16 +48,21 @@ class ChatModel
void triggerRequest();
void showMessages();
void clear();
+ void addAddressbylabel(QString addr, QString label);
void addMessage(ChatItem item);
void addMessage(QString timestamp, ChatItem item);
void addCid(QString tx, QString cid);
void addrequestZaddr(QString tx, QString requestZaddr);
+ void addconfirmations(QString tx, int confirmation);
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
QString getCidByTx(QString tx);
QString getrequestZaddrByTx(QString tx);
+ QString getConfirmationByTx(QString tx);
+ QString Addressbylabel(QString addr);
void killCidCache();
+ void killConfirmationCache();
void killrequestZaddrCache();
-
+
};
#endif
\ No newline at end of file
diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp
index 6f452fa..7f9d097 100644
--- a/src/contactmodel.cpp
+++ b/src/contactmodel.cpp
@@ -5,11 +5,18 @@
#include "addressbook.h"
#include "mainwindow.h"
#include "chatmodel.h"
+#include "requestdialog.h"
+#include "ui_requestdialog.h"
+#include "ui_hushrequest.h"
+#include "settings.h"
+#include "controller.h"
+
+
void ContactModel::renderContactList(QListView* view)
{
QStandardItemModel* contact = new QStandardItemModel();
-
+
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
{
@@ -18,14 +25,119 @@ void ContactModel::renderContactList(QListView* view)
QStandardItem* Items1 = new QStandardItem(c.getName());
Items1->setData(QIcon(avatar),Qt::DecorationRole);
+
contact->appendRow(Items1);
view->setModel(contact);
view->setIconSize(QSize(60,70));
view->setUniformItemSizes(true);
view->setDragDropMode(QAbstractItemView::DropOnly);
view->show();
-
+
+
}
+}
+
+void MainWindow::showRequesthush() {
+
+ Ui_hushrequest req;
+ QDialog d(this);
+ req.setupUi(&d);
+ Settings::saveRestore(&d);
+
+ QString label = ui->contactNameMemo->text();
+ for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
+ {
+
+ if (p.getName() == label)
+
+ {
+
+ QString addr = p.getPartnerAddress();
+ QString myzaddr = p.getMyAddress();
+
+ req.txtFrom->setText(addr);
+ req.lblAddressInfo->setText(myzaddr);
+ // Amount textbox
+ req.txtAmount->setValidator(this->getAmountValidator());
+ QObject::connect(req.txtAmount, &QLineEdit::textChanged, [=] (auto text) {
+ CAmount amount = CAmount::fromDecimalString(text);
+ if (Settings::getInstance()->get_currency_name() == "USD") {
+ req.txtAmountUSD->setText(amount.toDecimalUSDString());
+ } else if (Settings::getInstance()->get_currency_name() == "EUR") {
+ req.txtAmountUSD->setText(amount.toDecimalEURString());
+ } else if (Settings::getInstance()->get_currency_name() == "BTC") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ } else if (Settings::getInstance()->get_currency_name() == "CNY") {
+ req.txtAmountUSD->setText(amount.toDecimalCNYString());
+ } else if (Settings::getInstance()->get_currency_name() == "RUB") {
+ req.txtAmountUSD->setText(amount.toDecimalRUBString());
+ } else if (Settings::getInstance()->get_currency_name() == "CAD") {
+ req.txtAmountUSD->setText(amount.toDecimalCADString());
+ } else if (Settings::getInstance()->get_currency_name() == "SGD") {
+ req.txtAmountUSD->setText(amount.toDecimalSGDString());
+ } else if (Settings::getInstance()->get_currency_name() == "CHF") {
+ req.txtAmountUSD->setText(amount.toDecimalCHFString());
+ } else if (Settings::getInstance()->get_currency_name() == "INR") {
+ req.txtAmountUSD->setText(amount.toDecimalINRString());
+ } else if (Settings::getInstance()->get_currency_name() == "GBP") {
+ req.txtAmountUSD->setText(amount.toDecimalGBPString());
+ } else if (Settings::getInstance()->get_currency_name() == "AUD") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ }
+ });
+ CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
+ if (Settings::getInstance()->get_currency_name() == "USD") {
+ req.txtAmountUSD->setText(amount.toDecimalUSDString());
+ } else if (Settings::getInstance()->get_currency_name() == "EUR") {
+ req.txtAmountUSD->setText(amount.toDecimalEURString());
+ } else if (Settings::getInstance()->get_currency_name() == "BTC") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ } else if (Settings::getInstance()->get_currency_name() == "CNY") {
+ req.txtAmountUSD->setText(amount.toDecimalCNYString());
+ } else if (Settings::getInstance()->get_currency_name() == "RUB") {
+ req.txtAmountUSD->setText(amount.toDecimalRUBString());
+ } else if (Settings::getInstance()->get_currency_name() == "CAD") {
+ req.txtAmountUSD->setText(amount.toDecimalCADString());
+ } else if (Settings::getInstance()->get_currency_name() == "SGD") {
+ req.txtAmountUSD->setText(amount.toDecimalSGDString());
+ } else if (Settings::getInstance()->get_currency_name() == "CHF") {
+ req.txtAmountUSD->setText(amount.toDecimalCHFString());
+ } else if (Settings::getInstance()->get_currency_name() == "INR") {
+ req.txtAmountUSD->setText(amount.toDecimalINRString());
+ } else if (Settings::getInstance()->get_currency_name() == "GBP") {
+ req.txtAmountUSD->setText(amount.toDecimalGBPString());
+ } else if (Settings::getInstance()->get_currency_name() == "AUD") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ }
+ req.txtMemo->setAcceptButton(req.buttonBox->button(QDialogButtonBox::Ok));
+ req.txtMemo->setLenDisplayLabel(req.lblMemoLen);
+ req.txtMemo->setMaxLen(400);
+
+ req.txtFrom->setFocus();
+
+
+ }
+ }
+ if (d.exec() == QDialog::Accepted) {
+ // Construct a hush Payment URI with the data and pay it immediately.
+ CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
+ QString memoURI = "hush:" + req.lblAddressInfo->text()
+ + "?amt=" + amount.toDecimalString()
+ + "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText());
+
+ QString sendURI = "hush:" + AddressBook::addressFromAddressLabel(req.txtFrom->text())
+ + "?amt=0.0001"
+ + "&memo=" + QUrl::toPercentEncoding(memoURI);
+
+ // If the disclosed address in the memo doesn't have a balance, it will automatically fallback to the default
+ // sapling address
+ this->payhushURI(sendURI, req.lblAddressInfo->text());
+
+
+
+ }
+
+}
+
-}
\ No newline at end of file
diff --git a/src/contactmodel.h b/src/contactmodel.h
index fcdf7a3..5f79c47 100644
--- a/src/contactmodel.h
+++ b/src/contactmodel.h
@@ -5,13 +5,17 @@
#include "Model/ContactItem.h"
#include
+#include "mainwindow.h"
class ContactModel
+
{
public:
+
ContactModel() {}
void renderContactList(QListView* view);
+
};
#endif
\ No newline at end of file
diff --git a/src/contactrequest.ui b/src/contactrequest.ui
index 8667057..1e37ee9 100644
--- a/src/contactrequest.ui
+++ b/src/contactrequest.ui
@@ -6,7 +6,7 @@
0
0
- 777
+ 780
427
@@ -233,7 +233,7 @@
- -
+
-
<html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Insert a memo for your request</span></p></body></html>
@@ -318,36 +318,11 @@
- -
-
-
-
- 152
- 25
-
-
-
-
- 100
- 0
-
-
-
- Only add this contact
-
-
- false
-
-
- false
-
-
-
-
- 188
+ 300
25
@@ -358,7 +333,7 @@
- Add Contact & send request
+ Add Contact and send request
false
diff --git a/src/controller.cpp b/src/controller.cpp
index 8007205..83ee2e4 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -237,12 +237,15 @@ void Controller::getInfoThenRefresh(bool force)
zrpc->fetchInfo([=] (const json& reply) {
prevCallSucceeded = true;
int curBlock = reply["latest_block_height"].get();
- int longestchain = reply["longestchain"].get();
- int notarized = reply["notarized"].get();
+ bool doUpdate = force || (model->getLatestBlock() != curBlock);
int difficulty = reply["difficulty"].get();
int blocks_until_halving= 340000 - curBlock;
int halving_days = (blocks_until_halving * 150) / (60*60*24) ;
- bool doUpdate = force || (model->getLatestBlock() != curBlock);
+ int longestchain = reply["longestchain"].get();
+ int notarized = reply["notarized"].get();
+
+
+
model->setLatestBlock(curBlock);
if (
Settings::getInstance()->get_currency_name() == "EUR" ||
@@ -258,7 +261,11 @@ void Controller::getInfoThenRefresh(bool force)
);
ui->longestchain->setText(
"Block: " + QLocale(QLocale::German).toString(longestchain)
+
);
+
+
+
ui->difficulty->setText(
QLocale(QLocale::German).toString(difficulty)
);
@@ -540,8 +547,12 @@ void Controller::getInfoThenRefresh(bool force)
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
refreshTransactions();
}
+
+ int lag = longestchain - notarized ;
+ this->setLag(lag);
}, [=](QString err) {
// hushd has probably disappeared.
+
this->noConnection();
// Prevent multiple dialog boxes, because these are called async
@@ -562,6 +573,20 @@ void Controller::getInfoThenRefresh(bool force)
});
}
+int Controller::getLag()
+{
+
+ return _lag;
+
+}
+
+void Controller::setLag(int lag)
+{
+
+ _lag = lag;
+
+}
+
void Controller::refreshAddresses()
{
if (!zrpc->haveConnection())
@@ -871,12 +896,33 @@ void Controller::refreshTransactions() {
CAmount amount = CAmount::fromqint64(-1* o["value"].get());
// Check for Memos
+
+ if (confirmations == 0) {
+ chatModel->addconfirmations(txid, confirmations);
+ }
+
+ if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
+ DataStore::getChatDataStore()->clear();
+ chatModel->killConfirmationCache();
+ this->refresh(true);
+ }
QString memo;
if (!o["memo"].is_null()) {
memo = QString::fromStdString(o["memo"]);
QString cid;
+ bool isNotarized;
+
+ if (confirmations > getLag())
+ {
+ isNotarized = true;
+ }else{
+
+ isNotarized = false;
+ }
+
+ qDebug()<<"Conf : " << confirmations;
ChatItem item = ChatItem(
datetime,
@@ -888,15 +934,17 @@ void Controller::refreshTransactions() {
cid,
txid,
confirmations,
- true
+ true,
+ isNotarized,
+ false
);
- // qDebug()<<"Memo : " <setData(ChatIDGenerator::getInstance()->generateID(item), item);
-
- }
-
+
+
+
+ }
+
+
items.push_back(TransactionItemDetail{address, amount, memo});
total_amount = total_amount + amount;
}
@@ -944,6 +992,28 @@ void Controller::refreshTransactions() {
QString cid;
int position;
QString requestZaddr;
+ bool isContact;
+
+
+ for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
+ {
+
+ if (p.getPartnerAddress() == requestZaddr)
+ {
+
+ chatModel->addAddressbylabel(address, requestZaddr);
+ } else{}
+
+
+ if (chatModel->Addressbylabel(address) != QString("0xdeadbeef")){
+
+ isContact = true;
+
+ }else{
+
+ isContact = false;
+
+ }
if (!it["memo"].is_null()) {
@@ -958,7 +1028,8 @@ void Controller::refreshTransactions() {
chatModel->addCid(txid, cid);
chatModel->addrequestZaddr(txid, requestZaddr);
- }
+ }
+
if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){
@@ -973,8 +1044,20 @@ void Controller::refreshTransactions() {
requestZaddr = chatModel->getrequestZaddrByTx(txid);
}else{
requestZaddr = "";
- }
+ }
+
position = it["position"].get();
+
+ bool isNotarized;
+
+ if (confirmations > getLag())
+ {
+ isNotarized = true;
+ }else{
+
+ isNotarized = false;
+ }
+
ChatItem item = ChatItem(
datetime,
address,
@@ -985,16 +1068,17 @@ void Controller::refreshTransactions() {
cid,
txid,
confirmations,
- false
+ false,
+ isNotarized,
+ isContact
);
- // qDebug()<< "Position : " << position;
- // qDebug()<<"Confirmation :" << confirmations;
-
+
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
}
}
-
+ }
}
+ qDebug()<<"get Lag" << getLag();
// Calculate the total unspent amount that's pending. This will need to be
// shown in the UI so the user can keep track of pending funds
diff --git a/src/controller.h b/src/controller.h
index b34aeb4..9fd445b 100644
--- a/src/controller.h
+++ b/src/controller.h
@@ -1,3 +1,6 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
+
#ifndef RPCCLIENT_H
#define RPCCLIENT_H
@@ -37,7 +40,10 @@ public:
Connection* getConnection() { return zrpc->getConnection(); }
void setConnection(Connection* c);
void refresh(bool force = false);
- void refreshAddresses();
+ void refreshAddresses();
+ int getLag();
+ void setLag(int lag);
+ int _lag;
void checkForUpdate(bool silent = true);
void refreshZECPrice();
diff --git a/src/encryption.ui b/src/encryption.ui
index b4ab606..ae2643b 100644
--- a/src/encryption.ui
+++ b/src/encryption.ui
@@ -14,65 +14,23 @@
Encrypt Your Wallet
-
-
-
+
-
+
- Qt::Horizontal
+ Qt::Vertical
-
+
+
+ 20
+ 40
+
+
+
- -
-
-
- Encryption Password:
-
-
-
- -
-
-
- Confirm Password:
-
-
-
- -
-
-
- QLineEdit::Password
-
-
-
- -
-
-
- color: red;
-
-
- Passwords don't match
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QLineEdit::Password
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
+
-
- WARNING: If you forget your password, the only way to recover the wallet is from the seed phrase.
+ <html><head/><body><p><span style=" font-size:14pt; color:#ef2929;">WARNING:</span> If you forget your passphrase the only way to recover the wallet is from the seed phrase. If you dont have Backup your seed phrase, please do it now!</p></body></html>
Qt::AlignCenter
@@ -82,6 +40,81 @@
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ <html><head/><body><p>16 letters minimum</p></body></html>
+
+
+
+ -
+
+
+ color: red;
+
+
+ Passphrase don't match
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Encryption Passphrase:
+
+
+
+ -
+
+
+ QLineEdit::Password
+
+
+
+ -
+
+
+ Confirm Passphrase:
+
+
+
+ -
+
+
+ QLineEdit::Password
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
-
@@ -95,32 +128,6 @@
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
diff --git a/src/hushrequest.ui b/src/hushrequest.ui
new file mode 100644
index 0000000..d0b0ca7
--- /dev/null
+++ b/src/hushrequest.ui
@@ -0,0 +1,156 @@
+
+
+ hushrequest
+
+
+
+ 0
+ 0
+ 663
+ 529
+
+
+
+ Dialog
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.
+
+
+ true
+
+
+
+ -
+
+
+ Request From
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 541
+ 20
+
+
+
+
+ -
+
+
+ zaddr
+
+
+
+ -
+
+
+ Amount in
+
+
+
+ -
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ Amount
+
+
+
+ -
+
+
+ Amount USD
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Memo
+
+
+
+ -
+
+
+ 0 / 512
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ My Address
+
+
+
+ -
+
+
+ The recipient will see this address in the "to" field when they pay your request.
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+ MemoEdit
+ QPlainTextEdit
+
+
+
+
+
+
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 0e231f4..7db28cf 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -21,15 +21,36 @@
#include "ui_requestContactDialog.h"
#include "chatmodel.h"
#include "requestdialog.h"
+#include "ui_startupencryption.h"
+#include "ui_removeencryption.h"
#include "websockets.h"
+#include "sodium.h"
+#include "sodium/crypto_generichash_blake2b.h"
#include
+#include "FileSystem/FileSystem.h"
+#include "Crypto/passwd.h"
+#include "Crypto/FileEncryption.h"
using json = nlohmann::json;
+
+
+#ifdef Q_OS_WIN
+auto dirwallet = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat");
+auto dirwalletenc = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat");
+auto dirwalletbackup = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.datBackup");
+#endif
+#ifdef Q_OS_UNIX
+auto dirwallet = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.dat");
+auto dirwalletenc = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat");
+auto dirwalletbackup = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.datBackup");
+#endif
+
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
+
// Include css
QString theme_name;
try
@@ -47,12 +68,19 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
+ // Check for encryption
+
+
+
+ if(fileExists(dirwalletenc))
+ {
+ this->removeWalletEncryptionStartUp();
+ }
+
ui->memoTxtChat->setAutoFillBackground(false);
ui->memoTxtChat->setPlaceholderText("Send Message");
ui->memoTxtChat->setTextColor(Qt::white);
-
-
-
+
// Status Bar
setupStatusBar();
@@ -180,6 +208,12 @@ MainWindow::MainWindow(QWidget *parent) :
createWebsocket(wormholecode);
}
}
+
+bool MainWindow::fileExists(QString path)
+{
+ QFileInfo check_file(path);
+ return (check_file.exists() && check_file.isFile());
+}
void MainWindow::createWebsocket(QString wormholecode) {
qDebug() << "Listening for app connections on port 8777";
@@ -234,6 +268,10 @@ void MainWindow::doClose() {
closeEvent(nullptr);
}
+void MainWindow::doClosePw() {
+ closeEventpw(nullptr);
+}
+
void MainWindow::closeEvent(QCloseEvent* event) {
QSettings s;
@@ -243,6 +281,78 @@ void MainWindow::closeEvent(QCloseEvent* event) {
s.sync();
+
+ // Let the RPC know to shut down any running service.
+ rpc->shutdownhushd();
+
+// Check is encryption is ON for SDl
+ if(fileExists(dirwalletenc))
+
+ {
+ // delete old file before
+
+ //auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
+ QFile fileoldencryption(dirwalletenc);
+ fileoldencryption.remove();
+
+ // Encrypt our wallet.dat
+ QString str = this->getPassword();
+ // QString str = ed.txtPassword->text(); // data comes from user inputs
+ int length = str.length();
+
+ char *sequence = NULL;
+ sequence = new char[length+1];
+ strncpy(sequence, str.toLocal8Bit(), length +1);
+
+ #define MESSAGE ((const unsigned char *) sequence)
+ #define MESSAGE_LEN length
+
+ unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
+
+ crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
+
+ #define PASSWORD sequence
+ #define KEY_LEN crypto_box_SEEDBYTES
+
+
+
+ /////////we use the Hash of the Password as Salt, not perfect but still a good solution.
+
+ unsigned char key[KEY_LEN];
+
+ if (crypto_pwhash
+ (key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
+ crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
+ crypto_pwhash_ALG_DEFAULT) != 0) {
+ /* out of memory */
+}
+
+ auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ // auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
+ QString source_file = dir.filePath("addresslabels.dat");
+ QString target_enc_file = dir.filePath("addresslabels.dat.enc");
+ QString sourceWallet_file = dirwallet;
+ QString target_encWallet_file = dirwalletenc;
+
+ FileEncryption::encrypt(target_enc_file, source_file, key);
+ FileEncryption::encrypt(target_encWallet_file, sourceWallet_file, key);
+
+ ///////////////// we rename the plaintext wallet.dat to Backup, for testing.
+
+ QFile wallet(dirwallet);
+ QFile address(dir.filePath("addresslabels.dat"));
+ wallet.remove();
+ address.remove();
+ }
+
+
+ // Bubble up
+ if (event)
+ QMainWindow::closeEvent(event);
+}
+
+void MainWindow::closeEventpw(QCloseEvent* event) {
+
// Let the RPC know to shut down any running service.
rpc->shutdownhushd();
@@ -253,124 +363,299 @@ void MainWindow::closeEvent(QCloseEvent* event) {
void MainWindow::encryptWallet() {
- // Check if wallet is already encrypted
- auto encStatus = rpc->getModel()->getEncryptionStatus();
- if (encStatus.first) {
- QMessageBox::information(this, tr("Wallet is already encrypted"),
- tr("Your wallet is already encrypted with a password.\nPlease use 'Remove Wallet Encryption' if you want to remove the wallet encryption."),
- QMessageBox::Ok
- );
- return;
- }
QDialog d(this);
Ui_encryptionDialog ed;
ed.setupUi(&d);
// Handle edits on the password box
+
+
auto fnPasswordEdited = [=](const QString&) {
// Enable the OK button if the passwords match.
+ QString password = ed.txtPassword->text();
+
if (!ed.txtPassword->text().isEmpty() &&
- ed.txtPassword->text() == ed.txtConfirmPassword->text()) {
+ ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 16) {
+ ed.lblPasswordMatch->setText("");
+ ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
+ } else {
+ ed.lblPasswordMatch->setText(tr("Passphrase don't match or You have entered too few letters (16 minimum)"));
+ ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+ }
+
+ };
+
+ QObject::connect(ed.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
+ QObject::connect(ed.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
+
+ if (d.exec() == QDialog::Accepted)
+ {
+
+ QString str = ed.txtPassword->text(); // data comes from user inputs
+ int length = str.length();
+ this->setPassword(str);
+
+ char *sequence = NULL;
+ sequence = new char[length+1];
+ strncpy(sequence, str.toLocal8Bit(), length +1);
+
+ #define MESSAGE ((const unsigned char *) sequence)
+ #define MESSAGE_LEN length
+
+ unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
+
+ crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
+
+ #define PASSWORD sequence
+ #define KEY_LEN crypto_box_SEEDBYTES
+
+
+
+ /////////we use the Hash of the Password as Salt, not perfect but still a good solution.
+
+ unsigned char key[KEY_LEN];
+
+ if (crypto_pwhash
+ (key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
+ crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
+ crypto_pwhash_ALG_DEFAULT) != 0) {
+ /* out of memory */
+}
+
+ auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
+ QString source_file = dir.filePath("addresslabels.dat");
+ QString target_enc_file = dir.filePath("addresslabels.dat.enc");
+ QString sourceWallet_file = dirwallet;
+ QString target_encWallet_file = dirwalletenc;
+
+ FileEncryption::encrypt(target_enc_file, source_file, key);
+ FileEncryption::encrypt(target_encWallet_file, sourceWallet_file, key);
+
+ QFile wallet(dirwallet);
+ QFile address(dir.filePath("addresslabels.dat"));
+ wallet.rename(dirwalletbackup);
+ address.rename(dir.filePath("addresslabels.datBackup"));
+ }
+}
+
+void MainWindow::removeWalletEncryption() {
+ QDialog d(this);
+ Ui_removeencryption ed;
+ ed.setupUi(&d);
+
+ auto fnPasswordEdited = [=](const QString&) {
+ QString password = ed.txtPassword->text();
+ // Enable the OK button if the passwords match.
+ if (!ed.txtPassword->text().isEmpty() &&
+ ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 16) {
ed.lblPasswordMatch->setText("");
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
} else {
ed.lblPasswordMatch->setText(tr("Passwords don't match"));
ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
}
+
};
QObject::connect(ed.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
QObject::connect(ed.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
- ed.txtPassword->setText("");
- ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+ if (d.exec() == QDialog::Accepted)
+ {
+ QString str = ed.txtPassword->text(); // data comes from user inputs
+ int length = str.length();
- auto fnShowError = [=](QString title, const json& res) {
- QMessageBox::critical(this, title,
- tr("Error was:\n") + QString::fromStdString(res.dump()),
- QMessageBox::Ok
- );
- };
+ char *sequence = NULL;
+ sequence = new char[length+1];
+ strncpy(sequence, str.toLocal8Bit(), length +1);
- if (d.exec() == QDialog::Accepted) {
- rpc->encryptWallet(ed.txtPassword->text(), [=](json res) {
- if (isJsonResultSuccess(res)) {
- // Save the wallet
- rpc->saveWallet([=] (json reply) {
- if (isJsonResultSuccess(reply)) {
- QMessageBox::information(this, tr("Wallet Encrypted"),
- tr("Your wallet was successfully encrypted! The password will be needed to send funds or export private keys."),
- QMessageBox::Ok
- );
- } else {
- fnShowError(tr("Wallet Encryption Failed"), reply);
- }
- });
+ #define MESSAGE ((const unsigned char *) sequence)
+ #define MESSAGE_LEN length
+
+ unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
+
+ crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
+
+ #define PASSWORD sequence
+ #define KEY_LEN crypto_box_SEEDBYTES
+
+
+
+ /////////we use the Hash of the Password as Salt, not perfect but still a good solution.
+
+ unsigned char key[KEY_LEN];
+
+ if (crypto_pwhash
+ (key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
+ crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
+ crypto_pwhash_ALG_DEFAULT) != 0) {
+ /* out of memory */
+}
+
+
+
+ auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
+ QString target_encwallet_file = dirwalletenc;
+ QString target_decwallet_file = dirwallet;
+ QString target_encaddr_file = dir.filePath("addresslabels.dat.enc");
+ QString target_decaddr_file = dir.filePath("addresslabels.dat");
+
+ FileEncryption::decrypt(target_decwallet_file, target_encwallet_file, key);
+ FileEncryption::decrypt(target_decaddr_file, target_encaddr_file, key);
+
+ QFile filencrypted(dirwalletenc);
+ QFile wallet(dirwallet);
+
+ if (wallet.size() > 0)
+ {
+
+ QMessageBox::information(this, tr("Wallet decryption Success"),
+ QString("Successfully delete the encryption"),
+ QMessageBox::Ok
+ );
+
+ filencrypted.remove();
+
+ }else{
+
+ qDebug()<<"verschlüsselung gescheitert ";
+
+ QMessageBox::critical(this, tr("Wallet Encryption Failed"),
+ QString("False password, please try again"),
+ QMessageBox::Ok
+ );
+ this->removeWalletEncryption();
+ }
- // And then refresh the UI
- rpc->refresh(true);
- } else {
- fnShowError(tr("Wallet Encryption Failed"), res);
- }
- });
}
+
}
-void MainWindow::removeWalletEncryption() {
- // Check if wallet is already encrypted
- auto encStatus = rpc->getModel()->getEncryptionStatus();
- if (!encStatus.first) {
- QMessageBox::information(this, tr("Wallet is not encrypted"),
- tr("Your wallet is not encrypted with a password."),
+void MainWindow::removeWalletEncryptionStartUp() {
+ QDialog d(this);
+ Ui_startup ed;
+ ed.setupUi(&d);
+
+ // Handle edits on the password box
+
+ auto fnPasswordEdited = [=](const QString&) {
+ QString password = ed.txtPassword->text();
+ // Enable the OK button if the passwords match.
+ if (!ed.txtPassword->text().isEmpty() &&
+ ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 16) {
+ ed.lblPasswordMatch->setText("");
+ ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
+ } else {
+ ed.lblPasswordMatch->setText(tr("Passwords don't match or under-lettered"));
+ ed.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+ }
+
+ };
+
+ QObject::connect(ed.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
+ QObject::connect(ed.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
+
+ if (d.exec() == QDialog::Accepted)
+ {
+ QString str = ed.txtPassword->text(); // data comes from user inputs
+ int length = str.length();
+ this->setPassword(str);
+ char *sequence = NULL;
+ sequence = new char[length+1];
+ strncpy(sequence, str.toLocal8Bit(), length +1);
+
+ #define MESSAGE ((const unsigned char *) sequence)
+ #define MESSAGE_LEN length
+
+ unsigned char hash[crypto_secretstream_xchacha20poly1305_KEYBYTES];
+
+ crypto_hash_sha256(hash,MESSAGE, MESSAGE_LEN);
+
+ #define PASSWORD sequence
+ #define KEY_LEN crypto_box_SEEDBYTES
+
+
+
+ /////////we use the Hash of the Password as Salt, not perfect but still a good solution.
+
+ unsigned char key[KEY_LEN];
+
+ if (crypto_pwhash
+ (key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
+ crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
+ crypto_pwhash_ALG_DEFAULT) != 0) {
+ /* out of memory */
+ }
+
+
+ {
+ auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
+ QString target_encwallet_file = dirwalletenc;
+ QString target_decwallet_file = dirwallet;
+ QString target_encaddr_file = dir.filePath("addresslabels.dat.enc");
+ QString target_decaddr_file = dir.filePath("addresslabels.dat");
+
+ FileEncryption::decrypt(target_decwallet_file, target_encwallet_file, key);
+ FileEncryption::decrypt(target_decaddr_file, target_encaddr_file, key);
+
+ }
+
+ auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
+ QFile wallet(dirwallet);
+ //QFile backup(dirHome.filePath(".silentdragonlite/silentdragonlite-wallet.datBACKUP"));*/
+
+ if (wallet.size() > 0)
+ {
+ if (fileExists(dirwalletbackup))
+
+ {
+
+ QMessageBox::warning(this, tr("You have still Plaintextdata on your disk!"),
+ QString("WARNING: Delete it only if you have a backup of your Wallet Seed."),
+ QMessageBox::Ok
+ );
+ // backup.remove();
+
+ }
+
+ QMessageBox::information(this, tr("Wallet Encryption Success"),
+ QString("SDL is ready to Rock"),
+ QMessageBox::Ok
+ );
+
+
+ }else{
+
+ qDebug()<<"verschlüsselung gescheitert ";
+
+ QMessageBox::critical(this, tr("Wallet Encryption Failed"),
+ QString("false password please try again"),
QMessageBox::Ok
);
- return;
+ this->removeWalletEncryptionStartUp();
+ }
+
+ }else{
+
+ this->doClosePw();
}
+
+}
- bool ok;
- QString password = QInputDialog::getText(this, tr("Wallet Password"),
- tr("Please enter your wallet password"), QLineEdit::Password, "", &ok);
+QString MainWindow::getPassword()
+{
- // If cancel was pressed, just return
- if (!ok) {
- return;
- }
+ return _password;
+}
- if (password.isEmpty()) {
- QMessageBox::critical(this, tr("Wallet Decryption Failed"),
- tr("Please enter a password to decrypt your wallet!"),
- QMessageBox::Ok
- );
- return;
- }
+void MainWindow::setPassword(QString password)
+{
- rpc->removeWalletEncryption(password, [=] (json res) {
- if (isJsonResultSuccess(res)) {
- // Save the wallet
- rpc->saveWallet([=] (json reply) {
- if(isJsonResultSuccess(reply)) {
- QMessageBox::information(this, tr("Wallet Encryption Removed"),
- tr("Your wallet was successfully decrypted! You will no longer need a password to send funds or export private keys."),
- QMessageBox::Ok
- );
- } else {
- QMessageBox::critical(this, tr("Wallet Decryption Failed"),
- QString::fromStdString(reply["error"].get()),
- QMessageBox::Ok
- );
- }
- });
-
- // And then refresh the UI
- rpc->refresh(true);
- } else {
- QMessageBox::critical(this, tr("Wallet Decryption Failed"),
- QString::fromStdString(res["error"].get()),
- QMessageBox::Ok
- );
- }
- });
+ _password = password;
}
void MainWindow::setupStatusBar() {
@@ -923,6 +1208,7 @@ void MainWindow::setupTransactionsTab() {
ui->listChat->setMinimumSize(200,350);
ui->listChat->setItemDelegate(new ListViewDelegate());
ui->listChat->show();
+
ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu);
// Table right click
QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
@@ -1052,9 +1338,6 @@ void MainWindow::setupchatTab() {
ui->memoTxtChat->setTextColor("Black");
}
-
-
-
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChat);
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest);
@@ -1069,18 +1352,67 @@ void MainWindow::setupchatTab() {
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
if (label_contact == p.getName()) {
- // ui->ContactZaddr->setText(p.getPartnerAddress());
- // ui->MyZaddr->setText(p.getMyAddress());
- ui->contactNameMemo->setText(p.getName());
- ui->memoTxtChat->clear();
-
- rpc->refresh(true);
- // updateChat();
+ ui->contactNameMemo->setText(p.getName());
+ rpc->refresh(true);
+
}
});
+ QMenu* contextMenu;
+ QAction* requestAction;
+ QAction* editAction;
+ QAction* HushAction;
+ QAction* requestHushAction;
+ QAction* subatomicAction;
+ contextMenu = new QMenu(ui->listContactWidget);
+ requestAction = new QAction("Send a contact request - coming soon",contextMenu);
+ editAction = new QAction("Delete this contact",contextMenu);
+ HushAction = new QAction("Send a friend some Hush - coming soon",contextMenu);
+ requestHushAction = new QAction("Request some Hush - coming soon",contextMenu);
+ subatomicAction = new QAction("Make a subatomic swap with a friend- coming soon",contextMenu);
+ ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+ ui->listContactWidget->addAction(requestAction);
+ ui->listContactWidget->addAction(editAction);
+ ui->listContactWidget->addAction(HushAction);
+ ui->listContactWidget->addAction(requestHushAction);
+ ui->listContactWidget->addAction(subatomicAction);
+ QObject::connect(requestHushAction, &QAction::triggered, [=]() {
+ QModelIndex index = ui->listContactWidget->currentIndex();
+ QString label_contact = index.data(Qt::DisplayRole).toString();
+
+ for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
+ if (label_contact == p.getName()) {
+ ui->contactNameMemo->setText(p.getName());
+ rpc->refresh(true);
+
+ }
+
+ MainWindow::showRequesthush();
+ });
+
+ QObject::connect(editAction, &QAction::triggered, [=]() {
+ QModelIndex index = ui->listContactWidget->currentIndex();
+ QString label_contact = index.data(Qt::DisplayRole).toString();
+
+ for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
+ if (label_contact == p.getName()) {
+
+ QString label1 = p.getName();
+ QString addr = p.getPartnerAddress();
+ QString myzaddr = p.getMyAddress();
+ QString cid = p.getCid();
+ QString avatar = p.getAvatar();
+
+
+ AddressBook::getInstance()->removeAddressLabel(label1, addr, myzaddr, cid,avatar);
+ rpc->refreshContacts(
+ ui->listContactWidget);
+ rpc->refresh(true);
+ }
+ });
+
-ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat);
+ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);
}
@@ -1089,13 +1421,11 @@ void MainWindow::updateChat()
{
rpc->refreshChat(ui->listChat,ui->memoSizeChat);
rpc->refresh(true);
-
-
}
void MainWindow::updateContacts()
{
- //rpc->refreshContacts(ui->listContactWidget);
+
}
void MainWindow::addNewZaddr(bool sapling) {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 85f4feb..56bfbc6 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -51,6 +51,8 @@ public:
QString doSendChatTxValidations(Tx tx);
QString doSendRequestTxValidations(Tx tx);
QString getCid();
+ QString getPassword();
+ void setPassword(QString Password);
void replaceWormholeClient(WormholeClient* newClient);
bool isWebsocketListening();
@@ -58,8 +60,9 @@ public:
void stopWebsocket();
void saveContact();
void saveandsendContact();
- void setMaxLen(int len);
- void updateDisplay();
+ void showRequesthush();
+ // void setmaxlenChat(int len);
+ // void updateDisplay();
void balancesReady();
@@ -86,6 +89,7 @@ public:
Logger* logger;
void doClose();
+ void doClosePw();
QString createHeaderMemo(QString type, QString cid, QString zaddr, int version, int headerNumber);
public slots:
@@ -100,7 +104,9 @@ private slots:
private:
+ bool fileExists(QString path);
void closeEvent(QCloseEvent* event);
+ void closeEventpw(QCloseEvent* event);
void setupSendTab();
@@ -119,6 +125,7 @@ private:
void setupStatusBar();
void clearSendForm();
+ QString _password;
Tx createTxFromSendPage();
bool confirmTx(Tx tx, RecurringPaymentInfo* rpi);
@@ -129,6 +136,7 @@ private:
void encryptWallet();
void removeWalletEncryption();
+ void removeWalletEncryptionStartUp();
void cancelButton();
void sendButton();
@@ -192,14 +200,14 @@ class ChatMemoEdit : public QTextEdit
public:
ChatMemoEdit(QWidget* parent);
- void setMaxLen(int len);
- void setLenDisplayLabel(QLabel* label);
+ void setMaxLenChat(int len);
+ void setLenDisplayLabelChat(QLabel* label);
void SetSendChatButton(QPushButton* button);
- void updateDisplay();
+ void updateDisplayChat();
private:
- int maxlen = 512;
- QLabel* lenDisplayLabel = nullptr;
+ int maxlenchat = 512;
+ QLabel* lenDisplayLabelchat = nullptr;
QPushButton* sendChatButton = nullptr;
};
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 2d85bd5..de58411 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1378,7 +1378,10 @@
true
- QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked
+ QAbstractItemView::NoEditTriggers
+
+
+ false
false
@@ -1386,6 +1389,9 @@
QAbstractItemView::SingleSelection
+
+ QAbstractItemView::SelectItems
+
@@ -1419,10 +1425,16 @@
QTextEdit::AutoNone
- QTextEdit::FixedColumnWidth
+ QTextEdit::FixedPixelWidth
- 80
+ 600
+
+
+ false
+
+
+ Qt::TextEditorInteraction
@@ -1505,6 +1517,9 @@
521
+
+ The locks shows you the status of the message. Red lock = unconfirmed, green lock = min. 1 confirmations, orange lock = message is notarized
+
Qt::ScrollBarAsNeeded
@@ -1515,7 +1530,7 @@
QAbstractScrollArea::AdjustToContents
- QAbstractItemView::AllEditTriggers
+ QAbstractItemView::NoEditTriggers
QListView::Adjust
diff --git a/src/memodialog.ui b/src/memodialog.ui
index 1c144e0..d365221 100644
--- a/src/memodialog.ui
+++ b/src/memodialog.ui
@@ -74,7 +74,7 @@
MemoEdit
QPlainTextEdit
-
+
diff --git a/src/removeencryption.ui b/src/removeencryption.ui
new file mode 100644
index 0000000..77d7239
--- /dev/null
+++ b/src/removeencryption.ui
@@ -0,0 +1,197 @@
+
+
+ removeencryption
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Remove your Wallet encryption
+
+
+
+
+ 50
+ 260
+ 341
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+ 260
+ 170
+ 133
+ 23
+
+
+
+ <html><head/><body><p>16 letters minimum</p></body></html>
+
+
+
+
+
+ 10
+ 229
+ 157
+ 25
+
+
+
+ Confirm Passphrase:
+
+
+
+
+
+ 10
+ 164
+ 382
+ 3
+
+
+
+ Qt::Horizontal
+
+
+
+
+
+ 173
+ 229
+ 219
+ 25
+
+
+
+ QLineEdit::Password
+
+
+
+
+
+ 10
+ 56
+ 382
+ 56
+
+
+
+ <html><head/><body><p><span style=" font-size:14pt; color:#ef2929;">WARNING:</span> If yo remove your encryption, all your Data is Plaintext on your Disk!</p></body></html>
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+
+
+
+ 10
+ 260
+ 382
+ 3
+
+
+
+ Qt::Horizontal
+
+
+
+
+
+ 10
+ 198
+ 157
+ 25
+
+
+
+ Encryption Passphrase:
+
+
+
+
+
+ 10
+ 175
+ 243
+ 17
+
+
+
+ color: red;
+
+
+ Passphrase don't match
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ 173
+ 198
+ 219
+ 25
+
+
+
+ QLineEdit::Password
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ removeencryption
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ removeencryption
+ close()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/requestContactDialog.ui b/src/requestContactDialog.ui
index 2eb4bc0..d4420ea 100644
--- a/src/requestContactDialog.ui
+++ b/src/requestContactDialog.ui
@@ -6,7 +6,7 @@
0
0
- 812
+ 850
495
@@ -27,7 +27,7 @@
- -
+
-
<html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Memo of the request</span></p></body></html>
@@ -97,12 +97,12 @@
- -
+
-
256
- 192
+ 190
@@ -119,14 +119,21 @@
- -
+
-
+
+
+ <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html>
+
+
+
+ -
Request from :
- -
+
-
@@ -142,14 +149,14 @@
- -
+
-
My Zaddr :
- -
+
-
@@ -165,24 +172,24 @@
- -
+
-
Give a Nickname:
- -
+
-
- -
+
-
<html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html>
- -
+
-
@@ -328,7 +335,7 @@
- -
+
-
@@ -353,7 +360,7 @@
- -
+
-
@@ -369,17 +376,24 @@
- -
-
+
-
+
+
+
+
+
+
+ -
+
- -
-
+
-
+
- <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html>
+
diff --git a/src/requestdialog.ui b/src/requestdialog.ui
index 952f780..e52c475 100644
--- a/src/requestdialog.ui
+++ b/src/requestdialog.ui
@@ -14,9 +14,124 @@
Payment Request
+ -
+
+
+
+
+
+
+ -
+
+
+ Request From
+
+
+
+ -
+
+
+ The recipient will see this address in the "to" field when they pay your request.
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
-
+ -
+
+
+
+
+
+
+ -
+
+
+ color: red;
+
+
+
+
+
+
+ -
+
+
+ Memo
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ 0 / 512
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Amount USD
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
-
-
@@ -41,65 +156,13 @@
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
+
-
+
- Request From
+ Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.
-
-
- -
-
-
- My Address
-
-
-
- -
-
-
- color: red;
-
-
-
-
-
-
- -
-
-
- Amount in
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
- -
-
-
-
+
+ true
@@ -119,20 +182,20 @@
- -
-
-
- Qt::Horizontal
+
-
+
+
+ My Address
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
@@ -146,83 +209,20 @@
- -
-
+
-
+
+
+ Amount in
+
+
+
+ -
+
Qt::Horizontal
- -
-
-
- The recipient will see this address in the "to" field when they pay your request.
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- 0 / 512
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- Amount USD
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Memo
-
-
-
- -
-
-
- TextLabel
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.
-
-
- true
-
-
-
diff --git a/src/sendtab.cpp b/src/sendtab.cpp
index de61cf2..ce04a54 100644
--- a/src/sendtab.cpp
+++ b/src/sendtab.cpp
@@ -937,7 +937,7 @@ QString MainWindow::doSendTxValidations(Tx tx) {
auto available = rpc->getModel()->getAvailableBalance();
if (available < total) {
- return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 5 confirmations before they can be spent")
+ return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
.arg(available.toDecimalhushString(), total.toDecimalhushString());
}
diff --git a/src/startupencryption.ui b/src/startupencryption.ui
new file mode 100644
index 0000000..6abdad1
--- /dev/null
+++ b/src/startupencryption.ui
@@ -0,0 +1,184 @@
+
+
+ startup
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ SDL Startup Decryption
+
+
+
+
+ 50
+ 260
+ 341
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+ 10
+ 229
+ 127
+ 25
+
+
+
+ Confirm Password:
+
+
+
+
+
+ 10
+ 166
+ 382
+ 3
+
+
+
+ Qt::Horizontal
+
+
+
+
+
+ 162
+ 229
+ 230
+ 25
+
+
+
+ QLineEdit::Password
+
+
+
+
+
+ 10
+ 58
+ 382
+ 56
+
+
+
+ <html><head/><body><p>If you have forgotten your password, restore your wallet with your seed!</p></body></html>
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+
+
+
+ 10
+ 260
+ 382
+ 3
+
+
+
+ Qt::Horizontal
+
+
+
+
+
+ 10
+ 198
+ 146
+ 25
+
+
+
+ Encryption Password:
+
+
+
+
+
+ 10
+ 175
+ 382
+ 17
+
+
+
+ color: red;
+
+
+ Passwords don't match
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ 162
+ 198
+ 230
+ 25
+
+
+
+ QLineEdit::Password
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ startup
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ startup
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+