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

List:       kde-commits
Subject:    [calligra/textshape-stylesWidget-PierreSt] /: Remove default paragraph style from user visible lists
From:       Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date:       2012-12-31 16:03:35
Message-ID: 20121231160335.C345CA6091 () git ! kde ! org
[Download RAW message or body]

Git commit d968f8a2126c29e1b62b0c1af60c5700626a1584 by Pierre Stirnweiss.
Committed on 31/12/2012 at 17:01.
Pushed by pstirnweiss into branch 'textshape-stylesWidget-PierreSt'.

Remove default paragraph style from user visible lists.

The default paragraph style was seen in user visible lists (as blank
item). This style is not supposed to be user visible/selectable.

M  +8    -8    libs/kotext/styles/KoStyleManager.cpp
M  +5    -3    plugins/textshape/dialogs/StylesModel.cpp

http://commits.kde.org/calligra/d968f8a2126c29e1b62b0c1af60c5700626a1584

diff --git a/libs/kotext/styles/KoStyleManager.cpp \
b/libs/kotext/styles/KoStyleManager.cpp index 480fa19..e3bb380 100644
--- a/libs/kotext/styles/KoStyleManager.cpp
+++ b/libs/kotext/styles/KoStyleManager.cpp
@@ -413,12 +413,12 @@ void KoStyleManager::add(KoCharacterStyle *style)
     }
     style->setParent(this);
     style->setStyleId(d->s_stylesNumber);
-    if (style->isApplied() && !d->m_usedCharacterStyles.contains(d->s_stylesNumber)) \
                {
-        d->m_usedCharacterStyles.append(d->s_stylesNumber);
-    }
     d->charStyles.insert(d->s_stylesNumber++, style);
 
-    connect(style, SIGNAL(styleApplied(const KoCharacterStyle*)), this, \
SLOT(slotAppliedStyle(const KoCharacterStyle*))); +    if (style->isApplied() && \
!d->m_usedCharacterStyles.contains(d->s_stylesNumber) && !(style == \
defaultCharacterStyle())) { //defaultStyle should not be user visible +        \
d->m_usedCharacterStyles.append(d->s_stylesNumber); +        connect(style, \
SIGNAL(styleApplied(const KoCharacterStyle*)), this, SLOT(slotAppliedStyle(const \
KoCharacterStyle*))); +    }
     emit styleAdded(style);
 }
 
@@ -432,9 +432,6 @@ void KoStyleManager::add(KoParagraphStyle *style)
     }
     style->setParent(this);
     style->setStyleId(d->s_stylesNumber);
-    if (style->isApplied() && !d->m_usedParagraphStyles.contains(d->s_stylesNumber)) \
                {
-        d->m_usedParagraphStyles.append(d->s_stylesNumber);
-    }
     d->paragStyles.insert(d->s_stylesNumber++, style);
 
     if (style->listStyle() && style->listStyle()->styleId() == 0)
@@ -446,7 +443,10 @@ void KoStyleManager::add(KoParagraphStyle *style)
             add(root);
     }
 
-    connect(style, SIGNAL(styleApplied(const KoParagraphStyle*)), this, \
SLOT(slotAppliedStyle(const KoParagraphStyle*))); +    if (style->isApplied() && \
!d->m_usedParagraphStyles.contains(d->s_stylesNumber) && !(style == \
defaultParagraphStyle())) { //defaultStyle should not be user visible +        \
d->m_usedParagraphStyles.append(d->s_stylesNumber); +        connect(style, \
SIGNAL(styleApplied(const KoParagraphStyle*)), this, SLOT(slotAppliedStyle(const \
KoParagraphStyle*))); +    }
     emit styleAdded(style);
 }
 
diff --git a/plugins/textshape/dialogs/StylesModel.cpp \
b/plugins/textshape/dialogs/StylesModel.cpp index 0e33084..2ac95fa 100644
--- a/plugins/textshape/dialogs/StylesModel.cpp
+++ b/plugins/textshape/dialogs/StylesModel.cpp
@@ -353,9 +353,11 @@ void StylesModel::updateParagraphStyles()
     qSort(styles.begin(), styles.end(), sortParagraphStyleByName);
 
     foreach(KoParagraphStyle *style, styles) {
-        m_styleList.append(style->styleId());
-        m_styleMapper->setMapping(style, style->styleId());
-        connect(style, SIGNAL(nameChanged(const QString&)), m_styleMapper, \
SLOT(map())); +        if (style != m_styleManager->defaultParagraphStyle()) { //The \
default character style is not user selectable. It only provides individual property \
defaults and is not a style per say. +            \
m_styleList.append(style->styleId()); +            m_styleMapper->setMapping(style, \
style->styleId()); +            connect(style, SIGNAL(nameChanged(const QString&)), \
m_styleMapper, SLOT(map())); +        }
     }
 
     endResetModel();


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

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