libkdepim
LinkLocator Class Reference
#include <linklocator.h>
Detailed Description
LinkLocator assists in identifying sections of text that can usefully be converted in hyperlinks in html.Identifies URLs and email addresses embedded in plaintext.It is intended to be used in two ways: either by calling convertToHtml() to convert a plaintext string into html, or to be derived from where more control is needed.
- Author:
- Dave Corrie <kde@davecorrie.com>
Definition at line 41 of file linklocator.h.
Public Member Functions | |
LinkLocator (const QString &text, int pos=0) | |
void | setMaxUrlLen (int length) |
int | maxUrlLen () const |
void | setMaxAddressLen (int length) |
int | maxAddressLen () const |
QString | getUrl () |
QString | getEmailAddress () |
Static Public Member Functions | |
static QString | convertToHtml (const QString &plainText, int flags=0, int maxUrlLen=4096, int maxAddressLen=255) |
static QString | pngToDataUrl (const QString &iconPath) |
Static Public Attributes | |
static const int | PreserveSpaces = 0x01 |
static const int | ReplaceSmileys = 0x02 |
static const int | IgnoreUrls = 0x04 |
static const int | HighlightText = 0x08 |
Protected Attributes | |
QString | mText |
int | mPos |
Constructor & Destructor Documentation
|
Constructs a LinkLocator that will search a plaintext string from a given starting point.
Definition at line 43 of file linklocator.cpp. |
Member Function Documentation
|
Converts plaintext into html. The following characters are converted to HTML entities: & " < >. Newlines are also preserved.
Definition at line 225 of file linklocator.cpp. |
|
Attempts to grab an email address. If there is an @ symbol at the current scan position, then the text will be searched both backwards and forwards to find the email address. If there is no @ symbol at the current scan position, an empty string is returned. If an address is found, then the current scan position is set to the index of the last character in the address.
Definition at line 168 of file linklocator.cpp. |
|
Attempts to grab a URL starting at the current scan position. If there is no URL at the current scan position, then an empty string is returned. If a URL is found, the current scan position is set to the index of the last character in the URL.
Definition at line 87 of file linklocator.cpp. |
|
Definition at line 82 of file linklocator.cpp. |
|
Definition at line 72 of file linklocator.cpp. |
|
Embed the given PNG image into a data URL.
Definition at line 353 of file linklocator.cpp. |
|
Sets the maximum length of email addresses that will be matched by getEmailAddress(). By default, this is set to 255 characters. The reason for this limit is that there may be possible security implications in handling addresses of unlimited length.
Definition at line 77 of file linklocator.cpp. |
|
Sets the maximum length of URLs that will be matched by getUrl(). By default, this is set to 4096 characters. The reason for this limit is that there may be possible security implications in handling URLs of unlimited length.
Definition at line 67 of file linklocator.cpp. |
Member Data Documentation
|
The current scan position.
Definition at line 161 of file linklocator.h. |
|
The plaintext string being scanned for URLs and email addresses.
Definition at line 157 of file linklocator.h. |
The documentation for this class was generated from the following files: