diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9245835c9..6beb12d22 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -244,7 +244,7 @@ endif(${USE_QT_5})
# Setup librar ies.
if(${USE_QT_5})
- find_package(Qt5 REQUIRED Sql WebKit WebKitWidgets Widgets Xml XmlPatterns Network LinguistTools)
+ find_package(Qt5 REQUIRED Sql WebKit WebKitWidgets Widgets Xml XmlPatterns Network LinguistTools PrintSupport)
else(${USE_QT_5})
set(QT_MIN_VERSION ${MINIMUM_QT_VERSION})
find_package(Qt4 REQUIRED QtCore QtGui QtSql QtNetwork QtWebkit QtXml QtXmlPatterns)
@@ -616,6 +616,7 @@ if(${USE_QT_5})
Xml
WebKit
WebKitWidgets
+ PrintSupport
)
# Setup compilation for Qt 4.
else(${USE_QT_5})
diff --git a/resources/graphics/icons/mini-kfaenza/print-web-page.png b/resources/graphics/icons/mini-kfaenza/print-web-page.png
new file mode 100644
index 000000000..c16344391
Binary files /dev/null and b/resources/graphics/icons/mini-kfaenza/print-web-page.png differ
diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG
index 163d54af2..68f7f08a4 100644
--- a/resources/text/CHANGELOG
+++ b/resources/text/CHANGELOG
@@ -1,5 +1,5 @@
-2.0.5
+2.1.0
Fixed:
@@ -8,6 +8,7 @@ Fixed:
Added:
+- Embedded web browser supports printing of its contents, feature is accessible via web browser context menu.
- Embedded web browser now displays navigation toolbar even in message preview mode/newspaper mode when user loads external links.
diff --git a/src/definitions/definitions.h.in b/src/definitions/definitions.h.in
index 73c5645a2..14f4b6faf 100755
--- a/src/definitions/definitions.h.in
+++ b/src/definitions/definitions.h.in
@@ -61,6 +61,7 @@
#define MIN_CATEGORY_NAME_LENGTH 3
#define INTERNAL_URL_NEWSPAPER "@APP_LOW_NAME@:newspaper"
#define INTERNAL_URL_EMPTY "@APP_LOW_NAME@:empty"
+#define INTERNAL_URL_BLANK "about:blank"
#define DEFAULT_AUTO_UPDATE_INTERVAL 15
#define AUTO_UPDATE_INTERVAL 60000
#define STARTUP_UPDATE_DELAY 1500
diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp
index 682c29ec7..3000683d0 100755
--- a/src/gui/feedsview.cpp
+++ b/src/gui/feedsview.cpp
@@ -75,6 +75,12 @@ void FeedsView::quit() {
}
}
+void FeedsView::setSortingEnabled(bool enable) {
+ disconnect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder)));
+ QTreeView::setSortingEnabled(enable);
+ connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder)));
+}
+
void FeedsView::updateAutoUpdateStatus() {
// Restore global intervals.
// NOTE: Specific per-feed interval are left intact.
diff --git a/src/gui/feedsview.h b/src/gui/feedsview.h
index c5a5f153e..7b8456ae1 100644
--- a/src/gui/feedsview.h
+++ b/src/gui/feedsview.h
@@ -50,6 +50,8 @@ class FeedsView : public QTreeView {
// Does necessary job before quitting this component.
void quit();
+ void setSortingEnabled(bool enable);
+
// Resets global auto-update intervals according to settings
// and starts/stop the timer as needed.
void updateAutoUpdateStatus();
diff --git a/src/network-web/webview.cpp b/src/network-web/webview.cpp
index 00fa9214c..9fb570c9b 100755
--- a/src/network-web/webview.cpp
+++ b/src/network-web/webview.cpp
@@ -34,6 +34,12 @@
#include
#include
+#if QT_VERSION >= 0x050000
+#include
+#else
+#include
+#endif
+
WebView::WebView(QWidget *parent)
: QWebView(parent), m_page(new WebPage(this)) {
@@ -74,12 +80,14 @@ void WebView::createConnections() {
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(popupContextMenu(QPoint)));
+ connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(printCurrentPage()));
connect(m_actionOpenLinkNewTab, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()));
connect(m_actionOpenImageNewTab, SIGNAL(triggered()), this, SLOT(openImageInNewTab()));
connect(m_actionOpenLinkExternally, SIGNAL(triggered()), this, SLOT(openLinkExternally()));
}
void WebView::setupIcons() {
+ m_actionPrint->setIcon(qApp->icons()->fromTheme("print-web-page"));
m_actionReload->setIcon(qApp->icons()->fromTheme("go-refresh"));
m_actionCopySelectedItem->setIcon(qApp->icons()->fromTheme("edit-copy"));
m_actionCopyLink->setIcon(qApp->icons()->fromTheme("edit-copy"));
@@ -102,6 +110,9 @@ void WebView::initializeActions() {
m_actionReload->setText(tr("Reload web page"));
m_actionReload->setToolTip(tr("Reload current web page."));
+ m_actionPrint = new QAction(tr("Print"), this);
+ m_actionPrint->setToolTip(tr("Print current web page."));
+
m_actionCopySelectedItem = pageAction(QWebPage::Copy);
m_actionCopySelectedItem->setParent(this);
m_actionCopySelectedItem->setText(tr("Copy selection"));
@@ -174,7 +185,17 @@ void WebView::popupContextMenu(const QPoint &pos) {
link_submenu.setIcon(qApp->icons()->fromTheme("text-html"));
// Assemble the menu from actions.
- context_menu.addAction(m_actionReload);
+
+ QString current_url = url().toString();
+
+ if (!current_url.isEmpty() && current_url != INTERNAL_URL_EMPTY && current_url != INTERNAL_URL_BLANK) {
+ context_menu.addAction(m_actionPrint);
+
+ if (current_url != INTERNAL_URL_NEWSPAPER) {
+ context_menu.addAction(m_actionReload);
+ }
+ }
+
context_menu.addAction(m_actionCopySelectedItem);
QUrl hit_url = hit_result.linkUrl();
@@ -209,6 +230,12 @@ void WebView::popupContextMenu(const QPoint &pos) {
context_menu.exec(mapToGlobal(pos));
}
+void WebView::printCurrentPage() {
+ QPointer print_preview = new QPrintPreviewDialog(this);
+ connect(print_preview.data(), SIGNAL(paintRequested(QPrinter*)), this, SLOT(print(QPrinter*)));
+ print_preview.data()->exec();
+}
+
void WebView::mousePressEvent(QMouseEvent *event) {
if (event->button() & Qt::LeftButton && event->modifiers() & Qt::ControlModifier) {
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(event->pos());
@@ -239,6 +266,7 @@ void WebView::mousePressEvent(QMouseEvent *event) {
void WebView::mouseReleaseEvent(QMouseEvent *event) {
if (event->button() & Qt::MiddleButton) {
bool are_gestures_enabled = qApp->settings()->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool();
+
if (are_gestures_enabled) {
QPoint release_point = event->pos();
int left_move = m_gestureOrigin.x() - release_point.x();
diff --git a/src/network-web/webview.h b/src/network-web/webview.h
index 590412d8b..a8b717c96 100644
--- a/src/network-web/webview.h
+++ b/src/network-web/webview.h
@@ -68,6 +68,8 @@ class WebView : public QWebView {
// Provides custom context menu.
void popupContextMenu(const QPoint &pos);
+ void printCurrentPage();
+
protected:
// Initializes all actions.
void initializeActions();
@@ -89,6 +91,7 @@ class WebView : public QWebView {
WebPage *m_page;
QAction *m_actionReload;
+ QAction *m_actionPrint;
QAction *m_actionCopySelectedItem;
QAction *m_actionCopyLink;
QAction *m_actionCopyImage;