~ubuntu-branches/ubuntu/natty/kde4libs/natty-proposed

« back to all changes in this revision

Viewing changes to kdeui/widgets/krichtextedit.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell, Jonathan Riddell, Scott Kitterman
  • Date: 2011-01-21 11:32:24 UTC
  • mfrom: (1.14.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110121113224-c9tebdkklj5u3awu
Tags: 4:4.6.0-0ubuntu1~ppa1
[ Jonathan Riddell ]
* New upstream release
* Reluctantly add kcm_ssl to kdelibs5-plugins, this should be in kdebase

[ Scott Kitterman ]
* Update libkatepartinterfaces4.symbols and libkdecore5.symbols for 4.5.95
  and confirm symbols on all architectures with pkgkde-symbolshelper
  - Thanks to Jonathan Thomas for verifying the missing symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
522
522
 
523
523
QString KRichTextEdit::toCleanHtml() const
524
524
{
525
 
    // Does nothing anymore, as Qt seems to be fixed now.
526
 
    // See the unit test which confirms this.
527
 
    return toHtml();
 
525
  QString result = toHtml();
 
526
 
 
527
  static const QString EMPTYLINEFROMQT = QLatin1String(
 
528
  "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; "
 
529
  "margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "
 
530
  "-qt-user-state:0;\"></p>" );
 
531
 
 
532
  static const QString EMPTYLINEHTML = QLatin1String(
 
533
  "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; "
 
534
  "margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "
 
535
  "-qt-user-state:0;\"><br /></p>" );
 
536
 
 
537
  static const QString OLLISTPATTERNQT = QLatin1String(
 
538
  "<ol style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px;" );
 
539
 
 
540
  static const QString ULLISTPATTERNQT = QLatin1String(
 
541
  "<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px;" );
 
542
 
 
543
  static const QString ORDEREDLISTHTML = QLatin1String(
 
544
  "<ol style=\"margin-top: 0px; margin-bottom: 0px;" );
 
545
 
 
546
  static const QString UNORDEREDLISTHTML = QLatin1String(
 
547
  "<ul style=\"margin-top: 0px; margin-bottom: 0px;" );
 
548
 
 
549
  // fix 1 - empty lines should show as empty lines - MS Outlook treats margin-top:0px; as
 
550
  // a non-existing line.
 
551
  // Although we can simply remove the margin-top style property, we still get unwanted results
 
552
  // if you have three or more empty lines. It's best to replace empty <p> elements with <p><br /></p>.
 
553
  // As per http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict, <br> elements are still proper
 
554
  // HTML.
 
555
  result.replace(EMPTYLINEFROMQT, EMPTYLINEHTML);
 
556
 
 
557
  // fix 2a - ordered lists - MS Outlook treats margin-left:0px; as
 
558
  // a non-existing number; e.g: "1. First item" turns into "First Item"
 
559
  result.replace(OLLISTPATTERNQT, ORDEREDLISTHTML);
 
560
 
 
561
  // fix 2b - unordered lists - MS Outlook treats margin-left:0px; as
 
562
  // a non-existing bullet; e.g: "* First bullet" turns into "First Bullet"
 
563
  result.replace(ULLISTPATTERNQT, UNORDEREDLISTHTML);
 
564
 
 
565
  return result;
528
566
}
529
567
 
530
568
#include "krichtextedit.moc"