Fixed navigate to channel post when clicking a channel post link.

Fixed navigate to forum message when clicking a forum message link.
Fixed copy of forum message link to clipboard

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7640 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-10-25 23:52:33 +00:00
parent 6c2cc75f2b
commit cfd6a7b8b5
15 changed files with 129 additions and 45 deletions

View file

@ -752,6 +752,11 @@ void GxsForumThreadWidget::fillThreadFinished()
calculateIconsAndFonts();
calculateUnreadCount();
emit groupChanged(this);
if (!mNavigatePendingMsgId.isNull()) {
navigate(mNavigatePendingMsgId);
mNavigatePendingMsgId.clear();
}
}
#ifdef DEBUG_FORUMS
@ -1506,29 +1511,45 @@ void GxsForumThreadWidget::setAllMessagesRead(bool read)
markMsgAsReadUnread(read, true, true);
}
bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
{
if (mStateHelper->isLoading(TOKEN_TYPE_CURRENTFORUM)) {
mNavigatePendingMsgId = msgId;
/* No information if message is available */
return true;
}
QString msgIdString = QString::fromStdString(msgId.toStdString());
/* Search exisiting item */
QTreeWidgetItemIterator itemIterator(ui->threadTreeWidget);
QTreeWidgetItem *item = NULL;
while ((item = *itemIterator) != NULL) {
++itemIterator;
if (item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString() == msgIdString) {
ui->threadTreeWidget->setCurrentItem(item);
ui->threadTreeWidget->setFocus();
return true;
}
}
return false;
}
void GxsForumThreadWidget::copyMessageLink()
{
if (mForumId.isNull() || mThreadId.isNull()) {
return;
}
// THIS CODE CALLS getForumInfo() to verify that the Ids are valid.
// As we are switching to Request/Response this is now harder to do...
// So not bothering any more - shouldn't be necessary.
// IF we get errors - fix them, rather than patching here.
#if 0
ForumInfo fi;
if (rsGxsForums->getForumInfo(mForumId, fi)) {
RetroShareLink link;
if (link.createForum(mForumId, mThreadId)) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
RetroShareLink link;
if (link.createGxsMessageLink(RetroShareLink::TYPE_FORUM, mForumId, mThreadId, ui->threadTitle->text())) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
#endif
QMessageBox::warning(this, "RetroShare", "ToDo");
}
void GxsForumThreadWidget::subscribeGroup(bool subscribe)
@ -1704,6 +1725,8 @@ void GxsForumThreadWidget::requestGroup_CurrentForum()
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, true);
emit groupChanged(this);
mNavigatePendingMsgId.clear();
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;