class KIOJob

A main class for doing IO operations. More...

Definition#include <kio_simpleprogress_dlg.h>
InheritsKIOJobBase, QObject (kdecore)
Inherited byKIOCachedJob
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Signals

Public Static Methods

Public Members

Protected Types

Protected Methods

Protected Slots

Protected Static Methods

Protected Members


Detailed Description

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:
_modeif 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:
_modeNONE - 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 )
[virtual]

Directory listing. Will emit sigListEntry and/or error signals "." and ".." are listed as well.

bool testDir ( const char *_url )
[virtual]

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 )
[virtual]

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 ()
[virtual]

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 )
[virtual]

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:
quietif true - KIOJob will not emit sigCanceled when killed. This is a default value.

QString convertSize ( unsigned long size )
[static]

Convert size from bytes to the string representation.

Parameters:
_sizesize in bytes

Returns: converted size as a string - e.g. 123.4 kB , 12 MB

void sigError ( int id, int errid, const char *txt )
[signal]

KIOJob has stopped because of error.

Parameters:
idid number of this KIOJob.
erridid number of the error.
txtadditional text message for the error.

void sigFinished ( int id )
[signal]

KIOJob has finished.

Parameters:
idid number of this KIOJob.

void sigCanceled ( int id )
[signal]

KIOJob has been canceled.

Parameters:
idid number of this KIOJob.

void sigListEntry ( int id, const KUDSEntry& entry )
[signal]

A new entry has been found by listDir

Parameters:
idid number of this KIOJob.
entryinformation on this entry

void sigRenamed ( int id, const char *name )
[signal]

The saved file has been renamed.

Parameters:
idid number of this KIOJob.
namenew name of the destination file ( Usually from rename dialog ).

void sigCopying (int id, const char *from, const char *to )
[signal]

Copying has been started.

Parameters:
idid number of this KIOJob.
froma source name.
toa destination name.

void sigScanningDir ( int id, const char *dir )
[signal]

Directory is being scanned.

Parameters:
idid number of this KIOJob.
dira name of scanned directory.

void sigMakingDir ( int id, const char *dir )
[signal]

Directory is being made.

Parameters:
idid number of this KIOJob.
dira name of created directory.

void sigGettingFile ( int id, const char *url )
[signal]

Fetching has been started.

Parameters:
idid number of this KIOJob.
urla name of fetched file.

void sigDeletingFile ( int id, const char *url )
[signal]

Deleting has been started.

Parameters:
idid number of this KIOJob.
urla name of deleted file.

void sigCanResume ( int id, bool resume )
[signal]

KIOJob can / cannot be resumed.

Parameters:
idid number of this KIOJob.
resumeif true - this KIOJob can be resumed. if false - this KIOJob cannot be resumed.

void sigPreData ( int id, const char *data, int len )
[signal]

Parameters:
idid number of this KIOJob.
datamay be 0L if the file has zero size.

void sigSpeed ( int id, unsigned long bytes_per_second )
[signal]

Current speed of the transfer in bytes per second.

Parameters:
idid number of this KIOJob.
bytes_per_secondspeed in bytes per second.

void sigTotalSize ( int id, unsigned long bytes )
[signal]

Total size of transfer ( counted recursively in case of directories ).

Parameters:
idid number of this KIOJob.
bytestotal size in bytes.

void sigTotalFiles ( int id, unsigned long files )
[signal]

Total number of files in this transfer ( counted recursively ).

Parameters:
idid number of this KIOJob.
filestotal number of files.

void sigTotalDirs ( int id, unsigned long dirs )
[signal]

Total number of directories in this transfer ( counted recursively ).

Parameters:
idid number of this KIOJob.
dirstotal number of directories.

void sigProcessedSize ( int id, unsigned long bytes )
[signal]

Already processed size in bytes.

Parameters:
idid number of this KIOJob.
bytesprocessed size in bytes.

void sigPercent ( int id, unsigned long percent )
[signal]

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:
idid number of this KIOJob.
percentprocessed size in percent.

void sigProcessedFiles ( int id, unsigned long files )
[signal]

Number of already transfered files.

Parameters:
idid number of this KIOJob.
filesnumber of processed files.

void sigProcessedDirs ( int id, unsigned long dirs )
[signal]

Number of already transfered directories.

Parameters:
idid number of this KIOJob.
dirsnumber of processed directories.

void slotDispatch ( int, int & )
[protected virtual slot]

Connected to KProcess

m_pNotifier

void slotCancel ()
[protected virtual slot]

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 *)
[protected slot]

Slave has died.

void clean ()
[protected]

Cleanup function used in the destructor.

KIOSlave* createSlave ( const char *_protocol, int& _error, QString & _error_text )
[protected]

Creates a new slave if the KIOSlavePool has no matching one. m_pSlave and m_strSlaveProtocol are set accordingly on success.

Parameters:
_erroris the error code on failure and undefined else.
_error_textis 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 )
[protected]

Creates a new slave if the KIOSlavePool has no matching one. m_pSlave and m_strSlaveProtocol are set accordingly on success.

Parameters:
_erroris the error code on failure and undefined else.
_error_textis the error text on failure and undefined else.

Returns: m_pSlave on success or 0L on failure.

bool m_bPreGet
[protected]

Used in preget


Generated by: root@tantive.terraplex.com on Sun Feb 27 17:39:31 2000, using kdoc 2.0a33.