|
|
This is main class for doing IO operations.
Use this class if you need to do any file transfer using various transfer protocols. Simply create new instance of this class, connect your custom slots to KIOJob signals and then call methods like copy, get, mount etc.
KIOJob by default shows progress dialog for these operations ( this feature can be turned off ).
KIOJob emits signals for almost all events that happen during transfer. Utilize these for more sophisticated control over transfer. The most important are sigFinished and sigError
KIOProgressBase* progressDlg () |
Call this, if you want to do a runtime manipulation with progress dialog. KIOProgressBase inherits QWidget, so you can call e.g. show(), hide() methods.
Returns: pointer to a SIMPLE or CUSTOM progress dialog, depends on settings.
KIOListProgressDlg* listProgressDlg () |
Call this, if you want to do a runtime manipulation with list progress dialog. KIOListProgressDlg inherits KTMainWindow, so you can call e.g. show(), hide() methods.
Returns: pointer to a list progress dialog.
void setAutoDelete ( bool _mode ) |
AutoDelete mode is turned on by default. It is not recommended to turn it off. Later versions may not even be able to turn it off at all.
void cacheToPool ( bool _mode ) |
Use this to set whether KIOJob should cache slaves into the pool. Caching means, that when slave is done it is cached for next use. This also means, that it is kept in the memory.
Parameters:
_mode | if true - cache slaves to the pool. This is a default value. if false - don't cache them but destroy immediately after it's done. |
void setGUImode ( GUImode _mode ) |
Specify what type of GUI will this KIOJob use. Call this before you call any other operation method ( copy, move, del etc. ) Valid values are NONE, SIMPLE and LIST
Parameters:
_mode | NONE - don't show any dialogs. SIMPLE - show a simple progress dialog. It shows progress for one operation. LIST - show a list progress dialog. It shows progress for all operations. |
void setProgressDlg ( KIOProgressBase *dlg ) |
Set a custom progress dialog. Call this before you call any other operation method ( copy, move, del etc. ) Custom progress dialog must inherit from KIOProgressBase.
Parameters:
dlg | - custom progress dialog. |
bool listDir ( const char *_url ) |
Directory listing. Will emit sigListEntry and/or error signals "." and ".." are listed as well.
bool testDir ( const char *_url ) |
Tests whether _url is a directory. Will emit sigIsDirectory or sigIsFile depending on which one it is.
bool preget ( const char *_url, int _max_len ) |
Starts fetching '_url' and buffers _max_len characters or some more if available. These are sent using sigPreData. If we know about the mimetype ( example HTTP protocol ) then sigMimeType is called and no data is buffered. The connection is sleeping until someone calls cont.
void cont () |
Call only after using preget and after you received either the signal sigMimeType or sigPreData. Afte calling this functions the KIOJob behaves like calling get. All buffered data is emitted using sigData now.
void kill ( bool quiet = false ) |
Stops the current action ( that means kills any running servers associated with this job and deletes itself ignoring whether auto-delete mode is on or off.
Parameters:
quiet | if true - KIOJob will not emit sigCanceled when killed. This is a default value. |
QString convertSize ( unsigned long size ) |
Convert size from bytes to the string representation.
Parameters:
_size | size in bytes |
Returns: converted size as a string - e.g. 123.4 kB , 12 MB
void sigError ( int id, int errid, const char *txt ) |
KIOJob has stopped because of error.
Parameters:
id | id number of this KIOJob. |
errid | id number of the error. |
txt | additional text message for the error. |
void sigFinished ( int id ) |
KIOJob has finished.
Parameters:
id | id number of this KIOJob. |
void sigCanceled ( int id ) |
KIOJob has been canceled.
Parameters:
id | id number of this KIOJob. |
void sigListEntry ( int id, const KUDSEntry& entry ) |
A new entry has been found by listDir
Parameters:
id | id number of this KIOJob. |
entry | information on this entry |
void sigRenamed ( int id, const char *name ) |
The saved file has been renamed.
Parameters:
id | id number of this KIOJob. |
name | new name of the destination file ( Usually from rename dialog ). |
void sigCopying (int id, const char *from, const char *to ) |
Copying has been started.
Parameters:
id | id number of this KIOJob. |
from | a source name. |
to | a destination name. |
void sigScanningDir ( int id, const char *dir ) |
Directory is being scanned.
Parameters:
id | id number of this KIOJob. |
dir | a name of scanned directory. |
void sigMakingDir ( int id, const char *dir ) |
Directory is being made.
Parameters:
id | id number of this KIOJob. |
dir | a name of created directory. |
void sigGettingFile ( int id, const char *url ) |
Fetching has been started.
Parameters:
id | id number of this KIOJob. |
url | a name of fetched file. |
void sigDeletingFile ( int id, const char *url ) |
Deleting has been started.
Parameters:
id | id number of this KIOJob. |
url | a name of deleted file. |
void sigCanResume ( int id, bool resume ) |
KIOJob can / cannot be resumed.
Parameters:
id | id number of this KIOJob. |
resume | if true - this KIOJob can be resumed. if false - this KIOJob cannot be resumed. |
void sigPreData ( int id, const char *data, int len ) |
Parameters:
id | id number of this KIOJob. |
data | may be 0L if the file has zero size. |
void sigSpeed ( int id, unsigned long bytes_per_second ) |
Current speed of the transfer in bytes per second.
Parameters:
id | id number of this KIOJob. |
bytes_per_second | speed in bytes per second. |
void sigTotalSize ( int id, unsigned long bytes ) |
Total size of transfer ( counted recursively in case of directories ).
Parameters:
id | id number of this KIOJob. |
bytes | total size in bytes. |
void sigTotalFiles ( int id, unsigned long files ) |
Total number of files in this transfer ( counted recursively ).
Parameters:
id | id number of this KIOJob. |
files | total number of files. |
void sigTotalDirs ( int id, unsigned long dirs ) |
Total number of directories in this transfer ( counted recursively ).
Parameters:
id | id number of this KIOJob. |
dirs | total number of directories. |
void sigProcessedSize ( int id, unsigned long bytes ) |
Already processed size in bytes.
Parameters:
id | id number of this KIOJob. |
bytes | processed size in bytes. |
void sigPercent ( int id, unsigned long percent ) |
Already processed size in percent. This is different from sigProcessedSize(), because it is not emited everytime the processed size changes, but only when percent changes.
Parameters:
id | id number of this KIOJob. |
percent | processed size in percent. |
void sigProcessedFiles ( int id, unsigned long files ) |
Number of already transfered files.
Parameters:
id | id number of this KIOJob. |
files | number of processed files. |
void sigProcessedDirs ( int id, unsigned long dirs ) |
Number of already transfered directories.
Parameters:
id | id number of this KIOJob. |
dirs | number of processed directories. |
void slotDispatch ( int, int & ) |
Connected to KProcess
m_pNotifier
void slotCancel () |
Stops the current action ( that means kills any running servers associated with this KIOJob and deletes itself if auto-delete mode is on.
void slotSlaveDied ( KProcess *) |
Slave has died.
void clean () |
Cleanup function used in the destructor.
KIOSlave* createSlave ( const char *_protocol, int& _error, QString & _error_text ) |
Creates a new slave if the KIOSlavePool has no matching one. m_pSlave and m_strSlaveProtocol are set accordingly on success.
Parameters:
_error | is the error code on failure and undefined else. |
_error_text | is the error text on failure and undefined else. |
Returns: m_pSlave on success or 0L on failure.
KIOSlave* createSlave ( const char *_protocol, const char *_host, const char *_user, const char *_pass, int& _error, QString& _error_text ) |
Creates a new slave if the KIOSlavePool has no matching one. m_pSlave and m_strSlaveProtocol are set accordingly on success.
Parameters:
_error | is the error code on failure and undefined else. |
_error_text | is the error text on failure and undefined else. |
Returns: m_pSlave on success or 0L on failure.
bool m_bPreGet |
Used in preget
Generated by: root@tantive.terraplex.com on Sun Feb 27 17:39:31 2000, using kdoc 2.0a33. |