FileUndoManager Class Reference
from PyKDE4.kio import *
Inherits: QObject
Namespace: KIO
Detailed Description
FileUndoManager: makes it possible to undo kio jobs.
This class is a singleton, use self() to access its only instance.
Enumerations |
CommandType | { Copy, Move, Rename, Link, Mkdir, Trash } |
Signals |
| jobRecordingFinished (KIO.FileUndoManager.CommandType op) |
| jobRecordingStarted (KIO.FileUndoManager.CommandType op) |
| undoAvailable (bool avail) |
| undoJobFinished () |
| undoTextChanged (QString text) |
Methods |
| __init__ (self) |
long | currentCommandSerialNumber (self) |
long | newCommandSerialNumber (self) |
| recordCopyJob (self, KIO.CopyJob copyJob) |
| recordJob (self, KIO.FileUndoManager.CommandType op, KUrl.List src, KUrl dst, KIO.Job job) |
| setUiInterface (self, KIO.FileUndoManager.UiInterface ui) |
KIO.FileUndoManager.UiInterface | uiInterface (self) |
| undo (self) |
bool | undoAvailable (self) |
QString | undoText (self) |
Static Methods |
KIO.FileUndoManager | self () |
Signal Documentation
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
- Signal syntax:
QObject.connect(source, SIGNAL("jobRecordingFinished(KIO::FileUndoManager::CommandType)"), target_slot)
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
- Signal syntax:
QObject.connect(source, SIGNAL("jobRecordingStarted(KIO::FileUndoManager::CommandType)"), target_slot)
undoAvailable |
( |
bool |
avail |
|
) |
|
|
|
- Returns:
- true if undo is possible. Usually used for enabling/disabling the undo action.
- Signal syntax:
QObject.connect(source, SIGNAL("undoAvailable(bool)"), target_slot)
- Signal syntax:
QObject.connect(source, SIGNAL("undoJobFinished()"), target_slot)
- Signal syntax:
QObject.connect(source, SIGNAL("undoTextChanged(const QString&)"), target_slot)
Method Documentation
long currentCommandSerialNumber |
( |
|
self ) |
|
long newCommandSerialNumber |
( |
|
self ) |
|
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.
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.
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:
-
| op | the type of job - which is also the type of command that will be created for it
|
| src | list of source urls
|
| dst | destination url
|
| job | the job to record
|
Set a new UiInterface implementation.
This deletes the previous one.
- Parameters:
-
| ui | the UiInterface instance, which becomes owned by the undo manager.
|
- Returns:
- the UiInterface instance passed to setUiInterface.
This is useful for calling setParentWidget on it. Never delete it!
Undoes the last command
Remember to call uiInterface()->setParentWidget(parentWidget) first,
if you have multiple mainwindows.
bool undoAvailable |
( |
|
self ) |
|
- Returns:
- true if undo is possible. Usually used for enabling/disabling the undo action.
- Returns:
- the current text for the undo action.
Static Method Documentation
- Returns:
- the FileUndoManager instance
Enumeration Documentation
- Enumerator:
-
Copy | |
Move | |
Rename | |
Link | |
Mkdir | |
Trash | |