|
|
This is a basic message object used for exchanging filtering information between the filter plugins and the application whenever the application requires more information about the URI than just a filtered version of it. Any application can create an instance of this class and send it to KURIFilter to have the filter plugins fill the necessary information.
QString text = "kde.org"; KURIFilterData d = text; bool filtered = KURIFilter::self()->filter( d ); if( filtered ) print ( "URI: %s\n"Filtered URI: %s\n URI Type: %i\n"Was Filtered: %i" text.latin1(), d.uri().url().latin1(), d.uriType(), filtered ); |
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 |
enum URITypes { NET_PROTOCOL=0, LOCAL_FILE, LOCAL_DIR, EXECUTABLE, HELP, SHELL, BLOCKED, ERROR, UNKNOWN } | URITypes |
Describes the type of URI to be filtered.
This enumerator prvoides the return value for uriType. A breif description for each value:
KURIFilterData ()
| KURIFilterData |
Default constructor.
Creates a URIFilterData object.
KURIFilterData ( const KURL& url )
| KURIFilterData |
Creates a URIFilterData object from the given URL.
Parameters:
url | is the URL to be filtered. |
KURIFilterData ( const QString& url )
| KURIFilterData |
Creates a URIFilterData object from the given string.
Parameters:
url | is the string to be filtered. |
KURIFilterData ( const KURIFilterData& )
| KURIFilterData |
Copy constructor.
Creates a URIFilterData object from another URI filter data object.
Parameters:
data | the uri filter data to be copied. |
~KURIFilterData ()
| ~KURIFilterData |
Destructor.
bool hasBeenFiltered ()
| hasBeenFiltered |
[const]
This method has been deprecated and will always return TRUE. You should instead use the result from the KURIFilter::filterURI() calls.
KURL uri ()
| uri |
[const]
Returns the filtered or the original URL.
This function returns the filtered url if one of the plugins sucessfully filtered the original URL. Otherwise, it returns the original URL. See hasBeenFiltered() and
Returns: the filtered or original url.
QString errorMsg ()
| 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::null.
Returns: the error message or a NULL when there is none.
URITypes uriType ()
| uriType |
[const]
Returns the URI type.
This method always returns KURIFilterData::UNKNOWN if the given URL was not filtered.
void setData ( const QString& url )
| setData |
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. |
void setData ( const KURL& url )
| setData |
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. |
bool setAbsolutePath ( const QString& )
| setAbsolutePath |
Sets the absolute path to be used whenever the supplied data is a relative local URL.
NOTE: This function works only for a local resource and expects the absolute path to the relative URL set in this meta object. If you are extracting the absolute path from a KURL object, make sure you always set the argument below using KURL::path() instead of KURL::url() so that "file:/" would not be appended! Otherwise, the filter might not be able to make correct determination whether the relative URL locally exists!
Parameters:
abs_path | the abolute path to the local resource. |
Returns: true if absolute path is successfully set. Otherwise, false.
QString absolutePath ()
| absolutePath |
[const]
Returns the absolute path if one has already been set.
bool hasAbsolutePath ()
| hasAbsolutePath |
[const]
Returns true if the supplied data has an absolute path.
QString argsAndOptions ()
| argsAndOptions |
[const]
Returns the command line options and arguments for a local resource when present.
Returns: options and arguments when present, otherwise QString::null
bool hasArgsAndOptions ()
| hasArgsAndOptions |
[const]
Returns true if the current data is a local resource with command line options and arguments.
QString iconName ()
| 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
KURIFilterData& operator= ( const KURL& url )
| operator= |
Overloaded assigenment operator.
This function allows you to easily assign a KURL to a KURIFilterData object.
Returns: an instance of a KURIFilterData object.
KURIFilterData& operator= ( const QString& url )
| operator= |
Overloaded assigenment operator.
This function allows you to easily assign a QString to a KURIFilterData object.
Returns: an instance of a KURIFilterData object.
void init ( const KURL& url = QString::null )
| init |
[protected]
Initializes the KURIFilterData on construction.
Generated by: dfaure on kde.faure.org on Thu Jan 17 22:16:53 2002, using kdoc 2.0a53. |