# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 #ifdef MAKE_KDECORE_LIB //needed for proper linkage (win32)
    00021 #undef KIO_EXPORT
    00022 #define KIO_EXPORT KDE_EXPORT
    00023 #endif
    00024
    00025 #include "kprotocolinfo.h"
    00026 #include "kprotocolinfofactory.h"
    00027 #include "kprotocolmanager.h"
    00028
    00029 // Most of this class is implemented in kdecore/kprotocolinfo_kdecore.cpp
    00030 // This file only contains a few static class-functions that depend on
    00031 // KProtocolManager
    00032
    00033 KProtocolInfo* KProtocolInfo::findProtocol(const KURL &url)
    00034 {
    00035 #ifdef MAKE_KDECORE_LIB
    00036    return 0;
    00037 #else
    00038    QString protocol = url.protocol();
    00039
    00040    if ( !KProtocolInfo::proxiedBy( protocol ).isEmpty() )
    00041    {
    00042       QString dummy;
    00043       protocol = KProtocolManager::slaveProtocol(url, dummy);
    00044    }
    00045
    00046    return KProtocolInfoFactory::self()->findProtocol(protocol);
    00047 #endif
    00048 }
    00049
    00050
    00051 KProtocolInfo::Type KProtocolInfo::inputType( const KURL &url )
    00052 {
    00053   KProtocolInfo::Ptr prot = findProtocol(url);
    00054   if ( !prot )
    00055     return T_NONE;
    00056
    00057   return prot->m_inputType;
    00058 }
    00059
    00060 KProtocolInfo::Type KProtocolInfo::outputType( const KURL &url )
    00061 {
    00062   KProtocolInfo::Ptr prot = findProtocol(url);
    00063   if ( !prot )
    00064     return T_NONE;
    00065
    00066   return prot->m_outputType;
    00067 }
    00068
    00069
    00070 bool KProtocolInfo::isSourceProtocol( const KURL &url )
    00071 {
    00072   KProtocolInfo::Ptr prot = findProtocol(url);
    00073   if ( !prot )
    00074     return false;
    00075
    00076   return prot->m_isSourceProtocol;
    00077 }
    00078
    00079 bool KProtocolInfo::isFilterProtocol( const KURL &url )
    00080 {
    00081   return isFilterProtocol (url.protocol());
    00082 }
    00083
    00084 bool KProtocolInfo::isFilterProtocol( const QString &protocol )
    00085 {
    00086   // We call the findProtocol (const QString&) to bypass any proxy settings.
    00087   KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
    00088   if ( !prot )
    00089     return false;
    00090
    00091   return !prot->m_isSourceProtocol;
    00092 }
    00093
    00094 bool KProtocolInfo::isHelperProtocol( const KURL &url )
    00095 {
    00096   return isHelperProtocol (url.protocol());
    00097 }
    00098
    00099 bool KProtocolInfo::isHelperProtocol( const QString &protocol )
    00100 {
    00101   // We call the findProtocol (const QString&) to bypass any proxy settings.
    00102   KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
    00103   if ( !prot )
    00104     return false;
    00105
    00106   return prot->m_isHelperProtocol;
    00107 }
    00108
    00109 bool KProtocolInfo::isKnownProtocol( const KURL &url )
    00110 {
    00111   return isKnownProtocol (url.protocol());
    00112 }
    00113
    00114 bool KProtocolInfo::isKnownProtocol( const QString &protocol )
    00115 {
    00116   // We call the findProtocol (const QString&) to bypass any proxy settings.
    00117   KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
    00118   return ( prot != 0);
    00119 }
    00120
    00121 bool KProtocolInfo::supportsListing( const KURL &url )
    00122 {
    00123   KProtocolInfo::Ptr prot = findProtocol(url);
    00124   if ( !prot )
    00125     return false;
    00126
    00127   return prot->m_supportsListing;
    00128 }
    00129
    00130 QStringList KProtocolInfo::listing( const KURL &url )
    00131 {
    00132   KProtocolInfo::Ptr prot = findProtocol(url);
    00133   if ( !prot )
    00134     return QStringList();
    00135
    00136   return prot->m_listing;
    00137 }
    00138
    00139 bool KProtocolInfo::supportsReading( const KURL &url )
    00140 {
    00141   KProtocolInfo::Ptr prot = findProtocol(url);
    00142   if ( !prot )
    00143     return false;
    00144
    00145   return prot->m_supportsReading;
    00146 }
    00147
    00148 bool KProtocolInfo::supportsWriting( const KURL &url )
    00149 {
    00150   KProtocolInfo::Ptr prot = findProtocol(url);
    00151   if ( !prot )
    00152     return false;
    00153
    00154   return prot->m_supportsWriting;
    00155 }
    00156
    00157 bool KProtocolInfo::supportsMakeDir( const KURL &url )
    00158 {
    00159   KProtocolInfo::Ptr prot = findProtocol(url);
    00160   if ( !prot )
    00161     return false;
    00162
    00163   return prot->m_supportsMakeDir;
    00164 }
    00165
    00166 bool KProtocolInfo::supportsDeleting( const KURL &url )
    00167 {
    00168   KProtocolInfo::Ptr prot = findProtocol(url);
    00169   if ( !prot )
    00170     return false;
    00171
    00172   return prot->m_supportsDeleting;
    00173 }
    00174
    00175 bool KProtocolInfo::supportsLinking( const KURL &url )
    00176 {
    00177   KProtocolInfo::Ptr prot = findProtocol(url);
    00178   if ( !prot )
    00179     return false;
    00180
    00181   return prot->m_supportsLinking;
    00182 }
    00183
    00184 bool KProtocolInfo::supportsMoving( const KURL &url )
    00185 {
    00186   KProtocolInfo::Ptr prot = findProtocol(url);
    00187   if ( !prot )
    00188     return false;
    00189
    00190   return prot->m_supportsMoving;
    00191 }
    00192
    00193 bool KProtocolInfo::canCopyFromFile( const KURL &url )
    00194 {
    00195   KProtocolInfo::Ptr prot = findProtocol(url);
    00196   if ( !prot )
    00197     return false;
    00198
    00199   return prot->m_canCopyFromFile;
    00200 }
    00201
    00202
    00203 bool KProtocolInfo::canCopyToFile( const KURL &url )
    00204 {
    00205   KProtocolInfo::Ptr prot = findProtocol(url);
    00206   if ( !prot )
    00207     return false;
    00208
    00209   return prot->m_canCopyToFile;
    00210 }
    00211
    00212 bool KProtocolInfo::canRenameFromFile( const KURL &url )
    00213 {
    00214   KProtocolInfo::Ptr prot = findProtocol(url);
    00215   if ( !prot )
    00216     return false;
    00217
    00218   return prot->canRenameFromFile();
    00219 }
    00220
    00221
    00222 bool KProtocolInfo::canRenameToFile( const KURL &url )
    00223 {
    00224   KProtocolInfo::Ptr prot = findProtocol(url);
    00225   if ( !prot )
    00226     return false;
    00227
    00228   return prot->canRenameToFile();
    00229 }
    00230
    00231 bool KProtocolInfo::canDeleteRecursive( const KURL &url )
    00232 {
    00233   KProtocolInfo::Ptr prot = findProtocol(url);
    00234   if ( !prot )
    00235     return false;
    00236
    00237   return prot->canDeleteRecursive();
    00238 }
    00239
    00240 KProtocolInfo::FileNameUsedForCopying KProtocolInfo::fileNameUsedForCopying( const KURL &url )
    00241 {
    00242   KProtocolInfo::Ptr prot = findProtocol(url);
    00243   if ( !prot )
    00244     return FromURL;
    00245
    00246   return prot->fileNameUsedForCopying();
    00247 }
    00248
    00249 QString KProtocolInfo::defaultMimetype( const KURL &url )
    00250 {
    00251   KProtocolInfo::Ptr prot = findProtocol(url);
    00252   if ( !prot )
    00253     return QString::null;
    00254
    00255   return prot->m_defaultMimetype;
    00256 }
    00257

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003