Merge pull request #201 from MyHush/dev
fix of disapparing contacts, show number of new contacts
This commit is contained in:
@@ -565,27 +565,17 @@ try {
|
||||
|
||||
QString AddressBook::writeableFile()
|
||||
{
|
||||
auto filename = QStringLiteral("addresslabels.dat");
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
auto filename = QStringLiteral("addresslabels.dat");
|
||||
|
||||
try {
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
if (!dir.exists())
|
||||
QDir().mkpath(dir.absolutePath());
|
||||
|
||||
if (Settings::getInstance()->isTestnet())
|
||||
if (Settings::getInstance()->isTestnet()) {
|
||||
return dir.filePath("testnet-" % filename);
|
||||
|
||||
else
|
||||
} else {
|
||||
return dir.filePath(filename);
|
||||
|
||||
} catch(...) {
|
||||
QMessageBox msgWarning;
|
||||
msgWarning.setText("WARNING!\nCould not write Addressbook.");
|
||||
msgWarning.setIcon(QMessageBox::Warning);
|
||||
msgWarning.setWindowTitle("Caution");
|
||||
msgWarning.exec();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -237,6 +237,20 @@ void MainWindow::renderContactRequest(){
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow duplicate address labels.
|
||||
|
||||
if (!AddressBook::getInstance()->getAddressForLabel(newLabel).isEmpty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Label Error"),
|
||||
QObject::tr("The label '%1' already exists. Please remove the existing label.").arg(newLabel),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
qDebug()<<"Doppelter Name";
|
||||
return;
|
||||
}
|
||||
|
||||
// Test if address is valid.
|
||||
if (!Settings::isValidAddress(addr))
|
||||
{
|
||||
@@ -248,12 +262,15 @@ void MainWindow::renderContactRequest(){
|
||||
);
|
||||
return;
|
||||
}
|
||||
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
|
||||
rpc->refreshContacts(
|
||||
ui->listContactWidget);
|
||||
|
||||
QMessageBox::information(this, "Added Contact","successfully added your new contact. You can now Chat with this contact");
|
||||
dialog.close();
|
||||
|
||||
|
||||
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
|
||||
rpc->refreshContacts(
|
||||
ui->listContactWidget);
|
||||
|
||||
QMessageBox::information(this, "Added Contact","successfully added your new contact. You can now Chat with this contact");
|
||||
dialog.close();
|
||||
});
|
||||
|
||||
dialog.exec();
|
||||
@@ -684,7 +701,7 @@ QString MainWindow::doSendChatTxValidations(Tx tx) {
|
||||
return QString(tr("Recipient Address ")) % addr % tr(" is Invalid");
|
||||
ui->memoTxtChat->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
// This technically shouldn't be possible, but issue #62 seems to have discovered a bug
|
||||
// somewhere, so just add a check to make sure.
|
||||
if (toAddr.amount.toqint64() < 0) {
|
||||
@@ -828,6 +845,19 @@ void MainWindow::ContactRequest() {
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
QString newLabel = contactRequest.getLabel();
|
||||
|
||||
if (!AddressBook::getInstance()->getAddressForLabel(newLabel).isEmpty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Label Error"),
|
||||
QObject::tr("The label '%1' already exists. Please remove the existing label.").arg(newLabel),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
int max = 512;
|
||||
QString chattext = contactRequest.getMemo();;
|
||||
@@ -916,6 +946,17 @@ void MainWindow::ContactRequest() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AddressBook::getInstance()->getAddressForLabel(newLabel).isEmpty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Label Error"),
|
||||
QObject::tr("The label '%1' already exists. Please remove the existing label.").arg(newLabel),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Test if address is valid.
|
||||
if (!Settings::isValidAddress(addr))
|
||||
{
|
||||
@@ -928,8 +969,6 @@ void MainWindow::ContactRequest() {
|
||||
return;
|
||||
}
|
||||
|
||||
///////Todo: Test if label allready exist!
|
||||
|
||||
////// Success, so show it
|
||||
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
|
||||
rpc->refreshContacts(
|
||||
|
||||
@@ -81,6 +81,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
if (!dir.exists()){
|
||||
QDir().mkpath(dir.absolutePath());
|
||||
}else{}
|
||||
|
||||
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
|
||||
// Check for encryption
|
||||
|
||||
@@ -1667,13 +1672,21 @@ if (-1 != pos)
|
||||
|
||||
QObject::connect(ui->listContactWidget, &QTableView::clicked, [=] () {
|
||||
|
||||
ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
ui->listContactWidget->addAction(HushAction);
|
||||
ui->listContactWidget->addAction(editAction);
|
||||
ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
ui->listContactWidget->addAction(HushAction);
|
||||
ui->listContactWidget->addAction(editAction);
|
||||
int requestsize = DataStore::getChatDataStore()->getAllNewContactRequests().size();
|
||||
|
||||
ui->memoTxtChat->setEnabled(false);
|
||||
ui->emojiButton->setEnabled(false);
|
||||
ui->sendChatButton->setEnabled(false);
|
||||
if (requestsize > 0)
|
||||
{
|
||||
ui->newRequest->setStyleSheet("color: red;");
|
||||
}else{}
|
||||
|
||||
ui->newRequest->setNum(requestsize);
|
||||
|
||||
ui->memoTxtChat->setEnabled(false);
|
||||
ui->emojiButton->setEnabled(false);
|
||||
ui->sendChatButton->setEnabled(false);
|
||||
|
||||
QModelIndex index = ui->listContactWidget->currentIndex();
|
||||
QString label_contact = index.data(Qt::DisplayRole).toString();
|
||||
@@ -1773,6 +1786,19 @@ if (-1 != pos)
|
||||
|
||||
|
||||
ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);
|
||||
ui->newRequest->setStyleSheet("color: red;");
|
||||
|
||||
|
||||
////get amount of new contact request as intervall
|
||||
|
||||
QTimer* timer = new QTimer();
|
||||
timer->setInterval(30000);
|
||||
|
||||
connect(timer, &QTimer::timeout, this, [=](){
|
||||
int requestsize = DataStore::getChatDataStore()->getAllNewContactRequests().size();
|
||||
ui->newRequest->setNum(requestsize);
|
||||
});
|
||||
timer->start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -66,210 +66,6 @@
|
||||
<string>HushChat</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushContact">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Incoming contact request</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../application.qrc">
|
||||
<normaloff>:/icons/res/requestBlack.png</normaloff>:/icons/res/requestBlack.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="safeContactRequest">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add a new contact</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="Dark">
|
||||
<normalon>:/icons/res/addContactBlack.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="givemeZaddr">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Get a new Address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../application.qrc">
|
||||
<normaloff>:/icons/res/getAddrBlack.png</normaloff>:/icons/res/getAddrBlack.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_39">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Contactlist</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listContactWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectItems</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<property name="sizeConstraint">
|
||||
@@ -547,6 +343,223 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushContact">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Incoming contact request</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../application.qrc">
|
||||
<normaloff>:/icons/res/requestBlack.png</normaloff>:/icons/res/requestBlack.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QLabel" name="newRequest">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="safeContactRequest">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add a new contact</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="Dark">
|
||||
<normalon>:/icons/res/addContactBlack.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="givemeZaddr">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Get a new Address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../application.qrc">
|
||||
<normaloff>:/icons/res/getAddrBlack.png</normaloff>:/icons/res/getAddrBlack.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_39">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Contactlist</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listContactWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectItems</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define APP_VERSION "1.3.10"
|
||||
#define APP_VERSION "1.3.11"
|
||||
|
||||
Reference in New Issue
Block a user