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

tdeio/tdeio

  • tdeio
  • tdeio
kurifilter.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (C) 2000-2001,2003 Dawit Alemayehu <adawit at kde.org>
4  *
5  * Original author
6  * Copyright (C) 2000 Yves Arrouye <yves@realnames.com>
7  *
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this library; see the file COPYING.LIB. If not, write to
21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  **/
24 
25 #ifndef __kurifilter_h__
26 #define __kurifilter_h__
27 
28 #include <tqptrlist.h>
29 #include <tqobject.h>
30 #include <tqstringlist.h>
31 #include <tqpixmap.h>
32 
33 #include <kurl.h>
34 
35 #ifdef Q_OS_WIN
36 #undef ERROR
37 #endif
38 
39 class KURIFilterPrivate;
40 class KURIFilterDataPrivate;
41 
42 class TDECModule;
43 
79 class TDEIO_EXPORT KURIFilterData
80 {
81 friend class KURIFilterPlugin;
82 
83 public:
100  enum URITypes { NET_PROTOCOL=0, LOCAL_FILE, LOCAL_DIR, EXECUTABLE, HELP, SHELL, BLOCKED, ERROR, UNKNOWN };
101 
107  KURIFilterData() { init(); }
108 
114  KURIFilterData( const KURL& url ) { init( url); }
115 
121  KURIFilterData( const TQString& url ) { init( url ); }
122 
131  KURIFilterData( const KURIFilterData& data);
132 
136  ~KURIFilterData();
137 
145  KDE_DEPRECATED bool hasBeenFiltered() const { return true; }
146 
157  KURL uri() const { return m_pURI; }
158 
169  TQString errorMsg() const { return m_strErrMsg; }
170 
178  URITypes uriType() const { return m_iType; }
179 
189  void setData( const TQString& url ) { reinit( url ); }
190 
200  void setData( const KURL& url ) { reinit( url ); }
201 
216  bool setAbsolutePath( const TQString& abs_path );
217 
223  TQString absolutePath() const;
224 
230  bool hasAbsolutePath() const;
231 
238  TQString argsAndOptions() const;
239 
245  bool hasArgsAndOptions() const;
246 
258  TQString iconName();
259 
268  TQPixmap customIconPixmap();
269 
280  void setCheckForExecutables (bool check);
281 
288  bool checkForExecutables() const { return m_bCheckForExecutables; }
289 
294  TQString typedString() const;
295 
304  KURIFilterData& operator=( const KURL& url ) { reinit( url ); return *this; }
305 
314  KURIFilterData& operator=( const TQString& url ) { reinit( url ); return *this; }
315 
316 protected:
317 
322  void init( const KURL& url);
323 
328  void init( const TQString& url = TQString::null );
329 
330 private:
331 
332  // BC hack to avoid leaking KURIFilterDataPrivate objects.
333  // setData() and operator= used to call init() without deleting `d'
334  void reinit(const KURL& url);
335  void reinit(const TQString& url = TQString::null);
336 
337  bool m_bCheckForExecutables;
338  bool m_bChanged;
339 
340  TQString m_strErrMsg;
341  TQString m_strIconName;
342 
343  KURL m_pURI;
344  URITypes m_iType;
345  KURIFilterDataPrivate *d;
346 
347  TQPixmap m_customIconPixmap;
348 };
349 
350 
363 class TDEIO_EXPORT KURIFilterPlugin : public TQObject
364 {
365  Q_OBJECT
366 
367 
368 public:
369 
378  KURIFilterPlugin( TQObject *parent = 0, const char *name = 0, double pri = 1.0 );
379 
385  virtual TQString name() const { return m_strName; }
386 
395  virtual double priority() const { return m_dblPriority; }
396 
403  virtual bool filterURI( KURIFilterData& data ) const = 0;
404 
413  virtual TDECModule *configModule( TQWidget*, const char* ) const { return 0; }
414 
420  virtual TQString configName() const { return name(); }
421 
422 protected:
423 
427  void setFilteredURI ( KURIFilterData& data, const KURL& uri ) const;
428 
432  void setErrorMsg ( KURIFilterData& data, const TQString& errmsg ) const {
433  data.m_strErrMsg = errmsg;
434  }
435 
439  void setURIType ( KURIFilterData& data, KURIFilterData::URITypes type) const {
440  data.m_iType = type;
441  data.m_bChanged = true;
442  }
443 
448  void setArguments( KURIFilterData& data, const TQString& args ) const;
449 
450  TQString m_strName;
451  double m_dblPriority;
452 
453 protected:
454  virtual void virtual_hook( int id, void* data );
455 private:
456  class KURIFilterPluginPrivate *d;
457 };
458 
459 
463 class TDEIO_EXPORT KURIFilterPluginList : public TQPtrList<KURIFilterPlugin>
464 {
465 public:
466  virtual int compareItems(Item a, Item b)
467  {
468  double diff = ((KURIFilterPlugin *) a)->priority() - ((KURIFilterPlugin *) b)->priority();
469  return diff < 0 ? -1 : (diff > 0 ? 1 : 0);
470  }
471 
472 private:
473  KURIFilterPrivate *d;
474 
475 };
476 
548 class TDEIO_EXPORT KURIFilter
549 {
550 public:
554  ~KURIFilter ();
555 
559  static KURIFilter* self();
560 
572  bool filterURI( KURIFilterData& data, const TQStringList& filters = TQStringList() );
573 
585  bool filterURI( KURL &uri, const TQStringList& filters = TQStringList() );
586 
598  bool filterURI( TQString &uri, const TQStringList& filters = TQStringList() );
599 
611  KURL filteredURI( const KURL &uri, const TQStringList& filters = TQStringList() );
612 
624  TQString filteredURI( const TQString &uri, const TQStringList& filters = TQStringList() );
625 
632  TQPtrListIterator<KURIFilterPlugin> pluginsIterator() const;
633 
640  TQStringList pluginNames() const;
641 
642 protected:
643 
651  KURIFilter();
652 
659  void loadPlugins();
660 
661 private:
662  static KURIFilter *s_self;
663  KURIFilterPluginList m_lstPlugins;
664  KURIFilterPrivate *d;
665 };
666 
667 #endif
KURIFilterData::operator=
KURIFilterData & operator=(const KURL &url)
Overloaded assigenment operator.
Definition: kurifilter.h:304
KURIFilterPluginList
A list of filter plugins.
Definition: kurifilter.h:463
KURIFilterData::KURIFilterData
KURIFilterData()
Default constructor.
Definition: kurifilter.h:107
KURIFilterPlugin::name
virtual TQString name() const
Returns the filter's name.
Definition: kurifilter.h:385
KURIFilterData::uriType
URITypes uriType() const
Returns the URI type.
Definition: kurifilter.h:178
KURIFilterData::hasBeenFiltered
KDE_DEPRECATED bool hasBeenFiltered() const
This method has been deprecated and will always return true.
Definition: kurifilter.h:145
KURIFilterData::uri
KURL uri() const
Returns the filtered or the original URL.
Definition: kurifilter.h:157
KURIFilterData::errorMsg
TQString errorMsg() const
Returns an error message.
Definition: kurifilter.h:169
KURIFilterData::operator=
KURIFilterData & operator=(const TQString &url)
Overloaded assigenment operator.
Definition: kurifilter.h:314
KURIFilterPlugin::setURIType
void setURIType(KURIFilterData &data, KURIFilterData::URITypes type) const
Sets the URI type in data to type.
Definition: kurifilter.h:439
KURIFilterPlugin::setErrorMsg
void setErrorMsg(KURIFilterData &data, const TQString &errmsg) const
Sets the error message in data to errormsg.
Definition: kurifilter.h:432
KURIFilterPlugin::configModule
virtual TDECModule * configModule(TQWidget *, const char *) const
Creates a configuration module for the filter.
Definition: kurifilter.h:413
KURIFilterData
A basic message object used for exchanging filtering information between the filter plugins and the a...
Definition: kurifilter.h:79
KURIFilterPlugin::priority
virtual double priority() const
Returns the filter's priority.
Definition: kurifilter.h:395
KURIFilter
Manages the filtering of URIs.
Definition: kurifilter.h:548
KURIFilterData::checkForExecutables
bool checkForExecutables() const
Definition: kurifilter.h:288
KURIFilterData::setData
void setData(const KURL &url)
Same as above except the argument is a URL.
Definition: kurifilter.h:200
KURIFilterPlugin::configName
virtual TQString configName() const
Returns the name of the configuration module for the filter.
Definition: kurifilter.h:420
KURIFilterData::KURIFilterData
KURIFilterData(const TQString &url)
Creates a URIFilterData object from the given string.
Definition: kurifilter.h:121
KURIFilterData::URITypes
URITypes
Describes the type of the URI that was filtered.
Definition: kurifilter.h:100
KURIFilterPlugin
Base class for URI filter plugins.
Definition: kurifilter.h:363
KURIFilterData::KURIFilterData
KURIFilterData(const KURL &url)
Creates a URIFilterData object from the given URL.
Definition: kurifilter.h:114
KURIFilterData::setData
void setData(const TQString &url)
Sets the URL to be filtered.
Definition: kurifilter.h:189

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • 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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.8.8
This website is maintained by Timothy Pearson.