KDE 4.9 PyKDE API Reference

- KDE's Python API

# StatJob Class Reference

`from PyKDE4.kio import *`

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

## Detailed Description

A KIO job that retrieves information about a file or directory.

See also:
  KIO.stat()

## Enumerations

StatSide | { SourceSide, DestinationSide }

## Signals

| permanentRedirection (KIO.Job job, KUrl fromUrl, KUrl toUrl)
| redirection (KIO.Job job, KUrl url)

## Methods

| __init__ (self)
KUrl | mostLocalUrl (self)
| setDetails (self, int details)
| setSide (self, KIO.StatJob.StatSide side)
| setSide (self, bool source)
| slotFinished (self)
| slotMetaData (self, KIO.MetaData _metaData)
KIO.UDSEntry | statResult (self)

## Signal Documentation

permanentRedirection | ( | KIO.Job | job,
|  | KUrl | fromUrl,
|  | KUrl | toUrl
| ) |  |  |

Signals a permanent redirection. The redirection itself is handled internally.

Parameters:

  | job | the job that is redirected
  | fromUrl | the original URL
  | toUrl | the new URL

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

redirection | ( | KIO.Job | job,
|  | KUrl | url
| ) |  |  |

Signals a redirection. Use to update the URL shown to the user. The redirection itself is handled internally.

Parameters:

  | job | the job that is redirected
  | url | the new url

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

## Method Documentation

__init__ | ( |  | self ) |

KUrl mostLocalUrl | ( |  | self ) |

most local URL Call this in the slot connected to result, and only after making sure no error happened.

Returns:
  the most local URL for the URL we were stat'ing.

Sample usage:

    KIO.StatJob* job = KIO.mostLocalUrl("desktop:/foo");
    job->ui()->setWindow(this);
    connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*)));
    [...]
    // and in the slot
    if (job->error()) {
    [...] // doesn't exist
    } else {
    const KUrl localUrl = job->mostLocalUrl();
    // localUrl = file:$HOME/Desktop/foo
    [...]
    }

    Since: 4.4

setDetails | ( | self, |
|  | int | details
| ) |  |  |

Selects the level of details we want. By default this is 2 (all details wanted, including modification time, size, etc.), setDetails(1) is used when deleting: we don't need all the information if it takes too much time, no need to follow symlinks etc. setDetails(0) is used for very simple probing: we'll only get the answer "it's a file or a directory, or it doesn't exist". This is used by KRun.

Parameters:

  | details | 2 for all details, 1 for simple, 0 for very simple

setSide | ( | self, |
|  | KIO.StatJob.StatSide | side
| ) |  |  |

A stat() can have two meanings. Either we want to read from this URL, or to check if we can write to it. First case is "source", second is "dest". It is necessary to know what the StatJob is for, to tune the kioslave's behavior (e.g. with FTP).

Parameters:

  | source | true for "source" mode, false for "dest" mode

setSide | ( | self, |
|  | bool | source
| ) |  |  |

A stat() can have two meanings. Either we want to read from this URL, or to check if we can write to it. First case is "source", second is "dest". It is necessary to know what the StatJob is for, to tune the kioslave's behavior (e.g. with FTP).

Parameters:

  | source | true for "source" mode, false for "dest" mode

slotFinished | ( |  | self ) |

slotMetaData | ( | self, |
|  | KIO.MetaData | _metaData
| ) |  |  |

KIO.UDSEntry statResult | ( |  | self ) |

Result of the stat operation. Call this in the slot connected to result, and only after making sure no error happened.

Returns:
  the result of the stat

## Enumeration Documentation

StatSide

Enumerator:

  SourceSide |
  DestinationSide |