summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
Unidiff
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 986c9b8..8a4dd3d 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,348 +1,350 @@
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#include <kglobalsettings.h>
58 59
59class ExtensionItem : public QCheckListItem 60class ExtensionItem : public QCheckListItem
60{ 61{
61 public: 62 public:
62 63
63#ifndef KAB_EMBEDDED 64#ifndef KAB_EMBEDDED
64 ExtensionItem( QListView *parent, const QString &text ); 65 ExtensionItem( QListView *parent, const QString &text );
65 void setService( const KService::Ptr &ptr ); 66 void setService( const KService::Ptr &ptr );
66#else //KAB_EMBEDDED 67#else //KAB_EMBEDDED
67 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); 68 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment );
68 void setFactory( ExtensionFactory* fac ); 69 void setFactory( ExtensionFactory* fac );
69#endif //KAB_EMBEDDED 70#endif //KAB_EMBEDDED
70 71
71 bool configWidgetAvailable() const; 72 bool configWidgetAvailable() const;
72 ExtensionFactory *factory() const; 73 ExtensionFactory *factory() const;
73 74
74 virtual QString text( int column ) const; 75 virtual QString text( int column ) const;
75 76
76 private: 77 private:
77#ifndef KAB_EMBEDDED 78#ifndef KAB_EMBEDDED
78 KService::Ptr mPtr; 79 KService::Ptr mPtr;
79#else //KAB_EMBEDDED 80#else //KAB_EMBEDDED
80 ExtensionFactory* mFactory; 81 ExtensionFactory* mFactory;
81 QString mName; 82 QString mName;
82 QString mComment; 83 QString mComment;
83 84
84#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
85 86
86}; 87};
87 88
88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) 89KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name )
89 : KPrefsWidget( prefs, parent, name ) 90 : KPrefsWidget( prefs, parent, name )
90{ 91{
92
91 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 93 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
92 KDialog::spacingHint() ); 94 KDialog::spacingHintSmall() );
93 95
94 QTabWidget *tabWidget = new QTabWidget( this ); 96 QTabWidget *tabWidget = new QTabWidget( this );
95 topLayout->addWidget( tabWidget ); 97 topLayout->addWidget( tabWidget );
96 98
97 // General page 99 // General page
98 QWidget *generalPage = new QWidget( this ); 100 QWidget *generalPage = new QWidget( this );
99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 101 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
100 KDialog::spacingHintSmall() ); 102 KDialog::spacingHintSmall() );
101 103
102 104
103 QWidget *hBox = new QWidget( generalPage, "qhbox" ); 105 QWidget *hBox = new QWidget( generalPage, "qhbox" );
104 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); 106 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox);
105 KPrefsWidFont *detailsFont = 107 KPrefsWidFont *detailsFont =
106 addWidFont(i18n("phone:123"),i18n("Details view font"), 108 addWidFont(i18n("phone:123"),i18n("Details view font"),
107 &(KABPrefs::instance()->mDetailsFont),hBox); 109 &(KABPrefs::instance()->mDetailsFont),hBox);
108 hboxLayout->addWidget(detailsFont->label()); 110 hboxLayout->addWidget(detailsFont->label());
109 hboxLayout->addWidget(detailsFont->preview()); 111 hboxLayout->addWidget(detailsFont->preview());
110 hboxLayout->addWidget(detailsFont->button()); 112 hboxLayout->addWidget(detailsFont->button());
111 hboxLayout->setMargin(KDialog::marginHintSmall() ); 113 hboxLayout->setMargin(KDialog::marginHintSmall() );
112 hboxLayout->setSpacing(KDialog::spacingHintSmall()); 114 hboxLayout->setSpacing(KDialog::spacingHintSmall());
113 //hBox->setBackgroundColor( black); 115 //hBox->setBackgroundColor( black);
114 layout->addWidget( hBox ); 116 layout->addWidget( hBox );
115 117
116 //general groupbox 118 //general groupbox
117 QWidget *vBox = new QWidget( generalPage, "qvbox" ); 119 QWidget *vBox = new QWidget( generalPage, "qvbox" );
118 QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); 120 QVBoxLayout *boxLayout = new QVBoxLayout( vBox );
119 boxLayout->setAlignment( Qt::AlignTop ); 121 boxLayout->setAlignment( Qt::AlignTop );
120 boxLayout->setMargin(KDialog::marginHintSmall() ); 122 boxLayout->setMargin(KDialog::marginHintSmall() );
121 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 123 boxLayout->setSpacing( KDialog::spacingHintSmall() );
122 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); 124 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" );
123 boxLayout->addWidget( mMenuBarBox ); 125 boxLayout->addWidget( mMenuBarBox );
124 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 126 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
125 boxLayout->addWidget( mSearchReturnBox ); 127 boxLayout->addWidget( mSearchReturnBox );
126 mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); 128 mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" );
127 boxLayout->addWidget( mAutoSearchWithWildcardBox); 129 boxLayout->addWidget( mAutoSearchWithWildcardBox);
128 mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); 130 mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" );
129 boxLayout->addWidget( mHideSearchOnSwitchBox ); 131 boxLayout->addWidget( mHideSearchOnSwitchBox );
130 132
131#ifdef DESKTOP_VERSION 133#ifdef DESKTOP_VERSION
132 mHideSearchOnSwitchBox->hide(); 134 mHideSearchOnSwitchBox->hide();
133#endif 135#endif
134 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); 136 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
135 boxLayout->addWidget( mViewsSingleClickBox ); 137 boxLayout->addWidget( mViewsSingleClickBox );
136 138
137 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); 139 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
138 boxLayout->addWidget( mNameParsing ); 140 boxLayout->addWidget( mNameParsing );
139 141
140 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 142 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
141 boxLayout->addWidget( mMultipleViewsAtOnce ); 143 boxLayout->addWidget( mMultipleViewsAtOnce );
142 144
143 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); 145 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
144 boxLayout->addWidget( mAskForQuit ); 146 boxLayout->addWidget( mAskForQuit );
145 147
146 layout->addWidget( vBox ); 148 layout->addWidget( vBox );
147 149
148 tabWidget->addTab( generalPage, i18n( "General" ) ); 150 tabWidget->addTab( generalPage, i18n( "General" ) );
149 151
150 // Extension page 152 // Extension page
151 QWidget *extensionPage = new QWidget( this ); 153 QWidget *extensionPage = new QWidget( this );
152 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 154 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
153 KDialog::spacingHintSmall() ); 155 KDialog::spacingHintSmall() );
154 156
155 //extensions groupbox 157 //extensions groupbox
156 158
157 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 159 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
158 boxLayout = new QVBoxLayout( groupBox->layout() ); 160 boxLayout = new QVBoxLayout( groupBox->layout() );
159 boxLayout->setAlignment( Qt::AlignTop ); 161 boxLayout->setAlignment( Qt::AlignTop );
160 boxLayout->setMargin(KDialog::marginHintSmall()); 162 boxLayout->setMargin(KDialog::marginHintSmall());
161 boxLayout->setSpacing(KDialog::spacingHintSmall()); 163 boxLayout->setSpacing(KDialog::spacingHintSmall());
162 groupBox->layout()->setMargin(1) ; 164 groupBox->layout()->setMargin(1) ;
163 groupBox->layout()->setSpacing(0); 165 groupBox->layout()->setSpacing(0);
164 mExtensionView = new KListView( groupBox ); 166 mExtensionView = new KListView( groupBox );
165 mExtensionView->setAllColumnsShowFocus( true ); 167 mExtensionView->setAllColumnsShowFocus( true );
166 mExtensionView->addColumn( i18n( "Name" ) ); 168 mExtensionView->addColumn( i18n( "Name" ) );
167 mExtensionView->addColumn( i18n( "Description" ) ); 169 mExtensionView->addColumn( i18n( "Description" ) );
168 //mExtensionView->setMaximumHeight(80); 170 //mExtensionView->setMaximumHeight(80);
169 171
170 boxLayout->addWidget( mExtensionView ); 172 boxLayout->addWidget( mExtensionView );
171 173
172 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 174 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
173 mConfigureButton->setEnabled( false ); 175 mConfigureButton->setEnabled( false );
174 boxLayout->addWidget( mConfigureButton ); 176 boxLayout->addWidget( mConfigureButton );
175 177
176 extensionLayout->addWidget( groupBox ); 178 extensionLayout->addWidget( groupBox );
177 179
178 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 180 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
179 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 181 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
180 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 182 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
181 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 183 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
182 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 184 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
183 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 185 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
184 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 186 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
185 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 187 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
186 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 188 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
187 SLOT( selectionChanged( QListViewItem* ) ) ); 189 SLOT( selectionChanged( QListViewItem* ) ) );
188 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 190 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
189 SLOT( itemClicked( QListViewItem* ) ) ); 191 SLOT( itemClicked( QListViewItem* ) ) );
190 connect( mConfigureButton, SIGNAL( clicked() ), 192 connect( mConfigureButton, SIGNAL( clicked() ),
191 SLOT( configureExtension() ) ); 193 SLOT( configureExtension() ) );
192 194
193 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 195 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
194 196
195 // Addressee page 197 // Addressee page
196 mAddresseeWidget = new AddresseeWidget( this ); 198 mAddresseeWidget = new AddresseeWidget( this );
197 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 199 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
198 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 200 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
199 201
200} 202}
201 203
202void KABConfigWidget::usrReadConfig() 204void KABConfigWidget::usrReadConfig()
203{ 205{
204 KABPrefs* prefs = KABPrefs::instance(); 206 KABPrefs* prefs = KABPrefs::instance();
205 207
206 bool blocked = signalsBlocked(); 208 bool blocked = signalsBlocked();
207 blockSignals( true ); 209 blockSignals( true );
208 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); 210 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
209 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 211 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
210 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 212 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
211 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 213 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
212 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); 214 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard );
213 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); 215 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch );
214 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 216 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
215 mAskForQuit->setChecked( prefs->mAskForQuit ); 217 mAskForQuit->setChecked( prefs->mAskForQuit );
216 218
217 mAddresseeWidget->restoreSettings(); 219 mAddresseeWidget->restoreSettings();
218 220
219 restoreExtensionSettings(); 221 restoreExtensionSettings();
220 222
221 blockSignals( blocked ); 223 blockSignals( blocked );
222 224
223} 225}
224 226
225void KABConfigWidget::usrWriteConfig() 227void KABConfigWidget::usrWriteConfig()
226{ 228{
227 KABPrefs* prefs = KABPrefs::instance(); 229 KABPrefs* prefs = KABPrefs::instance();
228 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); 230 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked();
229 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 231 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
230 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 232 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
231 prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); 233 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
232 prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); 234 prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked();
233 prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); 235 prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked();
234 236
235 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 237 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
236 prefs->mAskForQuit = mAskForQuit->isChecked(); 238 prefs->mAskForQuit = mAskForQuit->isChecked();
237 239
238 mAddresseeWidget->saveSettings(); 240 mAddresseeWidget->saveSettings();
239 241
240 saveExtensionSettings(); 242 saveExtensionSettings();
241 243
242} 244}
243 245
244void KABConfigWidget::restoreExtensionSettings() 246void KABConfigWidget::restoreExtensionSettings()
245{ 247{
246 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 248 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
247 249
248 mExtensionView->clear(); 250 mExtensionView->clear();
249 251
250#ifndef KAB_EMBEDDED 252#ifndef KAB_EMBEDDED
251 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 253 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
252 KTrader::OfferList::ConstIterator it; 254 KTrader::OfferList::ConstIterator it;
253 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 255 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
254 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 256 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
255 continue; 257 continue;
256 258
257 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 259 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
258 item->setService( *it ); 260 item->setService( *it );
259 if ( activeExtensions.contains( item->factory()->identifier() ) ) 261 if ( activeExtensions.contains( item->factory()->identifier() ) )
260 item->setOn( true ); 262 item->setOn( true );
261 } 263 }
262#else //KAB_EMBEDDED 264#else //KAB_EMBEDDED
263 ExtensionFactory *extensionFactory = new MergeFactory(); 265 ExtensionFactory *extensionFactory = new MergeFactory();
264 266
265 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 267 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
266 268
267 item->setFactory( extensionFactory ); 269 item->setFactory( extensionFactory );
268 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 270 if ( activeExtensions.contains( extensionFactory->identifier() ) )
269 item->setOn( true ); 271 item->setOn( true );
270 272
271 273
272 274
273 extensionFactory = new DistributionListFactory(); 275 extensionFactory = new DistributionListFactory();
274 276
275 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 277 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
276 278
277 item->setFactory( extensionFactory ); 279 item->setFactory( extensionFactory );
278 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 280 if ( activeExtensions.contains( extensionFactory->identifier() ) )
279 item->setOn( true ); 281 item->setOn( true );
280 282
281 283
282#endif //KAB_EMBEDDED 284#endif //KAB_EMBEDDED
283 285
284} 286}
285 287
286void KABConfigWidget::saveExtensionSettings() 288void KABConfigWidget::saveExtensionSettings()
287{ 289{
288 QStringList activeExtensions; 290 QStringList activeExtensions;
289 291
290 QPtrList<QListViewItem> list; 292 QPtrList<QListViewItem> list;
291 QListViewItemIterator it( mExtensionView ); 293 QListViewItemIterator it( mExtensionView );
292 while ( it.current() ) { 294 while ( it.current() ) {
293 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); 295 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
294 if ( item ) { 296 if ( item ) {
295 if ( item->isOn() ) 297 if ( item->isOn() )
296 activeExtensions.append( item->factory()->identifier() ); 298 activeExtensions.append( item->factory()->identifier() );
297 } 299 }
298 ++it; 300 ++it;
299 } 301 }
300 302
301 KABPrefs::instance()->mActiveExtensions = activeExtensions; 303 KABPrefs::instance()->mActiveExtensions = activeExtensions;
302} 304}
303 305
304void KABConfigWidget::configureExtension() 306void KABConfigWidget::configureExtension()
305{ 307{
306 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); 308 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
307 if ( !item ) 309 if ( !item )
308 return; 310 return;
309 311
310#ifndef KAB_EMBEDDED 312#ifndef KAB_EMBEDDED
311 KConfig config( "kaddressbookrc" ); 313 KConfig config( "kaddressbookrc" );
312#else //KAB_EMBEDDED 314#else //KAB_EMBEDDED
313 KConfig config( locateLocal("config", "kaddressbookrc") ); 315 KConfig config( locateLocal("config", "kaddressbookrc") );
314#endif //KAB_EMBEDDED 316#endif //KAB_EMBEDDED
315 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); 317 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
316 318
317 ExtensionConfigDialog dlg( item->factory(), &config, this ); 319 ExtensionConfigDialog dlg( item->factory(), &config, this );
318 dlg.exec(); 320 dlg.exec();
319 321
320 config.sync(); 322 config.sync();
321} 323}
322 324
323void KABConfigWidget::selectionChanged( QListViewItem *i ) 325void KABConfigWidget::selectionChanged( QListViewItem *i )
324{ 326{
325 ExtensionItem *item = static_cast<ExtensionItem*>( i ); 327 ExtensionItem *item = static_cast<ExtensionItem*>( i );
326 if ( !item ) 328 if ( !item )
327 return; 329 return;
328 330
329 mConfigureButton->setEnabled( item->configWidgetAvailable() ); 331 mConfigureButton->setEnabled( item->configWidgetAvailable() );
330} 332}
331 333
332void KABConfigWidget::itemClicked( QListViewItem *item ) 334void KABConfigWidget::itemClicked( QListViewItem *item )
333{ 335{
334 if ( item != 0 ) 336 if ( item != 0 )
335 modified(); 337 modified();
336} 338}
337 339
338#ifndef KAB_EMBEDDED 340#ifndef KAB_EMBEDDED
339ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) 341ExtensionItem::ExtensionItem( QListView *parent, const QString &text )
340 : QCheckListItem( parent, text, CheckBox ) 342 : QCheckListItem( parent, text, CheckBox )
341{ 343{
342} 344}
343 345
344void ExtensionItem::setService( const KService::Ptr &ptr ) 346void ExtensionItem::setService( const KService::Ptr &ptr )
345{ 347{
346 mPtr = ptr; 348 mPtr = ptr;
347} 349}
348#else //KAB_EMBEDDED 350#else //KAB_EMBEDDED