From 7b3e82b48eccc18e640066b5f040f94bee471776 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Tue, 29 Apr 2025 07:29:33 +0200 Subject: [PATCH] #1709 fix --- docs/source/features/filters.md | 1 + src/librssguard/core/messageobject.cpp | 4 ++++ src/librssguard/core/messageobject.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/docs/source/features/filters.md b/docs/source/features/filters.md index 5709b021b..096a53f75 100644 --- a/docs/source/features/filters.md +++ b/docs/source/features/filters.md @@ -68,6 +68,7 @@ Here is the reference documentation of types available for your filtering script | Property | `contents` | `String` | ❌ | ❌ | Contents of the message. | Property | `rawContents` | `String` | ❌ | ❌ | This is the RAW contents of the message obtained from remote service/feed. A raw XML or JSON element data. This attribute has the value only if `runningFilterWhenFetching` returns `true`. In other words, this attribute is not persistently stored in the RSS Guard's DB. Also, this attribute is artificially filled in with ATOM-like data when testing the filter. | Property | `score` | `Number` | ❌ | ❌ | Arbitrary number in range \<0.0, 100.0\>. You can use this number to sort messages in a custom fashion as this attribute also has its own column in articles list. +| Property | `hasEnclosures` | `Boolean` | ✅ | ❌ | Returns `true` if the article has at least one enclosure/attachment. Otherwise returns `false`. | Property | `created` | `Date` | ❌ | ❌ | Date/time of the message. | Property | `isRead` | `Boolean` | ❌ | ✅ | Is message read? | Property | `isImportant` | `Boolean` | ❌ | ✅ | Is message important? diff --git a/src/librssguard/core/messageobject.cpp b/src/librssguard/core/messageobject.cpp index c29979e2e..0cf73e15c 100644 --- a/src/librssguard/core/messageobject.cpp +++ b/src/librssguard/core/messageobject.cpp @@ -341,3 +341,7 @@ QList MessageObject::categories() const { bool MessageObject::runningFilterWhenFetching() const { return m_runningAfterFetching; } + +bool MessageObject::hasEnclosures() const { + return !m_message->m_enclosures.isEmpty(); +} diff --git a/src/librssguard/core/messageobject.h b/src/librssguard/core/messageobject.h index f97cb999e..adcac7604 100644 --- a/src/librssguard/core/messageobject.h +++ b/src/librssguard/core/messageobject.h @@ -16,6 +16,7 @@ class MessageObject : public QObject { Q_PROPERTY(QString feedCustomId READ feedCustomId) Q_PROPERTY(int accountId READ accountId) Q_PROPERTY(int id READ id) + Q_PROPERTY(bool hasEnclosures READ hasEnclosures) Q_PROPERTY(QString customId READ customId WRITE setCustomId) Q_PROPERTY(QString title READ title WRITE setTitle) Q_PROPERTY(QString url READ url WRITE setUrl) @@ -106,6 +107,7 @@ class MessageObject : public QObject { QList categories() const; bool runningFilterWhenFetching() const; + bool hasEnclosures() const; // Generic Message's properties bindings. QString feedCustomId() const;