global.h
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kio_global_h__
#define __kio_global_h__
#include <qstring.h>
#include <qvaluelist.h>
#include <qptrlist.h>
#include <qdatastream.h>
#include <qdatetime.h>
#include <qmap.h>
#include <kurl.h>
namespace KIO
{
typedef Q_LLONG fileoffset_t;
typedef Q_ULLONG filesize_t;
KIO_EXPORT QString convertSize( KIO::filesize_t size );
KIO_EXPORT QString convertSizeWithBytes( KIO::filesize_t size );
KIO_EXPORT QString number( KIO::filesize_t size );
KIO_EXPORT QString convertSizeFromKB( KIO::filesize_t kbSize );
KIO_EXPORT unsigned int calculateRemainingSeconds( KIO::filesize_t totalSize,
KIO::filesize_t processedSize, KIO::filesize_t speed );
KIO_EXPORT QString convertSeconds( unsigned int seconds );
KIO_EXPORT QTime calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed ) KDE_DEPRECATED;
KIO_EXPORT QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize);
KIO_EXPORT QString encodeFileName( const QString & str );
KIO_EXPORT QString decodeFileName( const QString & str );
enum Command {
CMD_HOST = '0', // 48
CMD_CONNECT = '1', // 49
CMD_DISCONNECT = '2', // 50
CMD_SLAVE_STATUS = '3', // 51
CMD_SLAVE_CONNECT = '4', // 52
CMD_SLAVE_HOLD = '5', // 53
CMD_NONE = 'A', // 65
CMD_TESTDIR = 'B', // 66
CMD_GET = 'C', // 67
CMD_PUT = 'D', // 68
CMD_STAT = 'E', // 69
CMD_MIMETYPE = 'F', // 70
CMD_LISTDIR = 'G', // 71
CMD_MKDIR = 'H', // 72
CMD_RENAME = 'I', // 73
CMD_COPY = 'J', // 74
CMD_DEL = 'K', // 75
CMD_CHMOD = 'L', // 76
CMD_SPECIAL = 'M', // 77
CMD_USERPASS = 'N', // 78
CMD_REPARSECONFIGURATION = 'O', // 79
CMD_META_DATA = 'P', // 80
CMD_SYMLINK = 'Q', // 81
CMD_SUBURL = 'R', // 82 Inform the slave about the url it is streaming on.
CMD_MESSAGEBOXANSWER = 'S', // 83
CMD_RESUMEANSWER = 'T', // 84
CMD_CONFIG = 'U', // 85
CMD_MULTI_GET = 'V' // 86
// Add new ones here once a release is done, to avoid breaking binary compatibility.
// Note that protocol-specific commands shouldn't be added here, but should use special.
};
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, // ... where a file was expected
ERR_IS_FILE = 10, // ... where a directory was expected (e.g. listing)
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, // KDE4: s/COULD_NOT/CANNOT/ or the other way round
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,
// The text argument is the protocol that the dead slave supported.
// This means for example: file, ftp, http, ...
ERR_SLAVE_DIED = 43,
ERR_OUT_OF_MEMORY = 44,
ERR_UNKNOWN_PROXY_HOST = 45,
ERR_COULD_NOT_AUTHENTICATE = 46,
ERR_ABORTED = 47, // Action got aborted from application side
ERR_INTERNAL_SERVER = 48,
ERR_SERVER_TIMEOUT = 49,
ERR_SERVICE_NOT_AVAILABLE = 50,
ERR_UNKNOWN = 51,
// (was a warning) ERR_CHECKSUM_MISMATCH = 52,
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,
ERR_CANNOT_SYMLINK = 59,
ERR_NO_CONTENT = 60, // Action succeeded but no content will follow.
ERR_DISK_FULL = 61,
ERR_IDENTICAL_FILES = 62, // src==dest when moving/copying
ERR_SLAVE_DEFINED = 63, // for slave specified errors that can be
// rich text. Email links will be handled
// by the standard email app and all hrefs
// will be handled by the standard browser.
// <a href="exec:/khelpcenter ?" will be
// forked.
ERR_UPGRADE_REQUIRED = 64, // A transport upgrade is required to access this
// object. For instance, TLS is demanded by
// the server in order to continue.
ERR_POST_DENIED = 65 // Issued when trying to POST data to a certain Ports
// see job.cpp
};
KIO_EXPORT QString buildErrorString(int errorCode, const QString &errorText);
KIO_EXPORT QString buildHTMLErrorString(int errorCode, const QString &errorText,
const KURL *reqUrl = 0L, int method = -1 );
KIO_EXPORT QByteArray rawErrorDetail(int errorCode, const QString &errorText,
const KURL *reqUrl = 0L, int method = -1 );
KIO_EXPORT QString unsupportedActionErrorString(const QString &protocol, int cmd);
enum UDSAtomTypes {
UDS_STRING = 1,
UDS_LONG = 2,
UDS_TIME = 4 | UDS_LONG,
// To add new UDS entries below, you can use a step of 8
// (i.e. 8, 16, 24, 32, etc.) Only the last 3 bits are a bitfield,
// the rest isn't.
UDS_SIZE = 8 | UDS_LONG,
UDS_SIZE_LARGE = 32768 | UDS_LONG, // For internal use only
UDS_USER = 16 | UDS_STRING,
UDS_ICON_NAME = 24 | UDS_STRING,
UDS_GROUP = 32 | UDS_STRING,
UDS_EXTRA = 48 | UDS_STRING,
UDS_NAME = 64 | UDS_STRING,
UDS_LOCAL_PATH = 72 | UDS_STRING,
UDS_HIDDEN = 80 | UDS_LONG,
UDS_EXTENDED_ACL = 88 | UDS_LONG,
UDS_ACL_STRING = 96 | UDS_STRING,
UDS_DEFAULT_ACL_STRING = 104 | UDS_STRING,
// available: 112, 120
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,
UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
UDS_XML_PROPERTIES = 0x8000 | UDS_STRING
};
enum CacheControl
{
CC_CacheOnly,
CC_Cache,
CC_Verify,
CC_Refresh,
CC_Reload
};
KIO_EXPORT KIO::CacheControl parseCacheControl(const QString &cacheControl);
KIO_EXPORT QString getCacheControlString(KIO::CacheControl cacheControl);
KIO_EXPORT QString findDeviceMountPoint( const QString& device );
KIO_EXPORT QString findPathMountPoint( const QString & filename );
KIO_EXPORT bool probably_slow_mounted(const QString& filename);
KIO_EXPORT bool manually_mounted(const QString& filename);
enum FileSystemFlag { SupportsChmod, SupportsChown, SupportsUTime,
SupportsSymlinks, CaseInsensitive };
KIO_EXPORT bool testFileSystemFlag(const QString& filename, FileSystemFlag flag);
/************
*
* 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
*/
class KIO_EXPORT UDSAtom
{
public:
QString m_str;
long long m_long;
unsigned int m_uds;
};
typedef QValueList<UDSAtom> UDSEntry;
typedef QValueList<UDSEntry> UDSEntryList;
typedef QValueListIterator<UDSEntry> UDSEntryListIterator;
typedef QValueListConstIterator<UDSEntry> UDSEntryListConstIterator;
class KIO_EXPORT MetaData : public QMap<QString, QString>
{
public:
MetaData() : QMap<QString, QString>() { };
MetaData(const QMap<QString, QString>&metaData) :
QMap<QString, QString>(metaData) { };
MetaData & operator+= ( const QMap<QString,QString> &metaData )
{
QMap<QString,QString>::ConstIterator it;
for( it = metaData.begin();
it != metaData.end();
++it)
{
replace(it.key(), it.data());
}
return *this;
}
};
}
#endif
KIO::UDS_ACL_STRING
The access control list serialized into a single string.
Definition: global.h:344
KIO::probably_slow_mounted
KIO_EXPORT bool probably_slow_mounted(const QString &filename)
Checks if the path belongs to a filesystem that is probably slow.
Definition: global.cpp:1938
KIO::buildErrorString
KIO_EXPORT QString buildErrorString(int errorCode, const QString &errorText)
Returns a translated error message for errorCode using the additional error information provided by e...
Definition: global.cpp:213
KIO::calculateRemaining
KIO_EXPORT QTime calculateRemaining(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed) KDE_DEPRECATED
Calculates remaining time from total size, processed size and speed.
Definition: global.cpp:127
KIO::UDS_LOCAL_PATH
A local file path if the ioslave display files sitting on the local filesystem (but in another hierar...
Definition: global.h:335
KIO::CC_CacheOnly
Fail request if not in cache.
Definition: global.h:386
KIO::getCacheControlString
KIO_EXPORT QString getCacheControlString(KIO::CacheControl cacheControl)
Returns a string representation of the given cache control method.
Definition: global.cpp:1992
KIO::UDS_ICON_NAME
Name of the icon, that should be used for displaying.
Definition: global.h:323
KIO::MetaData::MetaData
MetaData()
Creates an empty meta data map.
Definition: global.h:518
KIO::unsupportedActionErrorString
KIO_EXPORT QString unsupportedActionErrorString(const QString &protocol, int cmd)
Returns an appropriate error message if the given command cmd is an unsupported action (ERR_UNSUPPORT...
Definition: global.cpp:419
KIO::UDS_MODIFICATION_TIME
The last time the file was modified.
Definition: global.h:355
KIO::Error
Error
Error codes that can be emitted by KIO.
Definition: global.h:174
KIO::calculateRemainingSeconds
KIO_EXPORT unsigned int calculateRemainingSeconds(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed)
Calculates remaining time in seconds from total size, processed size and speed.
Definition: global.cpp:103
KIO::Command
Command
Commands that can be invoked by a job.
Definition: global.h:138
KIO::encodeFileName
KIO_EXPORT QString encodeFileName(const QString &str)
Encodes (from the text displayed to the real filename) This translates % into %% and / into %2f Used ...
Definition: global.cpp:165
KIO::findDeviceMountPoint
KIO_EXPORT QString findDeviceMountPoint(const QString &device)
Returns the mount point where device is mounted right now.
Definition: global.cpp:1368
KIO::testFileSystemFlag
KIO_EXPORT bool testFileSystemFlag(const QString &filename, FileSystemFlag flag)
Checks the capabilities of the filesystem to which a given file belongs.
Definition: global.cpp:1950
KIO::UDS_STRING
First let's define the item types.
Definition: global.h:307
KIO::CC_Reload
Always fetch from remote site.
Definition: global.h:391
KIO::UDS_SIZE
Size of the file.
Definition: global.h:316
KIO::UDS_EXTENDED_ACL
Indicates that the entry has extended ACL entries.
Definition: global.h:341
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:512
KIO::fileoffset_t
Q_LLONG fileoffset_t
64-bit file offset
Definition: global.h:37
KIO::UDS_EXTRA
Extra data (used only if you specified Columns/ColumnsTypes) This is the only UDS entry that can be r...
Definition: global.h:329
KIO::number
KIO_EXPORT QString number(KIO::filesize_t size)
Converts a size to a string representation Not unlike QString::number(...)
Definition: global.cpp:96
KIO::decodeFileName
KIO_EXPORT QString decodeFileName(const QString &str)
Decodes (from the filename to the text displayed) This translates %2[fF] into / and %% into %...
Definition: global.cpp:180
KIO::findPathMountPoint
KIO_EXPORT QString findPathMountPoint(const QString &filename)
Returns the mount point on which resides filename.
Definition: global.cpp:1915
KIO::UDS_GUESSED_MIME_TYPE
A mime type to be used for displaying only.
Definition: global.h:373
KIO::convertSizeWithBytes
KIO_EXPORT QString convertSizeWithBytes(KIO::filesize_t size)
Converts size from bytes to a string representation with includes the size in bytes.
Definition: global.cpp:45
KIO::UDS_NAME
Filename - as displayed in directory listings etc.
Definition: global.h:332
KIO::itemsSummaryString
KIO_EXPORT QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize)
Helper for showing information about a set of files and directories.
Definition: global.cpp:150
KIO::UDS_FILE_TYPE
File type, part of the mode returned by stat (for a link, this returns the file type of the pointed i...
Definition: global.h:363
KIO::CacheControl
CacheControl
Specifies how to use the cache.
Definition: global.h:384
KIO::UDS_ACCESS_TIME
The last time the file was opened.
Definition: global.h:357
KIO::UDS_LINK_DEST
Name of the file where the link points to Allows to check for a symlink (don't use S_ISLNK !) ...
Definition: global.h:366
KIO::rawErrorDetail
KIO_EXPORT QByteArray rawErrorDetail(int errorCode, const QString &errorText, const KURL *reqUrl=0L, int method=-1)
Returns translated error details for errorCode using the additional error information provided by err...
Definition: global.cpp:508
KIO::UDS_MIME_TYPE
A mime type; prevents guessing.
Definition: global.h:370
KIO::UDS_USER
User ID of the file owner.
Definition: global.h:319
KIO::buildHTMLErrorString
KIO_EXPORT QString buildHTMLErrorString(int errorCode, const QString &errorText, const KURL *reqUrl=0L, int method=-1)
Returns a translated html error message for errorCode using the additional error information provided...
KIO::parseCacheControl
KIO_EXPORT KIO::CacheControl parseCacheControl(const QString &cacheControl)
Parses the string representation of the cache control option.
Definition: global.cpp:1973
KIO::UDS_HIDDEN
Treat the file as a hidden file or as a normal file, regardless of (the absence of) a leading dot in ...
Definition: global.h:338
KIO::MetaData::MetaData
MetaData(const QMap< QString, QString > &metaData)
Copy constructor.
Definition: global.h:522
KIO::filesize_t
Q_ULLONG filesize_t
64-bit file size
Definition: global.h:39
KIO::convertSeconds
KIO_EXPORT QString convertSeconds(unsigned int seconds)
Convert seconds to a string representing number of days, hours, minutes and seconds.
Definition: global.cpp:112
KIO::UDS_GROUP
Group ID of the file owner.
Definition: global.h:325
KIO::CC_Cache
Use cached entry if available.
Definition: global.h:387
KIO::CC_Refresh
Always validate cached entry with remote site.
Definition: global.h:389
KIO::UDS_ACCESS
Access permissions (part of the mode returned by stat)
Definition: global.h:353
KIO::UDSEntry
QValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the informations for a file or URL.
Definition: global.h:504
KIO::CC_Verify
Validate cached entry with remote site if expired.
Definition: global.h:388
KIO::UDS_DEFAULT_ACL_STRING
The default access control list serialized into a single string.
Definition: global.h:348
KIO::UDS_CREATION_TIME
The time the file was created.
Definition: global.h:359
KIO::UDS_XML_PROPERTIES
XML properties, e.g.
Definition: global.h:376
KIO::UDS_URL
An alternative URL (If different from the caption)
Definition: global.h:368
KIO::manually_mounted
KIO_EXPORT bool manually_mounted(const QString &filename)
Checks if the path belongs to a filesystem that is manually mounted.
Definition: global.cpp:1926
KIO::UDSAtomTypes
UDSAtomTypes
Constants used to specify the type of a KUDSAtom.
Definition: global.h:305
KIO::convertSize
KIO_EXPORT QString convertSize(KIO::filesize_t size)
Converts size from bytes to the string representation.
Definition: global.cpp:53
KIO::convertSizeFromKB
KIO_EXPORT QString convertSizeFromKB(KIO::filesize_t kbSize)
Converts size from kilo-bytes to the string representation.
Definition: global.cpp:91

KDE Home | KDE Accessibility Home | Description of Access Keys