• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

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., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 #ifndef __tdeio_global_h__
00019 #define __tdeio_global_h__
00020 
00021 #include <tqstring.h>
00022 #include <tqvaluelist.h>
00023 #include <tqptrlist.h>
00024 #include <tqdatastream.h>
00025 #include <tqdatetime.h>
00026 #include <tqmap.h>
00027 
00028 #include <kurl.h>
00029 
00034 namespace TDEIO
00035 {
00037   typedef TQ_LLONG fileoffset_t;
00039   typedef TQ_ULLONG filesize_t;
00040 
00047   TDEIO_EXPORT TQString convertSize( TDEIO::filesize_t size );
00048 
00056   TDEIO_EXPORT TQString convertSizeWithBytes( TDEIO::filesize_t size );
00064   TDEIO_EXPORT TQString number( TDEIO::filesize_t size );
00065 
00072    TDEIO_EXPORT TQString convertSizeFromKB( TDEIO::filesize_t kbSize );
00073 
00084   TDEIO_EXPORT unsigned int calculateRemainingSeconds( TDEIO::filesize_t totalSize,
00085                                                      TDEIO::filesize_t processedSize, TDEIO::filesize_t speed );
00086 
00095   TDEIO_EXPORT TQString convertSeconds( unsigned int seconds );
00096 
00106   TDEIO_EXPORT TQTime calculateRemaining( TDEIO::filesize_t totalSize, TDEIO::filesize_t processedSize, TDEIO::filesize_t speed ) KDE_DEPRECATED;
00107 
00117   TDEIO_EXPORT TQString itemsSummaryString(uint items, uint files, uint dirs, TDEIO::filesize_t size, bool showSize);
00118 
00126   TDEIO_EXPORT TQString encodeFileName( const TQString & str );
00133   TDEIO_EXPORT TQString decodeFileName( const TQString & str );
00134 
00138   enum Command {
00139     CMD_HOST = '0', // 48
00140     CMD_CONNECT = '1', // 49
00141     CMD_DISCONNECT = '2', // 50
00142     CMD_SLAVE_STATUS = '3', // 51
00143     CMD_SLAVE_CONNECT = '4', // 52
00144     CMD_SLAVE_HOLD = '5', // 53
00145     CMD_NONE = 'A', // 65
00146     CMD_TESTDIR = 'B', // 66
00147     CMD_GET = 'C', // 67
00148     CMD_PUT = 'D', // 68
00149     CMD_STAT = 'E', // 69
00150     CMD_MIMETYPE = 'F', // 70
00151     CMD_LISTDIR = 'G', // 71
00152     CMD_MKDIR = 'H', // 72
00153     CMD_RENAME = 'I', // 73
00154     CMD_COPY = 'J', // 74
00155     CMD_DEL = 'K', // 75
00156     CMD_CHMOD = 'L', // 76
00157     CMD_SPECIAL = 'M', // 77
00158     CMD_USERPASS = 'N', // 78
00159     CMD_REPARSECONFIGURATION = 'O', // 79
00160     CMD_META_DATA = 'P', // 80
00161     CMD_SYMLINK = 'Q', // 81
00162     CMD_SUBURL = 'R', // 82  Inform the slave about the url it is streaming on.
00163     CMD_MESSAGEBOXANSWER = 'S', // 83
00164     CMD_RESUMEANSWER = 'T', // 84
00165     CMD_CONFIG = 'U', // 85
00166     CMD_MULTI_GET = 'V', // 86
00167     CMD_LOCALURL = 'W' // 87
00168     // Add new ones here once a release is done, to avoid breaking binary compatibility.
00169     // Note that protocol-specific commands shouldn't be added here, but should use special.
00170   };
00171 
00175   enum Error {
00176     ERR_CANNOT_OPEN_FOR_READING = 1,
00177     ERR_CANNOT_OPEN_FOR_WRITING = 2,
00178     ERR_CANNOT_LAUNCH_PROCESS = 3,
00179     ERR_INTERNAL = 4,
00180     ERR_MALFORMED_URL = 5,
00181     ERR_UNSUPPORTED_PROTOCOL = 6,
00182     ERR_NO_SOURCE_PROTOCOL = 7,
00183     ERR_UNSUPPORTED_ACTION = 8,
00184     ERR_IS_DIRECTORY = 9, // ... where a file was expected
00185     ERR_IS_FILE = 10, // ... where a directory was expected (e.g. listing)
00186     ERR_DOES_NOT_EXIST = 11,
00187     ERR_FILE_ALREADY_EXIST = 12,
00188     ERR_DIR_ALREADY_EXIST = 13,
00189     ERR_UNKNOWN_HOST = 14,
00190     ERR_ACCESS_DENIED = 15,
00191     ERR_WRITE_ACCESS_DENIED = 16,
00192     ERR_CANNOT_ENTER_DIRECTORY = 17,
00193     ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = 18,
00194     ERR_CYCLIC_LINK = 19,
00195     ERR_USER_CANCELED = 20,
00196     ERR_CYCLIC_COPY = 21,
00197     ERR_COULD_NOT_CREATE_SOCKET = 22, // KDE4: s/COULD_NOT/CANNOT/ or the other way round
00198     ERR_COULD_NOT_CONNECT = 23,
00199     ERR_CONNECTION_BROKEN = 24,
00200     ERR_NOT_FILTER_PROTOCOL = 25,
00201     ERR_COULD_NOT_MOUNT = 26,
00202     ERR_COULD_NOT_UNMOUNT = 27,
00203     ERR_COULD_NOT_READ = 28,
00204     ERR_COULD_NOT_WRITE = 29,
00205     ERR_COULD_NOT_BIND = 30,
00206     ERR_COULD_NOT_LISTEN = 31,
00207     ERR_COULD_NOT_ACCEPT = 32,
00208     ERR_COULD_NOT_LOGIN = 33,
00209     ERR_COULD_NOT_STAT = 34,
00210     ERR_COULD_NOT_CLOSEDIR = 35,
00211     ERR_COULD_NOT_MKDIR = 37,
00212     ERR_COULD_NOT_RMDIR = 38,
00213     ERR_CANNOT_RESUME = 39,
00214     ERR_CANNOT_RENAME = 40,
00215     ERR_CANNOT_CHMOD = 41,
00216     ERR_CANNOT_DELETE = 42,
00217     // The text argument is the protocol that the dead slave supported.
00218     // This means for example: file, ftp, http, ...
00219     ERR_SLAVE_DIED = 43,
00220     ERR_OUT_OF_MEMORY = 44,
00221     ERR_UNKNOWN_PROXY_HOST = 45,
00222     ERR_COULD_NOT_AUTHENTICATE = 46,
00223     ERR_ABORTED = 47, // Action got aborted from application side
00224     ERR_INTERNAL_SERVER = 48,
00225     ERR_SERVER_TIMEOUT = 49,
00226     ERR_SERVICE_NOT_AVAILABLE = 50,
00227     ERR_UNKNOWN = 51,
00228     // (was a warning) ERR_CHECKSUM_MISMATCH = 52,
00229     ERR_UNKNOWN_INTERRUPT = 53,
00230     ERR_CANNOT_DELETE_ORIGINAL = 54,
00231     ERR_CANNOT_DELETE_PARTIAL = 55,
00232     ERR_CANNOT_RENAME_ORIGINAL = 56,
00233     ERR_CANNOT_RENAME_PARTIAL = 57,
00234     ERR_NEED_PASSWD = 58,
00235     ERR_CANNOT_SYMLINK = 59,
00236     ERR_NO_CONTENT = 60, // Action succeeded but no content will follow.
00237     ERR_DISK_FULL = 61,
00238     ERR_IDENTICAL_FILES = 62, // src==dest when moving/copying
00239     ERR_SLAVE_DEFINED = 63, // for slave specified errors that can be
00240                             // rich text.  Email links will be handled
00241                             // by the standard email app and all hrefs
00242                             // will be handled by the standard browser.
00243                             // <a href="exec:/khelpcenter ?" will be
00244                             // forked.
00245     ERR_UPGRADE_REQUIRED = 64, // A transport upgrade is required to access this
00246                                // object.  For instance, TLS is demanded by
00247                                // the server in order to continue.
00248     ERR_POST_DENIED = 65,      // Issued when trying to POST data to a certain Ports
00249                                // see job.cpp
00250     ERR_OFFLINE_MODE = 66      // Used when an app is in offline mode and a 
00251                                // requested document is unavailable.
00252   };
00253 
00261   TDEIO_EXPORT TQString buildErrorString(int errorCode, const TQString &errorText);
00262 
00273   TDEIO_EXPORT TQString buildHTMLErrorString(int errorCode, const TQString &errorText,
00274                                 const KURL *reqUrl = 0L, int method = -1 );
00275 
00292   TDEIO_EXPORT TQByteArray rawErrorDetail(int errorCode, const TQString &errorText,
00293                                 const KURL *reqUrl = 0L, int method = -1 );
00294 
00303   TDEIO_EXPORT TQString unsupportedActionErrorString(const TQString &protocol, int cmd);
00304 
00308   enum UDSAtomTypes {
00310     UDS_STRING = 1,
00311     UDS_LONG = 2,
00312     UDS_TIME = 4 | UDS_LONG,
00313 
00314     // To add new UDS entries below, you can use a step of 8
00315     // (i.e. 8, 16, 24, 32, etc.) Only the last 3 bits are a bitfield,
00316     // the rest isn't.
00317 
00319     UDS_SIZE = 8 | UDS_LONG,
00320     UDS_SIZE_LARGE = 32768 | UDS_LONG, // For internal use only
00322     UDS_USER = 16 | UDS_STRING,
00326     UDS_ICON_NAME = 24 | UDS_STRING,
00328     UDS_GROUP = 32 | UDS_STRING,
00332     UDS_EXTRA = 48 | UDS_STRING,
00335     UDS_NAME = 64 | UDS_STRING,
00338     UDS_LOCAL_PATH = 72 | UDS_STRING,
00341     UDS_HIDDEN = 80 | UDS_LONG,
00344     UDS_EXTENDED_ACL = 88 | UDS_LONG,
00347     UDS_ACL_STRING = 96 | UDS_STRING,
00351     UDS_DEFAULT_ACL_STRING = 104 | UDS_STRING,
00352 
00353     // available: 112, 120 
00354 
00356     UDS_ACCESS = 128 | UDS_LONG,
00358     UDS_MODIFICATION_TIME = 256 | UDS_TIME,
00360     UDS_ACCESS_TIME = 512 | UDS_TIME,
00362     UDS_CREATION_TIME = 1024 | UDS_TIME,
00366     UDS_FILE_TYPE = 2048 | UDS_LONG,
00369     UDS_LINK_DEST = 4096 | UDS_STRING,
00371     UDS_URL = 8192 | UDS_STRING,
00373     UDS_MIME_TYPE = 16384 | UDS_STRING,
00376     UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
00379     UDS_XML_PROPERTIES = 0x8000 | UDS_STRING
00380   };
00381 
00387   enum CacheControl
00388   {
00389       CC_CacheOnly, 
00390       CC_Cache,     
00391       CC_Verify,    
00392       CC_Refresh,   
00393 
00394       CC_Reload     
00395   };
00396 
00404   TDEIO_EXPORT TDEIO::CacheControl parseCacheControl(const TQString &cacheControl);
00405 
00413   TDEIO_EXPORT TQString getCacheControlString(TDEIO::CacheControl cacheControl);
00414 
00420   TDEIO_EXPORT TQString findDeviceMountPoint( const TQString& device );
00421 
00429   TDEIO_EXPORT TQString findPathMountPoint( const TQString & filename );
00430 
00438   TDEIO_EXPORT bool probably_slow_mounted(const TQString& filename);
00439 
00446   TDEIO_EXPORT bool manually_mounted(const TQString& filename);
00447 
00448   enum FileSystemFlag { SupportsChmod, SupportsChown, SupportsUTime,
00449                         SupportsSymlinks, CaseInsensitive };
00470   TDEIO_EXPORT bool testFileSystemFlag(const TQString& filename, FileSystemFlag flag);
00471 
00472 
00473 /************
00474  *
00475  * Universal Directory Service
00476  *
00477  * Any file or URL can be represented by the UDSEntry type below
00478  * A UDSEntry is a list of atoms
00479  * Each atom contains a specific bit of information for the file
00480  *
00481  * The following UDS constants represent the different possible values
00482  * for m_uds in the UDS atom structure below
00483  *
00484  * Each atom contains a specific bit of information for the file
00485  */
00486 class TDEIO_EXPORT UDSAtom
00487 {
00488 public:
00492   TQString m_str;
00496   long long m_long;
00497 
00501   unsigned int m_uds;
00502 };
00503 
00507 typedef TQValueList<UDSAtom> UDSEntry;
00508 typedef TQValueList<UDSEntry> UDSEntryList;
00509 typedef TQValueListIterator<UDSEntry> UDSEntryListIterator;
00510 typedef TQValueListConstIterator<UDSEntry> UDSEntryListConstIterator;
00511 
00515 class TDEIO_EXPORT MetaData : public TQMap<TQString, TQString>
00516 {
00517 public:
00521    MetaData() : TQMap<TQString, TQString>() { };
00525    MetaData(const TQMap<TQString, TQString>&metaData) :
00526      TQMap<TQString, TQString>(metaData) { };
00527 
00533    MetaData & operator+= ( const TQMap<TQString,TQString> &metaData )
00534    {
00535       TQMap<TQString,TQString>::ConstIterator it;
00536       for( it = metaData.begin();
00537            it !=  metaData.end();
00538            ++it)
00539       {
00540          replace(it.key(), it.data());
00541       }
00542       return *this;
00543    }
00544 };
00545 
00546 }
00547 #endif

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.