Changeset 3535 for branches/protocol_plugin_1_3_0
- Timestamp:
- 06/05/03 04:53:36 (5 years ago)
- Location:
- branches/protocol_plugin_1_3_0/qt-gui/src
- Files:
-
- 2 modified
-
ewidgets.cpp (modified) (1 diff)
-
mlview3.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/protocol_plugin_1_3_0/qt-gui/src/ewidgets.cpp
r3534 r3535 638 638 s.sprintf("<html><body><font color=\"%s\">%s</font></body></html>", 639 639 color, 640 messageText.utf8().data() 641 //MLView::toRichText(messageText, true).utf8().data() 640 MLView::toRichText(messageText, true).utf8().data() 642 641 ); 643 642 append(s); -
branches/protocol_plugin_1_3_0/qt-gui/src/mlview3.cpp
r3392 r3535 61 61 strcmp(qVersion(), "3.0.1") == 0 || 62 62 strcmp(qVersion(), "3.0.2") == 0 || 63 strcmp(qVersion(), "3.0.3") == 0 || 63 strcmp(qVersion(), "3.0.3") == 0 || 64 64 strcmp(qVersion(), "3.0.4") == 0) 65 65 { … … 78 78 // We cannot use QStyleSheet::convertFromPlainText 79 79 // 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; 81 82 82 83 // 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) 85 89 { 86 90 QRegExp reURL("(\\w+://.+)(\\s+|$)"); 87 91 reURL.setMinimal(true); 88 intpos = 0;92 pos = 0; 89 93 while ( (pos = text.find(reURL, pos)) != -1 ) { 90 94 QString url = reURL.cap(1); … … 93 97 pos += reURL.matchedLength() - url.length() + link.length(); 94 98 } 95 99 96 100 QRegExp reMail("(mailto:)?([\\d\\w\\.\\-_]+@[\\d\\w\\.\\-_]+)(\\s+|$)"); 97 101 reMail.setMinimal(true); … … 103 107 pos += reMail.matchedLength() - mail.length() + link.length(); 104 108 } 105 109 106 110 } 107 111 … … 111 115 // spaces). 112 116 QRegExp longSpaces(" ([ ]+)"); 113 int pos;117 pos = 0; 114 118 QString cap; 115 119 while ((pos = longSpaces.search(text)) > -1) … … 117 121 cap = longSpaces.cap(1); 118 122 cap.replace(QRegExp(" "), " "); 119 text.replace(pos+1, longSpaces.matchedLength()-1, cap); 123 text.replace(pos+1, longSpaces.matchedLength()-1, cap); 120 124 } 121 125 text.replace(QRegExp("\t"), " "); 122 126 123 127 return text; 124 128 }
