dont delete unsent message when switching tab, add more contextmenu
This commit is contained in:
@@ -36,6 +36,7 @@ class ChatItem
|
|||||||
QString getTxid();
|
QString getTxid();
|
||||||
int getConfirmations();
|
int getConfirmations();
|
||||||
bool isOutgoing();
|
bool isOutgoing();
|
||||||
|
bool isdouble();
|
||||||
bool isNotarized();
|
bool isNotarized();
|
||||||
void setTimestamp(long timestamp);
|
void setTimestamp(long timestamp);
|
||||||
void setAddress(QString address);
|
void setAddress(QString address);
|
||||||
|
|||||||
@@ -5,20 +5,17 @@
|
|||||||
#include "addressbook.h"
|
#include "addressbook.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "chatmodel.h"
|
#include "chatmodel.h"
|
||||||
|
#include "requestdialog.h"
|
||||||
|
#include "ui_requestdialog.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "controller.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ContactModel::renderContactList(QListView* view)
|
void ContactModel::renderContactList(QListView* view)
|
||||||
{
|
{
|
||||||
QStandardItemModel* contact = new QStandardItemModel();
|
QStandardItemModel* contact = new QStandardItemModel();
|
||||||
QMenu* contextMenu;
|
|
||||||
QAction* requestAction;
|
|
||||||
QAction* editAction;
|
|
||||||
contextMenu = new QMenu(view);
|
|
||||||
requestAction = new QAction("Send a contact request",contextMenu);
|
|
||||||
editAction = new QAction("Edit this contact",contextMenu);
|
|
||||||
|
|
||||||
// QObject::connect(requestAction,SIGNAL(customContextMenuRequested(const QModelIndex)),this, SLOT(&ContactModel::requestActionClickedSlot));
|
|
||||||
|
|
||||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -34,9 +31,25 @@ void ContactModel::renderContactList(QListView* view)
|
|||||||
view->setUniformItemSizes(true);
|
view->setUniformItemSizes(true);
|
||||||
view->setDragDropMode(QAbstractItemView::DropOnly);
|
view->setDragDropMode(QAbstractItemView::DropOnly);
|
||||||
view->show();
|
view->show();
|
||||||
view->setContextMenuPolicy(Qt::ActionsContextMenu);
|
|
||||||
view->addAction(requestAction);
|
|
||||||
view->addAction(editAction);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showRequesthush() {
|
||||||
|
|
||||||
|
Ui_RequestDialog req;
|
||||||
|
QDialog d(this);
|
||||||
|
req.setupUi(&d);
|
||||||
|
Settings::saveRestore(&d);
|
||||||
|
|
||||||
|
// setupDialog(main, &d, &req);
|
||||||
|
|
||||||
|
// Setup the Label completer for the Address
|
||||||
|
|
||||||
|
|
||||||
|
d.exec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,17 @@
|
|||||||
|
|
||||||
#include "Model/ContactItem.h"
|
#include "Model/ContactItem.h"
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
|
||||||
class ContactModel
|
class ContactModel
|
||||||
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ContactModel() {}
|
ContactModel() {}
|
||||||
void renderContactList(QListView* view);
|
void renderContactList(QListView* view);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -943,8 +943,7 @@ void Controller::refreshTransactions() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this->refresh(true);
|
|
||||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||||
total_amount = total_amount + amount;
|
total_amount = total_amount + amount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1358,13 +1358,33 @@ void MainWindow::setupchatTab() {
|
|||||||
// ui->ContactZaddr->setText(p.getPartnerAddress());
|
// ui->ContactZaddr->setText(p.getPartnerAddress());
|
||||||
// ui->MyZaddr->setText(p.getMyAddress());
|
// ui->MyZaddr->setText(p.getMyAddress());
|
||||||
ui->contactNameMemo->setText(p.getName());
|
ui->contactNameMemo->setText(p.getName());
|
||||||
ui->memoTxtChat->clear();
|
// ui->memoTxtChat->clear();
|
||||||
|
|
||||||
rpc->refresh(true);
|
rpc->refresh(true);
|
||||||
// updateChat();
|
// updateChat();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
QMenu* contextMenu;
|
||||||
|
QAction* requestAction;
|
||||||
|
QAction* editAction;
|
||||||
|
QAction* HushAction;
|
||||||
|
QAction* requestHushAction;
|
||||||
|
contextMenu = new QMenu(ui->listContactWidget);
|
||||||
|
requestAction = new QAction("Send a contact request",contextMenu);
|
||||||
|
editAction = new QAction("Delete this contact",contextMenu);
|
||||||
|
HushAction = new QAction("Send a friend some Hush",contextMenu);
|
||||||
|
requestHushAction = new QAction("Request some Hush",contextMenu);
|
||||||
|
ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
|
ui->listContactWidget->addAction(requestAction);
|
||||||
|
ui->listContactWidget->addAction(editAction);
|
||||||
|
ui->listContactWidget->addAction(HushAction);
|
||||||
|
ui->listContactWidget->addAction(requestHushAction);
|
||||||
|
QObject::connect(requestHushAction, &QAction::triggered, [=]() {
|
||||||
|
MainWindow::showRequesthush();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);
|
ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public:
|
|||||||
void stopWebsocket();
|
void stopWebsocket();
|
||||||
void saveContact();
|
void saveContact();
|
||||||
void saveandsendContact();
|
void saveandsendContact();
|
||||||
|
void showRequesthush();
|
||||||
// void setmaxlenChat(int len);
|
// void setmaxlenChat(int len);
|
||||||
// void updateDisplay();
|
// void updateDisplay();
|
||||||
|
|
||||||
|
|||||||
@@ -1389,6 +1389,9 @@
|
|||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectItems</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_39">
|
<widget class="QLabel" name="label_39">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@@ -1422,10 +1425,16 @@
|
|||||||
<set>QTextEdit::AutoNone</set>
|
<set>QTextEdit::AutoNone</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="lineWrapMode">
|
<property name="lineWrapMode">
|
||||||
<enum>QTextEdit::FixedColumnWidth</enum>
|
<enum>QTextEdit::FixedPixelWidth</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="lineWrapColumnOrWidth">
|
<property name="lineWrapColumnOrWidth">
|
||||||
<number>80</number>
|
<number>600</number>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextEditorInteraction</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="contactNameMemo">
|
<widget class="QLabel" name="contactNameMemo">
|
||||||
|
|||||||
Reference in New Issue
Block a user