fixed bugs in Mail display

This commit is contained in:
csoler 2022-11-28 17:08:02 +01:00
parent 7b0d501c1e
commit 0db41deb9f
2 changed files with 27 additions and 16 deletions

View File

@ -1204,6 +1204,11 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
return NULL; 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(); MessageComposer *msgComposer = MessageComposer::newMsg();
msgComposer->m_msgParentId = msgId; msgComposer->m_msgParentId = msgId;
msgComposer->m_msgType = REPLY; msgComposer->m_msgType = REPLY;
@ -1233,8 +1238,6 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
if (all) if (all)
{ {
RsPeerId ownId = rsPeers->getOwnId();
for(auto m:msgInfo.destinations) for(auto m:msgInfo.destinations)
if(m.type()==MsgAddress::MSG_ADDRESS_TYPE_RSGXSID) if(m.type()==MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
msgComposer->addRecipient(MessageComposer::TO,m.toGxsId()); msgComposer->addRecipient(MessageComposer::TO,m.toGxsId());

View File

@ -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_READ,box_row!=ROW_INBOX);
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_STAR,box_row==ROW_OUTBOX); 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_SPAM,box_row==ROW_OUTBOX);
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_TAGS,box_row==ROW_OUTBOX);
} }
else else
{ {
@ -1154,9 +1155,15 @@ void MessagesDialog::removemessage()
bool doDelete = false; bool doDelete = false;
int listrow = ui.listWidget->currentRow(); int listrow = ui.listWidget->currentRow();
if (listrow == ROW_TRASHBOX || listrow == ROW_OUTBOX) if (listrow == ROW_TRASHBOX)
doDelete = true; 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) if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
doDelete = true; doDelete = true;
@ -1276,8 +1283,12 @@ void MessagesDialog::updateMessageSummaryList()
box = Rs::Msgs::BoxName::BOX_NONE; box = Rs::Msgs::BoxName::BOX_NONE;
} }
std::list<MsgInfoSummary> msgList; std::list<MsgInfoSummary> msgList,tmplist;
rsMail->getMessageSummaries(box,msgList); 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<int, int> tagCount; QMap<int, int> tagCount;
@ -1293,17 +1304,14 @@ void MessagesDialog::updateMessageSummaryList()
tagCount [*tagId] = nCount; tagCount [*tagId] = nCount;
} }
if (it->msgflags & RS_MSG_STAR) { if (it->msgflags & RS_MSG_STAR)
++starredCount; ++starredCount;
}
if (it->msgflags & RS_MSG_SYSTEM) { if (it->msgflags & RS_MSG_SYSTEM)
++systemCount; ++systemCount;
}
if (it->msgflags & RS_MSG_SPAM) { if (it->msgflags & RS_MSG_SPAM)
++spamCount; ++spamCount;
}
/* calculate box */ /* calculate box */
if (it->msgflags & RS_MSG_TRASH) { if (it->msgflags & RS_MSG_TRASH) {
@ -1321,7 +1329,7 @@ void MessagesDialog::updateMessageSummaryList()
case RS_MSG_OUTBOX: case RS_MSG_OUTBOX:
++newOutboxCount; ++newOutboxCount;
break; break;
case RS_MSG_DRAFTBOX: case RS_MSG_DRAFT: // not RS_MSG_DRAFTBOX because drafts are not considered outgoing
++newDraftCount; ++newDraftCount;
break; break;
case RS_MSG_SENTBOX: case RS_MSG_SENTBOX:
@ -1358,7 +1366,7 @@ void MessagesDialog::updateMessageSummaryList()
break; break;
} }
std::cerr << "NewInboxCount = " << newInboxCount << " NewDraftCount = " << newDraftCount << std::endl;
QString textItem; QString textItem;
/*updating the labels in leftcolumn*/ /*updating the labels in leftcolumn*/