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 protocol = url.protocol(); 00031 00032 if ( !KProtocolInfo::proxiedBy( protocol ).isEmpty() ) 00033 { 00034 QString dummy; 00035 protocol = KProtocolManager::slaveProtocol(url, dummy); 00036 } 00037 00038 return KProtocolInfoFactory::self()->findProtocol(protocol); 00039 } 00040 00041 00042 KProtocolInfo::Type KProtocolInfo::inputType( const KURL &url ) 00043 { 00044 KProtocolInfo::Ptr prot = findProtocol(url); 00045 if ( !prot ) 00046 return T_NONE; 00047 00048 return prot->m_inputType; 00049 } 00050 00051 KProtocolInfo::Type KProtocolInfo::outputType( const KURL &url ) 00052 { 00053 KProtocolInfo::Ptr prot = findProtocol(url); 00054 if ( !prot ) 00055 return T_NONE; 00056 00057 return prot->m_outputType; 00058 } 00059 00060 00061 bool KProtocolInfo::isSourceProtocol( const KURL &url ) 00062 { 00063 KProtocolInfo::Ptr prot = findProtocol(url); 00064 if ( !prot ) 00065 return false; 00066 00067 return prot->m_isSourceProtocol; 00068 } 00069 00070 bool KProtocolInfo::isFilterProtocol( const KURL &url ) 00071 { 00072 return isFilterProtocol (url.protocol()); 00073 } 00074 00075 bool KProtocolInfo::isFilterProtocol( const QString &protocol ) 00076 { 00077 // We call the findProtocol (const QString&) to bypass any proxy settings. 00078 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol); 00079 if ( !prot ) 00080 return false; 00081 00082 return !prot->m_isSourceProtocol; 00083 } 00084 00085 bool KProtocolInfo::isHelperProtocol( const KURL &url ) 00086 { 00087 return isHelperProtocol (url.protocol()); 00088 } 00089 00090 bool KProtocolInfo::isHelperProtocol( const QString &protocol ) 00091 { 00092 // We call the findProtocol (const QString&) to bypass any proxy settings. 00093 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol); 00094 if ( !prot ) 00095 return false; 00096 00097 return prot->m_isHelperProtocol; 00098 } 00099 00100 bool KProtocolInfo::isKnownProtocol( const KURL &url ) 00101 { 00102 return isKnownProtocol (url.protocol()); 00103 } 00104 00105 bool KProtocolInfo::isKnownProtocol( const QString &protocol ) 00106 { 00107 // We call the findProtocol (const QString&) to bypass any proxy settings. 00108 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol); 00109 return ( prot != 0); 00110 } 00111 00112 bool KProtocolInfo::supportsListing( const KURL &url ) 00113 { 00114 KProtocolInfo::Ptr prot = findProtocol(url); 00115 if ( !prot ) 00116 return false; 00117 00118 return prot->m_supportsListing; 00119 } 00120 00121 QStringList KProtocolInfo::listing( const KURL &url ) 00122 { 00123 KProtocolInfo::Ptr prot = findProtocol(url); 00124 if ( !prot ) 00125 return QStringList(); 00126 00127 return prot->m_listing; 00128 } 00129 00130 bool KProtocolInfo::supportsReading( const KURL &url ) 00131 { 00132 KProtocolInfo::Ptr prot = findProtocol(url); 00133 if ( !prot ) 00134 return false; 00135 00136 return prot->m_supportsReading; 00137 } 00138 00139 bool KProtocolInfo::supportsWriting( const KURL &url ) 00140 { 00141 KProtocolInfo::Ptr prot = findProtocol(url); 00142 if ( !prot ) 00143 return false; 00144 00145 return prot->m_supportsWriting; 00146 } 00147 00148 bool KProtocolInfo::supportsMakeDir( const KURL &url ) 00149 { 00150 KProtocolInfo::Ptr prot = findProtocol(url); 00151 if ( !prot ) 00152 return false; 00153 00154 return prot->m_supportsMakeDir; 00155 } 00156 00157 bool KProtocolInfo::supportsDeleting( const KURL &url ) 00158 { 00159 KProtocolInfo::Ptr prot = findProtocol(url); 00160 if ( !prot ) 00161 return false; 00162 00163 return prot->m_supportsDeleting; 00164 } 00165 00166 bool KProtocolInfo::supportsLinking( const KURL &url ) 00167 { 00168 KProtocolInfo::Ptr prot = findProtocol(url); 00169 if ( !prot ) 00170 return false; 00171 00172 return prot->m_supportsLinking; 00173 } 00174 00175 bool KProtocolInfo::supportsMoving( const KURL &url ) 00176 { 00177 KProtocolInfo::Ptr prot = findProtocol(url); 00178 if ( !prot ) 00179 return false; 00180 00181 return prot->m_supportsMoving; 00182 } 00183 00184 bool KProtocolInfo::canCopyFromFile( const KURL &url ) 00185 { 00186 KProtocolInfo::Ptr prot = findProtocol(url); 00187 if ( !prot ) 00188 return false; 00189 00190 return prot->m_canCopyFromFile; 00191 } 00192 00193 00194 bool KProtocolInfo::canCopyToFile( const KURL &url ) 00195 { 00196 KProtocolInfo::Ptr prot = findProtocol(url); 00197 if ( !prot ) 00198 return false; 00199 00200 return prot->m_canCopyToFile; 00201 } 00202 00203 QString KProtocolInfo::defaultMimetype( const KURL &url ) 00204 { 00205 KProtocolInfo::Ptr prot = findProtocol(url); 00206 if ( !prot ) 00207 return QString::null; 00208 00209 return prot->m_defaultMimetype; 00210 } 00211
KDE Logo
This file is part of the documentation for kio Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:41:07 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003