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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/generic/applets/notifications/ui
From:       Alex Fiestas <alex () eyeos ! org>
Date:       2011-01-03 16:10:25
Message-ID: 20110103161025.B4F2EAC8AE () svn ! kde ! org
[Download RAW message or body]

SVN commit 1211306 by afiestas:

Move the char append into each case since we don't want to elid special characters \
such < or >, this fix a HTML breakage when long sentences are elided and just after \
them  there is a html tag.


 M  +7 -2      notificationwidget.cpp  


--- trunk/KDE/kdebase/workspace/plasma/generic/applets/notifications/ui/notificationwidget.cpp \
#1211305:1211306 @@ -330,7 +330,7 @@
 
     /*if there is a < that is not closed as a tag, replace it with an entity*/
     processed = processed.replace(QRegExp("<([^>]*($|<))"), "&lt;\\1");
-    processed.replace('\n', "<br>");
+    processed.replace('\n', "</br>");
 
     QFontMetricsF fm(messageLabel->font());
     qreal maxLine = messageLabel->rect().width();
@@ -344,7 +344,6 @@
 
     while (i != processed.end()) {
         QChar c = *i;
-        word.append(c);
 
         if (c == '<') {
             inTag = true;
@@ -352,22 +351,28 @@
             parsed.append(fm.elidedText(sentence, Qt::ElideRight, maxLine*2.6));
             sentence = QString();
             word = QString();
+            word.append(c);
         } else if (c == '>') {
+            word.append(c);
             inTag = false;
             parsed.append(word);
             word = QString();
             sentence = QString();
         } else if (c == ' ') {
+            word.append(c);
             if (inTag) {
                 parsed.append(word);
             } else {
                 sentence.append(word);
             }
             word = QString();
+        } else {
+            word.append(c);
         }
 
         ++i;
     }
+
     sentence.append(word);
     parsed.append(fm.elidedText(sentence, Qt::ElideRight, maxLine*2.6));
 


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

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