KIO::FileUndoManager Class
Header: | #include <FileUndoManager> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS KIOWidgets) target_link_libraries(mytarget PRIVATE Qt6::KIOWidgets) |
Public Types
class | UiInterface |
enum | CommandType { Copy, Move, Rename, Link, Mkdir, …, BatchRename } |
Public Functions
bool | isUndoAvailable() const |
quint64 | newCommandSerialNumber() |
void | recordCopyJob(KIO::CopyJob *copyJob) |
void | recordJob(KIO::FileUndoManager::CommandType op, const QList<QUrl> &src, const QUrl &dst, KIO::Job *job) |
void | setUiInterface(KIO::FileUndoManager::UiInterface *ui) |
KIO::FileUndoManager::UiInterface * | uiInterface() const |
QString | undoText() const |
Public Slots
void | undo() |
Signals
void | jobRecordingFinished(KIO::FileUndoManager::CommandType op) |
void | jobRecordingStarted(KIO::FileUndoManager::CommandType op) |
Static Public Members
KIO::FileUndoManager * | self() |
Detailed Description
@class KIO::FileUndoManager fileundomanager.h <KIO/FileUndoManager>
FileUndoManager: makes it possible to undo kio jobs. This class is a singleton, use self() to access its only instance.
Member Type Documentation
enum FileUndoManager::CommandType
The type of job.
Member Function Documentation
bool FileUndoManager::isUndoAvailable() const
@return true if undo is possible. Usually used for enabling/disabling the undo action.
@since 5.79
[signal]
void FileUndoManager::jobRecordingFinished(KIO::FileUndoManager::CommandType op)
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.
[signal]
void FileUndoManager::jobRecordingStarted(KIO::FileUndoManager::CommandType op)
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.
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.
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.
void FileUndoManager::recordJob(KIO::FileUndoManager::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. @param op the type of job - which is also the type of command that will be created for it @param src list of source urls. This is empty for Mkdir, Mkpath, Put operations. @param dst destination url @param job the job to record
[static]
KIO::FileUndoManager *FileUndoManager::self()
@return the FileUndoManager instance
void FileUndoManager::setUiInterface(KIO::FileUndoManager::UiInterface *ui)
Set a new UiInterface implementation. This deletes the previous one. @param ui the UiInterface instance, which becomes owned by the undo manager.
See also uiInterface().
KIO::FileUndoManager::UiInterface *FileUndoManager::uiInterface() const
@return the UiInterface instance passed to setUiInterface. This is useful for calling setParentWidget on it. Never delete it!
See also setUiInterface().
[slot]
void FileUndoManager::undo()
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.
QString FileUndoManager::undoText() const
@return the current text for the undo action.