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

List:       kde-commits
Subject:    kdenetwork/kopete/kopete/chatwindow
From:       Matt Rogers <mattr () kde ! org>
Date:       2005-01-28 4:18:27
Message-ID: 20050128041827.3DB3D1CF30 () office ! kde ! org
[Download RAW message or body]

CVS commit by mattr: 

Don't return const references. const references are bad, m'kay?

make sure updateFont() gets called in KopeteRichTextEditPart when using
KopeteRichTextEditPart::setFont( const QFont& ), otherwise, the format
toolbar doesn't get updated (fixes #97773)

add an explicit ChatView::setFont( const QFont& ) so that we can be sure
the fonts get updated correctly. maybe it's not needed, but better safe
than sorry.

make sure we save the font to use before reparenting the window and restore
it after reparenting, this may not be necessary either, but well, better
safe than sorry.

BUG: 97773


  M +1 -1      Makefile.am   1.16
  M +5 -0      chatview.cpp   1.189
  M +5 -0      chatview.h   1.64
  M +5 -0      kopetechatwindow.cpp   1.99
  M +5 -3      krichtexteditpart.cpp   1.23
  M +4 -4      krichtexteditpart.h   1.14


--- kdenetwork/kopete/kopete/chatwindow/Makefile.am  #1.15:1.16
@@ -14,5 +14,5 @@
 libkrichtexteditpart_la_SOURCES = krichtexteditpart.cpp
 libkrichtexteditpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) \
                $(KDE_RPATH)
-libkrichtexteditpart_la_LIBADD = $(LIB_KPARTS) $(LIB_KSPELL) $(LIB_KDEPRINT)
+libkrichtexteditpart_la_LIBADD = ../../libkopete/libkopete.la $(LIB_KPARTS) \
$(LIB_KSPELL) $(LIB_KDEPRINT)  
 partdir = $(kde_datadir)/kopeterichtexteditpart

--- kdenetwork/kopete/kopete/chatwindow/chatview.cpp  #1.188:1.189
@@ -226,4 +226,9 @@ void ChatView::setFont()
 }
 
+QFont ChatView::font()
+{
+        return editPart()->font();
+}
+
 void ChatView::setFont( const QFont &font )
 {

--- kdenetwork/kopete/kopete/chatwindow/chatview.h  #1.63:1.64
@@ -216,4 +216,9 @@ public slots:
 
         /**
+         * Get the font used in the format toolbar for Rich Text formatting
+         */
+        QFont font();
+
+        /**
          * Sets the background color of the entry area, and outgoing messages
          * @param newColor The new background color. If this is QColor(), then

--- kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.cpp  #1.98:1.99
@@ -612,7 +612,12 @@ void KopeteChatWindow::addTab( ChatView 
 void KopeteChatWindow::setPrimaryChatView( ChatView *view )
 {
+        //TODO figure out what else we have to save here besides the font
+        //reparent clears a lot of stuff out
+        QFont savedFont = view->font();
         view->reparent( mainArea, 0, QPoint(), true );
         view->setTabBar( 0L );
+        view->setFont( savedFont );
         view->show();
+
         mainLayout->addWidget( view );
         setActiveView( view );

--- kdenetwork/kopete/kopete/chatwindow/krichtexteditpart.cpp  #1.22:1.23
@@ -16,4 +16,5 @@
 #include "krichtexteditpart.moc"
 #include "kopeteprotocol.h"
+#include "kopeteprefs.h"
 
 typedef KParts::GenericFactory<KopeteRichTextEditPart> \
KopeteRichTextEditPartFactory; @@ -302,5 +303,5 @@ void \
KopeteRichTextEditPart::readConfig(  setBgColor( config->readColorEntry("BgColor", \
&tmpColor ) );  
-        QFont tmpFont = KGlobalSettings::generalFont();
+        QFont tmpFont = KopetePrefs::prefs()->fontFace();
         setFont( config->readFontEntry("Font", &tmpFont ) );
 }
@@ -382,5 +383,4 @@ void KopeteRichTextEditPart::setFont()
         KFontDialog::getFont(mFont, false, editor);
         setFont(mFont);
-        updateFont();
         writeConfig();
 }
@@ -390,4 +390,5 @@ void KopeteRichTextEditPart::setFont( co
         mFont = newFont;
         editor->setFont(mFont);
+        updateFont();
 }
 
@@ -399,4 +400,5 @@ void KopeteRichTextEditPart::setFont( co
         else if( m_capabilities & Kopete::Protocol::BaseFont)
                 editor->setFont( mFont );
+        updateFont();
         writeConfig();
 }
@@ -464,5 +466,5 @@ void KopeteRichTextEditPart::setAlignJus
 }
 
-const QString KopeteRichTextEditPart::text( Qt::TextFormat fmt ) const
+QString KopeteRichTextEditPart::text( Qt::TextFormat fmt ) const
 {
         if( fmt == editor->textFormat() || fmt != Qt::PlainText )

--- kdenetwork/kopete/kopete/chatwindow/krichtexteditpart.h  #1.13:1.14
@@ -35,11 +35,11 @@ class KopeteRichTextEditPart : public KP
                 KTextEdit *widget() const { return (KTextEdit*)editor; }
 
-                const QString text( Qt::TextFormat = Qt::AutoText ) const;
+                QString text( Qt::TextFormat = Qt::AutoText ) const;
 
-                const QFont &font() { return mFont; }
+                QFont font() { return mFont; }
 
-                const QColor &fgColor() { return mFgColor; }
+                QColor fgColor() { return mFgColor; }
 
-                const QColor &bgColor() { return mBgColor; }
+                QColor bgColor() { return mBgColor; }
 
                 void clear();


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

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