libfuoten 0.8.2
Qt based library to access the Nextcloud News App API.
Loading...
Searching...
No Matches
Fuoten::AbstractConfiguration Class Referenceabstract

Server and authentication settings abstract base class. More...

#include <Fuoten/Helpers/AbstractConfiguration>

Inheritance diagram for Fuoten::AbstractConfiguration:
QObject

Public Member Functions

 AbstractConfiguration (QObject *parent=nullptr)
 Constructs a new AbstractConfiguration object with the given parent.
 ~AbstractConfiguration () override
 Destroys the AbstractConfiguration object.
virtual Q_INVOKABLE void deleteAccount ()
 Deletes all local account data.
virtual QString getHost () const =0
 Returns the host the ownCloud/Nextcloud is installed on.
virtual bool getIgnoreSSLErrors () const
 Returns true if SSL/TLS errors should be ignored.
virtual QString getInstallPath () const =0
 Returns the optional installation path of the ownCloud/Nextcloud on the server.
virtual QDateTime getLastSync () const
 Returns the last date and time in UTC a successful snychronization has been performed.
virtual Q_INVOKABLE QString getLoginFlowUserAgent () const
 Returns a user agent string usable for the login flow.
virtual QString getPassword () const =0
 Returns the password used for authentiction.
virtual FuotenEnums::ItemDeletionStrategy getPerFeedDeletionStrategy (qint64 feedId) const
 Returns the item deletion strategy for the feed identified by feedId.
virtual quint16 getPerFeedDeletionValue (qint64 feedId) const
 Returns the deletion value for the feed identified by feedId.
virtual int getServerPort () const
 Returns the server port used for the connection.
virtual QString getUserAgent () const
 Returns the user agent to send as request header.
virtual QString getUsername () const =0
 Returns the user name used for authentication.
virtual bool getUseSSL () const
 Returns true if the connection should use SSL/TLS.
virtual bool isAccountValid () const =0
 Returns true if the account data is valid.
virtual void setHost (const QString &host)
 Sets the host the remote Nextcloud instance runs on.
virtual void setInstallPath (const QString &path)
 Sets the path under which the remote Nextcloud instance is installed.
virtual void setLastSync (const QDateTime &syncTime)
 Sets the data and time in UTC the last successfule synchronization has been performed.
virtual void setPassword (const QString &password)
 Sets the password used for authentication.
virtual void setServerPort (int port)
 Sets the server port used for the connection.
virtual void setUsername (const QString &username)
 Sets the username used for authentication.
virtual void setUseSSL (bool useSSL)
 Set useSSL to true to let the connection use SSL/TLS.

Public Slots

bool setLoginFlowCredentials (const QByteArray &credentials)
 Sets the login credentials requested from the login flow v2 API and returns true on success.
bool setLoginFlowCredentials (const QJsonDocument &credentials)
 Sets the login credentials requested from the login flow v2 API and returns true on success.
bool setLoginFlowCredentials (const QJsonObject &credentials)
 Sets the login credentials requested from the login flow v2 API and returns true on success.
virtual bool setLoginFlowCredentials (const QUrl &credentialUrl)
 Sets login credentials requested from the login flow API and returns true on success.
bool setServerUrl (const QString &url)
 Sets the server data via url and returns true on success, otherwise false.
bool setServerUrl (const QUrl &url)
 Sets the server data via url and returns true on success, otherwise false.

Signals

void accountDeleted ()
 Emitted when the account data has been deleted.

Protected Member Functions

void checkAccountValidity ()
 Performs a simple check on the important account data.
virtual void setIsAccountValid (bool nIsAccountValid)=0
 Set to true if the account data is valid.

Detailed Description

Server and authentication settings abstract base class.

In order to use libfuoten, you have to reimplement this class, especially all pure virtual functions that provide the necessary data to perform API requests.

The reimplemented class will than be used on all API call classes. All of the API classes have a configuration property that takes subclasses of AbstractConfiguration.

Constructor & Destructor Documentation

◆ AbstractConfiguration()

AbstractConfiguration::AbstractConfiguration ( QObject * parent = nullptr)
explicit

Constructs a new AbstractConfiguration object with the given parent.

◆ ~AbstractConfiguration()

AbstractConfiguration::~AbstractConfiguration ( )
override

Destroys the AbstractConfiguration object.

Member Function Documentation

◆ accountDeleted

void Fuoten::AbstractConfiguration::accountDeleted ( )
signal

Emitted when the account data has been deleted.

Emit this signal in your implementation of deleteAccount() after the account data has been deleted.

◆ checkAccountValidity()

void AbstractConfiguration::checkAccountValidity ( )
protected

Performs a simple check on the important account data.

This will check if username, password and host are not empty. You can use this function to set the account validity. The result of the check will be set to setIsAccountValid().

See also
setIsAccountValid(), isAccountValid()

◆ deleteAccount()

void AbstractConfiguration::deleteAccount ( )
virtual

Deletes all local account data.

Reimplement this to delete the configuration entries for username, password, host, path, port and current verion. Make sure to emit the accountDelted() signal after deleting the data. The default version does nothing.

◆ getHost()

virtual QString Fuoten::AbstractConfiguration::getHost ( ) const
pure virtual

Returns the host the ownCloud/Nextcloud is installed on.

Reimplement this function in a subclass.

◆ getIgnoreSSLErrors()

bool AbstractConfiguration::getIgnoreSSLErrors ( ) const
virtual

Returns true if SSL/TLS errors should be ignored.

The default implementation returns false.

◆ getInstallPath()

virtual QString Fuoten::AbstractConfiguration::getInstallPath ( ) const
pure virtual

Returns the optional installation path of the ownCloud/Nextcloud on the server.

Reimplement this function in a subclass.

◆ getLastSync()

QDateTime AbstractConfiguration::getLastSync ( ) const
virtual

Returns the last date and time in UTC a successful snychronization has been performed.

Reimplement this in a subclass if you want let the Synchronizer save the last sync time. The default implementation returns a invalid QDateTime. Your implementation should also return an invalid QDateTime if there has been no last sync.

See also
setLastSync()

◆ getLoginFlowUserAgent()

QString AbstractConfiguration::getLoginFlowUserAgent ( ) const
virtual

Returns a user agent string usable for the login flow.

In the login flow API, the user agent is used to show the user the application that requests a new application password and will also be used for the identifier of the generated application password.

See also https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html

Reimplement this in a subclass. The default implementation simply returns the same as getUserAgent(), the string "Libfuoten $VERSION" and that is not really meaningful to a user.

Since
0.8.0
Returns
user agent string

◆ getPassword()

virtual QString Fuoten::AbstractConfiguration::getPassword ( ) const
pure virtual

Returns the password used for authentiction.

Reimplement this function in a subclass.

◆ getPerFeedDeletionStrategy()

FuotenEnums::ItemDeletionStrategy AbstractConfiguration::getPerFeedDeletionStrategy ( qint64 feedId) const
virtual

Returns the item deletion strategy for the feed identified by feedId.

The default implementation returns FuotenEnums::NoItemDeletion.

Parameters
feedIdID of the feed to get the deletion strategy for

◆ getPerFeedDeletionValue()

quint16 AbstractConfiguration::getPerFeedDeletionValue ( qint64 feedId) const
virtual

Returns the deletion value for the feed identified by feedId.

If getPerFeedDeletionStrategy() returns FuotenEnums::DeleteItemsByTime, the returned value should be treated as older than n days. If for example 5 is returned, all items in the feed that are older than 5 days should be removed. Reference time should be the publication time.

If getPerFeedDeletionStrategy() return FuotenEnums::DeleteItemsByCount, the returned value should be treated as numer of items in the feed to keep. If for example 200 is returned, so many items should be deleted that after the deletion the feed contains 200 items.

The default implementation returns 0.

Parameters
feedIdID of the feed to get the deletion value for

◆ getServerPort()

int AbstractConfiguration::getServerPort ( ) const
virtual

Returns the server port used for the connection.

The default implementation returns 0, what means that the connection should use the default port for HTTP or HTTPS.

◆ getUserAgent()

QString AbstractConfiguration::getUserAgent ( ) const
virtual

Returns the user agent to send as request header.

The default implementation returns "Libfuoten VERSION"

◆ getUsername()

virtual QString Fuoten::AbstractConfiguration::getUsername ( ) const
pure virtual

Returns the user name used for authentication.

Reimplement this function in a subclass.

◆ getUseSSL()

bool AbstractConfiguration::getUseSSL ( ) const
virtual

Returns true if the connection should use SSL/TLS.

The default implementation returns true.

◆ isAccountValid()

virtual bool Fuoten::AbstractConfiguration::isAccountValid ( ) const
pure virtual

Returns true if the account data is valid.

Reimplement this function in a subclass. You can use checkAccountValidity() to perform a simple check if the important values are not empty.

See also
setIsAccountValid(), checkAccountValidity()

◆ setHost()

void AbstractConfiguration::setHost ( const QString & host)
virtual

Sets the host the remote Nextcloud instance runs on.

Reimplement this in a subclass. The default implementation does nothing.

◆ setInstallPath()

void AbstractConfiguration::setInstallPath ( const QString & path)
virtual

Sets the path under which the remote Nextcloud instance is installed.

Reimplement this in a subclass. The default implementation does nothing.

◆ setIsAccountValid()

virtual void Fuoten::AbstractConfiguration::setIsAccountValid ( bool nIsAccountValid)
protectedpure virtual

Set to true if the account data is valid.

Reimplement this in a subclass. You can use checkAccountValidity() to perform a simple check if the important data is not empty.

See also
isAccountValid(), checkAccountValidity()

◆ setLastSync()

void AbstractConfiguration::setLastSync ( const QDateTime & syncTime)
virtual

Sets the data and time in UTC the last successfule synchronization has been performed.

Reimplement this in a subclass if you want let the Synchronizer save the last sync time. The default implementation does nothing.

See also
getLastSync()
Parameters
syncTimethe date and time the last/current synchronization has successfully finished

◆ setLoginFlowCredentials [1/4]

bool AbstractConfiguration::setLoginFlowCredentials ( const QByteArray & credentials)
slot

Sets the login credentials requested from the login flow v2 API and returns true on success.

This has to be a valid JSON object requested from the polling endpoint. See also https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html

Since
0.8.0

◆ setLoginFlowCredentials [2/4]

bool AbstractConfiguration::setLoginFlowCredentials ( const QJsonDocument & credentials)
slot

Sets the login credentials requested from the login flow v2 API and returns true on success.

This has to be a valid JSON object requested from the polling endpoint. See also https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html

Since
0.8.0

◆ setLoginFlowCredentials [3/4]

bool AbstractConfiguration::setLoginFlowCredentials ( const QJsonObject & credentials)
slot

Sets the login credentials requested from the login flow v2 API and returns true on success.

This has to be a valid JSON object requested from the polling endpoint. See also https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html

Since
0.8.0

◆ setLoginFlowCredentials [4/4]

bool AbstractConfiguration::setLoginFlowCredentials ( const QUrl & credentialUrl)
virtualslot

Sets login credentials requested from the login flow API and returns true on success.

See also https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html

Reimplement this in a subclass. The default implementation does nothing.

Since
0.8.0

◆ setPassword()

void AbstractConfiguration::setPassword ( const QString & password)
virtual

Sets the password used for authentication.

Reimplement this in a subclass. The default implementation does nothing.

Parameters
passwordused for authentication

◆ setServerPort()

void AbstractConfiguration::setServerPort ( int port)
virtual

Sets the server port used for the connection.

Reimplement this in a subclass. The default implementation does nothing.

◆ setServerUrl [1/2]

bool AbstractConfiguration::setServerUrl ( const QString & url)
slot

Sets the server data via url and returns true on success, otherwise false.

This takes the scheme and the host and if available the port and the path from the url to set them to setUseSSL(), setHost(), setServerPort() and setInstallPath().

Since
0.8.0

◆ setServerUrl [2/2]

bool AbstractConfiguration::setServerUrl ( const QUrl & url)
slot

Sets the server data via url and returns true on success, otherwise false.

This takes the scheme and the host and if available the port and the path from the url to set them to setUseSSL(), setHost(), setServerPort() and setInstallPath().

Since
0.8.0

◆ setUsername()

void AbstractConfiguration::setUsername ( const QString & username)
virtual

Sets the username used for authentication.

Reimplement this in a subclass. The default implementation does nothing.

Parameters
usernameused for authentication

◆ setUseSSL()

void AbstractConfiguration::setUseSSL ( bool useSSL)
virtual

Set useSSL to true to let the connection use SSL/TLS.

Reimplement this in a subclass. The default implementation does nothing.


The documentation for this class was generated from the following files:
  • Fuoten/Helpers/abstractconfiguration.h
  • build/Fuoten/FuotenQt5_autogen/include/moc_abstractconfiguration.cpp
  • Fuoten/Helpers/abstractconfiguration.cpp