| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef LABEL_H |
| 4 | #define LABEL_H |
| 5 | |
| 6 | #include "services/abstract/rootitem.h" |
| 7 | |
| 8 | #include <QColor> |
| 9 | |
| 10 | class RSSGUARD_DLLSPEC Label : public RootItem { |
| 11 | Q_OBJECT |
| 12 | |
| 13 | // Added for message filtering with labels. |
| 14 | Q_PROPERTY(QColor color READ color) |
| 15 | |
| 16 | public: |
| 17 | explicit Label(const QString& name, const QColor& color, RootItem* parent_item = nullptr); |
| 18 | explicit Label(RootItem* parent_item = nullptr); |
| 19 | |
| 20 | QColor color() const; |
| 21 | void setColor(const QColor& color); |
| 22 | |
| 23 | void setCountOfAllMessages(int totalCount); |
| 24 | void setCountOfUnreadMessages(int unreadCount); |
| 25 | |
| 26 | virtual bool cleanMessages(bool clear_only_read); |
| 27 | virtual bool markAsReadUnread(ReadStatus status); |
| 28 | virtual int countOfAllMessages() const; |
| 29 | virtual int countOfUnreadMessages() const; |
| 30 | virtual bool canBeEdited() const; |
| 31 | virtual bool canBeDeleted() const; |
| 32 | virtual bool deleteItem(); |
| 33 | virtual void updateCounts(bool including_total_count); |
| 34 | virtual QList<Message> undeletedMessages() const; |
| 35 | |
| 36 | public slots: |
| 37 | void assignToMessage(const Message& msg, bool reload_model = true); |
| 38 | void deassignFromMessage(const Message& msg, bool reload_model = true); |
| 39 | |
| 40 | private: |
| 41 | QColor m_color; |
| 42 | int m_totalCount{}; |
| 43 | int m_unreadCount{}; |
| 44 | }; |
| 45 | |
| 46 | #endif // LABEL_H |