summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp3
-rw-r--r--kaddressbook/details/look_html.cpp3
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kabprefs.h1
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp13
5 files changed, 19 insertions, 3 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index a42499f..ceffc77 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -1,172 +1,169 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> 3 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29 29
30#include <kapplication.h> 30#include <kapplication.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kdialog.h> 32#include <kdialog.h>
33 33
34#include "look_basic.h" 34#include "look_basic.h"
35//#include "look_details.h" 35//#include "look_details.h"
36#include "look_html.h" 36#include "look_html.h"
37 37
38#ifdef KAB_EMBEDDED 38#ifdef KAB_EMBEDDED
39#include "kabprefs.h" 39#include "kabprefs.h"
40#endif //KAB_EMBEDDED 40#endif //KAB_EMBEDDED
41 41
42 42
43#include "detailsviewcontainer.h" 43#include "detailsviewcontainer.h"
44 44
45ViewContainer::ViewContainer( QWidget *parent, const char* name ) 45ViewContainer::ViewContainer( QWidget *parent, const char* name )
46 : QWidget( parent, name ), mCurrentLook( 0 ) 46 : QWidget( parent, name ), mCurrentLook( 0 )
47{ 47{
48 QBoxLayout *topLayout = new QVBoxLayout( this ); 48 QBoxLayout *topLayout = new QVBoxLayout( this );
49 //topLayout->setMargin( KDialog::marginHint() ); 49 //topLayout->setMargin( KDialog::marginHint() );
50 //topLayout->setSpacing( KDialog::spacingHint() ); 50 //topLayout->setSpacing( KDialog::spacingHint() );
51 topLayout->setMargin( 0 ); 51 topLayout->setMargin( 0 );
52 topLayout->setSpacing( 0 ); 52 topLayout->setSpacing( 0 );
53 53
54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); 54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
55 55
56 QLabel *label = new QLabel( i18n("Style:"), this ); 56 QLabel *label = new QLabel( i18n("Style:"), this );
57 styleLayout->addWidget( label ); 57 styleLayout->addWidget( label );
58 58
59 mStyleCombo = new QComboBox( this ); 59 mStyleCombo = new QComboBox( this );
60 styleLayout->addWidget( mStyleCombo ); 60 styleLayout->addWidget( mStyleCombo );
61 61
62 QFrame *frameRuler = new QFrame( this ); 62 QFrame *frameRuler = new QFrame( this );
63//US frameRuler->setFrameShape( QFrame::HLine ); 63//US frameRuler->setFrameShape( QFrame::HLine );
64//US frameRuler->setFrameShadow( QFrame::Sunken ); 64//US frameRuler->setFrameShadow( QFrame::Sunken );
65//US topLayout->addWidget( frameRuler ); 65//US topLayout->addWidget( frameRuler );
66 66
67 mDetailsStack = new QWidgetStack( this ); 67 mDetailsStack = new QWidgetStack( this );
68 topLayout->addWidget( mDetailsStack, 1 ); 68 topLayout->addWidget( mDetailsStack, 1 );
69 69
70 registerLooks(); 70 registerLooks();
71 71
72#if 1 72#if 1
73 // Hide detailed view selection combo box, because we currently have 73 // Hide detailed view selection combo box, because we currently have
74 // only one. Reenable it when there are more detailed views. 74 // only one. Reenable it when there are more detailed views.
75 label->hide(); 75 label->hide();
76 mStyleCombo->hide(); 76 mStyleCombo->hide();
77 frameRuler->hide(); 77 frameRuler->hide();
78#endif 78#endif
79} 79}
80 80
81KABBasicLook *ViewContainer::currentLook() 81KABBasicLook *ViewContainer::currentLook()
82{ 82{
83 return mCurrentLook; 83 return mCurrentLook;
84} 84}
85 85
86void ViewContainer::registerLooks() 86void ViewContainer::registerLooks()
87{ 87{
88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); 88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); 89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
90 mStyleCombo->clear(); 90 mStyleCombo->clear();
91 91
92 for ( uint i = 0; i < mLookFactories.count(); ++i ) 92 for ( uint i = 0; i < mLookFactories.count(); ++i )
93 mStyleCombo->insertItem( mLookFactories.at( i )->description() ); 93 mStyleCombo->insertItem( mLookFactories.at( i )->description() );
94 94
95 if ( !mLookFactories.isEmpty() ) 95 if ( !mLookFactories.isEmpty() )
96 slotStyleSelected( 0 ); 96 slotStyleSelected( 0 );
97} 97}
98 98
99void ViewContainer::slotStyleSelected( int index ) 99void ViewContainer::slotStyleSelected( int index )
100{ 100{
101#ifndef KAB_EMBEDDED 101#ifndef KAB_EMBEDDED
102 KConfig *config = kapp->config(); 102 KConfig *config = kapp->config();
103#else //KAB_EMBEDDED 103#else //KAB_EMBEDDED
104 //US I hope I got the same config object as above expected. 104 //US I hope I got the same config object as above expected.
105 KConfig *config = KABPrefs::instance()->getConfig(); 105 KConfig *config = KABPrefs::instance()->getConfig();
106#endif //KAB_EMBEDDED 106#endif //KAB_EMBEDDED
107 KABC::Addressee addr; 107 KABC::Addressee addr;
108 108
109 if ( index >= 0 && index < mStyleCombo->count() ) { 109 if ( index >= 0 && index < mStyleCombo->count() ) {
110 if ( mCurrentLook != 0 ) { 110 if ( mCurrentLook != 0 ) {
111 mCurrentLook->saveSettings( config ); 111 mCurrentLook->saveSettings( config );
112 addr = mCurrentLook->addressee(); 112 addr = mCurrentLook->addressee();
113 113
114 delete mCurrentLook; 114 delete mCurrentLook;
115 mCurrentLook = 0; 115 mCurrentLook = 0;
116 } 116 }
117 117
118 KABLookFactory *factory = mLookFactories.at( index ); 118 KABLookFactory *factory = mLookFactories.at( index );
119 kdDebug(5720) << "ViewContainer::slotStyleSelected: "
120 << "creating look "
121 << factory->description() << endl;
122 119
123 mCurrentLook = factory->create(); 120 mCurrentLook = factory->create();
124 mDetailsStack->raiseWidget( mCurrentLook ); 121 mDetailsStack->raiseWidget( mCurrentLook );
125 122
126 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, 123 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
127 SIGNAL( sendEmail( const QString& ) ) ); 124 SIGNAL( sendEmail( const QString& ) ) );
128 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, 125 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
129 SIGNAL( browse( const QString& ) ) ); 126 SIGNAL( browse( const QString& ) ) );
130 } 127 }
131 128
132 mCurrentLook->restoreSettings( config ); 129 mCurrentLook->restoreSettings( config );
133 mCurrentLook->setAddressee( addr ); 130 mCurrentLook->setAddressee( addr );
134} 131}
135void ViewContainer::refreshView() 132void ViewContainer::refreshView()
136{ 133{
137 if ( mCurrentLook ) { 134 if ( mCurrentLook ) {
138 mCurrentLook->setAddressee( mCurrentAddressee ); 135 mCurrentLook->setAddressee( mCurrentAddressee );
139 } 136 }
140} 137}
141 138
142void ViewContainer::setAddressee( const KABC::Addressee& addressee ) 139void ViewContainer::setAddressee( const KABC::Addressee& addressee )
143{ 140{
144 if ( mCurrentLook != 0 ) { 141 if ( mCurrentLook != 0 ) {
145 if ( addressee == mCurrentAddressee ) 142 if ( addressee == mCurrentAddressee )
146 return; 143 return;
147 else { 144 else {
148 mCurrentAddressee = addressee; 145 mCurrentAddressee = addressee;
149 mCurrentLook->setAddressee( mCurrentAddressee ); 146 mCurrentLook->setAddressee( mCurrentAddressee );
150 } 147 }
151 } 148 }
152} 149}
153 150
154KABC::Addressee ViewContainer::addressee() 151KABC::Addressee ViewContainer::addressee()
155{ 152{
156 static KABC::Addressee empty; // do not use! 153 static KABC::Addressee empty; // do not use!
157 154
158 if ( !mCurrentLook ) 155 if ( !mCurrentLook )
159 return empty; 156 return empty;
160 else 157 else
161 return mCurrentLook->addressee(); 158 return mCurrentLook->addressee();
162} 159}
163 160
164void ViewContainer::setReadOnly( bool state ) 161void ViewContainer::setReadOnly( bool state )
165{ 162{
166 if ( mCurrentLook ) 163 if ( mCurrentLook )
167 mCurrentLook->setReadOnly( state ); 164 mCurrentLook->setReadOnly( state );
168} 165}
169 166
170#ifndef KAB_EMBEDDED 167#ifndef KAB_EMBEDDED
171#include "detailsviewcontainer.moc" 168#include "detailsviewcontainer.moc"
172#endif //KAB_EMBEDDED 169#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp
index 63364a7..64987b8 100644
--- a/kaddressbook/details/look_html.cpp
+++ b/kaddressbook/details/look_html.cpp
@@ -1,45 +1,48 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <addresseeview.h> 24#include <addresseeview.h>
25 25
26#include "look_html.h" 26#include "look_html.h"
27#include <qscrollview.h> 27#include <qscrollview.h>
28#include "kabprefs.h"
28KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) 29KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
29 : KABBasicLook( parent, name ) 30 : KABBasicLook( parent, name )
30{ 31{
31 mView = new KPIM::AddresseeView( this ); 32 mView = new KPIM::AddresseeView( this );
33 mView->setFont( KABPrefs::instance()->mDetailsFont );
32} 34}
33 35
34KABHtmlView::~KABHtmlView() 36KABHtmlView::~KABHtmlView()
35{ 37{
36} 38}
37 39
38void KABHtmlView::setAddressee( const KABC::Addressee &addr ) 40void KABHtmlView::setAddressee( const KABC::Addressee &addr )
39{ 41{
42 mView->setFont( KABPrefs::instance()->mDetailsFont );
40 mView->setAddressee( addr ); 43 mView->setAddressee( addr );
41} 44}
42 45
43#ifndef KAB_EMBEDDED 46#ifndef KAB_EMBEDDED
44#include "look_html.moc" 47#include "look_html.moc"
45#endif //KAB_EMBEDDED 48#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index dded2bf..9270a7d 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,133 +1,135 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28 28
29#include <kconfig.h> 29#include <kconfig.h>
30#include <klocale.h> 30#include <klocale.h>
31#include <kstaticdeleter.h> 31#include <kstaticdeleter.h>
32//US#include <kdebug.h> // defines kdDebug() 32//US#include <kdebug.h> // defines kdDebug()
33 33
34#include "kabprefs.h" 34#include "kabprefs.h"
35 35
36KABPrefs *KABPrefs::sInstance = 0; 36KABPrefs *KABPrefs::sInstance = 0;
37static KStaticDeleter<KABPrefs> staticDeleter; 37static KStaticDeleter<KABPrefs> staticDeleter;
38 38
39KABPrefs::KABPrefs() 39KABPrefs::KABPrefs()
40 : KPimPrefs("kaddressbookrc") 40 : KPimPrefs("kaddressbookrc")
41{ 41{
42 mDetailsFont = QFont("helvetica",12);
42 KPrefs::setCurrentGroup( "Views" ); 43 KPrefs::setCurrentGroup( "Views" );
43 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 44 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
44 45
45 KPrefs::setCurrentGroup( "General" ); 46 KPrefs::setCurrentGroup( "General" );
46 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 47 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
47 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 48 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
48 49
49#ifdef KAB_EMBEDDED 50#ifdef KAB_EMBEDDED
50 addItemBool("AskForQuit",&mAskForQuit,true); 51 addItemBool("AskForQuit",&mAskForQuit,true);
51 addItemBool("ToolBarHor",&mToolBarHor, true ); 52 addItemBool("ToolBarHor",&mToolBarHor, true );
52 addItemBool("ToolBarUp",&mToolBarUp, false ); 53 addItemBool("ToolBarUp",&mToolBarUp, false );
53 addItemBool("SearchWithReturn",&mSearchWithReturn, true ); 54 addItemBool("SearchWithReturn",&mSearchWithReturn, true );
55 addItemFont("DetailsFont",&mDetailsFont);
54 56
55 57
56#endif //KAB_EMBEDDED 58#endif //KAB_EMBEDDED
57 59
58 KPrefs::setCurrentGroup( "MainWindow" ); 60 KPrefs::setCurrentGroup( "MainWindow" );
59 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 61 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
60 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 62 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
61 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 63 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
62 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 64 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
63 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 65 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
64 66
65 67
66 KPrefs::setCurrentGroup( "Extensions_General" ); 68 KPrefs::setCurrentGroup( "Extensions_General" );
67 QStringList defaultExtensions; 69 QStringList defaultExtensions;
68 defaultExtensions << "merge"; 70 defaultExtensions << "merge";
69 defaultExtensions << "distribution_list_editor"; 71 defaultExtensions << "distribution_list_editor";
70 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 72 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
71 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 73 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
72 74
73 KPrefs::setCurrentGroup( "Views" ); 75 KPrefs::setCurrentGroup( "Views" );
74 QString defaultView = i18n( "Default Table View" ); 76 QString defaultView = i18n( "Default Table View" );
75 addItemString( "CurrentView", &mCurrentView, defaultView ); 77 addItemString( "CurrentView", &mCurrentView, defaultView );
76 addItemStringList( "ViewNames", &mViewNames, defaultView ); 78 addItemStringList( "ViewNames", &mViewNames, defaultView );
77 79
78 KPrefs::setCurrentGroup( "Filters" ); 80 KPrefs::setCurrentGroup( "Filters" );
79 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 81 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
80 82
81} 83}
82 84
83KABPrefs::~KABPrefs() 85KABPrefs::~KABPrefs()
84{ 86{
85 //qDebug("KABPrefs::~KABPrefs() "); 87 //qDebug("KABPrefs::~KABPrefs() ");
86} 88}
87 89
88KABPrefs *KABPrefs::instance() 90KABPrefs *KABPrefs::instance()
89{ 91{
90 if ( !sInstance ) { 92 if ( !sInstance ) {
91#ifdef KAB_EMBEDDED 93#ifdef KAB_EMBEDDED
92 sInstance = staticDeleter.setObject( new KABPrefs() ); 94 sInstance = staticDeleter.setObject( new KABPrefs() );
93#else //KAB_EMBEDDED 95#else //KAB_EMBEDDED
94 //US the following line has changed ???. Why 96 //US the following line has changed ???. Why
95 staticDeleter.setObject( sInstance, new KABPrefs() ); 97 staticDeleter.setObject( sInstance, new KABPrefs() );
96#endif //KAB_EMBEDDED 98#endif //KAB_EMBEDDED
97 sInstance->readConfig(); 99 sInstance->readConfig();
98 } 100 }
99 101
100 return sInstance; 102 return sInstance;
101} 103}
102 104
103void KABPrefs::setCategoryDefaults() 105void KABPrefs::setCategoryDefaults()
104{ 106{
105 mCustomCategories.clear(); 107 mCustomCategories.clear();
106 108
107 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) 109 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
108 << i18n( "Customer" ) << i18n( "Friend" ); 110 << i18n( "Customer" ) << i18n( "Friend" );
109} 111}
110 112
111 // US introduce a nonconst way to return the config object. 113 // US introduce a nonconst way to return the config object.
112KConfig* KABPrefs::getConfig() 114KConfig* KABPrefs::getConfig()
113{ 115{
114 return config(); 116 return config();
115} 117}
116 118
117 119
118/*US 120/*US
119void KABPrefs::usrSetDefaults() 121void KABPrefs::usrSetDefaults()
120{ 122{
121 KPimPrefs::usrSetDefaults(); 123 KPimPrefs::usrSetDefaults();
122} 124}
123 125
124void KABPrefs::usrReadConfig() 126void KABPrefs::usrReadConfig()
125{ 127{
126 KPimPrefs::usrReadConfig(); 128 KPimPrefs::usrReadConfig();
127} 129}
128 130
129void KABPrefs::usrWriteConfig() 131void KABPrefs::usrWriteConfig()
130{ 132{
131 KPimPrefs::usrWriteConfig(); 133 KPimPrefs::usrWriteConfig();
132} 134}
133*/ 135*/
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index e4f359c..4a3b6e2 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -1,92 +1,93 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABPREFS_H 24#ifndef KABPREFS_H
25#define KABPREFS_H 25#define KABPREFS_H
26 26
27#include <qstringlist.h> 27#include <qstringlist.h>
28 28
29#include <libkdepim/kpimprefs.h> 29#include <libkdepim/kpimprefs.h>
30 30
31class KConfig; 31class KConfig;
32 32
33class KABPrefs : public KPimPrefs 33class KABPrefs : public KPimPrefs
34{ 34{
35 public: 35 public:
36 virtual ~KABPrefs(); 36 virtual ~KABPrefs();
37 37
38 static KABPrefs *instance(); 38 static KABPrefs *instance();
39 39
40 // General 40 // General
41 bool mHonorSingleClick; 41 bool mHonorSingleClick;
42 bool mAutomaticNameParsing; 42 bool mAutomaticNameParsing;
43 int mCurrentIncSearchField; 43 int mCurrentIncSearchField;
44 44
45#ifdef KAB_EMBEDDED 45#ifdef KAB_EMBEDDED
46 // US introduce a nonconst way to return the config object. 46 // US introduce a nonconst way to return the config object.
47 KConfig* getConfig(); 47 KConfig* getConfig();
48 48
49 bool mToolBarHor; 49 bool mToolBarHor;
50 bool mToolBarUp; 50 bool mToolBarUp;
51 bool mAskForQuit; 51 bool mAskForQuit;
52 52
53 53
54 /** Set preferences to default values */ 54 /** Set preferences to default values */
55// void usrSetDefaults(); 55// void usrSetDefaults();
56 56
57 /** Read preferences from config file */ 57 /** Read preferences from config file */
58// void usrReadConfig(); 58// void usrReadConfig();
59 59
60 /** Write preferences to config file */ 60 /** Write preferences to config file */
61// void usrWriteConfig(); 61// void usrWriteConfig();
62#endif //KAB_EMBEDDED 62#endif //KAB_EMBEDDED
63 63
64 64
65 // GUI 65 // GUI
66 bool mJumpButtonBarVisible; 66 bool mJumpButtonBarVisible;
67 bool mDetailsPageVisible; 67 bool mDetailsPageVisible;
68 bool mMultipleViewsAtOnce; 68 bool mMultipleViewsAtOnce;
69 bool mSearchWithReturn; 69 bool mSearchWithReturn;
70 QValueList<int> mExtensionsSplitter; 70 QValueList<int> mExtensionsSplitter;
71 QValueList<int> mDetailsSplitter; 71 QValueList<int> mDetailsSplitter;
72 72
73 // Extensions stuff 73 // Extensions stuff
74 int mCurrentExtension; 74 int mCurrentExtension;
75 QStringList mActiveExtensions; 75 QStringList mActiveExtensions;
76 76
77 // Views stuff 77 // Views stuff
78 QString mCurrentView; 78 QString mCurrentView;
79 QStringList mViewNames; 79 QStringList mViewNames;
80 80
81 // Filter 81 // Filter
82 int mCurrentFilter; 82 int mCurrentFilter;
83 83
84 void setCategoryDefaults(); 84 void setCategoryDefaults();
85 QFont mDetailsFont;
85 86
86 private: 87 private:
87 KABPrefs(); 88 KABPrefs();
88 89
89 static KABPrefs *sInstance; 90 static KABPrefs *sInstance;
90}; 91};
91 92
92#endif 93#endif
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index e970c3d..c8b68c7 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,356 +1,369 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qvbox.h> 34#include <qvbox.h>
35 35
36#include <kconfig.h> 36#include <kconfig.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include <kdialog.h> 38#include <kdialog.h>
39#include <klistview.h> 39#include <klistview.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kglobal.h> 41#include <kglobal.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <ktrader.h> 46#include <ktrader.h>
47#else // KAB_EMBEDDED 47#else // KAB_EMBEDDED
48#include <mergewidget.h> 48#include <mergewidget.h>
49#include <distributionlistwidget.h> 49#include <distributionlistwidget.h>
50#endif // KAB_EMBEDDED 50#endif // KAB_EMBEDDED
51 51
52#include "addresseewidget.h" 52#include "addresseewidget.h"
53#include "extensionconfigdialog.h" 53#include "extensionconfigdialog.h"
54#include "extensionwidget.h" 54#include "extensionwidget.h"
55#include "kabprefs.h" 55#include "kabprefs.h"
56 56
57#include "kabconfigwidget.h" 57#include "kabconfigwidget.h"
58 58
59class ExtensionItem : public QCheckListItem 59class ExtensionItem : public QCheckListItem
60{ 60{
61 public: 61 public:
62 62
63#ifndef KAB_EMBEDDED 63#ifndef KAB_EMBEDDED
64 ExtensionItem( QListView *parent, const QString &text ); 64 ExtensionItem( QListView *parent, const QString &text );
65 void setService( const KService::Ptr &ptr ); 65 void setService( const KService::Ptr &ptr );
66#else //KAB_EMBEDDED 66#else //KAB_EMBEDDED
67 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); 67 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment );
68 void setFactory( ExtensionFactory* fac ); 68 void setFactory( ExtensionFactory* fac );
69#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
70 70
71 bool configWidgetAvailable() const; 71 bool configWidgetAvailable() const;
72 ExtensionFactory *factory() const; 72 ExtensionFactory *factory() const;
73 73
74 virtual QString text( int column ) const; 74 virtual QString text( int column ) const;
75 75
76 private: 76 private:
77#ifndef KAB_EMBEDDED 77#ifndef KAB_EMBEDDED
78 KService::Ptr mPtr; 78 KService::Ptr mPtr;
79#else //KAB_EMBEDDED 79#else //KAB_EMBEDDED
80 ExtensionFactory* mFactory; 80 ExtensionFactory* mFactory;
81 QString mName; 81 QString mName;
82 QString mComment; 82 QString mComment;
83 83
84#endif //KAB_EMBEDDED 84#endif //KAB_EMBEDDED
85 85
86}; 86};
87 87
88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) 88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name )
89 : KPrefsWidget( prefs, parent, name ) 89 : KPrefsWidget( prefs, parent, name )
90{ 90{
91 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 91 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
92 KDialog::spacingHint() ); 92 KDialog::spacingHint() );
93 93
94 QTabWidget *tabWidget = new QTabWidget( this ); 94 QTabWidget *tabWidget = new QTabWidget( this );
95 topLayout->addWidget( tabWidget ); 95 topLayout->addWidget( tabWidget );
96 96
97 // General page 97 // General page
98 QWidget *generalPage = new QWidget( this ); 98 QWidget *generalPage = new QWidget( this );
99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
100 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
101
102 QWidget *hBox = new QWidget( generalPage, "qhbox" );
103 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox);
104 KPrefsWidFont *detailsFont =
105 addWidFont(i18n("phone:123"),i18n("Details view font"),
106 &(KABPrefs::instance()->mDetailsFont),hBox);
107 hboxLayout->addWidget(detailsFont->label());
108 hboxLayout->addWidget(detailsFont->preview());
109 hboxLayout->addWidget(detailsFont->button());
110 hboxLayout->setMargin(KDialog::marginHintSmall() );
111 hboxLayout->setSpacing(KDialog::spacingHintSmall());
112 layout->addWidget( hBox );
113
101 //general groupbox 114 //general groupbox
102 QVBox *vBox = new QVBox( generalPage, "qvbox" ); 115 QVBox *vBox = new QVBox( generalPage, "qvbox" );
103 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); 116 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" );
104 boxLayout->setAlignment( Qt::AlignTop ); 117 boxLayout->setAlignment( Qt::AlignTop );
105 boxLayout->setMargin(KDialog::marginHintSmall() ); 118 boxLayout->setMargin(KDialog::marginHintSmall() );
106 vBox->layout()->setMargin(KDialog::marginHintSmall()) ; 119 vBox->layout()->setMargin(KDialog::marginHintSmall()) ;
107 vBox->layout()->setSpacing(KDialog::spacingHintSmall()); 120 vBox->layout()->setSpacing(KDialog::spacingHintSmall());
108 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 121 boxLayout->setSpacing( KDialog::spacingHintSmall() );
109 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 122 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
110 boxLayout->addWidget( mSearchReturnBox ); 123 boxLayout->addWidget( mSearchReturnBox );
111 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); 124 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
112 boxLayout->addWidget( mViewsSingleClickBox ); 125 boxLayout->addWidget( mViewsSingleClickBox );
113 126
114 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); 127 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
115 boxLayout->addWidget( mNameParsing ); 128 boxLayout->addWidget( mNameParsing );
116 129
117 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 130 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
118 boxLayout->addWidget( mMultipleViewsAtOnce ); 131 boxLayout->addWidget( mMultipleViewsAtOnce );
119 132
120 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); 133 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
121 boxLayout->addWidget( mAskForQuit ); 134 boxLayout->addWidget( mAskForQuit );
122 135
123 layout->addWidget( vBox ); 136 layout->addWidget( vBox );
124 137
125 tabWidget->addTab( generalPage, i18n( "General" ) ); 138 tabWidget->addTab( generalPage, i18n( "General" ) );
126 139
127 // Extension page 140 // Extension page
128 QWidget *extensionPage = new QWidget( this ); 141 QWidget *extensionPage = new QWidget( this );
129 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 142 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
130 KDialog::spacingHintSmall() ); 143 KDialog::spacingHintSmall() );
131 144
132 //extensions groupbox 145 //extensions groupbox
133 146
134 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 147 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
135 boxLayout = new QVBoxLayout( groupBox->layout() ); 148 boxLayout = new QVBoxLayout( groupBox->layout() );
136 boxLayout->setAlignment( Qt::AlignTop ); 149 boxLayout->setAlignment( Qt::AlignTop );
137 boxLayout->setMargin(KDialog::marginHintSmall()); 150 boxLayout->setMargin(KDialog::marginHintSmall());
138 boxLayout->setSpacing(KDialog::spacingHintSmall()); 151 boxLayout->setSpacing(KDialog::spacingHintSmall());
139 groupBox->layout()->setMargin(1) ; 152 groupBox->layout()->setMargin(1) ;
140 groupBox->layout()->setSpacing(0); 153 groupBox->layout()->setSpacing(0);
141 mExtensionView = new KListView( groupBox ); 154 mExtensionView = new KListView( groupBox );
142 mExtensionView->setAllColumnsShowFocus( true ); 155 mExtensionView->setAllColumnsShowFocus( true );
143 mExtensionView->addColumn( i18n( "Name" ) ); 156 mExtensionView->addColumn( i18n( "Name" ) );
144 mExtensionView->addColumn( i18n( "Description" ) ); 157 mExtensionView->addColumn( i18n( "Description" ) );
145 mExtensionView->setMaximumHeight(80); 158 mExtensionView->setMaximumHeight(80);
146 159
147 boxLayout->addWidget( mExtensionView ); 160 boxLayout->addWidget( mExtensionView );
148 161
149 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 162 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
150 mConfigureButton->setEnabled( false ); 163 mConfigureButton->setEnabled( false );
151 boxLayout->addWidget( mConfigureButton ); 164 boxLayout->addWidget( mConfigureButton );
152 165
153 extensionLayout->addWidget( groupBox ); 166 extensionLayout->addWidget( groupBox );
154 167
155 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 168 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
156 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 169 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
157 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 170 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
158 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 171 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
159 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 172 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
160 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 173 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
161 SLOT( selectionChanged( QListViewItem* ) ) ); 174 SLOT( selectionChanged( QListViewItem* ) ) );
162 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 175 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
163 SLOT( itemClicked( QListViewItem* ) ) ); 176 SLOT( itemClicked( QListViewItem* ) ) );
164 connect( mConfigureButton, SIGNAL( clicked() ), 177 connect( mConfigureButton, SIGNAL( clicked() ),
165 SLOT( configureExtension() ) ); 178 SLOT( configureExtension() ) );
166 179
167 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 180 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
168 181
169 // Addressee page 182 // Addressee page
170 mAddresseeWidget = new AddresseeWidget( this ); 183 mAddresseeWidget = new AddresseeWidget( this );
171 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 184 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
172 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 185 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
173 186
174} 187}
175 188
176void KABConfigWidget::usrReadConfig() 189void KABConfigWidget::usrReadConfig()
177{ 190{
178 KABPrefs* prefs = KABPrefs::instance(); 191 KABPrefs* prefs = KABPrefs::instance();
179 192
180 bool blocked = signalsBlocked(); 193 bool blocked = signalsBlocked();
181 blockSignals( true ); 194 blockSignals( true );
182 195
183 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 196 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
184 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 197 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
185 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 198 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
186 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 199 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
187 mAskForQuit->setChecked( prefs->mAskForQuit ); 200 mAskForQuit->setChecked( prefs->mAskForQuit );
188 201
189 mAddresseeWidget->restoreSettings(); 202 mAddresseeWidget->restoreSettings();
190 203
191 restoreExtensionSettings(); 204 restoreExtensionSettings();
192 205
193 blockSignals( blocked ); 206 blockSignals( blocked );
194 207
195} 208}
196 209
197void KABConfigWidget::usrWriteConfig() 210void KABConfigWidget::usrWriteConfig()
198{ 211{
199 KABPrefs* prefs = KABPrefs::instance(); 212 KABPrefs* prefs = KABPrefs::instance();
200 213
201 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 214 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
202 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 215 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
203 prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); 216 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
204 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 217 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
205 prefs->mAskForQuit = mAskForQuit->isChecked(); 218 prefs->mAskForQuit = mAskForQuit->isChecked();
206 219
207 mAddresseeWidget->saveSettings(); 220 mAddresseeWidget->saveSettings();
208 221
209 saveExtensionSettings(); 222 saveExtensionSettings();
210 223
211} 224}
212 225
213void KABConfigWidget::restoreExtensionSettings() 226void KABConfigWidget::restoreExtensionSettings()
214{ 227{
215 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 228 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
216 229
217 mExtensionView->clear(); 230 mExtensionView->clear();
218 231
219#ifndef KAB_EMBEDDED 232#ifndef KAB_EMBEDDED
220 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 233 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
221 KTrader::OfferList::ConstIterator it; 234 KTrader::OfferList::ConstIterator it;
222 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 235 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
223 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 236 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
224 continue; 237 continue;
225 238
226 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 239 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
227 item->setService( *it ); 240 item->setService( *it );
228 if ( activeExtensions.contains( item->factory()->identifier() ) ) 241 if ( activeExtensions.contains( item->factory()->identifier() ) )
229 item->setOn( true ); 242 item->setOn( true );
230 } 243 }
231#else //KAB_EMBEDDED 244#else //KAB_EMBEDDED
232 ExtensionFactory *extensionFactory = new MergeFactory(); 245 ExtensionFactory *extensionFactory = new MergeFactory();
233 246
234 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 247 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
235 248
236 item->setFactory( extensionFactory ); 249 item->setFactory( extensionFactory );
237 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 250 if ( activeExtensions.contains( extensionFactory->identifier() ) )
238 item->setOn( true ); 251 item->setOn( true );
239 252
240 253
241 254
242 extensionFactory = new DistributionListFactory(); 255 extensionFactory = new DistributionListFactory();
243 256
244 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 257 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
245 258
246 item->setFactory( extensionFactory ); 259 item->setFactory( extensionFactory );
247 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 260 if ( activeExtensions.contains( extensionFactory->identifier() ) )
248 item->setOn( true ); 261 item->setOn( true );
249 262
250 263
251#endif //KAB_EMBEDDED 264#endif //KAB_EMBEDDED
252 265
253} 266}
254 267
255void KABConfigWidget::saveExtensionSettings() 268void KABConfigWidget::saveExtensionSettings()
256{ 269{
257 QStringList activeExtensions; 270 QStringList activeExtensions;
258 271
259 QPtrList<QListViewItem> list; 272 QPtrList<QListViewItem> list;
260 QListViewItemIterator it( mExtensionView ); 273 QListViewItemIterator it( mExtensionView );
261 while ( it.current() ) { 274 while ( it.current() ) {
262 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); 275 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
263 if ( item ) { 276 if ( item ) {
264 if ( item->isOn() ) 277 if ( item->isOn() )
265 activeExtensions.append( item->factory()->identifier() ); 278 activeExtensions.append( item->factory()->identifier() );
266 } 279 }
267 ++it; 280 ++it;
268 } 281 }
269 282
270 KABPrefs::instance()->mActiveExtensions = activeExtensions; 283 KABPrefs::instance()->mActiveExtensions = activeExtensions;
271} 284}
272 285
273void KABConfigWidget::configureExtension() 286void KABConfigWidget::configureExtension()
274{ 287{
275 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); 288 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
276 if ( !item ) 289 if ( !item )
277 return; 290 return;
278 291
279#ifndef KAB_EMBEDDED 292#ifndef KAB_EMBEDDED
280 KConfig config( "kaddressbookrc" ); 293 KConfig config( "kaddressbookrc" );
281#else //KAB_EMBEDDED 294#else //KAB_EMBEDDED
282 KConfig config( locateLocal("config", "kaddressbookrc") ); 295 KConfig config( locateLocal("config", "kaddressbookrc") );
283#endif //KAB_EMBEDDED 296#endif //KAB_EMBEDDED
284 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); 297 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
285 298
286 ExtensionConfigDialog dlg( item->factory(), &config, this ); 299 ExtensionConfigDialog dlg( item->factory(), &config, this );
287 dlg.exec(); 300 dlg.exec();
288 301
289 config.sync(); 302 config.sync();
290} 303}
291 304
292void KABConfigWidget::selectionChanged( QListViewItem *i ) 305void KABConfigWidget::selectionChanged( QListViewItem *i )
293{ 306{
294 ExtensionItem *item = static_cast<ExtensionItem*>( i ); 307 ExtensionItem *item = static_cast<ExtensionItem*>( i );
295 if ( !item ) 308 if ( !item )
296 return; 309 return;
297 310
298 mConfigureButton->setEnabled( item->configWidgetAvailable() ); 311 mConfigureButton->setEnabled( item->configWidgetAvailable() );
299} 312}
300 313
301void KABConfigWidget::itemClicked( QListViewItem *item ) 314void KABConfigWidget::itemClicked( QListViewItem *item )
302{ 315{
303 if ( item != 0 ) 316 if ( item != 0 )
304 modified(); 317 modified();
305} 318}
306 319
307#ifndef KAB_EMBEDDED 320#ifndef KAB_EMBEDDED
308ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) 321ExtensionItem::ExtensionItem( QListView *parent, const QString &text )
309 : QCheckListItem( parent, text, CheckBox ) 322 : QCheckListItem( parent, text, CheckBox )
310{ 323{
311} 324}
312 325
313void ExtensionItem::setService( const KService::Ptr &ptr ) 326void ExtensionItem::setService( const KService::Ptr &ptr )
314{ 327{
315 mPtr = ptr; 328 mPtr = ptr;
316} 329}
317#else //KAB_EMBEDDED 330#else //KAB_EMBEDDED
318ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) 331ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment )
319 : QCheckListItem( parent, text, CheckBox ) 332 : QCheckListItem( parent, text, CheckBox )
320{ 333{
321 mName = name; 334 mName = name;
322 mComment = comment; 335 mComment = comment;
323} 336}
324 337
325 338
326void ExtensionItem::setFactory( ExtensionFactory* fac ) 339void ExtensionItem::setFactory( ExtensionFactory* fac )
327{ 340{
328 mFactory = fac; 341 mFactory = fac;
329} 342}
330#endif //KAB_EMBEDDED 343#endif //KAB_EMBEDDED
331 344
332bool ExtensionItem::configWidgetAvailable() const 345bool ExtensionItem::configWidgetAvailable() const
333{ 346{
334#ifndef KAB_EMBEDDED 347#ifndef KAB_EMBEDDED
335 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 348 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
336 if ( !factory ) 349 if ( !factory )
337 return false; 350 return false;
338 351
339 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); 352 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
340 if ( !extensionFactory ) 353 if ( !extensionFactory )
341 return false; 354 return false;
342 355
343 return extensionFactory->configureWidgetAvailable(); 356 return extensionFactory->configureWidgetAvailable();
344#else //KAB_EMBEDDED 357#else //KAB_EMBEDDED
345 return mFactory->configureWidgetAvailable(); 358 return mFactory->configureWidgetAvailable();
346#endif //KAB_EMBEDDED 359#endif //KAB_EMBEDDED
347 360
348} 361}
349 362
350ExtensionFactory *ExtensionItem::factory() const 363ExtensionFactory *ExtensionItem::factory() const
351{ 364{
352#ifndef KAB_EMBEDDED 365#ifndef KAB_EMBEDDED
353 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 366 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
354 if ( !factory ) 367 if ( !factory )
355 return 0; 368 return 0;
356 369