• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • sources
  • kde-4.12
  • kdepim
  • messageviewer
  • viewer
csshelper.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2  csshelper.cpp
3 
4  This file is part of KMail, the KDE mail client.
5  Copyright (c) 2003 Marc Mutz <mutz@kde.org>
6 
7  KMail is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License, version 2, as
9  published by the Free Software Foundation.
10 
11  KMail is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 
20  In addition, as a special exception, the copyright holders give
21  permission to link the code of this program with any edition of
22  the Qt library by Trolltech AS, Norway (or with modified versions
23  of Qt that use the same license as Qt), and distribute linked
24  combinations including the two. You must obey the GNU General
25  Public License in all respects for all of the code used other than
26  Qt. If you modify this file, you may extend this exception to
27  your version of the file, but you are not obligated to do so. If
28  you do not wish to do so, delete this exception statement from
29  your version.
30 */
31 
32 
33 #include "csshelper.h"
34 #include "settings/globalsettings.h"
35 
36 #include "messagecore/settings/globalsettings.h"
37 
38 #include <kconfig.h>
39 #include <kconfiggroup.h>
40 #include <kapplication.h>
41 #include <KColorScheme>
42 
43 #include <QColor>
44 #include <QFont>
45 #include <QPalette>
46 
47 namespace MessageViewer {
48 
49 CSSHelper::CSSHelper( const QPaintDevice *pd ) :
50  CSSHelperBase( pd )
51 {
52  KConfig *config = GlobalSettings::self()->config();
53 
54  KConfigGroup reader( config, "Reader" );
55  KConfigGroup fonts( config, "Fonts" );
56  KConfigGroup pixmaps( config, "Pixmaps" );
57 
58  mRecycleQuoteColors = reader.readEntry( "RecycleQuoteColors", false );
59 
60  mForegroundColor = KColorScheme( QPalette::Active ).foreground().color();
61  if ( !MessageCore::GlobalSettings::self()->useDefaultColors() ) {
62  mLinkColor =
63  reader.readEntry( "LinkColor", mLinkColor );
64  mVisitedLinkColor =
65  reader.readEntry( "FollowedColor", mVisitedLinkColor );
66  cPgpEncrH =
67  reader.readEntry( "PGPMessageEncr", cPgpEncrH );
68  cPgpOk1H =
69  reader.readEntry( "PGPMessageOkKeyOk", cPgpOk1H );
70  cPgpOk0H =
71  reader.readEntry( "PGPMessageOkKeyBad", cPgpOk0H );
72  cPgpWarnH =
73  reader.readEntry( "PGPMessageWarn", cPgpWarnH );
74  cPgpErrH =
75  reader.readEntry( "PGPMessageErr", cPgpErrH );
76  cHtmlWarning =
77  reader.readEntry( "HTMLWarningColor", cHtmlWarning );
78  for ( int i = 0 ; i < 3 ; ++i ) {
79  const QString key = QLatin1String("QuotedText") + QString::number( i+1 );
80  mQuoteColor[i] = reader.readEntry( key, mQuoteColor[i] );
81  }
82  mBackgroundColor = reader.readEntry( "BackgroundColor", mBackgroundColor );
83  }
84 
85  if ( !MessageCore::GlobalSettings::self()->useDefaultFonts() ) {
86  mBodyFont = fonts.readEntry( "body-font", mBodyFont );
87  mPrintFont = fonts.readEntry( "print-font", mPrintFont );
88  mFixedFont = fonts.readEntry( "fixed-font", mFixedFont );
89  mFixedPrintFont = mFixedFont; // FIXME when we have a separate fixed print font
90  QFont defaultFont = mBodyFont;
91  defaultFont.setItalic( true );
92  for ( int i = 0 ; i < 3 ; ++i ) {
93  const QString key = QString::fromLatin1( "quote%1-font" ).arg( i+1 );
94  mQuoteFont[i] = fonts.readEntry( key, defaultFont );
95  }
96  }
97 
98  mShrinkQuotes = GlobalSettings::self()->shrinkQuotes();
99 
100  mBackingPixmapStr = pixmaps.readPathEntry("Readerwin", QString());
101  mBackingPixmapOn = !mBackingPixmapStr.isEmpty();
102 
103  recalculatePGPColors();
104 }
105 
106 QString CSSHelper::htmlHead( bool fixed ) const {
107  return
108  QLatin1String("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
109  "<html><head><title></title><style>\n")
110  + cssDefinitions( fixed ) +
111  QLatin1String("</style></head>\n"
112  "<body>\n");
113 }
114 
115 }
116 
MessageViewer::CSSHelperBase::mShrinkQuotes
bool mShrinkQuotes
Definition: csshelperbase.h:87
MessageViewer::CSSHelperBase::mQuoteFont
QFont mQuoteFont[3]
Definition: csshelperbase.h:83
globalsettings.h
MessageViewer::CSSHelperBase::cPgpErrH
QColor cPgpErrH
Definition: csshelperbase.h:91
MessageViewer::CSSHelper::htmlHead
QString htmlHead(bool fixedFont=false) const
Definition: csshelper.cpp:106
MessageViewer::CSSHelperBase::recalculatePGPColors
void recalculatePGPColors()
Recalculate PGP frame and body colors (should be called after changing color settings) ...
Definition: csshelperbase.cpp:114
MessageViewer::CSSHelperBase::mBackingPixmapOn
bool mBackingPixmapOn
Definition: csshelperbase.h:86
MessageViewer::CSSHelperBase::mBackgroundColor
QColor mBackgroundColor
Definition: csshelperbase.h:89
MessageViewer::CSSHelperBase::mFixedFont
QFont mFixedFont
Definition: csshelperbase.h:82
MessageViewer::CSSHelperBase::cPgpWarnH
QColor cPgpWarnH
Definition: csshelperbase.h:91
MessageViewer::CSSHelperBase
Definition: csshelperbase.h:44
MessageViewer::GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:34
MessageViewer::CSSHelperBase::mFixedPrintFont
QFont mFixedPrintFont
Definition: csshelperbase.h:82
MessageViewer::CSSHelperBase::cPgpOk1H
QColor cPgpOk1H
Definition: csshelperbase.h:91
MessageViewer::CSSHelperBase::cssDefinitions
QString cssDefinitions(bool fixedFont=false) const
Definition: csshelperbase.cpp:165
MessageViewer::CSSHelperBase::mVisitedLinkColor
QColor mVisitedLinkColor
Definition: csshelperbase.h:89
MessageViewer::CSSHelperBase::mRecycleQuoteColors
bool mRecycleQuoteColors
Definition: csshelperbase.h:85
MessageViewer::CSSHelperBase::mLinkColor
QColor mLinkColor
Definition: csshelperbase.h:89
MessageViewer::CSSHelperBase::cPgpOk0H
QColor cPgpOk0H
Definition: csshelperbase.h:91
MessageViewer::CSSHelperBase::mBackingPixmapStr
QString mBackingPixmapStr
Definition: csshelperbase.h:88
MessageViewer::CSSHelperBase::mForegroundColor
QColor mForegroundColor
Definition: csshelperbase.h:89
MessageViewer::CSSHelperBase::cHtmlWarning
QColor cHtmlWarning
Definition: csshelperbase.h:97
MessageViewer::CSSHelperBase::mPrintFont
QFont mPrintFont
Definition: csshelperbase.h:82
MessageViewer::CSSHelper::CSSHelper
CSSHelper(const QPaintDevice *pd)
Definition: csshelper.cpp:49
MessageViewer::CSSHelperBase::cPgpEncrH
QColor cPgpEncrH
Definition: csshelperbase.h:91
MessageViewer::CSSHelperBase::mBodyFont
QFont mBodyFont
Definition: csshelperbase.h:82
csshelper.h
MessageViewer::CSSHelperBase::mQuoteColor
QColor mQuoteColor[3]
Definition: csshelperbase.h:84
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal