# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# global.h

    00001 /* This file is part of the KDE libraries
    00002    Copyright (C) 2000 David Faure <faure@kde.org>
    00003
    00004    This library is free software; you can redistribute it and/or
    00005    modify it under the terms of the GNU Library General Public
    00006    License version 2 as published by the Free Software Foundation.
    00007
    00008    This library is distributed in the hope that it will be useful,
    00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00011    Library General Public License for more details.
    00012
    00013    You should have received a copy of the GNU Library General Public License
    00014    along with this library; see the file COPYING.LIB.  If not, write to
    00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00016    Boston, MA 02111-1307, USA.
    00017 */
    00018 #ifndef __kio_global_h__
    00019 #define __kio_global_h__
    00020
    00021 #include <qstring.h>
    00022 #include <qvaluelist.h>
    00023 #include <qptrlist.h>
    00024 #include <qdatastream.h>
    00025 #include <qdatetime.h>
    00026 #include <qmap.h>
    00027
    00028 #include <kurl.h>
    00029
    00034 namespace KIO
    00035 {
    00037   typedef Q_LLONG fileoffset_t;
    00039   typedef Q_ULLONG filesize_t;
    00040
    00047   KIO_EXPORT QString convertSize( KIO::filesize_t size );
    00048
    00056   KIO_EXPORT QString number( KIO::filesize_t size );
    00057
    00064    KIO_EXPORT QString convertSizeFromKB( KIO::filesize_t kbSize );
    00065
    00076   KIO_EXPORT unsigned int calculateRemainingSeconds( KIO::filesize_t totalSize,
    00077                                                      KIO::filesize_t processedSize, KIO::filesize_t speed );
    00078
    00087   KIO_EXPORT QString convertSeconds( unsigned int seconds );
    00088
    00098   KIO_EXPORT QTime calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed ) KDE_DEPRECATED;
    00099
    00109   KIO_EXPORT QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize);
    00110
    00118   KIO_EXPORT QString encodeFileName( const QString & str );
    00125   KIO_EXPORT QString decodeFileName( const QString & str );
    00126
    00130   enum Command {
    00131     CMD_HOST = '0', // 48
    00132     CMD_CONNECT = '1', // 49
    00133     CMD_DISCONNECT = '2', // 50
    00134     CMD_SLAVE_STATUS = '3', // 51
    00135     CMD_SLAVE_CONNECT = '4', // 52
    00136     CMD_SLAVE_HOLD = '5', // 53
    00137     CMD_NONE = 'A', // 65
    00138     CMD_TESTDIR = 'B', // 66
    00139     CMD_GET = 'C', // 67
    00140     CMD_PUT = 'D', // 68
    00141     CMD_STAT = 'E', // 69
    00142     CMD_MIMETYPE = 'F', // 70
    00143     CMD_LISTDIR = 'G', // 71
    00144     CMD_MKDIR = 'H', // 72
    00145     CMD_RENAME = 'I', // 73
    00146     CMD_COPY = 'J', // 74
    00147     CMD_DEL = 'K', // 75
    00148     CMD_CHMOD = 'L', // 76
    00149     CMD_SPECIAL = 'M', // 77
    00150     CMD_USERPASS = 'N', // 78
    00151     CMD_REPARSECONFIGURATION = 'O', // 79
    00152     CMD_META_DATA = 'P', // 80
    00153     CMD_SYMLINK = 'Q', // 81
    00154     CMD_SUBURL = 'R', // 82  Inform the slave about the url it is streaming on.
    00155     CMD_MESSAGEBOXANSWER = 'S', // 83
    00156     CMD_RESUMEANSWER = 'T', // 84
    00157     CMD_CONFIG = 'U', // 85
    00158     CMD_MULTI_GET = 'V' // 86
    00159     // Add new ones here once a release is done, to avoid breaking binary compatibility.
    00160     // Note that protocol-specific commands shouldn't be added here, but should use special.
    00161   };
    00162
    00166   enum Error {
    00167     ERR_CANNOT_OPEN_FOR_READING = 1,
    00168     ERR_CANNOT_OPEN_FOR_WRITING = 2,
    00169     ERR_CANNOT_LAUNCH_PROCESS = 3,
    00170     ERR_INTERNAL = 4,
    00171     ERR_MALFORMED_URL = 5,
    00172     ERR_UNSUPPORTED_PROTOCOL = 6,
    00173     ERR_NO_SOURCE_PROTOCOL = 7,
    00174     ERR_UNSUPPORTED_ACTION = 8,
    00175     ERR_IS_DIRECTORY = 9, // ... where a file was expected
    00176     ERR_IS_FILE = 10, // ... where a directory was expected (e.g. listing)
    00177     ERR_DOES_NOT_EXIST = 11,
    00178     ERR_FILE_ALREADY_EXIST = 12,
    00179     ERR_DIR_ALREADY_EXIST = 13,
    00180     ERR_UNKNOWN_HOST = 14,
    00181     ERR_ACCESS_DENIED = 15,
    00182     ERR_WRITE_ACCESS_DENIED = 16,
    00183     ERR_CANNOT_ENTER_DIRECTORY = 17,
    00184     ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = 18,
    00185     ERR_CYCLIC_LINK = 19,
    00186     ERR_USER_CANCELED = 20,
    00187     ERR_CYCLIC_COPY = 21,
    00188     ERR_COULD_NOT_CREATE_SOCKET = 22, // KDE4: s/COULD_NOT/CANNOT/ or the other way round
    00189     ERR_COULD_NOT_CONNECT = 23,
    00190     ERR_CONNECTION_BROKEN = 24,
    00191     ERR_NOT_FILTER_PROTOCOL = 25,
    00192     ERR_COULD_NOT_MOUNT = 26,
    00193     ERR_COULD_NOT_UNMOUNT = 27,
    00194     ERR_COULD_NOT_READ = 28,
    00195     ERR_COULD_NOT_WRITE = 29,
    00196     ERR_COULD_NOT_BIND = 30,
    00197     ERR_COULD_NOT_LISTEN = 31,
    00198     ERR_COULD_NOT_ACCEPT = 32,
    00199     ERR_COULD_NOT_LOGIN = 33,
    00200     ERR_COULD_NOT_STAT = 34,
    00201     ERR_COULD_NOT_CLOSEDIR = 35,
    00202     ERR_COULD_NOT_MKDIR = 37,
    00203     ERR_COULD_NOT_RMDIR = 38,
    00204     ERR_CANNOT_RESUME = 39,
    00205     ERR_CANNOT_RENAME = 40,
    00206     ERR_CANNOT_CHMOD = 41,
    00207     ERR_CANNOT_DELETE = 42,
    00208     // The text argument is the protocol that the dead slave supported.
    00209     // This means for example: file, ftp, http, ...
    00210     ERR_SLAVE_DIED = 43,
    00211     ERR_OUT_OF_MEMORY = 44,
    00212     ERR_UNKNOWN_PROXY_HOST = 45,
    00213     ERR_COULD_NOT_AUTHENTICATE = 46,
    00214     ERR_ABORTED = 47, // Action got aborted from application side
    00215     ERR_INTERNAL_SERVER = 48,
    00216     ERR_SERVER_TIMEOUT = 49,
    00217     ERR_SERVICE_NOT_AVAILABLE = 50,
    00218     ERR_UNKNOWN = 51,
    00219     // (was a warning) ERR_CHECKSUM_MISMATCH = 52,
    00220     ERR_UNKNOWN_INTERRUPT = 53,
    00221     ERR_CANNOT_DELETE_ORIGINAL = 54,
    00222     ERR_CANNOT_DELETE_PARTIAL = 55,
    00223     ERR_CANNOT_RENAME_ORIGINAL = 56,
    00224     ERR_CANNOT_RENAME_PARTIAL = 57,
    00225     ERR_NEED_PASSWD = 58,
    00226     ERR_CANNOT_SYMLINK = 59,
    00227     ERR_NO_CONTENT = 60, // Action succeeded but no content will follow.
    00228     ERR_DISK_FULL = 61,
    00229     ERR_IDENTICAL_FILES = 62, // src==dest when moving/copying
    00230     ERR_SLAVE_DEFINED = 63, // for slave specified errors that can be
    00231                             // rich text.  Email links will be handled
    00232                             // by the standard email app and all hrefs
    00233                             // will be handled by the standard browser.
    00234                             // <a href="exec:/khelpcenter ?" will be
    00235                             // forked.
    00236     ERR_UPGRADE_REQUIRED = 64, // A transport upgrade is required to access this
    00237                                // object.  For instance, TLS is demanded by
    00238                                // the server in order to continue.
    00239     ERR_POST_DENIED = 65    // Issued when trying to POST data to a certain Ports
    00240                                // see job.cpp
    00241   };
    00242
    00250   KIO_EXPORT QString buildErrorString(int errorCode, const QString &errorText);
    00251
    00262   KIO_EXPORT QString buildHTMLErrorString(int errorCode, const QString &errorText,
    00263                                 const KURL *reqUrl = 0L, int method = -1 );
    00264
    00281   KIO_EXPORT QByteArray rawErrorDetail(int errorCode, const QString &errorText,
    00282                                 const KURL *reqUrl = 0L, int method = -1 );
    00283
    00292   KIO_EXPORT QString unsupportedActionErrorString(const QString &protocol, int cmd);
    00293
    00297   enum UDSAtomTypes {
    00299     UDS_STRING = 1,
    00300     UDS_LONG = 2,
    00301     UDS_TIME = 4 | UDS_LONG,
    00302
    00303     // To add new UDS entries below, you can use a step of 8
    00304     // (i.e. 8, 16, 24, 32, etc.) Only the last 3 bits are a bitfield,
    00305     // the rest isn't.
    00306
    00308     UDS_SIZE = 8 | UDS_LONG,
    00309     UDS_SIZE_LARGE = 32768 | UDS_LONG, // For internal use only
    00311     UDS_USER = 16 | UDS_STRING,
    00315     UDS_ICON_NAME = 24 | UDS_STRING,
    00317     UDS_GROUP = 32 | UDS_STRING,
    00321     UDS_EXTRA = 48 | UDS_STRING,
    00324     UDS_NAME = 64 | UDS_STRING,
    00327     UDS_LOCAL_PATH = 72 | UDS_STRING,
    00328
    00329     // available: 80, 88, 92, 100, 108 etc.
    00330
    00332     UDS_ACCESS = 128 | UDS_LONG,
    00334     UDS_MODIFICATION_TIME = 256 | UDS_TIME,
    00336     UDS_ACCESS_TIME = 512 | UDS_TIME,
    00338     UDS_CREATION_TIME = 1024 | UDS_TIME,
    00342     UDS_FILE_TYPE = 2048 | UDS_LONG,
    00345     UDS_LINK_DEST = 4096 | UDS_STRING,
    00347     UDS_URL = 8192 | UDS_STRING,
    00349     UDS_MIME_TYPE = 16384 | UDS_STRING,
    00352     UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
    00355     UDS_XML_PROPERTIES = 32768 | UDS_STRING
    00356   };
    00357
    00363   enum CacheControl
    00364   {
    00365       CC_CacheOnly,
    00366       CC_Cache,
    00367       CC_Verify,
    00368       CC_Refresh,
    00369
    00370       CC_Reload
    00371   };
    00372
    00380   KIO_EXPORT KIO::CacheControl parseCacheControl(const QString &cacheControl);
    00381
    00389   KIO_EXPORT QString getCacheControlString(KIO::CacheControl cacheControl);
    00390
    00396   KIO_EXPORT QString findDeviceMountPoint( const QString& device );
    00397
    00405   KIO_EXPORT QString findPathMountPoint( const QString & filename );
    00406
    00414   KIO_EXPORT bool probably_slow_mounted(const QString& filename);
    00415
    00422   KIO_EXPORT bool manually_mounted(const QString& filename);
    00423
    00424   enum FileSystemFlag { SupportsChmod, SupportsChown, SupportsUTime,
    00425                         SupportsSymlinks, CaseInsensitive };
    00446   KIO_EXPORT bool testFileSystemFlag(const QString& filename, FileSystemFlag flag);
    00447
    00448
    00449 /************
    00450  *
    00451  * Universal Directory Service
    00452  *
    00453  * Any file or URL can be represented by the UDSEntry type below
    00454  * A UDSEntry is a list of atoms
    00455  * Each atom contains a specific bit of information for the file
    00456  *
    00457  * The following UDS constants represent the different possible values
    00458  * for m_uds in the UDS atom structure below
    00459  *
    00460  * Each atom contains a specific bit of information for the file
    00461  */
    00462 class KIO_EXPORT UDSAtom
    00463 {
    00464 public:
    00468   QString m_str;
    00472   long long m_long;
    00473
    00477   unsigned int m_uds;
    00478 };
    00479
    00483 typedef QValueList<UDSAtom> UDSEntry;
    00484 typedef QValueList<UDSEntry> UDSEntryList;
    00485 typedef QValueListIterator<UDSEntry> UDSEntryListIterator;
    00486 typedef QValueListConstIterator<UDSEntry> UDSEntryListConstIterator;
    00487
    00491 class KIO_EXPORT MetaData : public QMap<QString, QString>
    00492 {
    00493 public:
    00497    MetaData() : QMap<QString, QString>() { };
    00501    MetaData(const QMap<QString, QString>&metaData) :
    00502      QMap<QString, QString>(metaData) { };
    00503
    00509    MetaData & operator+= ( const QMap<QString,QString> &metaData )
    00510    {
    00511       QMap<QString,QString>::ConstIterator it;
    00512       for( it = metaData.begin();
    00513            it !=  metaData.end();
    00514            ++it)
    00515       {
    00516          replace(it.key(), it.data());
    00517       }
    00518       return *this;
    00519    }
    00520 };
    00521
    00522 }
    00523 #endif

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:53 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003