# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | 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 __global_h__
    00019 #define __global_h__ "$Id: global.h,v 1.54.2.2 2003/05/17 11:19:22 mueller Exp $"
    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 {
    00036   typedef signed long long int fileoffset_t;
    00037   typedef unsigned long long int filesize_t;
    00038
    00045   QString convertSize( KIO::filesize_t size );
    00046
    00054   QString number( KIO::filesize_t size );
    00055
    00062    QString convertSizeFromKB( KIO::filesize_t kbSize );
    00063
    00072   QTime calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed );
    00073
    00080   QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize);
    00081
    00087   QString encodeFileName( const QString & str );
    00092   QString decodeFileName( const QString & str );
    00093
    00097   enum Error {
    00098     ERR_CANNOT_OPEN_FOR_READING = 1,
    00099     ERR_CANNOT_OPEN_FOR_WRITING = 2,
    00100     ERR_CANNOT_LAUNCH_PROCESS = 3,
    00101     ERR_INTERNAL = 4,
    00102     ERR_MALFORMED_URL = 5,
    00103     ERR_UNSUPPORTED_PROTOCOL = 6,
    00104     ERR_NO_SOURCE_PROTOCOL = 7,
    00105     ERR_UNSUPPORTED_ACTION = 8,
    00106     ERR_IS_DIRECTORY = 9, // ... where a file was expected
    00107     ERR_IS_FILE = 10, // ... where a directory was expected (e.g. listing)
    00108     ERR_DOES_NOT_EXIST = 11,
    00109     ERR_FILE_ALREADY_EXIST = 12,
    00110     ERR_DIR_ALREADY_EXIST = 13,
    00111     ERR_UNKNOWN_HOST = 14,
    00112     ERR_ACCESS_DENIED = 15,
    00113     ERR_WRITE_ACCESS_DENIED = 16,
    00114     ERR_CANNOT_ENTER_DIRECTORY = 17,
    00115     ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = 18,
    00116     ERR_CYCLIC_LINK = 19,
    00117     ERR_USER_CANCELED = 20,
    00118     ERR_CYCLIC_COPY = 21,
    00119     ERR_COULD_NOT_CREATE_SOCKET = 22,
    00120     ERR_COULD_NOT_CONNECT = 23,
    00121     ERR_CONNECTION_BROKEN = 24,
    00122     ERR_NOT_FILTER_PROTOCOL = 25,
    00123     ERR_COULD_NOT_MOUNT = 26,
    00124     ERR_COULD_NOT_UNMOUNT = 27,
    00125     ERR_COULD_NOT_READ = 28,
    00126     ERR_COULD_NOT_WRITE = 29,
    00127     ERR_COULD_NOT_BIND = 30,
    00128     ERR_COULD_NOT_LISTEN = 31,
    00129     ERR_COULD_NOT_ACCEPT = 32,
    00130     ERR_COULD_NOT_LOGIN = 33,
    00131     ERR_COULD_NOT_STAT = 34,
    00132     ERR_COULD_NOT_CLOSEDIR = 35,
    00133     ERR_COULD_NOT_MKDIR = 37,
    00134     ERR_COULD_NOT_RMDIR = 38,
    00135     ERR_CANNOT_RESUME = 39,
    00136     ERR_CANNOT_RENAME = 40,
    00137     ERR_CANNOT_CHMOD = 41,
    00138     ERR_CANNOT_DELETE = 42,
    00139     // The text argument is the protocol that the dead slave supported.
    00140     // This means for example: file, ftp, http, ...
    00141     ERR_SLAVE_DIED = 43,
    00142     ERR_OUT_OF_MEMORY = 44,
    00143     ERR_UNKNOWN_PROXY_HOST = 45,
    00144     ERR_COULD_NOT_AUTHENTICATE = 46,
    00145     ERR_ABORTED = 47, // Action got aborted from application side
    00146     // ERR_WARNING, // Errors terminate the job now. Use warning() instead.
    00147     ERR_INTERNAL_SERVER = 48,
    00148     ERR_SERVER_TIMEOUT = 49,
    00149     ERR_SERVICE_NOT_AVAILABLE = 50,
    00150     ERR_UNKNOWN = 51,
    00151     // (was a warning) ERR_CHECKSUM_MISMATCH = 52,
    00152     ERR_UNKNOWN_INTERRUPT = 53,
    00153     ERR_CANNOT_DELETE_ORIGINAL = 54,
    00154     ERR_CANNOT_DELETE_PARTIAL = 55,
    00155     ERR_CANNOT_RENAME_ORIGINAL = 56,
    00156     ERR_CANNOT_RENAME_PARTIAL = 57,
    00157     ERR_NEED_PASSWD = 58,
    00158     ERR_CANNOT_SYMLINK = 59,
    00159     ERR_NO_CONTENT = 60, // Action succeeded but no content will follow.
    00160     ERR_DISK_FULL = 61,
    00161     ERR_IDENTICAL_FILES = 62, // src==dest when moving/copying
    00162     ERR_SLAVE_DEFINED = 63, // for slave specified errors that can be
    00163                             // rich text.  Email links will be handled
    00164                             // by the standard email app and all hrefs
    00165                             // will be handled by the standard browser.
    00166                             // <a href="exec:/khelpcenter ?" will be
    00167                             // forked.
    00168     ERR_UPGRADE_REQUIRED = 64, // A transport upgrade is required to access this
    00169                                // object.  For instance, TLS is demanded by
    00170                                // the server in order to continue.
    00171     ERR_POST_DENIED = 65    // Issued when trying to POST data to a certain Ports
    00172                                // see job.cpp
    00173   };
    00174
    00175   /*
    00176    * Returns a translated error message for @p errorCode using the
    00177    * additional error information provided by @p errorText.
    00178    */
    00179   QString buildErrorString(int errorCode, const QString &errorText);
    00180
    00181   /*
    00182    * Returns a translated html error message for @p errorCode using the
    00183    * additional error information provided by @p errorText , @p reqUrl
    00184    * (the request URL), and the ioslave @p method .
    00185    */
    00186   QString buildHTMLErrorString(int errorCode, const QString &errorText,
    00187                                 const KURL *reqUrl = 0L, int method = -1 );
    00188
    00189   /*
    00190    * Returns translated error details for @p errorCode using the
    00191    * additional error information provided by @p errorText , @p reqUrl
    00192    * (the request URL), and the ioslave @p method .
    00193    *
    00194    * Returns the following data:
    00195    * QString errorName - the name of the error
    00196    * QString techName - if not null, the more technical name of the error
    00197    * QString description - a description of the error
    00198    * QStringList causes - a list of possible causes of the error
    00199    * QStringList solutions - a liso of solutions for the error
    00200    */
    00201   QByteArray rawErrorDetail(int errorCode, const QString &errorText,
    00202                                 const KURL *reqUrl = 0L, int method = -1 );
    00203
    00207   enum UDSAtomTypes {
    00209     UDS_STRING = 1,
    00210     UDS_LONG = 2,
    00211     UDS_TIME = 4 | UDS_LONG,
    00212
    00214     UDS_SIZE = 8 | UDS_LONG,
    00215     UDS_SIZE_LARGE = 32768 | UDS_LONG, // For internal use only
    00217     UDS_USER = 16 | UDS_STRING,
    00219     UDS_GROUP = 32 | UDS_STRING,
    00221     UDS_NAME = 64 | UDS_STRING,
    00223     UDS_ACCESS = 128 | UDS_LONG,
    00225     UDS_MODIFICATION_TIME = 256 | UDS_TIME,
    00227     UDS_ACCESS_TIME = 512 | UDS_TIME,
    00229     UDS_CREATION_TIME = 1024 | UDS_TIME,
    00233     UDS_FILE_TYPE = 2048 | UDS_LONG,
    00236     UDS_LINK_DEST = 4096 | UDS_STRING,
    00238     UDS_URL = 8192 | UDS_STRING,
    00240     UDS_MIME_TYPE = 16384 | UDS_STRING,
    00243     UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
    00246     UDS_XML_PROPERTIES = 32768 | UDS_STRING
    00247   };
    00248
    00249   enum CacheControl
    00250   {
    00251       CC_CacheOnly,
    00252       CC_Cache,
    00253       CC_Verify,
    00254       CC_Refresh,
    00255
    00256       CC_Reload
    00257   };
    00258
    00259   KIO::CacheControl parseCacheControl(const QString &cacheControl);
    00260
    00261   QString getCacheControlString(KIO::CacheControl cacheControl);
    00262
    00268   QString findDeviceMountPoint( const QString& device );
    00269
    00275   QString findPathMountPoint( const QString & filename );
    00276
    00282   bool probably_slow_mounted(const QString& filename);
    00283
    00290   bool manually_mounted(const QString& filename);
    00291
    00292
    00293 /************
    00294  *
    00295  * Universal Directory Service
    00296  *
    00297  * Any file or URL can be represented by the UDSEntry type below
    00298  * A UDSEntry is a list of atoms
    00299  * Each atom contains a specific bit of information for the file
    00300  *
    00301  * The following UDS constants represent the different possible values
    00302  * for m_uds in the UDS atom structure below
    00303  *
    00304  * Each atom contains a specific bit of information for the file
    00305  */
    00306 class UDSAtom
    00307 {
    00308 public:
    00312   QString m_str;
    00313   long long m_long;
    00314
    00318   unsigned int m_uds;
    00319 };
    00320
    00324 typedef QValueList<UDSAtom> UDSEntry;
    00325 typedef QValueList<UDSEntry> UDSEntryList;
    00326 typedef QValueListIterator<UDSEntry> UDSEntryListIterator;
    00327 typedef QValueListConstIterator<UDSEntry> UDSEntryListConstIterator;
    00328
    00329 class MetaData : public QMap<QString, QString>
    00330 {
    00331 public:
    00332    MetaData() : QMap<QString, QString>() { };
    00333    MetaData(const QMap<QString, QString>&metaData) :
    00334      QMap<QString, QString>(metaData) { };
    00335
    00336    MetaData & operator+= ( const QMap<QString,QString> &metaData )
    00337    {
    00338       QMap<QString,QString>::ConstIterator it;
    00339       for( it = metaData.begin();
    00340            it !=  metaData.end();
    00341            ++it)
    00342       {
    00343          replace(it.key(), it.data());
    00344       }
    00345       return *this;
    00346    }
    00347 };
    00348
    00349 }
    00350 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:12:45 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001