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

List:       kde-commits
Subject:    kdevelop/vcs/cvsservice
From:       Robert Gruber <rgruber () users ! sourceforge ! net>
Date:       2005-03-08 19:32:30
Message-ID: 20050308193230.3F4A9103CB () office ! kde ! org
[Download RAW message or body]

CVS commit by rgruber: 

If the line already contains tags (or any other text surrounded by "<" and ">")
we need to replace these delimiters with their corresponding HTML code. 
That way the tags will be no longer recognized by QTextEdit but displayed 
as plain text. 
Besides that QTextEdit crashes in some special constellations if we 
try to wrap or own tags around already existing ones.
BUGS:99590


  M +17 -7     cvsprocesswidget.cpp   1.19


--- kdevelop/vcs/cvsservice/cvsprocesswidget.cpp  #1.18:1.19
@@ -259,18 +259,28 @@ void CvsProcessWidget::showOutput( const
         const QString &line = (*it);
 
+        //If the line already contains tags we need to replace the 
+        //delimiters with the corresponding HTML code so that they are no longer 
+        //recognized as tags.
+        //This will prevent QTextEdit from crashing on trying to parse the tags.
+        //This should fix BUG:99590
+        QString lineNew(line);
+        lineNew.replace("<", "&lt;");
+        lineNew.replace(">", "&gt;");
+        lineNew.replace("&", "&amp;");
+
         if (line.startsWith( "C " ))
-            append( "<cvs_conflict>" + line + "</cvs_conflict>" );
+            append( "<cvs_conflict>" + lineNew + "</cvs_conflict>" );
         else if (line.startsWith( "M " ))
-            append( "<cvs_modified>" + line + "</cvs_modified>" );
+            append( "<cvs_modified>" + lineNew + "</cvs_modified>" );
         else if (line.startsWith( "A " ))
-            append( "<cvs_added>" + line + "</cvs_added>" );
+            append( "<cvs_added>" + lineNew + "</cvs_added>" );
         else if (line.startsWith( "R " ))
-            append( "<cvs_removed>" + line + "</cvs_removed>" );
+            append( "<cvs_removed>" + lineNew + "</cvs_removed>" );
         else if (line.startsWith( "U " ))
-            append( "<cvs_updated>" + line + "</cvs_updated>" );
+            append( "<cvs_updated>" + lineNew + "</cvs_updated>" );
         else if (line.startsWith( "? " ))
-            append( "<cvs_unknown>" + line + "</cvs_unknown>" );
+            append( "<cvs_unknown>" + lineNew + "</cvs_unknown>" );
         else // default
-            append( "<goodtag>" + (*it) + "</goodtag>" );
+            append( "<goodtag>" + lineNew + "</goodtag>" );
     }
 }


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

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