csshelper.cpp
00001 /* -*- mode: C++; c-file-style: "gnu" -*- 00002 csshelper.cpp 00003 00004 This file is part of KMail, the KDE mail client. 00005 Copyright (c) 2003 Marc Mutz <mutz@kde.org> 00006 00007 KMail is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License, version 2, as 00009 published by the Free Software Foundation. 00010 00011 KMail is distributed in the hope that it will be useful, but 00012 WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 00020 In addition, as a special exception, the copyright holders give 00021 permission to link the code of this program with any edition of 00022 the TQt library by Trolltech AS, Norway (or with modified versions 00023 of TQt that use the same license as TQt), and distribute linked 00024 combinations including the two. You must obey the GNU General 00025 Public License in all respects for all of the code used other than 00026 TQt. If you modify this file, you may extend this exception to 00027 your version of the file, but you are not obligated to do so. If 00028 you do not wish to do so, delete this exception statement from 00029 your version. 00030 */ 00031 00032 #include "csshelper.h" 00033 #include "kmkernel.h" 00034 00035 #include "globalsettings.h" 00036 00037 #include <kconfig.h> 00038 00039 #include <tqcolor.h> 00040 #include <tqfont.h> 00041 00042 namespace KMail { 00043 00044 CSSHelper::CSSHelper( const TQPaintDeviceMetrics &pdm ) : 00045 KPIM::CSSHelper( pdm ) 00046 { 00047 KConfig * config = KMKernel::config(); 00048 00049 KConfigGroup reader( config, "Reader" ); 00050 KConfigGroup fonts( config, "Fonts" ); 00051 KConfigGroup pixmaps( config, "Pixmaps" ); 00052 00053 mRecycleQuoteColors = reader.readBoolEntry( "RecycleQuoteColors", false ); 00054 00055 if ( !reader.readBoolEntry( "defaultColors", true ) ) { 00056 mForegroundColor = reader.readColorEntry("ForegroundColor",&mForegroundColor); 00057 mLinkColor = reader.readColorEntry("LinkColor",&mLinkColor); 00058 mVisitedLinkColor = reader.readColorEntry("FollowedColor",&mVisitedLinkColor); 00059 mBackgroundColor = reader.readColorEntry("BackgroundColor",&mBackgroundColor); 00060 cPgpEncrH = reader.readColorEntry( "PGPMessageEncr", &cPgpEncrH ); 00061 cPgpOk1H = reader.readColorEntry( "PGPMessageOkKeyOk", &cPgpOk1H ); 00062 cPgpOk0H = reader.readColorEntry( "PGPMessageOkKeyBad", &cPgpOk0H ); 00063 cPgpWarnH = reader.readColorEntry( "PGPMessageWarn", &cPgpWarnH ); 00064 cPgpErrH = reader.readColorEntry( "PGPMessageErr", &cPgpErrH ); 00065 cHtmlWarning = reader.readColorEntry( "HTMLWarningColor", &cHtmlWarning ); 00066 for ( int i = 0 ; i < 3 ; ++i ) { 00067 const TQString key = "QuotedText" + TQString::number( i+1 ); 00068 mQuoteColor[i] = reader.readColorEntry( key, &mQuoteColor[i] ); 00069 } 00070 } 00071 00072 if ( !fonts.readBoolEntry( "defaultFonts", true ) ) { 00073 mBodyFont = fonts.readFontEntry( "body-font", &mBodyFont); 00074 mPrintFont = fonts.readFontEntry( "print-font", &mPrintFont); 00075 mFixedFont = fonts.readFontEntry( "fixed-font", &mFixedFont); 00076 mFixedPrintFont = mFixedFont; // FIXME when we have a separate fixed print font 00077 TQFont defaultFont = mBodyFont; 00078 defaultFont.setItalic( true ); 00079 for ( int i = 0 ; i < 3 ; ++i ) { 00080 const TQString key = TQString( "quote%1-font" ).arg( i+1 ); 00081 mQuoteFont[i] = fonts.readFontEntry( key, &defaultFont ); 00082 } 00083 } 00084 00085 mShrinkQuotes = GlobalSettings::self()->shrinkQuotes(); 00086 00087 mBackingPixmapStr = pixmaps.readPathEntry("Readerwin"); 00088 mBackingPixmapOn = !mBackingPixmapStr.isEmpty(); 00089 00090 recalculatePGPColors(); 00091 } 00092 } // namespace KMail 00093