diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp index ce22fa7f3..c1e0ce5ad 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp @@ -28,6 +28,7 @@ #include "ui_PostedCreatePostDialog.h" #include "util/misc.h" +#include "util/qtthreadsutils.h" #include "util/RichTextEdit.h" #include "gui/feeds/SubFileItem.h" #include "util/rsdir.h" @@ -178,10 +179,20 @@ void PostedCreatePostDialog::createPost() return; } - uint32_t token; - mPosted->createPost(token, post); + RsThread::async([this,post]() + { + RsGxsMessageId post_id; - accept(); + bool res = rsPosted->createPost(post,post_id); + + RsQThreadUtils::postToObject( [res,this]() + { + if(!res) + QMessageBox::information(nullptr,tr("Error while creating post"),tr("An error occurred while creating the post.")); + + accept(); + }, this ); + }); } void PostedCreatePostDialog::fileHashingFinished(QList hashedFiles) diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp index 33a9c5854..6d41767d2 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedDialog.cpp @@ -217,34 +217,6 @@ QWidget *PostedDialog::createCommentHeaderWidget(const RsGxsGroupId &grpId, cons return new PostedItem(NULL, 0, grpId, msgId, true, false); } -#ifdef TO_REMOVE -void PostedDialog::loadGroupSummaryToken(const uint32_t &token, std::list &groupInfo, RsUserdata *&userdata) -{ - std::vector groups; - rsPosted->getGroupData(token, groups); - - /* Save groups to fill description */ - PostedGroupInfoData *postedData = new PostedGroupInfoData; - userdata = postedData; - - std::vector::iterator groupIt; - for (groupIt = groups.begin(); groupIt != groups.end(); ++groupIt) { - RsPostedGroup &group = *groupIt; - groupInfo.push_back(group.mMeta); - - if (group.mGroupImage.mData != NULL) { - QPixmap image; - GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, image,GxsIdDetails::ORIGINAL); - postedData->mIcon[group.mMeta.mGroupId] = image; - } - - if (!group.mDescription.empty()) { - postedData->mDescription[group.mMeta.mGroupId] = QString::fromUtf8(group.mDescription.c_str()); - } - } -} -#endif - void PostedDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo) { GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo); diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index d9242c571..dcb5c2c97 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -279,16 +279,20 @@ void BasePostedItem::loadComments() } void BasePostedItem::readToggled(bool checked) { - if (mInFill) { - return; - } + if (mInFill) { + return; + } - RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId()); + RsThread::async([this,checked]() + { + RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId()); + rsPosted->setPostReadStatus(msgPair, !checked); - uint32_t token; - rsPosted->setMessageReadStatus(token, msgPair, !checked); - - setReadStatus(false, checked); + RsQThreadUtils::postToObject( [checked,this]() + { + setReadStatus(false, checked); + }, this ); + }); } void BasePostedItem::readAndClearItem()