KDE 4.9 PyKDE API Reference

- KDE's Python API

# 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, Put }

## 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

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.

Since:
  4.2

Signal syntax:
  `QObject.connect(source, SIGNAL("jobRecordingFinished(KIO::FileUndoManager::CommandType)"), target_slot)`

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.

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)`

undoJobFinished | ( |  | ) |

Signal syntax:
  `QObject.connect(source, SIGNAL("undoJobFinished()"), target_slot)`

undoTextChanged | ( | QString | text
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("undoTextChanged(const QString&)"), target_slot)`

## Method Documentation

__init__ | ( |  | self ) |

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.

recordCopyJob | ( | self, |
|  | 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.

recordJob | ( | self, |
|  | KIO.FileUndoManager.CommandType | op,
|  | KUrl.List | src,
|  | KUrl | 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:

  | 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

setUiInterface | ( | self, |
|  | KIO.FileUndoManager.UiInterface | ui
| ) |  |  |

Set a new UiInterface implementation. This deletes the previous one.

Parameters:

  | ui | the UiInterface instance, which becomes owned by the undo manager.

KIO.FileUndoManager.UiInterface uiInterface | ( |  | self ) |

Returns:
  the UiInterface instance passed to setUiInterface. This is useful for calling setParentWidget on it. Never delete it!

undo | ( |  | self ) |

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.

QString undoText | ( |  | self ) |

Returns:
  the current text for the undo action.

## Static Method Documentation

KIO.FileUndoManager self | ( |  | ) |

Returns:
  the FileUndoManager instance

## Enumeration Documentation

CommandType

The type of job.

Put:

Since:
  4.7, represents the creation of a file from data in memory. Used when pasting data from clipboard or drag-n-drop.

Enumerator:

  Copy |
  Move |
  Rename |
  Link |
  Mkdir |
  Trash |
  Put |