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

List:       kde-commits
Subject:    [calligra] libs/kotext: Fix style appears modified after new line following a list style.
From:       Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date:       2012-12-01 16:08:42
Message-ID: 20121201160842.AC690A6091 () git ! kde ! org
[Download RAW message or body]

Git commit 6ca4bdf30bcf953ac3b13e0daeb35d3590332d0b by Pierre Stirnweiss.
Committed on 01/12/2012 at 17:05.
Pushed by pstirnweiss into branch 'master'.

Fix style appears modified after new line following a list style.

BUG: 293378
FIXED-IN: 2.6
REVIEW: 107540

Squashed commit of the following:

commit e8e9407c088577aff79e28cd2262c0f02c29cbc7
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Dec 1 14:07:50 2012 +0100

    Clean up

commit 4a31b7e1fe79fbd959cadbcaeb33bafe115f6d6e
Merge: 677be5e fc4b005
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Dec 1 13:54:43 2012 +0100

    Merge branch 'master' into textshape-stylesWidget-PierreSt

commit 677be5ea17fa68da4cd171ec5d0a5a7f1be87556
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Dec 1 13:21:13 2012 +0100

    Fix next style appears as modified after a list style

commit 31cdb8e0ad6ee2ea0a42894933a2db48c543aab1
Merge: bd699d1 f3ae109
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Wed Nov 28 18:28:01 2012 +0100

    Merge branch 'master' into textshape-stylesWidget-PierreSt

commit bd699d1bbf8c837505ebe19c5c0fc7cbc307ca11
Merge: 15e1a5c c98e784
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Tue Nov 27 20:14:12 2012 +0100

    Merge branch 'master' into textshape-stylesWidget-PierreSt

commit 15e1a5c348a09e516fa5b3e58525e9f4440060a1
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Tue Nov 27 17:58:17 2012 +0100

    Fix problems highlighted by C. Boemann

commit fe4de0d618eb6c6dd83ab07f8641f6e24cfd55fc
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Mon Nov 26 18:43:33 2012 +0100

    Clean-up left-over

commit 1e40dfdc986eb2bc9114684a20aa5ec60db77d2d
Merge: ea8cdb0 82cc058
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sun Nov 25 10:19:14 2012 +0100

    Merge branch 'master' into textshape-stylesWidget-PierreSt

commit ea8cdb0e14e6805b4082ffd0929c8b1b344c82f4
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Nov 24 15:02:15 2012 +0100

    Additional clean ups

commit 6308ed4fd70aa99ccd5214806f370423ca5b7015
Merge: d306e00 81b50ca
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Nov 24 14:49:45 2012 +0100

    Merge branch 'master' into textshape-stylesWidget-PierreSt

commit d306e009525c97d2c7e1706a47ec267d7e994c8c
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Nov 24 14:48:09 2012 +0100

    Clean ups in the code

commit 231e717b0c1c7dbec984679e0fb07dc821f8e889
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sun Nov 11 13:03:26 2012 +0100

    Fix another crash

commit c37b513c5b4f9c09345848f2885f4eac24791008
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sun Nov 11 12:42:08 2012 +0100

    Fix random crash.

commit 0a9c5e3464c39e45eeeb26b1c65643bdb63fca32
Merge: 8e675f4 e6c1c31
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Nov 10 17:07:22 2012 +0100

    Merge branch 'master' into textshape-stylesWidget-PierreSt

commit 8e675f4d1b66eda355e994c0c88b6ac67337bca3
Merge: bcb9fbd 6c7d9e1
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Nov 10 15:54:06 2012 +0100

    Merge branch 'master' into textshape-stylesWidget-PierreSt

commit bcb9fbd767aa2c4b7e5670ab2546797e9cf3e42b
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sat Nov 10 15:52:53 2012 +0100

    Initial population of style, a tad further.

commit fbbcf132764ca9a60b59e46aa844df918aa8fd05
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Mon Oct 22 21:36:20 2012 +0200

    Add missing bits to previous commit

commit 889e39862888ef83dc052604746611c959352bf0
Author: Pierre Stirnweiss <pstirnweiss@googlemail.com>
Date:   Sun Oct 21 23:39:14 2012 +0200

    Create filter for stylesCombo in the docker

M  +11   -0    libs/kotext/KoList.cpp
M  +0    -1    libs/kotext/styles/KoParagraphStyle.cpp

http://commits.kde.org/calligra/6ca4bdf30bcf953ac3b13e0daeb35d3590332d0b

diff --git a/libs/kotext/KoList.cpp b/libs/kotext/KoList.cpp
index a9f582b..14279ec 100644
--- a/libs/kotext/KoList.cpp
+++ b/libs/kotext/KoList.cpp
@@ -148,6 +148,10 @@ void KoList::add(const QTextBlock &block, int level)
 
 void KoList::remove(const QTextBlock &block)
 {
+    //QTextLists are created with a blockIndent of 1. When a block is removed from a \
QTextList, it's blockIndent is set to (block.indent + list.indent). +    //Since we \
do not use Qt's indentation for lists, we need to clear the block's blockIndent, \
otherwise the block's style will appear as modified. +    bool clearIndent = \
!block.blockFormat().hasProperty(4160); +
     if (QTextList *textList = block.textList()) {
         // invalidate the list before we remove the item
         // (since the list might disappear if the block is the only item)
@@ -155,6 +159,13 @@ void KoList::remove(const QTextBlock &block)
         textList->remove(block);
     }
     KoListPrivate::invalidate(block);
+
+    if (clearIndent) {
+        QTextBlockFormat format = block.blockFormat();
+        format.clearProperty(4160);
+        QTextCursor cursor(block);
+        cursor.setBlockFormat(format);
+    }
 }
 
 void KoList::setStyle(KoListStyle *style)
diff --git a/libs/kotext/styles/KoParagraphStyle.cpp \
b/libs/kotext/styles/KoParagraphStyle.cpp index 78f09f0..060ee19 100644
--- a/libs/kotext/styles/KoParagraphStyle.cpp
+++ b/libs/kotext/styles/KoParagraphStyle.cpp
@@ -370,7 +370,6 @@ void KoParagraphStyle::unapplyStyle(QTextBlock &block) const
     if (d->list && block.textList()) { // TODO check its the same one?
         KoList::remove(block);
     }
-
 }
 
 void KoParagraphStyle::setLineHeightPercent(qreal lineHeight)


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

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