Fix Message Quick View

This commit is contained in:
Phenom 2021-01-28 10:37:25 +01:00
parent e0ed60ee6f
commit 7a3370ae0f
2 changed files with 65 additions and 60 deletions

View File

@ -373,10 +373,12 @@ uint32_t RsMessageModel::updateFilterStatus(ForumModelIndex /*i*/,int /*column*/
void RsMessageModel::setFilter(FilterType filter_type, const QStringList& strings) void RsMessageModel::setFilter(FilterType filter_type, const QStringList& strings)
{ {
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "Setting filter to filter_type=" << int(filter_type) << " and strings to " ; std::cerr << "Setting filter to filter_type=" << int(filter_type) << " and strings to " ;
foreach(const QString& str,strings) foreach(const QString& str,strings)
std::cerr << "\"" << str.toStdString() << "\" " ; std::cerr << "\"" << str.toStdString() << "\" " ;
std::cerr << std::endl; std::cerr << std::endl;
#endif
preMods(); preMods();
@ -484,7 +486,6 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
QString text; QString text;
// build tag names // build tag names
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
for (auto tagit = tagInfo.tagIds.begin(); tagit != tagInfo.tagIds.end(); ++tagit) for (auto tagit = tagInfo.tagIds.begin(); tagit != tagInfo.tagIds.end(); ++tagit)
{ {
if (!text.isNull()) if (!text.isNull())
@ -495,7 +496,7 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
if (Tag != Tags.types.end()) if (Tag != Tags.types.end())
text += TagDefs::name(Tag->first, Tag->second.first); text += TagDefs::name(Tag->first, Tag->second.first);
else else
std::cerr << "(WW) unknown tag " << (int)Tag->first << " in message " << fmpe.msgId << std::endl; RS_WARN("Unknown tag ", (int)Tag->first, " in message ", fmpe.msgId);
} }
return text; return text;
} }
@ -514,7 +515,6 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
return QVariant("[ TODO ]"); return QVariant("[ TODO ]");
} }
return QVariant("[ERROR]"); return QVariant("[ERROR]");
} }
@ -625,11 +625,12 @@ void RsMessageModel::setQuickViewFilter(QuickViewFilter fn)
{ {
if(fn != mQuickViewFilter) if(fn != mQuickViewFilter)
{ {
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "Changing new quickview filter to " << fn << std::endl; std::cerr << "Changing new quickview filter to " << fn << std::endl;
#endif
preMods();
mQuickViewFilter = fn ; mQuickViewFilter = fn ;
postMods(); updateMessages();
} }
} }
@ -717,8 +718,10 @@ QModelIndex RsMessageModel::getIndexOfMessage(const std::string& mid) const
return createIndex(it->second,0,ref); return createIndex(it->second,0,ref);
} }
#ifdef DEBUG_MESSAGE_MODEL
void RsMessageModel::debug_dump() const void RsMessageModel::debug_dump() const
{ {
for(auto it(mMessages.begin());it!=mMessages.end();++it) for(auto& it : mMessages)
std::cerr << "Id: " << it->msgId << ": from " << it->srcId << ": flags=" << it->msgflags << ": title=\"" << it->title << "\"" << std::endl; std::cerr << "Id: " << it.msgId << ": from " << it.srcId << ": flags=" << it.msgflags << ": title=\"" << it.title << "\"" << std::endl;
} }
#endif

View File

@ -140,11 +140,13 @@ public:
QVariant textColorRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const; QVariant textColorRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant backgroundRole(const Rs::Msgs::MsgInfoSummary& fmpe, int col) const; QVariant backgroundRole(const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
#ifdef DEBUG_MESSAGE_MODEL
/*! /*!
* \brief debug_dump * \brief debug_dump
* Dumps the hierarchy of posts in the terminal, to allow checking whether the internal representation is correct. * Dumps the hierarchy of posts in the terminal, to allow checking whether the internal representation is correct.
*/ */
void debug_dump() const; void debug_dump() const;
#endif
// control over message flags and so on. This is handled by the model because it will allow it to update accordingly // control over message flags and so on. This is handled by the model because it will allow it to update accordingly
void setMsgReadStatus(const QModelIndex& i, bool read_status); void setMsgReadStatus(const QModelIndex& i, bool read_status);