mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
gxsforums: add expand subtree button to context menu
This commit is contained in:
parent
e7b09ba8dd
commit
958d13951c
@ -596,6 +596,11 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||
QAction* expandAll = new QAction(tr("Expand all"), &contextMnu);
|
||||
connect(expandAll, SIGNAL(triggered()), ui->threadTreeWidget, SLOT(expandAll()));
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
QAction* expandSubtree = new QAction(tr("Expand subtree"), &contextMnu);
|
||||
connect(expandSubtree, SIGNAL(triggered()), this, SLOT(expandSubtree()));
|
||||
#endif
|
||||
|
||||
QAction* collapseAll = new QAction(tr( "Collapse all"), &contextMnu);
|
||||
connect(collapseAll, SIGNAL(triggered()), ui->threadTreeWidget, SLOT(collapseAll()));
|
||||
|
||||
@ -630,6 +635,10 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||
markMsgAsUnreadChildren->setDisabled(true);
|
||||
replyAct->setDisabled (true);
|
||||
replyauthorAct->setDisabled (true);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
expandSubtree->setDisabled(true);
|
||||
expandSubtree->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(has_current_post)
|
||||
@ -673,6 +682,9 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||
contextMnu.addAction(markMsgAsUnreadChildren);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction(expandAll);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
contextMnu.addAction(expandSubtree);
|
||||
#endif
|
||||
contextMnu.addAction(collapseAll);
|
||||
|
||||
if(has_current_post)
|
||||
@ -1325,6 +1337,20 @@ void GxsForumThreadWidget::setAllMessagesReadDo(bool read, uint32_t &/*token*/)
|
||||
markMsgAsReadUnread(read, true, true);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
void GxsForumThreadWidget::expandSubtree() {
|
||||
QAction* the_action = qobject_cast<QAction*>(sender());
|
||||
if (!the_action) {
|
||||
return;
|
||||
}
|
||||
const QModelIndex current_index = ui->threadTreeWidget->currentIndex();
|
||||
if (!current_index.isValid()) {
|
||||
return;
|
||||
}
|
||||
ui->threadTreeWidget->expandRecursively(current_index);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
|
||||
{
|
||||
QModelIndex source_index = mThreadModel->getIndexOfMessage(msgId);
|
||||
|
@ -144,6 +144,10 @@ private slots:
|
||||
|
||||
void filterColumnChanged(int column);
|
||||
void filterItems(const QString &text);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
void expandSubtree();
|
||||
#endif
|
||||
private:
|
||||
void insertMessageData(const RsGxsForumMsg &msg);
|
||||
bool getCurrentPost(ForumModelPostEntry& fmpe) const ;
|
||||
|
Loading…
Reference in New Issue
Block a user