libkdepim
linklocator.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LINKLOCATOR_H_INCLUDED
00024 #define LINKLOCATOR_H_INCLUDED
00025
00026 #include <qstring.h>
00027 #include <qmap.h>
00028
00029 #include <kdepimmacros.h>
00030
00041 class KDE_EXPORT LinkLocator
00042 {
00043 public:
00052 LinkLocator(const QString& text, int pos = 0);
00053
00064 void setMaxUrlLen(int length);
00065
00071 int maxUrlLen() const;
00072
00083 void setMaxAddressLen(int length);
00084
00091 int maxAddressLen() const;
00092
00101 QString getUrl();
00102
00114 QString getEmailAddress();
00115
00139 static QString convertToHtml(const QString& plainText, int flags = 0,
00140 int maxUrlLen = 4096, int maxAddressLen = 255);
00141
00142 static const int PreserveSpaces = 0x01;
00143 static const int ReplaceSmileys = 0x02;
00144 static const int IgnoreUrls = 0x04;
00145 static const int HighlightText = 0x08;
00146
00151 static QString pngToDataUrl( const QString & iconPath );
00152
00153 protected:
00157 QString mText;
00161 int mPos;
00162
00163 private:
00164 bool atUrl() const;
00165 bool isEmptyUrl(const QString& url);
00166
00173 QString getEmoticon();
00178 QString highlightedText();
00179
00180 int mMaxUrlLen;
00181 int mMaxAddressLen;
00182
00183
00184 static QMap<QString, QString> *s_smileyEmoticonNameMap;
00185
00186 static QMap<QString, QString> *s_smileyEmoticonHTMLCache;
00187 };
00188
00189 #endif // LINKLOCATOR_H_INCLUDED
00190
|