KDE 4.7 PyKDE API Reference

- KDE's Python API

# Slave Class Reference

`from PyKDE4.kio import *`

Inherits: KIO.SlaveInterface → QObject
Namespace: KIO

## Detailed Description

## Signals

| slaveDied (KIO.Slave slave)

## Methods

| __init__ (self, QString protocol, QObject parent=0)
| accept (self)
| deref (self)
| gotInput (self)
| hold (self, KUrl url)
QString | host (self)
long | idleTime (self)
bool | isAlive (self)
bool | isConnected (self)
KIO.SimpleJob | job (self)
| kill (self)
QString | passwd (self)
int | port (self)
QString | protocol (self)
| ref (self)
| resetHost (self)
| resume (self)
| send (self, int cmd, QByteArray arr=QByteArray())
| setConfig (self, KIO.MetaData config)
| setConnected (self, bool c)
| setHost (self, QString host, int port, QString user, QString passwd)
| setIdle (self)
| setJob (self, KIO.SimpleJob job)
| setPID (self, int a0)
| setProtocol (self, QString protocol)
QString | slaveProtocol (self)
int | slave_pid (self)
| suspend (self)
bool | suspended (self)
| timeout (self)
QString | user (self)

## Static Methods

bool | checkForHeldSlave (KUrl url)
KIO.Slave, int error | createSlave (QString protocol, KUrl url, QString error_text)
KIO.Slave | holdSlave (QString protocol, KUrl url)

## Signal Documentation

slaveDied | ( | KIO.Slave | slave
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("slaveDied(KIO::Slave*)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QString | protocol,
|  | QObject | parent=0
| ) |  |  |

accept | ( |  | self ) |

deref | ( |  | self ) |

gotInput | ( |  | self ) |

hold | ( | self, |
|  | KUrl | url
| ) |  |  |

Puts the kioslave associated with url at halt, and return it to klauncher, in order to let another application connect to it and finish the job. This is for the krunner case: type a URL in krunner, it will start downloading to find the mimetype (KRun), and then hold the slave, publish the held slave using, this method, and the final application can continue the same download by requesting the same URL.

QString host | ( |  | self ) |

Returns:
  Host this slave is (was?) connected to

long idleTime | ( |  | self ) |

Returns:
  The time this slave has been idle.

bool isAlive | ( |  | self ) |

Returns:
  true if the slave survived the last mission.

bool isConnected | ( |  | self ) |

KIO.SimpleJob job | ( |  | self ) |

kill | ( |  | self ) |

Force termination

QString passwd | ( |  | self ) |

Returns:
  Passwd used to log in

int port | ( |  | self ) |

Returns:
  port this slave is (was?) connected to

QString protocol | ( |  | self ) |

The protocol this slave handles.

Returns:
  name of protocol handled by this slave, as seen by the user

ref | ( |  | self ) |

resetHost | ( |  | self ) |

Clear host info.

resume | ( |  | self ) |

Resumes the operation of the attached kioslave.

send | ( | self, |
|  | int | cmd,
|  | QByteArray | arr=QByteArray()
| ) |  |  |

Sends the given command to the kioslave.

Parameters:

  | cmd | command id
  | arr | byte array containing data

setConfig | ( | self, |
|  | KIO.MetaData | config
| ) |  |  |

Configure slave

setConnected | ( | self, |
|  | bool | c
| ) |  |  |

setHost | ( | self, |
|  | QString | host,
|  | int | port,
|  | QString | user,
|  | QString | passwd
| ) |  |  |

Set host for url

Parameters:

  | host | to connect to.
  | port | to connect to.
  | user | to login as
  | passwd | to login with

setIdle | ( |  | self ) |

Marks this slave as idle.

setJob | ( | self, |
|  | KIO.SimpleJob | job
| ) |  |  |

setPID | ( | self, |
|  | int | a0
| ) |  |  |

setProtocol | ( | self, |
|  | QString | protocol
| ) |  |  |

QString slaveProtocol | ( |  | self ) |

The actual protocol used to handle the request.

This method will return a different protocol than the one obtained by using protocol() if a proxy-server is used for the given protocol. This usually means that this method will return "http" when the actuall request was to retrieve a resource from an "ftp" server by going through a proxy server.

Returns:
  the actual protocol (io-slave) that handled the request

int slave_pid | ( |  | self ) |

suspend | ( |  | self ) |

Suspends the operation of the attached kioslave.

bool suspended | ( |  | self ) |

Tells whether the kioslave is suspended.

Returns:
  true if the kioslave is suspended.

timeout | ( |  | self ) |

QString user | ( |  | self ) |

Returns:
  User this slave is (was?) logged in as

## Static Method Documentation

bool checkForHeldSlave | ( | KUrl | url
| ) |  |  |

Returns true if klauncher is holding a slave for url.

Since:
  4.7

KIO.Slave, int error createSlave | ( | QString | protocol,
|  | KUrl | url,
|  | QString | error_text
| ) |  |  |

Creates a new slave.

Parameters:

  | protocol | the protocol
  | url | is the url
  | error | is the error code on failure and undefined else.
  | error_text | is the error text on failure and undefined else.

Returns:
  0 on failure, or a pointer to a slave otherwise.

KIO.Slave holdSlave | ( | QString | protocol,
|  | KUrl | url
| ) |  |  |

Requests a slave on hold for ths url, from klauncher, if there is such a job. See hold()