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

kio/kio

kurifilter.h
00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (C) 2000-2001,2003 Dawit Alemayehu <adawit at kde.org>
00004  *
00005  *  Original author
00006  *  Copyright (C) 2000 Yves Arrouye <yves@realnames.com>
00007  *
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU Library General Public
00011  *  License as published by the Free Software Foundation; either
00012  *  version 2 of the License, or (at your option) any later version.
00013  *
00014  *  This library is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  *  Library General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU Library General Public License
00020  *  along with this library; see the file COPYING.LIB.  If not, write to
00021  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00022  *  Boston, MA 02110-1301, USA.
00023  **/
00024 
00025 #ifndef __kurifilter_h__
00026 #define __kurifilter_h__
00027 
00028 #include <tqptrlist.h>
00029 #include <tqobject.h>
00030 #include <tqstringlist.h>
00031 
00032 #include <kurl.h>
00033 
00034 #ifdef Q_OS_WIN
00035 #undef ERROR
00036 #endif
00037 
00038 class KURIFilterPrivate;
00039 class KURIFilterDataPrivate;
00040 
00041 class KCModule;
00042 
00078 class KIO_EXPORT KURIFilterData
00079 {
00080 friend class KURIFilterPlugin;
00081 
00082 public:
00099     enum URITypes { NET_PROTOCOL=0, LOCAL_FILE, LOCAL_DIR, EXECUTABLE, HELP, SHELL, BLOCKED, ERROR, UNKNOWN };
00100 
00106     KURIFilterData() { init(); }
00107 
00113     KURIFilterData( const KURL& url ) { init( url); }
00114 
00120     KURIFilterData( const TQString& url ) { init( url ); }
00121 
00130     KURIFilterData( const KURIFilterData& data);
00131 
00135     ~KURIFilterData();
00136 
00144     KDE_DEPRECATED bool hasBeenFiltered() const { return true; }
00145 
00156     KURL uri() const { return m_pURI; }
00157 
00168     TQString errorMsg() const { return m_strErrMsg; }
00169 
00177     URITypes uriType() const { return m_iType; }
00178 
00188     void setData( const TQString& url ) { reinit( url ); }
00189 
00199     void setData( const KURL& url ) { reinit( url ); }
00200 
00215     bool setAbsolutePath( const TQString& abs_path );
00216 
00222     TQString absolutePath() const;
00223 
00229     bool hasAbsolutePath() const;
00230 
00237     TQString argsAndOptions() const;
00238 
00244     bool hasArgsAndOptions() const;
00245 
00257     TQString iconName();
00258 
00269     void setCheckForExecutables (bool check);
00270 
00277     bool checkForExecutables() const { return m_bCheckForExecutables; }
00278 
00283     TQString typedString() const;
00284 
00293     KURIFilterData& operator=( const KURL& url ) { reinit( url ); return *this; }
00294 
00303     KURIFilterData& operator=( const TQString& url ) { reinit( url ); return *this; }
00304 
00305 protected:
00306 
00311     void init( const KURL& url);
00312 
00317     void init( const TQString& url = TQString::null );
00318 
00319 private:
00320 
00321     // BC hack to avoid leaking KURIFilterDataPrivate objects.
00322     // setData() and operator= used to call init() without deleting `d'
00323     void reinit(const KURL& url);
00324     void reinit(const TQString& url = TQString::null);
00325 
00326     bool m_bCheckForExecutables;
00327     bool m_bChanged;
00328 
00329     TQString m_strErrMsg;
00330     TQString m_strIconName;
00331 
00332     KURL m_pURI;
00333     URITypes m_iType;
00334     KURIFilterDataPrivate *d;
00335 };
00336 
00337 
00350 class KIO_EXPORT KURIFilterPlugin : public TQObject
00351 {
00352     Q_OBJECT
00353     TQ_OBJECT
00354 
00355 public:
00356 
00365     KURIFilterPlugin( TQObject *parent = 0, const char *name = 0, double pri = 1.0 );
00366 
00372     virtual TQString name() const { return m_strName; }
00373 
00382     virtual double priority() const { return m_dblPriority; }
00383 
00390     virtual bool filterURI( KURIFilterData& data ) const = 0;
00391 
00400     virtual KCModule *configModule( TQWidget*, const char* ) const { return 0; }
00401 
00407     virtual TQString configName() const { return name(); }
00408 
00409 protected:
00410 
00414     void setFilteredURI ( KURIFilterData& data, const KURL& uri ) const;
00415 
00419     void setErrorMsg ( KURIFilterData& data, const TQString& errmsg ) const {
00420         data.m_strErrMsg = errmsg;
00421     }
00422 
00426     void setURIType ( KURIFilterData& data, KURIFilterData::URITypes type) const {
00427         data.m_iType = type;
00428         data.m_bChanged = true;
00429     }
00430 
00435     void setArguments( KURIFilterData& data, const TQString& args ) const;
00436 
00437     TQString m_strName;
00438     double m_dblPriority;
00439 
00440 protected:
00441     virtual void virtual_hook( int id, void* data );
00442 private:
00443     class KURIFilterPluginPrivate *d;
00444 };
00445 
00446 
00450 class KIO_EXPORT KURIFilterPluginList : public TQPtrList<KURIFilterPlugin>
00451 {
00452 public:
00453     virtual int compareItems(Item a, Item b)
00454     {
00455       double diff = ((KURIFilterPlugin *) a)->priority() - ((KURIFilterPlugin *) b)->priority();
00456       return diff < 0 ? -1 : (diff > 0 ? 1 : 0);
00457     }
00458 
00459 private:
00460     KURIFilterPrivate *d;
00461 
00462 };
00463 
00535 class KIO_EXPORT KURIFilter
00536 {
00537 public:
00541     ~KURIFilter ();
00542 
00546     static KURIFilter* self();
00547 
00559     bool filterURI( KURIFilterData& data, const TQStringList& filters = TQStringList() );
00560 
00572     bool filterURI( KURL &uri, const TQStringList& filters = TQStringList() );
00573 
00585     bool filterURI( TQString &uri, const TQStringList& filters = TQStringList() );
00586 
00598     KURL filteredURI( const KURL &uri, const TQStringList& filters = TQStringList() );
00599 
00611     TQString filteredURI( const TQString &uri, const TQStringList& filters = TQStringList() );
00612 
00619     TQPtrListIterator<KURIFilterPlugin> pluginsIterator() const;
00620 
00627     TQStringList pluginNames() const;
00628 
00629 protected:
00630 
00638     KURIFilter();
00639 
00646     void loadPlugins();
00647 
00648 private:
00649     static KURIFilter *s_self;
00650     KURIFilterPluginList m_lstPlugins;
00651     KURIFilterPrivate *d;
00652 };
00653 
00654 #endif

kio/kio

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

kio/kio

Skip menu "kio/kio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kio by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |