KIO.CopyJob

KDE 4.2 PyKDE API Reference

- KDE's Python API

# CopyJob Class Reference

`from PyKDE4.kio import *`

Inherits: KIO.Job → KCompositeJob → KJob → QObject
Namespace: KIO

## Detailed Description

CopyJob is used to move, copy or symlink files and directories. Don't create the job directly, but use KIO.copy(), KIO.move(), KIO.link() and friends.

See also:
  KIO.copy()

See also:
  KIO.copyAs()

See also:
  KIO.move()

See also:
  KIO.moveAs()

See also:
  KIO.link()

See also:
  KIO.linkAs()

## Enumerations
CopyMode | { Copy, Move, Link }
## Signals
| aboutToCreate (KIO.Job job, [KIO.CopyInfo] files)
| copying (KIO.Job job, KUrl src, KUrl dest)
| copyingDone (KIO.Job job, KUrl from, KUrl to, time_t mtime, bool directory, bool renamed)
| copyingLinkDone (KIO.Job job, KUrl from, QString target, KUrl to)
| creatingDir (KIO.Job job, KUrl dir)
| linking (KIO.Job job, QString target, KUrl to)
| moving (KIO.Job job, KUrl from, KUrl to)
| processedDirs (KIO.Job job, long dirs)
| processedFiles (KIO.Job job, long files)
| renamed (KIO.Job job, KUrl from, KUrl to)
| totalDirs (KJob job, long dirs)
| totalFiles (KJob job, long files)
## Methods
| __init__ (self, CopyJobPrivate dd)
| __init__ (self)
| aboutToCreate (self, KIO.Job job, [KIO.CopyInfo] files)
| copying (self, KIO.Job job, KUrl src, KUrl dest)
| copyingDone (self, KIO.Job job, KUrl from, KUrl to, time_t mtime, bool directory, bool renamed)
| copyingLinkDone (self, KIO.Job job, KUrl from, QString target, KUrl to)
| creatingDir (self, KIO.Job job, KUrl dir)
KUrl | destUrl (self)
bool | doSuspend (self)
| linking (self, KIO.Job job, QString target, KUrl to)
| moving (self, KIO.Job job, KUrl from, KUrl to)
KIO.CopyJob.CopyMode | operationMode (self)
| processedDirs (self, KIO.Job job, long dirs)
| processedFiles (self, KIO.Job job, long files)
| renamed (self, KIO.Job job, KUrl from, KUrl to)
| setAutoSkip (self, bool autoSkip)
| setDefaultPermissions (self, bool b)
| setWriteIntoExistingDirectories (self, bool overwriteAllDirs)
| slotResult (self, KJob job)
KUrl.List | srcUrls (self)
| totalDirs (self, KJob job, long dirs)
| totalFiles (self, KJob job, long files)

## Method Documentation

__init__ | ( | self, |
|  | CopyJobPrivate | dd
| ) |  |  |

__init__ | ( |  | self ) |

aboutToCreate | ( | self, |
|  | KIO.Job | job,
|  | [KIO.CopyInfo] | files
| ) |  |  |

Emitted when it is known which files / directories are going to be created. Note that this may still change e.g. when existing files with the same name are discovered.

Parameters:

  | job | the job that emitted this signal
  | files | a list of items that are about to be created.

Signal syntax:
  `QObject.connect(source, SIGNAL("aboutToCreate(Job*, const QList&)"), target_slot)`

copying | ( | self, |
|  | KIO.Job | job,
|  | KUrl | src,
|  | KUrl | dest
| ) |  |  |

The job is copying a file or directory.

Note: This signal is used for progress dialogs, it's not emitted for every file or directory (this would be too slow), but every 200ms.

Parameters:

  | job | the job that emitted this signal
  | src | the URL of the file or directory that is currently being copied
  | dest | the destination of the current operation

Signal syntax:
  `QObject.connect(source, SIGNAL("copying(Job*, const KUrl&, const KUrl&)"), target_slot)`

copyingDone | ( | self, |
|  | KIO.Job | job,
|  | KUrl | from,
|  | KUrl | to,
|  | time_t | mtime,
|  | bool | directory,
|  | bool | renamed
| ) |  |  |

The job emits this signal when copying or moving a file or directory successfully finished. This signal is mainly for the Undo feature. If you simply want to know when a copy job is done, use result().

Parameters:

  | job | the job that emitted this signal
  | from | the source URL
  | to | the destination URL
  | mtime | the modification time of the source file, hopefully set on the destination file too (when the kioslave supports it).
  | directory | indicates whether a file or directory was successfully copied/moved. true for a directory, false for file
  | renamed | indicates that the destination URL was created using a rename operation (i.e. fast directory moving). true if is has been renamed

Signal syntax:
  `QObject.connect(source, SIGNAL("copyingDone(Job*, const KUrl&, const KUrl&, time_t, bool, bool)"), target_slot)`

copyingLinkDone | ( | self, |
|  | KIO.Job | job,
|  | KUrl | from,
|  | QString | target,
|  | KUrl | to
| ) |  |  |

The job is copying or moving a symbolic link, that points to target. The new link is created in to. The existing one is/was in from. This signal is mainly for the Undo feature.

Parameters:

  | job | the job that emitted this signal
  | from | the source URL
  | target | the target
  | to | the destination URL

Signal syntax:
  `QObject.connect(source, SIGNAL("copyingLinkDone(Job*, const KUrl&, const QString&, const KUrl&)"), target_slot)`

creatingDir | ( | self, |
|  | KIO.Job | job,
|  | KUrl | dir
| ) |  |  |

The job is creating the directory dir.

This signal is emitted for every directory being created.

Parameters:

  | job | the job that emitted this signal
  | dir | the directory that is currently being created

Signal syntax:
  `QObject.connect(source, SIGNAL("creatingDir(Job*, const KUrl&)"), target_slot)`

KUrl destUrl | ( |  | self ) |

Returns the destination URL.

Returns:
  the destination URL

bool doSuspend | ( |  | self ) |

Reimplemented for internal reasons

linking | ( | self, |
|  | KIO.Job | job,
|  | QString | target,
|  | KUrl | to
| ) |  |  |

The job is creating a symbolic link.

Note: This signal is used for progress dialogs, it's not emitted for every file or directory (this would be too slow), but every 200ms.

Parameters:

  | job | the job that emitted this signal
  | target | the URL of the file or directory that is currently being linked
  | to | the destination of the current operation

Signal syntax:
  `QObject.connect(source, SIGNAL("linking(Job*, const QString&, const KUrl&)"), target_slot)`

moving | ( | self, |
|  | KIO.Job | job,
|  | KUrl | from,
|  | KUrl | to
| ) |  |  |

The job is moving a file or directory.

Note: This signal is used for progress dialogs, it's not emitted for every file or directory (this would be too slow), but every 200ms.

Parameters:

  | job | the job that emitted this signal
  | from | the URL of the file or directory that is currently being moved
  | to | the destination of the current operation

Signal syntax:
  `QObject.connect(source, SIGNAL("moving(Job*, const KUrl&, const KUrl&)"), target_slot)`

KIO.CopyJob.CopyMode operationMode | ( |  | self ) |

Returns the mode of the operation (copy, move, or link), depending on whether KIO.copy(), KIO.move() or KIO.link() was called.

processedDirs | ( | self, |
|  | KIO.Job | job,
|  | long | dirs
| ) |  |  |

Sends the number of processed directories.

Parameters:

  | job | the job that emitted this signal
  | dirs | the number of processed dirs

Signal syntax:
  `QObject.connect(source, SIGNAL("processedDirs(Job*, unsigned long)"), target_slot)`

processedFiles | ( | self, |
|  | KIO.Job | job,
|  | long | files
| ) |  |  |

Sends the number of processed files.

Parameters:

  | job | the job that emitted this signal
  | files | the number of processed files

Signal syntax:
  `QObject.connect(source, SIGNAL("processedFiles(Job*, unsigned long)"), target_slot)`

renamed | ( | self, |
|  | KIO.Job | job,
|  | KUrl | from,
|  | KUrl | to
| ) |  |  |

The user chose to rename from to to.

Parameters:

  | job | the job that emitted this signal
  | from | the original name
  | to | the new name

Signal syntax:
  `QObject.connect(source, SIGNAL("renamed(Job*, const KUrl&, const KUrl&)"), target_slot)`

setAutoSkip | ( | self, |
|  | bool | autoSkip
| ) |  |  |

Skip copying or moving any file when the destination already exists, instead of the default behavior (interactive mode: showing a dialog to the user, non-interactive mode: aborting with an error). Initially added for a unit test.

Since:
  4.2

setDefaultPermissions | ( | self, |
|  | bool | b
| ) |  |  |

By default the permissions of the copied files will be those of the source files.

But when copying "template" files to "new" files, people prefer the umask to apply, rather than the template's permissions. For that case, call setDefaultPermissions(true)

setWriteIntoExistingDirectories | ( | self, |
|  | bool | overwriteAllDirs
| ) |  |  |

Reuse any directory that already exists, instead of the default behavior (interactive mode: showing a dialog to the user, non-interactive mode: aborting with an error).

Since:
  4.2

slotResult | ( | self, |
|  | KJob | job
| ) |  |  |

KUrl.List srcUrls | ( |  | self ) |

Returns the list of source URLs.

Returns:
  the list of source URLs.

totalDirs | ( | self, |
|  | KJob | job,
|  | long | dirs
| ) |  |  |

Emitted when the toal number of direcotries is known.

Parameters:

  | job | the job that emitted this signal
  | dirs | the total number of directories

Signal syntax:
  `QObject.connect(source, SIGNAL("totalDirs(KJob*, unsigned long)"), target_slot)`

totalFiles | ( | self, |
|  | KJob | job,
|  | long | files
| ) |  |  |

Emitted when the total number of files is known.

Parameters:

  | job | the job that emitted this signal
  | files | the total number of files

Signal syntax:
  `QObject.connect(source, SIGNAL("totalFiles(KJob*, unsigned long)"), target_slot)`

## Enumeration Documentation

CopyMode

Defines the mode of the operation

Enumerator:

  Copy |
  Move |
  Link |