/usr/include/kprotocolinfo.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | /* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000-2001 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KPROTOCOLINFO_H
#define KPROTOCOLINFO_H
#include <kglobal.h>
#include <kurl.h>
#include <ksycocaentry.h>
#include <ksycocatype.h>
#include <QtCore/QVariant>
#include <QtCore/QStringList>
class QDataStream;
class KProtocolInfoPrivate;
/**
* \class KProtocolInfo kprotocolinfo.h <KProtocolInfo>
*
* Information about I/O (Internet, etc.) protocols supported by KDE.
* This class is useful if you want to know which protocols
* KDE supports. In addition you can find out lots of information
* about a certain protocol. A KProtocolInfo instance represents a
* single protocol. Most of the functionality is provided by the static
* methods that scan the *.protocol files of all installed kioslaves to get
* this information.
*
* *.protocol files are installed in the "services" resource.
*
* @author Torben Weis <weis@kde.org>
*/
class KDECORE_EXPORT KProtocolInfo : public KSycocaEntry
{
friend class KProtocolInfoFactory;
friend class KBuildProtocolInfoFactory;
friend class KProtocolManager;
public:
typedef KSharedPtr<KProtocolInfo> Ptr;
typedef QList<Ptr> List;
public:
//
// Static functions:
//
/**
* Returns list of all known protocols.
* @return a list of all known protocols
*/
static QStringList protocols();
/**
* Returns whether a protocol is installed that is able to handle @p url.
*
* @param url the url to check
* @return true if the protocol is known
* @see name()
*/
static bool isKnownProtocol( const KUrl &url );
/**
* Same as above except you can supply just the protocol instead of
* the whole URL.
*/
static bool isKnownProtocol( const QString& protocol );
/**
* Returns the library / executable to open for the protocol @p protocol
* Example : "kio_ftp", meaning either the executable "kio_ftp" or
* the library "kio_ftp.la" (recommended), whichever is available.
*
* This corresponds to the "exec=" field in the protocol description file.
* @param protocol the protocol to check
* @return the executable of library to open, or QString() for
* unsupported protocols
* @see KUrl::protocol()
*/
static QString exec( const QString& protocol );
/**
* Describes the type of a protocol.
* For instance ftp:// appears as a filesystem with folders and files,
* while bzip2:// appears as a single file (a stream of data),
* and telnet:// doesn't output anything.
* @see outputType
*/
enum Type { T_STREAM, ///< stream of data (e.g. single file)
T_FILESYSTEM, ///< structured directory
T_NONE, ///< no information about the type available
T_ERROR ///< used to signal an error
};
/**
* Definition of an extra field in the UDS entries, returned by a listDir operation.
*
* The name is the name of the column, translated.
*
* The type name comes from QVariant::typeName()
* Currently supported types: "QString", "QDateTime" (ISO-8601 format)
*/
struct ExtraField {
enum Type { String = QVariant::String, DateTime = QVariant::DateTime, Invalid = QVariant::Invalid };
ExtraField() : type(Invalid) {}
ExtraField(const QString& _name, Type _type )
: name(_name), type(_type) {
}
QString name;
Type type;
};
typedef QList<ExtraField> ExtraFieldList;
/**
* Definition of extra fields in the UDS entries, returned by a listDir operation.
*
* This corresponds to the "ExtraNames=" and "ExtraTypes=" fields in the protocol description file.
* Those two lists should be separated with ',' in the protocol description file.
* See ExtraField for details about names and types
*/
static ExtraFieldList extraFields( const KUrl& url );
/**
* Returns whether the protocol can act as a helper protocol.
* A helper protocol invokes an external application and does not return
* a file or stream.
*
* This corresponds to the "helper=" field in the protocol description file.
* Valid values for this field are "true" or "false" (default).
*
* @param url the url to check
* @return true if the protocol is a helper protocol (e.g. vnc), false
* if not (e.g. http)
*/
static bool isHelperProtocol( const KUrl &url );
/**
* Same as above except you can supply just the protocol instead of
* the whole URL.
*/
static bool isHelperProtocol( const QString& protocol );
/**
* Returns whether the protocol can act as a filter protocol.
*
* A filter protocol can operate on data that is passed to it
* but does not retrieve/store data itself, like gzip.
* A filter protocol is the opposite of a source protocol.
*
* The "source=" field in the protocol description file determines
* whether a protocol is a source protocol or a filter protocol.
* Valid values for this field are "true" (default) for source protocol or
* "false" for filter protocol.
*
* @param url the url to check
* @return true if the protocol is a filter (e.g. gzip), false if the
* protocol is a helper or source
*/
static bool isFilterProtocol( const KUrl &url );
/**
* Same as above except you can supply just the protocol instead of
* the whole URL.
*/
static bool isFilterProtocol( const QString& protocol );
/**
* Returns the name of the icon, associated with the specified protocol.
*
* This corresponds to the "Icon=" field in the protocol description file.
*
* @param protocol the protocol to check
* @return the icon of the protocol, or an empty string if unknown
*/
static QString icon( const QString& protocol );
/**
* Returns the name of the config file associated with the
* specified protocol. This is useful if two similar protocols
* need to share a single config file, e.g. http and https.
*
* This corresponds to the "config=" field in the protocol description file.
* The default is the protocol name, see name()
*
* @param protocol the protocol to check
* @return the config file, or an empty string if unknown
*/
static QString config( const QString& protocol );
/**
* Returns the soft limit on the number of slaves for this protocol.
* This limits the number of slaves used for a single operation, note
* that multiple operations may result in a number of instances that
* exceeds this soft limit.
*
* This corresponds to the "maxInstances=" field in the protocol description file.
* The default is 1.
*
* @param protocol the protocol to check
* @return the maximum number of slaves, or 1 if unknown
*/
static int maxSlaves( const QString& protocol );
/**
* Returns the limit on the number of slaves for this protocol per host.
*
* This corresponds to the "maxInstancesPerHost=" field in the protocol description file.
* The default is 0 which means there is no per host limit.
*
* @param protocol the protocol to check
* @return the maximum number of slaves, or 1 if unknown
*
* @since 4.4
*/
static int maxSlavesPerHost( const QString& protocol );
/**
* Returns whether mimetypes can be determined based on extension for this
* protocol. For some protocols, e.g. http, the filename extension in the URL
* can not be trusted to truly reflect the file type.
*
* This corresponds to the "determineMimetypeFromExtension=" field in the protocol description file.
* Valid values for this field are "true" (default) or "false".
*
* @param protocol the protocol to check
* @return true if the mime types can be determined by extension
*/
static bool determineMimetypeFromExtension( const QString &protocol );
/**
* Returns the documentation path for the specified protocol.
*
* This corresponds to the "X-DocPath=" or "DocPath=" field in the protocol description file.
*
* @param protocol the protocol to check
* @return the docpath of the protocol, or an empty string if unknown
*/
static QString docPath( const QString& protocol );
/**
* Returns the protocol class for the specified protocol.
*
* This corresponds to the "Class=" field in the protocol description file.
*
* The following classes are defined:
* @li ":internet" for common internet protocols
* @li ":local" for protocols that access local resources
*
* Protocol classes always start with a ':' so that they can not be confused with
* the protocols themselves.
*
* @param protocol the protocol to check
* @return the class of the protocol, or an empty string if unknown
*/
static QString protocolClass( const QString& protocol );
/**
* Returns whether file previews should be shown for the specified protocol.
*
* This corresponds to the "ShowPreviews=" field in the protocol description file.
*
* By default previews are shown if protocolClass is :local.
*
* @param protocol the protocol to check
* @return true if previews should be shown by default, false otherwise
*/
static bool showFilePreview( const QString& protocol );
/**
* Returns the list of capabilities provided by the kioslave implementing
* this protocol.
*
* This corresponds to the "Capabilities=" field in the protocol description file.
*
* The capability names are not defined globally, they are up to each
* slave implementation. For example when adding support for a new
* special command for mounting, one would add the string "Mount" to the
* capabilities list, and applications could check for that string
* before sending a special() command that would otherwise do nothing
* on older kioslave implementations.
*
* @param protocol the protocol to check
* @return the list of capabilities.
*/
static QStringList capabilities( const QString& protocol );
/**
* Returns the name of the protocol through which the request
* will be routed if proxy support is enabled.
*
* A good example of this is the ftp protocol for which proxy
* support is commonly handled by the http protocol.
*
* This corresponds to the "ProxiedBy=" in the protocol description file.
*/
static QString proxiedBy( const QString& protocol );
public:
// Internal functions:
/**
* @internal construct a KProtocolInfo from a stream
*/
KProtocolInfo( QDataStream& _str, int offset);
virtual ~KProtocolInfo();
typedef enum { Name, FromUrl, DisplayName } FileNameUsedForCopying;
/// @internal. Use KProtocolManager instead.
bool supportsListing() const;
/// @internal. Use KProtocolManager instead.
QString defaultMimeType() const;
/// @internal. Use KProtocolManager instead.
QStringList archiveMimeTypes() const;
protected:
QString m_name;
QString m_exec;
Type m_inputType;
Type m_outputType;
QStringList m_listing;
bool m_isSourceProtocol;
bool m_isHelperProtocol;
bool m_supportsListing;
bool m_supportsReading;
bool m_supportsWriting;
bool m_supportsMakeDir;
bool m_supportsDeleting;
bool m_supportsLinking;
bool m_supportsMoving;
bool m_supportsOpening;
QString m_defaultMimetype;
bool m_determineMimetypeFromExtension;
QString m_icon;
bool m_canCopyFromFile;
bool m_canCopyToFile;
QString m_config;
int m_maxSlaves;
bool canRenameFromFile() const;
bool canRenameToFile() const;
bool canDeleteRecursive() const;
FileNameUsedForCopying fileNameUsedForCopying() const;
private:
/**
* Read a protocol description file
* @param path the path of the description file
*/
KProtocolInfo( const QString & path);
Q_DECLARE_PRIVATE(KProtocolInfo)
void load(QDataStream &s);
};
KDECORE_EXPORT QDataStream& operator>>( QDataStream& s, KProtocolInfo::ExtraField& field );
KDECORE_EXPORT QDataStream& operator<<( QDataStream& s, const KProtocolInfo::ExtraField& field );
#endif
|