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

List:       kde-commits
Subject:    [Konversation] 1b17c5e: Paragraph spacing now affects new text in
From:       Dario Abatianni <eisfuchs () tigress ! com>
Date:       2010-07-01 13:27:01
Message-ID: 20100701132701.CFCE2BB54C3 () projects ! kde ! org
[Download RAW message or body]

commit 1b17c5e6d03316c1aade4c56df24296f08827209
Author: Dario Abatianni <eisfuchs@tigress.com>
Date:   Mon Nov 3 19:36:33 2003 +0000

    Paragraph spacing now affects new text in already opened views as well
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=264310

diff --git a/konversation/channel.cpp b/konversation/channel.cpp
index b05679a..255ff0e 100644
--- a/konversation/channel.cpp
+++ b/konversation/channel.cpp
@@ -1415,6 +1415,11 @@ void Channel::updateFonts()
   nicknameListView->setFont(KonversationApplication::preferences.getListFont());
 }
 
+void Channel::updateStyleSheet()
+{
+  getTextView()->updateStyleSheet();
+}
+
 void Channel::openNickChangeDialog()
 {
   if(!nickChangeDialog)
diff --git a/konversation/channel.h b/konversation/channel.h
index 0fdc533..6dc4989 100644
--- a/konversation/channel.h
+++ b/konversation/channel.h
@@ -76,6 +76,7 @@ class Channel : public ChatWindow
     void updateModeWidgets(char mode, bool plus, const QString &parameter);
     void updateQuickButtons(QStringList newButtonList);
     void updateFonts();
+    void updateStyleSheet();
 
     virtual QString getTextInLine();
     virtual void closeYourself();
diff --git a/konversation/ircview.cpp b/konversation/ircview.cpp
index 42b77d3..d672463 100644
--- a/konversation/ircview.cpp
+++ b/konversation/ircview.cpp
@@ -69,20 +69,9 @@ IRCView::IRCView(QWidget* parent,Server* newServer) : KTextBrowser(parent)
 
   installEventFilter(this);
 
-  // set style sheet for <p> to define paragraph spacing
+  // set basic style sheet for <p> to make paragraph spacing possible
   QStyleSheet* sheet=new QStyleSheet(this,"ircview_style_sheet");
-
-  int paragraphSpacing;
-  if(KonversationApplication::preferences.getUseParagraphSpacing())
-    paragraphSpacing=KonversationApplication::preferences.getParagraphSpacing();
-  else
-    paragraphSpacing=0;
-
-  QStyleSheetItem* style=new QStyleSheetItem(sheet,"p");
-  style->setDisplayMode(QStyleSheetItem::DisplayBlock);
-  style->setMargin(QStyleSheetItem::MarginVertical,paragraphSpacing);
-  style->setSelfNesting(false);
-
+  new QStyleSheetItem(sheet,"p");
   setStyleSheet(sheet);
 
   setServer(newServer);
@@ -108,6 +97,34 @@ IRCView::~IRCView()
   if(popup) delete popup;
 }
 
+void IRCView::updateStyleSheet()
+{
+  // set style sheet for <p> to define paragraph spacing
+  QStyleSheet* sheet=styleSheet();
+  if(sheet==0)
+  {
+    kdDebug() << "IRCView::updateStyleSheet(): sheet==0!" << endl;
+    return;
+  }
+
+  int paragraphSpacing;
+  if(KonversationApplication::preferences.getUseParagraphSpacing())
+    paragraphSpacing=KonversationApplication::preferences.getParagraphSpacing();
+  else
+    paragraphSpacing=0;
+
+  QStyleSheetItem* style=sheet->item("p");
+  if(sheet==0)
+  {
+    kdDebug() << "IRCView::updateStyleSheet(): style==0!" << endl;
+    return;
+  }
+
+  style->setDisplayMode(QStyleSheetItem::DisplayBlock);
+  style->setMargin(QStyleSheetItem::MarginVertical,paragraphSpacing);
+  style->setSelfNesting(false);
+}
+
 void IRCView::setViewBackground(const QString& color,const QString& pixmapName)
 {
   QColor backgroundColor("#"+color);
diff --git a/konversation/ircview.h b/konversation/ircview.h
index 49da63e..2a6c450 100644
--- a/konversation/ircview.h
+++ b/konversation/ircview.h
@@ -38,6 +38,8 @@ class IRCView : public KTextBrowser
     void setViewBackground(const QString& color,const QString& pixmapName);
     void setServer(Server* server);
 
+    void updateStyleSheet();
+
     QPopupMenu* getPopup();
     enum PopupIDs
     {
diff --git a/konversation/server.cpp b/konversation/server.cpp
index 425f012..188529b 100644
--- a/konversation/server.cpp
+++ b/konversation/server.cpp
@@ -1123,6 +1123,7 @@ void Server::updateFonts()
   while(channel)
   {
     channel->updateFonts();
+    channel->updateStyleSheet();
     channel=channelList.next();
   }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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