File indexing completed on 2024-11-10 12:23:10

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2000-2005 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 #ifndef KIO_GLOBAL_H
0008 #define KIO_GLOBAL_H
0009 
0010 #include "kiocore_export.h"
0011 
0012 #include <QFile> // for QFile::Permissions
0013 #include <QString>
0014 
0015 #include <KJob>
0016 
0017 #include "jobtracker.h" // for source compat
0018 #include "metadata.h" // for source compat
0019 
0020 class QUrl;
0021 
0022 class QTime;
0023 
0024 #if defined(Q_OS_WIN) && defined(Q_CC_MSVC)
0025 // on windows ssize_t is not defined, only SSIZE_T exists
0026 #include <basetsd.h>
0027 typedef SSIZE_T ssize_t;
0028 #endif
0029 
0030 /**
0031  * @short A namespace for KIO globals
0032  *
0033  */
0034 namespace KIO
0035 {
0036 /// 64-bit file offset
0037 typedef qlonglong fileoffset_t;
0038 /// 64-bit file size
0039 typedef qulonglong filesize_t;
0040 
0041 /**
0042  * Converts @p size from bytes to the string representation.
0043  *
0044  * @param  size  size in bytes
0045  * @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
0046  */
0047 KIOCORE_EXPORT QString convertSize(KIO::filesize_t size);
0048 
0049 /**
0050  * Converts a size to a string representation
0051  * Not unlike QString::number(...)
0052  *
0053  * @param size size in bytes
0054  * @return  converted size as a string - e.g. 123456789
0055  */
0056 KIOCORE_EXPORT QString number(KIO::filesize_t size);
0057 
0058 /**
0059  * Converts size from kibi-bytes (2^10) to the string representation.
0060  *
0061  * @param  kibSize  size in kibi-bytes (2^10)
0062  * @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
0063  */
0064 KIOCORE_EXPORT QString convertSizeFromKiB(KIO::filesize_t kibSize);
0065 
0066 /**
0067  * Calculates remaining time in seconds from total size, processed size and speed.
0068  *
0069  * @param  totalSize      total size in bytes
0070  * @param  processedSize  processed size in bytes
0071  * @param  speed          speed in bytes per second
0072  * @return calculated remaining time in seconds
0073  */
0074 KIOCORE_EXPORT unsigned int calculateRemainingSeconds(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed);
0075 
0076 /**
0077  * Convert @p seconds to a string representing number of days, hours, minutes and seconds
0078  *
0079  * @param  seconds number of seconds to convert
0080  * @return string representation in a locale depending format
0081  */
0082 KIOCORE_EXPORT QString convertSeconds(unsigned int seconds);
0083 
0084 #if KIOCORE_ENABLE_DEPRECATED_SINCE(3, 4)
0085 /**
0086  * Calculates remaining time from total size, processed size and speed.
0087  *
0088  * @param  totalSize      total size in bytes
0089  * @param  processedSize  processed size in bytes
0090  * @param  speed          speed in bytes per second
0091  * @return calculated remaining time
0092  * @deprecated Since 3.4, use calculateRemainingSeconds() instead, as QTime is limited to 23:59:59
0093  */
0094 KIOCORE_EXPORT
0095 KIOCORE_DEPRECATED_VERSION(3, 4, "Use KIO::calculateRemainingSeconds(KIO::filesize_t, KIO::filesize_t, KIO::filesize_t")
0096 QTime calculateRemaining(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed);
0097 #endif
0098 
0099 /**
0100  * Helper for showing information about a set of files and directories
0101  * @param items the number of items (= @p files + @p dirs + number of symlinks :)
0102  * @param files the number of files
0103  * @param dirs the number of dirs
0104  * @param size the sum of the size of the @p files
0105  * @param showSize whether to show the size in the result
0106  * @return the summary string
0107  */
0108 KIOCORE_EXPORT QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize);
0109 
0110 /**
0111  * Encodes (from the text displayed to the real filename)
0112  * This translates '/' into a "unicode fraction slash", QChar(0x2044).
0113  * Used by KIO::link, for instance.
0114  * @param str the file name to encode
0115  * @return the encoded file name
0116  */
0117 KIOCORE_EXPORT QString encodeFileName(const QString &str);
0118 /**
0119  * Decodes (from the filename to the text displayed)
0120  * This doesn't do anything anymore, it used to do the opposite of encodeFileName
0121  * when encodeFileName was using %2F for '/'.
0122  * @param str the file name to decode
0123  * @return the decoded file name
0124  */
0125 KIOCORE_EXPORT QString decodeFileName(const QString &str);
0126 
0127 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 61)
0128 /**
0129  * Given a directory path and a filename (which usually exists already),
0130  * this function returns a suggested name for a file that doesn't exist
0131  * in that directory. The existence is only checked for local urls though.
0132  * The suggested file name is of the form "foo 1", "foo 2" etc.
0133  * @since 5.0
0134  * @deprecated since 5.61, use KFileUtils::suggestName() from KCoreAddons
0135  */
0136 KIOCORE_EXPORT
0137 KIOCORE_DEPRECATED_VERSION(5, 61, "Use KFileUtils::suggestName(const QUrl &, const QString &) from KCoreAddons")
0138 QString suggestName(const QUrl &baseURL, const QString &oldName);
0139 #endif
0140 
0141 /**
0142  * Error codes that can be emitted by KIO.
0143  */
0144 enum Error {
0145     ERR_CANNOT_OPEN_FOR_READING = KJob::UserDefinedError + 1,
0146     ERR_CANNOT_OPEN_FOR_WRITING = KJob::UserDefinedError + 2,
0147     ERR_CANNOT_LAUNCH_PROCESS = KJob::UserDefinedError + 3,
0148     ERR_INTERNAL = KJob::UserDefinedError + 4,
0149     ERR_MALFORMED_URL = KJob::UserDefinedError + 5,
0150     ERR_UNSUPPORTED_PROTOCOL = KJob::UserDefinedError + 6,
0151     ERR_NO_SOURCE_PROTOCOL = KJob::UserDefinedError + 7,
0152     ERR_UNSUPPORTED_ACTION = KJob::UserDefinedError + 8,
0153     ERR_IS_DIRECTORY = KJob::UserDefinedError + 9, ///< ... where a file was expected
0154     ERR_IS_FILE = KJob::UserDefinedError + 10, ///< ... where a directory was expected (e.g.\ listing)
0155     ERR_DOES_NOT_EXIST = KJob::UserDefinedError + 11,
0156     ERR_FILE_ALREADY_EXIST = KJob::UserDefinedError + 12,
0157     ERR_DIR_ALREADY_EXIST = KJob::UserDefinedError + 13,
0158     ERR_UNKNOWN_HOST = KJob::UserDefinedError + 14,
0159     ERR_ACCESS_DENIED = KJob::UserDefinedError + 15,
0160     ERR_WRITE_ACCESS_DENIED = KJob::UserDefinedError + 16,
0161     ERR_CANNOT_ENTER_DIRECTORY = KJob::UserDefinedError + 17,
0162     ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = KJob::UserDefinedError + 18,
0163     ERR_CYCLIC_LINK = KJob::UserDefinedError + 19,
0164     ERR_USER_CANCELED = KJob::KilledJobError,
0165     ERR_CYCLIC_COPY = KJob::UserDefinedError + 21,
0166 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0167     ERR_COULD_NOT_CREATE_SOCKET ///< @deprecated Since 5.0, use ERR_CANNOT_CREATE_SOCKET
0168         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_CREATE_SOCKET.") = KJob::UserDefinedError + 22,
0169 #endif
0170     ERR_CANNOT_CREATE_SOCKET = KJob::UserDefinedError + 22,
0171 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0172     ERR_COULD_NOT_CONNECT ///< @deprecated Since 5.0, use ERR_CANNOT_CONNECT
0173         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_CONNECT.") = KJob::UserDefinedError + 23,
0174 #endif
0175     ERR_CANNOT_CONNECT = KJob::UserDefinedError + 23,
0176     ERR_CONNECTION_BROKEN = KJob::UserDefinedError + 24,
0177     ERR_NOT_FILTER_PROTOCOL = KJob::UserDefinedError + 25,
0178 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0179     ERR_COULD_NOT_MOUNT ///< @deprecated Since 5.0, use ERR_CANNOT_MOUNT
0180         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_MOUNT.") = KJob::UserDefinedError + 26,
0181 #endif
0182     ERR_CANNOT_MOUNT = KJob::UserDefinedError + 26,
0183 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0184     ERR_COULD_NOT_UNMOUNT ///< @deprecated Since 5.0, use ERR_CANNOT_UNMOUNT
0185         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_UNMOUNT.") = KJob::UserDefinedError + 27,
0186 #endif
0187     ERR_CANNOT_UNMOUNT = KJob::UserDefinedError + 27,
0188 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0189     ERR_COULD_NOT_READ ///< @deprecated Since 5.0, use ERR_CANNOT_READ
0190         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_READ.") = KJob::UserDefinedError + 28,
0191 #endif
0192     ERR_CANNOT_READ = KJob::UserDefinedError + 28,
0193 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0194     ERR_COULD_NOT_WRITE ///< @deprecated Since 5.0, use ERR_CANNOT_WRITE
0195         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_WRITE.") = KJob::UserDefinedError + 29,
0196 #endif
0197     ERR_CANNOT_WRITE = KJob::UserDefinedError + 29,
0198 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0199     ERR_COULD_NOT_BIND ///< @deprecated Since 5.0, use ERR_CANNOT_BIND
0200         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_BIND.") = KJob::UserDefinedError + 30,
0201 #endif
0202     ERR_CANNOT_BIND = KJob::UserDefinedError + 30,
0203 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0204     ERR_COULD_NOT_LISTEN ///< @deprecated Since 5.0, use ERR_CANNOT_LISTEN
0205         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_LISTEN.") = KJob::UserDefinedError + 31,
0206 #endif
0207     ERR_CANNOT_LISTEN = KJob::UserDefinedError + 31,
0208 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0209     ERR_COULD_NOT_ACCEPT ///< @deprecated Since 5.0, use ERR_CANNOT_ACCEPT
0210         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_ACCEPT.") = KJob::UserDefinedError + 32,
0211 #endif
0212     ERR_CANNOT_ACCEPT = KJob::UserDefinedError + 32,
0213 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0214     ERR_COULD_NOT_LOGIN ///< @deprecated Since 5.0, use ERR_CANNOT_LOGIN
0215         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_LOGIN.") = KJob::UserDefinedError + 33,
0216 #endif
0217     ERR_CANNOT_LOGIN = KJob::UserDefinedError + 33,
0218 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0219     ERR_COULD_NOT_STAT ///< @deprecated Since 5.0, use ERR_CANNOT_STAT
0220         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_STAT.") = KJob::UserDefinedError + 34,
0221 #endif
0222     ERR_CANNOT_STAT = KJob::UserDefinedError + 34,
0223 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0224     ERR_COULD_NOT_CLOSEDIR ///< @deprecated Since 5.0, use ERR_CANNOT_CLOSEDIR
0225         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_CLOSEDIR.") = KJob::UserDefinedError + 35,
0226 #endif
0227     ERR_CANNOT_CLOSEDIR = KJob::UserDefinedError + 35,
0228 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0229     ERR_COULD_NOT_MKDIR ///< @deprecated Since 5.0, use ERR_CANNOT_MKDIR
0230         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_AUTHENTICATE.") = KJob::UserDefinedError + 37,
0231 #endif
0232     ERR_CANNOT_MKDIR = KJob::UserDefinedError + 37,
0233 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0234     ERR_COULD_NOT_RMDIR ///< @deprecated Since 5.0, use ERR_CANNOT_RMDIR
0235         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_RMDIR.") = KJob::UserDefinedError + 38,
0236 #endif
0237     ERR_CANNOT_RMDIR = KJob::UserDefinedError + 38,
0238     ERR_CANNOT_RESUME = KJob::UserDefinedError + 39,
0239     ERR_CANNOT_RENAME = KJob::UserDefinedError + 40,
0240     ERR_CANNOT_CHMOD = KJob::UserDefinedError + 41,
0241     ERR_CANNOT_DELETE = KJob::UserDefinedError + 42,
0242     // The text argument is the protocol that the dead worker supported.
0243     // This means for example: file, ftp, http, ...
0244     ERR_WORKER_DIED = KJob::UserDefinedError + 43, ///< @since 5.96
0245 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 96)
0246     ERR_SLAVE_DIED ///< @deprecated Since 5.96, use ERR_WORKER_DIED
0247         KIOCORE_ENUMERATOR_DEPRECATED_VERSION(5, 96, "Use ERR_WORKER_DIED.") = ERR_WORKER_DIED,
0248 #endif
0249     ERR_OUT_OF_MEMORY = KJob::UserDefinedError + 44,
0250     ERR_UNKNOWN_PROXY_HOST = KJob::UserDefinedError + 45,
0251 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0252     ERR_COULD_NOT_AUTHENTICATE ///< @deprecated Since 5.0, use ERR_CANNOT_AUTHENTICATE
0253         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_AUTHENTICATE.") = KJob::UserDefinedError + 46,
0254 #endif
0255     ERR_CANNOT_AUTHENTICATE = KJob::UserDefinedError + 46,
0256     ERR_ABORTED = KJob::UserDefinedError + 47, ///< Action got aborted from application side
0257     ERR_INTERNAL_SERVER = KJob::UserDefinedError + 48,
0258     ERR_SERVER_TIMEOUT = KJob::UserDefinedError + 49,
0259     ERR_SERVICE_NOT_AVAILABLE = KJob::UserDefinedError + 50,
0260     ERR_UNKNOWN = KJob::UserDefinedError + 51,
0261     // (was a warning) ERR_CHECKSUM_MISMATCH = 52,
0262     ERR_UNKNOWN_INTERRUPT = KJob::UserDefinedError + 53,
0263     ERR_CANNOT_DELETE_ORIGINAL = KJob::UserDefinedError + 54,
0264     ERR_CANNOT_DELETE_PARTIAL = KJob::UserDefinedError + 55,
0265     ERR_CANNOT_RENAME_ORIGINAL = KJob::UserDefinedError + 56,
0266     ERR_CANNOT_RENAME_PARTIAL = KJob::UserDefinedError + 57,
0267     ERR_NEED_PASSWD = KJob::UserDefinedError + 58,
0268     ERR_CANNOT_SYMLINK = KJob::UserDefinedError + 59,
0269     ERR_NO_CONTENT = KJob::UserDefinedError + 60, ///< Action succeeded but no content will follow.
0270     ERR_DISK_FULL = KJob::UserDefinedError + 61,
0271     ERR_IDENTICAL_FILES = KJob::UserDefinedError + 62, ///< src==dest when moving/copying
0272     /**
0273      * For worker specified errors that can be
0274      * rich text.  Email links will be handled
0275      * by the standard email app and all hrefs
0276      * will be handled by the standard browser.
0277      * <a href="exec:/khelpcenter ?" will be
0278      * forked.
0279      * @since 5.96
0280      */
0281     ERR_WORKER_DEFINED = KJob::UserDefinedError + 63,
0282 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 96)
0283     /**
0284      * For slave specified errors that can be
0285      * rich text.  Email links will be handled
0286      * by the standard email app and all hrefs
0287      * will be handled by the standard browser.
0288      * <a href="exec:/khelpcenter ?" will be
0289      * forked.
0290      * @deprecated Since 5.96, use ERR_WORKER_DEFINED
0291      */
0292     ERR_SLAVE_DEFINED KIOCORE_ENUMERATOR_DEPRECATED_VERSION(5, 96, "Use ERR_WORKER_DEFINED.") = ERR_WORKER_DEFINED,
0293 #endif
0294     ERR_UPGRADE_REQUIRED = KJob::UserDefinedError + 64, ///< A transport upgrade is required to access this
0295     ///< object.  For instance, TLS is demanded by
0296     ///< the server in order to continue.
0297     ERR_POST_DENIED = KJob::UserDefinedError + 65, ///< Issued when trying to POST data to a certain Ports
0298 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 0)
0299     ERR_COULD_NOT_SEEK ///< @deprecated Since 5.0, use ERR_CANNOT_SEEK
0300         KIOCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "Use ERR_CANNOT_SEEK.") = KJob::UserDefinedError + 66,
0301 #endif
0302     // see job.cpp
0303     ERR_CANNOT_SEEK = KJob::UserDefinedError + 66,
0304     ERR_CANNOT_SETTIME = KJob::UserDefinedError + 67, ///< Emitted by setModificationTime
0305     ERR_CANNOT_CHOWN = KJob::UserDefinedError + 68,
0306     ERR_POST_NO_SIZE = KJob::UserDefinedError + 69,
0307     ERR_DROP_ON_ITSELF = KJob::UserDefinedError + 70, ///< from KIO::DropJob, @since 5.6
0308     ERR_CANNOT_MOVE_INTO_ITSELF = KJob::UserDefinedError + 71, ///< emitted by KIO::move, @since 5.18
0309     // TODO KF6 remove reference to slavebase
0310     ERR_PASSWD_SERVER = KJob::UserDefinedError + 72, ///< returned by WorkerBase::openPasswordDialog and SlaveBase::openPasswordDialogV2, @since 5.24
0311     ERR_CANNOT_CREATE_WORKER = KJob::UserDefinedError + 73, ///< used by Slave::createSlave, @since 5.96
0312 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 96)
0313     ERR_CANNOT_CREATE_SLAVE ///< used by Slave::createSlave, @since 5.30 @deprecated Since 5.96, use ERR_CANNOT_CREATE_WORKER
0314         KIOCORE_ENUMERATOR_DEPRECATED_VERSION(5, 96, "Use ERR_CANNOT_CREATE_WORKER.") = ERR_CANNOT_CREATE_WORKER,
0315 #endif
0316     ERR_FILE_TOO_LARGE_FOR_FAT32 = KJob::UserDefinedError + 74, ///< @since 5.54
0317     ERR_OWNER_DIED ///< Value used between kuiserver and views when the job owner disappears unexpectedly. It should not be emitted by workers. @since 5.54
0318     = KJob::UserDefinedError + 75,
0319     ERR_PRIVILEGE_NOT_REQUIRED = KJob::UserDefinedError + 76, ///< used by file ioworker, @since 5.60
0320     ERR_CANNOT_TRUNCATE = KJob::UserDefinedError + 77, // used by FileJob::truncate, @since 5.66
0321     /**
0322      * Indicates failure to create a symlink due to the underlying filesystem (FAT/ExFAT)
0323      * not supporting them. Used by e.g. CopyJob.
0324      * @since 5.88
0325      */
0326     ERR_SYMLINKS_NOT_SUPPORTED = KJob::UserDefinedError + 78,
0327 
0328     /**
0329      * Moving files/dirs to the Trash failed due to size constraints.
0330      *
0331      * @since 5.100
0332      */
0333     ERR_TRASH_FILE_TOO_LARGE = KJob::UserDefinedError + 79,
0334 };
0335 
0336 /**
0337  * Specifies how to use the cache.
0338  * @see parseCacheControl()
0339  * @see getCacheControlString()
0340  */
0341 enum CacheControl {
0342     CC_CacheOnly, ///< Fail request if not in cache
0343     CC_Cache, ///< Use cached entry if available
0344     CC_Verify, ///< Validate cached entry with remote site if expired
0345     CC_Refresh, ///< Always validate cached entry with remote site
0346     CC_Reload, ///< Always fetch from remote site.
0347 };
0348 
0349 /**
0350  * Specifies privilege file operation status.
0351  * @since 5.43
0352  */
0353 enum PrivilegeOperationStatus {
0354     OperationAllowed = 1,
0355     OperationCanceled,
0356     OperationNotAllowed,
0357 };
0358 
0359 /**
0360  * Describes the fields that a stat command will retrieve
0361  * @see UDSEntry
0362  * @see StatDetails
0363  * @since 5.69
0364  */
0365 enum StatDetail {
0366     /// No field returned, useful to check if a file exists
0367     StatNoDetails = 0x0,
0368     /// Filename, access, type, size, linkdest
0369     StatBasic = 0x1,
0370     /// uid, gid
0371     StatUser = 0x2,
0372     /// atime, mtime, btime
0373     StatTime = 0x4,
0374     /// Resolve symlinks
0375     StatResolveSymlink = 0x8,
0376     /// ACL data
0377     StatAcl = 0x10,
0378     /// dev, inode
0379     StatInode = 0x20,
0380     /// Recursive size
0381     /// @since 5.70
0382     StatRecursiveSize = 0x40,
0383     /// MIME type
0384     /// @since 5.82
0385     StatMimeType = 0x80,
0386 
0387     /// Default StatDetail flag when creating a @c StatJob.
0388     /// Equivalent to setting <tt>StatBasic | StatUser | StatTime | StatAcl | StatResolveSymlink</tt>
0389     StatDefaultDetails = StatBasic | StatUser | StatTime | StatAcl | StatResolveSymlink,
0390 };
0391 /**
0392  * Stores a combination of #StatDetail values.
0393  */
0394 Q_DECLARE_FLAGS(StatDetails, StatDetail)
0395 
0396 Q_DECLARE_OPERATORS_FOR_FLAGS(KIO::StatDetails)
0397 
0398 /**
0399  * Parses the string representation of the cache control option.
0400  *
0401  * @param cacheControl the string representation
0402  * @return the cache control value
0403  * @see getCacheControlString()
0404  */
0405 KIOCORE_EXPORT KIO::CacheControl parseCacheControl(const QString &cacheControl);
0406 
0407 /**
0408  * Returns a string representation of the given cache control method.
0409  *
0410  * @param cacheControl the cache control method
0411  * @return the string representation
0412  * @see parseCacheControl()
0413  */
0414 KIOCORE_EXPORT QString getCacheControlString(KIO::CacheControl cacheControl);
0415 
0416 /**
0417  * Return the "favicon" (see http://www.favicon.com) for the given @p url,
0418  * if available. Does NOT attempt to download the favicon, it only returns
0419  * one that is already available.
0420  *
0421  * If unavailable, returns QString().
0422  * Use KIO::FavIconRequestJob instead of this method if you can wait
0423  * for the favicon to be downloaded.
0424  *
0425  * @param url the URL of the favicon
0426  * @return the path to the icon (to be passed to QIcon()), or QString()
0427  *
0428  * @since 5.0
0429  */
0430 KIOCORE_EXPORT QString favIconForUrl(const QUrl &url);
0431 
0432 /**
0433  * Converts KIO file permissions from mode_t to QFile::Permissions format.
0434  *
0435  * This is a convenience function for converting KIO permissions parameter from
0436  * mode_t to QFile::Permissions.
0437  *
0438  * @param permissions KIO file permissions.
0439  *
0440  * @return -1 if @p permissions is -1, otherwise its OR'ed QFile::Permission equivalent.
0441  * @since 4.12
0442  */
0443 KIOCORE_EXPORT QFile::Permissions convertPermissions(int permissions);
0444 
0445 /**
0446  * Return the icon name for a URL.
0447  * Most of the time this returns the MIME type icon,
0448  * but also has fallback to favicon and protocol-specific icon.
0449  *
0450  * Pass this to QIcon::fromTheme().
0451  *
0452  * @since 5.0
0453  */
0454 KIOCORE_EXPORT QString iconNameForUrl(const QUrl &url);
0455 
0456 /**
0457  * This function is useful to implement the "Up" button in a file manager for example.
0458  *
0459  * @return a URL that is a level higher
0460  *
0461  * @since 5.0
0462  */
0463 KIOCORE_EXPORT QUrl upUrl(const QUrl &url);
0464 
0465 }
0466 #endif