| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/core/messageobject.h`/ |
| 2 | |
| 3 | #ifndef MESSAGEOBJECT_H |
| 4 | #define MESSAGEOBJECT_Hcxx . . $ `src/librssguard/core/messageobject.h:4:9`! |
| 5 | |
| 6 | #include "services/abstract/label.h"cxx . . $ `<file>/src/librssguard/services/abstract/label.h`/ |
| 7 | |
| 8 | #include <QObject> |
| 9 | |
| 10 | class MessageObjectcxx . . $ MessageObject# : public QObjectcxx . . $ QObject# { |
| 11 | Q_OBJECTcxx . . $ MessageObject#QPrivateSignal# |
| 12 | |
| 13 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QList<MessageCategory> categories READ categories) |
| 14 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QList<Label*> assignedLabels READ assignedLabels) |
| 15 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QList<Label*> availableLabels READ availableLabels) |
| 16 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QString feedCustomId READ feedCustomId) |
| 17 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(int accountId READ accountId) |
| 18 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(int id READ id) |
| 19 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(bool hasEnclosures READ hasEnclosures) |
| 20 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QString customId READ customId WRITE setCustomId) |
| 21 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QString title READ title WRITE setTitle) |
| 22 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QString url READ url WRITE setUrl) |
| 23 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QString author READ author WRITE setAuthor) |
| 24 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QString contents READ contents WRITE setContents) |
| 25 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QString rawContents READ rawContents WRITE setRawContents) |
| 26 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(QDateTime created READ created WRITE setCreated) |
| 27 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(bool createdIsMadeup READ createdIsMadeup WRITE setCreatedIsMadeup) |
| 28 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(double score READ score WRITE setScore) |
| 29 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(bool isRead READ isRead WRITE setIsRead) |
| 30 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(bool isImportant READ isImportant WRITE setIsImportant) |
| 31 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(bool isDeleted READ isDeleted WRITE setIsDeleted) |
| 32 | Q_PROPERTYcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:58:9`!(bool runningFilterWhenFetching READ runningFilterWhenFetching) |
| 33 | |
| 34 | public: |
| 35 | enum class FilteringActioncxx . . $ MessageObject#FilteringAction# { |
| 36 | // Message is normally accepted and stored in DB or updated. |
| 37 | Acceptcxx . . $ MessageObject#FilteringAction#Accept. = 1, |
| 38 | |
| 39 | // Message is ignored and will not be stored in DB but is not purged if it already exists. |
| 40 | Ignorecxx . . $ MessageObject#FilteringAction#Ignore. = 2, |
| 41 | |
| 42 | // Message is purged from DB if it already exists. |
| 43 | Purgecxx . . $ MessageObject#FilteringAction#Purge. = 4 |
| 44 | }; |
| 45 | |
| 46 | Q_ENUMcxx . . $ MessageObject#FilteringAction#(FilteringAction) |
| 47 | |
| 48 | enum class DuplicateCheckcxx . . $ MessageObject#DuplicateCheck# { |
| 49 | // Message with same title in DB. |
| 50 | SameTitlecxx . . $ MessageObject#DuplicateCheck#SameTitle. = 1, |
| 51 | |
| 52 | // Message with same URL in DB. |
| 53 | SameUrlcxx . . $ MessageObject#DuplicateCheck#SameUrl. = 2, |
| 54 | |
| 55 | // Message with same author in DB. |
| 56 | SameAuthorcxx . . $ MessageObject#DuplicateCheck#SameAuthor. = 4, |
| 57 | |
| 58 | // Messages with same creation date in DB. |
| 59 | SameDateCreatedcxx . . $ MessageObject#DuplicateCheck#SameDateCreated. = 8, |
| 60 | |
| 61 | // Compare with all messages from the account not only with messages from same feed. |
| 62 | // Note that this value must be used via bitwise OR with other values, |
| 63 | // for example 2 | 4 | 16. |
| 64 | AllFeedsSameAccountcxx . . $ MessageObject#DuplicateCheck#AllFeedsSameAccount. = 16, |
| 65 | |
| 66 | // Messages with same custom ID as provided by feed/service. |
| 67 | SameCustomIdcxx . . $ MessageObject#DuplicateCheck#SameCustomId. = 32 |
| 68 | }; |
| 69 | |
| 70 | Q_ENUMcxx . . $ MessageObject#DuplicateCheck#(DuplicateCheck) |
| 71 | |
| 72 | explicit MessageObjectcxx . . $ MessageObject#MessageObject(13126ae026653ba1).(QSqlDatabasecxx . . $ QSqlDatabase#* db, |
| 73 | Feedcxx . . $ Feed#* feed, |
| 74 | ServiceRootcxx . . $ ServiceRoot#* account, |
| 75 | bool is_new_message, |
| 76 | QObjectcxx . . $ QObject#* parent = nullptr); |
| 77 | |
| 78 | void setMessagecxx . . $ MessageObject#setMessage(aadc68b38cb9a8b0).(Messagecxx . . $ Message#* message); |
| 79 | |
| 80 | // Check if message is duplicate with another messages in DB. |
| 81 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! bool isAlreadyInDatabasecxx . . $ MessageObject#isAlreadyInDatabase(767b1060289374e5).(MessageObjectcxx . . $ MessageObject#::DuplicateCheckcxx . . $ MessageObject#DuplicateCheck# attribute_check) const; |
| 82 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! bool isDuplicatecxx . . $ MessageObject#isDuplicate(767b1060289374e5).(MessageObjectcxx . . $ MessageObject#::DuplicateCheckcxx . . $ MessageObject#DuplicateCheck# attribute_check) const; |
| 83 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! bool isDuplicateWithAttributecxx . . $ MessageObject#isDuplicateWithAttribute(767b1060289374e5).(MessageObjectcxx . . $ MessageObject#::DuplicateCheckcxx . . $ MessageObject#DuplicateCheck# attribute_check) const; |
| 84 | |
| 85 | // Adds given label to list of assigned labels to this message. |
| 86 | // Returns true if label was assigned now or if the message already has it assigned. |
| 87 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! bool assignLabelcxx . . $ MessageObject#assignLabel(f3b39adf77d9c36c).(const QStringcxx . . $ QString#& label_custom_id) const; |
| 88 | |
| 89 | // Removes given label from list of assigned labels of this message. |
| 90 | // Returns true if label was now removed or if it is not assigned to the message at all. |
| 91 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! bool deassignLabelcxx . . $ MessageObject#deassignLabel(f3b39adf77d9c36c).(const QStringcxx . . $ QString#& label_custom_id) const; |
| 92 | |
| 93 | // Returns label custom ID given label title. |
| 94 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! QStringcxx . . $ QString# findLabelIdcxx . . $ MessageObject#findLabelId(5555d9024dcf93fb).(const QStringcxx . . $ QString#& label_title) const; |
| 95 | |
| 96 | // Returns label custom ID given label title or creates |
| 97 | // the label if it does not exist. |
| 98 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! QStringcxx . . $ QString# createLabelIdcxx . . $ MessageObject#createLabelId(e9cecc7c907e7d19).(const QStringcxx . . $ QString#& title, const QStringcxx . . $ QString#& hex_color =cxx . . $ QString#QString(ced63f7c635d850d). {}); |
| 99 | |
| 100 | // Add multimedia attachment to the message. |
| 101 | Q_INVOKABLEcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:78:9`! void addEnclosurecxx . . $ MessageObject#addEnclosure(b5b78ffdab614c30).(const QStringcxx . . $ QString#& url, const QStringcxx . . $ QString#& mime_type) const; |
| 102 | |
| 103 | // Returns list of assigned and available messages. |
| 104 | QListcxx . . $ QList#<Labelcxx . . $ Label#*> assignedLabelscxx . . $ MessageObject#assignedLabels(fd3f29dd0362ab36).() const; |
| 105 | QListcxx . . $ QList#<Labelcxx . . $ Label#*> availableLabelscxx . . $ MessageObject#availableLabels(fd3f29dd0362ab36).() const; |
| 106 | |
| 107 | QListcxx . . $ QList#<MessageCategorycxx . . $ MessageCategory#> categoriescxx . . $ MessageObject#categories(bbb72f9e9909456).() const; |
| 108 | |
| 109 | bool runningFilterWhenFetchingcxx . . $ MessageObject#runningFilterWhenFetching(50ce9a9e25b4a850).() const; |
| 110 | bool hasEnclosurescxx . . $ MessageObject#hasEnclosures(50ce9a9e25b4a850).() const; |
| 111 | |
| 112 | // Generic Message's properties bindings. |
| 113 | QStringcxx . . $ QString# feedCustomIdcxx . . $ MessageObject#feedCustomId(6ef7b6c27b00b43d).() const; |
| 114 | |
| 115 | int accountIdcxx . . $ MessageObject#accountId(455f465bc33b4cdf).() const; |
| 116 | |
| 117 | QStringcxx . . $ QString# customIdcxx . . $ MessageObject#customId(6ef7b6c27b00b43d).() const; |
| 118 | void setCustomIdcxx . . $ MessageObject#setCustomId(3520e46b33348bf6).(const QStringcxx . . $ QString#& custom_id); |
| 119 | |
| 120 | int idcxx . . $ MessageObject#id(455f465bc33b4cdf).() const; |
| 121 | |
| 122 | QStringcxx . . $ QString# titlecxx . . $ MessageObject#title(6ef7b6c27b00b43d).() const; |
| 123 | void setTitlecxx . . $ MessageObject#setTitle(3520e46b33348bf6).(const QStringcxx . . $ QString#& title); |
| 124 | |
| 125 | QStringcxx . . $ QString# urlcxx . . $ MessageObject#url(6ef7b6c27b00b43d).() const; |
| 126 | void setUrlcxx . . $ MessageObject#setUrl(3520e46b33348bf6).(const QStringcxx . . $ QString#& url); |
| 127 | |
| 128 | QStringcxx . . $ QString# authorcxx . . $ MessageObject#author(6ef7b6c27b00b43d).() const; |
| 129 | void setAuthorcxx . . $ MessageObject#setAuthor(3520e46b33348bf6).(const QStringcxx . . $ QString#& author); |
| 130 | |
| 131 | QStringcxx . . $ QString# contentscxx . . $ MessageObject#contents(6ef7b6c27b00b43d).() const; |
| 132 | void setContentscxx . . $ MessageObject#setContents(3520e46b33348bf6).(const QStringcxx . . $ QString#& contents); |
| 133 | |
| 134 | QStringcxx . . $ QString# rawContentscxx . . $ MessageObject#rawContents(6ef7b6c27b00b43d).() const; |
| 135 | void setRawContentscxx . . $ MessageObject#setRawContents(3520e46b33348bf6).(const QStringcxx . . $ QString#& raw_contents); |
| 136 | |
| 137 | QDateTimecxx . . $ QDateTime# createdcxx . . $ MessageObject#created(4e062b5c490497ac).() const; |
| 138 | void setCreatedcxx . . $ MessageObject#setCreated(3672ecc950120406).(const QDateTimecxx . . $ QDateTime#& created); |
| 139 | |
| 140 | bool createdIsMadeupcxx . . $ MessageObject#createdIsMadeup(50ce9a9e25b4a850).() const; |
| 141 | void setCreatedIsMadeupcxx . . $ MessageObject#setCreatedIsMadeup(b45ddcbc8423892c).(bool madeup); |
| 142 | |
| 143 | bool isReadcxx . . $ MessageObject#isRead(50ce9a9e25b4a850).() const; |
| 144 | void setIsReadcxx . . $ MessageObject#setIsRead(b45ddcbc8423892c).(bool is_read); |
| 145 | |
| 146 | bool isImportantcxx . . $ MessageObject#isImportant(50ce9a9e25b4a850).() const; |
| 147 | void setIsImportantcxx . . $ MessageObject#setIsImportant(b45ddcbc8423892c).(bool is_important); |
| 148 | |
| 149 | bool isDeletedcxx . . $ MessageObject#isDeleted(50ce9a9e25b4a850).() const; |
| 150 | void setIsDeletedcxx . . $ MessageObject#setIsDeleted(b45ddcbc8423892c).(bool is_deleted); |
| 151 | |
| 152 | double scorecxx . . $ MessageObject#score(21b6c25e127938e2).() const; |
| 153 | void setScorecxx . . $ MessageObject#setScore(ba8836b59fb42830).(double score); |
| 154 | |
| 155 | private: |
| 156 | QSqlDatabasecxx . . $ QSqlDatabase#* m_dbcxx . . $ MessageObject#m_db.; |
| 157 | |
| 158 | Feedcxx . . $ Feed#* m_feedcxx . . $ MessageObject#m_feed.; |
| 159 | ServiceRootcxx . . $ ServiceRoot#* m_accountcxx . . $ MessageObject#m_account.; |
| 160 | |
| 161 | QStringcxx . . $ QString# m_feedCustomIdcxx . . $ MessageObject#m_feedCustomId.; |
| 162 | int m_accountIdcxx . . $ MessageObject#m_accountId.; |
| 163 | Messagecxx . . $ Message#* m_messagecxx . . $ MessageObject#m_message.; |
| 164 | QListcxx . . $ QList#<Labelcxx . . $ Label#*> m_availableLabelscxx . . $ MessageObject#m_availableLabels.; |
| 165 | bool m_runningAfterFetchingcxx . . $ MessageObject#m_runningAfterFetching.; |
| 166 | }; |
| 167 | |
| 168 | #endif // MESSAGEOBJECT_H |