mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 08:59:37 -05:00
Fix Forum Post Un/Read Column click when not selected.
This commit is contained in:
parent
67d1265eb2
commit
12650dfddf
@ -338,6 +338,7 @@ QVariant RsGxsForumModel::headerData(int section, Qt::Orientation /*orientation*
|
|||||||
switch(section)
|
switch(section)
|
||||||
{
|
{
|
||||||
case COLUMN_THREAD_TITLE: return tr("Title");
|
case COLUMN_THREAD_TITLE: return tr("Title");
|
||||||
|
case COLUMN_THREAD_READ: return tr("UnRead");
|
||||||
case COLUMN_THREAD_DATE: return tr("Date");
|
case COLUMN_THREAD_DATE: return tr("Date");
|
||||||
case COLUMN_THREAD_AUTHOR: return tr("Author");
|
case COLUMN_THREAD_AUTHOR: return tr("Author");
|
||||||
default:
|
default:
|
||||||
@ -347,9 +348,8 @@ QVariant RsGxsForumModel::headerData(int section, Qt::Orientation /*orientation*
|
|||||||
if(role == Qt::DecorationRole)
|
if(role == Qt::DecorationRole)
|
||||||
switch(section)
|
switch(section)
|
||||||
{
|
{
|
||||||
case COLUMN_THREAD_DISTRIBUTION: return FilesDefs::getIconFromQtResourcePath(":/icons/flag-green.png");
|
case COLUMN_THREAD_DISTRIBUTION: return FilesDefs::getIconFromQtResourcePath(":/icons/flag-green.png");
|
||||||
case COLUMN_THREAD_READ: return FilesDefs::getIconFromQtResourcePath(":/images/message-state-read.png");
|
default:
|
||||||
default:
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -969,12 +969,11 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou
|
|||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "GxsForumsFillThread::run() Collecting post versions" << std::endl;
|
std::cerr << "GxsForumsFillThread::run() Collecting post versions" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
mPostVersions.clear();
|
mPostVersions.clear();
|
||||||
std::list<RsGxsMessageId> msg_stack ;
|
|
||||||
|
|
||||||
for ( auto msgIt = msgs.begin(); msgIt != msgs.end();++msgIt)
|
for ( auto msgIt = msgs.begin(); msgIt != msgs.end();++msgIt)
|
||||||
{
|
{
|
||||||
if(!msgIt->second.mOrigMsgId.isNull() && msgIt->second.mOrigMsgId != msgIt->second.mMsgId)
|
if(!msgIt->second.mOrigMsgId.isNull() && msgIt->second.mOrigMsgId != msgIt->second.mMsgId)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << " Post " << msgIt->second.mMeta.mMsgId << " is a new version of " << msgIt->second.mMeta.mOrigMsgId << std::endl;
|
std::cerr << " Post " << msgIt->second.mMeta.mMsgId << " is a new version of " << msgIt->second.mMeta.mOrigMsgId << std::endl;
|
||||||
@ -1381,8 +1380,8 @@ void RsGxsForumModel::debug_dump()
|
|||||||
<< QString("%1").arg((uint32_t)e.mPostFlags,8,16,QChar('0')).toStdString() << " "
|
<< QString("%1").arg((uint32_t)e.mPostFlags,8,16,QChar('0')).toStdString() << " "
|
||||||
<< QString("%1").arg((uint32_t)e.mMsgStatus,8,16,QChar('0')).toStdString() << " ";
|
<< QString("%1").arg((uint32_t)e.mMsgStatus,8,16,QChar('0')).toStdString() << " ";
|
||||||
|
|
||||||
for(uint32_t i=0;i<e.mChildren.size();++i)
|
for(uint32_t j=0;j<e.mChildren.size();++j)
|
||||||
std::cerr << " " << e.mChildren[i] ;
|
std::cerr << " " << e.mChildren[j] ;
|
||||||
|
|
||||||
QDateTime qtime;
|
QDateTime qtime;
|
||||||
qtime.setTime_t(e.mPublishTs);
|
qtime.setTime_t(e.mPublishTs);
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "util/imageutil.h"
|
#include "util/imageutil.h"
|
||||||
|
|
||||||
#include <retroshare/rsgxsforums.h>
|
#include <retroshare/rsgxsforums.h>
|
||||||
|
#include <retroshare/rsgxscircles.h>
|
||||||
#include <retroshare/rsgrouter.h>
|
#include <retroshare/rsgrouter.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
// These should be in retroshare/ folder.
|
// These should be in retroshare/ folder.
|
||||||
@ -205,7 +206,7 @@ public:
|
|||||||
class ForumPostSortFilterProxyModel: public QSortFilterProxyModel
|
class ForumPostSortFilterProxyModel: public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ForumPostSortFilterProxyModel(const QHeaderView *header,QObject *parent = NULL): QSortFilterProxyModel(parent),m_header(header) {}
|
explicit ForumPostSortFilterProxyModel(const QHeaderView *header,QObject *parent = NULL): QSortFilterProxyModel(parent),m_header(header) {}
|
||||||
|
|
||||||
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override
|
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override
|
||||||
{
|
{
|
||||||
@ -330,7 +331,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
|||||||
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_TITLE, QHeaderView::Interactive);
|
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_TITLE, QHeaderView::Interactive);
|
||||||
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DATE, QHeaderView::Interactive);
|
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DATE, QHeaderView::Interactive);
|
||||||
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_AUTHOR, QHeaderView::Interactive);
|
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_AUTHOR, QHeaderView::Interactive);
|
||||||
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_READ, QHeaderView::Fixed);
|
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_READ, QHeaderView::Interactive);
|
||||||
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, QHeaderView::Fixed);
|
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, QHeaderView::Fixed);
|
||||||
|
|
||||||
ttheader->setCascadingSectionResizes(true);
|
ttheader->setCascadingSectionResizes(true);
|
||||||
@ -468,12 +469,13 @@ void GxsForumThreadWidget::processSettings(bool load)
|
|||||||
|
|
||||||
void GxsForumThreadWidget::changedSelection(const QModelIndex& current,const QModelIndex& last)
|
void GxsForumThreadWidget::changedSelection(const QModelIndex& current,const QModelIndex& last)
|
||||||
{
|
{
|
||||||
if (current!=last
|
if (current!=last
|
||||||
&& ( ( last.row()>=0 && last.column()>=0) //Double call when retrieve focus.
|
&& ( ( last.row()>=0 && last.column()>=0) //Double call when retrieve focus.
|
||||||
|| mThreadId.isNull() //For first click
|
|| mThreadId.isNull() //For first click
|
||||||
)
|
)
|
||||||
)
|
&& (current.column() != RsGxsForumModel::COLUMN_THREAD_READ) //clickedThread will changedThread after.
|
||||||
changedThread(current);
|
)
|
||||||
|
changedThread(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::groupIdChanged()
|
void GxsForumThreadWidget::groupIdChanged()
|
||||||
@ -603,8 +605,8 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
|||||||
QAction *editAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MESSAGEEDIT), tr("Edit"), &contextMnu);
|
QAction *editAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MESSAGEEDIT), tr("Edit"), &contextMnu);
|
||||||
connect(editAct, SIGNAL(triggered()), this, SLOT(editforummessage()));
|
connect(editAct, SIGNAL(triggered()), this, SLOT(editforummessage()));
|
||||||
|
|
||||||
bool is_pinned = mForumGroup.mPinnedPosts.ids.find(mThreadId) != mForumGroup.mPinnedPosts.ids.end();
|
bool this_is_pinned = mForumGroup.mPinnedPosts.ids.find(mThreadId) != mForumGroup.mPinnedPosts.ids.end();
|
||||||
QAction *pinUpPostAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PINPOST), (is_pinned?tr("Un-pin this post"):tr("Pin this post up")), &contextMnu);
|
QAction *pinUpPostAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PINPOST), (this_is_pinned?tr("Un-pin this post"):tr("Pin this post up")), &contextMnu);
|
||||||
connect(pinUpPostAct , SIGNAL(triggered()), this, SLOT(togglePinUpPost()));
|
connect(pinUpPostAct , SIGNAL(triggered()), this, SLOT(togglePinUpPost()));
|
||||||
|
|
||||||
QAction *replyAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_REPLY), tr("Reply"), &contextMnu);
|
QAction *replyAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_REPLY), tr("Reply"), &contextMnu);
|
||||||
@ -698,10 +700,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
|||||||
#endif
|
#endif
|
||||||
markMsgAsReadChildren->setVisible(has_children);
|
markMsgAsReadChildren->setVisible(has_children);
|
||||||
markMsgAsUnreadChildren->setVisible(has_children);
|
markMsgAsUnreadChildren->setVisible(has_children);
|
||||||
}
|
|
||||||
|
|
||||||
if(has_current_post)
|
|
||||||
{
|
|
||||||
bool is_pinned = mForumGroup.mPinnedPosts.ids.find( current_post.mMsgId ) != mForumGroup.mPinnedPosts.ids.end();
|
bool is_pinned = mForumGroup.mPinnedPosts.ids.find( current_post.mMsgId ) != mForumGroup.mPinnedPosts.ids.end();
|
||||||
|
|
||||||
if(!is_pinned)
|
if(!is_pinned)
|
||||||
@ -869,7 +868,6 @@ bool GxsForumThreadWidget::eventFilter(QObject *obj, QEvent *event)
|
|||||||
}
|
}
|
||||||
// pass the event on to the parent class
|
// pass the event on to the parent class
|
||||||
return RsGxsUpdateBroadcastWidget::eventFilter(obj, event);
|
return RsGxsUpdateBroadcastWidget::eventFilter(obj, event);
|
||||||
return RsGxsUpdateBroadcastWidget::eventFilter(obj, event);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1058,22 +1056,22 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
|
|||||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
|
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
|
||||||
|
|
||||||
if(group.mMeta.mLastPost==0)
|
if(group.mMeta.mLastPost==0)
|
||||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post")).arg(tr("Never"));
|
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post"),tr("Never"));
|
||||||
else
|
else
|
||||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post")).arg(DateTime::formatLongDateTime(group.mMeta.mLastPost));
|
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post"),DateTime::formatLongDateTime(group.mMeta.mLastPost));
|
||||||
|
|
||||||
if(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
|
if(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
|
||||||
{
|
{
|
||||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization")).arg(getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ;
|
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization"),getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ;
|
||||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage")).arg(getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400));
|
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage"),getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString distrib_string = tr("[unknown]");
|
QString distrib_string = tr("[unknown]");
|
||||||
switch(group.mMeta.mCircleType)
|
switch(static_cast<RsGxsCircleType>(group.mMeta.mCircleType))
|
||||||
{
|
{
|
||||||
case GXS_CIRCLE_TYPE_PUBLIC: distrib_string = tr("Public") ;
|
case RsGxsCircleType::PUBLIC: distrib_string = tr("Public");
|
||||||
break ;
|
break ;
|
||||||
case GXS_CIRCLE_TYPE_EXTERNAL:
|
case RsGxsCircleType::EXTERNAL:
|
||||||
{
|
{
|
||||||
RsGxsCircleDetails det ;
|
RsGxsCircleDetails det ;
|
||||||
|
|
||||||
@ -1085,7 +1083,7 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
|
|||||||
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
|
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
|
case RsGxsCircleType::NODES_GROUP:
|
||||||
{
|
{
|
||||||
distrib_string = tr("Only friends nodes in group ") ;
|
distrib_string = tr("Only friends nodes in group ") ;
|
||||||
|
|
||||||
@ -1098,7 +1096,7 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
|
|||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("Your eyes only"); // this is not yet supported. If you see this, it is a bug!
|
case RsGxsCircleType::LOCAL: distrib_string = tr("Your eyes only"); // this is not yet supported. If you see this, it is a bug!
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl;
|
std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl;
|
||||||
@ -1108,7 +1106,7 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
|
|||||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Owner"), author);
|
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Owner"), author);
|
||||||
|
|
||||||
if(!anti_spam_features1.isNull())
|
if(!anti_spam_features1.isNull())
|
||||||
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam")).arg(anti_spam_features1);
|
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam"),anti_spam_features1);
|
||||||
|
|
||||||
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags));
|
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags));
|
||||||
ui->newthreadButton->setEnabled(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags));
|
ui->newthreadButton->setEnabled(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags));
|
||||||
@ -1579,9 +1577,9 @@ void GxsForumThreadWidget::togglePinUpPost()
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString thread_title = index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_TITLE).data(Qt::DisplayRole).toString();
|
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
|
QString thread_title = index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_TITLE).data(Qt::DisplayRole).toString();
|
||||||
std::cerr << "Toggling Pin-up state of post " << mThreadId.toStdString() << ": \"" << thread_title.toStdString() << "\"" << std::endl;
|
std::cerr << "Toggling Pin-up state of post " << mThreadId.toStdString() << ": \"" << thread_title.toStdString() << "\"" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user