mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed navigate to forum and channel group when clicking a forum/channel link.
Navigate to post/message is still a todo. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7638 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
929599ad7f
commit
392159ae4b
@ -37,6 +37,7 @@
|
||||
#include "RetroShareLink.h"
|
||||
#include "MainWindow.h"
|
||||
#include "gui/gxsforums/GxsForumsDialog.h"
|
||||
#include "gui/gxschannels/GxsChannelDialog.h"
|
||||
#include "SearchDialog.h"
|
||||
#include "msgs/MessageComposer.h"
|
||||
#include "util/misc.h"
|
||||
@ -1205,14 +1206,13 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
std::cerr << " RetroShareLink::process ForumRequest : name : " << link.name().toStdString() << ". id : " << link.hash().toStdString() << ". msgId : " << link.msgId().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
MainWindow::showWindow(MainWindow::Forums);
|
||||
GxsForumsDialog *forumsDialog = dynamic_cast<GxsForumsDialog*>(MainWindow::getPage(MainWindow::Forums));
|
||||
MainWindow::showWindow(MainWindow::Forums);
|
||||
GxsForumsDialog *forumsDialog = dynamic_cast<GxsForumsDialog*>(MainWindow::getPage(MainWindow::Forums));
|
||||
if (!forumsDialog) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (forumsDialog->navigate(RsGxsGroupId(link.id().toStdString()), RsGxsMessageId(link.msgId().toStdString()))) {
|
||||
if (forumsDialog->navigate(RsGxsGroupId(link.id().toStdString()), RsGxsMessageId(link.msgId().toStdString()))) {
|
||||
if (link.msgId().isEmpty()) {
|
||||
forumFound.append(link.name());
|
||||
} else {
|
||||
@ -1227,38 +1227,19 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case TYPE_CHANNEL:
|
||||
{
|
||||
#ifdef DEBUG_RSLINK
|
||||
std::cerr << " RetroShareLink::process ChannelRequest : name : " << link.name().toStdString() << ". id : " << link.hash().toStdString() << ". msgId : " << link.msgId().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
ChannelInfo ci;
|
||||
if (!rsChannels->getChannelInfo(link.id().toStdString(), ci)) {
|
||||
if (link.msgId().isEmpty()) {
|
||||
channelUnknown.append(link.name());
|
||||
} else {
|
||||
channelMsgUnknown.append(link.name());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ChannelMsgInfo msg;
|
||||
if (!link.msgId().isEmpty()) {
|
||||
if (!rsChannels->getChannelMessage(ci.channelId, link.msgId().toStdString(), msg)) {
|
||||
channelMsgUnknown.append(link.name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::showWindow(MainWindow::Channels);
|
||||
ChannelFeed *channelFeed = dynamic_cast<ChannelFeed*>(MainWindow::getPage(MainWindow::Channels));
|
||||
if (!channelFeed) {
|
||||
GxsChannelDialog *channelDialog = dynamic_cast<GxsChannelDialog*>(MainWindow::getPage(MainWindow::Channels));
|
||||
if (!channelDialog) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (channelFeed->navigate(ci.channelId, msg.msgId)) {
|
||||
if (channelDialog->navigate(RsGxsGroupId(link.id().toStdString()), RsGxsMessageId(link.msgId().toStdString()))) {
|
||||
if (link.msgId().isEmpty()) {
|
||||
channelFound.append(link.name());
|
||||
} else {
|
||||
@ -1273,7 +1254,6 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case TYPE_SEARCH:
|
||||
{
|
||||
|
@ -471,23 +471,36 @@ void GxsGroupFrameDialog::loadComment(const RsGxsGroupId &grpId, const RsGxsMess
|
||||
ui->messageTabWidget->setCurrentWidget(commentDialog);
|
||||
}
|
||||
|
||||
bool GxsGroupFrameDialog::navigate(const RsGxsGroupId groupId, const RsGxsMessageId& msgId)
|
||||
bool GxsGroupFrameDialog::navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId)
|
||||
{
|
||||
if (groupId.isNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui->groupTreeWidget->activateId(QString::fromStdString(groupId.toStdString()), msgId.isNull()) == NULL) {
|
||||
return false;
|
||||
}
|
||||
// if (mGroupId == groupId) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (msgId.isNull()) {
|
||||
// return true;
|
||||
// }
|
||||
if (mStateHelper->isLoading(TOKEN_TYPE_GROUP_SUMMARY)) {
|
||||
mNavigatePendingGroupId = groupId;
|
||||
mNavigatePendingMsgId = msgId;
|
||||
|
||||
/* No information if group is available */
|
||||
return true;
|
||||
}
|
||||
|
||||
QString groupIdString = QString::fromStdString(groupId.toStdString());
|
||||
if (ui->groupTreeWidget->activateId(groupIdString, msgId.isNull()) == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
changedGroup(groupIdString);
|
||||
|
||||
/* search exisiting tab */
|
||||
GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, false);
|
||||
if (!msgWidget) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (msgId.isNull()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//#TODO
|
||||
// if (mThreadLoading) {
|
||||
@ -508,7 +521,7 @@ bool GxsGroupFrameDialog::navigate(const RsGxsGroupId groupId, const RsGxsMessag
|
||||
// }
|
||||
// }
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
GxsMessageFrameWidget *GxsGroupFrameDialog::messageWidget(const RsGxsGroupId &groupId, bool ownTab)
|
||||
@ -820,6 +833,14 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
|
||||
if (userdata) {
|
||||
delete(userdata);
|
||||
}
|
||||
|
||||
if (!mNavigatePendingGroupId.isNull()) {
|
||||
/* Navigate pending */
|
||||
navigate(mNavigatePendingGroupId, mNavigatePendingMsgId);
|
||||
|
||||
mNavigatePendingGroupId.clear();
|
||||
mNavigatePendingMsgId.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent = 0);
|
||||
virtual ~GxsGroupFrameDialog();
|
||||
|
||||
bool navigate(const RsGxsGroupId groupId, const RsGxsMessageId& msgId);
|
||||
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId);
|
||||
|
||||
// Callback for all Loads.
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
@ -186,6 +186,9 @@ private:
|
||||
QTreeWidgetItem *mPopularGroups;
|
||||
QTreeWidgetItem *mOtherGroups;
|
||||
|
||||
RsGxsGroupId mNavigatePendingGroupId;
|
||||
RsGxsMessageId mNavigatePendingMsgId;
|
||||
|
||||
UIStateHelper *mStateHelper;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
|
Loading…
Reference in New Issue
Block a user