namespace KIO
|
A namespace for KIO globals. More... |
|
|
Public Types
- struct Task
- class Connection
- enum Error {ERR_CANNOT_OPEN_FOR_READING = 1, ERR_CANNOT_OPEN_FOR_WRITING = 2, ERR_CANNOT_LAUNCH_PROCESS = 3, ERR_INTERNAL = 4, ERR_MALFORMED_URL = 5, ERR_UNSUPPORTED_PROTOCOL = 6, ERR_NO_SOURCE_PROTOCOL = 7, ERR_UNSUPPORTED_ACTION = 8, ERR_IS_DIRECTORY = 9, ERR_IS_FILE = 10, ERR_DOES_NOT_EXIST = 11, ERR_FILE_ALREADY_EXIST = 12, ERR_DIR_ALREADY_EXIST = 13, ERR_UNKNOWN_HOST = 14, ERR_ACCESS_DENIED = 15, ERR_WRITE_ACCESS_DENIED = 16, ERR_CANNOT_ENTER_DIRECTORY = 17, ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = 18, ERR_CYCLIC_LINK = 19, ERR_USER_CANCELED = 20, ERR_CYCLIC_COPY = 21, ERR_COULD_NOT_CREATE_SOCKET = 22, ERR_COULD_NOT_CONNECT = 23, ERR_CONNECTION_BROKEN = 24, ERR_NOT_FILTER_PROTOCOL = 25, ERR_COULD_NOT_MOUNT = 26, ERR_COULD_NOT_UNMOUNT = 27, ERR_COULD_NOT_READ = 28, ERR_COULD_NOT_WRITE = 29, ERR_COULD_NOT_BIND = 30, ERR_COULD_NOT_LISTEN = 31, ERR_COULD_NOT_ACCEPT = 32, ERR_COULD_NOT_LOGIN = 33, ERR_COULD_NOT_STAT = 34, ERR_COULD_NOT_CLOSEDIR = 35, ERR_COULD_NOT_MKDIR = 37, ERR_COULD_NOT_RMDIR = 38, ERR_CANNOT_RESUME = 39, ERR_CANNOT_RENAME = 40, ERR_CANNOT_CHMOD = 41, ERR_CANNOT_DELETE = 42, ERR_SLAVE_DIED = 43, ERR_OUT_OF_MEMORY = 44, ERR_UNKNOWN_PROXY_HOST = 45, ERR_COULD_NOT_AUTHENTICATE = 46, ERR_ABORTED = 47, ERR_INTERNAL_SERVER = 48, ERR_SERVER_TIMEOUT = 49, ERR_SERVICE_NOT_AVAILABLE = 50, ERR_UNKNOWN = 51, ERR_UNKNOWN_INTERRUPT = 53, ERR_CANNOT_DELETE_ORIGINAL = 54, ERR_CANNOT_DELETE_PARTIAL = 55, ERR_CANNOT_RENAME_ORIGINAL = 56, ERR_CANNOT_RENAME_PARTIAL = 57, ERR_NEED_PASSWD = 58 }
- enum UDSAtomTypes {UDS_STRING = 1, UDS_LONG = 2, UDS_TIME = 4 | UDS_LONG, UDS_SIZE = 8 | UDS_LONG, UDS_USER = 16 | UDS_STRING, UDS_GROUP = 32 | UDS_STRING, UDS_NAME = 64 | UDS_STRING, UDS_ACCESS = 128 | UDS_LONG, UDS_MODIFICATION_TIME = 256 | UDS_TIME, UDS_ACCESS_TIME = 512 | UDS_TIME, UDS_CREATION_TIME = 1024 | UDS_TIME, UDS_FILE_TYPE = 2048 | UDS_LONG, UDS_LINK_DEST = 4096 | UDS_STRING, UDS_URL = 8192 | UDS_STRING, UDS_MIME_TYPE = 16384 | UDS_STRING }
- class UDSAtom
- typedef QValueList<UDSAtom> UDSEntry
- typedef QList<UDSEntry> UDSEntryList
- typedef QListIterator<UDSEntry> UDSEntryListIterator
- class Slave
- class SlaveInterface
- class Job
- class SimpleJob
- class StatJob
- class TransferJob
- class MimetypeJob
- class FileCopyJob
- class ListJob
- struct CopyInfo
- class CopyJob
- class DeleteJob
- class KAutoMount
- class KAutoUnmount
- class NetAccess
- class PassDlg
- enum Progress {DEFAULT = 1, STATUSBAR = 2, LIST = 3 }
- class ProgressBase
- enum RenameDlg_Mode {M_OVERWRITE = 1, M_OVERWRITE_ITSELF = 2, M_SKIP = 4, M_SINGLE = 8, M_MULTI = 16, M_RESUME = 32 }
- enum RenameDlg_Result {R_RESUME = 6, R_RESUME_ALL = 7, R_OVERWRITE = 4, R_OVERWRITE_ALL = 5, R_SKIP = 2, R_AUTO_SKIP = 3, R_RENAME = 1, R_CANCEL = 0 }
- class RenameDlg
- class Scheduler
- enum SkipDlg_Result {S_SKIP = 1, S_AUTO_SKIP = 2, S_CANCEL = 0 }
- class SkipDlg
- class SlaveBase
- enum Command {CMD_HOST = '0', CMD_CONNECT = '1', CMD_DISCONNECT = '2', CMD_SLAVE_STATUS = '3', CMD_SLAVE_CONNECT = '4', CMD_NONE = 'A', CMD_TESTDIR = 'B', CMD_GET = 'C', CMD_PUT = 'D', CMD_STAT = 'E', CMD_MIMETYPE = 'F', CMD_LISTDIR = 'G', CMD_MKDIR = 'H', CMD_RENAME = 'I', CMD_COPY = 'J', CMD_DEL = 'K', CMD_CHMOD = 'L', CMD_SPECIAL = 'M', CMD_USERPASS = 'N' }
- enum Info {INF_TOTAL_SIZE = 10, INF_TOTAL_COUNT_OF_FILES, INF_TOTAL_COUNT_OF_DIRS, INF_PROCESSED_SIZE, INF_PROCESSED_COUNT_OF_FILES, INF_PROCESSED_COUNT_OF_DIRS, INF_SCANNING_DIR, INF_SPEED, INF_COPYING_FILE, INF_MAKING_DIR, INF_REDIRECTION = 20, INF_MIME_TYPE, INF_ERROR_PAGE, INF_WARNING, INF_GETTING_FILE, INF_DELETING_FILE, INF_NEED_PASSWD }
- enum Message {MSG_DATA = 100, MSG_DATA_REQ, MSG_ERROR, MSG_CONNECTED, MSG_FINISHED, MSG_STAT_ENTRY, MSG_LIST_ENTRIES, MSG_RENAMED, MSG_RESUME, MSG_SLAVE_STATUS, MSG_SLAVE_ACK }
- class StatusbarProgress
Public Methods
- QString convertSize ( unsigned long size )
- QString encodeFileName ( const QString & str )
- QString decodeFileName ( const QString & str )
- QString findDeviceMountPoint ( const QString& device )
- inline QDataStream& operator<< (QDataStream& s, unsigned long n)
- SimpleJob * mkdir ( const KURL& url, int permissions = -1 )
- SimpleJob * rmdir ( const KURL& url )
- SimpleJob * chmod ( const KURL& url, int permissions )
- SimpleJob * special ( const KURL& url, const QByteArray & data )
- SimpleJob * mount ( bool ro, const char *fstype, const QString& dev, const QString& point )
- SimpleJob * unmount ( const QString & point )
- StatJob * stat ( const KURL& url )
- TransferJob * get ( const KURL& url, bool reload=false )
- TransferJob * put ( const KURL& url, int permissions, bool overwrite, bool resume )
- TransferJob * http_post ( const KURL& url, const QByteArray &postData )
- MimetypeJob * mimetype ( const KURL& url )
- FileCopyJob * file_copy ( const KURL& src, const KURL& dest, int permissions=-1, bool overwrite=false, bool resume=false)
- FileCopyJob * file_move ( const KURL& src, const KURL& dest, int permissions=-1, bool overwrite=false, bool resume=false)
- SimpleJob * file_delete ( const KURL& src)
- bool link ( const KURL::List& src, const KURL& dest )
- ListJob * listDir ( const KURL& url )
- ListJob * listRecursive ( const KURL& url )
- CopyJob * copy ( const KURL& src, const KURL& dest )
- CopyJob * copy ( const KURL::List& src, const KURL& dest )
- CopyJob * move ( const KURL& src, const KURL& dest )
- CopyJob * move ( const KURL::List& src, const KURL& dest )
- DeleteJob * del ( const KURL& src, bool shred = false )
- DeleteJob * del ( const KURL::List& src, bool shred = false )
- void pasteClipboard ( const KURL& _dest_url, bool move = false )
- void pasteData ( const KURL& _dest_url, const QByteArray& _data )
- bool isClipboardEmpty ()
- RenameDlg_Result open_RenameDlg ( const QString & caption, const QString& src, const QString & dest, RenameDlg_Mode mode, QString& newDest, unsigned long sizeSrc = -1, unsigned long sizeDest = -1, time_t ctimeSrc = (time_t) -1, time_t ctimeDest = (time_t) -1, time_t mtimeSrc = (time_t) -1, time_t mtimeDest = (time_t) -1 )
- SkipDlg_Result open_SkipDlg ( bool _multi, const QString& _error_text = QString::null )
Public Members
Detailed Description
This class provides a simple means for IPC between two applications
via a pipe.
It handles a queue of commands to be sent, and has a internal signal
called after a command has been sent, to send the next one (FIFO).
QString convertSize ( unsigned long size )
|
Convert size from bytes to the string representation.
Parameters:
Returns: converted size as a string - e.g. 123.4 kB , 12.0 MB
Encode (from the text displayed to the real filename)
This translates % into %% and / into %2f
Used by KIO::link, for instance.
Decode (from the filename to the text displayed)
This translates %2[fF] into / and %% into %
enum Error {ERR_CANNOT_OPEN_FOR_READING = 1, ERR_CANNOT_OPEN_FOR_WRITING = 2, ERR_CANNOT_LAUNCH_PROCESS = 3, ERR_INTERNAL = 4, ERR_MALFORMED_URL = 5, ERR_UNSUPPORTED_PROTOCOL = 6, ERR_NO_SOURCE_PROTOCOL = 7, ERR_UNSUPPORTED_ACTION = 8, ERR_IS_DIRECTORY = 9, ERR_IS_FILE = 10, ERR_DOES_NOT_EXIST = 11, ERR_FILE_ALREADY_EXIST = 12, ERR_DIR_ALREADY_EXIST = 13, ERR_UNKNOWN_HOST = 14, ERR_ACCESS_DENIED = 15, ERR_WRITE_ACCESS_DENIED = 16, ERR_CANNOT_ENTER_DIRECTORY = 17, ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = 18, ERR_CYCLIC_LINK = 19, ERR_USER_CANCELED = 20, ERR_CYCLIC_COPY = 21, ERR_COULD_NOT_CREATE_SOCKET = 22, ERR_COULD_NOT_CONNECT = 23, ERR_CONNECTION_BROKEN = 24, ERR_NOT_FILTER_PROTOCOL = 25, ERR_COULD_NOT_MOUNT = 26, ERR_COULD_NOT_UNMOUNT = 27, ERR_COULD_NOT_READ = 28, ERR_COULD_NOT_WRITE = 29, ERR_COULD_NOT_BIND = 30, ERR_COULD_NOT_LISTEN = 31, ERR_COULD_NOT_ACCEPT = 32, ERR_COULD_NOT_LOGIN = 33, ERR_COULD_NOT_STAT = 34, ERR_COULD_NOT_CLOSEDIR = 35, ERR_COULD_NOT_MKDIR = 37, ERR_COULD_NOT_RMDIR = 38, ERR_CANNOT_RESUME = 39, ERR_CANNOT_RENAME = 40, ERR_CANNOT_CHMOD = 41, ERR_CANNOT_DELETE = 42, ERR_SLAVE_DIED = 43, ERR_OUT_OF_MEMORY = 44, ERR_UNKNOWN_PROXY_HOST = 45, ERR_COULD_NOT_AUTHENTICATE = 46, ERR_ABORTED = 47, ERR_INTERNAL_SERVER = 48, ERR_SERVER_TIMEOUT = 49, ERR_SERVICE_NOT_AVAILABLE = 50, ERR_UNKNOWN = 51, ERR_UNKNOWN_INTERRUPT = 53, ERR_CANNOT_DELETE_ORIGINAL = 54, ERR_CANNOT_DELETE_PARTIAL = 55, ERR_CANNOT_RENAME_ORIGINAL = 56, ERR_CANNOT_RENAME_PARTIAL = 57, ERR_NEED_PASSWD = 58 }
|
Error codes that can be emitted by KIO.
enum UDSAtomTypes {UDS_STRING = 1, UDS_LONG = 2, UDS_TIME = 4 | UDS_LONG, UDS_SIZE = 8 | UDS_LONG, UDS_USER = 16 | UDS_STRING, UDS_GROUP = 32 | UDS_STRING, UDS_NAME = 64 | UDS_STRING, UDS_ACCESS = 128 | UDS_LONG, UDS_MODIFICATION_TIME = 256 | UDS_TIME, UDS_ACCESS_TIME = 512 | UDS_TIME, UDS_CREATION_TIME = 1024 | UDS_TIME, UDS_FILE_TYPE = 2048 | UDS_LONG, UDS_LINK_DEST = 4096 | UDS_STRING, UDS_URL = 8192 | UDS_STRING, UDS_MIME_TYPE = 16384 | UDS_STRING }
|
Constants used to specify the type of a KUDSAtom.
Universal Directory Service
Any file or URL can be represented by the UDSEntry type below
A UDSEntry is a list of atoms
Each atom contains a specific bit of information for the file
The following UDS constants represent the different possible values
for m_uds in the UDS atom structure below
Each atom contains a specific bit of information for the file
An entry is the list of atoms containing all the informations for a file or URL
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.
A call to foo() results in a call to slotFoo() on the other end.
The base class for all jobs.
For all jobs created in an application, the code looks like
KIO::Job * job = KIO::someoperation( some parameters );
connect( job, SIGNAL( result( KIO::Job * ) ),
this, SLOT( slotResult( KIO::Job * ) ) );
(other connects, specific to the job)
And slotResult is usually at least:
if ( job->error() )
job->showErrorDialog( this or 0L );
A simple job (one url and one command)
This is the base class for all jobs that are scheduled.
Other jobs are high-level jobs (CopyJob, DeleteJob, FileCopyJob...)
that manage subjobs but aren't scheduled directly.
The tranfer job pumps data into and/or out of a Slave.
Data is sent to the slave on request of the slave (dataReq).
If data coming from the slave can not be handled, the
reading of data from the slave should be suspended.
The FileCopyJob copies data from one place to another.
SimpleJob * mkdir ( const KURL& url, int permissions = -1 )
|
Creates a single directory.
@param url
the URL of the directory to create
@param permissions
the permissions to set after creating the directory
Returns: a pointer to the job handling the operation.
SimpleJob * rmdir ( const KURL& url )
|
Removes a single directory.
assumed to be empty
@param url
the URL of the directory to remove
Returns: a pointer to the job handling the operation.
SimpleJob * chmod ( const KURL& url, int permissions )
|
Change permissions on a file or directory
Parameters:
url | the URL of file or directory
|
permissions | the permissions to set
|
Returns: the job handling the operation
Any command that is specific to one slave (protocol)
Examples are : HTTP POST, mount and unmount (kio_file)
Parameters:
url | the url isn't passed to the slave, but is used to know
which slave to send it to :-)
|
data | packed data; the meaning is completely dependent on the
slave, but usually starts with an int for the command number.
|
SimpleJob * mount ( bool ro, const char *fstype, const QString& dev, const QString& point )
|
Mount, special job for kio_file
Parameters:
ro | mount read-only if true
|
fstype | file system type (e.g. "ext2", can be 0L)
|
dev | device (e.g. /dev/sda0)
|
point | mount point, can be null
|
SimpleJob * unmount ( const QString & point )
|
Unmount, special job for kio_file
Parameters:
StatJob * stat ( const KURL& url )
|
Finds all details for one file or directory.
TransferJob * get ( const KURL& url, bool reload=false )
|
get, aka read.
The slave emits the data through data
TransferJob * put ( const KURL& url, int permissions, bool overwrite, bool resume )
|
put, aka write.
Parameters:
url | where to write data
|
permissions | may be -1. In this case no special permission mode is set.
|
overwrite | if true, any existing file will be overwritten
|
resume | |
TransferJob * http_post ( const KURL& url, const QByteArray &postData )
|
HTTP POST (for form data)
Parameters:
url | where to write data
|
postData | encoded data to post
|
MimetypeJob * mimetype ( const KURL& url )
|
Finds mimetype for one file or directory.
FileCopyJob * file_copy ( const KURL& src, const KURL& dest, int permissions=-1, bool overwrite=false, bool resume=false)
|
Copies a single file
Uses either SlaveBase::copy() if the slave supports that
or get() & put() otherwise.
Parameters:
src | where to get the file
|
dest | where to put the file
|
permissions | may be -1. In this case no special permission mode is set.
|
overwrite | if true, any existing file will be overwritten
|
resume | |
FileCopyJob * file_move ( const KURL& src, const KURL& dest, int permissions=-1, bool overwrite=false, bool resume=false)
|
Moves a single file.
Uses either SlaveBase::rename() if the slave supports that,
copy() & del() otherwise, or eventually get() & put() & del()
Parameters:
src | where to get the file
|
dest | where to put the file
|
permissions | may be -1. In this case no special permission mode is set.
|
overwrite | if true, any existing file will be overwritten
|
resume | |
SimpleJob * file_delete ( const KURL& src)
|
Delete a single file.
Parameters:
Create a link
This not yet a job, and will become only if at least one other
protocol than file has support for it :)
Parameters:
src | local files will result in symlinks,
remote files will result in Type=Link .desktop files
|
dest | destination, has to be a local file currently.
|
Returns: true on success, false on failure
ListJob * listDir ( const KURL& url )
|
Lists the contents of url
, which is assumed to be a directory.
"." and ".." are returned, filter them out if you don't want them.
ListJob * listRecursive ( const KURL& url )
|
The same, recursive.
"." and ".." are returned but only for the toplevel directory.
Filter them out if you don't want them.
DeleteJob * del ( const KURL& src, bool shred = false )
|
Delete a file or directory
Parameters:
src | file to delete
|
shred | if true, delete in a way that makes recovery impossible
(only supported for local files currently)
|
This class isn't meant to be used as a class but only as a simple
namespace for static functions, though an instance of the class
is built for internal purposes.
KIO::NetAccess implements the Net Transparency, which was formerly
provided by kfmlib, but now using KIO::Jobs.
Whereas a kiojob is asynchronous, meaning that the developer has
to connect slots for it, KIO::NetAccess provides synchronous downloads
and uploads, as well as temporary file creation and removal.
Port to kio done by David Faure, faure@kde.org
Base class for IO progress dialogs.
This class does all initialization stuff for progress,
like connecting signals to slots.
All slots are implemented as pure virtual methods.
All custom IO progress dialog should inherit this class.
Add your GUI code to the constructor and implemement those virtual
methods which you need in order to display progress.
E.g. StatusbarProgress only implements slotTotalSize,
slotPercent and slotSpeed.
Custom progress dialog will be used like this :
// create job
CopyJob* job = KIO::copy(...);
// create a dialog
MyCustomProgress *customProgress;
customProgress = new MyCustomProgress();
// connect progress with job
customProgress->setJob( job );
...
There is a special method setStopOnClose that controls the behaviour of
the dialog.
RenameDlg_Result open_RenameDlg ( const QString & caption, const QString& src, const QString & dest, RenameDlg_Mode mode, QString& newDest, unsigned long sizeSrc = -1, unsigned long sizeDest = -1, time_t ctimeSrc = (time_t) -1, time_t ctimeDest = (time_t) -1, time_t mtimeSrc = (time_t) -1, time_t mtimeDest = (time_t) -1 )
|
Construct a modal, parent-less "rename" dialog, and return
a result code, as well as the new dest. Much easier to use than the
class RenameDlg directly.
The following parameters bring optionnal information about src
and dest
Parameters:
caption | the caption for the dialog box
|
src | the file/dir we're trying to copy, as it's part of the text message
|
dest | the destination file/dir, i.e. the one that already exists
|
mode | parameters for the dialog (which buttons to show...), @see RenameDlg_Mode
|
newDest | the new destination path, valid if R_RENAME was returned.
|
sizeSrc | size of source file
|
sizeDest | size of destination file
|
ctimeSrc | creation time of source file
|
ctimeDest | creation time of destination file
|
mtimeSrc | modification time of source file
|
mtimeDest | modification time of destination file
|
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.
enum Command {CMD_HOST = '0', CMD_CONNECT = '1', CMD_DISCONNECT = '2', CMD_SLAVE_STATUS = '3', CMD_SLAVE_CONNECT = '4', CMD_NONE = 'A', CMD_TESTDIR = 'B', CMD_GET = 'C', CMD_PUT = 'D', CMD_STAT = 'E', CMD_MIMETYPE = 'F', CMD_LISTDIR = 'G', CMD_MKDIR = 'H', CMD_RENAME = 'I', CMD_COPY = 'J', CMD_DEL = 'K', CMD_CHMOD = 'L', CMD_SPECIAL = 'M', CMD_USERPASS = 'N' }
|
Commands that can be invoked by a job.
enum Info {INF_TOTAL_SIZE = 10, INF_TOTAL_COUNT_OF_FILES, INF_TOTAL_COUNT_OF_DIRS, INF_PROCESSED_SIZE, INF_PROCESSED_COUNT_OF_FILES, INF_PROCESSED_COUNT_OF_DIRS, INF_SCANNING_DIR, INF_SPEED, INF_COPYING_FILE, INF_MAKING_DIR, INF_REDIRECTION = 20, INF_MIME_TYPE, INF_ERROR_PAGE, INF_WARNING, INF_GETTING_FILE, INF_DELETING_FILE, INF_NEED_PASSWD }
|
Identifiers for KIO informational messages.
enum Message {MSG_DATA = 100, MSG_DATA_REQ, MSG_ERROR, MSG_CONNECTED, MSG_FINISHED, MSG_STAT_ENTRY, MSG_LIST_ENTRIES, MSG_RENAMED, MSG_RESUME, MSG_SLAVE_STATUS, MSG_SLAVE_ACK }
|
Identifiers for KIO data messages.
StatusbarProgress (class) |
This is a special IO progress widget.
Similarly to DefaultProgress,
it's purpose is to show a progress of the IO operation.
Instead of creating a separate window, this is only a widget that can be
easily embedded in a statusbar.
Usage of StatusbarProgress is little different.
This dialog will be a part of some application.
// create a dialog
StatusbarProgress *statusProgress;
statusProgress = new StatusbarProgress( statusBar() );
statusBar()->insertWidget( statusProgress, statusProgress->width() , 0 );
...
// create job and connect it to the progress
CopyJob* job = KIO::copy(...);
statusProgress->setJob( job );
...
Generated by: dfaure@faure on Sun Mar 26 14:24:43 2000, using kdoc 2.0a35. |