";
+ html += "
" + article->title() + "
";
+ if (article->date().isValid())
+ html += "
" + tr("Date: ") + "" + article->date().toLocalTime().toString(Qt::SystemLocaleLongDate) + "
";
+ if (!article->author().isEmpty())
+ html += "
" + tr("Author: ") + "" + article->author() + "
";
+ html += "
";
+ 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 + "
";
}
- m_currentArticle = item;
- }
- RssFeedPtr stream = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString());
- RssArticlePtr article = stream->getItem(item->data(Article::IdRole).toString());
- QString html;
- html += "
";
- html += "
"+article->title() + "
";
- if (article->date().isValid()) {
- html += "
"+tr("Date: ")+""+article->date().toLocalTime().toString(Qt::SystemLocaleLongDate)+"
";
- }
- if (!article->author().isEmpty()) {
- html += "
"+tr("Author: ")+""+article->author()+"
";
- }
- html += "
";
- 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")));
- item->setData(Article::IconRole, QVariant(QIcon(":/Icons/sphere.png")));
- // Decrement feed nb unread news
- updateItemInfos(m_feedList->stickyUnreadItem());
- updateItemInfos(m_feedList->getTreeItemFromUrl(item->data(Article::FeedUrlRole).toString()));
+ html += "
";
+ textBrowser->setHtml(html);
+ article->markAsRead();
+ item->setData(Article::ColorRole, QVariant(QColor("grey")));
+ item->setData(Article::IconRole, QVariant(QIcon(":/Icons/sphere.png")));
+ // Decrement feed nb unread news
+ updateItemInfos(m_feedList->stickyUnreadItem());
+ updateItemInfos(m_feedList->getTreeItemFromUrl(item->data(Article::FeedUrlRole).toString()));
}
void RSSImp::saveSlidersPosition()
{
- // Remember sliders positions
- Preferences* const pref = Preferences::instance();
- pref->setRssHSplitterState(splitter_h->saveState());
- pref->setRssVSplitterState(splitter_v->saveState());
- qDebug("Splitters position saved");
+ // Remember sliders positions
+ Preferences* const pref = Preferences::instance();
+ pref->setRssHSplitterState(splitter_h->saveState());
+ pref->setRssVSplitterState(splitter_v->saveState());
+ qDebug("Splitters position saved");
}
void RSSImp::restoreSlidersPosition()
{
- const Preferences* const pref = Preferences::instance();
- QByteArray pos_h = pref->getRssHSplitterState();
- if (!pos_h.isNull()) {
- splitter_h->restoreState(pos_h);
- }
- QByteArray pos_v = pref->getRssVSplitterState();
- if (!pos_v.isNull()) {
- splitter_v->restoreState(pos_v);
- }
+ const Preferences* const pref = Preferences::instance();
+ QByteArray pos_h = pref->getRssHSplitterState();
+ if (!pos_h.isNull())
+ splitter_h->restoreState(pos_h);
+ QByteArray pos_v = pref->getRssVSplitterState();
+ if (!pos_v.isNull())
+ splitter_v->restoreState(pos_v);
}
void RSSImp::updateItemsInfos(const QList