use the comments ID to create new comment

This commit is contained in:
csoler 2020-10-01 21:06:33 +02:00
parent c30c7a4dfe
commit 5e2f46a5fc
4 changed files with 18 additions and 7 deletions

View File

@ -44,7 +44,7 @@
#define VIEW_IMAGE 2
#define VIEW_LINK 3
PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGroupId& grpId, const RsGxsId& default_author, QWidget *parent):
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
mPosted(posted), mGrpId(grpId),
ui(new Ui::PostedCreatePostDialog)
@ -69,8 +69,8 @@ PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGrou
ui->sizeWarningLabel->setText(QString("Post size is limited to %1 KB, pictures will be downscaled.").arg(MAXMESSAGESIZE / 1024));
/* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, default_author);
QSignalMapper *signalMapper = new QSignalMapper(this);
connect(ui->postButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->imageButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
@ -85,6 +85,15 @@ PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGrou
/* load settings */
processSettings(true);
// Override the default ID, if supplied, since it is changed by processSettings
if(!default_author.isNull())
{
ui->idChooser->setChosenId(default_author);
// should we save the ID in the settings here? I'm not sure we want this.
}
}
PostedCreatePostDialog::~PostedCreatePostDialog()

View File

@ -39,7 +39,7 @@ public:
* @param tokenQ parent callee token
* @param posted
*/
explicit PostedCreatePostDialog(RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
explicit PostedCreatePostDialog(RsPosted* posted, const RsGxsGroupId& grpId, const RsGxsId& default_author=RsGxsId(),QWidget *parent = 0);
~PostedCreatePostDialog();
private:

View File

@ -741,8 +741,10 @@ void PostedListWidgetWithModel::createMsg()
if (!IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags)) {
return;
}
PostedCreatePostDialog *msgDialog = new PostedCreatePostDialog(rsPosted,groupId());
RsGxsId author_id;
ui->idChooser->getChosenId(author_id);
std::cerr << "Chosing default ID " << author_id<< std::endl;
PostedCreatePostDialog *msgDialog = new PostedCreatePostDialog(rsPosted,groupId(),author_id);
msgDialog->show();
/* window will destroy itself! */

View File

@ -313,7 +313,7 @@ void GxsIdChooser::setDefaultItem()
}
if (def >= 0) {
setCurrentIndex(def);
whileBlocking(this)->setCurrentIndex(def);
#ifdef IDCHOOSER_DEBUG
std::cerr << "GxsIdChooser-002" << (void*)this << " setting current index to " << def << std::endl;
#endif