From 8d82640f4133db97812b9bdbab4c355cc16d87bf Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 21 Jul 2017 10:58:19 +0200 Subject: [PATCH] Fix copy of RSLink when on Only plain text mode in chat lobby. (sss find) --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 2 ++ retroshare-gui/src/gui/common/MimeTextEdit.cpp | 6 +++++- retroshare-gui/src/gui/common/MimeTextEdit.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) 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