diff --git a/src/rss/rss_imp.cpp b/src/rss/rss_imp.cpp index c8e39c4df..6e6f0c773 100644 --- a/src/rss/rss_imp.cpp +++ b/src/rss/rss_imp.cpp @@ -567,7 +567,37 @@ void RSSImp::refreshTextBrowser() html += "
"+tr("Author: ")+""+article->author()+"
"; } html += ""; - html += ""+article->description()+""; + html += "
"; + 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")));