mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed crash when adding a new comment to a post without active item in tree
This commit is contained in:
parent
11c71d16ab
commit
26c5ce4ed2
@ -313,7 +313,11 @@ void GxsCommentTreeWidget::setCurrentCommentMsgId(QTreeWidgetItem *current, QTre
|
|||||||
mCurrentCommentText = current->text(PCITEM_COLUMN_COMMENT);
|
mCurrentCommentText = current->text(PCITEM_COLUMN_COMMENT);
|
||||||
mCurrentCommentAuthor = current->text(PCITEM_COLUMN_AUTHOR);
|
mCurrentCommentAuthor = current->text(PCITEM_COLUMN_AUTHOR);
|
||||||
mCurrentCommentAuthorId = RsGxsId(current->text(PCITEM_COLUMN_AUTHORID).toStdString());
|
mCurrentCommentAuthorId = RsGxsId(current->text(PCITEM_COLUMN_AUTHORID).toStdString());
|
||||||
|
} else {
|
||||||
|
mCurrentCommentMsgId.clear();
|
||||||
|
mCurrentCommentText.clear();
|
||||||
|
mCurrentCommentAuthor.clear();
|
||||||
|
mCurrentCommentAuthorId.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,19 +327,22 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& point)
|
|||||||
|
|
||||||
QMenu contextMnu( this );
|
QMenu contextMnu( this );
|
||||||
QAction* action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_REPLY), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
QAction* action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_REPLY), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
||||||
action->setDisabled(mCurrentCommentMsgId.isNull());
|
action->setDisabled(!item || mCurrentCommentMsgId.isNull());
|
||||||
|
|
||||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
||||||
action->setDisabled(mMsgVersions.empty());
|
action->setDisabled(mMsgVersions.empty());
|
||||||
|
|
||||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPY), tr("Copy Comment"), this, SLOT(copyComment()));
|
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPY), tr("Copy Comment"), this, SLOT(copyComment()));
|
||||||
action->setData( item->data(PCITEM_COLUMN_COMMENT,Qt::DisplayRole) );
|
action->setData( item ? item->data(PCITEM_COLUMN_COMMENT,Qt::DisplayRole) : "" );
|
||||||
action->setDisabled(mCurrentCommentMsgId.isNull());
|
action->setDisabled(!item || mCurrentCommentMsgId.isNull());
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_VOTEUP), tr("Vote Up"), this, SLOT(voteUp()));
|
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_VOTEUP), tr("Vote Up"), this, SLOT(voteUp()));
|
||||||
action->setDisabled(mVoterId.isNull());
|
action->setDisabled(!item || mCurrentCommentMsgId.isNull() || mVoterId.isNull());
|
||||||
|
|
||||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_VOTEDOWN), tr("Vote Down"), this, SLOT(voteDown()));
|
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_VOTEDOWN), tr("Vote Down"), this, SLOT(voteDown()));
|
||||||
action->setDisabled(mVoterId.isNull());
|
action->setDisabled(!item || mCurrentCommentMsgId.isNull() || mVoterId.isNull());
|
||||||
|
|
||||||
|
|
||||||
if (!mCurrentCommentMsgId.isNull())
|
if (!mCurrentCommentMsgId.isNull())
|
||||||
|
Loading…
Reference in New Issue
Block a user