unsigned int i;
DOM::Element tmpelm;
- QString linkstr,linkstr2,linkurl,tmpstr;
+ QString linkstr,linkstr2,linkurl,addstr,tmpstr;
if( m_colonstr == QString::null ){
m_colonstr = utf8ToUnicode( KITAUTF8_COLON );
DOM::Element namenode;
linkurl = QString::null;
- /* parse name strings */
+ /* parse name & address strings */
parseBODYdatText(PARSEMODE_TEXT,str_name,linkstr);
+ if( str_address != QString::null ) parseBODYdatText( PARSEMODE_TEXT, str_address, addstr );
+ else addstr = QString::null;
tmpstr = " " + m_colonnamestr;
switch( mode ){
}
/* show name with mail address, or show name only */
- if ( showMailAddress || str_address == QString::null ){
+ if ( showMailAddress || addstr == QString::null ){
const QChar *chpt = linkstr.unicode();
unsigned int length = linkstr.length();
case PARSEMODE_DOM:
- if ( showMailAddress && str_address != QString::null ) {
- tmpstr = QString( " [" ) + str_address + "]";
+ if ( showMailAddress && addstr != QString::null ) {
+ tmpstr = QString( " [" ) + addstr + "]";
namenode.appendChild( hdoc.createTextNode( tmpstr ) );
}
case PARSEMODE_HTML:
case PARSEMODE_TEXT:
- if ( showMailAddress && str_address != QString::null ) {
- tmpstr = QString( " [" ) + str_address + "]";
+ if ( showMailAddress && addstr != QString::null ) {
+ tmpstr = QString( " [" ) + addstr + "]";
titletext += tmpstr;
}
break;
}
- } /* if ( showMailAddress || str_address == QString::null ) */
+ } /* if ( showMailAddress || addstr == QString::null ) */
/* don't show mail address (i.e. showMailAddress == FALSE) */
else {
- linkurl = QString( "mailto:" ) + str_address;
+ linkurl = QString( "mailto:" ) + addstr;
switch(mode){
tmpelm = namenode.appendChild( hdoc.createElement( "A" ) );
{
tmpelm.setAttribute( "href", linkurl );
- tmpelm.setAttribute( "title", str_address );
+ tmpelm.setAttribute( "title", addstr );
tmpelm.appendChild( hdoc.createTextNode( linkstr ) );
}
break;
case PARSEMODE_HTML:
titletext += "<a href=\"" + linkurl;
- titletext += " title=\"" + str_address + "\">";
+ titletext += " title=\"" + addstr + "\">";
titletext += linkstr;
titletext +="</a>";
linkstr = QString::null;
linkurl = QString::null;
-
- int i = isEqual( cdat , "http://" );
- if(!i) i = isEqual( cdat , "ttp://" );
- if(!i) i = isEqual( cdat , "tp://" );
- if(!i) return FALSE;
- linkurl = "http://";
- pos = 0;
+ QString retlinkstr = QString::null;
+ QString prefix = QString::null;
- while ( cdat[ pos ] != '/' && pos < length ) linkstr += cdat[ pos++ ];
- linkstr += "//"; pos += 2;
+ if( isEqual( cdat , "http://" ) ) prefix = "http://";
+ else if( isEqual( cdat , "ttp://" ) ) prefix = "ttp://";
+ else if( isEqual( cdat , "tp://" ) ) prefix = "tp://";
+ if( prefix == QString::null ) return FALSE;
+
+ pos = prefix.length();
while ( cdat[ pos ] >= '!' && cdat[ pos ] <= '~' &&
cdat[ pos ] != ' ' && cdat[ pos ] != '<' && cdat[ pos ] != '>'
&& pos < length ){
- linkurl += cdat[ pos ];
- linkstr += cdat[ pos++ ];
+ retlinkstr += cdat[ pos++ ];
}
if ( pos > length ) return FALSE;
-
+
+ if( retlinkstr != QString::null ) parseBODYdatText( PARSEMODE_TEXT, retlinkstr, linkstr );
+ linkurl = "http://" + linkstr;
+ linkstr = prefix + linkstr;
+
return TRUE;
}