• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
kprotocolinfo.cpp
1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Torben Weis <weis@kde.org>
3 Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifdef MAKE_TDECORE_LIB //needed for proper linkage (win32)
21#undef TDEIO_EXPORT
22#define TDEIO_EXPORT TDE_EXPORT
23#endif
24
25#include "kprotocolinfo.h"
26#include "kprotocolinfofactory.h"
27#include "tdeprotocolmanager.h"
28
29// Most of this class is implemented in tdecore/kprotocolinfo_tdecore.cpp
30// This file only contains a few static class-functions that depend on
31// KProtocolManager
32
33KProtocolInfo* KProtocolInfo::findProtocol(const KURL &url)
34{
35#ifdef MAKE_TDECORE_LIB
36 return 0;
37#else
38 TQString protocol = url.protocol();
39
40 if ( !KProtocolInfo::proxiedBy( protocol ).isEmpty() )
41 {
42 TQString dummy;
43 protocol = KProtocolManager::slaveProtocol(url, dummy);
44 }
45
46 return KProtocolInfoFactory::self()->findProtocol(protocol);
47#endif
48}
49
50
51KProtocolInfo::Type KProtocolInfo::inputType( const KURL &url )
52{
53 KProtocolInfo::Ptr prot = findProtocol(url);
54 if ( !prot )
55 return T_NONE;
56
57 return prot->m_inputType;
58}
59
60KProtocolInfo::Type KProtocolInfo::outputType( const KURL &url )
61{
62 KProtocolInfo::Ptr prot = findProtocol(url);
63 if ( !prot )
64 return T_NONE;
65
66 return prot->m_outputType;
67}
68
69
70bool KProtocolInfo::isSourceProtocol( const KURL &url )
71{
72 KProtocolInfo::Ptr prot = findProtocol(url);
73 if ( !prot )
74 return false;
75
76 return prot->m_isSourceProtocol;
77}
78
79bool KProtocolInfo::isFilterProtocol( const KURL &url )
80{
81 return isFilterProtocol (url.protocol());
82}
83
84bool KProtocolInfo::isFilterProtocol( const TQString &protocol )
85{
86 // We call the findProtocol (const TQString&) to bypass any proxy settings.
87 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
88 if ( !prot )
89 return false;
90
91 return !prot->m_isSourceProtocol;
92}
93
94bool KProtocolInfo::isHelperProtocol( const KURL &url )
95{
96 return isHelperProtocol (url.protocol());
97}
98
99bool KProtocolInfo::isHelperProtocol( const TQString &protocol )
100{
101 // We call the findProtocol (const TQString&) to bypass any proxy settings.
102 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
103 if ( !prot )
104 return false;
105
106 return prot->m_isHelperProtocol;
107}
108
109bool KProtocolInfo::isKnownProtocol( const KURL &url )
110{
111 return isKnownProtocol (url.protocol());
112}
113
114bool KProtocolInfo::isKnownProtocol( const TQString &protocol )
115{
116 // We call the findProtocol (const TQString&) to bypass any proxy settings.
117 KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol);
118 return ( prot != 0);
119}
120
121bool KProtocolInfo::supportsListing( const KURL &url )
122{
123 KProtocolInfo::Ptr prot = findProtocol(url);
124 if ( !prot )
125 return false;
126
127 return prot->m_supportsListing;
128}
129
130TQStringList KProtocolInfo::listing( const KURL &url )
131{
132 KProtocolInfo::Ptr prot = findProtocol(url);
133 if ( !prot )
134 return TQStringList();
135
136 return prot->m_listing;
137}
138
139bool KProtocolInfo::supportsReading( const KURL &url )
140{
141 KProtocolInfo::Ptr prot = findProtocol(url);
142 if ( !prot )
143 return false;
144
145 return prot->m_supportsReading;
146}
147
148bool KProtocolInfo::supportsWriting( const KURL &url )
149{
150 KProtocolInfo::Ptr prot = findProtocol(url);
151 if ( !prot )
152 return false;
153
154 return prot->m_supportsWriting;
155}
156
157bool KProtocolInfo::supportsMakeDir( const KURL &url )
158{
159 KProtocolInfo::Ptr prot = findProtocol(url);
160 if ( !prot )
161 return false;
162
163 return prot->m_supportsMakeDir;
164}
165
166bool KProtocolInfo::supportsDeleting( const KURL &url )
167{
168 KProtocolInfo::Ptr prot = findProtocol(url);
169 if ( !prot )
170 return false;
171
172 return prot->m_supportsDeleting;
173}
174
175bool KProtocolInfo::supportsLinking( const KURL &url )
176{
177 KProtocolInfo::Ptr prot = findProtocol(url);
178 if ( !prot )
179 return false;
180
181 return prot->m_supportsLinking;
182}
183
184bool KProtocolInfo::supportsMoving( const KURL &url )
185{
186 KProtocolInfo::Ptr prot = findProtocol(url);
187 if ( !prot )
188 return false;
189
190 return prot->m_supportsMoving;
191}
192
193bool KProtocolInfo::canCopyFromFile( const KURL &url )
194{
195 KProtocolInfo::Ptr prot = findProtocol(url);
196 if ( !prot )
197 return false;
198
199 return prot->m_canCopyFromFile;
200}
201
202
203bool KProtocolInfo::canCopyToFile( const KURL &url )
204{
205 KProtocolInfo::Ptr prot = findProtocol(url);
206 if ( !prot )
207 return false;
208
209 return prot->m_canCopyToFile;
210}
211
212bool KProtocolInfo::canRenameFromFile( const KURL &url )
213{
214 KProtocolInfo::Ptr prot = findProtocol(url);
215 if ( !prot )
216 return false;
217
218 return prot->canRenameFromFile();
219}
220
221
222bool KProtocolInfo::canRenameToFile( const KURL &url )
223{
224 KProtocolInfo::Ptr prot = findProtocol(url);
225 if ( !prot )
226 return false;
227
228 return prot->canRenameToFile();
229}
230
231bool KProtocolInfo::canDeleteRecursive( const KURL &url )
232{
233 KProtocolInfo::Ptr prot = findProtocol(url);
234 if ( !prot )
235 return false;
236
237 return prot->canDeleteRecursive();
238}
239
240KProtocolInfo::FileNameUsedForCopying KProtocolInfo::fileNameUsedForCopying( const KURL &url )
241{
242 KProtocolInfo::Ptr prot = findProtocol(url);
243 if ( !prot )
244 return FromURL;
245
246 return prot->fileNameUsedForCopying();
247}
248
249TQString KProtocolInfo::defaultMimetype( const KURL &url )
250{
251 KProtocolInfo::Ptr prot = findProtocol(url);
252 if ( !prot )
253 return TQString::null;
254
255 return prot->m_defaultMimetype;
256}
257
KProtocolInfo
Information about I/O (Internet, etc.) protocols supported by KDE.
Definition kprotocolinfo.h:45
KProtocolInfo::defaultMimetype
static TQString defaultMimetype(const KURL &url)
Returns default mimetype for this URL based on the protocol.
Definition kprotocolinfo.cpp:249
KProtocolInfo::listing
static TQStringList listing(const KURL &url)
Returns the list of fields this protocol returns when listing The current possibilities are Name,...
Definition kprotocolinfo.cpp:130
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::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::supportsDeleting
static bool supportsDeleting(const KURL &url)
Returns whether the protocol can delete files/objects.
Definition kprotocolinfo.cpp:166
KProtocolInfo::supportsReading
static bool supportsReading(const KURL &url)
Returns whether the protocol can retrieve data from URLs.
Definition kprotocolinfo.cpp:139
KProtocolInfo::supportsWriting
static bool supportsWriting(const KURL &url)
Returns whether the protocol can store data to URLs.
Definition kprotocolinfo.cpp:148
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::canRenameToFile
static bool canRenameToFile(const KURL &url)
Returns whether the protocol can rename (i.e.
Definition kprotocolinfo.cpp:222
KProtocolInfo::isHelperProtocol
static bool isHelperProtocol(const KURL &url)
Returns whether the protocol can act as a helper protocol.
Definition kprotocolinfo.cpp:94
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::Type
Type
Describes the type of a protocol.
Definition kprotocolinfo.h:121
KProtocolInfo::T_NONE
@ T_NONE
no information about the tyope available
Definition kprotocolinfo.h:123
KProtocolInfo::supportsLinking
static bool supportsLinking(const KURL &url)
Returns whether the protocol can create links between files/objects.
Definition kprotocolinfo.cpp:175
KProtocolInfo::canRenameFromFile
static bool canRenameFromFile(const KURL &url)
Returns whether the protocol can rename (i.e.
Definition kprotocolinfo.cpp:212
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::canCopyToFile
static bool canCopyToFile(const KURL &url)
Returns whether the protocol can copy files/objects directly to the filesystem itself.
Definition kprotocolinfo.cpp:203
KProtocolInfo::isSourceProtocol
static bool isSourceProtocol(const KURL &url)
Returns whether the protocol can act as a source protocol.
Definition kprotocolinfo.cpp:70
KProtocolInfo::proxiedBy
static TQString proxiedBy(const TQString &protocol)
Returns the name of the protocol through which the request will be routed if proxy support is enabled...
KProtocolInfo::supportsMoving
static bool supportsMoving(const KURL &url)
Returns whether the protocol can move files/objects between different locations.
Definition kprotocolinfo.cpp:184
KProtocolInfo::supportsListing
static bool supportsListing(const KURL &url)
Returns whether the protocol can list files/objects.
Definition kprotocolinfo.cpp:121
KProtocolInfo::isFilterProtocol
static bool isFilterProtocol(const KURL &url)
Returns whether the protocol can act as a filter protocol.
Definition kprotocolinfo.cpp:79
KProtocolInfo::canDeleteRecursive
static bool canDeleteRecursive(const KURL &url)
Returns whether the protocol can recursively delete directories by itself.
Definition kprotocolinfo.cpp:231
KProtocolInfo::supportsMakeDir
static bool supportsMakeDir(const KURL &url)
Returns whether the protocol can create directories/folders.
Definition kprotocolinfo.cpp:157
KProtocolManager::slaveProtocol
static TQString slaveProtocol(const KURL &url, TQString &proxy)
Return the protocol to use in order to handle the given url It's usually the same,...
Definition tdeprotocolmanager.cpp:329

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.8
This website is maintained by Timothy Pearson.