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'
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();
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 };
The 0.12 branch has been merged, so this patch is in the KDE 3.5 branch for some time now.