Show
Ignore:
Timestamp:
06/05/03 04:53:36 (5 years ago)
Author:
emostar
Message:

Fix highlighting

Location:
branches/protocol_plugin_1_3_0/qt-gui/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/protocol_plugin_1_3_0/qt-gui/src/ewidgets.cpp

    r3534 r3535  
    638638  s.sprintf("<html><body><font color=\"%s\">%s</font></body></html>", 
    639639            color, 
    640             messageText.utf8().data() 
    641 //MLView::toRichText(messageText, true).utf8().data() 
     640            MLView::toRichText(messageText, true).utf8().data() 
    642641           ); 
    643642  append(s); 
  • branches/protocol_plugin_1_3_0/qt-gui/src/mlview3.cpp

    r3392 r3535  
    6161      strcmp(qVersion(), "3.0.1") == 0 || 
    6262      strcmp(qVersion(), "3.0.2") == 0 || 
    63       strcmp(qVersion(), "3.0.3") == 0 ||  
     63      strcmp(qVersion(), "3.0.3") == 0 || 
    6464      strcmp(qVersion(), "3.0.4") == 0) 
    6565  { 
     
    7878  // We cannot use QStyleSheet::convertFromPlainText 
    7979  // since it has a bug in Qt 3 which causes line breaks to mix up. 
    80   QString text = QStyleSheet::escape(s); 
     80  // not used for html now QString text = QStyleSheet::escape(s); 
     81  QString text = s; 
    8182 
    8283  // We must hightlight URLs at this step, before we convert 
    83   // linebreaks to richtext tags and such. 
    84   if (highlightURLs) 
     84  // linebreaks to richtext tags and such.  Also, check to make sure 
     85  // that the text is not prepared to be highlighted already (by AIM). 
     86  QRegExp reAHREF("<a href", false); 
     87  int pos = 0; 
     88  if (highlightURLs && (pos = text.find(reAHREF, pos)) == -1) 
    8589  { 
    8690     QRegExp reURL("(\\w+://.+)(\\s+|$)"); 
    8791     reURL.setMinimal(true); 
    88      int pos = 0; 
     92     pos = 0; 
    8993     while ( (pos = text.find(reURL, pos)) != -1 ) { 
    9094        QString url = reURL.cap(1); 
     
    9397        pos += reURL.matchedLength() - url.length() + link.length(); 
    9498     } 
    95       
     99 
    96100     QRegExp reMail("(mailto:)?([\\d\\w\\.\\-_]+@[\\d\\w\\.\\-_]+)(\\s+|$)"); 
    97101     reMail.setMinimal(true); 
     
    103107        pos += reMail.matchedLength() - mail.length() + link.length(); 
    104108     } 
    105       
     109 
    106110  } 
    107111 
     
    111115  // spaces). 
    112116  QRegExp longSpaces(" ([ ]+)"); 
    113   int pos; 
     117  pos = 0; 
    114118  QString cap; 
    115119  while ((pos = longSpaces.search(text)) > -1) 
     
    117121     cap = longSpaces.cap(1); 
    118122     cap.replace(QRegExp(" "), "&nbsp;"); 
    119      text.replace(pos+1, longSpaces.matchedLength()-1, cap);  
     123     text.replace(pos+1, longSpaces.matchedLength()-1, cap); 
    120124  } 
    121125  text.replace(QRegExp("\t"), " &nbsp;&nbsp;&nbsp;"); 
    122    
     126 
    123127  return text; 
    124128}