|
|
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 |
void |
Connection * |
[const]
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 |
Call this in get and copy, to give the total size of the file Call in listDir too, when you know the total number of items.
void |
Call this during get and copy, once in a while, to give some info about the current state. Don't emit it in listDir, listEntries speaks for itself.
void |
Call this in get and copy, to give the current transfer speed. Usually worked out as processed_size / ( t - t_start )
void |
Call this to signal a redirection The job will take care of going to that url.
void |
"Tell that we will only get an error page here." ? ## FIXME
void |
Call this in mimetype, when you know the mimetype. See mimetype about other ways to implement it.
void |
Call to signal a warning. ##### TODO : this is doesn't do anything yet
bool |
Call this when requesting for a login and password.
Parameters:
head | and i18n'ed message to explain the dialog box |
user | user name, in and out |
pass | password, in and out |
Returns: true on ok, false on cancel
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.
If the slave doesn't reimplement it, a get will be issued, i.e. the whole file will be downloaded before determining the mimetype on it - this is obviously not a good thing in most cases.
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
It should also emit totalFiles as soon as it knows how many
files it will list.
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]
bool |
[virtual]
void |
[virtual]
int |
Read data send by the job, after a dataReq
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: root@porky.devel.redhat.com on Wed May 10 08:56:52 2000, using kdoc 2.0a35. |