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
|
||||
m_feedsView->setExpanded(idx_map, true);
|
||||
|
||||
m_feedsView->selectionModel()->select(idx_map,
|
||||
QItemSelectionModel::SelectionFlag::ClearAndSelect |
|
||||
QItemSelectionModel::SelectionFlag::Rows);
|
||||
|
||||
m_feedsView->setCurrentIndex(idx_map);
|
||||
qApp->processEvents();
|
||||
|
||||
auto idx_map_msg = m_messagesView->model()->indexFromMessage(message);
|
||||
|
@ -255,7 +251,6 @@ void FeedMessageViewer::loadMessageToFeedAndArticleList(Feed* feed, const Messag
|
|||
return;
|
||||
}
|
||||
|
||||
// m_messagesView->selectionModel()->select(idx_map_msg, QItemSelectionModel::SelectionFlag::Clear);
|
||||
m_messagesView->setCurrentIndex(idx_map_msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "miscellaneous/iconfactory.h"
|
||||
#include "network-web/webfactory.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QTreeView>
|
||||
|
||||
ArticleListNotification::ArticleListNotification(QWidget* parent)
|
||||
|
@ -16,6 +17,8 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
|
|||
setupHeading(m_ui.m_lblTitle);
|
||||
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_btnPreviousPage->setIcon(qApp->icons()->fromTheme(QSL("arrow-left"), QSL("stock_left")));
|
||||
m_ui.m_btnOpenArticleList->setIcon(qApp->icons()->fromTheme(QSL("view-list-details")));
|
||||
|
@ -112,6 +115,8 @@ void ArticleListNotification::openArticleInWebBrowser() {
|
|||
Message msg = selectedMessage();
|
||||
|
||||
markAsRead(fd, {msg});
|
||||
emit reloadMessageListRequested(false);
|
||||
|
||||
qApp->web()->openUrlInExternalBrowser(msg.m_url);
|
||||
}
|
||||
|
||||
|
@ -119,6 +124,8 @@ void ArticleListNotification::markAllRead() {
|
|||
for (Feed* fd : m_newMessages.keys()) {
|
||||
markAsRead(fd, m_newMessages.value(fd));
|
||||
}
|
||||
|
||||
emit reloadMessageListRequested(false);
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
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:
|
||||
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
|
||||
void reloadMessageListRequested(bool mark_selected_messages_read);
|
||||
|
||||
public:
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||
|
||||
private slots:
|
||||
void openArticleInArticleList();
|
||||
|
|
|
@ -166,6 +166,11 @@ void ToastNotificationsManager::initializeArticleListNotification() {
|
|||
&ArticleListNotification::openingArticleInArticleListRequested,
|
||||
this,
|
||||
&ToastNotificationsManager::openingArticleInArticleListRequested);
|
||||
|
||||
connect(m_articleListNotification,
|
||||
&ArticleListNotification::reloadMessageListRequested,
|
||||
this,
|
||||
&ToastNotificationsManager::reloadMessageListRequested);
|
||||
}
|
||||
|
||||
void ToastNotificationsManager::hookNotification(BaseToastNotification* notif) {
|
||||
|
|
|
@ -51,6 +51,7 @@ class ToastNotificationsManager : public QObject {
|
|||
|
||||
signals:
|
||||
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
|
||||
void reloadMessageListRequested(bool mark_selected_messages_read);
|
||||
|
||||
private:
|
||||
QScreen* activeScreen() const;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "gui/dialogs/formmain.h"
|
||||
#include "gui/feedmessageviewer.h"
|
||||
#include "gui/messagebox.h"
|
||||
#include "gui/messagesview.h"
|
||||
#include "gui/notifications/toastnotificationsmanager.h"
|
||||
#include "gui/toolbars/statusbar.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_skins->loadCurrentSkin();
|
||||
|
||||
if (m_toastNotifications != nullptr) {
|
||||
connect(m_toastNotifications,
|
||||
&ToastNotificationsManager::openingArticleInArticleListRequested,
|
||||
this,
|
||||
&Application::loadMessageToFeedAndArticleList);
|
||||
}
|
||||
|
||||
connect(this, &Application::aboutToQuit, this, &Application::onAboutToQuit);
|
||||
connect(this, &Application::commitDataRequest, this, &Application::onCommitData);
|
||||
connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
|
||||
|
@ -499,9 +507,9 @@ void Application::setMainForm(FormMain* main_form) {
|
|||
|
||||
if (m_toastNotifications != nullptr) {
|
||||
connect(m_toastNotifications,
|
||||
&ToastNotificationsManager::openingArticleInArticleListRequested,
|
||||
m_mainForm->tabWidget()->feedMessageViewer(),
|
||||
&FeedMessageViewer::loadMessageToFeedAndArticleList);
|
||||
&ToastNotificationsManager::reloadMessageListRequested,
|
||||
m_mainForm->tabWidget()->feedMessageViewer()->messagesView(),
|
||||
&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,
|
||||
const GuiMessage& msg,
|
||||
GuiMessageDestination dest,
|
||||
|
|
|
@ -211,6 +211,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
|||
QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void loadMessageToFeedAndArticleList(Feed* feed, const Message& message);
|
||||
void fillCmdArgumentsParser(QCommandLineParser& parser);
|
||||
|
||||
void onNodeJsPackageUpdateError(const QList<NodeJs::PackageMetadata>& pkgs, const QString& error);
|
||||
|
|
Loading…
Add table
Reference in a new issue