• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

KUriFilterData Class Reference

#include <kurifilter.h>

List of all members.


Detailed Description

A basic message object used for exchanging filtering information between the filter plugins and the application requesting the filtering service.

Use this object if you require a more detailed information about the URI you want to filter. Any application can create an instance of this class and send it to KUriFilter to have the plugins fill out all possible information about the URI.

Example

   QString text = "kde.org";
   KUriFilterData d = text;
   bool filtered = KUriFilter::self()->filter( d );
   cout << "URL: " << text.toLatin1() << endl
        << "Filtered URL: " << d.uri().url().toLatin1() << endl
        << "URI Type: " << d.uriType() << endl
        << "Was Filtered: " << filtered << endl;

The above code should yield the following output:

   URI: kde.org
   Filtered URI: http://kde.org
   URI Type: 0            <== means NET_PROTOCOL
   Was Filtered: 1        <== means the URL was successfully filtered

A message object for exchanging filtering URI info.

Author:
Dawit Alemayehu <adawit at kde.org>

Definition at line 77 of file kurifilter.h.


Public Types

enum  UriTypes {
  NetProtocol = 0, LocalFile, LocalDir, Executable,
  Help, Shell, Blocked, Error,
  Unknown
}

Public Member Functions

QString absolutePath () const
QString argsAndOptions () const
bool checkForExecutables () const
QString errorMsg () const
bool hasAbsolutePath () const
bool hasArgsAndOptions () const
QString iconName ()
 KUriFilterData (const KUriFilterData &data)
 KUriFilterData (const QString &url)
 KUriFilterData (const KUrl &url)
 KUriFilterData ()
KUriFilterData & operator= (const QString &url)
KUriFilterData & operator= (const KUrl &url)
bool setAbsolutePath (const QString &abs_path)
void setCheckForExecutables (bool check)
void setData (const QString &url)
void setData (const KUrl &url)
QString typedString () const
KUrl uri () const
UriTypes uriType () const
 ~KUriFilterData ()

Member Enumeration Documentation

enum KUriFilterData::UriTypes

Describes the type of the URI that was filtered.

Here is a brief description of the types:

  • NetProtocol - Any network protocol: http, ftp, nttp, pop3, etc...
  • LocalFile - A local file whose executable flag is not set
  • LocalDir - A local directory
  • Executable - A local file whose executable flag is set
  • Help - A man or info page
  • Shell - A shell executable (ex: echo "Test..." >> ~/testfile)
  • Blocked - A URI that should be blocked/filtered (ex: ad filtering)
  • Error - An incorrect URI (ex: "~johndoe" when user johndoe does not exist in that system )
  • Unknown - A URI that is not identified. Default value when a KUriFilterData is first created.
Enumerator:
NetProtocol 
LocalFile 
LocalDir 
Executable 
Help 
Shell 
Blocked 
Error 
Unknown 

Definition at line 98 of file kurifilter.h.


Constructor & Destructor Documentation

KUriFilterData::KUriFilterData (  ) 

Default constructor.

Creates a UriFilterData object.

Definition at line 80 of file kurifilter.cpp.

KUriFilterData::KUriFilterData ( const KUrl &  url  )  [explicit]

Creates a UriFilterData object from the given URL.

Parameters:
url is the URL to be filtered.

Definition at line 85 of file kurifilter.cpp.

KUriFilterData::KUriFilterData ( const QString &  url  )  [explicit]

Creates a UriFilterData object from the given string.

Parameters:
url is the string to be filtered.

Definition at line 90 of file kurifilter.cpp.

KUriFilterData::KUriFilterData ( const KUriFilterData &  data  ) 

Copy constructor.

Creates a UriFilterData object from another URI filter data object.

Parameters:
data the uri filter data to be copied.

Definition at line 97 of file kurifilter.cpp.

KUriFilterData::~KUriFilterData (  ) 

Destructor.

Definition at line 102 of file kurifilter.cpp.


Member Function Documentation

QString KUriFilterData::absolutePath (  )  const

Returns the absolute path if one has already been set.

Returns:
the absolute path, or QString()
See also:
hasAbsolutePath()

Definition at line 144 of file kurifilter.cpp.

QString KUriFilterData::argsAndOptions (  )  const

Returns the command line options and arguments for a local resource when present.

Returns:
options and arguments when present, otherwise QString()

Definition at line 154 of file kurifilter.cpp.

bool KUriFilterData::checkForExecutables (  )  const

Returns:
true if the filters should attempt to check whether the supplied uri is an executable.

False otherwise.

Definition at line 222 of file kurifilter.cpp.

QString KUriFilterData::errorMsg (  )  const

Returns an error message.

This functions returns the error message set by the plugin whenever the uri type is set to KUriFilterData::ERROR. Otherwise, it returns a QString().

Returns:
the error message or a NULL when there is none.

Definition at line 112 of file kurifilter.cpp.

bool KUriFilterData::hasAbsolutePath (  )  const

Checks whether the supplied data had an absolute path.

Returns:
true if the supplied data has an absolute path
See also:
absolutePath()

Definition at line 149 of file kurifilter.cpp.

bool KUriFilterData::hasArgsAndOptions (  )  const

Checks whether the current data is a local resource with command line options and arguments.

Returns:
true if the current data has command line options and arguments

Definition at line 159 of file kurifilter.cpp.

QString KUriFilterData::iconName (  ) 

Returns the name of the icon that matches the current filtered URL.

NOTE that this function will return a NULL string by default and when no associated icon is found.

Returns:
the name of the icon associated with the resource, or QString() if not found

Definition at line 164 of file kurifilter.cpp.

KUriFilterData & KUriFilterData::operator= ( const QString &  url  ) 

Overloaded assigenment operator.

This function allows you to easily assign a QString to a KUriFilterData object.

Returns:
an instance of a KUriFilterData object.

Definition at line 238 of file kurifilter.cpp.

KUriFilterData & KUriFilterData::operator= ( const KUrl &  url  ) 

Overloaded assigenment operator.

This function allows you to easily assign a KUrl to a KUriFilterData object.

Returns:
an instance of a KUriFilterData object.

Definition at line 232 of file kurifilter.cpp.

bool KUriFilterData::setAbsolutePath ( const QString &  abs_path  ) 

Sets the absolute path to be used whenever the supplied data is a relative local URL.

NOTE: This function should only be used for local resources, i.e. the "file:/" protocol. It is useful for specifying the absolute path in cases where the actual URL might be relative. meta object. If deriving the path from a KUrl, make sure you set the argument for this function to the result of calling path () instead of url ().

Parameters:
abs_path the abolute path to the local resource.
Returns:
true if absolute path is successfully set. Otherwise, false.

Definition at line 132 of file kurifilter.cpp.

void KUriFilterData::setCheckForExecutables ( bool  check  ) 

Check whether the provided uri is executable or not.

Setting this to false ensures that typing the name of an executable does not start that application. This is useful in the location bar of a browser. The default value is true.

Definition at line 217 of file kurifilter.cpp.

void KUriFilterData::setData ( const QString &  url  ) 

Sets the URL to be filtered.

Use this function to set the string to be filtered when you construct an empty filter object.

Parameters:
url the string to be filtered.

Definition at line 127 of file kurifilter.cpp.

void KUriFilterData::setData ( const KUrl &  url  ) 

Same as above except the argument is a URL.

Use this function to set the string to be filtered when you construct an empty filter object.

Parameters:
url the URL to be filtered.

Definition at line 122 of file kurifilter.cpp.

QString KUriFilterData::typedString (  )  const

Returns:
the string as typed by the user, before any URL processing is done

Definition at line 227 of file kurifilter.cpp.

KUrl KUriFilterData::uri (  )  const

Returns the filtered or the original URL.

This function returns the filtered url if one of the plugins successfully filtered the original URL. Otherwise, it returns the original URL. See hasBeenFiltered() and

Returns:
the filtered or original url.

Definition at line 107 of file kurifilter.cpp.

KUriFilterData::UriTypes KUriFilterData::uriType (  )  const

Returns the URI type.

This method always returns KUriFilterData::UNKNOWN if the given URL was not filtered.

Returns:
the type of the URI

Definition at line 117 of file kurifilter.cpp.


The documentation for this class was generated from the following files:
  • kurifilter.h
  • kurifilter.cpp

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal