add only read option to article filtering

This commit is contained in:
Martin Rotter 2024-12-10 09:57:14 +01:00
parent 8ebefbfea4
commit 9326418478
4 changed files with 20 additions and 4 deletions

View File

@ -158,6 +158,12 @@ if(NOT OS2)
list(APPEND QT_COMPONENTS Multimedia)
endif()
if(MINGW AND NO_LITE)
message(WARNING "MinGW can only compile lite version of RSS Guard. Switching to it.")
set(NO_LITE OFF)
endif()
if(ENABLE_MEDIAPLAYER_QTMULTIMEDIA AND ENABLE_MEDIAPLAYER_LIBMPV)
message(FATAL_ERROR "You can only enable 1 media player backend.")
endif()

View File

@ -36,6 +36,10 @@ void MessagesProxyModel::initializeFilters() {
return !m_sourceModel->data(msg_row_index, MSG_DB_READ_INDEX, Qt::ItemDataRole::EditRole).toBool();
};
m_filters[MessageListFilter::ShowRead] = [this](int msg_row_index) {
return m_sourceModel->data(msg_row_index, MSG_DB_READ_INDEX, Qt::ItemDataRole::EditRole).toBool();
};
m_filters[MessageListFilter::ShowImportant] = [this](int msg_row_index) {
return m_sourceModel->data(msg_row_index, MSG_DB_IMPORTANT_INDEX, Qt::ItemDataRole::EditRole).toBool();
};
@ -235,8 +239,8 @@ int MessagesProxyModel::additionalArticleId() const {
return m_additionalArticleId;
}
void MessagesProxyModel::setAdditionalArticleId(int newAdditionalArticleId) {
m_additionalArticleId = newAdditionalArticleId;
void MessagesProxyModel::setAdditionalArticleId(int additional_article_id) {
m_additionalArticleId = additional_article_id;
}
void MessagesProxyModel::setMessageListFilter(MessageListFilter filter) {

View File

@ -25,7 +25,8 @@ class MessagesProxyModel : public QSortFilterProxyModel {
ShowThisWeek = 128,
ShowLastWeek = 256,
ShowOnlyWithAttachments = 512,
ShowOnlyWithScore = 1024
ShowOnlyWithScore = 1024,
ShowRead = 2048
};
explicit MessagesProxyModel(MessagesModel* source_model, QObject* parent = nullptr);
@ -53,7 +54,7 @@ class MessagesProxyModel : public QSortFilterProxyModel {
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
int additionalArticleId() const;
void setAdditionalArticleId(int newAdditionalArticleId);
void setAdditionalArticleId(int additional_article_id);
private:
void initializeFilters();

View File

@ -277,6 +277,11 @@ void MessagesToolBar::initializeHighlighter() {
tr("Show unread articles"),
QVariant::fromValue(MessagesProxyModel::MessageListFilter::ShowUnread),
QSL("show_unread"));
addActionToMenu(m_menuMessageFilter,
qApp->icons()->fromTheme(QSL("mail-mark-read")),
tr("Show read articles"),
QVariant::fromValue(MessagesProxyModel::MessageListFilter::ShowRead),
QSL("show_read"));
addActionToMenu(m_menuMessageFilter,
qApp->icons()->fromTheme(QSL("mail-mark-important")),
tr("Show important articles"),