Skip to content

Commit

Permalink
add only read option to article filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Dec 10, 2024
1 parent 8ebefbf commit 9326418
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions src/librssguard/core/messagesproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions src/librssguard/core/messagesproxymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/librssguard/gui/toolbars/messagestoolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 9326418

Please sign in to comment.