diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 114c08830..17dd367cc 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -201,6 +201,8 @@ ChatWidget::ChatWidget(QWidget *parent) : menu->addMenu(fontmenu); ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef()); + ui->chatTextEdit->setOnlyPlainText(ui->actionSendAsPlainText->isChecked()); + connect(ui->actionSendAsPlainText, SIGNAL(toggled(bool)), ui->chatTextEdit, SLOT(setOnlyPlainText(bool)) ); ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages()); ui->textBrowser->installEventFilter(this); diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.cpp b/retroshare-gui/src/gui/common/MimeTextEdit.cpp index 4fd75fd5b..e3b6d1437 100644 --- a/retroshare-gui/src/gui/common/MimeTextEdit.cpp +++ b/retroshare-gui/src/gui/common/MimeTextEdit.cpp @@ -42,6 +42,7 @@ MimeTextEdit::MimeTextEdit(QWidget *parent) mCompleterKey = Qt::Key_Space; mForceCompleterShowNextKeyEvent = false; highliter = new RsSyntaxHighlighter(this); + mOnlyPlainText = false; } bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const @@ -85,7 +86,10 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source) if(links.size() > 0) { for(int i = 0; i < links.size(); ++i) - insertHtml(links[i].toHtml() + "
"); + if (mOnlyPlainText) + insertPlainText(links[i].toString()); + else + insertHtml(links[i].toHtml() + "
"); return; } diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.h b/retroshare-gui/src/gui/common/MimeTextEdit.h index de992ecd3..2a6529ca1 100644 --- a/retroshare-gui/src/gui/common/MimeTextEdit.h +++ b/retroshare-gui/src/gui/common/MimeTextEdit.h @@ -48,9 +48,11 @@ public: void addContextMenuAction(QAction *action); QColor textColorQuote() const { return highliter->textColorQuote();} + bool onlyPlainText() const {return mOnlyPlainText;} public slots: void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);} + void setOnlyPlainText(bool bOnlyPlainText) {mOnlyPlainText = bOnlyPlainText;} signals: void calculateContextMenuActions(); @@ -80,6 +82,7 @@ private: QString mCompleterStartString; QList mContextMenuActions; RsSyntaxHighlighter *highliter; + bool mOnlyPlainText; }; #endif // MIMETEXTEDIT_H