[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kopete/libkopete
From:       Ladislav Strojil <Ladislav () Strojil ! cz>
Date:       2003-07-23 20:42:44
[Download RAW message or body]

CVS commit by strojil: 

Fix for the previous "fix"
Only add prefix if it is not already there (is there a better way? negative \
lookbehind?)


  M +3 -2      kopetemessage.cpp   1.118


--- kdenonbeta/kopete/libkopete/kopetemessage.cpp  #1.117:1.118
@@ -480,6 +480,7 @@ QString KopeteMessage::parseLinks( const
 
         //Replace http/https/ftp links
-        result.replace( QRegExp( \
QString::fromLatin1("\\b((http://\\w|ftp://\\w|https://\\w)[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") \
                ), QString::fromLatin1("<a href=\"\\1\">\\1</a>" ) );
-        result.replace( QRegExp( \
QString::fromLatin1("\\b((www\\.)[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") ), \
QString::fromLatin1("<a href=\"http://\\1\">\\1</a>" ) ); +        result.replace( \
QRegExp( QString::fromLatin1("\\b((http(s?)://\\w|ftp://\\w)[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") \
), QString::fromLatin1("<a href=\"\\1\">\\1</a>" ) ); +        result.replace( \
QRegExp( QString::fromLatin1("^(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") ), \
QString::fromLatin1("<a href=\"http://\\1\">\\1</a>" ) ); +        result.replace( \
QRegExp( QString::fromLatin1("([^/])\\b(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") \
), QString::fromLatin1("\\1<a href=\"http://\\2\">\\2</a>" ) );  
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic