kprotocolinfo.cpp
/* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@kde.org>
Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef MAKE_KDECORE_LIB //needed for proper linkage (win32)
#undef KIO_EXPORT
#define KIO_EXPORT KDE_EXPORT
#endif
#include "kprotocolinfo.h"
#include "kprotocolinfofactory.h"
#include "kprotocolmanager.h"
// Most of this class is implemented in kdecore/kprotocolinfo_kdecore.cpp
// This file only contains a few static class-functions that depend on
// KProtocolManager
KProtocolInfo* KProtocolInfo::findProtocol(const KURL &url)
{
#ifdef MAKE_KDECORE_LIB
return 0;
#else
QString protocol = url.protocol();
if ( !KProtocolInfo::proxiedBy( protocol ).isEmpty() )
{
QString dummy;
protocol = KProtocolManager::slaveProtocol(url, dummy);
}
return KProtocolInfoFactory::self()->findProtocol(protocol);
#endif
}
KProtocolInfo::Type KProtocolInfo::inputType( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return T_NONE;
return prot->m_inputType;
}
KProtocolInfo::Type KProtocolInfo::outputType( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return T_NONE;
return prot->m_outputType;
}
bool KProtocolInfo::isSourceProtocol( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_isSourceProtocol;
}
bool KProtocolInfo::isFilterProtocol( const KURL &url )
{
return isFilterProtocol (url.protocol());
}
bool KProtocolInfo::isFilterProtocol( const QString &protocol )
{
// We call the findProtocol (const QString&) to bypass any proxy settings.
KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
if ( !prot )
return false;
return !prot->m_isSourceProtocol;
}
bool KProtocolInfo::isHelperProtocol( const KURL &url )
{
return isHelperProtocol (url.protocol());
}
bool KProtocolInfo::isHelperProtocol( const QString &protocol )
{
// We call the findProtocol (const QString&) to bypass any proxy settings.
KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
if ( !prot )
return false;
return prot->m_isHelperProtocol;
}
bool KProtocolInfo::isKnownProtocol( const KURL &url )
{
return isKnownProtocol (url.protocol());
}
bool KProtocolInfo::isKnownProtocol( const QString &protocol )
{
// We call the findProtocol (const QString&) to bypass any proxy settings.
KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
return ( prot != 0);
}
bool KProtocolInfo::supportsListing( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_supportsListing;
}
QStringList KProtocolInfo::listing( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return QStringList();
return prot->m_listing;
}
bool KProtocolInfo::supportsReading( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_supportsReading;
}
bool KProtocolInfo::supportsWriting( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_supportsWriting;
}
bool KProtocolInfo::supportsMakeDir( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_supportsMakeDir;
}
bool KProtocolInfo::supportsDeleting( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_supportsDeleting;
}
bool KProtocolInfo::supportsLinking( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_supportsLinking;
}
bool KProtocolInfo::supportsMoving( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_supportsMoving;
}
bool KProtocolInfo::canCopyFromFile( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_canCopyFromFile;
}
bool KProtocolInfo::canCopyToFile( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->m_canCopyToFile;
}
bool KProtocolInfo::canRenameFromFile( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->canRenameFromFile();
}
bool KProtocolInfo::canRenameToFile( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->canRenameToFile();
}
bool KProtocolInfo::canDeleteRecursive( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return false;
return prot->canDeleteRecursive();
}
KProtocolInfo::FileNameUsedForCopying KProtocolInfo::fileNameUsedForCopying( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return FromURL;
return prot->fileNameUsedForCopying();
}
QString KProtocolInfo::defaultMimetype( const KURL &url )
{
KProtocolInfo::Ptr prot = findProtocol(url);
if ( !prot )
return QString::null;
return prot->m_defaultMimetype;
}
KProtocolInfo::T_NONE
no information about the tyope available
Definition: kprotocolinfo.h:123
KProtocolInfo::fileNameUsedForCopying
static FileNameUsedForCopying fileNameUsedForCopying(const KURL &url)
This setting defines the strategy to use for generating a filename, when copying a file or directory ...
Definition: kprotocolinfo.cpp:240
KProtocolInfo
Information about I/O (Internet, etc.) protocols supported by KDE.
Definition: kprotocolinfo.h:44
KProtocolInfo::inputType
static Type inputType(const KURL &url)
Returns whether the protocol should be treated as a filesystem or as a stream when reading from it...
Definition: kprotocolinfo.cpp:51
KProtocolInfo::isKnownProtocol
static bool isKnownProtocol(const KURL &url)
Returns whether a protocol is installed that is able to handle url.
Definition: kprotocolinfo.cpp:109
KProtocolInfo::listing
static QStringList listing(const KURL &url)
Returns the list of fields this protocol returns when listing The current possibilities are Name...
Definition: kprotocolinfo.cpp:130
KProtocolInfo::supportsMoving
static bool supportsMoving(const KURL &url)
Returns whether the protocol can move files/objects between different locations.
Definition: kprotocolinfo.cpp:184
KProtocolInfo::supportsMakeDir
static bool supportsMakeDir(const KURL &url)
Returns whether the protocol can create directories/folders.
Definition: kprotocolinfo.cpp:157
KProtocolInfo::supportsReading
static bool supportsReading(const KURL &url)
Returns whether the protocol can retrieve data from URLs.
Definition: kprotocolinfo.cpp:139
KProtocolInfo::canDeleteRecursive
static bool canDeleteRecursive(const KURL &url)
Returns whether the protocol can recursively delete directories by itself.
Definition: kprotocolinfo.cpp:231
KProtocolInfo::proxiedBy
static QString proxiedBy(const QString &protocol)
Returns the name of the protocol through which the request will be routed if proxy support is enabled...
KProtocolInfo::isFilterProtocol
static bool isFilterProtocol(const KURL &url)
Returns whether the protocol can act as a filter protocol.
Definition: kprotocolinfo.cpp:79
KProtocolInfo::supportsListing
static bool supportsListing(const KURL &url)
Returns whether the protocol can list files/objects.
Definition: kprotocolinfo.cpp:121
KProtocolInfo::defaultMimetype
static QString defaultMimetype(const KURL &url)
Returns default mimetype for this URL based on the protocol.
Definition: kprotocolinfo.cpp:249
KProtocolInfo::canCopyFromFile
static bool canCopyFromFile(const KURL &url)
Returns whether the protocol can copy files/objects directly from the filesystem itself.
Definition: kprotocolinfo.cpp:193
KProtocolInfo::supportsLinking
static bool supportsLinking(const KURL &url)
Returns whether the protocol can create links between files/objects.
Definition: kprotocolinfo.cpp:175
KProtocolManager::slaveProtocol
static QString slaveProtocol(const KURL &url, QString &proxy)
Return the protocol to use in order to handle the given url It's usually the same, except that FTP, when handled by a proxy, needs an HTTP ioslave.
Definition: kprotocolmanager.cpp:329
KProtocolInfo::supportsWriting
static bool supportsWriting(const KURL &url)
Returns whether the protocol can store data to URLs.
Definition: kprotocolinfo.cpp:148
KProtocolInfo::canRenameFromFile
static bool canRenameFromFile(const KURL &url)
Returns whether the protocol can rename (i.e.
Definition: kprotocolinfo.cpp:212
KProtocolInfo::supportsDeleting
static bool supportsDeleting(const KURL &url)
Returns whether the protocol can delete files/objects.
Definition: kprotocolinfo.cpp:166
KProtocolInfo::isHelperProtocol
static bool isHelperProtocol(const KURL &url)
Returns whether the protocol can act as a helper protocol.
Definition: kprotocolinfo.cpp:94
KProtocolInfo::canRenameToFile
static bool canRenameToFile(const KURL &url)
Returns whether the protocol can rename (i.e.
Definition: kprotocolinfo.cpp:222
KProtocolInfo::isSourceProtocol
static bool isSourceProtocol(const KURL &url)
Returns whether the protocol can act as a source protocol.
Definition: kprotocolinfo.cpp:70
KProtocolInfo::outputType
static Type outputType(const KURL &url)
Returns whether the protocol should be treated as a filesystem or as a stream when writing to it...
Definition: kprotocolinfo.cpp:60
KProtocolInfo::Type
Type
Describes the type of a protocol.
Definition: kprotocolinfo.h:121
KProtocolInfo::canCopyToFile
static bool canCopyToFile(const KURL &url)
Returns whether the protocol can copy files/objects directly to the filesystem itself.
Definition: kprotocolinfo.cpp:203

KDE Home | KDE Accessibility Home | Description of Access Keys