mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-25 23:06:10 -05:00
fixed multiple glitches in Mail UI
This commit is contained in:
parent
2d024c0d6f
commit
ea4df6306b
@ -127,11 +127,45 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
|||||||
|
|
||||||
/* Refresh style to have the correct text color */
|
/* Refresh style to have the correct text color */
|
||||||
Rshare::refreshStyleSheet(this, false);
|
Rshare::refreshStyleSheet(this, false);
|
||||||
|
|
||||||
|
mEventHandlerId_identities = 0;
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
|
||||||
|
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_identities, RsEventType::GXS_IDENTITY );
|
||||||
|
mEventHandlerId_peers = 0;
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
|
||||||
|
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_peers, RsEventType::PEER_CONNECTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
const RsGxsIdentityEvent *fe = dynamic_cast<const RsGxsIdentityEvent*>(event.get());
|
||||||
|
|
||||||
|
if(fe)
|
||||||
|
{
|
||||||
|
updateDisplay(true);
|
||||||
|
update(); // Qt flush
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const RsConnectionEvent *fp = dynamic_cast<const RsConnectionEvent*>(event.get());
|
||||||
|
|
||||||
|
if(fp)
|
||||||
|
switch(fp->mConnectionInfoCode)
|
||||||
|
{
|
||||||
|
case RsConnectionEventCode::PEER_REMOVED:
|
||||||
|
case RsConnectionEventCode::PEER_ADDED:
|
||||||
|
updateDisplay(true);
|
||||||
|
update(); // Qt flush
|
||||||
|
break;
|
||||||
|
default: break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FriendSelectionWidget::~FriendSelectionWidget()
|
FriendSelectionWidget::~FriendSelectionWidget()
|
||||||
{
|
{
|
||||||
delete ui;
|
rsEvents->unregisterEventsHandler(mEventHandlerId_peers);
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId_identities);
|
||||||
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendSelectionWidget::changeEvent(QEvent *e)
|
void FriendSelectionWidget::changeEvent(QEvent *e)
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "retroshare/rsevents.h"
|
||||||
#include <gui/gxs/RsGxsUpdateBroadcastPage.h>
|
#include <gui/gxs/RsGxsUpdateBroadcastPage.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -151,6 +152,8 @@ private:
|
|||||||
void setSelectedIds_internal(IdType idType, const std::set<std::string> &ids, bool add);
|
void setSelectedIds_internal(IdType idType, const std::set<std::string> &ids, bool add);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||||
|
|
||||||
bool mStarted;
|
bool mStarted;
|
||||||
RSTreeWidgetItemCompareRole *mCompareRole;
|
RSTreeWidgetItemCompareRole *mCompareRole;
|
||||||
Modus mListModus;
|
Modus mListModus;
|
||||||
@ -173,6 +176,9 @@ private:
|
|||||||
QList<QAction*> mContextMenuActions;
|
QList<QAction*> mContextMenuActions;
|
||||||
|
|
||||||
std::set<std::string> mPreSelectedIds; // because loading of GxsIds is asynchroneous we keep selected Ids from the client in a list here and use it to initialize after loading them.
|
std::set<std::string> mPreSelectedIds; // because loading of GxsIds is asynchroneous we keep selected Ids from the client in a list here and use it to initialize after loading them.
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_identities;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_peers;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(FriendSelectionWidget::ShowTypes)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(FriendSelectionWidget::ShowTypes)
|
||||||
|
@ -585,8 +585,9 @@ QVariant RsMessageModel::userRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col)
|
|||||||
{
|
{
|
||||||
switch(col)
|
switch(col)
|
||||||
{
|
{
|
||||||
case COLUMN_THREAD_AUTHOR: return displayRole(fmpe,col);
|
case COLUMN_THREAD_AUTHOR: return QVariant(QString::fromStdString(fmpe.from.toStdString()));
|
||||||
case COLUMN_THREAD_MSGID: return QVariant(QString::fromStdString(fmpe.msgId));
|
case COLUMN_THREAD_MSGID: return QVariant(QString::fromStdString(fmpe.msgId));
|
||||||
|
case COLUMN_THREAD_TO: return QVariant(QString::fromStdString(fmpe.to.toStdString()));
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -679,10 +679,13 @@ void MessageWidget::fill(const std::string &msgId)
|
|||||||
link = RetroShareLink::createMessage(msgInfo.from.toRsPeerId(), "");
|
link = RetroShareLink::createMessage(msgInfo.from.toRsPeerId(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.from.toRsPeerId() == ownId) || msgInfo.from.type()!=MsgAddress::MSG_ADDRESS_TYPE_RSPEERID) {
|
if ((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.from.toRsPeerId() == ownId)
|
||||||
|
{
|
||||||
ui.fromText->setText("[Notification]");
|
ui.fromText->setText("[Notification]");
|
||||||
if (toolButtonReply) toolButtonReply->setEnabled(false);
|
if (toolButtonReply) toolButtonReply->setEnabled(false);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui.fromText->setText(link.toHtml());
|
ui.fromText->setText(link.toHtml());
|
||||||
ui.fromText->setToolTip(tooltip_string) ;
|
ui.fromText->setToolTip(tooltip_string) ;
|
||||||
if (toolButtonReply) toolButtonReply->setEnabled(true);
|
if (toolButtonReply) toolButtonReply->setEnabled(true);
|
||||||
|
@ -379,12 +379,15 @@ void MessagesDialog::postModelUpdate()
|
|||||||
sel.select(i.sibling(i.row(),0),i.sibling(i.row(),RsMessageModel::COLUMN_THREAD_NB_COLUMNS-1));
|
sel.select(i.sibling(i.row(),0),i.sibling(i.row(),RsMessageModel::COLUMN_THREAD_NB_COLUMNS-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.messageTreeWidget->selectionModel()->select(sel,QItemSelectionModel::SelectCurrent);
|
// Restoring selection should not trigger anything, especially the re-display of the msg, which
|
||||||
|
// in turn will change the read status.
|
||||||
|
|
||||||
|
whileBlocking(ui.messageTreeWidget->selectionModel())->select(sel,QItemSelectionModel::SelectCurrent);
|
||||||
|
|
||||||
if (!mTmpSavedCurrentId.isEmpty()) {
|
if (!mTmpSavedCurrentId.isEmpty()) {
|
||||||
QModelIndex index = mMessageProxyModel->mapFromSource(mMessageModel->getIndexOfMessage(mTmpSavedCurrentId.toStdString()));
|
QModelIndex index = mMessageProxyModel->mapFromSource(mMessageModel->getIndexOfMessage(mTmpSavedCurrentId.toStdString()));
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
ui.messageTreeWidget->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select);
|
whileBlocking(ui.messageTreeWidget->selectionModel())->setCurrentIndex(index, QItemSelectionModel::Select);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -898,7 +901,7 @@ void MessagesDialog::changeBox(int box_row)
|
|||||||
switch(box_row)
|
switch(box_row)
|
||||||
{
|
{
|
||||||
case ROW_INBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_INBOX );
|
case ROW_INBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_INBOX );
|
||||||
break;
|
break;
|
||||||
case ROW_OUTBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_OUTBOX);
|
case ROW_OUTBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_OUTBOX);
|
||||||
break;
|
break;
|
||||||
case ROW_DRAFTBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_DRAFTS);
|
case ROW_DRAFTBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_DRAFTS);
|
||||||
@ -913,7 +916,8 @@ void MessagesDialog::changeBox(int box_row)
|
|||||||
|
|
||||||
insertMsgTxtAndFiles(ui.messageTreeWidget->currentIndex());
|
insertMsgTxtAndFiles(ui.messageTreeWidget->currentIndex());
|
||||||
ui.messageTreeWidget->setPlaceholderText(placeholderText);
|
ui.messageTreeWidget->setPlaceholderText(placeholderText);
|
||||||
}
|
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_READ,box_row!=ROW_INBOX);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_NONE);
|
mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_NONE);
|
||||||
@ -993,21 +997,16 @@ void MessagesDialog::clicked(const QModelIndex& proxy_index)
|
|||||||
case RsMessageModel::COLUMN_THREAD_READ:
|
case RsMessageModel::COLUMN_THREAD_READ:
|
||||||
{
|
{
|
||||||
mMessageModel->setMsgReadStatus(real_index, !isMessageRead(proxy_index));
|
mMessageModel->setMsgReadStatus(real_index, !isMessageRead(proxy_index));
|
||||||
//Already updated by currentChanged
|
|
||||||
//insertMsgTxtAndFiles(proxy_index);
|
|
||||||
updateMessageSummaryList();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RsMessageModel::COLUMN_THREAD_STAR:
|
case RsMessageModel::COLUMN_THREAD_STAR:
|
||||||
{
|
{
|
||||||
mMessageModel->setMsgStar(real_index, !hasMessageStar(proxy_index));
|
mMessageModel->setMsgStar(real_index, !hasMessageStar(proxy_index));
|
||||||
updateMessageSummaryList();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RsMessageModel::COLUMN_THREAD_SPAM:
|
case RsMessageModel::COLUMN_THREAD_SPAM:
|
||||||
{
|
{
|
||||||
mMessageModel->setMsgJunk(real_index, !hasMessageSpam(proxy_index));
|
mMessageModel->setMsgJunk(real_index, !hasMessageSpam(proxy_index));
|
||||||
updateMessageSummaryList();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user