summaryrefslogtreecommitdiffabout
path: root/kaddressbook/details
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/details
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/details') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp19
-rw-r--r--kaddressbook/details/detailsviewcontainer.h8
-rw-r--r--kaddressbook/details/look_basic.cpp6
-rw-r--r--kaddressbook/details/look_basic.h4
-rw-r--r--kaddressbook/details/look_details.cpp12
-rw-r--r--kaddressbook/details/look_details.h4
-rw-r--r--kaddressbook/details/look_html.cpp6
7 files changed, 31 insertions, 28 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index cee5886..4a86aca 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -1,164 +1,167 @@
/*
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 <qcombobox.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include <kapplication.h>
#include <kdebug.h>
#include <kdialog.h>
#include "look_basic.h"
//#include "look_details.h"
#include "look_html.h"
#ifdef KAB_EMBEDDED
#include "kabprefs.h"
#endif //KAB_EMBEDDED
#include "detailsviewcontainer.h"
ViewContainer::ViewContainer( QWidget *parent, const char* name )
: QWidget( parent, name ), mCurrentLook( 0 )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
//topLayout->setMargin( KDialog::marginHint() );
//topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( 0 );
topLayout->setSpacing( 0 );
- QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *styleLayout = new Q3HBoxLayout( topLayout );
QLabel *label = new QLabel( i18n("Style:"), this );
styleLayout->addWidget( label );
mStyleCombo = new QComboBox( this );
styleLayout->addWidget( mStyleCombo );
- QFrame *frameRuler = new QFrame( this );
+ Q3Frame *frameRuler = new Q3Frame( this );
//US frameRuler->setFrameShape( QFrame::HLine );
//US frameRuler->setFrameShadow( QFrame::Sunken );
//US topLayout->addWidget( frameRuler );
- mDetailsStack = new QWidgetStack( this );
+ mDetailsStack = new Q3WidgetStack( this );
topLayout->addWidget( mDetailsStack, 1 );
registerLooks();
#if 1
// Hide detailed view selection combo box, because we currently have
// only one. Reenable it when there are more detailed views.
label->hide();
mStyleCombo->hide();
frameRuler->hide();
#endif
}
void ViewContainer::printView()
{
mCurrentLook->printView();
}
KABBasicLook *ViewContainer::currentLook()
{
return mCurrentLook;
}
void ViewContainer::registerLooks()
{
mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
mStyleCombo->clear();
for ( uint i = 0; i < mLookFactories.count(); ++i )
mStyleCombo->insertItem( mLookFactories.at( i )->description() );
if ( !mLookFactories.isEmpty() )
slotStyleSelected( 0 );
}
void ViewContainer::slotStyleSelected( int index )
{
#ifndef KAB_EMBEDDED
KConfig *config = kapp->config();
#else //KAB_EMBEDDED
//US I hope I got the same config object as above expected.
KConfig *config = KABPrefs::instance()->getConfig();
#endif //KAB_EMBEDDED
KABC::Addressee addr;
if ( index >= 0 && index < mStyleCombo->count() ) {
if ( mCurrentLook != 0 ) {
mCurrentLook->saveSettings( config );
addr = mCurrentLook->addressee();
delete mCurrentLook;
mCurrentLook = 0;
}
KABLookFactory *factory = mLookFactories.at( index );
mCurrentLook = factory->create();
mDetailsStack->raiseWidget( mCurrentLook );
connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
SIGNAL( sendEmail( const QString& ) ) );
connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
SIGNAL( browse( const QString& ) ) );
}
mCurrentLook->restoreSettings( config );
mCurrentLook->setAddressee( addr );
}
void ViewContainer::setAddressee( const KABC::Addressee& addressee )
{
if ( mCurrentLook != 0 ) {
mCurrentAddressee = addressee;
mCurrentLook->setAddressee( mCurrentAddressee );
}
}
KABC::Addressee ViewContainer::addressee()
{
static KABC::Addressee empty; // do not use!
if ( !mCurrentLook )
return empty;
else
return mCurrentLook->addressee();
}
void ViewContainer::setReadOnly( bool state )
{
if ( mCurrentLook )
mCurrentLook->setReadOnly( state );
}
-#ifndef KAB_EMBEDDED
-#include "detailsviewcontainer.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_detailsviewcontainer.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h
index 9684736..f310a30 100644
--- a/kaddressbook/details/detailsviewcontainer.h
+++ b/kaddressbook/details/detailsviewcontainer.h
@@ -1,103 +1,103 @@
/*
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.
*/
#ifndef DETAILSVIEWCONTAINER_H
#define DETAILSVIEWCONTAINER_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "look_basic.h"
class QComboBox;
-class QWidgetStack;
+class Q3WidgetStack;
class ViewContainer : public QWidget
{
Q_OBJECT
public:
ViewContainer( QWidget *parent = 0, const char* name = 0 );
/**
Return the look currently selected. If there is none, it
returns zero. Do not use this pointer to store a reference
to a look, the user might select another one (e.g., create
a new object) at any time.
*/
KABBasicLook *currentLook();
/**
Return the contact currently displayed.
*/
KABC::Addressee addressee();
public slots:
void printView();
/**
Set the contact currently displayed.
*/
void setAddressee( const KABC::Addressee& addressee );
/**
Set read-write state.
*/
void setReadOnly( bool state );
signals:
/**
The contact has been changed.
*/
void addresseeChanged();
/**
The user acticated the email address displayed. This may happen
by, for example, clicking on the displayed mailto-URL.
*/
void sendEmail( const QString& );
/**
The user activated one of the displayed HTTP URLs. For example
by clicking on the displayed homepage address.
*/
void browse( const QString& );
protected:
/**
A style has been selected. Overloaded from base class.
*/
void slotStyleSelected( int );
/**
Register the available looks.
*/
void registerLooks();
private:
KABC::Addressee mCurrentAddressee;
KABBasicLook *mCurrentLook;
- QPtrList<KABLookFactory> mLookFactories;
+ Q3PtrList<KABLookFactory> mLookFactories;
QComboBox *mStyleCombo;
- QWidgetStack *mDetailsStack;
+ Q3WidgetStack *mDetailsStack;
};
#endif
diff --git a/kaddressbook/details/look_basic.cpp b/kaddressbook/details/look_basic.cpp
index 0245686..48cc42a 100644
--- a/kaddressbook/details/look_basic.cpp
+++ b/kaddressbook/details/look_basic.cpp
@@ -1,75 +1,75 @@
/*
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 <kdebug.h>
#include "look_basic.h"
KABBasicLook::KABBasicLook( QWidget *parent, const char *name )
- : QVBox( parent, name ), mReadOnly( false )
+ : Q3VBox( parent, name ), mReadOnly( false )
{
}
void KABBasicLook::setReadOnly( bool state )
{
mReadOnly = state;
}
bool KABBasicLook::isReadOnly() const
{
return mReadOnly;
}
void KABBasicLook::setAddressee( const KABC::Addressee &addr )
{
if ( mAddressee == addr )
return;
mAddressee = addr;
repaint( false );
}
KABC::Addressee KABBasicLook::addressee()
{
return mAddressee;
}
void KABBasicLook::restoreSettings( KConfig* )
{
}
void KABBasicLook::saveSettings( KConfig* )
{
}
KABLookFactory::KABLookFactory( QWidget *parent, const char *name )
: mParent( parent ), mName( name )
{
}
KABLookFactory::~KABLookFactory()
{
}
-#ifndef KAB_EMBEDDED
-#include "look_basic.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_look_basic.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/look_basic.h b/kaddressbook/details/look_basic.h
index a65c99c..a70e7f7 100644
--- a/kaddressbook/details/look_basic.h
+++ b/kaddressbook/details/look_basic.h
@@ -1,136 +1,136 @@
/*
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.
*/
#ifndef LOOK_KABBASIC_H
#define LOOK_KABBASIC_H
#include <kabc/addressbook.h>
-#include <qvbox.h>
+#include <q3vbox.h>
class KConfig;
/**
This is a pure virtual base class that defines the
interface for how to display and change entries of
the KDE addressbook.
This basic widget does not show anything in its client space.
Derive it and implement its look and how the user may edit the
entry.
The paintEvent() has to paint the whole widget, since repaint()
calls will not delete the widgets background.
*/
-class KABBasicLook : public QVBox
+class KABBasicLook : public Q3VBox
{
Q_OBJECT
public:
/**
The constructor.
*/
KABBasicLook( QWidget *parent = 0, const char *name = 0 );
/**
Set the entry. It will be displayed automatically.
*/
virtual void setAddressee( const KABC::Addressee& addressee );
/**
Get the current entry.
*/
virtual KABC::Addressee addressee();
/**
Configure the view from the configuration file.
*/
virtual void restoreSettings( KConfig* );
/**
Save the view settings to the configuration file.
*/
virtual void saveSettings( KConfig* );
/**
Retrieve read-write state.
*/
bool isReadOnly() const;
void printView(){ emit printMyView();}
signals:
void printMyView();
/**
This signal is emitted when the user changed the entry.
*/
void entryChanged();
/**
This signal indicates that the entry needs to be changed
immidiately in the database. This might be due to changes in
values that are available in menus.
*/
void saveMe();
/**
The user acticated the email address displayed. This may happen
by, for example, clicking on the displayed mailto-URL.
*/
void sendEmail( const QString &email );
/**
The user activated one of the displayed HTTP URLs. For example
by clicking on the displayed homepage address.
*/
void browse( const QString &url );
public slots:
/**
Set read-write state.
*/
virtual void setReadOnly( bool state );
private:
KABC::Addressee mAddressee;
bool mReadOnly;
};
class KABLookFactory
{
public:
KABLookFactory( QWidget *parent = 0, const char *name = 0 );
virtual ~KABLookFactory();
virtual KABBasicLook *create() = 0;
/**
Overload this method to provide a one-liner description
for your look.
*/
virtual QString description() = 0;
protected:
QWidget *mParent;
const char* mName;
};
#endif
diff --git a/kaddressbook/details/look_details.cpp b/kaddressbook/details/look_details.cpp
index 11d06e9..2c3a79d 100644
--- a/kaddressbook/details/look_details.cpp
+++ b/kaddressbook/details/look_details.cpp
@@ -64,356 +64,356 @@ KABDetailedView::KABDetailedView( QWidget *parent, const char *name )
};
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 );
p.end();
bitBlt( this, 0, 0, &pm );
}
void KABDetailedView::mouseMoveEvent( QMouseEvent *e )
{
QPoint bias( mGrid, mGrid );
int rc;
bool hit = false;
if ( ( rc = mPainter->hitsEmail( e->pos() - bias ) ) != -1 )
hit = true;
else if ( ( rc = mPainter->hitsURL( e->pos() - bias ) ) != -1 )
hit = true;
else if ( ( rc = mPainter->hitsPhone( e->pos() - bias ) ) != -1 )
hit = true;
else if ( ( rc = mPainter->hitsTalk( e->pos() - bias ) ) != -1 )
hit = true;
if ( hit ) {
if ( cursor().shape() != PointingHandCursor )
setCursor( PointingHandCursor );
else if( cursor().shape() != ArrowCursor )
setCursor(ArrowCursor);
}
}
void KABDetailedView::mousePressEvent( QMouseEvent *e )
{
- QPopupMenu menu( this );
- QPopupMenu *menuBG = new QPopupMenu( &menu );
- mMenuBorderedBG = new QPopupMenu( &menu );
- mMenuTiledBG = new QPopupMenu( &menu );
+ Q3PopupMenu menu( this );
+ Q3PopupMenu *menuBG = new Q3PopupMenu( &menu );
+ mMenuBorderedBG = new Q3PopupMenu( &menu );
+ mMenuTiledBG = new Q3PopupMenu( &menu );
menu.insertItem( i18n( "Select Background" ), menuBG );
menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG );
menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG );
menu.insertSeparator();
QPoint point = e->pos() - QPoint( mGrid, mGrid );
int rc;
QStringList dirsBorderedBG, dirsTiledBG;
QDir dir;
switch( e->button() ) {
case QMouseEvent::RightButton:
if ( isReadOnly() )
menu.setItemEnabled( menu.idAt( 0 ), false );
else {
// TODO: settings need to be saved in view options
dirsBorderedBG = KGlobal::instance()->dirs()->findDirs( "data", mBorderedBGDir );
if ( dirsBorderedBG.count() > 0 ) {
dir.setPath( dirsBorderedBG[ 0 ] );
mBorders = dir.entryList( QDir::Files );
for ( uint count = 0; count < mBorders.count(); ++count )
mMenuBorderedBG->insertItem( mBorders[ count ], count );
connect( mMenuBorderedBG, SIGNAL( activated( int ) ),
SLOT( slotBorderedBGSelected( int ) ) );
} else
menuBG->setItemEnabled( menuBG->idAt( 0 ), false );
dirsTiledBG = KGlobal::instance()->dirs()->findDirs( "data", mTiledBGDir );
if ( dirsTiledBG.count() > 0 ) {
dir.setPath( dirsTiledBG[ 0 ] );
mTiles = dir.entryList( QDir::Files );
for ( uint count = 0; count < mTiles.count(); ++count )
mMenuTiledBG->insertItem( mTiles[ count ], count );
connect( mMenuTiledBG, SIGNAL( activated( int ) ),
SLOT( slotTiledBGSelected( int ) ) );
} else
menuBG->setItemEnabled( menuBG->idAt( 1 ), false );
}
mActionShowAddresses->plug( &menu );
mActionShowEmails->plug( &menu );
mActionShowPhones->plug( &menu );
mActionShowURLs->plug( &menu );
menu.exec( e->globalPos() );
break;
case QMouseEvent::LeftButton:
// find whether the pointer touches an email address, URL,
// talk address or telephone number:
if ( ( rc = mPainter->hitsEmail( point ) ) != -1 ) {
emit sendEmail( addressee().emails()[ rc ] );
break;
}
if ( ( rc = mPainter->hitsURL( point ) ) != -1 ) {
emit browse( addressee().url().prettyURL() );
break;
}
if ( ( rc = mPainter->hitsPhone( point ) ) != -1 ) {
// not implemented yet
break;
}
if ( ( rc = mPainter->hitsTalk( point ) ) != -1 ) {
// not implemented yet
break;
}
break;
default:
break;
}
mMenuBorderedBG = 0;
mMenuTiledBG = 0;
}
void KABDetailedView::setAddressee( const KABC::Addressee &addr )
{
BackgroundStyle style = None;
QString dir, file, styleSetting;
KABBasicLook::setAddressee( addr );
// TODO: preload path and styleSetting with possible preference values
styleSetting = addressee().custom( "kab", "BackgroundStyle" );
style = (BackgroundStyle)styleSetting.toInt();
file = addressee().custom( "kab", "BackgroundImage" );
if ( !file.isEmpty() ) {
switch ( style ) {
case Tiled:
dir = mTiledBGDir;
break;
case Bordered:
dir = mBorderedBGDir;
break;
case None:
default:
break;
}
QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", dir );
mBackgroundStyle = None;
if ( !dirs.isEmpty() ) {
uint count = 0;
for ( ; count < dirs.count(); ++count ) {
QDir folder;
folder.setPath( dirs[ count ] );
file = folder.absPath() + "/" + file;
if ( getBackground( file, mCurrentBackground ) ) {
mBackgroundStyle = style;
break;
}
}
if ( count == dirs.count() ) {
kdDebug(5720) << "KABDetailedView::setEntry: " << file
<< " not locatable." << endl;
}
}
} else { // no background here
mBackgroundStyle = None;
mCurrentBackground.resize( 0, 0 );
}
repaint( false );
}
void KABDetailedView::slotBorderedBGSelected( int index )
{
if ( index >= 0 && (uint)index < mBorders.count() && !isReadOnly() ) {
// get the selection and make it a full path
QString path = mBorders[ index ];
mBackgroundStyle = Bordered;
addressee().insertCustom( "kab", "BackgroundStyle",
QString().setNum( mBackgroundStyle ) );
addressee().insertCustom( "kab", "BackgroundImage", path );
setAddressee( addressee() );
}
}
void KABDetailedView::slotTiledBGSelected( int index )
{
if ( index >= 0 && (uint)index < mTiles.count() && !isReadOnly() ) {
QString path = mTiles[ index ];
mBackgroundStyle = Tiled;
addressee().insertCustom( "kab", "BackgroundStyle",
QString().setNum( mBackgroundStyle ) );
addressee().insertCustom( "kab", "BackgroundImage", path );
setAddressee( addressee() );
}
}
void KABDetailedView::setReadOnly( bool state )
{
KABBasicLook::setReadOnly( state );
repaint( false );
}
void KABDetailedView::restoreSettings( KConfig *config )
{
QFont general = KGlobalSettings::generalFont();
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();
config->setGroup( ConfigView );
// load the default background image:
QString bgImage;
mUseDefaultBGImage = config->readBoolEntry( ConfigView_UseDefaultBackground, true );
mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white );
bgImage = config->readEntry( ConfigView_DefaultBackgroundImage, "konqueror/tiles/kenwimer.png" );
if ( mUseDefaultBGImage ) {
uint count = 0;
QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", "/" );
if ( !dirs.isEmpty() ) {
for ( count = 0; count < dirs.count(); ++count ) {
if ( getBackground( dirs[ count ] + "/" + bgImage, mDefaultBGImage ) )
break;
}
}
if ( count == dirs.count() ) {
mUseDefaultBGImage = getBackground( bgImage, mDefaultBGImage );
if ( !mUseDefaultBGImage )
kdDebug(5720) << "KABDetailedView::configure: "
<< "default BG image selected, but could not be loaded."
<< endl;
}
}
mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white );
mHeadLineBGColor = config->readColorEntry( ConfigView_HeadlineBGColor, &darkBlue );
mHeadLineTextColor = config->readColorEntry( ConfigView_HeadlineTextColor, &yellow );
mUseHeadLineBGColor = config->readBoolEntry( ConfigView_UseHeadlineBGColor, true );
if ( !mPainter )
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 ) );
}
-#ifndef KAB_EMBEDDED
-#include "look_details.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_look_details.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/look_details.h b/kaddressbook/details/look_details.h
index e8d50a9..b59d3a7 100644
--- a/kaddressbook/details/look_details.h
+++ b/kaddressbook/details/look_details.h
@@ -5,153 +5,153 @@
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.
*/
#ifndef LOOK_DETAILS_H
#define LOOK_DETAILS_H
#include <kabc/addressbook.h>
#include <kaction.h>
#include <klocale.h>
#include <qmap.h>
#include <qpixmap.h>
#include <qptrlist.h>
#include <qrect.h>
#include "look_basic.h"
class KABEntryPainter;
class QComboBox;
/**
This class implements the detailed view.
Currently, there is no possibility to change the entry in this
view.
*/
class KABDetailedView : public KABBasicLook
{
Q_OBJECT
public:
/**
Enum to select how the background is drawn.
*/
enum BackgroundStyle
{
None,
Tiled,
Bordered
};
/**
The constructor.
*/
KABDetailedView( QWidget *parent = 0, const char* name = 0 );
/**
The virtual destructor.
*/
virtual ~KABDetailedView();
/**
Set the addressee.
*/
void setAddressee( const KABC::Addressee& );
/**
Overloaded from KABBasicLook.
*/
void setReadOnly( bool );
/**
Overloaded from KABBasicLook.
*/
void restoreSettings( KConfig* );
public slots:
void slotBorderedBGSelected( int index );
void slotTiledBGSelected( int index );
protected:
void paintEvent( QPaintEvent* );
void mousePressEvent( QMouseEvent* );
void mouseMoveEvent( QMouseEvent* );
/**
A method to retrieve a background image according to the path
stored in the entry. It is either loaded
from backgrounds, that acts as a cache, or from the file
and added to @see backgrounds.
*/
bool getBackground( QString path, QPixmap& image );
private:
QPtrList<QRect> mURLRects;
QPtrList<QRect> mEmailRects;
QPtrList<QRect> mPhoneRects;
KABEntryPainter *mPainter;
QMap<QString, QPixmap> mBackgroundMap;
QPixmap mCurrentBackground;
BackgroundStyle mBackgroundStyle;
bool mUseDefaultBGImage;
bool mUseHeadLineBGColor;
QColor mDefaultBGColor;
QColor mHeadLineBGColor;
QColor mHeadLineTextColor;
QPixmap mDefaultBGImage;
KToggleAction *mActionShowAddresses;
KToggleAction *mActionShowEmails;
KToggleAction *mActionShowPhones;
KToggleAction *mActionShowURLs;
const int mGrid;
QStringList mBorders;
QStringList mTiles;
- QPopupMenu *mMenuBorderedBG;
- QPopupMenu *mMenuTiledBG;
+ Q3PopupMenu *mMenuBorderedBG;
+ Q3PopupMenu *mMenuTiledBG;
static const QString mBorderedBGDir;
static const QString mTiledBGDir;
};
class KABDetailedViewFactory : public KABLookFactory
{
public:
KABDetailedViewFactory( QWidget *parent = 0, const char *name = 0 )
: KABLookFactory( parent, name ) {}
KABBasicLook *create()
{
return new KABDetailedView( mParent, mName );
}
QString description()
{
return i18n( "Detailed Style: Display all details, no modifications." );
}
};
#endif
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp
index bb30650..4ec1c7d 100644
--- a/kaddressbook/details/look_html.cpp
+++ b/kaddressbook/details/look_html.cpp
@@ -1,56 +1,56 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@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 <addresseeview.h>
#include "look_html.h"
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include "kabprefs.h"
#include <kabc/addresseeview.h>
KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
: KABBasicLook( parent, name )
{
mView = new KABC::AddresseeView( this );
mView->setFont( KABPrefs::instance()->mDetailsFont );
connect(this, SIGNAL(printMyView()),
this , SLOT(printMe()));
}
KABHtmlView::~KABHtmlView()
{
}
void KABHtmlView::printMe()
{
mView->printMe();
}
void KABHtmlView::setAddressee( const KABC::Addressee &addr )
{
mView->setFont( KABPrefs::instance()->mDetailsFont );
mView->setAddressee( addr );
}
-#ifndef KAB_EMBEDDED
-#include "look_html.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_look_html.cpp"
#endif //KAB_EMBEDDED