From 5f66a45a151daba6d8d49daaa282238cc1e7d8ac Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 1 Aug 2018 18:40:40 +0200 Subject: [PATCH] Disable CMark Button on ChatWidget if not defined. --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 4d7c42a66..65a3597c3 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -191,7 +191,9 @@ ChatWidget::ChatWidget(QWidget *parent) fontmenu->addAction(ui->actionResetFont); fontmenu->addAction(ui->actionNoEmbed); fontmenu->addAction(ui->actionSendAsPlainText); + #ifdef USE_CMARK fontmenu->addAction(ui->actionSend_as_CommonMark); + #endif QMenu *menu = new QMenu(); menu->addAction(ui->actionClearChatHistory); @@ -205,9 +207,11 @@ ChatWidget::ChatWidget(QWidget *parent) ui->chatTextEdit->setOnlyPlainText(ui->actionSendAsPlainText->isChecked()); connect(ui->actionSendAsPlainText, SIGNAL(toggled(bool)), ui->chatTextEdit, SLOT(setOnlyPlainText(bool)) ); +#ifdef USE_CMARK connect(ui->actionSend_as_CommonMark, SIGNAL(toggled(bool)), this, SLOT(setUseCMark(bool)) ); - ui->cmPreview->setVisible(false); connect(ui->chatTextEdit, SIGNAL(textChanged()), this, SLOT(updateCMPreview()) ); +#endif + ui->cmPreview->setVisible(false); ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages()); ui->textBrowser->installEventFilter(this); @@ -983,10 +987,12 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx formatTextFlag |= RSHTML_FORMATTEXT_EMBED_SMILEYS; } +#ifdef USE_CMARK //Use CommonMark if (message.contains("CMark=\"true\"")) { formatTextFlag |= RSHTML_FORMATTEXT_USE_CMARK; } +#endif // Always fix colors formatTextFlag |= RSHTML_FORMATTEXT_FIX_COLORS;