kprotocolinfo.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00030
00031
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
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
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
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
|