diff --git a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp index 6b2f16a30..4bf36f218 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp @@ -686,8 +686,11 @@ void PostedListWidgetWithModel::openComments(const RsGxsMessageId& msgId) if(!index.isValid()) return; + RsGxsId current_author; + ui->idChooser->getChosenId(current_author); + RsPostedPost post = index.data(Qt::UserRole).value() ; - auto *commentDialog = new GxsCommentDialog(this,rsPosted->getTokenService(),rsPosted); + auto *commentDialog = new GxsCommentDialog(this,current_author,rsPosted->getTokenService(),rsPosted); std::set msg_versions({post.mMeta.mMsgId}); commentDialog->commentLoad(post.mMeta.mGroupId, msg_versions, post.mMeta.mMsgId); diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp index c1590fba4..b80539cea 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp @@ -60,7 +60,7 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const std::set< comments += "..."; } - GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService()); + GxsCommentDialog *commentDialog = new GxsCommentDialog(this, RsGxsId(),getTokenService(), getCommentService()); QWidget *commentHeader = createHeaderWidget(grpId, msgId); commentDialog->setCommentHeader(commentHeader); diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp index 7797b39f1..23fc18654 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp @@ -30,24 +30,24 @@ #include /** Constructor */ -GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service) +GxsCommentDialog::GxsCommentDialog(QWidget *parent, const RsGxsId &default_author, RsTokenService *token_service, RsGxsCommentService *comment_service) : QWidget(parent), ui(new Ui::GxsCommentDialog) { /* Invoke the Qt Designer generated QObject setup routine */ ui->setupUi(this); setTokenService(token_service,comment_service); - init(); + init(default_author); } -void GxsCommentDialog::init() +void GxsCommentDialog::init(const RsGxsId& default_author) { /* Set header resize modes and initial section sizes */ QHeaderView * ttheader = ui->treeWidget->header () ; ttheader->resizeSection (0, 440); /* fill in the available OwnIds for signing */ - ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId()); + ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, default_author); connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); connect(ui->idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int ))); @@ -70,13 +70,13 @@ void GxsCommentDialog::setTokenService(RsTokenService *token_service, RsGxsComme ui->treeWidget->setup(token_service, comment_service); } -GxsCommentDialog::GxsCommentDialog(QWidget *parent) +GxsCommentDialog::GxsCommentDialog(QWidget *parent,const RsGxsId &default_author) : QWidget(parent), ui(new Ui::GxsCommentDialog) { /* Invoke the Qt Designer generated QObject setup routine */ ui->setupUi(this); - init(); + init(default_author); } GxsCommentDialog::~GxsCommentDialog() diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.h b/retroshare-gui/src/gui/gxs/GxsCommentDialog.h index b07568eda..80a58ff47 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.h @@ -32,8 +32,8 @@ class GxsCommentDialog: public QWidget Q_OBJECT public: - GxsCommentDialog(QWidget *parent); - GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service); + GxsCommentDialog(QWidget *parent=nullptr,const RsGxsId& default_author=RsGxsId()); + GxsCommentDialog(QWidget *parent,const RsGxsId& default_author, RsTokenService *token_service, RsGxsCommentService *comment_service); virtual ~GxsCommentDialog(); void setTokenService(RsTokenService *token_service, RsGxsCommentService *comment_service); @@ -54,7 +54,7 @@ signals: void commentsLoaded(int); private: - void init(); + void init(const RsGxsId &default_author); RsGxsGroupId mGrpId; RsGxsMessageId mMostRecentMsgId; diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp index 35b56ae19..fcc13e851 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp @@ -323,7 +323,7 @@ void GxsCommentTreeWidget::banUser() void GxsCommentTreeWidget::makeComment() { - GxsCreateCommentDialog pcc(mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, this); + GxsCreateCommentDialog pcc(mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, mVoterId,this); pcc.exec(); } @@ -332,7 +332,7 @@ void GxsCommentTreeWidget::replyToComment() RsGxsGrpMsgIdPair msgId; msgId.first = mGroupId; msgId.second = mCurrentCommentMsgId; - GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, this); + GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, mVoterId,this); pcc.loadComment(mCurrentCommentText, mCurrentCommentAuthor, mCurrentCommentAuthorId); pcc.exec(); diff --git a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp index dd3f2f97c..e084635c3 100644 --- a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp @@ -26,7 +26,7 @@ #include #include -GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) : +GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, const RsGxsId& default_author,QWidget *parent) : QDialog(parent), ui(new Ui::GxsCreateCommentDialog), mCommentService(service), mParentId(parentId), mThreadId(threadId) { @@ -35,7 +35,7 @@ GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, co connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); /* fill in the available OwnIds for signing */ - ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId()); + ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, default_author); } void GxsCreateCommentDialog::loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId) diff --git a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h index 967649179..ce394bf5e 100644 --- a/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h @@ -36,7 +36,7 @@ class GxsCreateCommentDialog : public QDialog Q_OBJECT public: - explicit GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0); + explicit GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, const RsGxsId& default_author=RsGxsId(),QWidget *parent = 0); ~GxsCreateCommentDialog(); void loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 9cc924a33..4a5d0c859 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -731,7 +731,7 @@ void GxsGroupFrameDialog::loadComment(const RsGxsGroupId &grpId, const QVectorgetTokenService(), commentService); + commentDialog = new GxsCommentDialog(this,RsGxsId(), mInterface->getTokenService(), commentService); QWidget *commentHeader = createCommentHeaderWidget(grpId, most_recent_msgId); if (commentHeader) {