Bug 106522 - Font changes size in contact list
Summary: Font changes size in contact list
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Grzegorz Jaskiewicz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-30 21:51 UTC by Till Gerken
Modified: 2005-05-31 10:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Correct font size (18.25 KB, image/png)
2005-05-30 21:51 UTC, Till Gerken
Details
Incorrect font size (18.38 KB, image/png)
2005-05-30 21:52 UTC, Till Gerken
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Till Gerken 2005-05-30 21:51:06 UTC
Version:           0.10.90%20%3E%3D%2020050522 (using KDE 3.4.0,%20Debian%20Package%204%3A3.4.0-0ubuntu3.1%20(3.1))
Compiler:          gcc%20version%203.3.5%20(Debian%201%3A3.3.5-8ubuntu2)
OS:                Linux%20(i686)%20release%202.6.10-5-686

The away message in the contact list in "detailed view" is incorrect. When displayed initially, the size is ok. When the away message changes, the font size changes as well. If I toggle "view offline contacts" or change the contact list layout (anything that causes the contact list to be re-rendered I suppose), the font gets adjusted to its correct size again.

I suppose that this is related to Greg's commits 419602 and 419604. See the attached screenshots for what I mean.
Comment 1 Till Gerken 2005-05-30 21:51:54 UTC
Created attachment 11268 [details]
Correct font size
Comment 2 Till Gerken 2005-05-30 21:52:26 UTC
Created attachment 11269 [details]
Incorrect font size
Comment 3 Grzegorz Jaskiewicz 2005-05-31 00:44:39 UTC
ok, I got it here.
In essence it works like that:
you have your font set for away messages to let's say 8 pix height verdana. (smaller than default one).
someone on your list changes his away message, and new one being displayed using default settings again, rather than 8 pix verdana. Hope that's clear.
anyway, confirmed, My change to display away message using DisplayNameComponent only showed that there is another problem with this component.
Comment 4 Grzegorz Jaskiewicz 2005-05-31 01:00:40 UTC
http://www.kde.org.pl/kupa4.jpg
take a look at this.
The problem appears to be in DisplayNameComponent in general,not just away message.
My last commit just exposed that problem, and Till have found it.
Comment 5 Grzegorz Jaskiewicz 2005-05-31 01:33:11 UTC
SVN commit 419986 by gj:

BUGFIX:
Ok, this should FIX BUG 106522.
there was default QFont used to repaint any text, not one used with setFont();
I wonder how it ever worked. I have to play aroud with colors, and see if they are screwed up too.
Till, please test, and close the bug if you think it's OK. I am sure it is, as far as I am concerned.

CCMAIL: 106522@bugs.kde.org



 M  +7 -3      kopetelistviewitem.cpp  


--- trunk/KDE/kdenetwork/kopete/libkopete/ui/kopetelistviewitem.cpp #419985:419986
@@ -636,6 +636,8 @@
 {
 public:
 	QString text;
+    QColor color;
+    QFont font;
 };
 
 DisplayNameComponent::DisplayNameComponent( ComponentBase *parent )
@@ -707,15 +709,14 @@
 	tokens = Kopete::Emoticons::tokenizeEmoticons( text );
 	ImageComponent *ic;
 
-	QFont font;
-	QFontMetrics fontMetrics( font );
+	QFontMetrics fontMetrics( d->font );
 	int fontHeight = fontMetrics.height();
 	for ( token = tokens.begin(); token != tokens.end(); ++token )
 	{
 		switch ( (*token).type )
 		{
 		case Kopete::Emoticons::Text:
-			new TextComponent( this, font, (*token).text );
+			new TextComponent( this, d->font, (*token).text );
 		break;
 		case Kopete::Emoticons::Image:
 			ic = new ImageComponent( this );
@@ -733,6 +734,8 @@
 	for ( uint n = 0; n < components(); ++n )
 		if( component( n )->rtti() == Rtti_TextComponent )
 			((TextComponent*)component(n))->setFont( font );
+
+	d->font = font;
 }
 
 void DisplayNameComponent::setColor( const QColor& color )
@@ -740,6 +743,7 @@
 	for ( uint n = 0; n < components(); ++n )
 		if( component( n )->rtti() == Rtti_TextComponent )
 			((TextComponent*)component(n))->setColor( color );
+	d->color = color;
 }
 
 void DisplayNameComponent::setDefaultColor()
Comment 6 Till Gerken 2005-05-31 10:54:06 UTC
SVN commit 420065 by gerken:

Fix compilation. With previous change by Greg also fixes #106522.
BUG: 106522


 M  +2 -1      kopetelistviewitem.cpp  


--- trunk/KDE/kdenetwork/kopete/libkopete/ui/kopetelistviewitem.cpp #420064:420065
@@ -708,6 +708,7 @@
 
 	tokens = Kopete::Emoticons::tokenizeEmoticons( text );
 	ImageComponent *ic;
+	TextComponent *t;
 
 	QFontMetrics fontMetrics( d->font );
 	int fontHeight = fontMetrics.height();
@@ -716,7 +717,7 @@
 		switch ( (*token).type )
 		{
 		case Kopete::Emoticons::Text:
-			TextComponent *t = new TextComponent( this,  d->font, (*token).text );
+			t = new TextComponent( this,  d->font, (*token).text );
 			t->setColor( d->color );
 		break;
 		case Kopete::Emoticons::Image: