libfuoten 0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
Loading...
Searching...
No Matches
AbstractFeedModel Class Reference

#include <Fuoten/Models/AbstractFeedModel>

Inheritance diagram for AbstractFeedModel:
BaseModel FeedListModel

Public Member Functions

 AbstractFeedModel (QObject *parent=nullptr)
 ~AbstractFeedModel () override
QModelIndex findByID (qint64 id) const override
QHash< qint64, QModelIndex > findByIDs (const IdList &ids) const override
Public Member Functions inherited from BaseModel
 BaseModel (QObject *parent=nullptr)
 ~BaseModel () override
double doubleParentId () const
bool inOperation () const
int limit () const
bool loaded () const
qint64 parentId () const
void setDoubleParentId (double nDoubleParentId)
void setLimit (int nLimit)
void setParentId (qint64 nParentId)
void setSortingRole (FuotenEnums::SortingRole nSortingRole)
void setSortOrder (Qt::SortOrder nSortOrder)
void setStorage (AbstractStorage *nStorage)
void setUnreadOnly (bool nUnreadOnly)
FuotenEnums::SortingRole sortingRole () const
Qt::SortOrder sortOrder () const
AbstractStoragestorage () const
bool unreadOnly () const

Public Slots

void load () override
Public Slots inherited from BaseModel
virtual void load ()=0
virtual void reload ()

Protected Slots

void feedCreated (qint64 id, qint64 folderId)
void feedDeleted (qint64 id)
void feedMarkedRead (qint64 id, qint64 newestItemId)
void feedMoved (qint64 id, qint64 targetFolderId)
void feedRenamed (qint64 id, const QString &newName)
void feedsRequested (const Fuoten::IdList &updatedFeeds, const Fuoten::IdList &newFeeds, const Fuoten::IdList &deletedFeeds)
void folderDeleted (qint64 folderId)
void folderMarkedRead (qint64 folderId, qint64 newestItemId)
void itemMarked (qint64 itemId, bool unread)
void itemsMarked ()
void itemsRquested (const Fuoten::IdList &updatedItems, const Fuoten::IdList &newItems, const Fuoten::IdList &deletedItems)

Protected Member Functions

void clear () override
QList< Feed * > feeds () const
void handleStorageChanged (AbstractStorage *old) override
Protected Member Functions inherited from BaseModel
void setInOperation (bool nInOperation)
void setLoaded (bool loaded)

Additional Inherited Members

Properties inherited from BaseModel
double doubleParentId
bool inOperation
int limit
bool loaded
qint64 parentId
Fuoten::FuotenEnums::SortingRole sortingRole
Qt::SortOrder sortOrder
Fuoten::AbstractStoragestorage
bool unreadOnly
Signals inherited from BaseModel
void doubleParentIdChanged (double doubleParentId)
void inOperationChanged (bool inOperation)
void limitChanged (int limit)
void loadedChanged (bool loaded)
void parentIdChanged (qint64 parentId)
void sortingRoleChanged (FuotenEnums::SortingRole sortingRole)
void sortOrderChanged (Qt::SortOrder sortOrder)
void storageChanged (Fuoten::AbstractStorage *storage)
void unreadOnlyChanged (bool unreadOnly)

Detailed Description

Abstract feed model that provides basic functionalities for Feed models.

Constructor & Destructor Documentation

◆ AbstractFeedModel()

AbstractFeedModel ( QObject * parent = nullptr)
explicit

Constructs a new empty abstract Feed model with the given parent.

◆ ~AbstractFeedModel()

~AbstractFeedModel ( )
override

Destroys the AbstractFeedModel object.

Member Function Documentation

◆ clear()

void clear ( )
overrideprotectedvirtual

Clears the complete model and will destroy all Feed object.

Implements BaseModel.

◆ feedCreated

void feedCreated ( qint64 id,
qint64 folderId )
protectedslot

Takes and processes data after a feed has been created.

handleStorageChanged() will connect the AbstractStorage::createdFeed() signal to this slot.

Parameters
idID of the newly created feed
folderIdID of the folder the newly created feed is part of

◆ feedDeleted

void feedDeleted ( qint64 id)
protectedslot

Takes and processes data after a feed has been deleted.

handleStorageChanged() will connect the AbstractStorage::deletedFeed() signal to this slot.

Parameters
idID of the deleted feed

◆ feedMarkedRead

void feedMarkedRead ( qint64 id,
qint64 newestItemId )
protectedslot

Takes and processes data after a complete feed has been marked as read.

handleStorageChanged() will connect the AbstractStorage::markedReadFeed() and AbstractStorage::markedReadFeedInQueue() signals to this slot.

Parameters
idID of the feed that has been marked as read
newestItemIdunused

◆ feedMoved

void feedMoved ( qint64 id,
qint64 targetFolderId )
protectedslot

Takes and processes data after a feed has been moved to a different folder.

handleStorageChanged() will connect the AbstractStorage::movedFeed() signal to this slot.

Parameters
idID of the moved feed
targetFolderIdID of the folder the feed has been moved to

◆ feedRenamed

void feedRenamed ( qint64 id,
const QString & newName )
protectedslot

Takes and processes data after a feed has been renamed.

handleStorageChanged() will connect the AbstractStorage::renamedFeed() signal to this slot.

Parameters
idID of the renamed feed
newNamenew name for the feed

◆ feeds()

QList< Feed * > feeds ( ) const
protected

Returns the list of Feed objects in the model.

◆ feedsRequested

void feedsRequested ( const Fuoten::IdList & updatedFeeds,
const Fuoten::IdList & newFeeds,
const Fuoten::IdList & deletedFeeds )
protectedslot

Takes and processes data after feeds have been requested.

handleStorageChanged() will connect the AbstractStorage::requestedFeeds() signal to this slot.

Parameters
updatedFeedslist of IDs of feeds that have been updated
newFeedslist of IDs of feeds that are new to the local storage
deletedFeedslist of IDs of feeds that have been deleted in the local storage (and remotely before)

◆ findByID()

QModelIndex findByID ( qint64 id) const
overridevirtual

Returns the model index of the Feed identified by id.

Parameters
idID of the feed to find in the model

Reimplemented from BaseModel.

◆ findByIDs()

QHash< qint64, QModelIndex > findByIDs ( const IdList & ids) const
overridevirtual

Returns IDs and model indices of the Feed objects in the model defined by their ID in ids.

The key of the hash table contains the ID of the Feed, the value will contain the feed's model index. Only feeds will be returned of that the ID is part of the model.

Parameters
idslist of feed IDs to find in the model

Reimplemented from BaseModel.

◆ folderDeleted

void folderDeleted ( qint64 folderId)
protectedslot

Takes and processes data after a folder has been deleted.

handleStorageChanged() will connect the AbstractStorage::deletedFolder() signal to this slot.

Parameters
folderIdID of the folder that has been deleted

◆ folderMarkedRead

void folderMarkedRead ( qint64 folderId,
qint64 newestItemId )
protectedslot

Takes and processes data after a complete folder has been marked as read.

handleStorageChanged() will connect the AbstractStorage::markedReadFolder() and AbstractStorage::markedReadFolderInQueue() signals to this slot.

Parameters
folderIdID of the folder that has been marked as read
newestItemIdunused

◆ handleStorageChanged()

void handleStorageChanged ( Fuoten::AbstractStorage * old)
overrideprotectedvirtual

Connects the feed realted signals of AbstractStorage to the model's slots.

Reimplemented from BaseModel.

◆ itemMarked

void itemMarked ( qint64 itemId,
bool unread )
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.

Parameters
itemIdID of the item that has been marked as read or unread
unreadtrue if the item has been marked as unread, false if it has been marked as read

◆ itemsMarked

void itemsMarked ( )
protectedslot

Should be called after a set of items has been marked as read or unread.

Will update the unreadCount property of all Feed objects in the model.

handleStorageChanged() will connect the following signals to this slot:

◆ itemsRquested

void itemsRquested ( const Fuoten::IdList & updatedItems,
const Fuoten::IdList & newItems,
const Fuoten::IdList & deletedItems )
protectedslot

Takes and processes data after items/articles have been requested/updated.

handleStorageChanged() will connect the AbstractStorage::requestedItems() signal to this slot. The model will reload all feeds in it and will update the unreadCount properties, it will not use the arguments of the slot

◆ load

void load ( )
overrideslot

Populates the model with data from the local storage.

Uses AbstractStorage::getFeeds() to get Feed objects from the local storage that will be added to the model. If the BaseModel::parentId property is set to a value greater than -1, only feeds will be loaded that are part of the folder indentified by the parentId property.