diff --git a/localization/rssguard_en.ts b/localization/rssguard_en.ts
index a6fb8d2b2..5bf372bb3 100644
--- a/localization/rssguard_en.ts
+++ b/localization/rssguard_en.ts
@@ -218,27 +218,27 @@ version by clicking this popup notification.
-
+
-
+
-
+
-
+
-
+
@@ -7532,26 +7532,6 @@ Unread news: %2
ToastNotification
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/librssguard/gui/notifications/articlelistnotification.cpp b/src/librssguard/gui/notifications/articlelistnotification.cpp
index 00edc4971..cb899de4f 100644
--- a/src/librssguard/gui/notifications/articlelistnotification.cpp
+++ b/src/librssguard/gui/notifications/articlelistnotification.cpp
@@ -4,6 +4,7 @@
#include "core/articlelistnotificationmodel.h"
#include "miscellaneous/iconfactory.h"
+#include "network-web/webfactory.h"
#include
@@ -19,6 +20,8 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
m_ui.m_btnOpenArticleList->setIcon(qApp->icons()->fromTheme(QSL("view-list-details")));
m_ui.m_btnOpenWebBrowser->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
+ m_ui.m_treeArticles->setModel(m_model);
+
connect(m_model,
&ArticleListNotificationModel::nextPagePossibleChanged,
m_ui.m_btnNextPage,
@@ -29,6 +32,11 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
&PlainToolButton::setEnabled);
connect(m_ui.m_btnNextPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::nextPage);
connect(m_ui.m_btnPreviousPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::previousPage);
+ connect(m_ui.m_btnOpenWebBrowser, &PlainToolButton::clicked, this, &ArticleListNotification::openArticleInWebBrowser);
+ connect(m_ui.m_btnOpenArticleList,
+ &PlainToolButton::clicked,
+ this,
+ &ArticleListNotification::openArticleInArticleList);
connect(m_ui.m_treeArticles->selectionModel(),
&QItemSelectionModel::currentChanged,
this,
@@ -42,7 +50,6 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
pal.setColor(QPalette::ColorRole::Base, Qt::transparent);
m_ui.m_treeArticles->setPalette(pal);
- m_ui.m_treeArticles->setModel(m_model);
connect(m_ui.m_cmbFeeds,
QOverload::of(&QComboBox::currentIndexChanged),
@@ -57,20 +64,44 @@ void ArticleListNotification::loadResults(const QHash>& ne
m_ui.m_lblTitle->setText(tr("%n feeds fetched", nullptr, new_messages.size()));
+ m_ui.m_cmbFeeds->model()->sort(0, Qt::SortOrder::AscendingOrder);
m_ui.m_cmbFeeds->clear();
- for (Feed* fd : new_messages.keys()) {
+ auto ks = new_messages.keys();
+
+ std::sort(ks.begin(), ks.end(), [](Feed* lhs, Feed* rhs) {
+ return QString::compare(lhs->sanitizedTitle(), rhs->sanitizedTitle(), Qt::CaseSensitivity::CaseInsensitive) < 0;
+ });
+
+ for (Feed* fd : ks) {
m_ui.m_cmbFeeds->addItem(fd->sanitizedTitle(), QVariant::fromValue(fd));
}
}
+void ArticleListNotification::openArticleInArticleList() {
+ emit openingArticleInArticleListRequested(m_ui.m_cmbFeeds->currentData().value(), selectedMessage());
+}
+
void ArticleListNotification::onMessageSelected(const QModelIndex& current, const QModelIndex& previous) {
m_ui.m_btnOpenArticleList->setEnabled(current.isValid());
- m_ui.m_btnOpenWebBrowser->setEnabled(current.isValid());
+
+ try {
+ Message msg = selectedMessage();
+
+ m_ui.m_btnOpenWebBrowser->setEnabled(!msg.m_url.isEmpty());
+ }
+ catch (...) {
+ m_ui.m_btnOpenWebBrowser->setEnabled(false);
+ }
}
void ArticleListNotification::showFeed(int index) {
m_model->setArticles(m_newMessages.value(m_ui.m_cmbFeeds->itemData(index).value()));
+ onMessageSelected({}, {});
+}
+
+void ArticleListNotification::openArticleInWebBrowser() {
+ qApp->web()->openUrlInExternalBrowser(selectedMessage().m_url);
}
Message ArticleListNotification::selectedMessage() const {
diff --git a/src/librssguard/gui/notifications/articlelistnotification.h b/src/librssguard/gui/notifications/articlelistnotification.h
index a2774b7f3..cbbeed9a7 100644
--- a/src/librssguard/gui/notifications/articlelistnotification.h
+++ b/src/librssguard/gui/notifications/articlelistnotification.h
@@ -20,9 +20,14 @@ class ArticleListNotification : public BaseToastNotification {
void loadResults(const QHash>& new_messages);
+ signals:
+ void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
+
private slots:
+ void openArticleInArticleList();
void onMessageSelected(const QModelIndex& current, const QModelIndex& previous);
void showFeed(int index);
+ void openArticleInWebBrowser();
private:
Message selectedMessage() const;
diff --git a/src/librssguard/gui/notifications/toastnotification.ui b/src/librssguard/gui/notifications/toastnotification.ui
index 09e3b815b..c2b3731e3 100644
--- a/src/librssguard/gui/notifications/toastnotification.ui
+++ b/src/librssguard/gui/notifications/toastnotification.ui
@@ -39,11 +39,7 @@
-
-
-
- ...
-
-
+
@@ -55,9 +51,6 @@
0
-
- 11
-
Qt::AlignHCenter|Qt::AlignTop
@@ -65,9 +58,6 @@
-
-
- TextLabel
-
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
@@ -79,11 +69,7 @@
-
-
-
-
- PushButton
-
-
+
-