KIO::SlaveBase Class Reference
#include <slavebase.h>
Inheritance diagram for KIO::SlaveBase:

Detailed Description
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.
Definition at line 45 of file slavebase.h.
Public Types | |
enum | MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 } |
Public Member Functions | |
SlaveBase (const QCString &protocol, const QCString &pool_socket, const QCString &app_socket) | |
virtual | ~SlaveBase () |
void | exit () |
void | dispatchLoop () |
void | setConnection (Connection *connection) |
Connection * | connection () const |
void | data (const QByteArray &data) |
void | dataReq () |
void | error (int _errid, const QString &_text) |
void | connected () |
void | finished () |
void | needSubURLData () |
void | slaveStatus (const QString &host, bool connected) |
void | statEntry (const UDSEntry &_entry) |
void | listEntries (const UDSEntryList &_entry) |
bool | canResume (KIO::filesize_t offset) |
void | canResume () |
void | totalSize (KIO::filesize_t _bytes) |
void | processedSize (KIO::filesize_t _bytes) |
void | processedPercent (float percent) |
void | speed (unsigned long _bytes_per_second) |
void | redirection (const KURL &_url) |
void | errorPage () |
void | mimeType (const QString &_type) |
void | warning (const QString &msg) |
void | infoMessage (const QString &msg) |
int | messageBox (MessageBoxType type, const QString &text, const QString &caption=QString::null, const QString &buttonYes=QString::null, const QString &buttonNo=QString::null) |
int | messageBox (const QString &text, MessageBoxType type, const QString &caption=QString::null, const QString &buttonYes=QString::null, const QString &buttonNo=QString::null, const QString &dontAskAgainName=QString::null) |
void | setMetaData (const QString &key, const QString &value) |
bool | hasMetaData (const QString &key) const |
QString | metaData (const QString &key) const |
bool | hasMetaData (const QString &key) |
QString | metaData (const QString &key) |
MetaData | allMetaData () const |
KConfigBase * | config () |
KRemoteEncoding * | remoteEncoding () |
virtual void | setHost (const QString &host, int port, const QString &user, const QString &pass) |
virtual void | setSubURL (const KURL &url) |
virtual void | openConnection () |
virtual void | closeConnection () |
virtual void | get (const KURL &url) |
virtual void | put (const KURL &url, int permissions, bool overwrite, bool resume) |
virtual void | stat (const KURL &url) |
virtual void | mimetype (const KURL &url) |
virtual void | listDir (const KURL &url) |
virtual void | mkdir (const KURL &url, int permissions) |
virtual void | rename (const KURL &src, const KURL &dest, bool overwrite) |
virtual void | symlink (const QString &target, const KURL &dest, bool overwrite) |
virtual void | chmod (const KURL &url, int permissions) |
virtual void | copy (const KURL &src, const KURL &dest, int permissions, bool overwrite) |
virtual void | del (const KURL &url, bool isfile) |
virtual void | special (const QByteArray &data) |
virtual void | multiGet (const QByteArray &data) |
virtual void | slave_status () |
virtual void | reparseConfiguration () |
int | connectTimeout () |
int | proxyConnectTimeout () |
int | responseTimeout () |
int | readTimeout () |
void | setTimeoutSpecialCommand (int timeout, const QByteArray &data=QByteArray()) |
virtual bool | dispatch () |
virtual void | dispatch (int command, const QByteArray &data) |
int | readData (QByteArray &buffer) |
void | listEntry (const UDSEntry &_entry, bool ready) |
void | connectSlave (const QString &path) |
void | disconnectSlave () |
bool | openPassDlg (KIO::AuthInfo &info, const QString &errorMsg) |
bool | openPassDlg (KIO::AuthInfo &info) |
bool | checkCachedAuthentication (AuthInfo &info) |
bool | cacheAuthentication (const AuthInfo &info) |
bool | pingCacheDaemon () const |
QString | createAuthCacheKey (const KURL &url) |
void | sendAuthenticationKey (const QCString &gKey, const QCString &key, bool keep) |
void | delCachedAuthentication (const QString &key) |
void | setMultipleAuthCaching (bool) |
bool | multipleAuthCaching () const |
bool | requestNetwork (const QString &host=QString::null) |
void | dropNetwork (const QString &host=QString::null) |
DCOPClient * | dcopClient () |
int | waitForAnswer (int expected1, int expected2, QByteArray &data, int *pCmd=0) |
void | sendMetaData () |
bool | wasKilled () const |
void | setKillFlag () |
Static Public Member Functions | |
static void | sigsegv_handler (int) |
static void | sigpipe_handler (int) |
Public Attributes | |
QCString | mProtocol |
Connection * | m_pConnection |
MetaData | mOutgoingMetaData |
MetaData | mIncomingMetaData |
Protected Member Functions | |
virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
UDSEntryList | pendingListEntries |
uint | listEntryCurrentSize |
long | listEntry_sec |
long | listEntry_usec |
Connection * | appconn |
QString | mPoolSocket |
QString | mAppSocket |
bool | mConnectedToApp |
Static Protected Attributes | |
static long | s_seqNr |
Member Function Documentation
|
Explicitly store authentication information. openPassDlg already stores password information automatically, you only need to call this function if you want to store authentication information that is different from the information returned by openPassDlg. Definition at line 1222 of file slavebase.cpp. |
|
Call this at the beginning of put(), to give the size of the existing partial file, if there is one.
The Definition at line 914 of file slavebase.cpp. |
|
Checks for cached authentication based on parameters given by
Use this function to check if any cached password exists for the URL given by
AuthInfo info; info.url = KURL("http://www.foobar.org/foo/bar"); info.username = "somename"; info.verifyPath = true; if ( !checkCachedAuthentication( info ) ) { if ( !openPassDlg(info) ) .... }
Definition at line 1179 of file slavebase.cpp. |
|
Change permissions on
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 795 of file slavebase.cpp. |
|
Closes the connection (forced) Called when the application disconnects the slave to close any open network connections. When the slave was operating in connection-oriented mode, it should reset itself to connectionless (default) mode. Definition at line 771 of file slavebase.cpp. |
|
Returns a configuration object to query config/meta-data information from. The application provides the slave with all configuration information relevant for the current protocol and host. Definition at line 390 of file slavebase.cpp. |
|
Call in openConnection, if you reimplement it, when you're done.
Definition at line 446 of file slavebase.cpp. |
|
internal function to connect a slave to/ disconnect from either the slave pool or the application
Definition at line 340 of file slavebase.cpp. |
|
Definition at line 1237 of file slavebase.cpp. |
|
Copy If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will ask for get + put instead.
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 789 of file slavebase.cpp. |
|
Definition at line 1138 of file slavebase.cpp. |
|
Sends data in the slave to the job (i.e. in get). To signal end of data, simply send an empty QByteArray().
Definition at line 413 of file slavebase.cpp. |
|
Asks for data from the job.
Definition at line 422 of file slavebase.cpp. |
|
Return the dcop client used by this slave.
Definition at line 245 of file slavebase.cpp. |
|
Delete a file or directory.
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 791 of file slavebase.cpp. |
|
Cached authentication information is now session based and removed automatically when a given session ends, i.e. the application is closed. Definition at line 722 of file slavebase.cpp. |
|
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.
Definition at line 645 of file slavebase.cpp. |
|
Call to signal an error. This also finishes the job, no need to call finished. If the Error code is KIO::ERR_SLAVE_DEFINED then the _text should contain the complete translated text of of the error message. This message will be displayed in an KTextBrowser which allows rich text complete with hyper links. Email links will call the default mailer, "exec:/command arg1 arg2" will be forked and all other links will call the default browser.
Definition at line 433 of file slavebase.cpp. |
|
Tell that we will only get an error page here. This means: the data you'll get isn't the data you requested, but an error page (usually HTML) that describes an error. Definition at line 558 of file slavebase.cpp. |
|
Call to signal successful completion of any command (besides openConnection and closeConnection).
Definition at line 453 of file slavebase.cpp. |
|
get, aka read.
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 781 of file slavebase.cpp. |
|
Definition at line 386 of file slavebase.cpp. |
|
Queries for the existence of a certain config/meta-data entry send by the application to the slave.
Definition at line 373 of file slavebase.cpp. |
|
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. Definition at line 624 of file slavebase.cpp. |
|
Lists the contents of 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. Reimplemented in KIO::ForwardingSlaveBase. Definition at line 779 of file slavebase.cpp. |
|
Call this in listDir, each time you have a bunch of entries to report.
Definition at line 701 of file slavebase.cpp. |
|
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)
Definition at line 659 of file slavebase.cpp. |
|
Call this to show a message box from the slave.
Definition at line 897 of file slavebase.cpp. |
|
Call this to show a message box from the slave.
Definition at line 891 of file slavebase.cpp. |
|
Definition at line 383 of file slavebase.cpp. |
|
Queries for config/meta-data send by the application to the slave.
Definition at line 364 of file slavebase.cpp. |
|
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. Reimplemented in KIO::ForwardingSlaveBase. Definition at line 783 of file slavebase.cpp. |
|
Call this in mimetype() and in get(), when you know the mimetype. See mimetype about other ways to implement it. Definition at line 575 of file slavebase.cpp. |
|
Create a directory.
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 793 of file slavebase.cpp. |
|
Used for multiple get. Currently only used foir HTTP pielining support.
Definition at line 799 of file slavebase.cpp. |
|
Definition at line 746 of file slavebase.h. |
|
Call to signal that data from the sub-URL is needed.
Definition at line 466 of file slavebase.cpp. |
|
Opens the connection (forced) When this function gets called the slave is operating in connection-oriented mode. When a connection gets lost while the slave operates in connection oriented mode, the slave should report ERR_CONNECTION_BROKEN instead of reconnecting. The user is expected to disconnect the slave in the error handler. Definition at line 769 of file slavebase.cpp. |
|
Same as above function except it does not need error message. BIC: Combine this function with the above for KDE4. Definition at line 826 of file slavebase.cpp. |
|
Prompt the user for Authorization info (login & password). Use this function to request authorization information from the end user. You can also pass an error message which explains why a previous authorization attempt failed. Here is a very simple example:
KIO::AuthInfo authInfo; if ( openPassDlg( authInfo ) ) { kdDebug() << QString::fromLatin1("User: ") << authInfo.username << endl; kdDebug() << QString::fromLatin1("Password: ") << QString::fromLatin1("Not displayed here!") << endl; } You can also preset some values like the username, caption or comment as follows:
KIO::AuthInfo authInfo; authInfo.caption= "Acme Password Dialog"; authInfo.username= "Wile E. Coyote"; QString errorMsg = "You entered an incorrect password."; if ( openPassDlg( authInfo, errorMsg ) ) { kdDebug() << QString::fromLatin1("User: ") << authInfo.username << endl; kdDebug() << QString::fromLatin1("Password: ") << QString::fromLatin1("Not displayed here!") << endl; }
Definition at line 831 of file slavebase.cpp. |
|
Definition at line 1157 of file slavebase.cpp. |
|
Only use this if you can't know in advance the size of the copied data. For example, if you're doing variable bitrate compression of the source. STUB ! Currently unimplemented. Here now for binary compatibility. 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. Definition at line 538 of file slavebase.cpp. |
|
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. Definition at line 502 of file slavebase.cpp. |
|
Definition at line 1247 of file slavebase.cpp. |
|
put, i.e. write data into a file.
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 775 of file slavebase.cpp. |
|
Read data send by the job, after a dataReq.
Definition at line 964 of file slavebase.cpp. |
|
Definition at line 1269 of file slavebase.cpp. |
|
Call this to signal a redirection The job will take care of going to that url.
Definition at line 552 of file slavebase.cpp. |
|
Returns an object that can translate remote filenames into proper Unicode forms. This encoding can be set by the user.
Definition at line 405 of file slavebase.cpp. |
|
Rename If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will ask for copy + del instead.
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 785 of file slavebase.cpp. |
|
Called by the scheduler to tell the slave that the configuration changed (i.e. proxy settings) . Definition at line 806 of file slavebase.cpp. |
|
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
Definition at line 630 of file slavebase.cpp. |
|
Definition at line 1258 of file slavebase.cpp. |
|
Cache authentication information is now stored automatically by openPassDlg. Definition at line 714 of file slavebase.cpp. |
|
Internal function to transmit meta data to the application.
Definition at line 395 of file slavebase.cpp. |
|
Set the host.
Definition at line 765 of file slavebase.cpp. |
|
Internally used.
Definition at line 1284 of file slavebase.cpp. |
|
Sets meta-data to be send to the application before the first data() or finished() signal.
Definition at line 359 of file slavebase.cpp. |
|
Definition at line 740 of file slavebase.h. |
|
Prepare slave for streaming operation.
Definition at line 797 of file slavebase.cpp. |
|
This function sets a timeout of A timeout can only occur when the slave is waiting for a command from the application. Specifying a negative timeout cancels a pending timeout. Only one timeout at a time is supported, setting a timeout cancels any pending timeout.
Definition at line 971 of file slavebase.cpp. |
|
Called to get the status of the slave. Slave should respond by calling slaveStatus(...) Definition at line 803 of file slavebase.cpp. |
|
Used to report the status of the slave.
Definition at line 471 of file slavebase.cpp. |
|
Used for any command that is specific to this slave (protocol) Examples are : HTTP POST, mount and unmount (kio_file).
Definition at line 777 of file slavebase.cpp. |
|
Call this in get and copy, to give the current transfer speed, but only if it can't be calculated out of the size you passed to processedSize (in most cases you don't want to call it).
Definition at line 544 of file slavebase.cpp. |
|
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. Reimplemented in KIO::ForwardingSlaveBase. Definition at line 773 of file slavebase.cpp. |
|
Call this from stat() to express details about an object, the UDSEntry customarily contains the atoms describing file name, size, mimetype, etc.
Definition at line 651 of file slavebase.cpp. |
|
Creates a symbolic link named
Reimplemented in KIO::ForwardingSlaveBase. Definition at line 787 of file slavebase.cpp. |
|
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.
Definition at line 486 of file slavebase.cpp. |
|
Wait for an answer to our request, until we get
Definition at line 936 of file slavebase.cpp. |
|
Call to signal a warning, to be displayed in a dialog box.
Definition at line 618 of file slavebase.cpp. |
|
If your ioslave was killed by a signal, wasKilled() returns true. Check it regularly in lengthy functions (e.g. in get();) and return as fast as possible from this function if wasKilled() returns true. This will ensure that your slave destructor will be called correctly.
Definition at line 1279 of file slavebase.cpp. |
Member Data Documentation
|
Name of the protocol supported by this slave.
Definition at line 803 of file slavebase.h. |
The documentation for this class was generated from the following files: