kmail Library API Documentation

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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Qt library by Trolltech AS, Norway (or with modified versions 00023 of Qt that use the same license as Qt), 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 Qt. 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 <config.h> 00033 00034 #include "csshelper.h" 00035 00036 #include "kmkernel.h" 00037 00038 #include <kconfig.h> 00039 #include <kglobalsettings.h> 00040 #include <kdebug.h> 00041 #include <kglobal.h> 00042 00043 #include <qcolor.h> 00044 #include <qfont.h> 00045 #include <qstring.h> 00046 #include <qapplication.h> 00047 00048 #include <cassert> 00049 00050 namespace KMail { 00051 00052 class CSSHelper::Private { 00053 friend class CSSHelper; 00054 public: 00055 Private() {} 00056 ~Private() {} 00057 00058 bool operator==( const Private & other ) const; 00059 bool operator!=( const Private & other ) const { 00060 return !operator==( other ); 00061 } 00062 00063 void readColorConfig(); 00064 00065 // returns CSS rules specific to the print media type 00066 QString printCssDefinitions() const; 00067 00068 // returns CSS rules specific to the screen media type 00069 QString screenCssDefinitions( const CSSHelper * helper, bool fixed ) const; 00070 00071 // returns CSS rules common to both screen and print media types 00072 QString commonCssDefinitions() const; 00073 00074 QFont bodyFont( bool fixed, bool print=false ) const { 00075 return fixed ? mFixedFont : print ? mPrintFont : mBodyFont ; 00076 } 00077 int fontSize( bool fixed, bool print=false ) const { 00078 return bodyFont( fixed, print ).pointSize(); 00079 } 00080 00081 QString quoteFontTag( int level ) const; 00082 00083 private: 00084 QFont mBodyFont, mPrintFont, mFixedFont; 00085 QFont mQuoteFont[3]; 00086 QColor mQuoteColor[3]; 00087 bool mRecycleQuoteColors; 00088 bool mBackingPixmapOn; 00089 QString mBackingPixmapStr; 00090 QColor c1, c2, c3, c4; 00091 // colors for PGP (Frame, Header, Body) 00092 QColor cPgpOk1F, cPgpOk1H, cPgpOk1B, 00093 cPgpOk0F, cPgpOk0H, cPgpOk0B, 00094 cPgpWarnF, cPgpWarnH, cPgpWarnB, 00095 cPgpErrF, cPgpErrH, cPgpErrB, 00096 cPgpEncrF, cPgpEncrH, cPgpEncrB; 00097 // color of frame of warning preceding the source of HTML messages 00098 QColor cHtmlWarning; 00099 }; 00100 00101 bool CSSHelper::Private::operator==( const Private & other ) const { 00102 for ( int i = 0 ; i < 3 ; ++i ) 00103 if ( mQuoteFont[i] != other.mQuoteFont[i] || 00104 mQuoteColor[i] != other.mQuoteColor[i] ) 00105 return false; 00106 return // eeek! 00107 mBodyFont == other.mBodyFont && 00108 mPrintFont == other.mPrintFont && 00109 mFixedFont == other.mFixedFont && 00110 mRecycleQuoteColors == other.mRecycleQuoteColors && 00111 mBackingPixmapOn == other.mBackingPixmapOn && 00112 mBackingPixmapStr == other.mBackingPixmapStr && 00113 c1 == other.c1 && c2 == other.c2 && c3 == other.c3 && c4 == other.c4 && 00114 cHtmlWarning == other.cHtmlWarning && 00115 cPgpOk1F == other.cPgpOk1F && cPgpOk1H == other.cPgpOk1H && cPgpOk1B == other.cPgpOk1B && 00116 cPgpOk0F == other.cPgpOk0F && cPgpOk0H == other.cPgpOk0H && cPgpOk0B == other.cPgpOk0B && 00117 cPgpWarnF == other.cPgpWarnF && cPgpWarnH == other.cPgpWarnH && cPgpWarnB == other.cPgpWarnB && 00118 cPgpErrF == other.cPgpErrF && cPgpErrH == other.cPgpErrH && cPgpErrB == other.cPgpErrB && 00119 cPgpEncrF == other.cPgpEncrF && cPgpEncrH == other.cPgpEncrH && cPgpEncrB == other.cPgpEncrB ; 00120 } 00121 00122 namespace { 00123 // some QColor manipulators that hide the ugly QColor API w.r.t. HSV: 00124 inline QColor darker( const QColor & c ) { 00125 int h, s, v; 00126 c.hsv( &h, &s, &v ); 00127 return QColor( h, s, v*4/5, QColor::Hsv ); 00128 } 00129 00130 inline QColor desaturate( const QColor & c ) { 00131 int h, s, v; 00132 c.hsv( &h, &s, &v ); 00133 return QColor( h, s/8, v, QColor::Hsv ); 00134 } 00135 00136 inline QColor fixValue( const QColor & c, int newV ) { 00137 int h, s, v; 00138 c.hsv( &h, &s, &v ); 00139 return QColor( h, s, newV, QColor::Hsv ); 00140 } 00141 00142 inline int getValueOf( const QColor & c ) { 00143 int h, s, v; 00144 c.hsv( &h, &s, &v ); 00145 return v; 00146 } 00147 } 00148 00149 void CSSHelper::Private::readColorConfig() { 00150 KConfig * config = KMKernel::config(); 00151 00152 KConfigGroup reader( config, "Reader" ); 00153 KConfigGroup fonts( config, "Fonts" ); 00154 KConfigGroup pixmaps( config, "Pixmaps" ); 00155 00156 c1 = QApplication::palette().active().text(); 00157 c2 = KGlobalSettings::linkColor(); 00158 c3 = KGlobalSettings::visitedLinkColor(); 00159 c4 = QApplication::palette().active().base(); 00160 cHtmlWarning = QColor( 0xFF, 0x40, 0x40 ); // warning frame color: light red 00161 00162 // The default colors are also defined in configuredialog.cpp 00163 cPgpEncrH = QColor( 0x00, 0x80, 0xFF ); // light blue 00164 cPgpOk1H = QColor( 0x40, 0xFF, 0x40 ); // light green 00165 cPgpOk0H = QColor( 0xFF, 0xFF, 0x40 ); // light yellow 00166 cPgpWarnH = QColor( 0xFF, 0xFF, 0x40 ); // light yellow 00167 cPgpErrH = Qt::red; 00168 00169 for ( int i = 0 ; i < 3 ; ++i ) 00170 mQuoteColor[i] = QColor( 0x00, 0x80 - i * 0x10, 0x00 ); // shades of green 00171 mRecycleQuoteColors = reader.readBoolEntry( "RecycleQuoteColors", false ); 00172 00173 if ( !reader.readBoolEntry( "defaultColors", true ) ) { 00174 c1 = reader.readColorEntry("ForegroundColor",&c1); 00175 c2 = reader.readColorEntry("LinkColor",&c2); 00176 c3 = reader.readColorEntry("FollowedColor",&c3); 00177 c4 = reader.readColorEntry("BackgroundColor",&c4); 00178 cPgpEncrH = reader.readColorEntry( "PGPMessageEncr", &cPgpEncrH ); 00179 cPgpOk1H = reader.readColorEntry( "PGPMessageOkKeyOk", &cPgpOk1H ); 00180 cPgpOk0H = reader.readColorEntry( "PGPMessageOkKeyBad", &cPgpOk0H ); 00181 cPgpWarnH = reader.readColorEntry( "PGPMessageWarn", &cPgpWarnH ); 00182 cPgpErrH = reader.readColorEntry( "PGPMessageErr", &cPgpErrH ); 00183 cHtmlWarning = reader.readColorEntry( "HTMLWarningColor", &cHtmlWarning ); 00184 for ( int i = 0 ; i < 3 ; ++i ) { 00185 const QString key = "QuotedText" + QString::number( i+1 ); 00186 mQuoteColor[i] = reader.readColorEntry( key, &mQuoteColor[i] ); 00187 } 00188 } 00189 00190 // determine the frame and body color for PGP messages from the header color 00191 // if the header color equals the background color then the other colors are 00192 // also set to the background color (-> old style PGP message viewing) 00193 // else 00194 // the brightness of the frame is set to 4/5 of the brightness of the header 00195 // and in case of a light background color 00196 // the saturation of the body is set to 1/8 of the saturation of the header 00197 // while in case of a dark background color 00198 // the value of the body is set to the value of the background color 00199 00200 // Check whether the user uses a light color scheme 00201 const int vBG = getValueOf( c4 ); 00202 const bool lightBG = vBG >= 128; 00203 if ( cPgpOk1H == c4 ) { 00204 cPgpOk1F = c4; 00205 cPgpOk1B = c4; 00206 } else { 00207 cPgpOk1F= darker( cPgpOk1H ); 00208 cPgpOk1B = lightBG ? desaturate( cPgpOk1H ) : fixValue( cPgpOk1H, vBG ); 00209 } 00210 if ( cPgpOk0H == c4 ) { 00211 cPgpOk0F = c4; 00212 cPgpOk0B = c4; 00213 } else { 00214 cPgpOk0F = darker( cPgpOk0H ); 00215 cPgpOk0B = lightBG ? desaturate( cPgpOk0H ) : fixValue( cPgpOk0H, vBG ); 00216 } 00217 if ( cPgpWarnH == c4 ) { 00218 cPgpWarnF = c4; 00219 cPgpWarnB = c4; 00220 } else { 00221 cPgpWarnF = darker( cPgpWarnH ); 00222 cPgpWarnB = lightBG ? desaturate( cPgpWarnH ) : fixValue( cPgpWarnH, vBG ); 00223 } 00224 if ( cPgpErrH == c4 ) { 00225 cPgpErrF = c4; 00226 cPgpErrB = c4; 00227 } else { 00228 cPgpErrF = darker( cPgpErrH ); 00229 cPgpErrB = lightBG ? desaturate( cPgpErrH ) : fixValue( cPgpErrH, vBG ); 00230 } 00231 if ( cPgpEncrH == c4 ) { 00232 cPgpEncrF = c4; 00233 cPgpEncrB = c4; 00234 } else { 00235 cPgpEncrF = darker( cPgpEncrH ); 00236 cPgpEncrB = lightBG ? desaturate( cPgpEncrH ) : fixValue( cPgpEncrH, vBG ); 00237 } 00238 00239 QFont defaultFont = KGlobalSettings::generalFont(); 00240 if ( fonts.readBoolEntry( "defaultFonts", true ) ) { 00241 mBodyFont = mPrintFont = defaultFont; 00242 mFixedFont = KGlobalSettings::fixedFont(); 00243 defaultFont.setItalic( true ); 00244 for ( int i = 0 ; i < 3 ; ++i ) 00245 mQuoteFont[i] = defaultFont; 00246 } else { 00247 mBodyFont = fonts.readFontEntry( "body-font", &defaultFont); 00248 mPrintFont = fonts.readFontEntry( "print-font", &defaultFont); 00249 mFixedFont = fonts.readFontEntry( "fixed-font", &defaultFont); 00250 defaultFont.setItalic( true ); 00251 for ( int i = 0 ; i < 3 ; ++i ) { 00252 const QString key = QString( "quote%1-font" ).arg( i+1 ); 00253 mQuoteFont[i] = fonts.readFontEntry( key, &defaultFont ); 00254 } 00255 } 00256 00257 mBackingPixmapStr = pixmaps.readPathEntry("Readerwin"); 00258 mBackingPixmapOn = !mBackingPixmapStr.isEmpty(); 00259 } 00260 00261 CSSHelper::CSSHelper( const QPaintDeviceMetrics & pdm, QObject * parent, const char * name ) 00262 : ConfigManager( parent, name ), 00263 d( 0 ), s( 0 ), mMetrics( pdm ) 00264 { 00265 d = new Private(); 00266 d->readColorConfig(); 00267 } 00268 00269 CSSHelper::~CSSHelper() { 00270 kdWarning( hasPendingChanges(), 5006 ) 00271 << "CSSHelper: There were uncommitted changes!" << endl; 00272 delete d; d = 0; 00273 delete s; s = 0; 00274 } 00275 00276 void CSSHelper::commit() { 00277 // not yet implemented 00278 } 00279 00280 void CSSHelper::rollback() { 00281 delete s; s = 0; 00282 } 00283 00284 bool CSSHelper::hasPendingChanges() const { 00285 assert( d ); 00286 return s && *s != *d ; 00287 } 00288 00289 QString CSSHelper::cssDefinitions( bool fixed ) const { 00290 assert( d ); 00291 return 00292 d->commonCssDefinitions() 00293 + 00294 "@media screen {\n\n" 00295 + 00296 d->screenCssDefinitions( this, fixed ) 00297 + 00298 "}\n" 00299 "@media print {\n\n" 00300 + 00301 d->printCssDefinitions() 00302 + 00303 "}\n"; 00304 } 00305 00306 QString CSSHelper::htmlHead( bool fixed ) const { 00307 return 00308 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" 00309 "<html><head><title></title></head>\n" 00310 + 00311 QString( fixed ? "<body class\"fixedfont\">\n" : "<body>\n" ); 00312 } 00313 00314 QString CSSHelper::Private::quoteFontTag( int level ) const { 00315 if ( level < 0 ) 00316 level = 0; 00317 static const int numQuoteLevels = sizeof mQuoteFont / sizeof *mQuoteFont ; 00318 const int effectiveLevel = mRecycleQuoteColors 00319 ? level % numQuoteLevels + 1 00320 : kMin( level + 1, numQuoteLevels ) ; 00321 return QString( "<div class=\"quotelevel%1\">" ).arg( effectiveLevel ); 00322 } 00323 00324 QString CSSHelper::quoteFontTag( int level ) const { 00325 assert( d ); 00326 return d->quoteFontTag( level ); 00327 } 00328 00329 QString CSSHelper::nonQuotedFontTag() const { 00330 return "<div class=\"noquote\">"; 00331 } 00332 00333 QFont CSSHelper::bodyFont( bool fixed, bool print ) const { 00334 assert( d ); 00335 return d->bodyFont( fixed, print ); 00336 } 00337 00338 namespace { 00339 int pointsToPixel( const QPaintDeviceMetrics & metrics, int pointSize ) { 00340 return ( pointSize * metrics.logicalDpiY() + 36 ) / 72 ; 00341 } 00342 } 00343 00344 QString CSSHelper::Private::printCssDefinitions() const { 00345 const QString headerFont = QString( " font-family: \"%1\" ! important;\n" 00346 " font-size: %2pt ! important;\n" ) 00347 .arg( mPrintFont.family() ) 00348 .arg( mPrintFont.pointSize() ); 00349 const QColorGroup & cg = QApplication::palette().active(); 00350 00351 QString quoteCSS; 00352 if ( mPrintFont.italic() ) 00353 quoteCSS += " font-style: italic ! important;\n"; 00354 if ( mPrintFont.bold() ) 00355 quoteCSS += " font-weight: bold ! important;\n"; 00356 if ( !quoteCSS.isEmpty() ) 00357 quoteCSS = "div.noquote {\n" + quoteCSS + "}\n\n"; 00358 00359 return 00360 QString( "body {\n" 00361 " font-family: \"%1\" ! important;\n" 00362 " font-size: %2pt ! important;\n" 00363 " color: #000000 ! important;\n" 00364 " background-color: #ffffff ! important\n" 00365 "}\n\n" ) 00366 .arg( mPrintFont.family(), 00367 QString::number( mPrintFont.pointSize() ) ) 00368 + 00369 QString( "tr.textAtmH,\n" 00370 "tr.rfc822H,\n" 00371 "tr.encrH,\n" 00372 "tr.signOkKeyOkH,\n" 00373 "tr.signOkKeyBadH,\n" 00374 "tr.signWarnH,\n" 00375 "tr.signErrH,\n" 00376 "div.header {\n" 00377 "%1" 00378 "}\n\n" 00379 00380 "div.fancy.header > div {\n" 00381 " background-color: %2 ! important;\n" 00382 " color: %3 ! important;\n" 00383 " padding: 4px ! important;\n" 00384 " border: solid %3 1px ! important;\n" 00385 "}\n\n" 00386 00387 "div.fancy.header > div a[href] { color: %3 ! important; }\n\n" 00388 00389 "div.fancy.header > table.outer{\n" 00390 " background-color: %2 ! important;\n" 00391 " color: %3 ! important;\n" 00392 " border-bottom: solid %3 1px ! important;\n" 00393 " border-left: solid %3 1px ! important;\n" 00394 " border-right: solid %3 1px ! important;\n" 00395 "}\n\n" 00396 00397 "div.fancy.header > div.sender-pic{\n" 00398 " font-size:0.8em;\n" 00399 " border:1px solid black;\n" 00400 " background-color:InfoBackground;\n" 00401 "}\n\n" 00402 00403 "div.fancy.header > div.sender-status{\n" 00404 " text-align:center;\n" 00405 "}\n\n" 00406 00407 "div.htmlWarn {\n" 00408 " border: 2px solid #ffffff ! important;\n" 00409 "}\n\n" 00410 "div.senderStatus {\n" 00411 00412 ) 00413 .arg( headerFont, 00414 cg.background().name(), 00415 cg.foreground().name() ) 00416 + quoteCSS; 00417 } 00418 00419 QString CSSHelper::Private::screenCssDefinitions( const CSSHelper * helper, bool fixed ) const { 00420 const QString fgColor = c1.name(); 00421 const QString bgColor = c4.name(); 00422 const QString linkColor = c2.name(); 00423 const QString headerFont = QString(" font-family: \"%1\" ! important;\n" 00424 " font-size: %2px ! important;\n") 00425 .arg( mBodyFont.family() ) 00426 .arg( pointsToPixel( helper->mMetrics, mBodyFont.pointSize() ) ); 00427 const QString background = ( mBackingPixmapOn 00428 ? QString( " background-image:url(file://%1) ! important;\n" ) 00429 .arg( mBackingPixmapStr ) 00430 : QString( " background-color: %1 ! important;\n" ) 00431 .arg( bgColor ) ); 00432 const QString bodyFontSize = QString::number( pointsToPixel( helper->mMetrics, fontSize( fixed ) ) ) + "px" ; 00433 const QColorGroup & cg = QApplication::palette().active(); 00434 00435 QString quoteCSS; 00436 if ( bodyFont( fixed ).italic() ) 00437 quoteCSS += " font-style: italic ! important;\n"; 00438 if ( bodyFont( fixed ).bold() ) 00439 quoteCSS += " font-weight: bold ! important;\n"; 00440 if ( !quoteCSS.isEmpty() ) 00441 quoteCSS = "div.noquote {\n" + quoteCSS + "}\n\n"; 00442 00443 for ( int i = 0 ; i < 3 ; ++i ) { 00444 quoteCSS += QString( "div.quotelevel%1 {\n" 00445 " color: %2 ! important;\n" ) 00446 .arg( QString::number(i+1), mQuoteColor[i].name() ); 00447 if ( mQuoteFont[i].italic() ) 00448 quoteCSS += " font-style: italic ! important;\n"; 00449 if ( mQuoteFont[i].bold() ) 00450 quoteCSS += " font-weight: bold ! important;\n"; 00451 quoteCSS += "}\n\n"; 00452 } 00453 00454 return 00455 QString( "body {\n" 00456 " font-family: \"%1\" ! important;\n" 00457 " font-size: %2 ! important;\n" 00458 " color: %3 ! important;\n" 00459 "%4" 00460 "}\n\n" ) 00461 .arg( bodyFont( fixed ).family(), 00462 bodyFontSize, 00463 fgColor, 00464 background ) 00465 + 00466 QString( "a {\n" 00467 " color: %1 ! important;\n" 00468 " text-decoration: none ! important;\n" 00469 "}\n\n" 00470 00471 "table.textAtm { background-color: %2 ! important; }\n\n" 00472 00473 "tr.textAtmH {\n" 00474 " background-color: %3 ! important;\n" 00475 "%4" 00476 "}\n\n" 00477 00478 "tr.textAtmB {\n" 00479 " background-color: %3 ! important;\n" 00480 "}\n\n" 00481 00482 "table.rfc822 {\n" 00483 " background-color: %3 ! important;\n" 00484 "}\n\n" 00485 00486 "tr.rfc822H {\n" 00487 "%4" 00488 "}\n\n" ) 00489 .arg( linkColor, fgColor, bgColor, headerFont ) 00490 + 00491 QString( "table.encr {\n" 00492 " background-color: %1 ! important;\n" 00493 "}\n\n" 00494 00495 "tr.encrH {\n" 00496 " background-color: %2 ! important;\n" 00497 "%3" 00498 "}\n\n" 00499 00500 "tr.encrB { background-color: %4 ! important; }\n\n" ) 00501 .arg( cPgpEncrF.name(), 00502 cPgpEncrH.name(), 00503 headerFont, 00504 cPgpEncrB.name() ) 00505 + 00506 QString( "table.signOkKeyOk {\n" 00507 " background-color: %1 ! important;\n" 00508 "}\n\n" 00509 00510 "tr.signOkKeyOkH {\n" 00511 " background-color: %2 ! important;\n" 00512 "%3" 00513 "}\n\n" 00514 00515 "tr.signOkKeyOkB { background-color: %4 ! important; }\n\n" ) 00516 .arg( cPgpOk1F.name(), 00517 cPgpOk1H.name(), 00518 headerFont, 00519 cPgpOk1B.name() ) 00520 + 00521 QString( "table.signOkKeyBad {\n" 00522 " background-color: %1 ! important;\n" 00523 "}\n\n" 00524 00525 "tr.signOkKeyBadH {\n" 00526 " background-color: %2 ! important;\n" 00527 "%3" 00528 "}\n\n" 00529 00530 "tr.signOkKeyBadB { background-color: %4 ! important; }\n\n" ) 00531 .arg( cPgpOk0F.name(), 00532 cPgpOk0H.name(), 00533 headerFont, 00534 cPgpOk0B.name() ) 00535 + 00536 QString( "table.signWarn {\n" 00537 " background-color: %1 ! important;\n" 00538 "}\n\n" 00539 00540 "tr.signWarnH {\n" 00541 " background-color: %2 ! important;\n" 00542 "%3" 00543 "}\n\n" 00544 00545 "tr.signWarnB { background-color: %4 ! important; }\n\n" ) 00546 .arg( cPgpWarnF.name(), 00547 cPgpWarnH.name(), 00548 headerFont, 00549 cPgpWarnB.name() ) 00550 + 00551 QString( "table.signErr {\n" 00552 " background-color: %1 ! important;\n" 00553 "}\n\n" 00554 00555 "tr.signErrH {\n" 00556 " background-color: %2 ! important;\n" 00557 "%3" 00558 "}\n\n" 00559 00560 "tr.signErrB { background-color: %4 ! important; }\n\n" ) 00561 .arg( cPgpErrF.name(), 00562 cPgpErrH.name(), 00563 headerFont, 00564 cPgpErrB.name() ) 00565 + 00566 QString( "div.htmlWarn {\n" 00567 " border: 2px solid %1 ! important;\n" 00568 "}\n\n" ) 00569 .arg( cHtmlWarning.name() ) 00570 + 00571 QString( "div.header {\n" 00572 "%1" 00573 "}\n\n" 00574 00575 "div.fancy.header > div {\n" 00576 " background-color: %2 ! important;\n" 00577 " color: %3 ! important;\n" 00578 " border: solid %4 1px ! important;\n" 00579 "}\n\n" 00580 00581 "div.fancy.header > div a[href] { color: %3 ! important; }\n\n" 00582 00583 "div.fancy.header > div a[href]:hover { text-decoration: underline ! important; }\n\n" 00584 00585 "div.fancy.header > table.outer {\n" 00586 " background-color: %5 ! important;\n" 00587 " color: %4 ! important;\n" 00588 " border-bottom: solid %4 1px ! important;\n" 00589 " border-left: solid %4 1px ! important;\n" 00590 " border-right: solid %4 1px ! important;\n" 00591 "}\n\n" 00592 00593 "div.senderpic{\n" 00594 " font-size:0.8em;\n" 00595 " border:1px solid black;\n" 00596 // FIXME: InfoBackground crashes KHTML 00597 //" background-color:InfoBackground;\n" 00598 " background-color:yellow;\n" 00599 "}\n\n" 00600 00601 "div.senderstatus{\n" 00602 " text-align:center;\n" 00603 "}\n\n" ) 00604 00605 .arg( headerFont ) 00606 .arg( cg.highlight().name(), 00607 cg.highlightedText().name(), 00608 cg.foreground().name(), 00609 cg.background().name() ) 00610 + quoteCSS; 00611 } 00612 00613 QString CSSHelper::Private::commonCssDefinitions() const { 00614 return 00615 "div.header {\n" 00616 " margin-bottom: 10pt ! important;\n" 00617 "}\n\n" 00618 00619 "table.textAtm {\n" 00620 " margin-top: 10pt ! important;\n" 00621 " margin-bottom: 10pt ! important;\n" 00622 "}\n\n" 00623 00624 "tr.textAtmH,\n" 00625 "tr.textAtmB,\n" 00626 "tr.rfc822B {\n" 00627 " font-weight: normal ! important;\n" 00628 "}\n\n" 00629 00630 "tr.rfc822H,\n" 00631 "tr.encrH,\n" 00632 "tr.signOkKeyOkH,\n" 00633 "tr.signOkKeyBadH,\n" 00634 "tr.signWarnH,\n" 00635 "tr.signErrH {\n" 00636 " font-weight: bold ! important;\n" 00637 "}\n\n" 00638 00639 "tr.textAtmH td,\n" 00640 "tr.textAtmB td {\n" 00641 " padding: 3px ! important;\n" 00642 "}\n\n" 00643 00644 "table.rfc822 {\n" 00645 " width: 100% ! important;\n" 00646 " border: solid 1px black ! important;\n" 00647 " margin-top: 10pt ! important;\n" 00648 " margin-bottom: 10pt ! important;\n" 00649 "}\n\n" 00650 00651 "table.textAtm,\n" 00652 "table.encr,\n" 00653 "table.signWarn,\n" 00654 "table.signErr,\n" 00655 "table.signOkKeyBad,\n" 00656 "table.signOkKeyOk,\n" 00657 "div.fancy.header table {\n" 00658 " width: 100% ! important;\n" 00659 " border-width: 0px ! important;\n" 00660 "}\n\n" 00661 00662 "div.htmlWarn {\n" 00663 " margin: 0px 5% ! important;\n" 00664 " padding: 10px ! important;\n" 00665 " text-align: left ! important;\n" 00666 "}\n\n" 00667 00668 "div.fancy.header > div {\n" 00669 " font-weight: bold ! important;\n" 00670 " padding: 4px ! important;\n" 00671 "}\n\n" 00672 00673 "div.fancy.header table {\n" 00674 " padding: 2px ! important;\n" // ### khtml bug: this is ignored 00675 " text-align: left ! important\n" 00676 "}\n\n" 00677 00678 "div.fancy.header table th {\n" 00679 " padding: 0px ! important;\n" 00680 " white-space: nowrap ! important;\n" 00681 " border-spacing: 0px ! important;\n" 00682 " text-align: left ! important;\n" 00683 " vertical-align: top ! important;\n" 00684 "}\n\n" 00685 00686 "div.fancy.header table td {\n" 00687 " padding: 0px ! important;\n" 00688 " border-spacing: 0px ! important;\n" 00689 " text-align: left ! important;\n" 00690 " vertical-align: top ! important;\n" 00691 " width: 100% ! important;\n" 00692 "}\n\n" 00693 ; 00694 } 00695 00696 } // namespace KMail 00697
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:52:15 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003