• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

kprotocolinfo.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1999 Torben Weis <weis@kde.org>
00003    Copyright (C) 2000-2001 Waldo Bastian <bastian@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
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); // KDE4: make private and add friend class KProtocolInfoBuildFactory
00058                                         // Then we can get rid of the d pointer
00059 
00064   virtual bool isValid() const { return !m_name.isEmpty(); }
00065 
00074   virtual QString name() const { return m_name; }
00075 
00076   //
00077   // Static functions:
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() {} // for QValueList
00177     ExtraField(const QString& _name, const QString& _type )
00178       : name(_name), type(_type) {
00179     }
00180     QString name;
00181     QString type; // KDE4: make it QVariant::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   // Internal functions:
00595   KProtocolInfo( QDataStream& _str, int offset);
00596 
00597   virtual ~KProtocolInfo();
00598 
00603   virtual void load(QDataStream& );
00604 
00609   virtual void save(QDataStream& );
00610 
00612   // The following methods are deprecated:
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; // for kprotocolinfo_kdecore
00673   bool canRenameToFile() const; // for kprotocolinfo_kdecore
00674   bool canDeleteRecursive() const; // for kprotocolinfo_kdecore
00675   FileNameUsedForCopying fileNameUsedForCopying() const; // for kprotocolinfo_kdecore
00676   static KProtocolInfo* findProtocol(const KURL &url); // for kprotocolinfo_kdecore
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

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal