summaryrefslogtreecommitdiffabout
path: root/kaddressbook/details/look_details.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/details/look_details.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/details/look_details.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/details/look_details.cpp b/kaddressbook/details/look_details.cpp
index 51ec0c0..11d06e9 100644
--- a/kaddressbook/details/look_details.cpp
+++ b/kaddressbook/details/look_details.cpp
@@ -1,162 +1,162 @@
/*
This file is part of KAddressBook.
Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kconfig.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kinstance.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <qcursor.h>
#include <qdir.h>
#include <qpainter.h>
#include <qpopupmenu.h>
#include "global.h"
#include "kabentrypainter.h"
#include "look_details.h"
#define GRID 5
const QString KABDetailedView::mBorderedBGDir = "kab3part/backgrounds/bordered/";
const QString KABDetailedView::mTiledBGDir = "kab3part/backgrounds/tiled/";
KABDetailedView::KABDetailedView( QWidget *parent, const char *name )
: KABBasicLook( parent, name ), mPainter( 0 ), mBackgroundStyle( None ),
mDefaultBGColor( white ), mHeadLineBGColor( darkBlue ),
mHeadLineTextColor( yellow ), mGrid( 3 ), mMenuBorderedBG( 0 ),
mMenuTiledBG( 0 )
{
KToggleAction** actions[] = {
&mActionShowAddresses,
&mActionShowEmails,
&mActionShowPhones,
&mActionShowURLs
};
QString actionTexts[] = {
i18n( "Show Postal Addresses" ),
i18n( "Show Email Addresses" ),
i18n( "Show Telephone Numbers" ),
i18n( "Show Web Pages (URLs)" )
};
- QFont general = KGlobalSettings::generalFont();
+ QFont general = KGlobalSettings::generalMaxFont();
QFont fixed = KGlobalSettings::fixedFont();
QString gfont = general.family();
QString ffont = fixed.family();
int gpointsize = general.pixelSize();
if ( gpointsize == -1 )
gpointsize = general.pointSize();
int fpointsize = fixed.pixelSize();
if ( fpointsize == -1 )
fpointsize = fixed.pointSize();
mPainter = new KABEntryPainter;
mPainter->setForegroundColor( black );
mPainter->setHeaderColor( mHeadLineTextColor );
mPainter->setUseHeaderColor( mUseHeadLineBGColor );
mPainter->setBackgroundColor( mHeadLineBGColor );
mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) );
mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) );
mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) );
mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) );
mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) );
const int numActions = sizeof( actions ) / sizeof( actions[ 0 ] );
for ( int count = 0; count < numActions; ++count ) {
*actions[ count ] = new KToggleAction( actionTexts[ count ] );
(*actions[ count ])->setChecked( true );
}
setMouseTracking( true );
setBackgroundMode( NoBackground );
}
KABDetailedView::~KABDetailedView()
{
delete mPainter;
mPainter = 0;
}
bool KABDetailedView::getBackground( QString path, QPixmap& image )
{
QMap<QString, QPixmap>::iterator pos;
pos = mBackgroundMap.find( path );
if ( pos == mBackgroundMap.end() ) { // the image has not been loaded previously
if ( image.load( path ) ) {
mBackgroundMap[ path ] = image;
return true;
} else
return false;
} else { // image found in cache
image = pos.data();
return true;
}
}
void KABDetailedView::paintEvent( QPaintEvent* )
{
const int BorderSpace = mGrid;
QPixmap pm( width(), height() );
QPainter p;
QRect entryArea = QRect( BorderSpace, mGrid, width() - mGrid - BorderSpace,
height() - 2 * mGrid );
p.begin( &pm );
p.setPen( darkBlue );
p.setBrush( mDefaultBGColor );
p.drawRect( 0, 0, width(), height() );
switch ( mBackgroundStyle ) {
case Tiled:
p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mCurrentBackground );
break;
case Bordered:
p.drawTiledPixmap( 1, 1, QMIN( width() - 2, mCurrentBackground.width() ),
height() - 2, mCurrentBackground );
break;
case None: // no BG image defined for this entry:
default:
if ( mUseDefaultBGImage )
p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mDefaultBGImage );
break;
};
p.setViewport( entryArea );
mPainter->setShowAddresses( mActionShowAddresses->isChecked() );
mPainter->setShowEmails( mActionShowEmails->isChecked() );
mPainter->setShowPhones( mActionShowPhones->isChecked() );
mPainter->setShowURLs( mActionShowURLs->isChecked() );
mPainter->printAddressee( addressee(), QRect( 0, 0, entryArea.width(),
entryArea.height() ), &p );