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

kio/kio

  • kio
  • kio
global.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 David Faure <faure@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 #ifndef __kio_global_h__
19 #define __kio_global_h__
20 
21 #include <tqstring.h>
22 #include <tqvaluelist.h>
23 #include <tqptrlist.h>
24 #include <tqdatastream.h>
25 #include <tqdatetime.h>
26 #include <tqmap.h>
27 
28 #include <kurl.h>
29 
34 namespace KIO
35 {
37  typedef TQ_LLONG fileoffset_t;
39  typedef TQ_ULLONG filesize_t;
40 
47  KIO_EXPORT TQString convertSize( KIO::filesize_t size );
48 
56  KIO_EXPORT TQString convertSizeWithBytes( KIO::filesize_t size );
64  KIO_EXPORT TQString number( KIO::filesize_t size );
65 
72  KIO_EXPORT TQString convertSizeFromKB( KIO::filesize_t kbSize );
73 
84  KIO_EXPORT unsigned int calculateRemainingSeconds( KIO::filesize_t totalSize,
85  KIO::filesize_t processedSize, KIO::filesize_t speed );
86 
95  KIO_EXPORT TQString convertSeconds( unsigned int seconds );
96 
106  KIO_EXPORT TQTime calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed ) KDE_DEPRECATED;
107 
117  KIO_EXPORT TQString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize);
118 
126  KIO_EXPORT TQString encodeFileName( const TQString & str );
133  KIO_EXPORT TQString decodeFileName( const TQString & str );
134 
138  enum Command {
139  CMD_HOST = '0', // 48
140  CMD_CONNECT = '1', // 49
141  CMD_DISCONNECT = '2', // 50
142  CMD_SLAVE_STATUS = '3', // 51
143  CMD_SLAVE_CONNECT = '4', // 52
144  CMD_SLAVE_HOLD = '5', // 53
145  CMD_NONE = 'A', // 65
146  CMD_TESTDIR = 'B', // 66
147  CMD_GET = 'C', // 67
148  CMD_PUT = 'D', // 68
149  CMD_STAT = 'E', // 69
150  CMD_MIMETYPE = 'F', // 70
151  CMD_LISTDIR = 'G', // 71
152  CMD_MKDIR = 'H', // 72
153  CMD_RENAME = 'I', // 73
154  CMD_COPY = 'J', // 74
155  CMD_DEL = 'K', // 75
156  CMD_CHMOD = 'L', // 76
157  CMD_SPECIAL = 'M', // 77
158  CMD_USERPASS = 'N', // 78
159  CMD_REPARSECONFIGURATION = 'O', // 79
160  CMD_META_DATA = 'P', // 80
161  CMD_SYMLINK = 'Q', // 81
162  CMD_SUBURL = 'R', // 82 Inform the slave about the url it is streaming on.
163  CMD_MESSAGEBOXANSWER = 'S', // 83
164  CMD_RESUMEANSWER = 'T', // 84
165  CMD_CONFIG = 'U', // 85
166  CMD_MULTI_GET = 'V' // 86
167  // Add new ones here once a release is done, to avoid breaking binary compatibility.
168  // Note that protocol-specific commands shouldn't be added here, but should use special.
169  };
170 
174  enum Error {
175  ERR_CANNOT_OPEN_FOR_READING = 1,
176  ERR_CANNOT_OPEN_FOR_WRITING = 2,
177  ERR_CANNOT_LAUNCH_PROCESS = 3,
178  ERR_INTERNAL = 4,
179  ERR_MALFORMED_URL = 5,
180  ERR_UNSUPPORTED_PROTOCOL = 6,
181  ERR_NO_SOURCE_PROTOCOL = 7,
182  ERR_UNSUPPORTED_ACTION = 8,
183  ERR_IS_DIRECTORY = 9, // ... where a file was expected
184  ERR_IS_FILE = 10, // ... where a directory was expected (e.g. listing)
185  ERR_DOES_NOT_EXIST = 11,
186  ERR_FILE_ALREADY_EXIST = 12,
187  ERR_DIR_ALREADY_EXIST = 13,
188  ERR_UNKNOWN_HOST = 14,
189  ERR_ACCESS_DENIED = 15,
190  ERR_WRITE_ACCESS_DENIED = 16,
191  ERR_CANNOT_ENTER_DIRECTORY = 17,
192  ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = 18,
193  ERR_CYCLIC_LINK = 19,
194  ERR_USER_CANCELED = 20,
195  ERR_CYCLIC_COPY = 21,
196  ERR_COULD_NOT_CREATE_SOCKET = 22, // KDE4: s/COULD_NOT/CANNOT/ or the other way round
197  ERR_COULD_NOT_CONNECT = 23,
198  ERR_CONNECTION_BROKEN = 24,
199  ERR_NOT_FILTER_PROTOCOL = 25,
200  ERR_COULD_NOT_MOUNT = 26,
201  ERR_COULD_NOT_UNMOUNT = 27,
202  ERR_COULD_NOT_READ = 28,
203  ERR_COULD_NOT_WRITE = 29,
204  ERR_COULD_NOT_BIND = 30,
205  ERR_COULD_NOT_LISTEN = 31,
206  ERR_COULD_NOT_ACCEPT = 32,
207  ERR_COULD_NOT_LOGIN = 33,
208  ERR_COULD_NOT_STAT = 34,
209  ERR_COULD_NOT_CLOSEDIR = 35,
210  ERR_COULD_NOT_MKDIR = 37,
211  ERR_COULD_NOT_RMDIR = 38,
212  ERR_CANNOT_RESUME = 39,
213  ERR_CANNOT_RENAME = 40,
214  ERR_CANNOT_CHMOD = 41,
215  ERR_CANNOT_DELETE = 42,
216  // The text argument is the protocol that the dead slave supported.
217  // This means for example: file, ftp, http, ...
218  ERR_SLAVE_DIED = 43,
219  ERR_OUT_OF_MEMORY = 44,
220  ERR_UNKNOWN_PROXY_HOST = 45,
221  ERR_COULD_NOT_AUTHENTICATE = 46,
222  ERR_ABORTED = 47, // Action got aborted from application side
223  ERR_INTERNAL_SERVER = 48,
224  ERR_SERVER_TIMEOUT = 49,
225  ERR_SERVICE_NOT_AVAILABLE = 50,
226  ERR_UNKNOWN = 51,
227  // (was a warning) ERR_CHECKSUM_MISMATCH = 52,
228  ERR_UNKNOWN_INTERRUPT = 53,
229  ERR_CANNOT_DELETE_ORIGINAL = 54,
230  ERR_CANNOT_DELETE_PARTIAL = 55,
231  ERR_CANNOT_RENAME_ORIGINAL = 56,
232  ERR_CANNOT_RENAME_PARTIAL = 57,
233  ERR_NEED_PASSWD = 58,
234  ERR_CANNOT_SYMLINK = 59,
235  ERR_NO_CONTENT = 60, // Action succeeded but no content will follow.
236  ERR_DISK_FULL = 61,
237  ERR_IDENTICAL_FILES = 62, // src==dest when moving/copying
238  ERR_SLAVE_DEFINED = 63, // for slave specified errors that can be
239  // rich text. Email links will be handled
240  // by the standard email app and all hrefs
241  // will be handled by the standard browser.
242  // <a href="exec:/khelpcenter ?" will be
243  // forked.
244  ERR_UPGRADE_REQUIRED = 64, // A transport upgrade is required to access this
245  // object. For instance, TLS is demanded by
246  // the server in order to continue.
247  ERR_POST_DENIED = 65, // Issued when trying to POST data to a certain Ports
248  // see job.cpp
249  ERR_OFFLINE_MODE = 66 // Used when an app is in offline mode and a
250  // requested document is unavailable.
251  };
252 
260  KIO_EXPORT TQString buildErrorString(int errorCode, const TQString &errorText);
261 
272  KIO_EXPORT TQString buildHTMLErrorString(int errorCode, const TQString &errorText,
273  const KURL *reqUrl = 0L, int method = -1 );
274 
291  KIO_EXPORT TQByteArray rawErrorDetail(int errorCode, const TQString &errorText,
292  const KURL *reqUrl = 0L, int method = -1 );
293 
302  KIO_EXPORT TQString unsupportedActionErrorString(const TQString &protocol, int cmd);
303 
307  enum UDSAtomTypes {
309  UDS_STRING = 1,
310  UDS_LONG = 2,
311  UDS_TIME = 4 | UDS_LONG,
312 
313  // To add new UDS entries below, you can use a step of 8
314  // (i.e. 8, 16, 24, 32, etc.) Only the last 3 bits are a bitfield,
315  // the rest isn't.
316 
318  UDS_SIZE = 8 | UDS_LONG,
319  UDS_SIZE_LARGE = 32768 | UDS_LONG, // For internal use only
321  UDS_USER = 16 | UDS_STRING,
325  UDS_ICON_NAME = 24 | UDS_STRING,
327  UDS_GROUP = 32 | UDS_STRING,
331  UDS_EXTRA = 48 | UDS_STRING,
334  UDS_NAME = 64 | UDS_STRING,
337  UDS_LOCAL_PATH = 72 | UDS_STRING,
340  UDS_HIDDEN = 80 | UDS_LONG,
343  UDS_EXTENDED_ACL = 88 | UDS_LONG,
346  UDS_ACL_STRING = 96 | UDS_STRING,
350  UDS_DEFAULT_ACL_STRING = 104 | UDS_STRING,
351 
352  // available: 112, 120
353 
355  UDS_ACCESS = 128 | UDS_LONG,
357  UDS_MODIFICATION_TIME = 256 | UDS_TIME,
359  UDS_ACCESS_TIME = 512 | UDS_TIME,
361  UDS_CREATION_TIME = 1024 | UDS_TIME,
365  UDS_FILE_TYPE = 2048 | UDS_LONG,
368  UDS_LINK_DEST = 4096 | UDS_STRING,
370  UDS_URL = 8192 | UDS_STRING,
372  UDS_MIME_TYPE = 16384 | UDS_STRING,
375  UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
378  UDS_XML_PROPERTIES = 0x8000 | UDS_STRING
379  };
380 
386  enum CacheControl
387  {
388  CC_CacheOnly,
389  CC_Cache,
390  CC_Verify,
391  CC_Refresh,
392 
393  CC_Reload
394  };
395 
403  KIO_EXPORT KIO::CacheControl parseCacheControl(const TQString &cacheControl);
404 
412  KIO_EXPORT TQString getCacheControlString(KIO::CacheControl cacheControl);
413 
419  KIO_EXPORT TQString findDeviceMountPoint( const TQString& device );
420 
428  KIO_EXPORT TQString findPathMountPoint( const TQString & filename );
429 
437  KIO_EXPORT bool probably_slow_mounted(const TQString& filename);
438 
445  KIO_EXPORT bool manually_mounted(const TQString& filename);
446 
447  enum FileSystemFlag { SupportsChmod, SupportsChown, SupportsUTime,
448  SupportsSymlinks, CaseInsensitive };
469  KIO_EXPORT bool testFileSystemFlag(const TQString& filename, FileSystemFlag flag);
470 
471 
472 /************
473  *
474  * Universal Directory Service
475  *
476  * Any file or URL can be represented by the UDSEntry type below
477  * A UDSEntry is a list of atoms
478  * Each atom contains a specific bit of information for the file
479  *
480  * The following UDS constants represent the different possible values
481  * for m_uds in the UDS atom structure below
482  *
483  * Each atom contains a specific bit of information for the file
484  */
485 class KIO_EXPORT UDSAtom
486 {
487 public:
491  TQString m_str;
495  long long m_long;
496 
500  unsigned int m_uds;
501 };
502 
506 typedef TQValueList<UDSAtom> UDSEntry;
507 typedef TQValueList<UDSEntry> UDSEntryList;
508 typedef TQValueListIterator<UDSEntry> UDSEntryListIterator;
509 typedef TQValueListConstIterator<UDSEntry> UDSEntryListConstIterator;
510 
514 class KIO_EXPORT MetaData : public TQMap<TQString, TQString>
515 {
516 public:
520  MetaData() : TQMap<TQString, TQString>() { };
524  MetaData(const TQMap<TQString, TQString>&metaData) :
525  TQMap<TQString, TQString>(metaData) { };
526 
532  MetaData & operator+= ( const TQMap<TQString,TQString> &metaData )
533  {
534  TQMap<TQString,TQString>::ConstIterator it;
535  for( it = metaData.begin();
536  it != metaData.end();
537  ++it)
538  {
539  replace(it.key(), it.data());
540  }
541  return *this;
542  }
543 };
544 
545 }
546 #endif

kio/kio

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

kio/kio

Skip menu "kio/kio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kio by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |