|
libfuoten 0.8.2
Qt based library to access the Nextcloud News App API.
|
Abstract article model that provides basic functionalities for Article models. More...
#include <Fuoten/Models/AbstractArticleModel>
Properties | |
| int | bodyLimit |
| Limits the size of the body text in number of characters. | |
| Fuoten::FuotenEnums::Type | parentIdType |
| Defines the type of the parentId. Can be Feed, Folder or All. | |
| bool | starredOnly |
| If true, only starred articles will be returned. | |
| Properties inherited from Fuoten::BaseModel | |
| double | doubleParentId |
| Stores the parent ID as double to make it accesseable from QML. | |
| bool | inOperation |
| Returns true while the model is loading data. | |
| int | limit |
| Limits the result to the specified number of objects. | |
| bool | loaded |
This property holds true if the model has initially loaded the data. | |
| qint64 | parentId |
| Sets the parent database ID to load feeds/items for. | |
| Fuoten::FuotenEnums::SortingRole | sortingRole |
| The role/value used to sort the result. | |
| Qt::SortOrder | sortOrder |
| The sorting order. | |
| Fuoten::AbstractStorage * | storage |
| Pointer to a class derived from AbstractStorage. | |
| bool | unreadOnly |
| If true, only unread articles, feeds or folders are returned. | |
Public Member Functions | |
| AbstractArticleModel (QObject *parent=nullptr) | |
| Constructs a new empty abstract Article model with the given parent. | |
| ~AbstractArticleModel () override | |
| Destroys the AbstractArticleModel object. | |
| int | bodyLimit () const |
| Getter function for the bodyLimit property. | |
| QModelIndex | findByID (qint64 id) const override |
| Returns the model index of the Article identified by id. Returns an invalid index if the ID could not be found in the mode. | |
| QHash< qint64, QModelIndex > | findByIDs (const IdList &ids) const override |
| Returns IDs and model indices of the Article objects in the model identified by their ID in ids. | |
| FuotenEnums::Type | parentIdType () const |
| Getter function for the parentIdType property. | |
| void | setBodyLimit (int nBodyLimit) |
| Setter function for the bodyLimit property. Emits the bodyLimitChanged() signal if nBodyLimit is not equal to the stored value. | |
| void | setParentIdType (FuotenEnums::Type nParentIdType) |
| Setter function for the parentIdType property. Emits the parentIdTypeChanged() signal if nParentIdType is not equal to the stored value. | |
| void | setStarredOnly (bool nStarredOnly) |
| Setter function for the starredOnly property. Emits the starredOnlyChanged() signal if nStarredOnly is not equal to the stored value. | |
| bool | starredOnly () const |
| Getter function for the starredOnly property. | |
| Public Member Functions inherited from Fuoten::BaseModel | |
| BaseModel (QObject *parent=nullptr) | |
| Constructs a new BaseModel object. | |
| ~BaseModel () override | |
| Deconstructs the BaseModel object. | |
| double | doubleParentId () const |
| Returns the currently set parent ID as double. This function is for use in QML, that does not support 64bit integers. It performs a static cast from the saved qint64 parent ID to double. | |
| bool | inOperation () const |
| Returns true while the model is loading data. | |
| int | limit () const |
| Getter function for the limit property. | |
| bool | loaded () const |
| Getter function for the loaded property. *. | |
| qint64 | parentId () const |
| Returns the currently set parent ID. | |
| void | setDoubleParentId (double nDoubleParentId) |
| Sets the parent ID via a double. This function is for use in QML, that does not support 64bit integers. It performs a static cast from the double to a qint64 to save it. | |
| void | setLimit (int nLimit) |
| Setter function for the limit property. Emits the limitChanged() signal if nLimit is not equal to the stored value. | |
| void | setParentId (qint64 nParentId) |
| Set the parent ID. | |
| void | setSortingRole (FuotenEnums::SortingRole nSortingRole) |
| Setter function for the sortingRole property. Emits the sortingRoleChanged() signal if nSortingRole is not equal to the stored value. | |
| void | setSortOrder (Qt::SortOrder nSortOrder) |
| Setter function for the sortOrder property. Emits the sortOrderChanged() signal if nSortOrder is not equal to the stored value. | |
| void | setStorage (AbstractStorage *nStorage) |
| Sets the pointer to the local storage handler. | |
| void | setUnreadOnly (bool nUnreadOnly) |
| Setter function for the unreadOnly property. Emits the unreadOnlyChanged() signal if nUnreadOnly is not equal to the stored value. | |
| FuotenEnums::SortingRole | sortingRole () const |
| Getter function for the sortingRole property. | |
| Qt::SortOrder | sortOrder () const |
| Getter function for the sortOrder property. | |
| AbstractStorage * | storage () const |
| Returns the pointer to the currently set local storage. | |
| bool | unreadOnly () const |
| Getter function for the unreadOnly property. | |
Public Slots | |
| void | load () override |
| Populates the model with data from the local storage. | |
| Public Slots inherited from Fuoten::BaseModel | |
| virtual void | load ()=0 |
| Loads the model data. | |
| virtual void | reload () |
| Reloads the complete model. | |
Signals | |
| void | bodyLimitChanged (int bodyLimit) |
| This is emitted if the value of the bodyLimit property changes. | |
| void | parentIdTypeChanged (FuotenEnums::Type parentIdType) |
| This is emitted if the value of the parentIdType property changes. | |
| void | starredOnlyChanged (bool starredOnly) |
| This is emitted if the value of the starredOnly property changes. | |
| Signals inherited from Fuoten::BaseModel | |
| void | doubleParentIdChanged (double doubleParentId) |
| This signal is emitted if the parent ID changes. | |
| void | inOperationChanged (bool inOperation) |
| This signal is emitted if the operational state of the model changes. | |
| void | limitChanged (int limit) |
| This is emitted if the value of the limit property changes. | |
| void | loadedChanged (bool loaded) |
| This is emitted if the value of the loaded property changes. | |
| void | parentIdChanged (qint64 parentId) |
| This signal is emitted if the parent ID changes. | |
| void | sortingRoleChanged (FuotenEnums::SortingRole sortingRole) |
| This is emitted if the value of the sortingRole property changes. | |
| void | sortOrderChanged (Qt::SortOrder sortOrder) |
| This is emitted if the value of the sortOrder property changes. | |
| void | storageChanged (Fuoten::AbstractStorage *storage) |
| This signal is emitted if the poiner to the local storage changes. | |
| void | unreadOnlyChanged (bool unreadOnly) |
| This is emitted if the value of the unreadOnly property changes. | |
Protected Slots | |
| void | allItemsMarkedRead (qint64 newestItemId) |
| Takes and processes data after all items/articles have been marked as read. | |
| void | allItemsMarkedReadInQueue () |
| Takes and processes data after all items/articles have been marked as read in local queue. | |
| void | feedDeleted (qint64 feedId) |
| Takes and processes data after a feed has been deleted. | |
| void | feedMarkedRead (qint64 feedId, qint64 newestItemId) |
| Takes and processes data after a feed has been marked as read. | |
| void | feedMarkedReadInQueue (qint64 feedId, qint64 newestItemId) |
| Takes and processes data after a feeds has been marked as read in local queue. | |
| void | folderDeleted (qint64 folderId) |
| Takes and processes data after a folder has been deleted. | |
| void | folderMarkedRead (qint64 folderId, qint64 newestItemId) |
| Takes and processses data after a folder has been marked as read. | |
| void | folderMarkedReadInQueue (qint64 folderId, qint64 newestItemId) |
| Takes and processses data after a folder has been marked as read in the queue. | |
| void | itemMarked (qint64 itemId, bool unread) |
| Takes and processes data after an item/article has been marked as read/unread. | |
| void | itemsMarked (const Fuoten::IdList &itemIds, bool unread) |
| Takes and processes data after a list of items/articles has been marked as read/unread. | |
| void | itemsRequested (const Fuoten::IdList &updatedItems, const Fuoten::IdList &newItems, const Fuoten::IdList &deletedItems) |
| Takes and processes data after items/articles have been requested. | |
| void | itemsStarred (const QList< QPair< qint64, QString > > &articles, bool starred) |
| Takes and processes data after a list of items/articles has been starred/unstarred. | |
| void | itemStarred (qint64 feedId, const QString &guidHash, bool starred) |
| Takes and processes data after an item/article has been starred/unstarred. | |
| void | queueCleared () |
| Updates the model after the local queue has been cleared. | |
Protected Member Functions | |
| QList< Article * > | articles () const |
| Returns the list of Article objects in the model. | |
| void | clear () override |
| Clears the model and destroy all Article objects. | |
| void | handleStorageChanged (AbstractStorage *old) override |
| Connets the article related signals of AbstractStorage to the model's slots. | |
| Protected Member Functions inherited from Fuoten::BaseModel | |
| void | setInOperation (bool nInOperation) |
| Sets the inOperation property. | |
| void | setLoaded (bool loaded) |
Set this to true if the model has initially loaded its data. | |
Abstract article model that provides basic functionalities for Article models.
|
readwrite |
Limits the size of the body text in number of characters.
Values lower than 0 will return no body text, 0 will return the full body text, any other positive value will return a body stripped from HTML tags and limited to the amount of characters. Defaults to -1.
| int | bodyLimit() const |
| void | setBodyLimit(int nBodyLimit) |
| void | bodyLimitChanged(int bodyLimit) |
|
readwrite |
Defines the type of the parentId. Can be Feed, Folder or All.
Default: FuotenEnums::All
| FuotenEnums::Type | parentIdType() const |
| void | setParentIdType(FuotenEnums::Type nParentIdType) |
| void | parentIdTypeChanged(FuotenEnums::Type parentIdType) |
|
readwrite |
If true, only starred articles will be returned.
| bool | starredOnly() const |
| void | setStarredOnly(bool nStarredOnly) |
| void | starredOnlyChanged(bool starredOnly) |
|
explicit |
Constructs a new empty abstract Article model with the given parent.
|
override |
Destroys the AbstractArticleModel object.
|
protectedslot |
Takes and processes data after all items/articles have been marked as read.
handleStorageChanged() will connect the AbstractStorage::markedAllItemsRead() signal to this slot.
| newestItemId | highest/newest ID of local available items/articles |
|
protectedslot |
Takes and processes data after all items/articles have been marked as read in local queue.
handleStorageChanged() will connect the AbstractStorage::markedAllItemsReadInQueue() signal to this slot.
Returns the list of Article objects in the model.
| int AbstractArticleModel::bodyLimit | ( | ) | const |
Getter function for the bodyLimit property.
|
signal |
This is emitted if the value of the bodyLimit property changes.
|
overrideprotectedvirtual |
Clears the model and destroy all Article objects.
Implements Fuoten::BaseModel.
|
protectedslot |
Takes and processes data after a feed has been deleted.
handleStorageChanged() will connect the AbstractStorage::deletedFeed() signal to this slot.
| feedId | ID of the feed that has been deleted. |
|
protectedslot |
Takes and processes data after a feed has been marked as read.
handleStorageChanged() will connect the AbstractStorage::markedReadFeed() signal to this slot.
| feedId | ID of the feed that has been marked as read |
| newestItemId | ID of the newest item that has been marked as read |
|
protectedslot |
Takes and processes data after a feeds has been marked as read in local queue.
Will do the same as feedMarkedRead() but will also update the queue property of the article objects.
handleStorageChanged() will connect the AbstractStorage::markedReadFeedInQueue() signal to this slot.
| feedId | ID of the feed that has been marked as read |
| newestItemId | ID of the newest item that has been marked as read |
|
overridevirtual |
Returns the model index of the Article identified by id. Returns an invalid index if the ID could not be found in the mode.
| id | ID of the Article to find in the model |
Reimplemented from Fuoten::BaseModel.
|
overridevirtual |
Returns IDs and model indices of the Article objects in the model identified by their ID in ids.
The key of the returned hash table will contain the ID of the Article, the value will contain the article's model index. Only articles will be returned of that the ID is part of the model.
| ids | list of article IDs to find in the model |
Reimplemented from Fuoten::BaseModel.
|
protectedslot |
Takes and processes data after a folder has been deleted.
handleStorageChanged() will connect the AbstractStorage::deletedFolder() signal to this slots.
| folderId | ID of the folder that has been deleted. |
|
protectedslot |
Takes and processses data after a folder has been marked as read.
handleStorageChanged() will connect the AbstractStorage::markedFolderRead() signal to this slot.
| folderId | ID of the folder that has been marked as read |
| newestItemId | ID of the newest item that has been marked as read |
|
protectedslot |
Takes and processses data after a folder has been marked as read in the queue.
handleStorageChanged() will connect the AbstractStorage::markedReadFolderInQueue() signal to this slots.
| folderId | ID of the folder that has been marked as read |
| newestItemId | ID of the newest item that has been marked as read |
|
overrideprotectedvirtual |
Connets the article related signals of AbstractStorage to the model's slots.
Reimplemented from Fuoten::BaseModel.
|
protectedslot |
Takes and processes data after an item/article has been marked as read/unread.
handleStorageChanged() will connect the AbstractStorage::markedItem() signal to this slot.
| itemId | ID of the article that has been marked as read or unread |
| unread | true if the article has been marked as unread, false if it has been marked as read |
|
protectedslot |
Takes and processes data after a list of items/articles has been marked as read/unread.
handleStorageChanged() will connect the AbstractStorage::markedItems() signal to this slot.
| itemIds | list of IDs of items/articles that have been marked as read/unread |
| unread | true if the items/articles in the list have been marked as unread, false if they have been marked as read |
|
protectedslot |
Takes and processes data after items/articles have been requested.
handleStorageChanged() will connect the AbstractStorage::requestedItems() signal to this slot.
| updatedItems | list of IDs of items that have been updated |
| newItems | list of IDs of items that are new to the local storage |
| deletedItems | list of IDs of items that have benn updated in the local storage |
|
protectedslot |
Takes and processes data after a list of items/articles has been starred/unstarred.
handleStorageChanged() will connect the AbstractStorage::starredItems() signal to this slot.
| articles | list of pairs of feed ID and article/item guid hash of articles that have been starred/unstarred |
| starred | true if the articles in the list have been starred, false if the have been unstarred |
|
protectedslot |
Takes and processes data after an item/article has been starred/unstarred.
handleStorageChanged() will connect the AbstractStorage::starredItem() signal to this slot.
| feedId | ID of the feed the article/item that has been starred/unstarred belongs to |
| guidHash | GUID hash of the article/item that has been starred/unstarred |
| starred | true if the article/item has been starred, false if it has been unstarred |
|
overrideslot |
Populates the model with data from the local storage.
Use AbstractStorage::getArticles() to ge Article objects from the local storage that will be added to the model. If the BaseModel::parentId property is set to a value gerater than -1, only Articles will be loaded that are part of the type defined in AbstractArticleMode::parentIdType.
| FuotenEnums::Type AbstractArticleModel::parentIdType | ( | ) | const |
Getter function for the parentIdType property.
|
signal |
This is emitted if the value of the parentIdType property changes.
|
protectedslot |
Updates the model after the local queue has been cleared.
Will set the Article::queue property of every article in the model to FuotenEnums::NoQueueAction. handleStorageChanged() will connect the AbstractStorage::queueCleared() signal to this slot.
| void AbstractArticleModel::setBodyLimit | ( | int | nBodyLimit | ) |
Setter function for the bodyLimit property. Emits the bodyLimitChanged() signal if nBodyLimit is not equal to the stored value.
| void AbstractArticleModel::setParentIdType | ( | FuotenEnums::Type | nParentIdType | ) |
Setter function for the parentIdType property. Emits the parentIdTypeChanged() signal if nParentIdType is not equal to the stored value.
| void AbstractArticleModel::setStarredOnly | ( | bool | nStarredOnly | ) |
Setter function for the starredOnly property. Emits the starredOnlyChanged() signal if nStarredOnly is not equal to the stored value.
| bool AbstractArticleModel::starredOnly | ( | ) | const |
Getter function for the starredOnly property.
|
signal |
This is emitted if the value of the starredOnly property changes.