kprotocolinfo.h
/* 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 <qstring.h>
#include <qstringlist.h>
#include <qdatastream.h>
#include <kurl.h>
#include <ksycocaentry.h>
#include <ksycocatype.h>
class KIO_EXPORT KProtocolInfo : public KSycocaEntry
{
friend class KProtocolInfoFactory;
K_SYCOCATYPE( KST_KProtocolInfo, KSycocaEntry )
public:
typedef KSharedPtr<KProtocolInfo> Ptr;
public:
KProtocolInfo( const QString & path); // KDE4: make private and add friend class KProtocolInfoBuildFactory
// Then we can get rid of the d pointer
virtual bool isValid() const { return !m_name.isEmpty(); }
virtual QString name() const { return m_name; }
//
// Static functions:
//
static QStringList protocols();
static bool isKnownProtocol( const KURL &url );
static bool isKnownProtocol( const QString& protocol )
#ifdef KPROTOCOLINFO_KDECORE
KDE_WEAK_SYMBOL
#endif
;
static QString exec( const QString& protocol );
enum Type { T_STREAM,
T_FILESYSTEM,
T_NONE,
T_ERROR
};
static Type inputType( const KURL &url );
static Type outputType( const KURL &url );
static QStringList listing( const KURL &url );
struct ExtraField {
ExtraField() {} // for QValueList
ExtraField(const QString& _name, const QString& _type )
: name(_name), type(_type) {
}
QString name;
QString type; // KDE4: make it QVariant::Type
};
typedef QValueList<ExtraField > ExtraFieldList;
static ExtraFieldList extraFields( const KURL& url );
static bool isSourceProtocol( const KURL &url );
static bool isHelperProtocol( const KURL &url );
static bool isHelperProtocol( const QString& protocol )
#ifdef KPROTOCOLINFO_KDECORE
KDE_WEAK_SYMBOL
#endif
;
static bool isFilterProtocol( const KURL &url );
static bool isFilterProtocol( const QString& protocol )
#ifdef KPROTOCOLINFO_KDECORE
KDE_WEAK_SYMBOL
#endif
;
static bool supportsListing( const KURL &url );
static bool supportsReading( const KURL &url );
static bool supportsWriting( const KURL &url );
static bool supportsMakeDir( const KURL &url );
static bool supportsDeleting( const KURL &url );
static bool supportsLinking( const KURL &url );
static bool supportsMoving( const KURL &url );
static bool canCopyFromFile( const KURL &url );
static bool canCopyToFile( const KURL &url );
static bool canRenameFromFile( const KURL &url );
static bool canRenameToFile( const KURL &url );
static bool canDeleteRecursive( const KURL &url );
typedef enum { Name, FromURL } FileNameUsedForCopying;
static FileNameUsedForCopying fileNameUsedForCopying( const KURL &url );
static QString defaultMimetype( const KURL& url );
static QString icon( const QString& protocol );
static QString config( const QString& protocol );
static int maxSlaves( const QString& protocol );
static bool determineMimetypeFromExtension( const QString &protocol );
static QString docPath( const QString& protocol );
static QString protocolClass( const QString& protocol );
static bool showFilePreview( const QString& protocol );
static KURL::URIMode uriParseMode( const QString& protocol );
static QStringList capabilities( const QString& protocol );
static QString proxiedBy( const QString& protocol );
public:
// Internal functions:
KProtocolInfo( QDataStream& _str, int offset);
virtual ~KProtocolInfo();
virtual void load(QDataStream& );
virtual void save(QDataStream& );
// The following methods are deprecated:
static Type inputType( const QString& protocol ) KDE_DEPRECATED;
static Type outputType( const QString& protocol ) KDE_DEPRECATED;
static QStringList listing( const QString& protocol ) KDE_DEPRECATED;
static bool isSourceProtocol( const QString& protocol ) KDE_DEPRECATED;
static bool supportsListing( const QString& protocol ) KDE_DEPRECATED;
static bool supportsReading( const QString& protocol ) KDE_DEPRECATED;
static bool supportsWriting( const QString& protocol ) KDE_DEPRECATED;
static bool supportsMakeDir( const QString& protocol ) KDE_DEPRECATED;
static bool supportsDeleting( const QString& protocol ) KDE_DEPRECATED;
static bool supportsLinking( const QString& protocol ) KDE_DEPRECATED;
static bool supportsMoving( const QString& protocol ) KDE_DEPRECATED;
static bool canCopyFromFile( const QString& protocol ) KDE_DEPRECATED;
static bool canCopyToFile( const QString& protocol ) KDE_DEPRECATED;
static QString defaultMimetype( const QString& protocol) KDE_DEPRECATED;
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;
QString m_defaultMimetype;
bool m_determineMimetypeFromExtension;
QString m_icon;
bool m_canCopyFromFile;
bool m_canCopyToFile;
QString m_config;
int m_maxSlaves;
bool canRenameFromFile() const; // for kprotocolinfo_kdecore
bool canRenameToFile() const; // for kprotocolinfo_kdecore
bool canDeleteRecursive() const; // for kprotocolinfo_kdecore
FileNameUsedForCopying fileNameUsedForCopying() const; // for kprotocolinfo_kdecore
static KProtocolInfo* findProtocol(const KURL &url); // for kprotocolinfo_kdecore
protected:
virtual void virtual_hook( int id, void* data );
private:
class KProtocolInfoPrivate;
KProtocolInfoPrivate* d;
};
KIO_EXPORT QDataStream& operator>>( QDataStream& s, KProtocolInfo::ExtraField& field );
KIO_EXPORT QDataStream& operator<<( QDataStream& s, const KProtocolInfo::ExtraField& field );
#endif
KProtocolInfo::T_NONE
no information about the tyope available
Definition: kprotocolinfo.h:123
KProtocolInfo
Information about I/O (Internet, etc.) protocols supported by KDE.
Definition: kprotocolinfo.h:44
KProtocolInfo::ExtraField
Definition of an extra field in the UDS entries, returned by a listDir operation. ...
Definition: kprotocolinfo.h:175
KProtocolInfo::T_FILESYSTEM
protocol describes location in a file system
Definition: kprotocolinfo.h:122
KProtocolInfo::name
virtual QString name() const
Returns the name of the protocol.
Definition: kprotocolinfo.h:74
KProtocolInfo::isValid
virtual bool isValid() const
Returns whether the protocol description file is valid.
Definition: kprotocolinfo.h:64
KProtocolInfo::Type
Type
Describes the type of a protocol.
Definition: kprotocolinfo.h:121

KDE Home | KDE Accessibility Home | Description of Access Keys