From 8bb9e96a3bd4b538befbfb8894094bef12ffc27a Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 29 Sep 2023 11:16:34 +0200 Subject: [PATCH] Fix crash in notifications. --- README.md | 2 +- docs/source/_static/style.css | 4 ++++ docs/source/_templates/layout.html | 4 ---- docs/source/conf.py | 5 +++++ docs/source/downloads.md | 2 +- docs/source/index.rst | 2 +- docs/source/what.md | 2 +- src/librssguard/core/articlelistnotificationmodel.cpp | 9 ++++++++- .../gui/notifications/articlelistnotification.cpp | 2 +- 9 files changed, 22 insertions(+), 10 deletions(-) delete mode 100644 docs/source/_templates/layout.html diff --git a/README.md b/README.md index 90397044b..6f2439af5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ RSS Guard [![Total downloads](https://img.shields.io/github/downloads/martinrotter/rssguard/total.svg?maxAge=360)](https://somsubhra.github.io/github-release-stats/?username=martinrotter&repository=rssguard&search=0) [![Version](https://img.shields.io/github/release/martinrotter/rssguard.svg?maxAge=360)](https://raw.githubusercontent.com/martinrotter/rssguard/master/resources/text/CHANGELOG) [![Packaging status](https://repology.org/badge/tiny-repos/rssguard.svg)](https://repology.org/project/rssguard/versions) -[![Documentation status](https://readthedocs.org/projects/rssguard/badge/?version=latest)](https://rssguard.readthedocs.io/en/latest/?badge=latest) +[![Documentation status](https://readthedocs.org/projects/rssguard/badge/?version=latest)](https://rssguard.readthedocs.io) [![GitHub issues](https://img.shields.io/github/issues/martinrotter/rssguard.svg?maxAge=360)](https://github.com/martinrotter/rssguard/issues) [![License](https://img.shields.io/github/license/martinrotter/rssguard.svg?maxAge=360000)](https://github.com/martinrotter/rssguard/blob/master/LICENSE.md) diff --git a/docs/source/_static/style.css b/docs/source/_static/style.css index 726fb5238..207241bdd 100644 --- a/docs/source/_static/style.css +++ b/docs/source/_static/style.css @@ -1,3 +1,7 @@ .wy-nav-content { max-width: none !important; +} + +.wy-side-nav-search { + background-color: rgb(250, 166, 136) !important; } \ No newline at end of file diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html deleted file mode 100644 index 7488ec4aa..000000000 --- a/docs/source/_templates/layout.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends "!layout.html" %} -{% block extrahead %} - -{% endblock %} \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 79f73fa2a..ce46577cd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -35,6 +35,7 @@ html_theme_options = { myst_enable_extensions = [ "amsmath", + "attrs_block", "attrs_inline", "colon_fence", "deflist", @@ -50,4 +51,8 @@ myst_enable_extensions = [ "tasklist", ] +html_css_files = [ + 'style.css', +] + myst_heading_anchors = 4 \ No newline at end of file diff --git a/docs/source/downloads.md b/docs/source/downloads.md index 7c0f847ad..51c254f46 100644 --- a/docs/source/downloads.md +++ b/docs/source/downloads.md @@ -4,7 +4,7 @@ Official place to download RSS Guard is at [Github Releases page](https://github RSS Guard is also available in [repositories of many Linux distributions](https://repology.org/project/rssguard/versions), and via [Flathub](https://flathub.org/about). -The are two different flavors: +The are two different [flavors](#features/browseradblock): * [Regular](https://flathub.org/apps/details/io.github.martinrotter.rssguard): Includes an (almost) full-blown integrated web browser (built with `-DUSE_WEBENGINE=ON`). * [Lite](https://flathub.org/apps/details/io.github.martinrotter.rssguardlite): Includes simpler, safer (and less memory hungry integrated web browser (built with `-DUSE_WEBENGINE=OFF`). diff --git a/docs/source/index.rst b/docs/source/index.rst index 12d74dd83..32c0e0e3e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,4 +1,4 @@ -RSS Guards documentation! +RSS Guards Documentation! ========================= .. toctree:: diff --git a/docs/source/what.md b/docs/source/what.md index e88d4eb88..aa7aff41b 100644 --- a/docs/source/what.md +++ b/docs/source/what.md @@ -1,3 +1,3 @@ What is RSS Guard? ================== -RSS Guard is an [open-source](https://en.wikipedia.org/wiki/Open_source) cross-platform multi-protocol desktop feed reader. It is able to fetch feeds in RSS/RDF/ATOM/JSON formats and connect to multiple web-based feed readers. RSS Guard is developed on top of the [Qt library](http://qt-project.org). \ No newline at end of file +RSS Guard is an [open-source](https://en.wikipedia.org/wiki/Open_source) [cross-platform](#supported-os) [multi-protocol](#supported-readers) desktop feed reader. It is able to fetch feeds in RSS/RDF/ATOM/JSON formats and connect to multiple web-based feed readers. RSS Guard is developed on top of the [Qt library](http://qt-project.org). \ No newline at end of file diff --git a/src/librssguard/core/articlelistnotificationmodel.cpp b/src/librssguard/core/articlelistnotificationmodel.cpp index 09a4a7194..22a68a3b5 100644 --- a/src/librssguard/core/articlelistnotificationmodel.cpp +++ b/src/librssguard/core/articlelistnotificationmodel.cpp @@ -3,6 +3,7 @@ #include "core/articlelistnotificationmodel.h" #include "definitions/definitions.h" +#include "exceptions/applicationexception.h" ArticleListNotificationModel::ArticleListNotificationModel(QObject* parent) : QAbstractListModel(parent), m_currentPage(-1) {} @@ -19,7 +20,13 @@ void ArticleListNotificationModel::setArticles(const QList& msgs) { } Message ArticleListNotificationModel::message(const QModelIndex& idx) const { - return m_articles.at((m_currentPage * NOTIFICATIONS_PAGE_SIZE) + idx.row()); + int list_position = (m_currentPage * NOTIFICATIONS_PAGE_SIZE) + idx.row(); + + if (list_position < 0 || list_position >= m_articles.size()) { + throw ApplicationException(QSL("message cannot be loaded, wrong index")); + } + + return m_articles.at(list_position); } void ArticleListNotificationModel::nextPage() { diff --git a/src/librssguard/gui/notifications/articlelistnotification.cpp b/src/librssguard/gui/notifications/articlelistnotification.cpp index eee373bb7..8ce9f64a2 100644 --- a/src/librssguard/gui/notifications/articlelistnotification.cpp +++ b/src/librssguard/gui/notifications/articlelistnotification.cpp @@ -113,6 +113,6 @@ Message ArticleListNotification::selectedMessage() const { return m_model->message(m_ui.m_treeArticles->currentIndex()); } else { - throw ApplicationException("message cannot be loaded, wrong index"); + throw ApplicationException(QSL("message cannot be loaded, wrong index")); } }