fixed toggling read/unread and star status

This commit is contained in:
csoler 2019-02-26 14:45:48 +01:00
parent 875d0a15da
commit 5cbff98e40
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
4 changed files with 39 additions and 69 deletions

View file

@ -58,7 +58,7 @@ void RsMessageModel::preMods()
}
void RsMessageModel::postMods()
{
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(0,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mMessages.size()-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
}
// void RsGxsForumModel::setSortMode(SortMode mode)
@ -651,15 +651,14 @@ void RsMessageModel::setMsgReadStatus(const QModelIndex& i,bool read_status)
return ;
preMods();
rsMsgs->MessageRead(i.data(MsgIdRole).toString().toStdString(),!read_status);
postMods();
}
quintptr ref = i.internalId();
uint32_t index = 0;
if(!convertInternalIdToMsgIndex(ref,index) || index >= mMessages.size())
return ;
rsMsgs->MessageRead(mMessages[index].msgId,!read_status);
void RsMessageModel::setMsgStar(const QModelIndex& i,bool star)
{
preMods();
rsMsgs->MessageStar(i.data(MsgIdRole).toString().toStdString(),star);
postMods();
}
@ -685,3 +684,4 @@ void RsMessageModel::debug_dump() const
std::cerr << "Id: " << it->msgId << ": from " << it->srcId << ": flags=" << it->msgflags << ": title=\"" << it->title << "\"" << std::endl;
}