kio
kprotocolinfo.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __kprotocolinfo_h__
00020 #define __kprotocolinfo_h__
00021
00022 #include <qstring.h>
00023 #include <qstringlist.h>
00024 #include <qdatastream.h>
00025
00026 #include <kurl.h>
00027 #include <ksycocaentry.h>
00028 #include <ksycocatype.h>
00029
00044 class KIO_EXPORT KProtocolInfo : public KSycocaEntry
00045 {
00046 friend class KProtocolInfoFactory;
00047 K_SYCOCATYPE( KST_KProtocolInfo, KSycocaEntry )
00048
00049 public:
00050 typedef KSharedPtr<KProtocolInfo> Ptr;
00051
00052 public:
00057 KProtocolInfo( const QString & path);
00058
00059
00064 virtual bool isValid() const { return !m_name.isEmpty(); }
00065
00074 virtual QString name() const { return m_name; }
00075
00076
00077
00078
00079
00084 static QStringList protocols();
00085
00093 static bool isKnownProtocol( const KURL &url );
00094
00099 static bool isKnownProtocol( const QString& protocol )
00100 #ifdef KPROTOCOLINFO_KDECORE
00101 KDE_WEAK_SYMBOL
00102 #endif
00103 ;
00104
00116 static QString exec( const QString& protocol );
00117
00121 enum Type { T_STREAM,
00122 T_FILESYSTEM,
00123 T_NONE,
00124 T_ERROR
00125 };
00126
00137 static Type inputType( const KURL &url );
00138
00149 static Type outputType( const KURL &url );
00150
00163 static QStringList listing( const KURL &url );
00164
00175 struct ExtraField {
00176 ExtraField() {}
00177 ExtraField(const QString& _name, const QString& _type )
00178 : name(_name), type(_type) {
00179 }
00180 QString name;
00181 QString type;
00182 };
00183 typedef QValueList<ExtraField > ExtraFieldList;
00193 static ExtraFieldList extraFields( const KURL& url );
00194
00208 static bool isSourceProtocol( const KURL &url );
00209
00222 static bool isHelperProtocol( const KURL &url );
00223
00228 static bool isHelperProtocol( const QString& protocol )
00229 #ifdef KPROTOCOLINFO_KDECORE
00230 KDE_WEAK_SYMBOL
00231 #endif
00232 ;
00233
00250 static bool isFilterProtocol( const KURL &url );
00251
00256 static bool isFilterProtocol( const QString& protocol )
00257 #ifdef KPROTOCOLINFO_KDECORE
00258 KDE_WEAK_SYMBOL
00259 #endif
00260 ;
00261
00277 static bool supportsListing( const KURL &url );
00278
00288 static bool supportsReading( const KURL &url );
00289
00299 static bool supportsWriting( const KURL &url );
00300
00310 static bool supportsMakeDir( const KURL &url );
00311
00321 static bool supportsDeleting( const KURL &url );
00322
00332 static bool supportsLinking( const KURL &url );
00333
00344 static bool supportsMoving( const KURL &url );
00345
00358 static bool canCopyFromFile( const KURL &url );
00359
00372 static bool canCopyToFile( const KURL &url );
00373
00387 static bool canRenameFromFile( const KURL &url );
00388
00402 static bool canRenameToFile( const KURL &url );
00403
00416 static bool canDeleteRecursive( const KURL &url );
00417
00418 typedef enum { Name, FromURL } FileNameUsedForCopying;
00419
00436 static FileNameUsedForCopying fileNameUsedForCopying( const KURL &url );
00437
00446 static QString defaultMimetype( const KURL& url );
00447
00456 static QString icon( const QString& protocol );
00457
00469 static QString config( const QString& protocol );
00470
00483 static int maxSlaves( const QString& protocol );
00484
00496 static bool determineMimetypeFromExtension( const QString &protocol );
00497
00507 static QString docPath( const QString& protocol );
00508
00525 static QString protocolClass( const QString& protocol );
00526
00538 static bool showFilePreview( const QString& protocol );
00539
00555 static KURL::URIMode uriParseMode( const QString& protocol );
00556
00575 static QStringList capabilities( const QString& protocol );
00576
00588 static QString proxiedBy( const QString& protocol );
00589
00590 public:
00591
00595 KProtocolInfo( QDataStream& _str, int offset);
00596
00597 virtual ~KProtocolInfo();
00598
00603 virtual void load(QDataStream& );
00604
00609 virtual void save(QDataStream& );
00610
00612
00613
00615 static Type inputType( const QString& protocol ) KDE_DEPRECATED;
00617 static Type outputType( const QString& protocol ) KDE_DEPRECATED;
00624 static QStringList listing( const QString& protocol ) KDE_DEPRECATED;
00626 static bool isSourceProtocol( const QString& protocol ) KDE_DEPRECATED;
00628 static bool supportsListing( const QString& protocol ) KDE_DEPRECATED;
00630 static bool supportsReading( const QString& protocol ) KDE_DEPRECATED;
00632 static bool supportsWriting( const QString& protocol ) KDE_DEPRECATED;
00634 static bool supportsMakeDir( const QString& protocol ) KDE_DEPRECATED;
00636 static bool supportsDeleting( const QString& protocol ) KDE_DEPRECATED;
00638 static bool supportsLinking( const QString& protocol ) KDE_DEPRECATED;
00640 static bool supportsMoving( const QString& protocol ) KDE_DEPRECATED;
00642 static bool canCopyFromFile( const QString& protocol ) KDE_DEPRECATED;
00644 static bool canCopyToFile( const QString& protocol ) KDE_DEPRECATED;
00646 static QString defaultMimetype( const QString& protocol) KDE_DEPRECATED;
00648
00649 protected:
00650 QString m_name;
00651 QString m_exec;
00652 Type m_inputType;
00653 Type m_outputType;
00654 QStringList m_listing;
00655 bool m_isSourceProtocol;
00656 bool m_isHelperProtocol;
00657 bool m_supportsListing;
00658 bool m_supportsReading;
00659 bool m_supportsWriting;
00660 bool m_supportsMakeDir;
00661 bool m_supportsDeleting;
00662 bool m_supportsLinking;
00663 bool m_supportsMoving;
00664 QString m_defaultMimetype;
00665 bool m_determineMimetypeFromExtension;
00666 QString m_icon;
00667 bool m_canCopyFromFile;
00668 bool m_canCopyToFile;
00669 QString m_config;
00670 int m_maxSlaves;
00671
00672 bool canRenameFromFile() const;
00673 bool canRenameToFile() const;
00674 bool canDeleteRecursive() const;
00675 FileNameUsedForCopying fileNameUsedForCopying() const;
00676 static KProtocolInfo* findProtocol(const KURL &url);
00677
00678 protected:
00679 virtual void virtual_hook( int id, void* data );
00680 private:
00681 class KProtocolInfoPrivate;
00682 KProtocolInfoPrivate* d;
00683 };
00684
00685 KIO_EXPORT QDataStream& operator>>( QDataStream& s, KProtocolInfo::ExtraField& field );
00686 KIO_EXPORT QDataStream& operator<<( QDataStream& s, const KProtocolInfo::ExtraField& field );
00687
00688 #endif