KIO::FileUndoManager

Search for usage in LXR

#include <KIO/FileUndoManager>

Inheritance diagram for KIO::FileUndoManager:

Classes

class  UiInterface
 

Public Types

enum  CommandType {
  Copy, Move, Rename, Link,
  Mkdir, Trash, Put, Mkpath,
  BatchRename
}
 

Signals

void jobRecordingFinished (CommandType op)
 
void jobRecordingStarted (CommandType op)
 
void undoAvailable (bool avail)
 
void undoJobFinished ()
 
void undoTextChanged (const QString &text)
 

Public Slots

void undo ()
 

Public Member Functions

quint64 currentCommandSerialNumber () const
 
bool isUndoAvailable () const
 
quint64 newCommandSerialNumber ()
 
void recordCopyJob (KIO::CopyJob *copyJob)
 
void recordJob (CommandType op, const QList< QUrl > &src, const QUrl &dst, KIO::Job *job)
 
void setUiInterface (UiInterface *ui)
 
UiInterfaceuiInterface () const
 
bool undoAvailable () const
 
QString undoText () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
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 ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
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 QRegExp &regExp, 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
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
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_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 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
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
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 setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static FileUndoManagerself ()
 
- 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)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- 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)
 

Detailed Description

FileUndoManager: makes it possible to undo kio jobs. This class is a singleton, use self() to access its only instance.

Definition at line 37 of file fileundomanager.h.

Member Enumeration Documentation

◆ CommandType

The type of job.

Enumerator
Put 

Represents the creation of a file from data in memory. Used when pasting data from clipboard or drag-n-drop.

Since
4.7
Mkpath 

Represents a KIO::mkpath() job.

Since
5.4
BatchRename 

Represents a KIO::batchRename() job. Used when renaming multiple files.

Since
5.42

Definition at line 128 of file fileundomanager.h.

Member Function Documentation

◆ isUndoAvailable()

bool FileUndoManager::isUndoAvailable ( ) const
Returns
true if undo is possible. Usually used for enabling/disabling the undo action.
Since
5.79

Definition at line 297 of file fileundomanager.cpp.

◆ jobRecordingFinished

void KIO::FileUndoManager::jobRecordingFinished ( CommandType  op)
signal

Emitted when a job that has been recorded by FileUndoManager::recordJob() or FileUndoManager::recordCopyJob has been finished.

The command is now available for an undo-operation.

Since
4.2

◆ jobRecordingStarted

void KIO::FileUndoManager::jobRecordingStarted ( CommandType  op)
signal

Emitted when a job recording has been started by FileUndoManager::recordJob() or FileUndoManager::recordCopyJob().

After the job recording has been finished, the signal jobRecordingFinished() will be emitted.

Since
4.2

◆ newCommandSerialNumber()

quint64 FileUndoManager::newCommandSerialNumber ( )

These two functions are useful when wrapping FileUndoManager and adding custom commands.

Each command has a unique ID. You can get a new serial number for a custom command with newCommandSerialNumber(), and then when you want to undo, check if the command FileUndoManager would undo is newer or older than your custom command.

Definition at line 333 of file fileundomanager.cpp.

◆ recordCopyJob()

void FileUndoManager::recordCopyJob ( KIO::CopyJob copyJob)

Record this CopyJob while it's happening and add a command for it so that the user can undo it.

The signal jobRecordingStarted() is emitted.

Definition at line 265 of file fileundomanager.cpp.

◆ recordJob()

void FileUndoManager::recordJob ( CommandType  op,
const QList< QUrl > &  src,
const QUrl dst,
KIO::Job job 
)

Record this job while it's happening and add a command for it so that the user can undo it.

The signal jobRecordingStarted() is emitted.

Parameters
opthe type of job - which is also the type of command that will be created for it
srclist of source urls. This is empty for Mkdir, Mkpath, Put operations.
dstdestination url
jobthe job to record

Definition at line 258 of file fileundomanager.cpp.

◆ self()

FileUndoManager * FileUndoManager::self ( )
static
Returns
the FileUndoManager instance

Definition at line 225 of file fileundomanager.cpp.

◆ setUiInterface()

void FileUndoManager::setUiInterface ( UiInterface ui)

Set a new UiInterface implementation.

This deletes the previous one.

Parameters
uithe UiInterface instance, which becomes owned by the undo manager.

Definition at line 689 of file fileundomanager.cpp.

◆ uiInterface()

FileUndoManager::UiInterface * FileUndoManager::uiInterface ( ) const
Returns
the UiInterface instance passed to setUiInterface. This is useful for calling setParentWidget on it. Never delete it!

Definition at line 694 of file fileundomanager.cpp.

◆ undo

void FileUndoManager::undo ( )
slot

Undoes the last command Remember to call uiInterface()->setParentWidget(parentWidget) first, if you have multiple mainwindows.

This operation is asynchronous. undoJobFinished will be emitted once the undo is complete.

Definition at line 349 of file fileundomanager.cpp.

◆ undoAvailable() [1/2]

bool FileUndoManager::undoAvailable ( ) const
Returns
true if undo is possible. Usually used for enabling/disabling the undo action.
Deprecated:
since 5.79, use KIO::FileUndoManager::isUndoAvailable()

Definition at line 291 of file fileundomanager.cpp.

◆ undoAvailable [2/2]

void KIO::FileUndoManager::undoAvailable ( bool  avail)
signal

Emitted when the value of isUndoAvailable() changes.

◆ undoJobFinished

void KIO::FileUndoManager::undoJobFinished ( )
signal

Emitted when an undo job finishes. Used for unit testing.

◆ undoText()

QString FileUndoManager::undoText ( ) const
Returns
the current text for the undo action.

Definition at line 302 of file fileundomanager.cpp.

◆ undoTextChanged

void KIO::FileUndoManager::undoTextChanged ( const QString text)
signal

Emitted when the value of undoText() changes.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Dec 6 2022 03:56:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.