|
libfuoten 0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
|
#include <Fuoten/Storage/SQLiteStorage>
Public Member Functions | |
| SQLiteStorage (const QString &dbpath, QObject *parent=nullptr) | |
| ~SQLiteStorage () override | |
| void | clearQueue () override |
| Q_INVOKABLE void | clearStorage () override |
| bool | enqueueItem (FuotenEnums::QueueAction action, Article *article) override |
| Q_INVOKABLE bool | enqueueMarkAllItemsRead () override |
| bool | enqueueMarkFeedRead (qint64 feedId, qint64 newestItemId) override |
| bool | enqueueMarkFolderRead (qint64 folderId, qint64 newestItemId) override |
| Article * | getArticle (qint64 id, int bodyLimit=0) override |
| Q_INVOKABLE QString | getArticleBody (qint64 id) override |
| QList< Article * > | getArticles (const QueryArgs &args) override |
| void | getArticlesAsync (const QueryArgs &args) override |
| Feed * | getFeed (qint64 id) override |
| QList< Feed * > | getFeeds (const QueryArgs &args) override |
| QList< Folder * > | getFolders (FuotenEnums::SortingRole sortingRole=FuotenEnums::Name, Qt::SortOrder sortOrder=Qt::AscendingOrder, const IdList &ids=IdList(), FuotenEnums::Type idType=FuotenEnums::Folder, int limit=0) override |
| qint64 | getNewestItemId (FuotenEnums::Type type=FuotenEnums::All, qint64 id=-1) override |
| void | init () override |
| Public Member Functions inherited from AbstractStorage | |
| AbstractStorage (QObject *parent=nullptr) | |
| ~AbstractStorage () override | |
| AbstractConfiguration * | configuration () const |
| Error * | error () const |
| bool | inOperation () const |
| AbstractNotificator * | notificator () const |
| bool | ready () const |
| void | setConfiguration (AbstractConfiguration *nConfiguration) |
| void | setNotificator (AbstractNotificator *notificator) |
| virtual int | starred () const |
| virtual int | totalUnread () const |
Additional Inherited Members | |
| Properties inherited from AbstractStorage | |
| AbstractConfiguration * | configuration |
| Fuoten::Error * | error |
| bool | inOperation |
| Fuoten::AbstractNotificator * | notificator |
| bool | ready |
| int | starred |
| int | totalUnread |
| Public Slots inherited from AbstractStorage | |
| virtual void | allItemsMarkedRead (qint64 newestItemId)=0 |
| virtual void | feedCreated (const QJsonDocument &json)=0 |
| virtual void | feedDeleted (qint64 id)=0 |
| virtual void | feedMarkedRead (qint64 id, qint64 newestItem)=0 |
| virtual void | feedMoved (qint64 id, qint64 targetFolder)=0 |
| virtual void | feedRenamed (qint64 id, const QString &newTitle)=0 |
| virtual void | feedsRequested (const QJsonDocument &json)=0 |
| virtual void | folderCreated (const QJsonDocument &json)=0 |
| virtual void | folderDeleted (qint64 id)=0 |
| virtual void | folderMarkedRead (qint64 id, qint64 newestItem)=0 |
| virtual void | folderRenamed (qint64 id, const QString &newName)=0 |
| virtual void | foldersRequested (const QJsonDocument &json)=0 |
| virtual void | itemMarked (qint64 itemId, bool unread)=0 |
| virtual void | itemsMarked (const Fuoten::IdList &itemIds, bool unread)=0 |
| virtual void | itemsRequested (const QJsonDocument &json)=0 |
| virtual void | itemsStarred (const QList< QPair< qint64, QString > > &articles, bool star)=0 |
| virtual void | itemStarred (qint64 feedId, const QString &guidHash, bool star)=0 |
| Signals inherited from AbstractStorage | |
| void | configurationChanged (Fuoten::AbstractConfiguration *configuration) |
| void | createdFeed (qint64 id, qint64 folderId) |
| void | createdFolder (qint64 id, const QString &name) |
| void | deletedFeed (qint64 id) |
| void | deletedFolder (qint64 id) |
| void | errorChanged (Fuoten::Error *error) |
| void | gotArticlesAsync (const Fuoten::ArticleList &articles) |
| void | inOperationChanged (bool inOperation) |
| void | markedAllItemsRead (qint64 newestItemId) |
| void | markedAllItemsReadInQueue () |
| void | markedItem (qint64 itemId, bool unread) |
| void | markedItems (const Fuoten::IdList &itemIds, bool unread) |
| void | markedReadFeed (qint64 id, qint64 newestItem) |
| void | markedReadFeedInQueue (qint64 feedId, qint64 newestItemId) |
| void | markedReadFolder (qint64 id, qint64 newestItem) |
| void | markedReadFolderInQueue (qint64 folderId, qint64 newestItemId) |
| void | movedFeed (qint64 id, qint64 targetFolder) |
| void | notificatorChanged (Fuoten::AbstractNotificator *notificator) |
| void | queueCleared () |
| void | readyChanged (bool ready) |
| void | renamedFeed (qint64 id, const QString &newName) |
| void | renamedFolder (qint64 id, const QString &newName) |
| void | requestedFeeds (const Fuoten::IdList &updatedFeeds, const Fuoten::IdList &newFeeds, const Fuoten::IdList &deletedFeeds) |
| void | requestedFolders (const QList< QPair< qint64, QString > > &updatedFolders, const QList< QPair< qint64, QString > > &newFolders, const Fuoten::IdList &deletedFolders) |
| void | requestedItems (const Fuoten::IdList &updatedItems, const Fuoten::IdList &newItems, const Fuoten::IdList &deletedItems) |
| void | starredChanged (int starred) |
| void | starredItem (qint64 feedId, const QString &guidHash, bool starred) |
| void | starredItems (const QList< QPair< qint64, QString > > &articles, bool star) |
| void | storageCleared () |
| void | totalUnreadChanged (int totalUnread) |
| Protected Slots inherited from AbstractStorage | |
| virtual void | setStarred (int nStarred) |
| virtual void | setTotalUnread (int nTotalUnread) |
| Protected Member Functions inherited from AbstractStorage | |
| void | notify (AbstractNotificator::Type type, QtMsgType severity, const QVariant &data) const |
| void | notify (const Error *e) const |
| void | setError (Error *nError) |
| void | setInOperation (bool nInOperation) |
| void | setReady (bool nReady) |
Storage using a local SQLite database.
To use this storage, simply set the path to the SQLite database file in the constructor and call init(). The path to the database file will not be created automatically. It has to be created before calling init().
If you want to have a custom storage class, derive from AbstractStorage.
| SQLiteStorage | ( | const QString & | dbpath, |
| QObject * | parent = nullptr ) |
Constructs a new SQLiteStorage object with given dbpath and parent.
|
override |
Deconstructs the SQLiteStorage object.
|
overridevirtual |
Resets the queue column after the queue has been worked.
Reimplemented from AbstractStorage.
|
overridevirtual |
Deletes all local data from the database.
This will clear the local storage and will emit AbstractStorage::storageCleared(). Will also set AbstractConfiguration::setLastSync() to an invalid QDateTime.
Reimplemented from AbstractStorage.
|
overridevirtual |
Enqueues the action for the given article in the local SQLite database.
Will update the queue column in the items table and also will perform the action locally.
| action | the action to be performed on the Article object |
| article | the Article object the action should be performed on |
true if the enqueue was successful, otherwise false Reimplemented from AbstractStorage.
|
overridevirtual |
Adds all local articles that are unread to the queue and marks them as read.
Will update the queue column for every item in the database and will also perform the cation locally. Will emit the AbstractStorage::markedAllItemsReadInQueue() signal on success The action will be performed in a separate thread, so the return value only indicates if the threaded action has been started successfully.
true on success, otherwise false Reimplemented from AbstractStorage.
|
overridevirtual |
Adds all articles older than newestItemId in the feed identified by feedId as read to the local queue.
Will update the queue column for every item in the feed and will also perform the action locally. Will emit the AbstractStorage::markedReadFeedInQueue() signal on success. The action will be performed in a separate thread, so the return value only indicates if the threaded action has been started successfully.
| feedId | ID of the feed to be marked as read |
| newestItemId | ID of the newest item in the feed |
true on success, otherwise false Reimplemented from AbstractStorage.
|
overridevirtual |
Adds all articles older than newestItemId in the folder identified by folderId as read to the local queue.
Will update the queue column for every item in the folder and will also perform the action locally. Will emit the AbstractStorage::markedReadFolderInQueue() signal on success. The action will be performed in a separate thread, so the return value only indicates if the threaded action has been started successfully.
| folderId | ID of the folder to be marked as read |
| newestItemId | ID of the newest item in the folder |
true on success, otherwise false Reimplemented from AbstractStorage.
|
overridevirtual |
Returns the Article identified by id.
Returns a nullptr if the Article can not be found.
Implements AbstractStorage.
|
overridevirtual |
Returns the full body of an Article identified by id.
Implements AbstractStorage.
Returns a list of Article objects from the items table.
Implements AbstractStorage.
|
overridevirtual |
Invokes an asynchronous query for articles in a different thread.
Will emit the AbstractStorage::gotArticlesAsync() signal after the query finished. The signal will contain a list of Article objects. When connecting to this signal, be aware that the objects in the list have been created in a different thread.
| args | query arguments |
Reimplemented from AbstractStorage.
|
overridevirtual |
Returns the Feed identified by id.
Returns a nullptr if the Feed can not be found.
Implements AbstractStorage.
Returns a list of Feed objects from the feeds table.
Implements AbstractStorage.
|
overridevirtual |
Returns a list of Folder objects from the folders table.
Implements AbstractStorage.
|
overridevirtual |
Returns the newest/highest item/article ID fo the given type.
Supported Types: FuotenEnums::Feed, FuotenEnums::Folder, FuotenEnums::All. For folder and feed type a valid id has be provided that identifieds the folder or feed.
If the type does not match one of the supported or if there are not items, -1 is returned.
Implements AbstractStorage.
|
overridevirtual |
Initializes the SQLite database.
This will create/check the table layout.
Implements AbstractStorage.