mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
keep current voter ID as poster ID in comment dialog
This commit is contained in:
parent
5e2f46a5fc
commit
6cc9cdf130
@ -686,8 +686,11 @@ void PostedListWidgetWithModel::openComments(const RsGxsMessageId& msgId)
|
|||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
RsGxsId current_author;
|
||||||
|
ui->idChooser->getChosenId(current_author);
|
||||||
|
|
||||||
RsPostedPost post = index.data(Qt::UserRole).value<RsPostedPost>() ;
|
RsPostedPost post = index.data(Qt::UserRole).value<RsPostedPost>() ;
|
||||||
auto *commentDialog = new GxsCommentDialog(this,rsPosted->getTokenService(),rsPosted);
|
auto *commentDialog = new GxsCommentDialog(this,current_author,rsPosted->getTokenService(),rsPosted);
|
||||||
|
|
||||||
std::set<RsGxsMessageId> msg_versions({post.mMeta.mMsgId});
|
std::set<RsGxsMessageId> msg_versions({post.mMeta.mMsgId});
|
||||||
commentDialog->commentLoad(post.mMeta.mGroupId, msg_versions, post.mMeta.mMsgId);
|
commentDialog->commentLoad(post.mMeta.mGroupId, msg_versions, post.mMeta.mMsgId);
|
||||||
|
@ -60,7 +60,7 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const std::set<
|
|||||||
comments += "...";
|
comments += "...";
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService());
|
GxsCommentDialog *commentDialog = new GxsCommentDialog(this, RsGxsId(),getTokenService(), getCommentService());
|
||||||
|
|
||||||
QWidget *commentHeader = createHeaderWidget(grpId, msgId);
|
QWidget *commentHeader = createHeaderWidget(grpId, msgId);
|
||||||
commentDialog->setCommentHeader(commentHeader);
|
commentDialog->setCommentHeader(commentHeader);
|
||||||
|
@ -30,24 +30,24 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
/** Constructor */
|
/** 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)
|
: QWidget(parent), ui(new Ui::GxsCommentDialog)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated QObject setup routine */
|
/* Invoke the Qt Designer generated QObject setup routine */
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setTokenService(token_service,comment_service);
|
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 */
|
/* Set header resize modes and initial section sizes */
|
||||||
QHeaderView * ttheader = ui->treeWidget->header () ;
|
QHeaderView * ttheader = ui->treeWidget->header () ;
|
||||||
ttheader->resizeSection (0, 440);
|
ttheader->resizeSection (0, 440);
|
||||||
|
|
||||||
/* fill in the available OwnIds for signing */
|
/* 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->refreshButton, SIGNAL(clicked()), this, SLOT(refresh()));
|
||||||
connect(ui->idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int )));
|
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);
|
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)
|
: QWidget(parent), ui(new Ui::GxsCommentDialog)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated QObject setup routine */
|
/* Invoke the Qt Designer generated QObject setup routine */
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
init();
|
init(default_author);
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsCommentDialog::~GxsCommentDialog()
|
GxsCommentDialog::~GxsCommentDialog()
|
||||||
|
@ -32,8 +32,8 @@ class GxsCommentDialog: public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GxsCommentDialog(QWidget *parent);
|
GxsCommentDialog(QWidget *parent=nullptr,const RsGxsId& default_author=RsGxsId());
|
||||||
GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service);
|
GxsCommentDialog(QWidget *parent,const RsGxsId& default_author, RsTokenService *token_service, RsGxsCommentService *comment_service);
|
||||||
virtual ~GxsCommentDialog();
|
virtual ~GxsCommentDialog();
|
||||||
|
|
||||||
void setTokenService(RsTokenService *token_service, RsGxsCommentService *comment_service);
|
void setTokenService(RsTokenService *token_service, RsGxsCommentService *comment_service);
|
||||||
@ -54,7 +54,7 @@ signals:
|
|||||||
void commentsLoaded(int);
|
void commentsLoaded(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init(const RsGxsId &default_author);
|
||||||
|
|
||||||
RsGxsGroupId mGrpId;
|
RsGxsGroupId mGrpId;
|
||||||
RsGxsMessageId mMostRecentMsgId;
|
RsGxsMessageId mMostRecentMsgId;
|
||||||
|
@ -323,7 +323,7 @@ void GxsCommentTreeWidget::banUser()
|
|||||||
|
|
||||||
void GxsCommentTreeWidget::makeComment()
|
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();
|
pcc.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ void GxsCommentTreeWidget::replyToComment()
|
|||||||
RsGxsGrpMsgIdPair msgId;
|
RsGxsGrpMsgIdPair msgId;
|
||||||
msgId.first = mGroupId;
|
msgId.first = mGroupId;
|
||||||
msgId.second = mCurrentCommentMsgId;
|
msgId.second = mCurrentCommentMsgId;
|
||||||
GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, this);
|
GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, mVoterId,this);
|
||||||
|
|
||||||
pcc.loadComment(mCurrentCommentText, mCurrentCommentAuthor, mCurrentCommentAuthorId);
|
pcc.loadComment(mCurrentCommentText, mCurrentCommentAuthor, mCurrentCommentAuthorId);
|
||||||
pcc.exec();
|
pcc.exec();
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
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),
|
QDialog(parent),
|
||||||
ui(new Ui::GxsCreateCommentDialog), mCommentService(service), mParentId(parentId), mThreadId(threadId)
|
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()));
|
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||||
|
|
||||||
/* fill in the available OwnIds for signing */
|
/* 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)
|
void GxsCreateCommentDialog::loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId)
|
||||||
|
@ -36,7 +36,7 @@ class GxsCreateCommentDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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();
|
~GxsCreateCommentDialog();
|
||||||
|
|
||||||
void loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId);
|
void loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId);
|
||||||
|
@ -731,7 +731,7 @@ void GxsGroupFrameDialog::loadComment(const RsGxsGroupId &grpId, const QVector<R
|
|||||||
comments += "...";
|
comments += "...";
|
||||||
}
|
}
|
||||||
|
|
||||||
commentDialog = new GxsCommentDialog(this, mInterface->getTokenService(), commentService);
|
commentDialog = new GxsCommentDialog(this,RsGxsId(), mInterface->getTokenService(), commentService);
|
||||||
|
|
||||||
QWidget *commentHeader = createCommentHeaderWidget(grpId, most_recent_msgId);
|
QWidget *commentHeader = createCommentHeaderWidget(grpId, most_recent_msgId);
|
||||||
if (commentHeader) {
|
if (commentHeader) {
|
||||||
|
Loading…
Reference in New Issue
Block a user