kpimutils
linklocator.cpp
Go to the documentation of this file.
154 // HACK: This is actually against the RFC. However, most people don't properly escape the URL in
160 wordBoundaries << QLatin1Char('.') << QLatin1Char(',') << QLatin1Char(':') << QLatin1Char('!') << QLatin1Char('?') << QLatin1Char(')') << QLatin1Char('>');
322 while ( locator.mPos < locator.mText.length() && locator.mText[locator.mPos] == QLatin1Char(' ') ) {
352 result += QLatin1String("<br />\n"); // Keep the \n, so apps can figure out the quoting levels correctly.
381 result += QLatin1String("<a href=\"") + hyperlink + QLatin1String("\">") + Qt::escape( str ) + QLatin1String("</a>");
397 result += QLatin1String("<a href=\"mailto:") + str + QLatin1String("\">") + str + QLatin1String("</a>");
416 exclude << QLatin1String("(c)") << QLatin1String("(C)") << QLatin1String(">:-(") << QLatin1String(">:(") << QLatin1String("(B)") << QLatin1String("(b)") << QLatin1String("(P)") << QLatin1String("(p)");
417 exclude << QLatin1String("(O)") << QLatin1String("(o)") << QLatin1String("(D)") << QLatin1String("(d)") << QLatin1String("(E)") << QLatin1String("(e)") << QLatin1String("(K)")<< QLatin1String("(k)");
418 exclude << QLatin1String("(I)") << QLatin1String("(i)") << QLatin1String("(L)") << QLatin1String("(l)") << QLatin1String("(8)") << QLatin1String("(T)") << QLatin1String("(t)") << QLatin1String("(G)");
419 exclude << QLatin1String("(g)") << QLatin1String("(F)") << QLatin1String("(f)") << QLatin1String("(H)");
420 exclude << QLatin1String("8)") << QLatin1String("(N)") << QLatin1String("(n)") << QLatin1String("(Y)") << QLatin1String("(y)" )<< QLatin1String("(U)") << QLatin1String("(u)") << QLatin1String("(W)") << QLatin1String("(w)");
446 return QString::fromLatin1( "data:image/png;base64,%1" ).arg( QLatin1String(ba.toBase64().constData()) );
457 if ( ch != QLatin1Char('/') && ch != QLatin1Char('*') && ch != QLatin1Char('_') && ch != QLatin1Char('-') ) {
462 QRegExp( QString::fromLatin1( "\\%1((\\w+)([\\s-']\\w+)*( ?[,.:\\?!;])?)\\%2" ).arg( ch ).arg( ch ) );
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
static QString pngToDataUrl(const QString &iconPath)
Embeds the given PNG image into a data URL.
Definition: linklocator.cpp:433
QString cap(int nth) const
QString & append(QChar ch)
void truncate(int position)
void setMinimal(bool minimal)
QString mText
The plaintext string being scanned for URLs and email addresses.
Definition: linklocator.h:162
QString getUrl()
Attempts to grab a URL starting at the current scan position.
Definition: linklocator.cpp:96
void chop(int n)
void clear()
int matchedLength() const
int indexIn(const QString &str, int offset, CaretMode caretMode) const
void setMaxAddressLen(int length)
Sets the maximum length of email addresses that will be matched by getEmailAddress().
Definition: linklocator.cpp:86
QString highlightedText()
Highlight text according to bold, /italic/ and underlined markup.
Definition: linklocator.cpp:449
bool isEmpty() const
const char * constData() const
QByteArray readAll()
LinkLocator assists in identifying sections of text that can usefully be converted in hyperlinks in H...
Definition: linklocator.h:48
void setMaxUrlLen(int length)
Sets the maximum length of URLs that will be matched by getUrl().
Definition: linklocator.cpp:76
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
bool isNull() const
bool contains(const T &value) const
char toLatin1() const
virtual void close()
QString mid(int position, int n) const
QString escape(const QString &plain)
int count() const
const QChar at(int position) const
This file is part of the KDEPIM Utilities library and provides the LinkLocator class.
int length() const
void reserve(int size)
QString left(int n) const
QString fromLatin1(const char *str, int size)
int maxUrlLen() const
Returns the current limit on the maximum length of a URL.
Definition: linklocator.cpp:81
QByteArray toBase64() const
static QString convertToHtml(const QString &plainText, int flags=0, int maxUrlLen=4096, int maxAddressLen=255)
Converts plaintext into html.
Definition: linklocator.cpp:291
int maxAddressLen() const
Returns the current limit on the maximum length of an email address.
Definition: linklocator.cpp:91
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.