mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-10 03:49:51 -05:00
Fix Message Quick View
This commit is contained in:
parent
e0ed60ee6f
commit
7a3370ae0f
@ -373,14 +373,16 @@ 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)
|
||||||
{
|
{
|
||||||
std::cerr << "Setting filter to filter_type=" << int(filter_type) << " and strings to " ;
|
#ifdef DEBUG_MESSAGE_MODEL
|
||||||
foreach(const QString& str,strings)
|
std::cerr << "Setting filter to filter_type=" << int(filter_type) << " and strings to " ;
|
||||||
std::cerr << "\"" << str.toStdString() << "\" " ;
|
foreach(const QString& str,strings)
|
||||||
std::cerr << std::endl;
|
std::cerr << "\"" << str.toStdString() << "\" " ;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
preMods();
|
preMods();
|
||||||
|
|
||||||
mFilterType = filter_type;
|
mFilterType = filter_type;
|
||||||
mFilterStrings = strings;
|
mFilterStrings = strings;
|
||||||
|
|
||||||
postMods();
|
postMods();
|
||||||
@ -388,7 +390,7 @@ void RsMessageModel::setFilter(FilterType filter_type, const QStringList& string
|
|||||||
|
|
||||||
QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
|
QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
|
||||||
{
|
{
|
||||||
if(column == COLUMN_THREAD_AUTHOR)
|
if(column == COLUMN_THREAD_AUTHOR)
|
||||||
{
|
{
|
||||||
QString str,comment ;
|
QString str,comment ;
|
||||||
QList<QIcon> icons;
|
QList<QIcon> icons;
|
||||||
@ -460,45 +462,44 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
|
|||||||
{
|
{
|
||||||
switch(col)
|
switch(col)
|
||||||
{
|
{
|
||||||
case COLUMN_THREAD_SUBJECT: return QVariant(QString::fromUtf8(fmpe.title.c_str()));
|
case COLUMN_THREAD_SUBJECT: return QVariant(QString::fromUtf8(fmpe.title.c_str()));
|
||||||
case COLUMN_THREAD_ATTACHMENT:return QVariant(QString::number(fmpe.count));
|
case COLUMN_THREAD_ATTACHMENT:return QVariant(QString::number(fmpe.count));
|
||||||
|
|
||||||
case COLUMN_THREAD_STAR:
|
case COLUMN_THREAD_STAR:
|
||||||
case COLUMN_THREAD_SPAM:
|
case COLUMN_THREAD_SPAM:
|
||||||
case COLUMN_THREAD_READ:return QVariant();
|
case COLUMN_THREAD_READ:return QVariant();
|
||||||
case COLUMN_THREAD_DATE:{
|
case COLUMN_THREAD_DATE:{
|
||||||
QDateTime qtime;
|
QDateTime qtime;
|
||||||
qtime.setTime_t(fmpe.ts);
|
qtime.setTime_t(fmpe.ts);
|
||||||
|
|
||||||
return QVariant(DateTime::formatDateTime(qtime));
|
return QVariant(DateTime::formatDateTime(qtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
case COLUMN_THREAD_TAGS:{
|
case COLUMN_THREAD_TAGS:{
|
||||||
// Tags
|
// Tags
|
||||||
Rs::Msgs::MsgTagInfo tagInfo;
|
Rs::Msgs::MsgTagInfo tagInfo;
|
||||||
rsMsgs->getMessageTag(fmpe.msgId, tagInfo);
|
rsMsgs->getMessageTag(fmpe.msgId, tagInfo);
|
||||||
|
|
||||||
Rs::Msgs::MsgTagType Tags;
|
Rs::Msgs::MsgTagType Tags;
|
||||||
rsMsgs->getMessageTagTypes(Tags);
|
rsMsgs->getMessageTagTypes(Tags);
|
||||||
|
|
||||||
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())
|
text += ",";
|
||||||
text += ",";
|
|
||||||
|
|
||||||
auto Tag = Tags.types.find(*tagit);
|
auto Tag = Tags.types.find(*tagit);
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
case COLUMN_THREAD_AUTHOR:{
|
case COLUMN_THREAD_AUTHOR:{
|
||||||
QString name;
|
QString name;
|
||||||
RsGxsId id = RsGxsId(fmpe.srcId.toStdString());
|
RsGxsId id = RsGxsId(fmpe.srcId.toStdString());
|
||||||
@ -510,11 +511,10 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
|
|||||||
return QVariant(tr("[Unknown]"));
|
return QVariant(tr("[Unknown]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QVariant("[ TODO ]");
|
return QVariant("[ TODO ]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return QVariant("[ERROR]");
|
return QVariant("[ERROR]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,23 +614,24 @@ void RsMessageModel::setMessages(const std::list<Rs::Msgs::MsgInfoSummary>& msgs
|
|||||||
|
|
||||||
void RsMessageModel::setCurrentBox(BoxName bn)
|
void RsMessageModel::setCurrentBox(BoxName bn)
|
||||||
{
|
{
|
||||||
if(mCurrentBox != bn)
|
if(mCurrentBox != bn)
|
||||||
{
|
{
|
||||||
mCurrentBox = bn;
|
mCurrentBox = bn;
|
||||||
updateMessages();
|
updateMessages();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsMessageModel::setQuickViewFilter(QuickViewFilter fn)
|
void RsMessageModel::setQuickViewFilter(QuickViewFilter fn)
|
||||||
{
|
{
|
||||||
if(fn != mQuickViewFilter)
|
if(fn != mQuickViewFilter)
|
||||||
{
|
{
|
||||||
std::cerr << "Changing new quickview filter to " << fn << std::endl;
|
#ifdef DEBUG_MESSAGE_MODEL
|
||||||
|
std::cerr << "Changing new quickview filter to " << fn << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
preMods();
|
mQuickViewFilter = fn ;
|
||||||
mQuickViewFilter = fn ;
|
updateMessages();
|
||||||
postMods();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsMessageModel::getMessageSummaries(BoxName box,std::list<Rs::Msgs::MsgInfoSummary>& msgs)
|
void RsMessageModel::getMessageSummaries(BoxName box,std::list<Rs::Msgs::MsgInfoSummary>& msgs)
|
||||||
@ -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
|
||||||
|
@ -140,15 +140,17 @@ 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
|
/*!
|
||||||
* Dumps the hierarchy of posts in the terminal, to allow checking whether the internal representation is correct.
|
* \brief debug_dump
|
||||||
*/
|
* 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);
|
||||||
void setMsgStar(const QModelIndex& index,bool star) ;
|
void setMsgStar(const QModelIndex& index,bool star) ;
|
||||||
void setMsgJunk(const QModelIndex& index,bool junk) ;
|
void setMsgJunk(const QModelIndex& index,bool junk) ;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user