mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
fixed update of Forum msg creation window
This commit is contained in:
parent
bbe2fdc5df
commit
43fb720a98
@ -191,6 +191,28 @@ void CreateGxsForumMsg::newMsg()
|
|||||||
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, true);
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, true);
|
||||||
|
|
||||||
|
if (mParentId.isNull())
|
||||||
|
{
|
||||||
|
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, false);
|
||||||
|
mParentMsgLoaded = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, true);
|
||||||
|
mParentMsgLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mOrigMsgId.isNull())
|
||||||
|
{
|
||||||
|
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, false);
|
||||||
|
mOrigMsgLoaded = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_ORIGMSG, true);
|
||||||
|
mOrigMsgLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
RsThread::async( [this]()
|
RsThread::async( [this]()
|
||||||
{
|
{
|
||||||
// We only need group Meta information, but forums do not provide it currently
|
// We only need group Meta information, but forums do not provide it currently
|
||||||
@ -198,163 +220,84 @@ void CreateGxsForumMsg::newMsg()
|
|||||||
std::vector<RsGxsForumGroup> forums_info;
|
std::vector<RsGxsForumGroup> forums_info;
|
||||||
rsGxsForums->getForumsInfo(std::list<RsGxsGroupId>{ mForumId },forums_info);
|
rsGxsForums->getForumsInfo(std::list<RsGxsGroupId>{ mForumId },forums_info);
|
||||||
|
|
||||||
|
// Load parent message
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [this,forums_info]()
|
RsGxsForumMsg parent_msg;
|
||||||
|
|
||||||
|
if(!mParentId.isNull())
|
||||||
|
{
|
||||||
|
std::vector<RsGxsForumMsg> parent_msgs;
|
||||||
|
rsGxsForums->getForumContent(mForumId,std::set<RsGxsMessageId>{ mParentId },parent_msgs);
|
||||||
|
|
||||||
|
if(parent_msgs.size() == 1)
|
||||||
|
parent_msg = *parent_msgs.begin();
|
||||||
|
else
|
||||||
|
RsErr() << "Cannot get parent message " << mParentId << " from forum." ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load original message (edit mode)
|
||||||
|
|
||||||
|
RsGxsForumMsg orig_msg;
|
||||||
|
|
||||||
|
if(!mOrigMsgId.isNull())
|
||||||
|
{
|
||||||
|
std::vector<RsGxsForumMsg> orig_msgs;
|
||||||
|
rsGxsForums->getForumContent(mForumId,std::set<RsGxsMessageId>{ mOrigMsgId },orig_msgs);
|
||||||
|
|
||||||
|
if(orig_msgs.size() == 1)
|
||||||
|
orig_msg = *orig_msgs.begin();
|
||||||
|
else
|
||||||
|
RsErr() << "Cannot get orig message " << mOrigMsgId << " from forum." ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now update GUI with all that nice data
|
||||||
|
|
||||||
|
RsQThreadUtils::postToObject( [this,forums_info,parent_msg,orig_msg]()
|
||||||
{
|
{
|
||||||
if(forums_info.size() != 1)
|
if(forums_info.size() != 1)
|
||||||
{
|
{
|
||||||
RsErr() << "Cannot retrieve group information for forum " << mForumId ;
|
RsErr() << "Cannot retrieve group information for forum " << mForumId ;
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto fg(forums_info.front());
|
auto fg(forums_info.front());
|
||||||
|
|
||||||
const RsGroupMetaData& fi(fg.mMeta);
|
|
||||||
mForumMetaLoaded = true;
|
mForumMetaLoaded = true;
|
||||||
mForumMeta = fi;
|
mForumMeta = fg.mMeta;
|
||||||
|
|
||||||
if(!fi.mCircleId.isNull())
|
if(!parent_msg.mMsg.empty())
|
||||||
loadCircleInfo(RsGxsGroupId(fi.mCircleId));
|
|
||||||
|
|
||||||
loadFormInformation();
|
|
||||||
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, false);
|
|
||||||
|
|
||||||
},this);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (mParentId.isNull())
|
|
||||||
{
|
{
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
mParentMsg = parent_msg;
|
||||||
mParentMsgLoaded = true;
|
mParentMsgLoaded = true;
|
||||||
}
|
}
|
||||||
else
|
if(!orig_msg.mMsg.empty())
|
||||||
{
|
{
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, true);
|
mOrigMsg = orig_msg;
|
||||||
|
mOrigMsgLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
RsThread::async( [this]() {
|
if(!mForumMeta.mCircleId.isNull())
|
||||||
|
loadCircleInfo(RsGxsGroupId(mForumMeta.mCircleId));
|
||||||
|
|
||||||
std::vector<RsGxsForumMsg> parent_msgs;
|
// Now update the GUI
|
||||||
rsGxsForums->getForumContent(mForumId,std::set<RsGxsMessageId>{ mParentId },parent_msgs);
|
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [this,parent_msgs]() {
|
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, mParentMsgLoaded);
|
||||||
if(parent_msgs.size() != 1)
|
|
||||||
{
|
|
||||||
RsErr() << "Cannot get parent message from forum." ;
|
|
||||||
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, false);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, false);
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, false);
|
||||||
|
|
||||||
return ;
|
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, mOrigMsgLoaded);
|
||||||
}
|
|
||||||
|
|
||||||
mParentMsg = parent_msgs.front();
|
|
||||||
mParentMsgLoaded = true;
|
|
||||||
|
|
||||||
loadFormInformation();
|
|
||||||
|
|
||||||
},this);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mOrigMsgId.isNull())
|
|
||||||
{
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, true);
|
|
||||||
mOrigMsgLoaded = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_ORIGMSG , true);
|
|
||||||
|
|
||||||
RsThread::async( [this]() {
|
|
||||||
|
|
||||||
std::vector<RsGxsForumMsg> orig_msgs;
|
|
||||||
rsGxsForums->getForumContent(mForumId,std::set<RsGxsMessageId>{ mOrigMsgId },orig_msgs);
|
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [this,orig_msgs]() {
|
|
||||||
if(orig_msgs.size() != 1)
|
|
||||||
{
|
|
||||||
RsErr() << "Cannot get parent message from forum." ;
|
|
||||||
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, false);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_ORIGMSG, false);
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_ORIGMSG, false);
|
||||||
|
|
||||||
return ;
|
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, mForumMetaLoaded);
|
||||||
}
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, false);
|
||||||
|
|
||||||
mOrigMsg = orig_msgs.front();
|
|
||||||
mOrigMsgLoaded = true;
|
|
||||||
|
|
||||||
loadFormInformation();
|
loadFormInformation();
|
||||||
|
|
||||||
},this);
|
},this);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGxsForumMsg::loadFormInformation()
|
void CreateGxsForumMsg::loadFormInformation()
|
||||||
{
|
{
|
||||||
if (!mOrigMsgId.isNull())
|
|
||||||
{
|
|
||||||
if (mOrigMsgLoaded) {
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, true);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_ORIGMSG, false);
|
|
||||||
} else {
|
|
||||||
//std::cerr << "CreateGxsForumMsg::loadMsgInformation() ParentMsg not Loaded Yet";
|
|
||||||
//std::cerr << std::endl;
|
|
||||||
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, false);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, true);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_ORIGMSG, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!mParentId.isNull())
|
|
||||||
{
|
|
||||||
if (mParentMsgLoaded) {
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, false);
|
|
||||||
} else {
|
|
||||||
//std::cerr << "CreateGxsForumMsg::loadMsgInformation() ParentMsg not Loaded Yet";
|
|
||||||
//std::cerr << std::endl;
|
|
||||||
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, false);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mForumMetaLoaded) {
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, true);
|
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_FORUMINFO, false);
|
|
||||||
} else {
|
|
||||||
//std::cerr << "CreateGxsForumMsg::loadMsgInformation() ForumMeta not Loaded Yet";
|
|
||||||
//std::cerr << std::endl;
|
|
||||||
|
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//std::cerr << "CreateGxsForumMsg::loadMsgInformation() Data Available!";
|
|
||||||
//std::cerr << std::endl;
|
|
||||||
|
|
||||||
//std::cerr << "CreateGxsForumMsg::loadMsgInformation() using signFlags=" << std::hex << mForumMeta.mSignFlags << std::dec << std::endl;
|
|
||||||
|
|
||||||
uint32_t fl = IDCHOOSER_ID_REQUIRED ;
|
uint32_t fl = IDCHOOSER_ID_REQUIRED ;
|
||||||
|
|
||||||
if( (mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) || (mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN))
|
if( (mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) || (mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN))
|
||||||
@ -369,9 +312,7 @@ void CreateGxsForumMsg::loadFormInformation()
|
|||||||
QString subj;
|
QString subj;
|
||||||
|
|
||||||
if(!mOrigMsgId.isNull())
|
if(!mOrigMsgId.isNull())
|
||||||
{
|
|
||||||
subj = QString::fromUtf8(mOrigMsg.mMeta.mMsgName.c_str());
|
subj = QString::fromUtf8(mOrigMsg.mMeta.mMsgName.c_str());
|
||||||
}
|
|
||||||
else if (!mParentId.isNull())
|
else if (!mParentId.isNull())
|
||||||
{
|
{
|
||||||
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
|
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
|
||||||
@ -388,6 +329,7 @@ void CreateGxsForumMsg::loadFormInformation()
|
|||||||
|
|
||||||
ui.forumName->setText(misc::removeNewLine(name));
|
ui.forumName->setText(misc::removeNewLine(name));
|
||||||
|
|
||||||
|
std::cerr << "Setting name to \"" << misc::removeNewLine(name).toStdString() << std::endl;
|
||||||
if(!subj.isNull())
|
if(!subj.isNull())
|
||||||
ui.forumSubject->setText(misc::removeNewLine(subj));
|
ui.forumSubject->setText(misc::removeNewLine(subj));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user