|
|
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.
|
~ |
[virtual]
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 |
Emit to signal that data from the sub-URL is needed
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 |
void |
Call to signal a warning, to be displayed in a dialog box.
void |
Call to signal a message, to be displayed if the application wants to, for instance in a status bar. Usual examples are "connecting to host xyz", etc.
bool |
Call this when requesting for a login and password.
This function is only different from the above only because it takes one more extra argument, the name of the host, so that any authorization can kept around for a whole session.
Parameters:
head | and i18n'ed message to explain the dialog box |
user | user name, in and out |
pass | password, in and out |
key | the string to be used to cache the password. |
Returns: true on ok, false on cancel
void |
Sets meta-data to be send to the application before the first data() or finished() signal.
QString |
Queries for meta-data send by the application to the slave.
void |
[virtual]
Set the host
This method is called whenever a change in host, port or user occurs.
Parameters:
pass | Called directly by createSlave, this is why there is no equivalent in SlaveInterface, unlike the other methods. |
void |
[virtual]
Prepare slave for streaming operation
void |
[virtual]
Opens the connection (forced)
void |
[virtual]
Closes the connection (forced)
void |
[virtual]
get, aka read.
Parameters:
url | the full url for this request. Host, port and user of the URL can be assumed to be the same as in the last setHost() call. 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 |
dest | where to move the file to |
overwrite | if true, any existing file will be overwritten |
void |
[virtual]
Creates a symbolic link named dest,
pointing to target,
which
may be a relative or an absolute path.
Parameters:
target | The string that will become the "target" of the link (can be relative) |
dest | The symlink to create. |
overwrite | whether to automatically overwrite if the dest exists |
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 |
[virtual]
Called by the scheduler to tell the slave that the configuration changed (i.e. proxy settings) .
void |
[static]
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)
Parameters:
ready | set to true after emitting all items. _entry is not used in this case |
void |
[protected]
internal function to connect a slave to/ disconnect from either the slave pool or the application
void |
[protected]
bool |
[protected]
internal function that slaves use to see if there is any cached authentication entries
void |
[protected]
internal function to store authentication entries
bool |
[protected]
Used by the slave to check if it can connect to a given host. This should be called where the slave is ready to do a ::connect() on a socket. For each call to requestNetwork must exist a matching call to dropNetwork, or the system will stay online until KNetMgr gets closed (or the SlaveBase gets destructed)!
If KNetMgr is not running, then this is a no-op and returns true
Parameters:
host | tells the netmgr the host the slave wants to connect to. As this could also be a proxy, we can't just take the host currenctly connected to (but that's the default value) |
Returns: true in theorie, the host is reachable false the system is offline and the host is in a remote network.
void |
[protected]
Used by the slave to withdraw a connection requested by requestNetwork. This function cancels the last call to requestNetwork. If a client uses more than one internet connection, it must use dropNetwork(host) to stop each request.
If KNetMgr is not running, then this is a no-op.
A slave should call this function every time it disconnect from a host.
Parameters:
host | the host passed to requestNetwork |
QCString |
[protected]
Name of the protocol supported by this slave
Connection * |
[protected]
Generated by: prospector@porky.devel.redhat.com on Thu Aug 24 05:36:06 2000, using kdoc 2.0a36. |