KDECore
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 <kglobal.h> 00023 00024 #include <kurl.h> 00025 #include <ksycocaentry.h> 00026 #include <ksycocatype.h> 00027 #include <QtCore/QVariant> 00028 #include <QtCore/QStringList> 00029 00030 class QDataStream; 00031 class KProtocolInfoPrivate; 00032 00049 class KDECORE_EXPORT KProtocolInfo : public KSycocaEntry 00050 { 00051 friend class KProtocolInfoFactory; 00052 friend class KBuildProtocolInfoFactory; 00053 friend class KProtocolManager; 00054 public: 00055 typedef KSharedPtr<KProtocolInfo> Ptr; 00056 typedef QList<Ptr> List; 00057 00058 public: 00059 00060 // 00061 // Static functions: 00062 // 00063 00068 static QStringList protocols(); 00069 00077 static bool isKnownProtocol( const KUrl &url ); 00078 00083 static bool isKnownProtocol( const QString& protocol ); 00084 00096 static QString exec( const QString& protocol ); 00097 00105 enum Type { T_STREAM, 00106 T_FILESYSTEM, 00107 T_NONE, 00108 T_ERROR 00109 }; 00110 00119 struct ExtraField { 00120 00121 enum Type { String = QVariant::String, DateTime = QVariant::DateTime, Invalid = QVariant::Invalid }; 00122 00123 ExtraField() : type(Invalid) {} 00124 ExtraField(const QString& _name, Type _type ) 00125 : name(_name), type(_type) { 00126 } 00127 QString name; 00128 Type type; 00129 }; 00130 typedef QList<ExtraField> ExtraFieldList; 00138 static ExtraFieldList extraFields( const KUrl& url ); 00139 00152 static bool isHelperProtocol( const KUrl &url ); 00153 00158 static bool isHelperProtocol( const QString& protocol ); 00159 00176 static bool isFilterProtocol( const KUrl &url ); 00177 00182 static bool isFilterProtocol( const QString& protocol ); 00183 00192 static QString icon( const QString& protocol ); 00193 00205 static QString config( const QString& protocol ); 00206 00219 static int maxSlaves( const QString& protocol ); 00220 00221 00233 static int maxSlavesPerHost( const QString& protocol ); 00234 00246 static bool determineMimetypeFromExtension( const QString &protocol ); 00247 00256 static QString docPath( const QString& protocol ); 00257 00273 static QString protocolClass( const QString& protocol ); 00274 00285 static bool showFilePreview( const QString& protocol ); 00286 00303 static QStringList capabilities( const QString& protocol ); 00304 00314 static QString proxiedBy( const QString& protocol ); 00315 00316 public: 00317 // Internal functions: 00321 KProtocolInfo( QDataStream& _str, int offset); 00322 00323 virtual ~KProtocolInfo(); 00324 00325 typedef enum { Name, FromUrl, DisplayName } FileNameUsedForCopying; 00326 00328 bool supportsListing() const; 00330 QString defaultMimeType() const; 00332 QStringList archiveMimeTypes() const; 00333 00334 protected: 00335 QString m_name; 00336 QString m_exec; 00337 Type m_inputType; 00338 Type m_outputType; 00339 QStringList m_listing; 00340 bool m_isSourceProtocol; 00341 bool m_isHelperProtocol; 00342 bool m_supportsListing; 00343 bool m_supportsReading; 00344 bool m_supportsWriting; 00345 bool m_supportsMakeDir; 00346 bool m_supportsDeleting; 00347 bool m_supportsLinking; 00348 bool m_supportsMoving; 00349 bool m_supportsOpening; 00350 QString m_defaultMimetype; 00351 bool m_determineMimetypeFromExtension; 00352 QString m_icon; 00353 bool m_canCopyFromFile; 00354 bool m_canCopyToFile; 00355 QString m_config; 00356 int m_maxSlaves; 00357 00358 bool canRenameFromFile() const; 00359 bool canRenameToFile() const; 00360 bool canDeleteRecursive() const; 00361 FileNameUsedForCopying fileNameUsedForCopying() const; 00362 00363 private: 00368 KProtocolInfo( const QString & path); 00369 00370 Q_DECLARE_PRIVATE(KProtocolInfo) 00371 00372 void load(QDataStream &s); 00373 }; 00374 00375 KDECORE_EXPORT QDataStream& operator>>( QDataStream& s, KProtocolInfo::ExtraField& field ); 00376 KDECORE_EXPORT QDataStream& operator<<( QDataStream& s, const KProtocolInfo::ExtraField& field ); 00377 00378 #endif
KDE 4.6 API Reference