File indexing completed on 2024-12-01 12:35:52
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 1999 Torben Weis <weis@kde.org> 0004 SPDX-FileCopyrightText: 2000 Waldo Bastain <bastain@kde.org> 0005 SPDX-FileCopyrightText: 2000 Dawit Alemayehu <adawit@kde.org> 0006 SPDX-FileCopyrightText: 2008 Jarosław Staniek <staniek@kde.org> 0007 SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org> 0008 0009 SPDX-License-Identifier: LGPL-2.0-only 0010 */ 0011 0012 #ifndef KPROTOCOLMANAGER_H 0013 #define KPROTOCOLMANAGER_H 0014 0015 #include <QStringList> 0016 0017 #include "kio/global.h" // KIO::CacheControl 0018 #include "kiocore_export.h" 0019 #include "kprotocolinfo.h" 0020 0021 class KSharedConfig; 0022 template<class T> 0023 class QExplicitlySharedDataPointer; 0024 typedef QExplicitlySharedDataPointer<KSharedConfig> KSharedConfigPtr; 0025 namespace KIO 0026 { 0027 class WorkerConfigPrivate; 0028 } // namespace KIO 0029 0030 /** 0031 * @class KProtocolManager kprotocolmanager.h <KProtocolManager> 0032 * 0033 * Provides information about I/O (Internet, etc.) settings chosen/set 0034 * by the end user. 0035 * 0036 * KProtocolManager has a heap of static functions that allows only read 0037 * access to KDE's IO related settings. These include proxy, cache, file 0038 * transfer resumption, timeout and user-agent related settings. 0039 * 0040 * The information provided by this class is generic enough to be applicable 0041 * to any application that makes use of KDE's IO sub-system. Note that this 0042 * mean the proxy, timeout etc. settings are saved in a separate user-specific 0043 * config file and not in the config file of the application. 0044 * 0045 * Original author: 0046 * @author Torben Weis <weis@kde.org> 0047 * 0048 * Revised by: 0049 * @author Waldo Bastain <bastain@kde.org> 0050 * @author Dawit Alemayehu <adawit@kde.org> 0051 * @see KPAC 0052 */ 0053 class KIOCORE_EXPORT KProtocolManager 0054 { 0055 public: 0056 /*=========================== USER-AGENT SETTINGS ===========================*/ 0057 0058 /** 0059 * Returns the default user-agent string used for web browsing. 0060 * 0061 * @return the default user-agent string 0062 */ 0063 static QString defaultUserAgent(); 0064 0065 /** 0066 * Returns the default user-agent value used for web browsing, for example 0067 * "Mozilla/5.0 (compatible; Konqueror/4.0; Linux; X11; i686; en_US) KHTML/4.0.1 (like Gecko)" 0068 * 0069 * @param keys can be any of the following: 0070 * @li 'o' Show OS 0071 * @li 'v' Show OS Version 0072 * @li 'p' Show platform (only for X11) 0073 * @li 'm' Show machine architecture 0074 * @li 'l' Show language 0075 * @return the default user-agent value with the given @p keys 0076 */ 0077 static QString defaultUserAgent(const QString &keys); 0078 0079 /** 0080 * Returns the application's user-agent string. 0081 * Example string is "KMail/1.9.50 (Windows/6.0; KDE/3.97.1; i686; svn-762186; 2008-01-15)", 0082 * where "KMail" is the @p appName parameter, "1.9.50" is the @p appVersion parameter, 0083 * "Windows/6.0; KDE/3.97.1; i686" part is added automatically and "svn-762186; 2008-01-15" 0084 * is provided by @p extraInfo list. 0085 * 0086 * @param appName name of the application 0087 * @param appVersion name of the application 0088 * @param extraInfo a list of elements that will be appended to the string as extra information 0089 * @return the application's user-agent string 0090 * 0091 * @since 4.1 0092 */ 0093 static QString userAgentForApplication(const QString &appName, const QString &appVersion, const QStringList &extraInfo = QStringList()); 0094 0095 /** 0096 * Returns the user-agent string configured for the 0097 * specified host. 0098 * 0099 * If hostname is not found or is empty (i.e. "" or 0100 * QString()) this function will return the default 0101 * user agent. 0102 * 0103 * @param hostname name of the host 0104 * @return specified user-agent string 0105 */ 0106 static QString userAgentForHost(const QString &hostname); 0107 0108 /** 0109 * Returns system name, version and machine type, for example "Windows", "5.1", "i686". 0110 * This information can be used for constructing custom user-agent strings. 0111 * 0112 * @param systemName system name 0113 * @param systemVersion system version 0114 * @param machine machine type 0115 0116 * @return true if system name, version and machine type has been provided 0117 * 0118 * @since 4.1 0119 */ 0120 static bool getSystemNameVersionAndMachine(QString &systemName, QString &systemVersion, QString &machine); 0121 0122 /*=========================== TIMEOUT CONFIG ================================*/ 0123 0124 /** 0125 * Returns the preferred timeout value for reading from 0126 * remote connections in seconds. 0127 * 0128 * @return timeout value for remote connection in secs. 0129 */ 0130 static int readTimeout(); 0131 0132 /** 0133 * Returns the preferred timeout value for remote connections 0134 * in seconds. 0135 * 0136 * @return timeout value for remote connection in secs. 0137 */ 0138 static int connectTimeout(); 0139 0140 /** 0141 * Returns the preferred timeout value for proxy connections 0142 * in seconds. 0143 * 0144 * @return timeout value for proxy connection in secs. 0145 */ 0146 static int proxyConnectTimeout(); 0147 0148 /** 0149 * Returns the preferred response timeout value for 0150 * remote connecting in seconds. 0151 * 0152 * @return timeout value for remote connection in seconds. 0153 */ 0154 static int responseTimeout(); 0155 0156 /*=============================== PROXY CONFIG ==============================*/ 0157 0158 /** 0159 * Returns whether or not the user specified the 0160 * use of proxy server to make connections. 0161 * @return true to use a proxy 0162 */ 0163 static bool useProxy(); 0164 0165 /** 0166 * Returns whether or not the proxy server 0167 * lookup should be reversed or not. 0168 * @return true to use a reversed proxy 0169 */ 0170 static bool useReverseProxy(); 0171 0172 /** 0173 * Types of proxy configuration 0174 * @li NoProxy - No proxy is used 0175 * @li ManualProxy - Proxies are manually configured 0176 * @li PACProxy - A Proxy configuration URL has been given 0177 * @li WPADProxy - A proxy should be automatically discovered 0178 * @li EnvVarProxy - Use the proxy values set through environment variables. 0179 */ 0180 enum ProxyType { 0181 NoProxy, 0182 ManualProxy, 0183 PACProxy, 0184 WPADProxy, 0185 EnvVarProxy, 0186 }; 0187 0188 /** 0189 * Returns the type of proxy configuration that is used. 0190 * @return the proxy type 0191 */ 0192 static ProxyType proxyType(); 0193 0194 /** 0195 * Proxy authorization modes. 0196 * 0197 * @li Prompt - Ask for authorization as needed 0198 * @li Automatic - Use auto login as defined in kionetrc files. 0199 */ 0200 enum ProxyAuthMode { 0201 Prompt, 0202 Automatic, 0203 }; 0204 0205 /** 0206 * Returns the way proxy authorization should be handled. 0207 * 0208 * @return the proxy authorization mode 0209 * @see ProxyAuthMode 0210 */ 0211 static ProxyAuthMode proxyAuthMode(); 0212 0213 /** 0214 * Returns the strings for hosts that should contacted 0215 * DIRECTLY, bypassing any proxy settings. 0216 * @return a list of (comma-separated) hostnames or partial host 0217 * names 0218 */ 0219 static QString noProxyFor(); 0220 0221 /** 0222 * Returns the proxy server address for a given 0223 * protocol. 0224 * 0225 * @param protocol the protocol whose proxy info is needed 0226 * @returns the proxy server address if one is available, 0227 * or QString() if not available 0228 */ 0229 static QString proxyFor(const QString &protocol); 0230 0231 /** 0232 * Returns the Proxy server address for a given URL. 0233 * 0234 * If the selected proxy type is @ref PACProxy or @ref WPADProxy, then a 0235 * helper kded module, proxyscout, is used to determine the proxy information. 0236 * Otherwise, @ref proxyFor is used to find the proxy to use for the given url. 0237 * 0238 * If this function returns an empty string, then the request to a proxy server 0239 * must be denied. For a direct connection, without the use of a proxy, this 0240 * function will return "DIRECT". 0241 * 0242 * @param url the URL whose proxy info is needed 0243 * @returns the proxy server address if one is available, otherwise a QString(). 0244 */ 0245 static QString proxyForUrl(const QUrl &url); 0246 0247 /** 0248 * Returns all the possible proxy server addresses for @p url. 0249 * 0250 * If the selected proxy type is @ref PACProxy or @ref WPADProxy, then a 0251 * helper kded module, proxyscout, is used to determine the proxy information. 0252 * Otherwise, @ref proxyFor is used to find the proxy to use for the given url. 0253 * 0254 * If this function returns empty list, then the request is to a proxy server 0255 * must be denied. For a direct connection, this function will return a single 0256 * entry of "DIRECT". 0257 * 0258 * @since 4.7 0259 * 0260 * @param url the URL whose proxy info is needed 0261 * @returns the proxy server address if one is available, otherwise an empty list . 0262 */ 0263 static QStringList proxiesForUrl(const QUrl &url); 0264 0265 /** 0266 * Marks this proxy as bad (down). It will not be used for the 0267 * next 30 minutes. (The script may supply an alternate proxy) 0268 * @param proxy the proxy to mark as bad (as URL) 0269 */ 0270 static void badProxy(const QString &proxy); 0271 0272 /** 0273 * Returns the URL of the script for automatic proxy configuration. 0274 * @return the proxy configuration script 0275 */ 0276 static QString proxyConfigScript(); 0277 0278 /*========================== CACHE CONFIG ===================================*/ 0279 0280 /** 0281 * Returns true/false to indicate whether a cache 0282 * should be used 0283 * 0284 * @return true to use the cache, false otherwisea 0285 */ 0286 static bool useCache(); 0287 0288 /** 0289 * Returns the maximum age in seconds cached files should be 0290 * kept before they are deleted as necessary. 0291 * 0292 * @return the maximum cache age in seconds 0293 */ 0294 static int maxCacheAge(); 0295 0296 /** 0297 * Returns the maximum size that can be used for caching. 0298 * 0299 * By default this function returns the DEFAULT_MAX_CACHE_SIZE 0300 * value as defined in http_worker_defaults.h. Not that the 0301 * value returned is in bytes, hence a value of 5120 would mean 0302 * 5 Kb. 0303 * 0304 * @return the maximum cache size in bytes 0305 */ 0306 static int maxCacheSize(); // Maximum cache size in Kb. 0307 0308 /** 0309 * The directory which contains the cache files. 0310 * @return the directory that contains the cache files 0311 */ 0312 static QString cacheDir(); 0313 0314 /** 0315 * Returns the Cache control directive to be used. 0316 * @return the cache control value 0317 */ 0318 static KIO::CacheControl cacheControl(); 0319 0320 /*============================ DOWNLOAD CONFIG ==============================*/ 0321 0322 /** 0323 * Returns true if partial downloads should be 0324 * automatically resumed. 0325 * @return true to resume partial downloads 0326 */ 0327 static bool autoResume(); 0328 0329 /** 0330 * Returns true if partial downloads should be marked 0331 * with a ".part" extension. 0332 * @return true if partial downloads should get an ".part" extension 0333 */ 0334 static bool markPartial(); 0335 0336 /** 0337 * Returns the minimum file size for keeping aborted 0338 * downloads. 0339 * 0340 * Any data downloaded that does not meet this minimum 0341 * requirement will simply be discarded. The default size 0342 * is 5 KB. 0343 * 0344 * @return the minimum keep size for aborted downloads in bytes 0345 */ 0346 static int minimumKeepSize(); 0347 0348 /*============================ NETWORK CONNECTIONS ==========================*/ 0349 /** 0350 * Returns true if proxy connections should be persistent. 0351 * @return true if proxy connections should be persistent 0352 */ 0353 static bool persistentProxyConnection(); 0354 0355 /** 0356 * Returns true if connections should be persistent 0357 * @return true if the connections should be persistent 0358 */ 0359 static bool persistentConnections(); 0360 0361 /*===================== PROTOCOL CAPABILITIES ===============================*/ 0362 0363 /** 0364 * Returns whether the protocol can list files/objects. 0365 * If a protocol supports listing it can be browsed in e.g. file-dialogs 0366 * and konqueror. 0367 * 0368 * Whether a protocol supports listing is determined by the "listing=" 0369 * field in the protocol description file. 0370 * If the protocol support listing it should list the fields it provides in 0371 * this field. If the protocol does not support listing this field should 0372 * remain empty (default.) 0373 * 0374 * @param url the url to check 0375 * @return true if the protocol support listing 0376 * @see listing() 0377 */ 0378 static bool supportsListing(const QUrl &url); 0379 0380 /** 0381 * Returns whether the protocol can retrieve data from URLs. 0382 * 0383 * This corresponds to the "reading=" field in the protocol description file. 0384 * Valid values for this field are "true" or "false" (default). 0385 * 0386 * @param url the url to check 0387 * @return true if it is possible to read from the URL 0388 */ 0389 static bool supportsReading(const QUrl &url); 0390 0391 /** 0392 * Returns whether the protocol can store data to URLs. 0393 * 0394 * This corresponds to the "writing=" field in the protocol description file. 0395 * Valid values for this field are "true" or "false" (default). 0396 * 0397 * @param url the url to check 0398 * @return true if the protocol supports writing 0399 */ 0400 static bool supportsWriting(const QUrl &url); 0401 0402 /** 0403 * Returns whether the protocol can create directories/folders. 0404 * 0405 * This corresponds to the "makedir=" field in the protocol description file. 0406 * Valid values for this field are "true" or "false" (default). 0407 * 0408 * @param url the url to check 0409 * @return true if the protocol can create directories 0410 */ 0411 static bool supportsMakeDir(const QUrl &url); 0412 0413 /** 0414 * Returns whether the protocol can delete files/objects. 0415 * 0416 * This corresponds to the "deleting=" field in the protocol description file. 0417 * Valid values for this field are "true" or "false" (default). 0418 * 0419 * @param url the url to check 0420 * @return true if the protocol supports deleting 0421 */ 0422 static bool supportsDeleting(const QUrl &url); 0423 0424 /** 0425 * Returns whether the protocol can create links between files/objects. 0426 * 0427 * This corresponds to the "linking=" field in the protocol description file. 0428 * Valid values for this field are "true" or "false" (default). 0429 * 0430 * @param url the url to check 0431 * @return true if the protocol supports linking 0432 */ 0433 static bool supportsLinking(const QUrl &url); 0434 0435 /** 0436 * Returns whether the protocol can move files/objects between different 0437 * locations. 0438 * 0439 * This corresponds to the "moving=" field in the protocol description file. 0440 * Valid values for this field are "true" or "false" (default). 0441 * 0442 * @param url the url to check 0443 * @return true if the protocol supports moving 0444 */ 0445 static bool supportsMoving(const QUrl &url); 0446 0447 /** 0448 * Returns whether the protocol can be opened using KIO::open(const QUrl&). 0449 * 0450 * This corresponds to the "opening=" field in the protocol description file. 0451 * Valid values for this field are "true" or "false" (default). 0452 * 0453 * @param url the url to check 0454 * @return true if the protocol supports opening 0455 */ 0456 static bool supportsOpening(const QUrl &url); 0457 0458 /** 0459 * Returns whether the protocol can be truncated with FileJob::truncate(KIO::filesize_t length). 0460 * 0461 * This corresponds to the "truncating=" field in the protocol description file. 0462 * Valid values for this field are "true" or "false" (default). 0463 * 0464 * @param url the url to check 0465 * @return true if the protocol supports truncating 0466 * @since 5.66 0467 */ 0468 static bool supportsTruncating(const QUrl &url); 0469 0470 /** 0471 * Returns whether the protocol can copy files/objects directly from the 0472 * filesystem itself. If not, the application will read files from the 0473 * filesystem using the file-protocol and pass the data on to the destination 0474 * protocol. 0475 * 0476 * This corresponds to the "copyFromFile=" field in the protocol description file. 0477 * Valid values for this field are "true" or "false" (default). 0478 * 0479 * @param url the url to check 0480 * @return true if the protocol can copy files from the local file system 0481 */ 0482 static bool canCopyFromFile(const QUrl &url); 0483 0484 /** 0485 * Returns whether the protocol can copy files/objects directly to the 0486 * filesystem itself. If not, the application will receive the data from 0487 * the source protocol and store it in the filesystem using the 0488 * file-protocol. 0489 * 0490 * This corresponds to the "copyToFile=" field in the protocol description file. 0491 * Valid values for this field are "true" or "false" (default). 0492 * 0493 * @param url the url to check 0494 * @return true if the protocol can copy files to the local file system 0495 */ 0496 static bool canCopyToFile(const QUrl &url); 0497 0498 /** 0499 * Returns whether the protocol can rename (i.e. move fast) files/objects 0500 * directly from the filesystem itself. If not, the application will read 0501 * files from the filesystem using the file-protocol and pass the data on 0502 * to the destination protocol. 0503 * 0504 * This corresponds to the "renameFromFile=" field in the protocol description file. 0505 * Valid values for this field are "true" or "false" (default). 0506 * 0507 * @param url the url to check 0508 * @return true if the protocol can rename/move files from the local file system 0509 */ 0510 static bool canRenameFromFile(const QUrl &url); 0511 0512 /** 0513 * Returns whether the protocol can rename (i.e. move fast) files/objects 0514 * directly to the filesystem itself. If not, the application will receive 0515 * the data from the source protocol and store it in the filesystem using the 0516 * file-protocol. 0517 * 0518 * This corresponds to the "renameToFile=" field in the protocol description file. 0519 * Valid values for this field are "true" or "false" (default). 0520 * 0521 * @param url the url to check 0522 * @return true if the protocol can rename files to the local file system 0523 */ 0524 static bool canRenameToFile(const QUrl &url); 0525 0526 /** 0527 * Returns whether the protocol can recursively delete directories by itself. 0528 * If not (the usual case) then KIO will list the directory and delete files 0529 * and empty directories one by one. 0530 * 0531 * This corresponds to the "deleteRecursive=" field in the protocol description file. 0532 * Valid values for this field are "true" or "false" (default). 0533 * 0534 * @param url the url to check 0535 * @return true if the protocol can delete non-empty directories by itself. 0536 */ 0537 static bool canDeleteRecursive(const QUrl &url); 0538 0539 /** 0540 * This setting defines the strategy to use for generating a filename, when 0541 * copying a file or directory to another directory. By default the destination 0542 * filename is made out of the filename in the source URL. However if the 0543 * KIO worker displays names that are different from the filename of the URL 0544 * (e.g. kio_fonts shows Arial for arial.ttf, or kio_trash shows foo.txt and 0545 * uses some internal URL), using Name means that the display name (UDS_NAME) 0546 * will be used to as the filename in the destination directory. 0547 * 0548 * This corresponds to the "fileNameUsedForCopying=" field in the protocol description file. 0549 * Valid values for this field are "Name" or "FromURL" (default). 0550 * 0551 * @param url the url to check 0552 * @return how to generate the filename in the destination directory when copying/moving 0553 */ 0554 static KProtocolInfo::FileNameUsedForCopying fileNameUsedForCopying(const QUrl &url); 0555 0556 /** 0557 * Returns default MIME type for this URL based on the protocol. 0558 * 0559 * This corresponds to the "defaultMimetype=" field in the protocol description file. 0560 * 0561 * @param url the url to check 0562 * @return the default MIME type of the protocol, or an empty string if unknown 0563 */ 0564 static QString defaultMimetype(const QUrl &url); 0565 0566 /** 0567 * Returns whether the protocol should be treated as a filesystem 0568 * or as a stream when reading from it. 0569 * 0570 * This corresponds to the "input=" field in the protocol description file. 0571 * Valid values for this field are "filesystem", "stream" or "none" (default). 0572 * 0573 * @param url the url to check 0574 * @return the input type of the given @p url 0575 */ 0576 static KProtocolInfo::Type inputType(const QUrl &url); 0577 0578 /** 0579 * Returns whether the protocol should be treated as a filesystem 0580 * or as a stream when writing to it. 0581 * 0582 * This corresponds to the "output=" field in the protocol description file. 0583 * Valid values for this field are "filesystem", "stream" or "none" (default). 0584 * 0585 * @param url the url to check 0586 * @return the output type of the given @p url 0587 */ 0588 static KProtocolInfo::Type outputType(const QUrl &url); 0589 0590 /** 0591 * Returns the list of fields this protocol returns when listing 0592 * The current possibilities are 0593 * Name, Type, Size, Date, AccessDate, Access, Owner, Group, Link, URL, MimeType 0594 * as well as Extra1, Extra2 etc. for extra fields (see extraFields). 0595 * 0596 * This corresponds to the "listing=" field in the protocol description file. 0597 * The supported fields should be separated with ',' in the protocol description file. 0598 * 0599 * @param url the url to check 0600 * @return a list of field names 0601 */ 0602 static QStringList listing(const QUrl &url); 0603 0604 /** 0605 * Returns whether the protocol can act as a source protocol. 0606 * 0607 * A source protocol retrieves data from or stores data to the 0608 * location specified by a URL. 0609 * A source protocol is the opposite of a filter protocol. 0610 * 0611 * The "source=" field in the protocol description file determines 0612 * whether a protocol is a source protocol or a filter protocol. 0613 * @param url the url to check 0614 * @return true if the protocol is a source of data (e.g. http), false if the 0615 * protocol is a filter (e.g. gzip) 0616 */ 0617 static bool isSourceProtocol(const QUrl &url); 0618 0619 /** 0620 * Returns which protocol handles this MIME type, if it's an archive MIME type. 0621 * For instance zip:/ handles application/x-zip. 0622 * 0623 * This is defined in the protocol description file using an entry like 0624 * "archiveMimetype=application/x-zip" 0625 * 0626 * @param mimeType the MIME type to check 0627 * @return the protocol that can handle this archive MIME type, for instance "zip". 0628 * @since 4.1 0629 */ 0630 static QString protocolForArchiveMimetype(const QString &mimeType); 0631 0632 /*=============================== OTHERS ====================================*/ 0633 0634 /** 0635 * Force a reload of the general config file of 0636 * KIO workers ( kioslaverc). 0637 */ 0638 static void reparseConfiguration(); 0639 0640 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 101) 0641 /** 0642 * Return the protocol to use in order to handle the given @p url 0643 * It's usually the same, except that FTP, when handled by a proxy, 0644 * needs an HTTP ioslave. 0645 * 0646 * When a proxy is to be used, proxy contains the URL for the proxy. 0647 * @param url the url to check 0648 * @param proxy the URL of the proxy to use 0649 * @return the slave protocol (e.g. 'http'), can be null if unknown 0650 * 0651 * @deprecated Since 5.101, use workerProtocol(const QUrl &, QString &) 0652 */ 0653 static KIOCORE_DEPRECATED_VERSION(5, 101, "Use workerProtocol(const QUrl &, QString &)") QString slaveProtocol(const QUrl &url, QString &proxy); 0654 #endif 0655 0656 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 101) 0657 /** 0658 * Overloaded function that returns a list of all available proxy servers. 0659 * 0660 * @since 4.7 0661 * 0662 * @deprecated Since 5.101, use workerProtocol(const QUrl &, QStringList &) 0663 */ 0664 static KIOCORE_DEPRECATED_VERSION(5, 101, "Use workerProtocol(const QUrl &, QStringList &)") QString slaveProtocol(const QUrl &url, QStringList &proxy); 0665 #endif 0666 0667 /** 0668 * Return the protocol to use in order to handle the given @p url 0669 * It's usually the same, except that FTP, when handled by a proxy, 0670 * needs an HTTP KIO worker. 0671 * 0672 * When a proxy is to be used, proxy contains the URL for the proxy. 0673 * @param url the url to check 0674 * @param proxy the URL of the proxy to use 0675 * @return the worker protocol (e.g. 'http'), can be null if unknown 0676 * 0677 * @since 5.101 0678 */ 0679 static QString workerProtocol(const QUrl &url, QString &proxy); 0680 0681 /** 0682 * Overloaded function that returns a list of all available proxy servers. 0683 * 0684 * @since 5.101 0685 */ 0686 static QString workerProtocol(const QUrl &url, QStringList &proxy); 0687 0688 /** 0689 * Return Accept-Languages header built up according to user's desktop 0690 * language settings. 0691 * @return Accept-Languages header string 0692 */ 0693 static QString acceptLanguagesHeader(); 0694 0695 /** 0696 * Returns the charset to use for the specified @ref url. 0697 * 0698 * @since 4.10 0699 */ 0700 static QString charsetFor(const QUrl &url); 0701 0702 /** 0703 * @brief Returns whether the protocol suppports KIO/POSIX permissions handling. 0704 * 0705 * When this is false the Permissions properties tab may be hidden, for example. The protocol may still support 0706 * permission control through other means, specific to the individual KIO worker. 0707 * 0708 * @param url the url to check 0709 * @return whether the protocol supports permissions 0710 * @since 5.98 0711 */ 0712 static bool supportsPermissions(const QUrl &url); 0713 0714 private: 0715 friend class KIO::WorkerConfigPrivate; 0716 0717 /** 0718 * @internal 0719 * (Shared with WorkerConfig) 0720 */ 0721 KIOCORE_NO_EXPORT static QMap<QString, QString> entryMap(const QString &group); 0722 }; 0723 #endif