diff --git a/localization/rssguard_cs.ts b/localization/rssguard_cs.ts index 6163261db..e09a3ad8e 100644 --- a/localization/rssguard_cs.ts +++ b/localization/rssguard_cs.ts @@ -389,6 +389,14 @@ Mark all messages in all feeds read. This does not take message filters into account. + + View selected items in newspaper mode + + + + Displays all messages from selected feeds/categories in a new "newspaper mode" tab. All selected feeds are marked as read. + + FormSettings @@ -1056,6 +1064,10 @@ Jazyk: %5 uknown author neznámý autor + + Newspaper view + + WebView @@ -1139,5 +1151,9 @@ Jazyk: %5 Hyperlink Hypertextový odkaz + + Error page + + diff --git a/localization/rssguard_en.ts b/localization/rssguard_en.ts index 4164e05d4..83c2bc6a3 100644 --- a/localization/rssguard_en.ts +++ b/localization/rssguard_en.ts @@ -389,6 +389,14 @@ Mark all messages in all feeds read. This does not take message filters into account. + + View selected items in newspaper mode + + + + Displays all messages from selected feeds/categories in a new "newspaper mode" tab. All selected feeds are marked as read. + + FormSettings @@ -1037,6 +1045,10 @@ Language: %5 uknown author + + Newspaper view + + WebView @@ -1120,5 +1132,9 @@ Language: %5 Hyperlink + + Error page + + diff --git a/localization/rssguard_nl.ts b/localization/rssguard_nl.ts index 1d330ef11..f460ba2af 100644 --- a/localization/rssguard_nl.ts +++ b/localization/rssguard_nl.ts @@ -389,6 +389,14 @@ Mark all messages in all feeds read. This does not take message filters into account. + + View selected items in newspaper mode + + + + Displays all messages from selected feeds/categories in a new "newspaper mode" tab. All selected feeds are marked as read. + + FormSettings @@ -1053,6 +1061,10 @@ Taal: %5 uknown author + + Newspaper view + + WebView @@ -1136,5 +1148,9 @@ Taal: %5 Hyperlink Koppeling + + Error page + + diff --git a/src/core/defs.h.in b/src/core/defs.h.in index 6e31bd169..0c996830c 100755 --- a/src/core/defs.h.in +++ b/src/core/defs.h.in @@ -23,18 +23,20 @@ #define APP_VERSION "@APP_VERSION@" #define APP_USERAGENT QString("@APP_NAME@/@APP_VERSION@ (@APP_URL@) on @CMAKE_SYSTEM@; Webkit/") + qWebKitVersion() -#define TEXT_TITLE_LIMIT 30 -#define MAX_ZOOM_FACTOR 10.0 -#define ICON_SIZE_SETTINGS 16 -#define DATABASE_DRIVER "QSQLITE" -#define NO_PARENT_CATEGORY -1 -#define TRAY_ICON_BUBBLE_TIMEOUT 15000 -#define KEY_MESSAGES_VIEW "messages_view_column_" -#define CLOSE_LOCK_TIMEOUT 3000 -#define DOWNLOAD_TIMEOUT 5000 -#define MESSAGES_VIEW_DEFAULT_COL 170 -#define ELLIPSIS_LENGTH 3 -#define NEWSPAPER_URL "rssguard:newspaper" +#define TEXT_TITLE_LIMIT 30 +#define MAX_ZOOM_FACTOR 10.0 +#define ICON_SIZE_SETTINGS 16 +#define DATABASE_DRIVER "QSQLITE" +#define NO_PARENT_CATEGORY -1 +#define TRAY_ICON_BUBBLE_TIMEOUT 15000 +#define KEY_MESSAGES_VIEW "messages_view_column_" +#define CLOSE_LOCK_TIMEOUT 3000 +#define DOWNLOAD_TIMEOUT 5000 +#define MESSAGES_VIEW_DEFAULT_COL 170 +#define ELLIPSIS_LENGTH 3 +#define INTERNAL_URL_SCHEME APP_LOW_NAME +#define INTERNAL_URL_NEWSPAPER "@APP_LOW_NAME@:newspaper" +#define INTERNAL_URL_NEWSPAPER_PATH "newspaper" #define APP_DB_INIT_FILE "db_init.sql" #define APP_DB_INIT_SPLIT "-- !\n" diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index c421b3332..dc8ca3746 100644 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -134,23 +134,19 @@ void FeedsView::markAllFeedsRead() { } void FeedsView::openSelectedFeedsInNewspaperMode() { - // TODO: oznacit vybrane feedy jako prectene zde - // protoze je uzivatel otvira v newspaperu -> jsou prectene automaticky - - QList selected_feeds = selectedFeeds(); QList messages = m_sourceModel->messagesForFeeds(selected_feeds); if (!messages.isEmpty()) { emit newspaperModeRequested(messages); + + // Moreover, mark those feeds as read because they were opened in + // newspaper mode, thus, they are read. + m_sourceModel->markFeedsRead(selected_feeds, 1); + updateCountsOfAllFeeds(false); + + emit feedsNeedToBeReloaded(1); } - - // Moreover, mark those feeds as read because they were opened in - // newspaper mode, thus, they are read. - m_sourceModel->markFeedsRead(selected_feeds, 1); - updateCountsOfAllFeeds(false); - - emit feedsNeedToBeReloaded(1); } void FeedsView::updateCountsOfSelectedFeeds(bool update_total_too) { diff --git a/src/gui/webbrowser.cpp b/src/gui/webbrowser.cpp index 2da820341..3b09bb6ec 100644 --- a/src/gui/webbrowser.cpp +++ b/src/gui/webbrowser.cpp @@ -166,25 +166,13 @@ void WebBrowser::clear() { } void WebBrowser::navigateToMessage(const Message &message) { - QString message_layout = SkinFactory::getInstance()->getCurrentMarkup().arg(message.m_title, - tr("Written by ") + (message.m_author.isEmpty() ? - tr("uknown author") : - message.m_author), - message.m_url, - message.m_contents, - message.m_created.toString(Qt::DefaultLocaleShortDate)); - - QString layout_wrapper = SkinFactory::getInstance()->getCurrentMarkupLayout().arg(message.m_title, - message_layout); - - m_webView->setHtml(layout_wrapper, QUrl(NEWSPAPER_URL)); - emit iconChanged(m_index, - IconThemeFactory::getInstance()->fromTheme("document-multiple")); + navigateToMessages(QList() << message); } void WebBrowser::navigateToMessages(const QList &messages) { + SkinFactory *factory = SkinFactory::getInstance(); QString messages_layout; - QString default_message_layout = SkinFactory::getInstance()->getCurrentMarkup(); + QString default_message_layout = factory->getCurrentMarkup(); foreach (const Message &message, messages) { messages_layout.append(default_message_layout.arg(message.m_title, @@ -195,13 +183,15 @@ void WebBrowser::navigateToMessages(const QList &messages) { message.m_contents, message.m_created.toString(Qt::DefaultLocaleShortDate))); } - QString layout_wrapper = SkinFactory::getInstance()->getCurrentMarkupLayout().arg(tr("Newspaper view"), - messages_layout); - m_webView->setHtml(layout_wrapper, QUrl(NEWSPAPER_URL)); + QString layout_wrapper = factory->getCurrentMarkupLayout().arg(messages.size() == 1 ? + messages.at(0).m_title : + tr("Newspaper view"), + messages_layout); + + m_webView->setHtml(layout_wrapper, QUrl(INTERNAL_URL_NEWSPAPER)); emit iconChanged(m_index, IconThemeFactory::getInstance()->fromTheme("document-multiple")); - } void WebBrowser::updateZoomGui() { diff --git a/src/gui/webview.cpp b/src/gui/webview.cpp index 36e0a0024..3a1994841 100644 --- a/src/gui/webview.cpp +++ b/src/gui/webview.cpp @@ -28,6 +28,10 @@ WebView::~WebView() { qDebug("Destroying BaseWebView."); } +WebPage *WebView::page() const { + return m_page; +} + void WebView::onLoadFinished(bool ok) { // If page was not loaded, then display custom error page. if (!ok) { diff --git a/src/gui/webview.h b/src/gui/webview.h index 1b54a6516..8844a20aa 100644 --- a/src/gui/webview.h +++ b/src/gui/webview.h @@ -16,6 +16,8 @@ class WebView : public QWebView { explicit WebView(QWidget *parent = 0); virtual ~WebView(); + WebPage *page() const; + void setupIcons(); signals: