summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs/kabconfigwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kcmconfigs/kabconfigwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp59
1 files changed, 31 insertions, 28 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 9e4db74..d2b7ef1 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,219 +1,223 @@
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 <q3frame.h>
26#include <qgroupbox.h> 26#include <q3groupbox.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 <q3vbox.h>
35//Added by qt3to4:
36#include <Q3HBoxLayout>
37#include <Q3PtrList>
38#include <Q3VBoxLayout>
35 39
36#include <kconfig.h> 40#include <kconfig.h>
37#include <kdebug.h> 41#include <kdebug.h>
38#include <kdialog.h> 42#include <kdialog.h>
39#include <klistview.h> 43#include <klistview.h>
40#include <klocale.h> 44#include <klocale.h>
41#include <kglobal.h> 45#include <kglobal.h>
42#include <kmessagebox.h> 46#include <kmessagebox.h>
43#include <kstandarddirs.h> 47#include <kstandarddirs.h>
44 48
45#ifndef KAB_EMBEDDED 49#ifndef KAB_EMBEDDED
46#include <ktrader.h> 50#include <ktrader.h>
47#else // KAB_EMBEDDED 51#else // KAB_EMBEDDED
48#include <mergewidget.h> 52#include <mergewidget.h>
49#include <distributionlistwidget.h> 53#include <distributionlistwidget.h>
50#endif // KAB_EMBEDDED 54#endif // KAB_EMBEDDED
51 55
52#include "addresseewidget.h" 56#include "addresseewidget.h"
53#include "extensionconfigdialog.h" 57#include "extensionconfigdialog.h"
54#include "extensionwidget.h" 58#include "extensionwidget.h"
55#include "kabprefs.h" 59#include "kabprefs.h"
56 60
57#include "kabconfigwidget.h" 61#include "kabconfigwidget.h"
58#include <kglobalsettings.h> 62#include <kglobalsettings.h>
59 63
60class ExtensionItem : public QCheckListItem 64class ExtensionItem : public Q3CheckListItem
61{ 65{
62 public: 66 public:
63 67
64#ifndef KAB_EMBEDDED 68#ifndef KAB_EMBEDDED
65 ExtensionItem( QListView *parent, const QString &text ); 69 ExtensionItem( Q3ListView *parent, const QString &text );
66 void setService( const KService::Ptr &ptr ); 70 void setService( const KService::Ptr &ptr );
67#else //KAB_EMBEDDED 71#else //KAB_EMBEDDED
68 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); 72 ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment );
69 void setFactory( ExtensionFactory* fac ); 73 void setFactory( ExtensionFactory* fac );
70#endif //KAB_EMBEDDED 74#endif //KAB_EMBEDDED
71 75
72 bool configWidgetAvailable() const; 76 bool configWidgetAvailable() const;
73 ExtensionFactory *factory() const; 77 ExtensionFactory *factory() const;
74 78
75 virtual QString text( int column ) const; 79 virtual QString text( int column ) const;
76 80
77 private: 81 private:
78#ifndef KAB_EMBEDDED 82#ifndef KAB_EMBEDDED
79 KService::Ptr mPtr; 83 KService::Ptr mPtr;
80#else //KAB_EMBEDDED 84#else //KAB_EMBEDDED
81 ExtensionFactory* mFactory; 85 ExtensionFactory* mFactory;
82 QString mName; 86 QString mName;
83 QString mComment; 87 QString mComment;
84 88
85#endif //KAB_EMBEDDED 89#endif //KAB_EMBEDDED
86 90
87}; 91};
88 92
89KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) 93KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name )
90 : KPrefsWidget( prefs, parent, name ) 94 : KPrefsWidget( prefs, parent, name )
91{ 95{
92 96
93 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 97 Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0,
94 KDialog::spacingHintSmall() ); 98 KDialog::spacingHintSmall() );
95 99
96 QTabWidget *tabWidget = new QTabWidget( this ); 100 QTabWidget *tabWidget = new QTabWidget( this );
97 topLayout->addWidget( tabWidget ); 101 topLayout->addWidget( tabWidget );
98 102
99 // General page 103 // General page
100 QWidget *generalPage = new QWidget( this ); 104 QWidget *generalPage = new QWidget( this );
101 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 105 Q3VBoxLayout *layout = new Q3VBoxLayout( generalPage, KDialog::marginHintSmall(),
102 KDialog::spacingHintSmall() ); 106 KDialog::spacingHintSmall() );
103 107
104 108
105 QWidget *hBox = new QWidget( generalPage, "qhbox" ); 109 QWidget *hBox = new QWidget( generalPage, "qhbox" );
106 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); 110 Q3HBoxLayout *hboxLayout = new Q3HBoxLayout( hBox);
107 KPrefsWidFont *detailsFont = 111 KPrefsWidFont *detailsFont =
108 addWidFont(i18n("phone:123"),i18n("Details view font"), 112 addWidFont(i18n("phone:123"),i18n("Details view font"),
109 &(KABPrefs::instance()->mDetailsFont),hBox); 113 &(KABPrefs::instance()->mDetailsFont),hBox);
110 hboxLayout->addWidget(detailsFont->label()); 114 hboxLayout->addWidget(detailsFont->label());
111 hboxLayout->addWidget(detailsFont->preview()); 115 hboxLayout->addWidget(detailsFont->preview());
112 hboxLayout->addWidget(detailsFont->button()); 116 hboxLayout->addWidget(detailsFont->button());
113 hboxLayout->setMargin(KDialog::marginHintSmall() ); 117 hboxLayout->setMargin(KDialog::marginHintSmall() );
114 hboxLayout->setSpacing(KDialog::spacingHintSmall()); 118 hboxLayout->setSpacing(KDialog::spacingHintSmall());
115 //hBox->setBackgroundColor( black); 119 //hBox->setBackgroundColor( black);
116 layout->addWidget( hBox ); 120 layout->addWidget( hBox );
117 121
118 //general groupbox 122 //general groupbox
119 QWidget *vBox = new QWidget( generalPage, "qvbox" ); 123 QWidget *vBox = new QWidget( generalPage, "qvbox" );
120 QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); 124 Q3VBoxLayout *boxLayout = new Q3VBoxLayout( vBox );
121 boxLayout->setAlignment( Qt::AlignTop ); 125 boxLayout->setAlignment( Qt::AlignTop );
122 boxLayout->setMargin(KDialog::marginHintSmall() ); 126 boxLayout->setMargin(KDialog::marginHintSmall() );
123 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 127 boxLayout->setSpacing( KDialog::spacingHintSmall() );
124 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); 128 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" );
125 boxLayout->addWidget( mMenuBarBox ); 129 boxLayout->addWidget( mMenuBarBox );
126 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 130 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
127 boxLayout->addWidget( mSearchReturnBox ); 131 boxLayout->addWidget( mSearchReturnBox );
128 mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); 132 mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" );
129 boxLayout->addWidget( mAutoSearchWithWildcardBox); 133 boxLayout->addWidget( mAutoSearchWithWildcardBox);
130 mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); 134 mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" );
131 boxLayout->addWidget( mHideSearchOnSwitchBox ); 135 boxLayout->addWidget( mHideSearchOnSwitchBox );
132 136
133#ifdef DESKTOP_VERSION 137#ifdef DESKTOP_VERSION
134 mHideSearchOnSwitchBox->hide(); 138 mHideSearchOnSwitchBox->hide();
135#endif 139#endif
136 mViewsSingleClickBox = new QCheckBox( i18n( "Show edit dialog on single click" ), vBox, "msingle" ); 140 mViewsSingleClickBox = new QCheckBox( i18n( "Show edit dialog on single click" ), vBox, "msingle" );
137 boxLayout->addWidget( mViewsSingleClickBox ); 141 boxLayout->addWidget( mViewsSingleClickBox );
138 142
139 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new contacts" ), vBox, "mparse" ); 143 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new contacts" ), vBox, "mparse" );
140 boxLayout->addWidget( mNameParsing ); 144 boxLayout->addWidget( mNameParsing );
141 145
142 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 146 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
143 boxLayout->addWidget( mMultipleViewsAtOnce ); 147 boxLayout->addWidget( mMultipleViewsAtOnce );
144 148
145 mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" ); 149 mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" );
146 boxLayout->addWidget( mAskForDelete ); 150 boxLayout->addWidget( mAskForDelete );
147 151
148 mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" ); 152 mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" );
149 boxLayout->addWidget( mAskForQuit ); 153 boxLayout->addWidget( mAskForQuit );
150 154
151 layout->addWidget( vBox ); 155 layout->addWidget( vBox );
152 156
153 tabWidget->addTab( generalPage, i18n( "General" ) ); 157 tabWidget->addTab( generalPage, i18n( "General" ) );
154 158
155 // Extension page 159 // Extension page
156 QWidget *extensionPage = new QWidget( this ); 160 QWidget *extensionPage = new QWidget( this );
157 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 161 Q3VBoxLayout *extensionLayout = new Q3VBoxLayout( extensionPage, KDialog::marginHintSmall(),
158 KDialog::spacingHintSmall() ); 162 KDialog::spacingHintSmall() );
159 163
160 //extensions groupbox 164 //extensions groupbox
161 165
162 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 166 Q3GroupBox* groupBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
163 boxLayout = new QVBoxLayout( groupBox->layout() ); 167 boxLayout = new Q3VBoxLayout( groupBox->layout() );
164 boxLayout->setAlignment( Qt::AlignTop ); 168 boxLayout->setAlignment( Qt::AlignTop );
165 boxLayout->setMargin(KDialog::marginHintSmall()); 169 boxLayout->setMargin(KDialog::marginHintSmall());
166 boxLayout->setSpacing(KDialog::spacingHintSmall()); 170 boxLayout->setSpacing(KDialog::spacingHintSmall());
167 groupBox->layout()->setMargin(1) ; 171 groupBox->layout()->setMargin(1) ;
168 groupBox->layout()->setSpacing(0); 172 groupBox->layout()->setSpacing(0);
169 mExtensionView = new KListView( groupBox ); 173 mExtensionView = new KListView( groupBox );
170 mExtensionView->setAllColumnsShowFocus( true ); 174 mExtensionView->setAllColumnsShowFocus( true );
171 mExtensionView->addColumn( i18n( "Name" ) ); 175 mExtensionView->addColumn( i18n( "Name" ) );
172 mExtensionView->addColumn( i18n( "Description" ) ); 176 mExtensionView->addColumn( i18n( "Description" ) );
173 //mExtensionView->setMaximumHeight(80); 177 //mExtensionView->setMaximumHeight(80);
174 178
175 boxLayout->addWidget( mExtensionView ); 179 boxLayout->addWidget( mExtensionView );
176 180
177 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 181 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
178 mConfigureButton->setEnabled( false ); 182 mConfigureButton->setEnabled( false );
179 boxLayout->addWidget( mConfigureButton ); 183 boxLayout->addWidget( mConfigureButton );
180 184
181 extensionLayout->addWidget( groupBox ); 185 extensionLayout->addWidget( groupBox );
182 186
183 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 187 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
184 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 188 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
185 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 189 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
186 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 190 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
187 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 191 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
188 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 192 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
189 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 193 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
190 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 194 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
191 connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 195 connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
192 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 196 connect( mExtensionView, SIGNAL( selectionChanged( Q3ListViewItem* ) ),
193 SLOT( selectionChanged( QListViewItem* ) ) ); 197 SLOT( selectionChanged( Q3ListViewItem* ) ) );
194 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 198 connect( mExtensionView, SIGNAL( clicked( Q3ListViewItem* ) ),
195 SLOT( itemClicked( QListViewItem* ) ) ); 199 SLOT( itemClicked( Q3ListViewItem* ) ) );
196 connect( mConfigureButton, SIGNAL( clicked() ), 200 connect( mConfigureButton, SIGNAL( clicked() ),
197 SLOT( configureExtension() ) ); 201 SLOT( configureExtension() ) );
198 202
199 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 203 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
200 204
201 // Addressee page 205 // Addressee page
202 mAddresseeWidget = new AddresseeWidget( this ); 206 mAddresseeWidget = new AddresseeWidget( this );
203 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 207 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
204 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 208 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
205 209
206} 210}
207 211
208void KABConfigWidget::usrReadConfig() 212void KABConfigWidget::usrReadConfig()
209{ 213{
210 KABPrefs* prefs = KABPrefs::instance(); 214 KABPrefs* prefs = KABPrefs::instance();
211 215
212 bool blocked = signalsBlocked(); 216 bool blocked = signalsBlocked();
213 blockSignals( true ); 217 blockSignals( true );
214 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); 218 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
215 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 219 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
216 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 220 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
217 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 221 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
218 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); 222 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard );
219 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); 223 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch );
@@ -274,109 +278,109 @@ void KABConfigWidget::restoreExtensionSettings()
274 278
275 item->setFactory( extensionFactory ); 279 item->setFactory( extensionFactory );
276 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 280 if ( activeExtensions.contains( extensionFactory->identifier() ) )
277 item->setOn( true ); 281 item->setOn( true );
278 282
279 283
280 284
281 extensionFactory = new DistributionListFactory(); 285 extensionFactory = new DistributionListFactory();
282 286
283 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 287 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
284 288
285 item->setFactory( extensionFactory ); 289 item->setFactory( extensionFactory );
286 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 290 if ( activeExtensions.contains( extensionFactory->identifier() ) )
287 item->setOn( true ); 291 item->setOn( true );
288 292
289 293
290#endif //KAB_EMBEDDED 294#endif //KAB_EMBEDDED
291 295
292} 296}
293 297
294void KABConfigWidget::saveExtensionSettings() 298void KABConfigWidget::saveExtensionSettings()
295{ 299{
296 QStringList activeExtensions; 300 QStringList activeExtensions;
297 301
298 QPtrList<QListViewItem> list; 302 Q3PtrList<Q3ListViewItem> list;
299 QListViewItemIterator it( mExtensionView ); 303 Q3ListViewItemIterator it( mExtensionView );
300 while ( it.current() ) { 304 while ( it.current() ) {
301 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); 305 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
302 if ( item ) { 306 if ( item ) {
303 if ( item->isOn() ) 307 if ( item->isOn() )
304 activeExtensions.append( item->factory()->identifier() ); 308 activeExtensions.append( item->factory()->identifier() );
305 } 309 }
306 ++it; 310 ++it;
307 } 311 }
308 312
309 KABPrefs::instance()->mActiveExtensions = activeExtensions; 313 KABPrefs::instance()->mActiveExtensions = activeExtensions;
310} 314}
311 315
312void KABConfigWidget::configureExtension() 316void KABConfigWidget::configureExtension()
313{ 317{
314 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); 318 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
315 if ( !item ) 319 if ( !item )
316 return; 320 return;
317 321
318#ifndef KAB_EMBEDDED 322#ifndef KAB_EMBEDDED
319 KConfig config( "kaddressbookrc" ); 323 KConfig config( "kaddressbookrc" );
320#else //KAB_EMBEDDED 324#else //KAB_EMBEDDED
321 KConfig config( locateLocal("config", "kaddressbookrc") ); 325 KConfig config( locateLocal("config", "kaddressbookrc") );
322#endif //KAB_EMBEDDED 326#endif //KAB_EMBEDDED
323 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); 327 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
324 328
325 ExtensionConfigDialog dlg( item->factory(), &config, this ); 329 ExtensionConfigDialog dlg( item->factory(), &config, this );
326 dlg.exec(); 330 dlg.exec();
327 331
328 config.sync(); 332 config.sync();
329} 333}
330 334
331void KABConfigWidget::selectionChanged( QListViewItem *i ) 335void KABConfigWidget::selectionChanged( Q3ListViewItem *i )
332{ 336{
333 ExtensionItem *item = static_cast<ExtensionItem*>( i ); 337 ExtensionItem *item = static_cast<ExtensionItem*>( i );
334 if ( !item ) 338 if ( !item )
335 return; 339 return;
336 340
337 mConfigureButton->setEnabled( item->configWidgetAvailable() ); 341 mConfigureButton->setEnabled( item->configWidgetAvailable() );
338} 342}
339 343
340void KABConfigWidget::itemClicked( QListViewItem *item ) 344void KABConfigWidget::itemClicked( Q3ListViewItem *item )
341{ 345{
342 if ( item != 0 ) 346 if ( item != 0 )
343 modified(); 347 modified();
344} 348}
345 349
346#ifndef KAB_EMBEDDED 350#ifndef KAB_EMBEDDED
347ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) 351ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text )
348 : QCheckListItem( parent, text, CheckBox ) 352 : Q3CheckListItem( parent, text, CheckBox )
349{ 353{
350} 354}
351 355
352void ExtensionItem::setService( const KService::Ptr &ptr ) 356void ExtensionItem::setService( const KService::Ptr &ptr )
353{ 357{
354 mPtr = ptr; 358 mPtr = ptr;
355} 359}
356#else //KAB_EMBEDDED 360#else //KAB_EMBEDDED
357ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) 361ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment )
358 : QCheckListItem( parent, text, CheckBox ) 362 : Q3CheckListItem( parent, text, CheckBox )
359{ 363{
360 mName = name; 364 mName = name;
361 mComment = comment; 365 mComment = comment;
362} 366}
363 367
364 368
365void ExtensionItem::setFactory( ExtensionFactory* fac ) 369void ExtensionItem::setFactory( ExtensionFactory* fac )
366{ 370{
367 mFactory = fac; 371 mFactory = fac;
368} 372}
369#endif //KAB_EMBEDDED 373#endif //KAB_EMBEDDED
370 374
371bool ExtensionItem::configWidgetAvailable() const 375bool ExtensionItem::configWidgetAvailable() const
372{ 376{
373#ifndef KAB_EMBEDDED 377#ifndef KAB_EMBEDDED
374 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 378 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
375 if ( !factory ) 379 if ( !factory )
376 return false; 380 return false;
377 381
378 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); 382 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
379 if ( !extensionFactory ) 383 if ( !extensionFactory )
380 return false; 384 return false;
381 385
382 return extensionFactory->configureWidgetAvailable(); 386 return extensionFactory->configureWidgetAvailable();
@@ -397,28 +401,27 @@ ExtensionFactory *ExtensionItem::factory() const
397#else //KAB_EMBEDDED 401#else //KAB_EMBEDDED
398 return mFactory; 402 return mFactory;
399#endif //KAB_EMBEDDED 403#endif //KAB_EMBEDDED
400} 404}
401 405
402QString ExtensionItem::text( int column ) const 406QString ExtensionItem::text( int column ) const
403{ 407{
404#ifndef KAB_EMBEDDED 408#ifndef KAB_EMBEDDED
405 if ( column == 0 ) 409 if ( column == 0 )
406 return mPtr->name(); 410 return mPtr->name();
407 else if ( column == 1 ) 411 else if ( column == 1 )
408 return mPtr->comment(); 412 return mPtr->comment();
409 else 413 else
410 return QString::null; 414 return QString::null;
411#else //KAB_EMBEDDED 415#else //KAB_EMBEDDED
412 if ( column == 0 ) 416 if ( column == 0 )
413 return mName; 417 return mName;
414 else if ( column == 1 ) 418 else if ( column == 1 )
415 return mComment; 419 return mComment;
416 else 420 else
417 return QString::null; 421 return QString::null;
418#endif //KAB_EMBEDDED 422#endif //KAB_EMBEDDED
419} 423}
420 424
421#ifndef KAB_EMBEDDED 425#ifndef KAB_EMBEDDED_
422#include "kabconfigwidget.moc" 426#include "moc_kabconfigwidget.cpp"
423#endif //KAB_EMBEDDED 427#endif //KAB_EMBEDDED
424