summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
authorzautrix <zautrix>2004-09-11 22:40:15 (UTC)
committer zautrix <zautrix>2004-09-11 22:40:15 (UTC)
commita040c9d56282dae396b02627fafb602e44323837 (patch) (unidiff)
tree9ee997f51e46a1ae6ab5aeaab709f1b8e138f3df /kaddressbook/kcmconfigs
parent53dda80aaab72d7efdbed8a206dc1fa64fed10ee (diff)
downloadkdepimpi-a040c9d56282dae396b02627fafb602e44323837.zip
kdepimpi-a040c9d56282dae396b02627fafb602e44323837.tar.gz
kdepimpi-a040c9d56282dae396b02627fafb602e44323837.tar.bz2
Added configure for search
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp6
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 3a2ccbb..0c3a199 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,397 +1,403 @@
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( QWidget *parent, const char *name ) 88KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
89 : QWidget( parent, name ) 89 : QWidget( 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 //general groupbox 101 //general groupbox
102 QVBox *vBox = new QVBox( generalPage, "qvbox" ); 102 QVBox *vBox = new QVBox( generalPage, "qvbox" );
103 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); 103 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" );
104 boxLayout->setAlignment( Qt::AlignTop ); 104 boxLayout->setAlignment( Qt::AlignTop );
105 boxLayout->setMargin(KDialog::marginHintSmall() ); 105 boxLayout->setMargin(KDialog::marginHintSmall() );
106 vBox->layout()->setMargin(KDialog::marginHintSmall()) ; 106 vBox->layout()->setMargin(KDialog::marginHintSmall()) ;
107 vBox->layout()->setSpacing(KDialog::spacingHintSmall()); 107 vBox->layout()->setSpacing(KDialog::spacingHintSmall());
108 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 108 boxLayout->setSpacing( KDialog::spacingHintSmall() );
109 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
110 boxLayout->addWidget( mSearchReturnBox );
109 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); 111 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
110 boxLayout->addWidget( mViewsSingleClickBox ); 112 boxLayout->addWidget( mViewsSingleClickBox );
111 113
112 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); 114 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
113 boxLayout->addWidget( mNameParsing ); 115 boxLayout->addWidget( mNameParsing );
114 116
115 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 117 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
116 boxLayout->addWidget( mMultipleViewsAtOnce ); 118 boxLayout->addWidget( mMultipleViewsAtOnce );
117 119
118 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); 120 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
119 boxLayout->addWidget( mAskForQuit ); 121 boxLayout->addWidget( mAskForQuit );
120 122
121 layout->addWidget( vBox ); 123 layout->addWidget( vBox );
122 124
123 tabWidget->addTab( generalPage, i18n( "General" ) ); 125 tabWidget->addTab( generalPage, i18n( "General" ) );
124 126
125 // Extension page 127 // Extension page
126 QWidget *extensionPage = new QWidget( this ); 128 QWidget *extensionPage = new QWidget( this );
127 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 129 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
128 KDialog::spacingHintSmall() ); 130 KDialog::spacingHintSmall() );
129 131
130 //extensions groupbox 132 //extensions groupbox
131 133
132 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 134 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
133 boxLayout = new QVBoxLayout( groupBox->layout() ); 135 boxLayout = new QVBoxLayout( groupBox->layout() );
134 boxLayout->setAlignment( Qt::AlignTop ); 136 boxLayout->setAlignment( Qt::AlignTop );
135 boxLayout->setMargin(KDialog::marginHintSmall()); 137 boxLayout->setMargin(KDialog::marginHintSmall());
136 boxLayout->setSpacing(KDialog::spacingHintSmall()); 138 boxLayout->setSpacing(KDialog::spacingHintSmall());
137 groupBox->layout()->setMargin(1) ; 139 groupBox->layout()->setMargin(1) ;
138 groupBox->layout()->setSpacing(0); 140 groupBox->layout()->setSpacing(0);
139 mExtensionView = new KListView( groupBox ); 141 mExtensionView = new KListView( groupBox );
140 mExtensionView->setAllColumnsShowFocus( true ); 142 mExtensionView->setAllColumnsShowFocus( true );
141 mExtensionView->addColumn( i18n( "Name" ) ); 143 mExtensionView->addColumn( i18n( "Name" ) );
142 mExtensionView->addColumn( i18n( "Description" ) ); 144 mExtensionView->addColumn( i18n( "Description" ) );
143 mExtensionView->setMaximumHeight(80); 145 mExtensionView->setMaximumHeight(80);
144 146
145 boxLayout->addWidget( mExtensionView ); 147 boxLayout->addWidget( mExtensionView );
146 148
147 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 149 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
148 mConfigureButton->setEnabled( false ); 150 mConfigureButton->setEnabled( false );
149 boxLayout->addWidget( mConfigureButton ); 151 boxLayout->addWidget( mConfigureButton );
150 152
151 extensionLayout->addWidget( groupBox ); 153 extensionLayout->addWidget( groupBox );
152 154
153 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 155 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
154 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 156 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
157 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
155 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 158 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
156 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 159 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
157 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 160 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
158 SLOT( selectionChanged( QListViewItem* ) ) ); 161 SLOT( selectionChanged( QListViewItem* ) ) );
159 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 162 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
160 SLOT( itemClicked( QListViewItem* ) ) ); 163 SLOT( itemClicked( QListViewItem* ) ) );
161 connect( mConfigureButton, SIGNAL( clicked() ), 164 connect( mConfigureButton, SIGNAL( clicked() ),
162 SLOT( configureExtension() ) ); 165 SLOT( configureExtension() ) );
163 166
164 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 167 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
165 168
166 // Addressee page 169 // Addressee page
167 mAddresseeWidget = new AddresseeWidget( this ); 170 mAddresseeWidget = new AddresseeWidget( this );
168 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 171 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
169 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 172 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
170 173
171} 174}
172 175
173 176
174void KABConfigWidget::restoreSettings(KABPrefs* prefs) 177void KABConfigWidget::restoreSettings(KABPrefs* prefs)
175{ 178{
176//US prefs was KABPrefs::instance() before 179//US prefs was KABPrefs::instance() before
177 180
178 bool blocked = signalsBlocked(); 181 bool blocked = signalsBlocked();
179 blockSignals( true ); 182 blockSignals( true );
180 183
181 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 184 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
182 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 185 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
186 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
183 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 187 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
184 mAskForQuit->setChecked( prefs->mAskForQuit ); 188 mAskForQuit->setChecked( prefs->mAskForQuit );
185 189
186 mAddresseeWidget->restoreSettings(); 190 mAddresseeWidget->restoreSettings();
187 191
188 restoreExtensionSettings(); 192 restoreExtensionSettings();
189 193
190 blockSignals( blocked ); 194 blockSignals( blocked );
191 195
192 emit changed( false ); 196 emit changed( false );
193} 197}
194 198
195void KABConfigWidget::saveSettings(KABPrefs* prefs) 199void KABConfigWidget::saveSettings(KABPrefs* prefs)
196{ 200{
197 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 201 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
198 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 202 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
203 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
199 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 204 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
200 prefs->mAskForQuit = mAskForQuit->isChecked(); 205 prefs->mAskForQuit = mAskForQuit->isChecked();
201 206
202 mAddresseeWidget->saveSettings(); 207 mAddresseeWidget->saveSettings();
203 208
204 saveExtensionSettings(); 209 saveExtensionSettings();
205 KABPrefs::instance()->writeConfig(); 210 KABPrefs::instance()->writeConfig();
206 211
207 emit changed( false ); 212 emit changed( false );
208} 213}
209 214
210void KABConfigWidget::defaults(KABPrefs* prefs) 215void KABConfigWidget::defaults(KABPrefs* prefs)
211{ 216{
212 mNameParsing->setChecked( true ); 217 mNameParsing->setChecked( true );
213 mViewsSingleClickBox->setChecked( false ); 218 mViewsSingleClickBox->setChecked( false );
214 mMultipleViewsAtOnce->setChecked( true ); 219 mMultipleViewsAtOnce->setChecked( true );
220 mSearchReturnBox->setChecked( true );
215 mAskForQuit->setChecked (true); 221 mAskForQuit->setChecked (true);
216 222
217 emit changed( true ); 223 emit changed( true );
218} 224}
219 225
220void KABConfigWidget::modified() 226void KABConfigWidget::modified()
221{ 227{
222 emit changed( true ); 228 emit changed( true );
223} 229}
224 230
225void KABConfigWidget::restoreExtensionSettings() 231void KABConfigWidget::restoreExtensionSettings()
226{ 232{
227 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 233 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
228 234
229 mExtensionView->clear(); 235 mExtensionView->clear();
230 236
231#ifndef KAB_EMBEDDED 237#ifndef KAB_EMBEDDED
232 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 238 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
233 KTrader::OfferList::ConstIterator it; 239 KTrader::OfferList::ConstIterator it;
234 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 240 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
235 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 241 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
236 continue; 242 continue;
237 243
238 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 244 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
239 item->setService( *it ); 245 item->setService( *it );
240 if ( activeExtensions.contains( item->factory()->identifier() ) ) 246 if ( activeExtensions.contains( item->factory()->identifier() ) )
241 item->setOn( true ); 247 item->setOn( true );
242 } 248 }
243#else //KAB_EMBEDDED 249#else //KAB_EMBEDDED
244 ExtensionFactory *extensionFactory = new MergeFactory(); 250 ExtensionFactory *extensionFactory = new MergeFactory();
245 251
246 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 252 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
247 253
248 item->setFactory( extensionFactory ); 254 item->setFactory( extensionFactory );
249 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 255 if ( activeExtensions.contains( extensionFactory->identifier() ) )
250 item->setOn( true ); 256 item->setOn( true );
251 257
252 258
253 259
254 extensionFactory = new DistributionListFactory(); 260 extensionFactory = new DistributionListFactory();
255 261
256 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 262 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
257 263
258 item->setFactory( extensionFactory ); 264 item->setFactory( extensionFactory );
259 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 265 if ( activeExtensions.contains( extensionFactory->identifier() ) )
260 item->setOn( true ); 266 item->setOn( true );
261 267
262 268
263#endif //KAB_EMBEDDED 269#endif //KAB_EMBEDDED
264 270
265} 271}
266 272
267void KABConfigWidget::saveExtensionSettings() 273void KABConfigWidget::saveExtensionSettings()
268{ 274{
269 QStringList activeExtensions; 275 QStringList activeExtensions;
270 276
271 QPtrList<QListViewItem> list; 277 QPtrList<QListViewItem> list;
272 QListViewItemIterator it( mExtensionView ); 278 QListViewItemIterator it( mExtensionView );
273 while ( it.current() ) { 279 while ( it.current() ) {
274 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); 280 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
275 if ( item ) { 281 if ( item ) {
276 if ( item->isOn() ) 282 if ( item->isOn() )
277 activeExtensions.append( item->factory()->identifier() ); 283 activeExtensions.append( item->factory()->identifier() );
278 } 284 }
279 ++it; 285 ++it;
280 } 286 }
281 287
282 KABPrefs::instance()->mActiveExtensions = activeExtensions; 288 KABPrefs::instance()->mActiveExtensions = activeExtensions;
283} 289}
284 290
285void KABConfigWidget::configureExtension() 291void KABConfigWidget::configureExtension()
286{ 292{
287 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); 293 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
288 if ( !item ) 294 if ( !item )
289 return; 295 return;
290 296
291#ifndef KAB_EMBEDDED 297#ifndef KAB_EMBEDDED
292 KConfig config( "kaddressbookrc" ); 298 KConfig config( "kaddressbookrc" );
293#else //KAB_EMBEDDED 299#else //KAB_EMBEDDED
294 KConfig config( locateLocal("config", "kaddressbookrc") ); 300 KConfig config( locateLocal("config", "kaddressbookrc") );
295#endif //KAB_EMBEDDED 301#endif //KAB_EMBEDDED
296 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); 302 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
297 303
298 ExtensionConfigDialog dlg( item->factory(), &config, this ); 304 ExtensionConfigDialog dlg( item->factory(), &config, this );
299 dlg.exec(); 305 dlg.exec();
300 306
301 config.sync(); 307 config.sync();
302} 308}
303 309
304void KABConfigWidget::selectionChanged( QListViewItem *i ) 310void KABConfigWidget::selectionChanged( QListViewItem *i )
305{ 311{
306 ExtensionItem *item = static_cast<ExtensionItem*>( i ); 312 ExtensionItem *item = static_cast<ExtensionItem*>( i );
307 if ( !item ) 313 if ( !item )
308 return; 314 return;
309 315
310 mConfigureButton->setEnabled( item->configWidgetAvailable() ); 316 mConfigureButton->setEnabled( item->configWidgetAvailable() );
311} 317}
312 318
313void KABConfigWidget::itemClicked( QListViewItem *item ) 319void KABConfigWidget::itemClicked( QListViewItem *item )
314{ 320{
315 if ( item != 0 ) 321 if ( item != 0 )
316 modified(); 322 modified();
317} 323}
318 324
319#ifndef KAB_EMBEDDED 325#ifndef KAB_EMBEDDED
320ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) 326ExtensionItem::ExtensionItem( QListView *parent, const QString &text )
321 : QCheckListItem( parent, text, CheckBox ) 327 : QCheckListItem( parent, text, CheckBox )
322{ 328{
323} 329}
324 330
325void ExtensionItem::setService( const KService::Ptr &ptr ) 331void ExtensionItem::setService( const KService::Ptr &ptr )
326{ 332{
327 mPtr = ptr; 333 mPtr = ptr;
328} 334}
329#else //KAB_EMBEDDED 335#else //KAB_EMBEDDED
330ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) 336ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment )
331 : QCheckListItem( parent, text, CheckBox ) 337 : QCheckListItem( parent, text, CheckBox )
332{ 338{
333 mName = name; 339 mName = name;
334 mComment = comment; 340 mComment = comment;
335} 341}
336 342
337 343
338void ExtensionItem::setFactory( ExtensionFactory* fac ) 344void ExtensionItem::setFactory( ExtensionFactory* fac )
339{ 345{
340 mFactory = fac; 346 mFactory = fac;
341} 347}
342#endif //KAB_EMBEDDED 348#endif //KAB_EMBEDDED
343 349
344bool ExtensionItem::configWidgetAvailable() const 350bool ExtensionItem::configWidgetAvailable() const
345{ 351{
346#ifndef KAB_EMBEDDED 352#ifndef KAB_EMBEDDED
347 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 353 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
348 if ( !factory ) 354 if ( !factory )
349 return false; 355 return false;
350 356
351 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); 357 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
352 if ( !extensionFactory ) 358 if ( !extensionFactory )
353 return false; 359 return false;
354 360
355 return extensionFactory->configureWidgetAvailable(); 361 return extensionFactory->configureWidgetAvailable();
356#else //KAB_EMBEDDED 362#else //KAB_EMBEDDED
357 return mFactory->configureWidgetAvailable(); 363 return mFactory->configureWidgetAvailable();
358#endif //KAB_EMBEDDED 364#endif //KAB_EMBEDDED
359 365
360} 366}
361 367
362ExtensionFactory *ExtensionItem::factory() const 368ExtensionFactory *ExtensionItem::factory() const
363{ 369{
364#ifndef KAB_EMBEDDED 370#ifndef KAB_EMBEDDED
365 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 371 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
366 if ( !factory ) 372 if ( !factory )
367 return 0; 373 return 0;
368 374
369 return static_cast<ExtensionFactory*>( factory ); 375 return static_cast<ExtensionFactory*>( factory );
370#else //KAB_EMBEDDED 376#else //KAB_EMBEDDED
371 return mFactory; 377 return mFactory;
372#endif //KAB_EMBEDDED 378#endif //KAB_EMBEDDED
373} 379}
374 380
375QString ExtensionItem::text( int column ) const 381QString ExtensionItem::text( int column ) const
376{ 382{
377#ifndef KAB_EMBEDDED 383#ifndef KAB_EMBEDDED
378 if ( column == 0 ) 384 if ( column == 0 )
379 return mPtr->name(); 385 return mPtr->name();
380 else if ( column == 1 ) 386 else if ( column == 1 )
381 return mPtr->comment(); 387 return mPtr->comment();
382 else 388 else
383 return QString::null; 389 return QString::null;
384#else //KAB_EMBEDDED 390#else //KAB_EMBEDDED
385 if ( column == 0 ) 391 if ( column == 0 )
386 return mName; 392 return mName;
387 else if ( column == 1 ) 393 else if ( column == 1 )
388 return mComment; 394 return mComment;
389 else 395 else
390 return QString::null; 396 return QString::null;
391#endif //KAB_EMBEDDED 397#endif //KAB_EMBEDDED
392} 398}
393 399
394#ifndef KAB_EMBEDDED 400#ifndef KAB_EMBEDDED
395#include "kabconfigwidget.moc" 401#include "kabconfigwidget.moc"
396#endif //KAB_EMBEDDED 402#endif //KAB_EMBEDDED
397 403
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 831efc1..6cd4223 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -1,79 +1,79 @@
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#ifndef KABCONFIGWIDGET_H 24#ifndef KABCONFIGWIDGET_H
25#define KABCONFIGWIDGET_H 25#define KABCONFIGWIDGET_H
26 26
27#include <qwidget.h> 27#include <qwidget.h>
28 28
29class QCheckBox; 29class QCheckBox;
30class QListViewItem; 30class QListViewItem;
31class QPushButton; 31class QPushButton;
32class QComboBox; 32class QComboBox;
33class QLineEdit; 33class QLineEdit;
34class KListView; 34class KListView;
35class KABPrefs; 35class KABPrefs;
36 36
37class AddresseeWidget; 37class AddresseeWidget;
38 38
39class KABConfigWidget : public QWidget 39class KABConfigWidget : public QWidget
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43 public: 43 public:
44 KABConfigWidget( QWidget *parent, const char *name = 0 ); 44 KABConfigWidget( QWidget *parent, const char *name = 0 );
45 45
46 void restoreSettings(KABPrefs* prefs); 46 void restoreSettings(KABPrefs* prefs);
47 void saveSettings(KABPrefs* prefs); 47 void saveSettings(KABPrefs* prefs);
48 void defaults(KABPrefs* prefs); 48 void defaults(KABPrefs* prefs);
49 49
50 signals: 50 signals:
51 void changed( bool ); 51 void changed( bool );
52 52
53 public slots: 53 public slots:
54 void modified(); 54 void modified();
55 55
56 56
57 57
58 private slots: 58 private slots:
59 void configureExtension(); 59 void configureExtension();
60 void selectionChanged( QListViewItem* ); 60 void selectionChanged( QListViewItem* );
61 void itemClicked( QListViewItem* ); 61 void itemClicked( QListViewItem* );
62 62
63 private: 63 private:
64 void restoreExtensionSettings(); 64 void restoreExtensionSettings();
65 void saveExtensionSettings(); 65 void saveExtensionSettings();
66 66
67 KListView *mExtensionView; 67 KListView *mExtensionView;
68 68 QCheckBox *mSearchReturnBox;
69 QCheckBox *mNameParsing; 69 QCheckBox *mNameParsing;
70 QCheckBox *mViewsSingleClickBox; 70 QCheckBox *mViewsSingleClickBox;
71 QCheckBox *mMultipleViewsAtOnce; 71 QCheckBox *mMultipleViewsAtOnce;
72 QCheckBox *mAskForQuit; 72 QCheckBox *mAskForQuit;
73 73
74 QPushButton *mConfigureButton; 74 QPushButton *mConfigureButton;
75 75
76 AddresseeWidget *mAddresseeWidget; 76 AddresseeWidget *mAddresseeWidget;
77}; 77};
78 78
79#endif 79#endif