Work on newspaper mode + langs updated.

This commit is contained in:
Martin Rotter 2014-01-05 13:28:56 +01:00
parent b89a95899c
commit 4842361397
8 changed files with 84 additions and 42 deletions

View File

@ -389,6 +389,14 @@
<source>Mark all messages in all feeds read. This does not take message filters into account.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>View selected items in newspaper mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Displays all messages from selected feeds/categories in a new &quot;newspaper mode&quot; tab. All selected feeds are marked as read.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1056,6 +1064,10 @@ Jazyk: %5</translation>
<source>uknown author</source>
<translation>neznámý autor</translation>
</message>
<message>
<source>Newspaper view</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WebView</name>
@ -1139,5 +1151,9 @@ Jazyk: %5</translation>
<source>Hyperlink</source>
<translation>Hypertextový odkaz</translation>
</message>
<message>
<source>Error page</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -389,6 +389,14 @@
<source>Mark all messages in all feeds read. This does not take message filters into account.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>View selected items in newspaper mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Displays all messages from selected feeds/categories in a new &quot;newspaper mode&quot; tab. All selected feeds are marked as read.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1037,6 +1045,10 @@ Language: %5</source>
<source>uknown author</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Newspaper view</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WebView</name>
@ -1120,5 +1132,9 @@ Language: %5</source>
<source>Hyperlink</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error page</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -389,6 +389,14 @@
<source>Mark all messages in all feeds read. This does not take message filters into account.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>View selected items in newspaper mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Displays all messages from selected feeds/categories in a new &quot;newspaper mode&quot; tab. All selected feeds are marked as read.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1053,6 +1061,10 @@ Taal: %5</translation>
<source>uknown author</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Newspaper view</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WebView</name>
@ -1136,5 +1148,9 @@ Taal: %5</translation>
<source>Hyperlink</source>
<translation type="unfinished">Koppeling</translation>
</message>
<message>
<source>Error page</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -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"

View File

@ -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<FeedsModelFeed*> selected_feeds = selectedFeeds();
QList<Message> 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) {

View File

@ -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>() << message);
}
void WebBrowser::navigateToMessages(const QList<Message> &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<Message> &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() {

View File

@ -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) {

View File

@ -16,6 +16,8 @@ class WebView : public QWebView {
explicit WebView(QWidget *parent = 0);
virtual ~WebView();
WebPage *page() const;
void setupIcons();
signals: