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
00050 class KPIMUTILS_EXPORT LinkLocator
00051 {
00052 public:
00060 explicit LinkLocator( const QString &text, int pos = 0 );
00061
00065 ~LinkLocator();
00066
00076 void setMaxUrlLen( int length );
00077
00083 int maxUrlLen() const;
00084
00095 void setMaxAddressLen( int length );
00096
00101 int maxAddressLen() const;
00102
00111 QString getUrl();
00112
00123 QString getEmailAddress();
00124
00145 static QString convertToHtml( const QString &plainText, int flags = 0,
00146 int maxUrlLen = 4096, int maxAddressLen = 255 );
00147
00148 static const int PreserveSpaces = 0x01;
00149 static const int ReplaceSmileys = 0x02;
00150 static const int IgnoreUrls = 0x04;
00151 static const int HighlightText = 0x08;
00152
00158 static QString pngToDataUrl( const QString & iconPath );
00159
00160 protected:
00164 QString mText;
00165
00169 int mPos;
00170
00171 bool atUrl() const;
00172 bool isEmptyUrl( const QString &url ) const;
00173
00178 QString highlightedText();
00179
00180 private:
00181 private:
00182
00183 class Private;
00184 Private *const d;
00185
00186
00187 };
00188
00189 }
00190
00191 #endif