mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-05 13:19:32 -04:00
Added Forum reply with plaintext quote (by anmo)
This commit is contained in:
parent
e3d12b8194
commit
5404cda302
6 changed files with 127 additions and 5 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <QtXml>
|
||||
#include <QBuffer>
|
||||
#include <QMessageBox>
|
||||
#include <QTextDocumentFragment>
|
||||
#include <qmath.h>
|
||||
|
||||
#include "HandleRichText.h"
|
||||
|
@ -997,3 +998,15 @@ QString RsHtml::plainText(const std::string &text)
|
|||
return Qt::escape(QString::fromUtf8(text.c_str()));
|
||||
#endif
|
||||
}
|
||||
|
||||
QString RsHtml::makeQuotedText(RSTextBrowser *browser)
|
||||
{
|
||||
QString text = browser->textCursor().selection().toPlainText();
|
||||
if(text.length() == 0)
|
||||
{
|
||||
text = browser->toPlainText();
|
||||
}
|
||||
QStringList sl = text.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
|
||||
text = sl.join("\n>");
|
||||
return QString(">") + text;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <gui/common/RSTextBrowser.h>
|
||||
|
||||
/**
|
||||
* This file provides helper functions and functors for translating data from/to
|
||||
* rich text format and HTML. Its main goal is to facilitate decoding of chat
|
||||
|
@ -72,6 +74,8 @@ public:
|
|||
static QString plainText(const QString &text);
|
||||
static QString plainText(const std::string &text);
|
||||
|
||||
static QString makeQuotedText(RSTextBrowser* browser);
|
||||
|
||||
protected:
|
||||
void embedHtml(QTextDocument *textDocument, QDomDocument &doc, QDomElement ¤tElement, EmbedInHtml& embedInfos, ulong flag);
|
||||
void replaceAnchorWithImg(QDomDocument& doc, QDomElement &element, QTextDocument *textDocument, const RetroShareLink &link);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue