";
+ if(Qt::mightBeRichText(article->description())) {
+ html += article->description();
+ } else {
+ QString description = article->description();
+ QRegExp rx;
+ // If description is plain text, replace BBCode tags with HTML and wrap everything in
so it looks nice
+ rx.setMinimal(true);
+ rx.setCaseSensitivity(Qt::CaseInsensitive);
+
+ rx.setPattern("\\[img\\](.+)\\[/img\\]");
+ description = description.replace(rx, "
");
+
+ rx.setPattern("\\[url=(\")?(.+)\\1\\]");
+ description = description.replace(rx, "
");
+ description = description.replace("[/url]", "", Qt::CaseInsensitive);
+
+ rx.setPattern("\\[(/)?([bius])\\]");
+ description = description.replace(rx, "<\\1\\2>");
+
+ rx.setPattern("\\[color=(\")?(.+)\\1\\]");
+ description = description.replace(rx, "
");
+ description = description.replace("[/color]", "", Qt::CaseInsensitive);
+
+ rx.setPattern("\\[size=(\")?(.+)\\d\\1\\]");
+ description = description.replace(rx, "
");
+ description = description.replace("[/size]", "", Qt::CaseInsensitive);
+
+ html += "
" + description + "
";
+ }
+ html += "
";
textBrowser->setHtml(html);
article->markAsRead();
item->setData(Article::ColorRole, QVariant(QColor("grey")));