KIO::AskUserActionInterface

Search for usage in LXR

KIO::AskUserActionInterface Class Referenceabstract

#include <KIO/AskUserActionInterface>

Inheritance diagram for KIO::AskUserActionInterface:

Public Types

enum  ConfirmationType { DefaultConfirmation , ForceConfirmation }
 
enum  DeletionType { Delete , Trash , EmptyTrash , DeleteInsteadOfTrash }
 
enum  MessageDialogType {
  QuestionTwoActions = 1 , QuestionTwoActionsCancel = 2 , WarningTwoActions = 3 , WarningTwoActionsCancel = 4 ,
  WarningContinueCancel = 5 , Information = 7 , Error = 9
}
 

Signals

void askIgnoreSslErrorsResult (int result)
 
void askUserDeleteResult (bool allowDelete, const QList< QUrl > &urls, KIO::AskUserActionInterface::DeletionType deletionType, QWidget *parent)
 
void askUserRenameResult (KIO::RenameDialog_Result result, const QUrl &newUrl, KJob *parentJob)
 
void askUserSkipResult (KIO::SkipDialog_Result result, KJob *parentJob)
 
void messageBoxResult (int result)
 

Public Member Functions

 ~AskUserActionInterface () override
 
virtual void askIgnoreSslErrors (const QVariantMap &sslErrorData, QWidget *parent)=0
 
virtual void askUserDelete (const QList< QUrl > &urls, DeletionType deletionType, ConfirmationType confirmationType, QWidget *parent=nullptr)=0
 
virtual void requestUserMessageBox (MessageDialogType type, const QString &text, const QString &title, const QString &primaryActionText, const QString &secondatyActionText, const QString &primaryActionIconName={}, const QString &secondatyActionIconName={}, const QString &dontAskAgainName={}, const QString &details={}, QWidget *parent=nullptr)=0
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

 AskUserActionInterface (QObject *parent=nullptr)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Related Symbols

(Note that these are not member symbols.)

virtual void askUserRename (KJob *job, const QString &title, const QUrl &src, const QUrl &dest, KIO::RenameDialog_Options options, KIO::filesize_t sizeSrc, KIO::filesize_t sizeDest, const QDateTime &ctimeSrc={}, const QDateTime &ctimeDest={}, const QDateTime &mtimeSrc={}, const QDateTime &mtimeDest={})=0
 
virtual void askUserSkip (KJob *job, KIO::SkipDialog_Options options, const QString &errorText)=0
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

The AskUserActionInterface class allows a KIO::Job to prompt the user for a decision when e.g. copying directories/files and there is a conflict (e.g. a file with the same name already exists at the destination).

The methods in this interface are similar to their counterparts in KIO::JobUiDelegateExtension, the main difference is that AskUserActionInterface shows the dialogs using show() or open(), rather than exec(), the latter creates a nested event loop which could lead to crashes.

See also
KIO::JobUiDelegateExtension
Since
5.78

Definition at line 43 of file askuseractioninterface.h.

Member Enumeration Documentation

◆ ConfirmationType

Deletion confirmation type.

Used by askUserDelete().

Enumerator
DefaultConfirmation 

Do not ask if the user has previously set the "Do not ask again" checkbox (which is is shown in the message dialog invoked by askUserDelete())

ForceConfirmation 

Always ask the user for confirmation.

Definition at line 132 of file askuseractioninterface.h.

◆ DeletionType

The type of deletion.

Used by askUserDelete().

Enumerator
Trash 

Delete the files/directories directly, i.e. without moving them to Trash.

EmptyTrash 

Move the files/directories to Trash.

DeleteInsteadOfTrash 

Empty the Trash.

This is the same as Delete, but more text is added to the message to inform the user that moving to Trash was tried but failed due to size constraints. Typical use case is re-asking the user about deleting instead of Trashing.

Since
5.100

Definition at line 114 of file askuseractioninterface.h.

◆ MessageDialogType

Enumerator
QuestionTwoActions 
Since
5.100
QuestionTwoActionsCancel 
Since
5.100
WarningTwoActions 
Since
5.100
WarningTwoActionsCancel 
Since
5.100

Definition at line 161 of file askuseractioninterface.h.

Constructor & Destructor Documentation

◆ AskUserActionInterface()

KIO::AskUserActionInterface::AskUserActionInterface ( QObject * parent = nullptr)
explicitprotected

Constructor.

Definition at line 18 of file askuseractioninterface.cpp.

◆ ~AskUserActionInterface()

KIO::AskUserActionInterface::~AskUserActionInterface ( )
override

Destructor.

Definition at line 23 of file askuseractioninterface.cpp.

Member Function Documentation

◆ askUserDelete()

virtual void KIO::AskUserActionInterface::askUserDelete ( const QList< QUrl > & urls,
DeletionType deletionType,
ConfirmationType confirmationType,
QWidget * parent = nullptr )
pure virtual

Ask for confirmation before moving urls (files/directories) to the Trash, emptying the Trash, or directly deleting files (i.e.

without moving to Trash).

Note that this method is not called automatically by KIO jobs. It's the application's responsibility to ask the user for confirmation before calling KIO::del() or KIO::trash().

You need to connect to the askUserDeleteResult signal to get the dialog's result (exit code).

Parameters
urlsthe urls about to be moved to the Trash or deleted directly
deletionTypethe type of deletion (Delete for real deletion, Trash otherwise), see the DeletionType enum
confirmationTypeThe type of deletion confirmation, see the ConfirmationType enum. Normally set to DefaultConfirmation
parentthe parent widget of the message box

Implemented in KIO::WidgetsAskUserActionHandler.

◆ askUserDeleteResult

void KIO::AskUserActionInterface::askUserDeleteResult ( bool allowDelete,
const QList< QUrl > & urls,
KIO::AskUserActionInterface::DeletionType deletionType,
QWidget * parent )
signal

Implementations of this interface must emit this signal when the dialog invoked by askUserDelete() finishes, to notify the caller of the user's decision.

Parameters
allowDeleteset to true if the user confirmed the delete operation, otherwise set to false
urlsa list of urls to delete/trash
deletionTypethe deletion type to use, one of KIO::AskUserActionInterface::DeletionType
parentthe parent widget passed to askUserDelete(), for request identification

◆ askUserRenameResult

void KIO::AskUserActionInterface::askUserRenameResult ( KIO::RenameDialog_Result result,
const QUrl & newUrl,
KJob * parentJob )
signal

Implementations of this interface must emit this signal when the rename dialog finishes, to notify the caller of the dialog's result.

Parameters
resultthe exit code from the rename dialog, one of the KIO::RenameDialog_Result enum
newUrlthe new destination URL set by the user
parentJobthe job that invoked the dialog

◆ askUserSkipResult

void KIO::AskUserActionInterface::askUserSkipResult ( KIO::SkipDialog_Result result,
KJob * parentJob )
signal

Implementations of this interface must emit this signal when the skip dialog finishes, to notify the caller of the dialog's result.

Parameters
resultthe exit code from the skip dialog, one of the KIO::SkipDialog_Result enum
parentJobthe job that invoked the dialog

◆ messageBoxResult

void KIO::AskUserActionInterface::messageBoxResult ( int result)
signal

Implementations of this interface must emit this signal when the dialog invoked by requestUserMessageBox() finishes, to notify the caller of the dialog's result (exit code).

Parameters
resultthe exit code of the dialog, one of KIO::WorkerBase::ButtonCode enum

◆ requestUserMessageBox()

virtual void KIO::AskUserActionInterface::requestUserMessageBox ( MessageDialogType type,
const QString & text,
const QString & title,
const QString & primaryActionText,
const QString & secondatyActionText,
const QString & primaryActionIconName = {},
const QString & secondatyActionIconName = {},
const QString & dontAskAgainName = {},
const QString & details = {},
QWidget * parent = nullptr )
pure virtual

This function allows for the delegation of user prompts from the KIO worker.

Parameters
typethe desired type of message box, see the MessageDialogType enum
textthe message to show to the user
titlethe title of the message dialog box
primaryActionTextthe text for the primary action
secondatyActionTextthe text for the secondary action
primaryActionIconNamethe icon to show on the primary action
secondatyActionIconNamethe icon to show on the secondary action
dontAskAgainNamethe config key name used to store the result from 'Do not ask again' checkbox
detailsmore details about the message shown to the user
parentthe parent widget of the dialog

Implemented in KIO::WidgetsAskUserActionHandler.

Friends And Related Symbol Documentation

◆ askUserRename()

virtual void askUserRename ( KJob * job,
const QString & title,
const QUrl & src,
const QUrl & dest,
KIO::RenameDialog_Options options,
KIO::filesize_t sizeSrc,
KIO::filesize_t sizeDest,
const QDateTime & ctimeSrc = {},
const QDateTime & ctimeDest = {},
const QDateTime & mtimeSrc = {},
const QDateTime & mtimeDest = {} )
related

Constructs a modal, parent-less "rename" dialog, to prompt the user for a decision in case of conflicts, while copying/moving files.

The dialog is shown using open(), rather than exec() (the latter creates a nested eventloop which could lead to crashes). You will need to connect to the askUserRenameResult() signal to get the dialog's result (exit code). The exit code is one of KIO::RenameDialog_Result.

See also
KIO::RenameDialog_Result enum.
Parameters
jobthe job that called this method
titlethe title for the dialog box
srcthe URL of the file/dir being copied/moved
destthe URL of the destination file/dir, i.e. the one that already exists
optionsparameters for the dialog (which buttons to show... etc), OR'ed values from the KIO::RenameDialog_Options enum
sizeSrcsize of the source file
sizeDestsize of the destination file
ctimeSrccreation time of the source file
ctimeDestcreation time of the destination file
mtimeSrcmodification time of the source file
mtimeDestmodification time of the destination file

Implemented in KIO::WidgetsAskUserActionHandler.

◆ askUserSkip()

virtual void askUserSkip ( KJob * job,
KIO::SkipDialog_Options options,
const QString & errorText )
related

You need to connect to the askUserSkipResult signal to get the dialog's result.

Parameters
jobthe job that called this method
optionsparameters for the dialog (which buttons to show... etc), OR'ed values from the KIO::SkipDialog_Options enum
error_textthe error text to show to the user (usually the string returned by KJob::errorText())

Implemented in KIO::WidgetsAskUserActionHandler.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:52 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.