Fix copy of RSLink when on Only plain text mode in chat lobby. (sss

find)
This commit is contained in:
Phenom 2017-07-21 10:58:19 +02:00
parent aa471e5b2f
commit 8d82640f41
3 changed files with 10 additions and 1 deletions

View File

@ -201,6 +201,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
menu->addMenu(fontmenu); menu->addMenu(fontmenu);
ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef()); 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->resetImagesStatus(Settings->getChatLoadEmbeddedImages());
ui->textBrowser->installEventFilter(this); ui->textBrowser->installEventFilter(this);

View File

@ -42,6 +42,7 @@ MimeTextEdit::MimeTextEdit(QWidget *parent)
mCompleterKey = Qt::Key_Space; mCompleterKey = Qt::Key_Space;
mForceCompleterShowNextKeyEvent = false; mForceCompleterShowNextKeyEvent = false;
highliter = new RsSyntaxHighlighter(this); highliter = new RsSyntaxHighlighter(this);
mOnlyPlainText = false;
} }
bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
@ -85,7 +86,10 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
if(links.size() > 0) if(links.size() > 0)
{ {
for(int i = 0; i < links.size(); ++i) for(int i = 0; i < links.size(); ++i)
insertHtml(links[i].toHtml() + "<br>"); if (mOnlyPlainText)
insertPlainText(links[i].toString());
else
insertHtml(links[i].toHtml() + "<br>");
return; return;
} }

View File

@ -48,9 +48,11 @@ public:
void addContextMenuAction(QAction *action); void addContextMenuAction(QAction *action);
QColor textColorQuote() const { return highliter->textColorQuote();} QColor textColorQuote() const { return highliter->textColorQuote();}
bool onlyPlainText() const {return mOnlyPlainText;}
public slots: public slots:
void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);} void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);}
void setOnlyPlainText(bool bOnlyPlainText) {mOnlyPlainText = bOnlyPlainText;}
signals: signals:
void calculateContextMenuActions(); void calculateContextMenuActions();
@ -80,6 +82,7 @@ private:
QString mCompleterStartString; QString mCompleterStartString;
QList<QAction*> mContextMenuActions; QList<QAction*> mContextMenuActions;
RsSyntaxHighlighter *highliter; RsSyntaxHighlighter *highliter;
bool mOnlyPlainText;
}; };
#endif // MIMETEXTEDIT_H #endif // MIMETEXTEDIT_H