mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-29 01:08:50 -04:00
Merge pull request #1826 from csoler/v0.6-FT4
attempt to solve GXS data access problems in new blocking API
This commit is contained in:
commit
4c4b7ce754
16 changed files with 73 additions and 50 deletions
|
@ -59,6 +59,8 @@
|
|||
* #define ID_DEBUG 1
|
||||
*****/
|
||||
|
||||
#define QT_BUG_CRASH_IN_TAKECHILD_WORKAROUND 1
|
||||
|
||||
// Data Requests.
|
||||
#define IDDIALOG_IDLIST 1
|
||||
#define IDDIALOG_IDDETAILS 2
|
||||
|
@ -586,6 +588,17 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
|||
|
||||
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true);
|
||||
|
||||
#ifdef QT_BUG_CRASH_IN_TAKECHILD_WORKAROUND
|
||||
// These 3 lines are normally not needed. But apparently a bug (in Qt ??) causes Qt to crash when takeChild() is called. If we remove everything from the
|
||||
// tree widget before updating it, takeChild() is never called, but the all tree is filled again from scratch. This is less efficient obviously, and
|
||||
// also collapses the tree. Because it is a *temporary* fix, I dont take the effort to save open/collapsed items yet. If we cannot find a proper way to fix
|
||||
// this, then we'll need to implement the two missing functions to save open/collapsed items.
|
||||
|
||||
ui->treeWidget_membership->clear();
|
||||
mExternalOtherCircleItem = NULL ;
|
||||
mExternalBelongingCircleItem = NULL ;
|
||||
#endif
|
||||
|
||||
/* add the top level item */
|
||||
//QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem();
|
||||
//personalCirclesItem->setText(0, tr("Personal Circles"));
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "ui_PostedCreatePostDialog.h"
|
||||
|
||||
#include "util/misc.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include "util/RichTextEdit.h"
|
||||
#include "gui/feeds/SubFileItem.h"
|
||||
#include "util/rsdir.h"
|
||||
|
@ -45,9 +44,9 @@
|
|||
#define VIEW_IMAGE 2
|
||||
#define VIEW_LINK 3
|
||||
|
||||
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
|
||||
PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
|
||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
|
||||
mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId),
|
||||
mPosted(posted), mGrpId(grpId),
|
||||
ui(new Ui::PostedCreatePostDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -176,7 +175,6 @@ void PostedCreatePostDialog::createPost()
|
|||
|
||||
uint32_t token;
|
||||
mPosted->createPost(token, post);
|
||||
// mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST);
|
||||
|
||||
accept();
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include "retroshare/rsposted.h"
|
||||
#include "util/RichTextEdit.h"
|
||||
|
||||
class TokenQueue;
|
||||
|
||||
namespace Ui {
|
||||
class PostedCreatePostDialog;
|
||||
}
|
||||
|
@ -41,7 +39,7 @@ public:
|
|||
* @param tokenQ parent callee token
|
||||
* @param posted
|
||||
*/
|
||||
explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
|
||||
explicit PostedCreatePostDialog(RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
|
||||
~PostedCreatePostDialog();
|
||||
|
||||
private:
|
||||
|
@ -62,7 +60,6 @@ private:
|
|||
|
||||
QString mLink;
|
||||
QString mNotes;
|
||||
TokenQueue* mTokenQueue;
|
||||
RsPosted* mPosted;
|
||||
RsGxsGroupId mGrpId;
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ void PostedListWidget::newPost()
|
|||
return;
|
||||
}
|
||||
|
||||
PostedCreatePostDialog *cp = new PostedCreatePostDialog(mTokenQueue, rsPosted, groupId(), this);
|
||||
PostedCreatePostDialog *cp = new PostedCreatePostDialog(rsPosted, groupId(), this);
|
||||
cp->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
|
|
|
@ -307,7 +307,7 @@ void GxsCommentTreeWidget::banUser()
|
|||
|
||||
void GxsCommentTreeWidget::makeComment()
|
||||
{
|
||||
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, this);
|
||||
GxsCreateCommentDialog pcc(mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, this);
|
||||
pcc.exec();
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ void GxsCommentTreeWidget::replyToComment()
|
|||
RsGxsGrpMsgIdPair msgId;
|
||||
msgId.first = mGroupId;
|
||||
msgId.second = mCurrentCommentMsgId;
|
||||
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, msgId, mLatestMsgId, this);
|
||||
GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, this);
|
||||
|
||||
pcc.loadComment(mCurrentCommentText, mCurrentCommentAuthor, mCurrentCommentAuthorId);
|
||||
pcc.exec();
|
||||
|
|
|
@ -26,20 +26,16 @@
|
|||
#include <QMessageBox>
|
||||
#include <iostream>
|
||||
|
||||
GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentService *service,
|
||||
const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
|
||||
GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::GxsCreateCommentDialog), mTokenQueue(tokQ), mCommentService(service), mParentId(parentId), mThreadId(threadId)
|
||||
ui(new Ui::GxsCreateCommentDialog), mCommentService(service), mParentId(parentId), mThreadId(threadId)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
|
||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GxsCreateCommentDialog::loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId)
|
||||
|
@ -80,9 +76,9 @@ void GxsCreateCommentDialog::createComment()
|
|||
std::cerr << "ThreadId : " << comment.mMeta.mThreadId << std::endl;
|
||||
std::cerr << "ParentId : " << comment.mMeta.mParentId << std::endl;
|
||||
|
||||
|
||||
RsGxsId authorId;
|
||||
switch (ui->idChooser->getChosenId(authorId)) {
|
||||
switch (ui->idChooser->getChosenId(authorId))
|
||||
{
|
||||
case GxsIdChooser::KnowId:
|
||||
case GxsIdChooser::UnKnowId:
|
||||
comment.mMeta.mAuthorId = authorId;
|
||||
|
@ -96,17 +92,12 @@ void GxsCreateCommentDialog::createComment()
|
|||
std::cerr << "GxsCreateCommentDialog::createComment() ERROR GETTING AuthorId!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
int ret = QMessageBox::information(this, tr("Comment Signing Error"),
|
||||
tr("You need to create an Identity\n"
|
||||
"before you can comment"),
|
||||
QMessageBox::Ok);
|
||||
Q_UNUSED(ret)
|
||||
QMessageBox::information(this, tr("Comment Signing Error"), tr("You need to create an Identity\n" "before you can comment"), QMessageBox::Ok);
|
||||
return;
|
||||
}//switch (ui->idChooser->getChosenId(authorId))
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
mCommentService->createNewComment(token, comment);
|
||||
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||
mCommentService->createComment(comment);
|
||||
close();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ class GxsCreateCommentDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GxsCreateCommentDialog(TokenQueue* tokQ, RsGxsCommentService *service,
|
||||
const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0);
|
||||
explicit GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0);
|
||||
~GxsCreateCommentDialog();
|
||||
|
||||
void loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId);
|
||||
|
@ -47,7 +46,6 @@ private slots:
|
|||
|
||||
private:
|
||||
Ui::GxsCreateCommentDialog *ui;
|
||||
TokenQueue *mTokenQueue;
|
||||
RsGxsCommentService *mCommentService;
|
||||
|
||||
RsGxsGrpMsgIdPair mParentId;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue