mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 23:25:32 -04:00
Fix GXS (Forum/Channel/Boards) RSLink
Have to add ID: tag in Board Filter due to range view.
This commit is contained in:
parent
af27ff5e4f
commit
68e027b227
8 changed files with 138 additions and 106 deletions
|
@ -62,6 +62,8 @@
|
|||
* #define DEBUG_POSTED
|
||||
***/
|
||||
|
||||
static const int POSTED_TABS_POSTS = 1;
|
||||
|
||||
/* View mode */
|
||||
#define VIEW_MODE_FEEDS 1
|
||||
#define VIEW_MODE_FILES 2
|
||||
|
@ -507,7 +509,7 @@ void PostedListWidgetWithModel::showPostDetails()
|
|||
{
|
||||
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
|
||||
RsPostedPost post = index.data(Qt::UserRole).value<RsPostedPost>() ;
|
||||
|
||||
|
||||
QTextDocument doc;
|
||||
doc.setHtml(post.mMsg.c_str());
|
||||
|
||||
|
@ -529,8 +531,8 @@ void PostedListWidgetWithModel::showPostDetails()
|
|||
if(index.row()==0 && index.column()==0)
|
||||
std::cerr << "here" << std::endl;
|
||||
|
||||
std::cerr << "showPostDetails: setting mSelectedPost to current post Id " << post.mMeta.mMsgId << ". Previous value: " << mSelectedPost << std::endl;
|
||||
mSelectedPost = post.mMeta.mMsgId;
|
||||
std::cerr << "showPostDetails: setting mLastSelectedPosts[groupId()] to current post Id " << post.mMeta.mMsgId << ". Previous value: " << mLastSelectedPosts[groupId()] << std::endl;
|
||||
mLastSelectedPosts[groupId()] = post.mMeta.mMsgId;
|
||||
|
||||
std::list<ChannelPostFileInfo> files;
|
||||
for(auto& file:post.mFiles)
|
||||
|
@ -625,24 +627,30 @@ void PostedListWidgetWithModel::updateGroupData()
|
|||
|
||||
void PostedListWidgetWithModel::postPostLoad()
|
||||
{
|
||||
std::cerr << "Post channel load..." << std::endl;
|
||||
std::cerr << "Post channel load..." << std::endl;
|
||||
whileBlocking(ui->filter_LE)->setText(QString()); //Clear it before navigate, as it will update it.
|
||||
|
||||
if(!mSelectedPost.isNull())
|
||||
{
|
||||
QModelIndex index = mPostedPostsModel->getIndexOfMessage(mSelectedPost);
|
||||
if (!mNavigatePendingMsgId.isNull())
|
||||
navigate(mNavigatePendingMsgId);
|
||||
|
||||
std::cerr << "Setting current index to " << index.row() << ","<< index.column() << " for current post "
|
||||
<< mSelectedPost.toStdString() << std::endl;
|
||||
#ifdef TO_REMOVE
|
||||
else if( (mLastSelectedPosts.count(groupId()) > 0)
|
||||
&& !mLastSelectedPosts[groupId()].isNull())
|
||||
{
|
||||
QModelIndex index = mPostedPostsModel->getIndexOfMessage(mLastSelectedPosts[groupId()]);
|
||||
|
||||
std::cerr << "Setting current index to " << index.row() << ","<< index.column() << " for current post "
|
||||
<< mLastSelectedPosts[groupId()].toStdString() << std::endl;
|
||||
|
||||
ui->postsTree->selectionModel()->setCurrentIndex(index,QItemSelectionModel::ClearAndSelect);
|
||||
ui->postsTree->scrollTo(index);//May change if model reloaded
|
||||
ui->postsTree->setFocus();
|
||||
}
|
||||
else
|
||||
std::cerr << "No pre-selected channel post." << std::endl;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
std::cerr << "No pre-selected channel post." << std::endl;
|
||||
|
||||
whileBlocking(ui->showLabel)->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+POSTS_CHUNK_SIZE+1)));
|
||||
whileBlocking(ui->filter_LE)->setText(QString());
|
||||
whileBlocking(ui->showLabel)->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+POSTS_CHUNK_SIZE+1)));
|
||||
}
|
||||
|
||||
void PostedListWidgetWithModel::forceRedraw()
|
||||
|
@ -721,7 +729,7 @@ QString PostedListWidgetWithModel::groupName(bool)
|
|||
return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
|
||||
}
|
||||
|
||||
void PostedListWidgetWithModel::groupNameChanged(const QString &name)
|
||||
void PostedListWidgetWithModel::groupNameChanged(const QString &/*name*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -737,12 +745,12 @@ QIcon PostedListWidgetWithModel::groupIcon()
|
|||
return QIcon(postedImage);
|
||||
}
|
||||
|
||||
void PostedListWidgetWithModel::setAllMessagesReadDo(bool read, uint32_t &token)
|
||||
void PostedListWidgetWithModel::setAllMessagesReadDo(bool read, uint32_t &/*token*/)
|
||||
{
|
||||
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags))
|
||||
return;
|
||||
|
||||
QModelIndex src_index;
|
||||
//QModelIndex src_index;
|
||||
|
||||
mPostedPostsModel->setAllMsgReadStatus(read);
|
||||
|
||||
|
@ -1126,20 +1134,24 @@ void PostedListWidgetWithModel::blank()
|
|||
|
||||
bool PostedListWidgetWithModel::navigate(const RsGxsMessageId& msgId)
|
||||
{
|
||||
ui->filter_LE->setText("ID:" + QString::fromStdString(msgId.toStdString()));
|
||||
|
||||
QModelIndex index = mPostedPostsModel->getIndexOfMessage(msgId);
|
||||
|
||||
if(!index.isValid())
|
||||
{
|
||||
std::cerr << "(EE) Cannot navigate to msg " << msgId << " in board " << mGroup.mMeta.mGroupId << ": index unknown. Setting mNavigatePendingMsgId." << std::endl;
|
||||
if(!index.isValid())
|
||||
{
|
||||
std::cerr << "(EE) Cannot navigate to msg " << msgId << " in board " << mGroup.mMeta.mGroupId << ": index unknown. Setting mNavigatePendingMsgId." << std::endl;
|
||||
|
||||
mSelectedPost = msgId; // not found. That means the forum may not be loaded yet. So we keep that post in mind, for after loading.
|
||||
return true; // we have to return true here, otherwise the caller will intepret the async loading as an error.
|
||||
}
|
||||
mNavigatePendingMsgId = msgId; // not found. That means the forum may not be loaded yet. So we keep that post in mind, for after loading.
|
||||
return true; // we have to return true here, otherwise the caller will intepret the async loading as an error.
|
||||
}
|
||||
|
||||
ui->postsTree->selectionModel()->setCurrentIndex(index,QItemSelectionModel::ClearAndSelect);
|
||||
ui->postsTree->scrollTo(index);//May change if model reloaded
|
||||
ui->postsTree->setFocus();
|
||||
|
||||
ui->tabWidget->setCurrentIndex(POSTED_TABS_POSTS);
|
||||
|
||||
mNavigatePendingMsgId.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue