|
libfuoten 0.8.2
Qt based library to access the Nextcloud News App API.
|
Abstract base class for Folder, Feed and Article. More...
#include <Fuoten/BaseItem>
Properties | |
| Fuoten::Error * | error |
Pointer to an Error object, if an error occurred, otherwise returns a nullptr. | |
| qint64 | id |
| Database ID of the Article, Feed or Folder. | |
| bool | inOperation |
| Returns true while there is an operation running on the item. | |
Public Member Functions | |
| BaseItem (QObject *parent=nullptr) | |
| Constructs an empty base item with the given parent. | |
| ~BaseItem () override | |
| Deconstructs the base item. | |
| Q_INVOKABLE void | clearError () |
Removes the current Error object and sets a nullptr. | |
| virtual void | copy (BaseItem *other) |
| Makes a deep copy of other into this object. | |
| Error * | error () const |
Returns a pointer to an Error object, if any error occurred, otherwise a nullptr. | |
| qint64 | id () const |
| Returns the ID of the item. | |
| bool | inOperation () const |
| Returns true while there is some operation ongoing directly on the item. | |
| void | setId (qint64 nId) |
| Sets the database ID of the item/feed/folder. | |
Signals | |
| void | errorChanged (Fuoten::Error *error) |
| This signal will be emitted whenever the error property changes. May return a nullptr. | |
| void | idChanged (qint64 id) |
| This signal will be emitted whenever the id property changes. | |
| void | inOperationChanged (bool inOperation) |
| This signal will be emitted whenever the inOperation property changes. | |
Protected Member Functions | |
| Component * | component () const |
| Returns the pointer to the currently active Component. | |
| void | setComponent (Component *nComp) |
| Sets the API component to perform an internal API request. | |
| void | setError (Error *nError) |
| Sets the Error object of the error property. | |
Abstract base class for Folder, Feed and Article.
Provides some basic properties used by other items. You have to derive this class and implement the pure virtual funtions.
If you are using a class that derives from BaseItem as the content object in a model, do not set the model as parent of the item if you intent to use item internal operations like remove, rename, etc. Setting the model as parent will delete the item when the model will be destructed.
Delete the model items manually in the model's destructor and check for items that are still inOperation(), use QObject::deleteLater() to delete these items so that they can finish the ongoing operation.
|
read |
Pointer to an Error object, if an error occurred, otherwise returns a nullptr.
| Error* | error() const |
| void | errorChanged(Error *error) |
|
read |
Database ID of the Article, Feed or Folder.
| qint64 | id() const |
| void | idChanged(qint64 id) |
|
read |
Returns true while there is an operation running on the item.
This is used for operations that are directly invoked by methods from the item, not from outside classes.
| bool | inOperation() const |
| void | inOperationChanged(bool inOperation) |
|
explicit |
Constructs an empty base item with the given parent.
|
override |
Deconstructs the base item.
| void BaseItem::clearError | ( | ) |
Removes the current Error object and sets a nullptr.
|
protected |
Returns the pointer to the currently active Component.
If no component is active, a nullptr will be returned.
|
virtual |
Makes a deep copy of other into this object.
The default implementation does nothing. When reimplementing, do a qobject_cast to the derived type.
Reimplemented in Fuoten::Article, Fuoten::Feed, and Fuoten::Folder.
| Error * BaseItem::error | ( | ) | const |
Returns a pointer to an Error object, if any error occurred, otherwise a nullptr.
|
signal |
This signal will be emitted whenever the error property changes. May return a nullptr.
| qint64 BaseItem::id | ( | ) | const |
Returns the ID of the item.
|
signal |
This signal will be emitted whenever the id property changes.
| bool BaseItem::inOperation | ( | ) | const |
Returns true while there is some operation ongoing directly on the item.
|
signal |
This signal will be emitted whenever the inOperation property changes.
|
protected |
Sets the API component to perform an internal API request.
This has to be a subclass of Component. Failed requests are handled automatically by connecting to the Component::failed() signal. It will set the BaseItem::error property and will delete the component as well setting the internal pointer to a nullptr.
Handling of succeeded API requests should be handled in the implementation.
|
protected |
| void BaseItem::setId | ( | qint64 | nId | ) |
Sets the database ID of the item/feed/folder.