diff --git a/configuration/akregator_config_appearance.cpp b/configuration/akregator_config_appearance.cpp index e39ce3e4..2f394817 100644 --- a/configuration/akregator_config_appearance.cpp +++ b/configuration/akregator_config_appearance.cpp @@ -1,77 +1,82 @@ /* This file is part of Akregator. Copyright (c) 2008 Frank Osterfeld This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include "akregator_config_appearance.h" #include "akregatorconfig.h" #include #include #include #include #include using namespace Akregator; K_PLUGIN_CLASS_WITH_JSON(KCMAkregatorAppearanceConfig, "akregator_config_appearance.json") KCMAkregatorAppearanceConfig::KCMAkregatorAppearanceConfig(QWidget *parent, const QVariantList &args) : KCModule(parent, args) , m_widget(new QWidget) { m_ui.setupUi(m_widget); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(m_widget); connect(m_ui.kcfg_UseCustomColors, &QAbstractButton::toggled, m_ui.kcfg_ColorUnreadArticles, &QWidget::setEnabled); connect(m_ui.kcfg_UseCustomColors, &QAbstractButton::toggled, m_ui.kcfg_ColorNewArticles, &QWidget::setEnabled); connect(m_ui.kcfg_UseCustomColors, &QAbstractButton::toggled, m_ui.lbl_newArticles, &QWidget::setEnabled); connect(m_ui.kcfg_UseCustomColors, &QAbstractButton::toggled, m_ui.lbl_unreadArticles, &QWidget::setEnabled); connect(m_ui.slider_minimumFontSize, &QAbstractSlider::valueChanged, m_ui.kcfg_MinimumFontSize, &QSpinBox::setValue); connect(m_ui.slider_mediumFontSize, &QAbstractSlider::valueChanged, m_ui.kcfg_MediumFontSize, &QSpinBox::setValue); + connect(m_ui.slider_zoom, &QAbstractSlider::valueChanged, m_ui.kcfg_Zoom, &QSpinBox::setValue); connect(m_ui.slider_minimumFontSize, &QAbstractSlider::sliderMoved, m_ui.kcfg_MinimumFontSize, &QSpinBox::setValue); connect(m_ui.slider_mediumFontSize, &QAbstractSlider::sliderMoved, m_ui.kcfg_MediumFontSize, &QSpinBox::setValue); + connect(m_ui.slider_zoom, &QAbstractSlider::sliderMoved, m_ui.kcfg_Zoom, &QSpinBox::setValue); connect(m_ui.kcfg_MinimumFontSize, QOverload::of(&KPluralHandlingSpinBox::valueChanged), m_ui.slider_minimumFontSize, &QSlider::setValue); connect(m_ui.kcfg_MediumFontSize, QOverload::of(&KPluralHandlingSpinBox::valueChanged), m_ui.slider_mediumFontSize, &QSlider::setValue); + connect(m_ui.kcfg_Zoom, QOverload::of(&QSpinBox::valueChanged), m_ui.slider_zoom, &QSlider::setValue); KAboutData *about = new KAboutData(QStringLiteral("kcmakrappearanceconfig"), i18n("Configure Feed Reader Appearance"), QString(), QString(), KAboutLicense::GPL, i18n("(c), 2004 - 2008 Frank Osterfeld")); about->addAuthor(i18n("Frank Osterfeld"), QString(), QStringLiteral("osterfeld@kde.org")); setAboutData(about); m_ui.slider_minimumFontSize->setDisabled(Settings::self()->isImmutable(QStringLiteral("MinimumFontSize"))); m_ui.slider_mediumFontSize->setDisabled(Settings::self()->isImmutable(QStringLiteral("MediumFontSize"))); + m_ui.slider_zoom->setDisabled(Settings::self()->isImmutable(QStringLiteral("Zoom"))); m_ui.lbl_MinimumFontSize->setDisabled(Settings::self()->isImmutable(QStringLiteral("MinimumFontSize"))); m_ui.lbl_MediumFontSize->setDisabled(Settings::self()->isImmutable(QStringLiteral("MediumFontSize"))); + m_ui.lbl_Zoom->setDisabled(Settings::self()->isImmutable(QStringLiteral("Zoom"))); addConfig(Settings::self(), m_widget); } #include "akregator_config_appearance.moc" diff --git a/configuration/ui/settings_appearance.ui b/configuration/ui/settings_appearance.ui index 80a9fa3d..ba96fb14 100644 --- a/configuration/ui/settings_appearance.ui +++ b/configuration/ui/settings_appearance.ui @@ -1,303 +1,385 @@ Frank Osterfeld Akregator::SettingsAppearance 0 0 - 389 - 477 + 438 + 538 0 0 0 0 Article List Colors 0 0 0 0 false Unread articles: false 24 24 false New articles: false 24 24 Use custom colors Qt::Horizontal 40 20 Font Size Minimum font size: 0 0 0 0 2 30 8 Qt::Horizontal 3 8 - + Medium font size: - + 0 0 0 0 2 30 12 Qt::Horizontal 3 12 + + + + Zoom: + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 25 + + + 500 + + + 5 + + + 100 + + + Qt::Horizontal + + + QSlider::NoTicks + + + 5 + + + + + + + % + + + 25 + + + 500 + + + 5 + + + 100 + + + + + Fonts Standard font: Fixed font: Serif font: Sans serif font: Qt::Vertical 20 1 KPluralHandlingSpinBox QSpinBox
kpluralhandlingspinbox.h
KColorButton QPushButton
kcolorbutton.h
+ + kcfg_UseCustomColors + kcfg_ColorUnreadArticles + kcfg_ColorNewArticles + slider_minimumFontSize + kcfg_MinimumFontSize + slider_mediumFontSize + kcfg_MediumFontSize + slider_zoom + kcfg_Zoom + kcfg_StandardFont + kcfg_FixedFont + kcfg_SerifFont + kcfg_SansSerifFont +
diff --git a/interfaces/akregator.kcfg b/interfaces/akregator.kcfg index f4a47678..6046a873 100644 --- a/interfaces/akregator.kcfg +++ b/interfaces/akregator.kcfg @@ -1,258 +1,261 @@ Hides feeds with no unread articles false Auto-expand folders containing unread articles false Show Quick Filter Bar true Stores the last status filter setting 0 Stores the last search line text Article display mode. 0 First (usually vertical) splitter widget sizes. 225,650 Second (usually horizontal) splitter widget sizes. 50,350 false false #0000FF #FF0000 5.2 12 8 + + 100 + true keepAllArticles Save an unlimited number of articles. Limit the number of articles in a feed Delete expired articles Do not save any articles Default expiry age for articles in days. 60 Number of articles to keep per feed. 1000 When this option is enabled, articles you marked as important will not be removed when limit the archive size by either age or number of the articles. true Number of concurrent fetches 6 Use the KDE-wide HTML cache settings when downloading feeds, to avoid unnecessary traffic. Disable only when necessary. true This option allows user to specify custom user-agent string instead of using the default one. This is here because some proxies may interrupt the connection because of having "gator" in the name. Fetch feedlist on startup. false Mark all feeds as read on startup. false Fetch all feeds every %1 minutes. true Interval for autofetching in minutes. 30 Specifies if the balloon notifications are used or not. false Specifies if the tray icon is shown or not. true false true Always show the tab bar, even when only one tab is open false Show close buttons on tabs instead of icons false Open a link which would normally open in a new window (external browser) in a new tab instead false Use KDE web browser when opening in external browser. true Use the specified command when opening in external browser. false Command to launch external browser. URL will substitute for %u. firefox %u What the click with left mouse button should do. OpenInInternalBrowser What the click with middle mouse button should do. OpenInExternalBrowser 0 0 metakit Whether to delay before marking an article as read upon selecting it. true Configurable delay between selecting an article and it being marked as read. 0 Resets the quick filter when changing feeds. false diff --git a/src/articleviewer-ng/webengine/articleviewerwebenginepage.cpp b/src/articleviewer-ng/webengine/articleviewerwebenginepage.cpp index d2e0ffe3..dee550c2 100644 --- a/src/articleviewer-ng/webengine/articleviewerwebenginepage.cpp +++ b/src/articleviewer-ng/webengine/articleviewerwebenginepage.cpp @@ -1,65 +1,75 @@ /* Copyright (C) 2015-2018 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "articleviewerwebenginepage.h" #include #include + +#include "akregatorconfig.h" + using namespace Akregator; ArticleViewerWebEnginePage::ArticleViewerWebEnginePage(QWebEngineProfile *profile, QObject *parent) : WebEngineViewer::WebEnginePage(profile, parent) { settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false); settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false); settings()->setAttribute(QWebEngineSettings::AutoLoadImages, true); settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false); settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, false); settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false); settings()->setAttribute(QWebEngineSettings::XSSAuditingEnabled, false); settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, false); settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false); settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); settings()->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled, false); settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false); settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); settings()->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled, false); settings()->setAttribute(QWebEngineSettings::WebGLEnabled, false); connect(this, &QWebEnginePage::featurePermissionRequested, this, &ArticleViewerWebEnginePage::slotFeaturePermissionRequested); + connect(this, &QWebEnginePage::urlChanged, + this, &ArticleViewerWebEnginePage::onUrlChanged); } ArticleViewerWebEnginePage::~ArticleViewerWebEnginePage() { } bool ArticleViewerWebEnginePage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) { Q_UNUSED(type); if (isMainFrame && type == NavigationTypeLinkClicked) { Q_EMIT urlClicked(url); return false; } return true; } void ArticleViewerWebEnginePage::slotFeaturePermissionRequested(const QUrl &url, QWebEnginePage::Feature feature) { //Denied all permissions. setFeaturePermission(url, feature, QWebEnginePage::PermissionDeniedByUser); } + +void ArticleViewerWebEnginePage::onUrlChanged() +{ + setZoomFactor((double)Settings::zoom() / 100.0); +} diff --git a/src/articleviewer-ng/webengine/articleviewerwebenginepage.h b/src/articleviewer-ng/webengine/articleviewerwebenginepage.h index 66cd6483..f7fbfadf 100644 --- a/src/articleviewer-ng/webengine/articleviewerwebenginepage.h +++ b/src/articleviewer-ng/webengine/articleviewerwebenginepage.h @@ -1,42 +1,43 @@ /* Copyright (c) 2015-2018 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef ARTICLEVIEWERWEBENGINEPAGE_H #define ARTICLEVIEWERWEBENGINEPAGE_H #include namespace Akregator { class ArticleViewerWebEnginePage : public WebEngineViewer::WebEnginePage { Q_OBJECT public: explicit ArticleViewerWebEnginePage(QWebEngineProfile *profile, QObject *parent = nullptr); ~ArticleViewerWebEnginePage() override; Q_SIGNALS: void urlClicked(const QUrl &url); protected: bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override; private: void slotFeaturePermissionRequested(const QUrl &url, QWebEnginePage::Feature feature); + void onUrlChanged(); }; } #endif // ARTICLEVIEWERWEBENGINEPAGE_H