Bug 86710 - font in history view is too large
Summary: font in history view is too large
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Unmaintained
Component: History Plugin (other bugs)
Version First Reported In: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-06 17:19 UTC by raviyella
Modified: 2007-08-11 14:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description raviyella 2004-08-06 17:19:23 UTC
Version:           0.8.91 cvs >= 20040626 (using KDE Devel)
Compiler:          gcc 3.2 
OS:                Linux

the font when showing history (right click on contact > view history) seems to default to a very huge size. Could it be updated to use one of the configurable fonts - atleast use 'base font'
Comment 1 Xavier FACQ 2005-11-14 15:27:38 UTC
Hi all,

 > the font when showing history (right click on contact > view history) 

seems
 > to default to a very huge size. Could > it be updated to use one of the
 > configurable fonts - atleast use 'base font'


This is my first patch for Kopete. As I'm working on Kopete
since 3 weeks I'm not very sure that the code is perfect :-)
especially about the #include for the namespace KopetePrefs.
If someone can tell me why the #include doesn't work using
#include "kopeteprefs.h", or give me another way to access to
the KopetePrefs class, I'm very insteresting !!!

Bye,
Xavier
Index: historydialog.cpp
===================================================================
--- historydialog.cpp	(révision 480351)
+++ historydialog.cpp	(copie de travail)
@@ -24,6 +24,7 @@
 #include "kopeteprotocol.h"
 #include "kopeteaccount.h"
 #include "kopetecontactlist.h"
+#include "../../libkopete/private/kopeteprefs.h"
 
 #include <dom/dom_doc.h>
 #include <dom/dom_element.h>
@@ -94,6 +95,9 @@
 	const char* name) : KDialogBase(parent, name, false,
 		i18n("History for %1").arg(mc->displayName()), 0)
 {
+	QString fontsize;
+	QString fontStyle;
+
 	kdDebug(14310) << k_funcinfo << "called." << endl;
 	setWFlags(Qt::WDestructiveClose);	// send SIGNAL(closing()) on quit
 
@@ -146,8 +150,12 @@
 	QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
 	l->addWidget(mHtmlView);
 
+	QTextOStream( &fontsize ) << KopetePrefs::prefs()->fontFace().pointSize();
+	fontStyle = "<style>.hf { font-size:" + fontsize + ".0pt; font-family:" + KopetePrefs::prefs()->fontFace().family() + "; }</style>";
+
 	mHtmlPart->begin();
-	mHtmlPart->write( QString::fromLatin1( "<html><head></head><body></body></html>") );
+	QString htmlCode = "<html><head>" + fontStyle + "</head><body class=\"hf\"></body></html>";
+	mHtmlPart->write( QString::fromLatin1( htmlCode.latin1() ) );
 	mHtmlPart->end();
 
 	
Comment 2 Matt Rogers 2005-11-20 22:35:26 UTC
SVN commit 481864 by mattr:

Apply fixes for bugs 87393 and 86710 to the 0.12 branch.
If possible, they'll be backported after the KDE 3.5 branch unfreezes
Thanks to Xavier FACQ for the patches

CCMAIL: xavier.facq@free.fr
CCBUG: 87393, 86710



 M  +29 -1     historydialog.cpp  
 M  +2 -0      historydialog.h  


--- branches/work/kopete/dev-0.12/kopete/plugins/history/historydialog.cpp #481863:481864
@@ -24,6 +24,7 @@
 #include "kopeteprotocol.h"
 #include "kopeteaccount.h"
 #include "kopetecontactlist.h"
+#include "kopeteprefs.h"
 
 #include <dom/dom_doc.h>
 #include <dom/dom_element.h>
@@ -40,6 +41,7 @@
 #include <qdatetime.h>
 #include <qheader.h>
 #include <qlabel.h>
+#include <qclipboard.h>
 
 #include <kapplication.h>
 #include <kdebug.h>
@@ -52,6 +54,7 @@
 #include <kprogress.h>
 #include <kiconloader.h>
 #include <kcombobox.h>
+#include <kpopupmenu.h>
 
 class KListViewDateItem : public KListViewItem
 {
@@ -94,6 +97,10 @@
 	const char* name) : KDialogBase(parent, name, false,
 		i18n("History for %1").arg(mc->displayName()), 0)
 {
+	QString fontSize;
+	QString htmlCode;
+	QString fontStyle;
+
 	kdDebug(14310) << k_funcinfo << "called." << endl;
 	setWFlags(Qt::WDestructiveClose);	// send SIGNAL(closing()) on quit
 
@@ -147,8 +154,12 @@
 	QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
 	l->addWidget(mHtmlView);
 
+	QTextOStream( &fontSize ) << KopetePrefs::prefs()->fontFace().pointSize();
+	fontStyle = "<style>.hf { font-size:" + fontSize + ".0pt; font-family:" + KopetePrefs::prefs()->fontFace().family() + "; }</style>";
+
 	mHtmlPart->begin();
-	mHtmlPart->write( QString::fromLatin1( "<html><head></head><body></body></html>") );
+	htmlCode = "<html><head>" + fontStyle + "</head><body class=\"hf\"></body></html>";
+	mHtmlPart->write( QString::fromLatin1( htmlCode.latin1() ) );
 	mHtmlPart->end();
 
 	
@@ -161,6 +172,7 @@
 	connect(mMainWidget->searchErase, SIGNAL(clicked()), this, SLOT(slotSearchErase()));
 	connect(mMainWidget->contactComboBox, SIGNAL(activated(int)), this, SLOT(slotContactChanged(int)));
 	connect(mMainWidget->messageFilterBox, SIGNAL(activated(int)), this, SLOT(slotFilterChanged(int )));
+	connect(mHtmlPart, SIGNAL(popupMenu(const QString &, const QPoint &)), this, SLOT(slotRightClick(const QString &, const QPoint &)));
 
 	resize(650, 700);
 	centerOnScreen(this);
@@ -582,4 +594,20 @@
 		mMainWidget->statusLabel->setText(i18n("Ready"));
 }
 
+void HistoryDialog::slotRightClick(const QString &, const QPoint &point)
+{
+	KPopupMenu *chatWindowPopup = 0L;
+	chatWindowPopup = new KPopupMenu();
+	chatWindowPopup->insertItem(i18n("Copy"), this, SLOT(slotCopy()));
+	chatWindowPopup->popup(point);
+}
+
+void HistoryDialog::slotCopy()
+{
+	QString qsSelection;
+	qsSelection = mHtmlPart->selectedText();
+	QApplication::clipboard()->setText(qsSelection, QClipboard::Clipboard);
+	QApplication::clipboard()->setText(qsSelection, QClipboard::Selection);
+}
+
 #include "historydialog.moc"
--- branches/work/kopete/dev-0.12/kopete/plugins/history/historydialog.h #481863:481864
@@ -95,6 +95,8 @@
 		void init();
 		void slotLoadDays();
 
+		void slotRightClick(const QString &, const QPoint &point);
+		void slotCopy();
 
 	private:
 		enum Disabled { Prev=1, Next=2 };
Comment 3 Bram Schoenmakers 2007-08-11 14:10:36 UTC
The 0.12 branch has been merged, so this patch is in the KDE 3.5 branch for some time now.