notifications can mark all as read

This commit is contained in:
Martin Rotter 2023-10-03 13:38:44 +02:00
parent 66a70ded98
commit 296493daae
4 changed files with 18 additions and 4 deletions

View file

@ -237,8 +237,13 @@ version by clicking this popup notification.</source>
<source>Open article in web browser</source> <source>Open article in web browser</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="141"/>
<source>Mark all articles as read</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes"> <message numerus="yes">
<location filename="../src/librssguard/gui/notifications/articlelistnotification.cpp" line="65"/> <location filename="../src/librssguard/gui/notifications/articlelistnotification.cpp" line="72"/>
<source>%n feeds fetched</source> <source>%n feeds fetched</source>
<translation type="unfinished"> <translation type="unfinished">
<numerusform></numerusform> <numerusform></numerusform>
@ -343,7 +348,7 @@ version by clicking this popup notification.</source>
<context> <context>
<name>BaseToastNotification</name> <name>BaseToastNotification</name>
<message> <message>
<location filename="../src/librssguard/gui/notifications/basetoastnotification.cpp" line="37"/> <location filename="../src/librssguard/gui/notifications/basetoastnotification.cpp" line="41"/>
<source>Close this notification</source> <source>Close this notification</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -5219,7 +5224,7 @@ Feedly is a secure space where you can privately organize and research the topic
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/librssguard/database/databasequeries.cpp" line="2650"/> <location filename="../src/librssguard/database/databasequeries.cpp" line="2657"/>
<source>Cannot insert article filter, because current database cannot return last inserted row ID.</source> <source>Cannot insert article filter, because current database cannot return last inserted row ID.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View file

@ -20,6 +20,7 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
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")));
m_ui.m_btnOpenWebBrowser->setIcon(qApp->icons()->fromTheme(QSL("document-open"))); m_ui.m_btnOpenWebBrowser->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
m_ui.m_btnMarkAllRead->setIcon(qApp->icons()->fromTheme(QSL("mail-mark-read")));
m_ui.m_treeArticles->setModel(m_model); m_ui.m_treeArticles->setModel(m_model);
@ -33,6 +34,7 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
&PlainToolButton::setEnabled); &PlainToolButton::setEnabled);
connect(m_ui.m_btnNextPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::nextPage); 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_btnPreviousPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::previousPage);
connect(m_ui.m_btnMarkAllRead, &PlainToolButton::clicked, this, &ArticleListNotification::markAllRead);
connect(m_ui.m_treeArticles, connect(m_ui.m_treeArticles,
&QAbstractItemView::doubleClicked, &QAbstractItemView::doubleClicked,
this, this,
@ -113,6 +115,12 @@ void ArticleListNotification::openArticleInWebBrowser() {
qApp->web()->openUrlInExternalBrowser(msg.m_url); qApp->web()->openUrlInExternalBrowser(msg.m_url);
} }
void ArticleListNotification::markAllRead() {
for (Feed* fd : m_newMessages.keys()) {
markAsRead(fd, m_newMessages.value(fd));
}
}
void ArticleListNotification::markAsRead(Feed* feed, const QList<Message>& articles) { void ArticleListNotification::markAsRead(Feed* feed, const QList<Message>& articles) {
ServiceRoot* acc = feed->getParentServiceRoot(); ServiceRoot* acc = feed->getParentServiceRoot();
QStringList message_ids; QStringList message_ids;

View file

@ -28,6 +28,7 @@ class ArticleListNotification : public BaseToastNotification {
void onMessageSelected(const QModelIndex& current, const QModelIndex& previous); void onMessageSelected(const QModelIndex& current, const QModelIndex& previous);
void showFeed(int index); void showFeed(int index);
void openArticleInWebBrowser(); void openArticleInWebBrowser();
void markAllRead();
private: private:
void markAsRead(Feed* feed, const QList<Message>& articles); void markAsRead(Feed* feed, const QList<Message>& articles);

View file

@ -138,7 +138,7 @@
<item> <item>
<widget class="PlainToolButton" name="m_btnMarkAllRead"> <widget class="PlainToolButton" name="m_btnMarkAllRead">
<property name="toolTip"> <property name="toolTip">
<string>Open article in article list</string> <string>Mark all articles as read</string>
</property> </property>
</widget> </widget>
</item> </item>