fix some followup stuff in article filtering
This commit is contained in:
parent
ed39e029cd
commit
284f08ae0a
@ -129,9 +129,9 @@ Here is the reference of methods and properties of some types available in your
|
||||
| `Boolean isImportant` | Is message important? |
|
||||
| `Boolean isDeleted` | Is message placed in recycle bin? |
|
||||
| `Boolean isDuplicateWithAttribute(DuplicationAttributeCheck)` | Allows you to test if this particular message is already stored in RSS Guard's DB. |
|
||||
| `Boolean assignLabel(String)` | Assigns label to this message. The passed `String` value is the `customId` property of `Label` type. See its API reference for relevant info. Only works if either `customId` or `id` of this message is valid. |
|
||||
| `Boolean deassignLabel(String)` | Removes label from this message. The passed `String` value is the `customId` property of `Label` type. See its API reference for relevant info. Only works if either `customId` or `id` of this message is valid. |
|
||||
| `Boolean alreadyStoredInDb` | `READ-ONLY` Returns true if this message is already stored in DB. This function is the way to check if the filter is being run automatically for newly downloaded messages or manually for already existing messages.
|
||||
| `Boolean assignLabel(String)` | Assigns label to this message. The passed `String` value is the `customId` property of `Label` type. See its API reference for relevant info. |
|
||||
| `Boolean deassignLabel(String)` | Removes label from this message. The passed `String` value is the `customId` property of `Label` type. See its API reference for relevant info. |
|
||||
| `Boolean runningFilterWhenFetching` | `READ-ONLY` Returns `true` if current run of the message filter is done when message is fetched. Returns `false` if message filter runs manually, for example from `Article filters` window. |
|
||||
|
||||
#### `Label` class
|
||||
| Property/method | Description |
|
||||
|
@ -205,7 +205,8 @@ void FeedDownloader::updateOneFeed(Feed* feed,
|
||||
MessageObject msg_obj(&database,
|
||||
feed->customId(),
|
||||
feed->getParentServiceRoot()->accountId(),
|
||||
feed->getParentServiceRoot()->labelsNode()->labels());
|
||||
feed->getParentServiceRoot()->labelsNode()->labels(),
|
||||
true);
|
||||
|
||||
MessageFilter::initializeFilteringEngine(filter_engine, &msg_obj);
|
||||
|
||||
|
@ -8,11 +8,10 @@
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
|
||||
MessageObject::MessageObject(QSqlDatabase* db, const QString& feed_custom_id,
|
||||
int account_id, QList<Label*> available_labels,
|
||||
QObject* parent)
|
||||
MessageObject::MessageObject(QSqlDatabase* db, const QString& feed_custom_id, int account_id,
|
||||
QList<Label*> available_labels, bool is_new_message, QObject* parent)
|
||||
: QObject(parent), m_db(db), m_feedCustomId(feed_custom_id), m_accountId(account_id), m_message(nullptr),
|
||||
m_availableLabels(available_labels) {}
|
||||
m_availableLabels(available_labels), m_runningAfterFetching(is_new_message) {}
|
||||
|
||||
void MessageObject::setMessage(Message* message) {
|
||||
m_message = message;
|
||||
@ -228,6 +227,6 @@ QList<Label*> MessageObject::availableLabels() const {
|
||||
return m_availableLabels;
|
||||
}
|
||||
|
||||
bool MessageObject::alreadyStoredInDb() const {
|
||||
return m_message->m_id > 0;
|
||||
bool MessageObject::runningFilterWhenFetching() const {
|
||||
return m_runningAfterFetching;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class MessageObject : public QObject {
|
||||
Q_PROPERTY(bool isRead READ isRead WRITE setIsRead)
|
||||
Q_PROPERTY(bool isImportant READ isImportant WRITE setIsImportant)
|
||||
Q_PROPERTY(bool isDeleted READ isDeleted WRITE setIsDeleted)
|
||||
Q_PROPERTY(bool alreadyStoredInDb READ alreadyStoredInDb)
|
||||
Q_PROPERTY(bool runningFilterWhenFetching READ runningFilterWhenFetching)
|
||||
|
||||
public:
|
||||
enum class FilteringAction {
|
||||
@ -61,8 +61,11 @@ class MessageObject : public QObject {
|
||||
|
||||
Q_ENUM(DuplicationAttributeCheck)
|
||||
|
||||
explicit MessageObject(QSqlDatabase* db, const QString& feed_custom_id,
|
||||
int account_id, QList<Label*> available_labels,
|
||||
explicit MessageObject(QSqlDatabase* db,
|
||||
const QString& feed_custom_id,
|
||||
int account_id,
|
||||
QList<Label*> available_labels,
|
||||
bool is_new_message,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
void setMessage(Message* message);
|
||||
@ -84,7 +87,7 @@ class MessageObject : public QObject {
|
||||
QList<Label*> assignedLabels() const;
|
||||
QList<Label*> availableLabels() const;
|
||||
|
||||
bool alreadyStoredInDb() const;
|
||||
bool runningFilterWhenFetching() const;
|
||||
|
||||
// Generic Message's properties bindings.
|
||||
QString feedCustomId() const;
|
||||
@ -126,6 +129,7 @@ class MessageObject : public QObject {
|
||||
int m_accountId;
|
||||
Message* m_message;
|
||||
QList<Label*> m_availableLabels;
|
||||
bool m_runningAfterFetching;
|
||||
};
|
||||
|
||||
inline MessageObject::DuplicationAttributeCheck operator|(MessageObject::DuplicationAttributeCheck lhs,
|
||||
|
@ -226,7 +226,8 @@ void FormMessageFiltersManager::testFilter() {
|
||||
selectedAccount() != nullptr
|
||||
? selectedAccount()->accountId()
|
||||
: NO_PARENT_CATEGORY,
|
||||
selected_fd_cat->getParentServiceRoot()->labelsNode()->labels());
|
||||
selected_fd_cat->getParentServiceRoot()->labelsNode()->labels(),
|
||||
false);
|
||||
auto* fltr = selectedFilter();
|
||||
|
||||
MessageFilter::initializeFilteringEngine(filter_engine, &msg_obj);
|
||||
@ -304,7 +305,8 @@ void FormMessageFiltersManager::processCheckedFeeds() {
|
||||
MessageObject msg_obj(&database,
|
||||
it->customId(),
|
||||
selectedAccount()->accountId(),
|
||||
it->getParentServiceRoot()->labelsNode()->labels());
|
||||
it->getParentServiceRoot()->labelsNode()->labels(),
|
||||
false);
|
||||
|
||||
MessageFilter::initializeFilteringEngine(filter_engine, &msg_obj);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user