Printing now works on Windows, fixed sorting bug in feed list.
This commit is contained in:
parent
dea0a1a274
commit
a8681c040c
8 changed files with 45 additions and 3 deletions
|
@ -244,7 +244,7 @@ endif(${USE_QT_5})
|
||||||
|
|
||||||
# Setup librar ies.
|
# Setup librar ies.
|
||||||
if(${USE_QT_5})
|
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})
|
else(${USE_QT_5})
|
||||||
set(QT_MIN_VERSION ${MINIMUM_QT_VERSION})
|
set(QT_MIN_VERSION ${MINIMUM_QT_VERSION})
|
||||||
find_package(Qt4 REQUIRED QtCore QtGui QtSql QtNetwork QtWebkit QtXml QtXmlPatterns)
|
find_package(Qt4 REQUIRED QtCore QtGui QtSql QtNetwork QtWebkit QtXml QtXmlPatterns)
|
||||||
|
@ -616,6 +616,7 @@ if(${USE_QT_5})
|
||||||
Xml
|
Xml
|
||||||
WebKit
|
WebKit
|
||||||
WebKitWidgets
|
WebKitWidgets
|
||||||
|
PrintSupport
|
||||||
)
|
)
|
||||||
# Setup compilation for Qt 4.
|
# Setup compilation for Qt 4.
|
||||||
else(${USE_QT_5})
|
else(${USE_QT_5})
|
||||||
|
|
BIN
resources/graphics/icons/mini-kfaenza/print-web-page.png
Normal file
BIN
resources/graphics/icons/mini-kfaenza/print-web-page.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
|
@ -1,5 +1,5 @@
|
||||||
<body>
|
<body>
|
||||||
<center><h2>2.0.5</h2></center>
|
<center><h2>2.1.0</h2></center>
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -8,6 +8,7 @@ Fixed:
|
||||||
|
|
||||||
Added:
|
Added:
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Embedded web browser supports printing of its contents, feature is accessible via web browser context menu.</li>
|
||||||
<li>Embedded web browser now displays navigation toolbar even in message preview mode/newspaper mode when user loads external links.</li>
|
<li>Embedded web browser now displays navigation toolbar even in message preview mode/newspaper mode when user loads external links.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
#define MIN_CATEGORY_NAME_LENGTH 3
|
#define MIN_CATEGORY_NAME_LENGTH 3
|
||||||
#define INTERNAL_URL_NEWSPAPER "@APP_LOW_NAME@:newspaper"
|
#define INTERNAL_URL_NEWSPAPER "@APP_LOW_NAME@:newspaper"
|
||||||
#define INTERNAL_URL_EMPTY "@APP_LOW_NAME@:empty"
|
#define INTERNAL_URL_EMPTY "@APP_LOW_NAME@:empty"
|
||||||
|
#define INTERNAL_URL_BLANK "about:blank"
|
||||||
#define DEFAULT_AUTO_UPDATE_INTERVAL 15
|
#define DEFAULT_AUTO_UPDATE_INTERVAL 15
|
||||||
#define AUTO_UPDATE_INTERVAL 60000
|
#define AUTO_UPDATE_INTERVAL 60000
|
||||||
#define STARTUP_UPDATE_DELAY 1500
|
#define STARTUP_UPDATE_DELAY 1500
|
||||||
|
|
|
@ -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() {
|
void FeedsView::updateAutoUpdateStatus() {
|
||||||
// Restore global intervals.
|
// Restore global intervals.
|
||||||
// NOTE: Specific per-feed interval are left intact.
|
// NOTE: Specific per-feed interval are left intact.
|
||||||
|
|
|
@ -50,6 +50,8 @@ class FeedsView : public QTreeView {
|
||||||
// Does necessary job before quitting this component.
|
// Does necessary job before quitting this component.
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
|
void setSortingEnabled(bool enable);
|
||||||
|
|
||||||
// Resets global auto-update intervals according to settings
|
// Resets global auto-update intervals according to settings
|
||||||
// and starts/stop the timer as needed.
|
// and starts/stop the timer as needed.
|
||||||
void updateAutoUpdateStatus();
|
void updateAutoUpdateStatus();
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
#include <QtPrintSupport/QPrintPreviewDialog>
|
||||||
|
#else
|
||||||
|
#include <QPrintPreviewDialog>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
WebView::WebView(QWidget *parent)
|
WebView::WebView(QWidget *parent)
|
||||||
: QWebView(parent), m_page(new WebPage(this)) {
|
: 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(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
|
||||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(popupContextMenu(QPoint)));
|
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_actionOpenLinkNewTab, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()));
|
||||||
connect(m_actionOpenImageNewTab, SIGNAL(triggered()), this, SLOT(openImageInNewTab()));
|
connect(m_actionOpenImageNewTab, SIGNAL(triggered()), this, SLOT(openImageInNewTab()));
|
||||||
connect(m_actionOpenLinkExternally, SIGNAL(triggered()), this, SLOT(openLinkExternally()));
|
connect(m_actionOpenLinkExternally, SIGNAL(triggered()), this, SLOT(openLinkExternally()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::setupIcons() {
|
void WebView::setupIcons() {
|
||||||
|
m_actionPrint->setIcon(qApp->icons()->fromTheme("print-web-page"));
|
||||||
m_actionReload->setIcon(qApp->icons()->fromTheme("go-refresh"));
|
m_actionReload->setIcon(qApp->icons()->fromTheme("go-refresh"));
|
||||||
m_actionCopySelectedItem->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
m_actionCopySelectedItem->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
||||||
m_actionCopyLink->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->setText(tr("Reload web page"));
|
||||||
m_actionReload->setToolTip(tr("Reload current 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 = pageAction(QWebPage::Copy);
|
||||||
m_actionCopySelectedItem->setParent(this);
|
m_actionCopySelectedItem->setParent(this);
|
||||||
m_actionCopySelectedItem->setText(tr("Copy selection"));
|
m_actionCopySelectedItem->setText(tr("Copy selection"));
|
||||||
|
@ -174,7 +185,17 @@ void WebView::popupContextMenu(const QPoint &pos) {
|
||||||
link_submenu.setIcon(qApp->icons()->fromTheme("text-html"));
|
link_submenu.setIcon(qApp->icons()->fromTheme("text-html"));
|
||||||
|
|
||||||
// Assemble the menu from actions.
|
// Assemble the menu from actions.
|
||||||
|
|
||||||
|
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_actionReload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
context_menu.addAction(m_actionCopySelectedItem);
|
context_menu.addAction(m_actionCopySelectedItem);
|
||||||
|
|
||||||
QUrl hit_url = hit_result.linkUrl();
|
QUrl hit_url = hit_result.linkUrl();
|
||||||
|
@ -209,6 +230,12 @@ void WebView::popupContextMenu(const QPoint &pos) {
|
||||||
context_menu.exec(mapToGlobal(pos));
|
context_menu.exec(mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebView::printCurrentPage() {
|
||||||
|
QPointer<QPrintPreviewDialog> 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) {
|
void WebView::mousePressEvent(QMouseEvent *event) {
|
||||||
if (event->button() & Qt::LeftButton && event->modifiers() & Qt::ControlModifier) {
|
if (event->button() & Qt::LeftButton && event->modifiers() & Qt::ControlModifier) {
|
||||||
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(event->pos());
|
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(event->pos());
|
||||||
|
@ -239,6 +266,7 @@ void WebView::mousePressEvent(QMouseEvent *event) {
|
||||||
void WebView::mouseReleaseEvent(QMouseEvent *event) {
|
void WebView::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
if (event->button() & Qt::MiddleButton) {
|
if (event->button() & Qt::MiddleButton) {
|
||||||
bool are_gestures_enabled = qApp->settings()->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool();
|
bool are_gestures_enabled = qApp->settings()->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool();
|
||||||
|
|
||||||
if (are_gestures_enabled) {
|
if (are_gestures_enabled) {
|
||||||
QPoint release_point = event->pos();
|
QPoint release_point = event->pos();
|
||||||
int left_move = m_gestureOrigin.x() - release_point.x();
|
int left_move = m_gestureOrigin.x() - release_point.x();
|
||||||
|
|
|
@ -68,6 +68,8 @@ class WebView : public QWebView {
|
||||||
// Provides custom context menu.
|
// Provides custom context menu.
|
||||||
void popupContextMenu(const QPoint &pos);
|
void popupContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
|
void printCurrentPage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Initializes all actions.
|
// Initializes all actions.
|
||||||
void initializeActions();
|
void initializeActions();
|
||||||
|
@ -89,6 +91,7 @@ class WebView : public QWebView {
|
||||||
WebPage *m_page;
|
WebPage *m_page;
|
||||||
|
|
||||||
QAction *m_actionReload;
|
QAction *m_actionReload;
|
||||||
|
QAction *m_actionPrint;
|
||||||
QAction *m_actionCopySelectedItem;
|
QAction *m_actionCopySelectedItem;
|
||||||
QAction *m_actionCopyLink;
|
QAction *m_actionCopyLink;
|
||||||
QAction *m_actionCopyImage;
|
QAction *m_actionCopyImage;
|
||||||
|
|
Loading…
Add table
Reference in a new issue