kio Library API Documentation

kprotocolinfo.cpp

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Torben Weis <weis@kde.org> 00003 Copyright (C) 2003 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., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #include "kprotocolinfo.h" 00021 #include "kprotocolinfofactory.h" 00022 #include "kprotocolmanager.h" 00023 00024 // Most of this class is implemented in kdecore/kprotocolinfo_kdecore.cpp 00025 // This file only contains a few static class-functions that depend on 00026 // KProtocolManager 00027 00028 static KProtocolInfo* findProtocol(const KURL &url) 00029 { 00030 QString dummy; 00031 QString protocol = KProtocolManager::slaveProtocol(url, dummy); 00032 return KProtocolInfoFactory::self()->findProtocol(protocol); 00033 } 00034 00035 00036 KProtocolInfo::Type KProtocolInfo::inputType( const KURL &url ) 00037 { 00038 KProtocolInfo::Ptr prot = findProtocol(url); 00039 if ( !prot ) 00040 return T_NONE; 00041 00042 return prot->m_inputType; 00043 } 00044 00045 KProtocolInfo::Type KProtocolInfo::outputType( const KURL &url ) 00046 { 00047 KProtocolInfo::Ptr prot = findProtocol(url); 00048 if ( !prot ) 00049 return T_NONE; 00050 00051 return prot->m_outputType; 00052 } 00053 00054 00055 bool KProtocolInfo::isSourceProtocol( const KURL &url ) 00056 { 00057 KProtocolInfo::Ptr prot = findProtocol(url); 00058 if ( !prot ) 00059 return false; 00060 00061 return prot->m_isSourceProtocol; 00062 } 00063 00064 bool KProtocolInfo::isFilterProtocol( const KURL &url ) 00065 { 00066 // We use url.protocol() to bypass any proxy settings. 00067 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(url.protocol()); 00068 if ( !prot ) 00069 return false; 00070 00071 return !prot->m_isSourceProtocol; 00072 } 00073 00074 bool KProtocolInfo::isHelperProtocol( const KURL &url ) 00075 { 00076 // We use url.protocol() to bypass any proxy settings. 00077 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(url.protocol()); 00078 if ( !prot ) 00079 return false; 00080 00081 return prot->m_isHelperProtocol; 00082 } 00083 00084 bool KProtocolInfo::isKnownProtocol( const KURL &url ) 00085 { 00086 // We use url.protocol() to bypass any proxy settings. 00087 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(url.protocol()); 00088 return ( prot != 0); 00089 } 00090 00091 bool KProtocolInfo::supportsListing( const KURL &url ) 00092 { 00093 KProtocolInfo::Ptr prot = findProtocol(url); 00094 if ( !prot ) 00095 return false; 00096 00097 return prot->m_supportsListing; 00098 } 00099 00100 QStringList KProtocolInfo::listing( const KURL &url ) 00101 { 00102 KProtocolInfo::Ptr prot = findProtocol(url); 00103 if ( !prot ) 00104 return QStringList(); 00105 00106 return prot->m_listing; 00107 } 00108 00109 bool KProtocolInfo::supportsReading( const KURL &url ) 00110 { 00111 KProtocolInfo::Ptr prot = findProtocol(url); 00112 if ( !prot ) 00113 return false; 00114 00115 return prot->m_supportsReading; 00116 } 00117 00118 bool KProtocolInfo::supportsWriting( const KURL &url ) 00119 { 00120 KProtocolInfo::Ptr prot = findProtocol(url); 00121 if ( !prot ) 00122 return false; 00123 00124 return prot->m_supportsWriting; 00125 } 00126 00127 bool KProtocolInfo::supportsMakeDir( const KURL &url ) 00128 { 00129 KProtocolInfo::Ptr prot = findProtocol(url); 00130 if ( !prot ) 00131 return false; 00132 00133 return prot->m_supportsMakeDir; 00134 } 00135 00136 bool KProtocolInfo::supportsDeleting( const KURL &url ) 00137 { 00138 KProtocolInfo::Ptr prot = findProtocol(url); 00139 if ( !prot ) 00140 return false; 00141 00142 return prot->m_supportsDeleting; 00143 } 00144 00145 bool KProtocolInfo::supportsLinking( const KURL &url ) 00146 { 00147 KProtocolInfo::Ptr prot = findProtocol(url); 00148 if ( !prot ) 00149 return false; 00150 00151 return prot->m_supportsLinking; 00152 } 00153 00154 bool KProtocolInfo::supportsMoving( const KURL &url ) 00155 { 00156 KProtocolInfo::Ptr prot = findProtocol(url); 00157 if ( !prot ) 00158 return false; 00159 00160 return prot->m_supportsMoving; 00161 } 00162 00163 bool KProtocolInfo::canCopyFromFile( const KURL &url ) 00164 { 00165 KProtocolInfo::Ptr prot = findProtocol(url); 00166 if ( !prot ) 00167 return false; 00168 00169 return prot->m_canCopyFromFile; 00170 } 00171 00172 00173 bool KProtocolInfo::canCopyToFile( const KURL &url ) 00174 { 00175 KProtocolInfo::Ptr prot = findProtocol(url); 00176 if ( !prot ) 00177 return false; 00178 00179 return prot->m_canCopyToFile; 00180 } 00181 00182 QString KProtocolInfo::defaultMimetype( const KURL &url ) 00183 { 00184 KProtocolInfo::Ptr prot = findProtocol(url); 00185 if ( !prot ) 00186 return QString::null; 00187 00188 return prot->m_defaultMimetype; 00189 } 00190
KDE Logo
This file is part of the documentation for kio Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 20 09:49:15 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003