diff options
Diffstat (limited to 'libkdepim/csshelper.cpp')
-rw-r--r-- | libkdepim/csshelper.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/libkdepim/csshelper.cpp b/libkdepim/csshelper.cpp index 2e2c11379..b65713dd2 100644 --- a/libkdepim/csshelper.cpp +++ b/libkdepim/csshelper.cpp @@ -36,61 +36,61 @@ #include <kdebug.h> #include <kglobal.h> -#include <qstring.h> -#include <qapplication.h> +#include <tqstring.h> +#include <tqapplication.h> namespace KPIM { namespace { - // some QColor manipulators that hide the ugly QColor API w.r.t. HSV: - inline QColor darker( const QColor & c ) { + // some TQColor manipulators that hide the ugly TQColor API w.r.t. HSV: + inline TQColor darker( const TQColor & c ) { int h, s, v; c.hsv( &h, &s, &v ); - return QColor( h, s, v*4/5, QColor::Hsv ); + return TQColor( h, s, v*4/5, TQColor::Hsv ); } - inline QColor desaturate( const QColor & c ) { + inline TQColor desaturate( const TQColor & c ) { int h, s, v; c.hsv( &h, &s, &v ); - return QColor( h, s/8, v, QColor::Hsv ); + return TQColor( h, s/8, v, TQColor::Hsv ); } - inline QColor fixValue( const QColor & c, int newV ) { + inline TQColor fixValue( const TQColor & c, int newV ) { int h, s, v; c.hsv( &h, &s, &v ); - return QColor( h, s, newV, QColor::Hsv ); + return TQColor( h, s, newV, TQColor::Hsv ); } - inline int getValueOf( const QColor & c ) { + inline int getValueOf( const TQColor & c ) { int h, s, v; c.hsv( &h, &s, &v ); return v; } } - CSSHelper::CSSHelper( const QPaintDeviceMetrics &pdm ) : + CSSHelper::CSSHelper( const TQPaintDeviceMetrics &pdm ) : mShrinkQuotes( false ), mMetrics( pdm ) { // initialize with defaults - should match the corresponding application defaults - mForegroundColor = QApplication::palette().active().text(); + mForegroundColor = TQApplication::palette().active().text(); mLinkColor = KGlobalSettings::linkColor(); mVisitedLinkColor = KGlobalSettings::visitedLinkColor(); - mBackgroundColor = QApplication::palette().active().base(); - cHtmlWarning = QColor( 0xFF, 0x40, 0x40 ); // warning frame color: light red + mBackgroundColor = TQApplication::palette().active().base(); + cHtmlWarning = TQColor( 0xFF, 0x40, 0x40 ); // warning frame color: light red - cPgpEncrH = QColor( 0x00, 0x80, 0xFF ); // light blue - cPgpOk1H = QColor( 0x40, 0xFF, 0x40 ); // light green - cPgpOk0H = QColor( 0xFF, 0xFF, 0x40 ); // light yellow - cPgpWarnH = QColor( 0xFF, 0xFF, 0x40 ); // light yellow + cPgpEncrH = TQColor( 0x00, 0x80, 0xFF ); // light blue + cPgpOk1H = TQColor( 0x40, 0xFF, 0x40 ); // light green + cPgpOk0H = TQColor( 0xFF, 0xFF, 0x40 ); // light yellow + cPgpWarnH = TQColor( 0xFF, 0xFF, 0x40 ); // light yellow cPgpErrH = Qt::red; for ( int i = 0 ; i < 3 ; ++i ) - mQuoteColor[i] = QColor( 0x00, 0x80 - i * 0x10, 0x00 ); // shades of green + mQuoteColor[i] = TQColor( 0x00, 0x80 - i * 0x10, 0x00 ); // shades of green mRecycleQuoteColors = false; - QFont defaultFont = KGlobalSettings::generalFont(); - QFont defaultFixedFont = KGlobalSettings::fixedFont(); + TQFont defaultFont = KGlobalSettings::generalFont(); + TQFont defaultFixedFont = KGlobalSettings::fixedFont(); mBodyFont = mPrintFont = defaultFont; mFixedFont = mFixedPrintFont = defaultFixedFont; defaultFont.setItalic( true ); @@ -153,7 +153,7 @@ namespace KPIM { } } - QString CSSHelper::cssDefinitions( bool fixed ) const { + TQString CSSHelper::cssDefinitions( bool fixed ) const { return commonCssDefinitions() + @@ -169,14 +169,14 @@ namespace KPIM { "}\n"; } - QString CSSHelper::htmlHead( bool /*fixed*/ ) const { + TQString CSSHelper::htmlHead( bool /*fixed*/ ) const { return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" "<html><head><title></title></head>\n" "<body>\n"; } - QString CSSHelper::quoteFontTag( int level ) const { + TQString CSSHelper::quoteFontTag( int level ) const { if ( level < 0 ) level = 0; static const int numQuoteLevels = sizeof mQuoteFont / sizeof *mQuoteFont; @@ -184,16 +184,16 @@ namespace KPIM { ? level % numQuoteLevels + 1 : kMin( level + 1, numQuoteLevels ) ; if ( level >= numQuoteLevels ) - return QString( "<div class=\"deepquotelevel%1\">" ).arg( effectiveLevel ); + return TQString( "<div class=\"deepquotelevel%1\">" ).arg( effectiveLevel ); else - return QString( "<div class=\"quotelevel%1\">" ).arg( effectiveLevel ); + return TQString( "<div class=\"quotelevel%1\">" ).arg( effectiveLevel ); } - QString CSSHelper::nonQuotedFontTag() const { + TQString CSSHelper::nonQuotedFontTag() const { return "<div class=\"noquote\">"; } - QFont CSSHelper::bodyFont( bool fixed, bool print ) const { + TQFont CSSHelper::bodyFont( bool fixed, bool print ) const { return fixed ? ( print ? mFixedPrintFont : mFixedFont ) : ( print ? mPrintFont : mBodyFont ); } @@ -204,22 +204,22 @@ namespace KPIM { namespace { - int pointsToPixel( const QPaintDeviceMetrics & metrics, int pointSize ) { + int pointsToPixel( const TQPaintDeviceMetrics & metrics, int pointSize ) { return ( pointSize * metrics.logicalDpiY() + 36 ) / 72 ; } } static const char * const quoteFontSizes[] = { "85", "80", "75" }; - QString CSSHelper::printCssDefinitions( bool fixed ) const { - const QString headerFont = QString( " font-family: \"%1\" ! important;\n" + TQString CSSHelper::printCssDefinitions( bool fixed ) const { + const TQString headerFont = TQString( " font-family: \"%1\" ! important;\n" " font-size: %2pt ! important;\n" ) .arg( mPrintFont.family() ) .arg( mPrintFont.pointSize() ); - const QColorGroup & cg = QApplication::palette().active(); + const TQColorGroup & cg = TQApplication::palette().active(); - const QFont printFont = bodyFont( fixed, true /* print */ ); - QString quoteCSS; + const TQFont printFont = bodyFont( fixed, true /* print */ ); + TQString quoteCSS; if ( printFont.italic() ) quoteCSS += " font-style: italic ! important;\n"; if ( printFont.bold() ) @@ -228,16 +228,16 @@ namespace KPIM { quoteCSS = "div.noquote {\n" + quoteCSS + "}\n\n"; return - QString( "body {\n" + TQString( "body {\n" " font-family: \"%1\" ! important;\n" " font-size: %2pt ! important;\n" " color: #000000 ! important;\n" " background-color: #ffffff ! important\n" "}\n\n" ) .arg( printFont.family(), - QString::number( printFont.pointSize() ) ) + TQString::number( printFont.pointSize() ) ) + - QString( "tr.textAtmH,\n" + TQString( "tr.textAtmH,\n" "tr.rfc822H,\n" "tr.encrH,\n" "tr.signOkKeyOkH,\n" @@ -293,23 +293,23 @@ namespace KPIM { + quoteCSS; } - QString CSSHelper::screenCssDefinitions( const CSSHelper * helper, bool fixed ) const { - const QString fgColor = mForegroundColor.name(); - const QString bgColor = mBackgroundColor.name(); - const QString linkColor = mLinkColor.name(); - const QString headerFont = QString(" font-family: \"%1\" ! important;\n" + TQString CSSHelper::screenCssDefinitions( const CSSHelper * helper, bool fixed ) const { + const TQString fgColor = mForegroundColor.name(); + const TQString bgColor = mBackgroundColor.name(); + const TQString linkColor = mLinkColor.name(); + const TQString headerFont = TQString(" font-family: \"%1\" ! important;\n" " font-size: %2px ! important;\n") .arg( mBodyFont.family() ) .arg( pointsToPixel( helper->mMetrics, mBodyFont.pointSize() ) ); - const QString background = ( mBackingPixmapOn - ? QString( " background-image:url(file://%1) ! important;\n" ) + const TQString background = ( mBackingPixmapOn + ? TQString( " background-image:url(file://%1) ! important;\n" ) .arg( mBackingPixmapStr ) - : QString( " background-color: %1 ! important;\n" ) + : TQString( " background-color: %1 ! important;\n" ) .arg( bgColor ) ); - const QString bodyFontSize = QString::number( pointsToPixel( helper->mMetrics, fontSize( fixed ) ) ) + "px" ; - const QColorGroup & cg = QApplication::palette().active(); + const TQString bodyFontSize = TQString::number( pointsToPixel( helper->mMetrics, fontSize( fixed ) ) ) + "px" ; + const TQColorGroup & cg = TQApplication::palette().active(); - QString quoteCSS; + TQString quoteCSS; if ( bodyFont( fixed ).italic() ) quoteCSS += " font-style: italic ! important;\n"; if ( bodyFont( fixed ).bold() ) @@ -319,24 +319,24 @@ namespace KPIM { // CSS definitions for quote levels 1-3 for ( int i = 0 ; i < 3 ; ++i ) { - quoteCSS += QString( "div.quotelevel%1 {\n" + quoteCSS += TQString( "div.quotelevel%1 {\n" " color: %2 ! important;\n" ) - .arg( QString::number(i+1), mQuoteColor[i].name() ); + .arg( TQString::number(i+1), mQuoteColor[i].name() ); if ( mQuoteFont[i].italic() ) quoteCSS += " font-style: italic ! important;\n"; if ( mQuoteFont[i].bold() ) quoteCSS += " font-weight: bold ! important;\n"; if ( mShrinkQuotes ) - quoteCSS += " font-size: " + QString::fromLatin1( quoteFontSizes[i] ) + quoteCSS += " font-size: " + TQString::fromLatin1( quoteFontSizes[i] ) + "% ! important;\n"; quoteCSS += "}\n\n"; } // CSS definitions for quote levels 4+ for ( int i = 0 ; i < 3 ; ++i ) { - quoteCSS += QString( "div.deepquotelevel%1 {\n" + quoteCSS += TQString( "div.deepquotelevel%1 {\n" " color: %2 ! important;\n" ) - .arg( QString::number(i+1), mQuoteColor[i].name() ); + .arg( TQString::number(i+1), mQuoteColor[i].name() ); if ( mQuoteFont[i].italic() ) quoteCSS += " font-style: italic ! important;\n"; if ( mQuoteFont[i].bold() ) @@ -347,7 +347,7 @@ namespace KPIM { } return - QString( "body {\n" + TQString( "body {\n" " font-family: \"%1\" ! important;\n" " font-size: %2 ! important;\n" " color: %3 ! important;\n" @@ -358,7 +358,7 @@ namespace KPIM { fgColor, background ) + - QString( "a {\n" + TQString( "a {\n" " color: %1 ! important;\n" " text-decoration: none ! important;\n" "}\n\n" @@ -387,7 +387,7 @@ namespace KPIM { "}\n\n" ) .arg( linkColor, fgColor, bgColor, headerFont ) + - QString( "table.encr {\n" + TQString( "table.encr {\n" " background-color: %1 ! important;\n" "}\n\n" @@ -402,7 +402,7 @@ namespace KPIM { headerFont, cPgpEncrB.name() ) + - QString( "table.signOkKeyOk {\n" + TQString( "table.signOkKeyOk {\n" " background-color: %1 ! important;\n" "}\n\n" @@ -417,7 +417,7 @@ namespace KPIM { headerFont, cPgpOk1B.name() ) + - QString( "table.signOkKeyBad {\n" + TQString( "table.signOkKeyBad {\n" " background-color: %1 ! important;\n" "}\n\n" @@ -432,7 +432,7 @@ namespace KPIM { headerFont, cPgpOk0B.name() ) + - QString( "table.signWarn {\n" + TQString( "table.signWarn {\n" " background-color: %1 ! important;\n" "}\n\n" @@ -447,7 +447,7 @@ namespace KPIM { headerFont, cPgpWarnB.name() ) + - QString( "table.signErr {\n" + TQString( "table.signErr {\n" " background-color: %1 ! important;\n" "}\n\n" @@ -462,12 +462,12 @@ namespace KPIM { headerFont, cPgpErrB.name() ) + - QString( "div.htmlWarn {\n" + TQString( "div.htmlWarn {\n" " border: 2px solid %1 ! important;\n" "}\n\n" ) .arg( cHtmlWarning.name() ) + - QString( "div.header {\n" + TQString( "div.header {\n" "%1" "}\n\n" @@ -521,7 +521,7 @@ namespace KPIM { + quoteCSS; } - QString CSSHelper::commonCssDefinitions() const { + TQString CSSHelper::commonCssDefinitions() const { return "div.header {\n" " margin-bottom: 10pt ! important;\n" @@ -620,12 +620,12 @@ namespace KPIM { } - void CSSHelper::setBodyFont( const QFont& font ) + void CSSHelper::setBodyFont( const TQFont& font ) { mBodyFont = font; } - void CSSHelper::setPrintFont( const QFont& font ) + void CSSHelper::setPrintFont( const TQFont& font ) { mPrintFont = font; } |