libfuoten  0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
Properties | Public Member Functions | Signals | Protected Member Functions | List of all members
RenameFolder Class Reference

#include <Fuoten/API/RenameFolder>

Inheritance diagram for RenameFolder:
Component

Properties

qint64 folderId
 
QString newName
 
- Properties inherited from Component
Fuoten::AbstractConfiguration configuration
 
Fuoten::Error error
 
bool inOperation
 
Fuoten::AbstractNotificator notificator
 
quint16 requestTimeout
 
Fuoten::AbstractStorage storage
 
bool useStorage
 
Fuoten::WipeManager wipeManager
 

Public Member Functions

 RenameFolder (QObject *parent=nullptr)
 
 ~RenameFolder () override
 
Q_INVOKABLE void execute () override
 
qint64 folderId () const
 
QString newName () const
 
void setFolderId (qint64 nFolderId)
 
void setNewName (const QString &nNewName)
 
- Public Member Functions inherited from Component
 Component (QObject *parent=nullptr)
 
 ~Component () override
 
AbstractConfigurationconfiguration () const
 
Errorerror () const
 
bool inOperation () const
 
bool isUseStorageEnabled () const
 
AbstractNotificatornotificator () const
 
quint16 requestTimeout () const
 
void setConfiguration (AbstractConfiguration *nAbstractConfiguration)
 
void setNotificator (AbstractNotificator *notificator)
 
void setRequestTimeout (quint16 seconds)
 
void setStorage (AbstractStorage *localStorage)
 
void setUseStorage (bool useStorage)
 
void setWipeManager (WipeManager *wipeManager)
 
AbstractStoragestorage () const
 
WipeManagerwipeManager () const
 

Signals

void folderIdChanged (qint64 folderId)
 
void newNameChanged (const QString &newName)
 
void succeeded (qint64 id, const QString &newName)
 
- Signals inherited from Component
void configurationChanged (Fuoten::AbstractConfiguration *configuration)
 
void errorChanged (Fuoten::Error *error)
 
void failed (Fuoten::Error *error)
 
void inOperationChanged (bool inOperation)
 
void notificatorChanged (Fuoten::AbstractNotificator *notificator)
 
void requestTimeoutChanged (quint16 requestTimeout)
 
void sslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
 
void storageChanged (Fuoten::AbstractStorage *storage)
 
void succeeded (const QJsonDocument &result)
 
void useStorageChanged (bool useStorage)
 
void wipeManagerChanged (Fuoten::WipeManager *wipeManager)
 

Protected Member Functions

bool checkInput () override
 
void extractError (QNetworkReply *reply) override
 
void successCallback () override
 
- Protected Member Functions inherited from Component
void addRequestHeader (const QByteArray &headerName, const QByteArray &headerValue)
 
void addRequestHeaders (const QHash< QByteArray, QByteArray > &headers)
 
virtual bool checkOutput ()
 
QJsonDocument jsonResult () const
 
void notify (const Error *e) const
 
void notify (AbstractNotificator::Type type, QtMsgType severity, const QVariant &data) const
 
QHash< QByteArray, QByteArray > requestHeaders () const
 
void sendRequest ()
 
void setApiRoute (const QString &route)
 
void setApiRoute (const QStringList &routeParts)
 
void setError (Error *nError)
 
void setExpectedJSONType (ExpectedJSONType type)
 
void setInOperation (bool nInOperation)
 
void setNetworkOperation (QNetworkAccessManager::Operation operation)
 
void setPayload (const QByteArray &payload)
 
void setPayload (const QJsonObject &payload)
 
void setRequestHeaders (const QHash< QByteArray, QByteArray > &headers)
 
void setRequiresAuth (bool reqAuth)
 
void setUrlQuery (const QUrlQuery &query)
 

Additional Inherited Members

- Public Types inherited from Component
enum  ExpectedJSONType : quint8 { Empty = 0, Array = 1, Object = 2 }
 
- Static Public Member Functions inherited from Component
static AbstractConfigurationdefaultConfiguration ()
 
static AbstractNotificatordefaultNotificator ()
 
static AbstractStoragedefaultStorage ()
 
static WipeManagerdefaultWipeManager ()
 
static AbstractNamFactorynetworkAccessManagerFactory ()
 
static void setDefaultConfiguration (AbstractConfiguration *config)
 
static void setDefaultNotificator (AbstractNotificator *notificator)
 
static void setDefaultStorage (AbstractStorage *storage)
 
static void setDefaultWipeManager (WipeManager *wipeManager)
 
static void setNetworkAccessManagerFactory (AbstractNamFactory *factory)
 

Detailed Description

Renames a folder on the News App server.

To rename a folder, set the RenameFolder::folderId and RenameFolder::newName as well as the Component::configuration property. Optionally set the Component::storage property to save the renamed folder. After setting the mandatory properties, call execute() to perform the API request.

If an AbstractStorage object is present, AbstractStorage::folderRenamed() will be used in the successCallback() to save the new folder name. If the request succeeded, the RenameFolder::succeeded() signal will be emitted. If something failed, the Component::failed() signal will be emitted and Component::error will contain a valid pointer to an Error object.

Mandatory properties
RenameFolder::folderId, RenameFolder::newName
API route
/folders/{folderId}
Method
PUT

Property Documentation

◆ folderId

qint64 folderId
readwrite

ID of the folder to rename.

This property can not be changed while Component::inOperation() returns true.

Access functions:
qint64folderId() const
voidsetFolderId(qint64 nFolderId)
Notifier signal:
voidfolderIdChanged(qint64 folderId)

◆ newName

QString newName
readwrite

The new name for the folder.

When setting this property, the input string will be simplified. See QString::simplified().

This property can not be changed while Component::inOperation() returns true.

Access functions:
QStringnewName() const
voidsetNewName(const QString &nNewName)
Notifier signal:
voidnewNameChanged(const QString &newName)

Constructor & Destructor Documentation

◆ RenameFolder()

RenameFolder ( QObject *  parent = nullptr)
explicit

Constructs an API request object with the given parent to rename a folder on the remote server.

◆ ~RenameFolder()

~RenameFolder ( )
override

Destroys the RenameFolder object.

Member Function Documentation

◆ checkInput()

bool checkInput ( )
overrideprotectedvirtual

Checks for valid folderId and newName properties.

Will at first perform the checks from Component::checkInput() and will than check if RenameFolder::folderId is greater than zero and RenameFolder::newName is not empty.

Reimplemented from Component.

◆ execute()

void execute ( )
overridevirtual

Executes the API request.

To perform a successful API request, RenameFolder::folderId and RenameFolder::newName have to be valid.

Execution will not run while Component::inOperation returns true and will itself set that property to true when the request starts.

Implements Component.

◆ extractError()

void extractError ( QNetworkReply *  reply)
overrideprotectedvirtual

Extracts possible errors replied by the News App API.

Reimplemented from Component.

◆ folderId()

qint64 folderId ( ) const

Returns the currently set ID of the folder that should be renamed.

See also
folderId

◆ folderIdChanged

void folderIdChanged ( qint64  folderId)
signal

This signal is emitted when the ID of the folder changes.

See also
folderId

◆ newName()

QString newName ( ) const

Returns the currently set new name for the folder.

See also
name

◆ newNameChanged

void newNameChanged ( const QString &  newName)
signal

This signal is emitted when the new name for the folder changes.

See also
newName

◆ setFolderId()

void setFolderId ( qint64  nFolderId)

Sets the ID of the folder that should be renamed.

See also
folderId

◆ setNewName()

void setNewName ( const QString &  nNewName)

Sets the new name for the folder.

See also
newName

◆ succeeded

void succeeded ( qint64  id,
const QString &  newName 
)
signal

Will be emitted when the request was successful.

Will contain the ID of the renamed folder as well as the new name.

See also
Component::failed()

◆ successCallback()

void successCallback ( )
overrideprotectedvirtual

Finishes the renaming if it was successful.

If Component::storage points to a valid object, it will use AbstractStorage::folderRenamed() to store the renamed folder. Afterwards it will set Component::inOperation to false and will emit the RenameFolder::succeeded() signal.

Implements Component.