kpimutils
linklocator.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00030 #ifndef KPIMUTILS_LINKLOCATOR_H_
00031 #define KPIMUTILS_LINKLOCATOR_H_
00032
00033 #include "kpimutils_export.h"
00034
00035 #include <QtCore/QString>
00036 #include <QtCore/QMap>
00037
00038 namespace KPIMUtils {
00039
00046 class KPIMUTILS_EXPORT LinkLocator
00047 {
00048 public:
00056 explicit LinkLocator( const QString &text, int pos = 0 );
00057
00061 ~LinkLocator();
00062
00072 void setMaxUrlLen( int length );
00073
00079 int maxUrlLen() const;
00080
00091 void setMaxAddressLen( int length );
00092
00097 int maxAddressLen() const;
00098
00107 QString getUrl();
00108
00119 QString getEmailAddress();
00120
00141 static QString convertToHtml( const QString &plainText, int flags = 0,
00142 int maxUrlLen = 4096, int maxAddressLen = 255 );
00143
00144 static const int PreserveSpaces = 0x01;
00145 static const int ReplaceSmileys = 0x02;
00146 static const int IgnoreUrls = 0x04;
00147 static const int HighlightText = 0x08;
00148
00154 static QString pngToDataUrl( const QString & iconPath );
00155
00156 protected:
00160 QString mText;
00161
00165 int mPos;
00166
00167 bool atUrl() const;
00168 bool isEmptyUrl( const QString &url ) const;
00169
00176 QString getEmoticon();
00177
00182 QString highlightedText();
00183
00184 private:
00185 private:
00186
00187 class Private;
00188 Private *const d;
00189
00190
00194 static QMap<QString, QString> *s_smileyEmoticonNameMap;
00195
00199 static QMap<QString, QString> *s_smileyEmoticonHTMLCache;
00200
00204 static void cleanupLinkLocator();
00205 };
00206
00207 }
00208
00209 #endif