|
|
There are two classes that specifies the protocol between application (job) and kioslave. SlaveInterface is the class to use on the application end, SlaveBase is the one to use on the slave end.
Slave implementations should simply inherit SlaveBase
A call to foo() results in a call to slotFoo() on the other end.
void |
Emit to send data in the slave (i.e. in get).
Parameters:
data | the data read by the slave Send an empty QByteArray() to signal end of data. |
void |
Emit to ask for data (in put)
void |
Emit to signal an error. This also finishes the job, no need to call finished.
void |
Emit in openConnection, if you reimplement it, when you're done.
void |
Emit to signal successful completion of any command (besides openConnection and closeConnection)
void |
Used to report the status of the slave.
Parameters:
host | the slave is currently connected to. (Should be empty if not connected) |
connected | Whether an actual network connection exists. |
void |
Emit this once in stat()
void |
Emit this in listDir, each time you have a bunch of entries to report.
void |
???? Is this still necessary?
void |
???? Is this still necessary?
void |
[virtual]
Set the host
Parameters:
pass | Called directly by createSlave, this is why there is no equivalent in SlaveInterface, unlike the other methods. |
void |
[virtual]
Opens the connection (forced)
void |
[virtual]
Closes the connection (forced)
void |
[virtual]
get, aka read.
Parameters:
path | the file to retrieve (decoded) |
query | an optionnal query (the part after the '?' in the URL) |
reload | if true, make sure to get an up to date version The slave emits the data through data |
void |
[virtual]
put, aka write.
Parameters:
path | where to write the file (decoded) |
permissions | may be -1. In this case no special permission mode is set. |
overwrite | if true, any existing file will be overwritten |
resume |
void |
[virtual]
Finds all details for one file or directory. The information returned is the same as what listDir returns, but only for one file or directory.
void |
[virtual]
Finds mimetype for one file or directory.
This method should either emit 'mimetype' or it should send a block of data big enough to be able to determine the mimetype.
void |
[virtual]
Lists the contents of path
.
The slave should emit ERR_CANNOT_ENTER_DIRECTORY if it doesn't exist,
if we don't have enough permissions, or if it is a file
void |
[virtual]
Create a directory
Parameters:
path | path to the directory to create |
permissions | the permissions to set after creating the directory (-1 if no permissions to be set) The slave emits ERR_COULD_NOT_MKDIR if failure. |
void |
[virtual]
Rename oldname
into newname
.
If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will
ask for copy + del instead.
Parameters:
src | where to move the file from (decoded) |
dest | where to move the file to (decoded) |
overwrite | if true, any existing file will be overwritten |
void |
[virtual]
Change permissions on path
The slave emits ERR_DOES_NOT_EXIST or ERR_CANNOT_CHMOD
void |
[virtual]
Copy src
into dest
.
If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will
ask for get + put instead.
Parameters:
src | where to copy the file from (decoded) |
dest | where to copy the file to (decoded) |
permissions | may be -1. In this case no special permission mode is set. |
overwrite | if true, any existing file will be overwritten |
void |
[virtual]
Delete a file or directory.
Parameters:
path | file/directory to delete |
isfile | if true, a file should be deleted. if false, a directory should be deleted. |
void |
[virtual]
Used for any command that is specific to this slave (protocol) Examples are : HTTP POST, mount and unmount (kio_file)
Parameters:
data | packed data; the meaning is completely dependent on the slave, but usually starts with an int for the command number. Document your slave's commands, at least in its header file. |
void |
[virtual]
Called to get the status of the slave. Slave should respond by calling slaveStatus(...)
void |
[static]
int |
Read data send by the job
Parameters:
buffer | buffer where data is stored |
Returns: 0 on end of data, > 0 bytes read < 0 error
void |
[protected]
internal function to be called by the slave. It collects entries and emits them via listEntries when enough of them are there or a certain time frame exceeded (to make sure the app gets some items in time but not too many items one by one as this will cause a drastic performance penalty
void |
[protected]
internal function to connect a slave to/ disconnect from either the slave pool or the application
QCString |
[protected]
Name of the protocol supported by this slave
Generated by: dfaure@faure on Sun Mar 26 14:24:43 2000, using kdoc 2.0a35. |