From 0db41deb9f6e9ddc4ba081ed7ef36a04f6417652 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 28 Nov 2022 17:08:02 +0100 Subject: [PATCH] fixed bugs in Mail display --- .../src/gui/msgs/MessageComposer.cpp | 7 ++-- .../src/gui/msgs/MessagesDialog.cpp | 36 +++++++++++-------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index 692b4b996..97c28a9e5 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -1204,6 +1204,11 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all) return NULL; } + if(msgInfo.from.type()==MsgAddress::MSG_ADDRESS_TYPE_RSPEERID && msgInfo.from.toRsPeerId().isNull()) + { + QMessageBox::warning(nullptr,tr("Will not reply"),tr("There is no point in replying to a notification message!")); + return nullptr; + } MessageComposer *msgComposer = MessageComposer::newMsg(); msgComposer->m_msgParentId = msgId; msgComposer->m_msgType = REPLY; @@ -1233,8 +1238,6 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all) if (all) { - RsPeerId ownId = rsPeers->getOwnId(); - for(auto m:msgInfo.destinations) if(m.type()==MsgAddress::MSG_ADDRESS_TYPE_RSGXSID) msgComposer->addRecipient(MessageComposer::TO,m.toGxsId()); diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp index b46dcd0f4..fedf0e7b4 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp @@ -919,6 +919,7 @@ void MessagesDialog::changeBox(int box_row) ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_READ,box_row!=ROW_INBOX); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_STAR,box_row==ROW_OUTBOX); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_SPAM,box_row==ROW_OUTBOX); + ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_TAGS,box_row==ROW_OUTBOX); } else { @@ -1154,9 +1155,15 @@ void MessagesDialog::removemessage() bool doDelete = false; int listrow = ui.listWidget->currentRow(); - if (listrow == ROW_TRASHBOX || listrow == ROW_OUTBOX) + if (listrow == ROW_TRASHBOX) doDelete = true; + if(listrow == ROW_OUTBOX) + { + QMessageBox::warning(nullptr,tr("Deletion impossible"),tr("Messages in this box are automatically deleted when received.")); + return ; + } + if (QApplication::keyboardModifiers() & Qt::ShiftModifier) doDelete = true; @@ -1267,17 +1274,21 @@ void MessagesDialog::updateMessageSummaryList() switch(box_row) { - case ROW_INBOX: box = Rs::Msgs::BoxName::BOX_INBOX ; break; - case ROW_OUTBOX: box = Rs::Msgs::BoxName::BOX_OUTBOX; break; + case ROW_INBOX: box = Rs::Msgs::BoxName::BOX_INBOX ; break; + case ROW_OUTBOX: box = Rs::Msgs::BoxName::BOX_OUTBOX; break; case ROW_DRAFTBOX: box = Rs::Msgs::BoxName::BOX_DRAFTS; break; - case ROW_SENTBOX: box = Rs::Msgs::BoxName::BOX_SENT ; break; + case ROW_SENTBOX: box = Rs::Msgs::BoxName::BOX_SENT ; break; case ROW_TRASHBOX: box = Rs::Msgs::BoxName::BOX_TRASH ; break; default: box = Rs::Msgs::BoxName::BOX_NONE; } - std::list msgList; - rsMail->getMessageSummaries(box,msgList); + std::list msgList,tmplist; + rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_INBOX ,tmplist); msgList.splice(msgList.end(),tmplist); + rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_OUTBOX,tmplist); msgList.splice(msgList.end(),tmplist); + rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_DRAFTS,tmplist); msgList.splice(msgList.end(),tmplist); + rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_SENT ,tmplist); msgList.splice(msgList.end(),tmplist); + rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_TRASH ,tmplist); msgList.splice(msgList.end(),tmplist); QMap tagCount; @@ -1293,17 +1304,14 @@ void MessagesDialog::updateMessageSummaryList() tagCount [*tagId] = nCount; } - if (it->msgflags & RS_MSG_STAR) { + if (it->msgflags & RS_MSG_STAR) ++starredCount; - } - if (it->msgflags & RS_MSG_SYSTEM) { + if (it->msgflags & RS_MSG_SYSTEM) ++systemCount; - } - if (it->msgflags & RS_MSG_SPAM) { + if (it->msgflags & RS_MSG_SPAM) ++spamCount; - } /* calculate box */ if (it->msgflags & RS_MSG_TRASH) { @@ -1321,7 +1329,7 @@ void MessagesDialog::updateMessageSummaryList() case RS_MSG_OUTBOX: ++newOutboxCount; break; - case RS_MSG_DRAFTBOX: + case RS_MSG_DRAFT: // not RS_MSG_DRAFTBOX because drafts are not considered outgoing ++newDraftCount; break; case RS_MSG_SENTBOX: @@ -1358,7 +1366,7 @@ void MessagesDialog::updateMessageSummaryList() break; } - +std::cerr << "NewInboxCount = " << newInboxCount << " NewDraftCount = " << newDraftCount << std::endl; QString textItem; /*updating the labels in leftcolumn*/