reaload article list when doing some ops in list notification, also react to middle button
This commit is contained in:
parent
d37b830a82
commit
4998f6f7cb
7 changed files with 45 additions and 9 deletions
|
@ -236,11 +236,7 @@ void FeedMessageViewer::loadMessageToFeedAndArticleList(Feed* feed, const Messag
|
||||||
|
|
||||||
// TODO: expand properly
|
// TODO: expand properly
|
||||||
m_feedsView->setExpanded(idx_map, true);
|
m_feedsView->setExpanded(idx_map, true);
|
||||||
|
m_feedsView->setCurrentIndex(idx_map);
|
||||||
m_feedsView->selectionModel()->select(idx_map,
|
|
||||||
QItemSelectionModel::SelectionFlag::ClearAndSelect |
|
|
||||||
QItemSelectionModel::SelectionFlag::Rows);
|
|
||||||
|
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
|
||||||
auto idx_map_msg = m_messagesView->model()->indexFromMessage(message);
|
auto idx_map_msg = m_messagesView->model()->indexFromMessage(message);
|
||||||
|
@ -255,7 +251,6 @@ void FeedMessageViewer::loadMessageToFeedAndArticleList(Feed* feed, const Messag
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_messagesView->selectionModel()->select(idx_map_msg, QItemSelectionModel::SelectionFlag::Clear);
|
|
||||||
m_messagesView->setCurrentIndex(idx_map_msg);
|
m_messagesView->setCurrentIndex(idx_map_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "miscellaneous/iconfactory.h"
|
#include "miscellaneous/iconfactory.h"
|
||||||
#include "network-web/webfactory.h"
|
#include "network-web/webfactory.h"
|
||||||
|
|
||||||
|
#include <QMouseEvent>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
ArticleListNotification::ArticleListNotification(QWidget* parent)
|
ArticleListNotification::ArticleListNotification(QWidget* parent)
|
||||||
|
@ -16,6 +17,8 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
|
||||||
setupHeading(m_ui.m_lblTitle);
|
setupHeading(m_ui.m_lblTitle);
|
||||||
setupCloseButton(m_ui.m_btnClose);
|
setupCloseButton(m_ui.m_btnClose);
|
||||||
|
|
||||||
|
m_ui.m_treeArticles->viewport()->installEventFilter(this);
|
||||||
|
|
||||||
m_ui.m_btnNextPage->setIcon(qApp->icons()->fromTheme(QSL("arrow-right"), QSL("stock_right")));
|
m_ui.m_btnNextPage->setIcon(qApp->icons()->fromTheme(QSL("arrow-right"), QSL("stock_right")));
|
||||||
m_ui.m_btnPreviousPage->setIcon(qApp->icons()->fromTheme(QSL("arrow-left"), QSL("stock_left")));
|
m_ui.m_btnPreviousPage->setIcon(qApp->icons()->fromTheme(QSL("arrow-left"), QSL("stock_left")));
|
||||||
m_ui.m_btnOpenArticleList->setIcon(qApp->icons()->fromTheme(QSL("view-list-details")));
|
m_ui.m_btnOpenArticleList->setIcon(qApp->icons()->fromTheme(QSL("view-list-details")));
|
||||||
|
@ -112,6 +115,8 @@ void ArticleListNotification::openArticleInWebBrowser() {
|
||||||
Message msg = selectedMessage();
|
Message msg = selectedMessage();
|
||||||
|
|
||||||
markAsRead(fd, {msg});
|
markAsRead(fd, {msg});
|
||||||
|
emit reloadMessageListRequested(false);
|
||||||
|
|
||||||
qApp->web()->openUrlInExternalBrowser(msg.m_url);
|
qApp->web()->openUrlInExternalBrowser(msg.m_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +124,8 @@ void ArticleListNotification::markAllRead() {
|
||||||
for (Feed* fd : m_newMessages.keys()) {
|
for (Feed* fd : m_newMessages.keys()) {
|
||||||
markAsRead(fd, m_newMessages.value(fd));
|
markAsRead(fd, m_newMessages.value(fd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit reloadMessageListRequested(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleListNotification::markAsRead(Feed* feed, const QList<Message>& articles) {
|
void ArticleListNotification::markAsRead(Feed* feed, const QList<Message>& articles) {
|
||||||
|
@ -157,3 +164,13 @@ Message ArticleListNotification::selectedMessage() const {
|
||||||
throw ApplicationException(QSL("message cannot be loaded, wrong index"));
|
throw ApplicationException(QSL("message cannot be loaded, wrong index"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ArticleListNotification::eventFilter(QObject* watched, QEvent* event) {
|
||||||
|
if (event->type() == QEvent::Type::MouseButtonRelease) {
|
||||||
|
if (dynamic_cast<QMouseEvent*>(event)->button() == Qt::MouseButton::MiddleButton) {
|
||||||
|
openArticleInArticleList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return BaseToastNotification::eventFilter(watched, event);
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,10 @@ class ArticleListNotification : public BaseToastNotification {
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
|
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
|
||||||
|
void reloadMessageListRequested(bool mark_selected_messages_read);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openArticleInArticleList();
|
void openArticleInArticleList();
|
||||||
|
|
|
@ -166,6 +166,11 @@ void ToastNotificationsManager::initializeArticleListNotification() {
|
||||||
&ArticleListNotification::openingArticleInArticleListRequested,
|
&ArticleListNotification::openingArticleInArticleListRequested,
|
||||||
this,
|
this,
|
||||||
&ToastNotificationsManager::openingArticleInArticleListRequested);
|
&ToastNotificationsManager::openingArticleInArticleListRequested);
|
||||||
|
|
||||||
|
connect(m_articleListNotification,
|
||||||
|
&ArticleListNotification::reloadMessageListRequested,
|
||||||
|
this,
|
||||||
|
&ToastNotificationsManager::reloadMessageListRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToastNotificationsManager::hookNotification(BaseToastNotification* notif) {
|
void ToastNotificationsManager::hookNotification(BaseToastNotification* notif) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ class ToastNotificationsManager : public QObject {
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
|
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
|
||||||
|
void reloadMessageListRequested(bool mark_selected_messages_read);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScreen* activeScreen() const;
|
QScreen* activeScreen() const;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "gui/dialogs/formmain.h"
|
#include "gui/dialogs/formmain.h"
|
||||||
#include "gui/feedmessageviewer.h"
|
#include "gui/feedmessageviewer.h"
|
||||||
#include "gui/messagebox.h"
|
#include "gui/messagebox.h"
|
||||||
|
#include "gui/messagesview.h"
|
||||||
#include "gui/notifications/toastnotificationsmanager.h"
|
#include "gui/notifications/toastnotificationsmanager.h"
|
||||||
#include "gui/toolbars/statusbar.h"
|
#include "gui/toolbars/statusbar.h"
|
||||||
#include "gui/webviewers/qtextbrowser/textbrowserviewer.h"
|
#include "gui/webviewers/qtextbrowser/textbrowserviewer.h"
|
||||||
|
@ -157,6 +158,13 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
|
||||||
m_icons->loadCurrentIconTheme();
|
m_icons->loadCurrentIconTheme();
|
||||||
m_skins->loadCurrentSkin();
|
m_skins->loadCurrentSkin();
|
||||||
|
|
||||||
|
if (m_toastNotifications != nullptr) {
|
||||||
|
connect(m_toastNotifications,
|
||||||
|
&ToastNotificationsManager::openingArticleInArticleListRequested,
|
||||||
|
this,
|
||||||
|
&Application::loadMessageToFeedAndArticleList);
|
||||||
|
}
|
||||||
|
|
||||||
connect(this, &Application::aboutToQuit, this, &Application::onAboutToQuit);
|
connect(this, &Application::aboutToQuit, this, &Application::onAboutToQuit);
|
||||||
connect(this, &Application::commitDataRequest, this, &Application::onCommitData);
|
connect(this, &Application::commitDataRequest, this, &Application::onCommitData);
|
||||||
connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
|
connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
|
||||||
|
@ -499,9 +507,9 @@ void Application::setMainForm(FormMain* main_form) {
|
||||||
|
|
||||||
if (m_toastNotifications != nullptr) {
|
if (m_toastNotifications != nullptr) {
|
||||||
connect(m_toastNotifications,
|
connect(m_toastNotifications,
|
||||||
&ToastNotificationsManager::openingArticleInArticleListRequested,
|
&ToastNotificationsManager::reloadMessageListRequested,
|
||||||
m_mainForm->tabWidget()->feedMessageViewer(),
|
m_mainForm->tabWidget()->feedMessageViewer()->messagesView(),
|
||||||
&FeedMessageViewer::loadMessageToFeedAndArticleList);
|
&MessagesView::reloadSelections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,6 +759,11 @@ void Application::showGuiMessageCore(Notification::Event event,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::loadMessageToFeedAndArticleList(Feed* feed, const Message& message) {
|
||||||
|
m_mainForm->display();
|
||||||
|
m_mainForm->tabWidget()->feedMessageViewer()->loadMessageToFeedAndArticleList(feed, message);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::showGuiMessage(Notification::Event event,
|
void Application::showGuiMessage(Notification::Event event,
|
||||||
const GuiMessage& msg,
|
const GuiMessage& msg,
|
||||||
GuiMessageDestination dest,
|
GuiMessageDestination dest,
|
||||||
|
|
|
@ -211,6 +211,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||||
QWidget* parent = nullptr);
|
QWidget* parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void loadMessageToFeedAndArticleList(Feed* feed, const Message& message);
|
||||||
void fillCmdArgumentsParser(QCommandLineParser& parser);
|
void fillCmdArgumentsParser(QCommandLineParser& parser);
|
||||||
|
|
||||||
void onNodeJsPackageUpdateError(const QList<NodeJs::PackageMetadata>& pkgs, const QString& error);
|
void onNodeJsPackageUpdateError(const QList<NodeJs::PackageMetadata>& pkgs, const QString& error);
|
||||||
|
|
Loading…
Add table
Reference in a new issue