summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
authorulf69 <ulf69>2004-08-05 22:50:37 (UTC)
committer ulf69 <ulf69>2004-08-05 22:50:37 (UTC)
commitc807547c32dd25e9d181d396590af9915b7a1166 (patch) (unidiff)
tree0950df8ef9653ab30e2faebf67bdd254e0ec1b8a /kaddressbook/kcmconfigs
parentbb1dd236b41cbd5cc4aed3b320801aa07974122d (diff)
downloadkdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.zip
kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.gz
kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.bz2
enabled the sending of emails to selected contacts, and mailing of vCards
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp167
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h48
2 files changed, 164 insertions, 51 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 38c7946..1bac26f 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,363 +1,470 @@
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>
31#include <qlineedit.h>
32#include <qlabel.h>
33#include <qfile.h>
30 34
31#include <kconfig.h> 35#include <kconfig.h>
32#include <kdebug.h> 36#include <kdebug.h>
33#include <kdialog.h> 37#include <kdialog.h>
34#include <klistview.h> 38#include <klistview.h>
35#include <klocale.h> 39#include <klocale.h>
36#include <kglobal.h> 40#include <kglobal.h>
37#include <kmessagebox.h> 41#include <kmessagebox.h>
38#include <kstandarddirs.h> 42#include <kstandarddirs.h>
39 43
40#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
41#include <ktrader.h> 45#include <ktrader.h>
42#else // KAB_EMBEDDED 46#else // KAB_EMBEDDED
43#include <mergewidget.h> 47#include <mergewidget.h>
44#include <distributionlistwidget.h> 48#include <distributionlistwidget.h>
45#endif // KAB_EMBEDDED 49#endif // KAB_EMBEDDED
46 50
47#include "addresseewidget.h" 51#include "addresseewidget.h"
48#include "extensionconfigdialog.h" 52#include "extensionconfigdialog.h"
49#include "extensionwidget.h" 53#include "extensionwidget.h"
50#include "kabprefs.h" 54#include "kabprefs.h"
51 55
52#include "kabconfigwidget.h" 56#include "kabconfigwidget.h"
53 57
54class ExtensionItem : public QCheckListItem 58class ExtensionItem : public QCheckListItem
55{ 59{
56 public: 60 public:
57 61
58#ifndef KAB_EMBEDDED 62#ifndef KAB_EMBEDDED
59 ExtensionItem( QListView *parent, const QString &text ); 63 ExtensionItem( QListView *parent, const QString &text );
60 void setService( const KService::Ptr &ptr ); 64 void setService( const KService::Ptr &ptr );
61#else //KAB_EMBEDDED 65#else //KAB_EMBEDDED
62 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); 66 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment );
63 void setFactory( ExtensionFactory* fac ); 67 void setFactory( ExtensionFactory* fac );
64#endif //KAB_EMBEDDED 68#endif //KAB_EMBEDDED
65 69
66 bool configWidgetAvailable() const; 70 bool configWidgetAvailable() const;
67 ExtensionFactory *factory() const; 71 ExtensionFactory *factory() const;
68 72
69 virtual QString text( int column ) const; 73 virtual QString text( int column ) const;
70 74
71 private: 75 private:
72#ifndef KAB_EMBEDDED 76#ifndef KAB_EMBEDDED
73 KService::Ptr mPtr; 77 KService::Ptr mPtr;
74#else //KAB_EMBEDDED 78#else //KAB_EMBEDDED
75 ExtensionFactory* mFactory; 79 ExtensionFactory* mFactory;
76 QString mName; 80 QString mName;
77 QString mComment; 81 QString mComment;
78 82
79#endif //KAB_EMBEDDED 83#endif //KAB_EMBEDDED
80 84
81}; 85};
82 86
83KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) 87KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
84 : QWidget( parent, name ) 88 : QWidget( parent, name )
85{ 89{
86 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 90 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
87 KDialog::spacingHint() ); 91 KDialog::spacingHint() );
88 92
89 QTabWidget *tabWidget = new QTabWidget( this ); 93 QTabWidget *tabWidget = new QTabWidget( this );
90 topLayout->addWidget( tabWidget ); 94 topLayout->addWidget( tabWidget );
91 95
92 // General page 96 // General page
93 QWidget *generalPage = new QWidget( this ); 97 QWidget *generalPage = new QWidget( this );
94 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 98 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
95 KDialog::spacingHintSmall() ); 99 KDialog::spacingHintSmall() );
96 100 //general groupbox
97 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); 101 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
98 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); 102 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
99 boxLayout->setAlignment( Qt::AlignTop ); 103 boxLayout->setAlignment( Qt::AlignTop );
100 boxLayout->setMargin(KDialog::marginHintSmall() ); 104 boxLayout->setMargin(KDialog::marginHintSmall() );
101 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; 105 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
102 groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); 106 groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
103 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 107 boxLayout->setSpacing( KDialog::spacingHintSmall() );
104 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); 108 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" );
105 boxLayout->addWidget( mViewsSingleClickBox ); 109 boxLayout->addWidget( mViewsSingleClickBox );
106 110
107 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); 111 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" );
108 boxLayout->addWidget( mNameParsing ); 112 boxLayout->addWidget( mNameParsing );
109 113
110 layout->addWidget( groupBox ); 114 layout->addWidget( groupBox );
111 115
116
117 //extensions groupbox
118
112 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); 119 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
113 boxLayout = new QVBoxLayout( groupBox->layout() ); 120 boxLayout = new QVBoxLayout( groupBox->layout() );
114 boxLayout->setAlignment( Qt::AlignTop ); 121 boxLayout->setAlignment( Qt::AlignTop );
115 boxLayout->setMargin(KDialog::marginHintSmall()); 122 boxLayout->setMargin(KDialog::marginHintSmall());
116 boxLayout->setSpacing(KDialog::spacingHintSmall()); 123 boxLayout->setSpacing(KDialog::spacingHintSmall());
117 groupBox->layout()->setMargin(1) ; 124 groupBox->layout()->setMargin(1) ;
118 groupBox->layout()->setSpacing(0); 125 groupBox->layout()->setSpacing(0);
119 mExtensionView = new KListView( groupBox ); 126 mExtensionView = new KListView( groupBox );
120 mExtensionView->setAllColumnsShowFocus( true ); 127 mExtensionView->setAllColumnsShowFocus( true );
121 mExtensionView->addColumn( i18n( "Name" ) ); 128 mExtensionView->addColumn( i18n( "Name" ) );
122 mExtensionView->addColumn( i18n( "Description" ) ); 129 mExtensionView->addColumn( i18n( "Description" ) );
123 mExtensionView->setMaximumHeight(80); 130 mExtensionView->setMaximumHeight(80);
124 131
125 boxLayout->addWidget( mExtensionView ); 132 boxLayout->addWidget( mExtensionView );
126 133
127 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 134 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
128 mConfigureButton->setEnabled( false ); 135 mConfigureButton->setEnabled( false );
129 boxLayout->addWidget( mConfigureButton ); 136 boxLayout->addWidget( mConfigureButton );
130 137
131 layout->addWidget( groupBox ); 138 layout->addWidget( groupBox );
132 139
133 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 140 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
134 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 141 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
135 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 142 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
136 SLOT( selectionChanged( QListViewItem* ) ) ); 143 SLOT( selectionChanged( QListViewItem* ) ) );
137 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 144 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
138 SLOT( itemClicked( QListViewItem* ) ) ); 145 SLOT( itemClicked( QListViewItem* ) ) );
139 connect( mConfigureButton, SIGNAL( clicked() ), 146 connect( mConfigureButton, SIGNAL( clicked() ),
140 SLOT( configureExtension() ) ); 147 SLOT( configureExtension() ) );
141 148
142 tabWidget->addTab( generalPage, i18n( "General" ) ); 149 tabWidget->addTab( generalPage, i18n( "General" ) );
143 150
144 // Addressee page 151 // Addressee page
145 mAddresseeWidget = new AddresseeWidget( this ); 152 mAddresseeWidget = new AddresseeWidget( this );
146 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 153 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
147 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 154 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
155
156 // mailclient page
157 QWidget *mailclientPage = new QWidget( this );
158 layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
159 KDialog::spacingHintSmall() );
160
161 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
162 boxLayout = new QVBoxLayout( groupBox->layout() );
163 boxLayout->setAlignment( Qt::AlignTop );
164// boxLayout->setMargin(KDialog::marginHintSmall() );
165// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
166// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
167// boxLayout->setSpacing( KDialog::spacingHintSmall() );
168
169 mEmailClient = new QComboBox( groupBox );
170 mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI );
171 mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA );
172 mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE );
173 mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER );
174 boxLayout->addWidget( mEmailClient );
175
176 connect( mEmailClient, SIGNAL( activated( int ) ),
177 this, SLOT (emailclient_changed( int ) ) );
178
179 QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
180 boxLayout->addWidget( lab );
181 mEmailChannel = new QLineEdit(groupBox);
182 mEmailChannel->setReadOnly(true);
183 boxLayout->addWidget( mEmailChannel );
184
185 layout->addWidget( groupBox );
186 tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
187
188
189
148} 190}
149 191
192
193
194void KABConfigWidget::emailclient_changed( int newClient )
195{
196 if (newClient == KABPrefs::OTHER)
197 mEmailChannel->setReadOnly(false);
198 else
199 mEmailChannel->setReadOnly(true);
200
201 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
202 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
203
204 if (opiepath.isEmpty())
205 opiepath = qtopiapath;
206
207 QString text = mEmailChannel->text();
208
209 if (newClient == KABPrefs::OPIE)
210 {
211 if ( QFile::exists( opiepath + "/bin/opiemail" ))
212 text = "QPE/Application/opiemail";
213 else
214 text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
215 }
216 else if (newClient == KABPrefs::QTOPIA)
217 {
218 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
219 text = "QPE/Application/qtmail";
220 else
221 text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
222
223 }
224 else if (newClient == KABPrefs::OMPI)
225 {
226 if ( QFile::exists( qtopiapath + "/bin/ompi" ))
227 text = "QPE/Application/ompi";
228 else if ( QFile::exists( opiepath + "/bin/ompi" ))
229 text = "QPE/Application/ompi";
230 else
231 text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
232
233 }
234 else
235 {
236 //do nothing if we choosed other
237 }
238
239 mEmailChannel->setText( text );
240
241
242}
243
244
150void KABConfigWidget::restoreSettings() 245void KABConfigWidget::restoreSettings()
151{ 246{
152 bool blocked = signalsBlocked(); 247 bool blocked = signalsBlocked();
153 blockSignals( true ); 248 blockSignals( true );
154 249
155 mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); 250 mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing );
156 mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); 251 mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick );
252
253 mEmailChannel->setText( KABPrefs::instance()->mEmailChannel );
254 mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient);
255
157 mAddresseeWidget->restoreSettings(); 256 mAddresseeWidget->restoreSettings();
158 257
159 restoreExtensionSettings(); 258 restoreExtensionSettings();
160 259
161 blockSignals( blocked ); 260 blockSignals( blocked );
162 261
163 emit changed( false ); 262 emit changed( false );
164} 263}
165 264
166void KABConfigWidget::saveSettings() 265void KABConfigWidget::saveSettings()
167{ 266{
168 KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); 267 KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked();
169 KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 268 KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked();
269
270 KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
271 KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
272
170 mAddresseeWidget->saveSettings(); 273 mAddresseeWidget->saveSettings();
171 274
172 saveExtensionSettings(); 275 saveExtensionSettings();
173 KABPrefs::instance()->writeConfig(); 276 KABPrefs::instance()->writeConfig();
174 277
175 emit changed( false ); 278 emit changed( false );
176} 279}
177 280
178void KABConfigWidget::defaults() 281void KABConfigWidget::defaults()
179{ 282{
180 mNameParsing->setChecked( true ); 283 mNameParsing->setChecked( true );
181 mViewsSingleClickBox->setChecked( false ); 284 mViewsSingleClickBox->setChecked( false );
182 285
286 mEmailClient->setCurrentItem(KABPrefs::OMPI);
287 emailclient_changed( KABPrefs::OMPI );
288
289
183 emit changed( true ); 290 emit changed( true );
184} 291}
185 292
186void KABConfigWidget::modified() 293void KABConfigWidget::modified()
187{ 294{
188 emit changed( true ); 295 emit changed( true );
189} 296}
190 297
191void KABConfigWidget::restoreExtensionSettings() 298void KABConfigWidget::restoreExtensionSettings()
192{ 299{
193 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 300 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
194 301
195 mExtensionView->clear(); 302 mExtensionView->clear();
196 303
197#ifndef KAB_EMBEDDED 304#ifndef KAB_EMBEDDED
198 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 305 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
199 KTrader::OfferList::ConstIterator it; 306 KTrader::OfferList::ConstIterator it;
200 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 307 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
201 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 308 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
202 continue; 309 continue;
203 310
204 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 311 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
205 item->setService( *it ); 312 item->setService( *it );
206 if ( activeExtensions.contains( item->factory()->identifier() ) ) 313 if ( activeExtensions.contains( item->factory()->identifier() ) )
207 item->setOn( true ); 314 item->setOn( true );
208 } 315 }
209#else //KAB_EMBEDDED 316#else //KAB_EMBEDDED
210 ExtensionFactory *extensionFactory = new MergeFactory(); 317 ExtensionFactory *extensionFactory = new MergeFactory();
211 318
212 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 319 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
213 320
214 item->setFactory( extensionFactory ); 321 item->setFactory( extensionFactory );
215 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 322 if ( activeExtensions.contains( extensionFactory->identifier() ) )
216 item->setOn( true ); 323 item->setOn( true );
217
218 324
219 325
326
220 extensionFactory = new DistributionListFactory(); 327 extensionFactory = new DistributionListFactory();
221 328
222 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 329 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
223 330
224 item->setFactory( extensionFactory ); 331 item->setFactory( extensionFactory );
225 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 332 if ( activeExtensions.contains( extensionFactory->identifier() ) )
226 item->setOn( true ); 333 item->setOn( true );
227 334
228 335
229#endif //KAB_EMBEDDED 336#endif //KAB_EMBEDDED
230 337
231} 338}
232 339
233void KABConfigWidget::saveExtensionSettings() 340void KABConfigWidget::saveExtensionSettings()
234{ 341{
235 QStringList activeExtensions; 342 QStringList activeExtensions;
236 343
237 QPtrList<QListViewItem> list; 344 QPtrList<QListViewItem> list;
238 QListViewItemIterator it( mExtensionView ); 345 QListViewItemIterator it( mExtensionView );
239 while ( it.current() ) { 346 while ( it.current() ) {
240 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); 347 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
241 if ( item ) { 348 if ( item ) {
242 if ( item->isOn() ) 349 if ( item->isOn() )
243 activeExtensions.append( item->factory()->identifier() ); 350 activeExtensions.append( item->factory()->identifier() );
244 } 351 }
245 ++it; 352 ++it;
246 } 353 }
247 354
248 KABPrefs::instance()->mActiveExtensions = activeExtensions; 355 KABPrefs::instance()->mActiveExtensions = activeExtensions;
249} 356}
250 357
251void KABConfigWidget::configureExtension() 358void KABConfigWidget::configureExtension()
252{ 359{
253 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); 360 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
254 if ( !item ) 361 if ( !item )
255 return; 362 return;
256 363
257#ifndef KAB_EMBEDDED 364#ifndef KAB_EMBEDDED
258 KConfig config( "kaddressbookrc" ); 365 KConfig config( "kaddressbookrc" );
259#else //KAB_EMBEDDED 366#else //KAB_EMBEDDED
260 KConfig config( locateLocal("config", "kaddressbookrc") ); 367 KConfig config( locateLocal("config", "kaddressbookrc") );
261#endif //KAB_EMBEDDED 368#endif //KAB_EMBEDDED
262 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); 369 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
263 370
264 ExtensionConfigDialog dlg( item->factory(), &config, this ); 371 ExtensionConfigDialog dlg( item->factory(), &config, this );
265 dlg.exec(); 372 dlg.exec();
266 373
267 config.sync(); 374 config.sync();
268} 375}
269 376
270void KABConfigWidget::selectionChanged( QListViewItem *i ) 377void KABConfigWidget::selectionChanged( QListViewItem *i )
271{ 378{
272 ExtensionItem *item = static_cast<ExtensionItem*>( i ); 379 ExtensionItem *item = static_cast<ExtensionItem*>( i );
273 if ( !item ) 380 if ( !item )
274 return; 381 return;
275 382
276 mConfigureButton->setEnabled( item->configWidgetAvailable() ); 383 mConfigureButton->setEnabled( item->configWidgetAvailable() );
277} 384}
278 385
279void KABConfigWidget::itemClicked( QListViewItem *item ) 386void KABConfigWidget::itemClicked( QListViewItem *item )
280{ 387{
281 if ( item != 0 ) 388 if ( item != 0 )
282 modified(); 389 modified();
283} 390}
284 391
285#ifndef KAB_EMBEDDED 392#ifndef KAB_EMBEDDED
286ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) 393ExtensionItem::ExtensionItem( QListView *parent, const QString &text )
287 : QCheckListItem( parent, text, CheckBox ) 394 : QCheckListItem( parent, text, CheckBox )
288{ 395{
289} 396}
290 397
291void ExtensionItem::setService( const KService::Ptr &ptr ) 398void ExtensionItem::setService( const KService::Ptr &ptr )
292{ 399{
293 mPtr = ptr; 400 mPtr = ptr;
294} 401}
295#else //KAB_EMBEDDED 402#else //KAB_EMBEDDED
296ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) 403ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment )
297 : QCheckListItem( parent, text, CheckBox ) 404 : QCheckListItem( parent, text, CheckBox )
298{ 405{
299 mName = name; 406 mName = name;
300 mComment = comment; 407 mComment = comment;
301} 408}
302 409
303 410
304void ExtensionItem::setFactory( ExtensionFactory* fac ) 411void ExtensionItem::setFactory( ExtensionFactory* fac )
305{ 412{
306 mFactory = fac; 413 mFactory = fac;
307} 414}
308#endif //KAB_EMBEDDED 415#endif //KAB_EMBEDDED
309 416
310bool ExtensionItem::configWidgetAvailable() const 417bool ExtensionItem::configWidgetAvailable() const
311{ 418{
312#ifndef KAB_EMBEDDED 419#ifndef KAB_EMBEDDED
313 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 420 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
314 if ( !factory ) 421 if ( !factory )
315 return false; 422 return false;
316 423
317 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); 424 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
318 if ( !extensionFactory ) 425 if ( !extensionFactory )
319 return false; 426 return false;
320 427
321 return extensionFactory->configureWidgetAvailable(); 428 return extensionFactory->configureWidgetAvailable();
322#else //KAB_EMBEDDED 429#else //KAB_EMBEDDED
323 return mFactory->configureWidgetAvailable(); 430 return mFactory->configureWidgetAvailable();
324#endif //KAB_EMBEDDED 431#endif //KAB_EMBEDDED
325 432
326} 433}
327 434
328ExtensionFactory *ExtensionItem::factory() const 435ExtensionFactory *ExtensionItem::factory() const
329{ 436{
330#ifndef KAB_EMBEDDED 437#ifndef KAB_EMBEDDED
331 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); 438 KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
332 if ( !factory ) 439 if ( !factory )
333 return 0; 440 return 0;
334 441
335 return static_cast<ExtensionFactory*>( factory ); 442 return static_cast<ExtensionFactory*>( factory );
336#else //KAB_EMBEDDED 443#else //KAB_EMBEDDED
337 return mFactory; 444 return mFactory;
338#endif //KAB_EMBEDDED 445#endif //KAB_EMBEDDED
339} 446}
340 447
341QString ExtensionItem::text( int column ) const 448QString ExtensionItem::text( int column ) const
342{ 449{
343#ifndef KAB_EMBEDDED 450#ifndef KAB_EMBEDDED
344 if ( column == 0 ) 451 if ( column == 0 )
345 return mPtr->name(); 452 return mPtr->name();
346 else if ( column == 1 ) 453 else if ( column == 1 )
347 return mPtr->comment(); 454 return mPtr->comment();
348 else 455 else
349 return QString::null; 456 return QString::null;
350#else //KAB_EMBEDDED 457#else //KAB_EMBEDDED
351 if ( column == 0 ) 458 if ( column == 0 )
352 return mName; 459 return mName;
353 else if ( column == 1 ) 460 else if ( column == 1 )
354 return mComment; 461 return mComment;
355 else 462 else
356 return QString::null; 463 return QString::null;
357#endif //KAB_EMBEDDED 464#endif //KAB_EMBEDDED
358} 465}
359 466
360#ifndef KAB_EMBEDDED 467#ifndef KAB_EMBEDDED
361#include "kabconfigwidget.moc" 468#include "kabconfigwidget.moc"
362#endif //KAB_EMBEDDED 469#endif //KAB_EMBEDDED
363 470
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 0f36d9e..9d1363b 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -1,72 +1,78 @@
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;
32 32class QComboBox;
33class QLineEdit;
33class KListView; 34class KListView;
34 35
35class AddresseeWidget; 36class AddresseeWidget;
36 37
37class KABConfigWidget : public QWidget 38class KABConfigWidget : public QWidget
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40 41
41 public: 42 public:
42 KABConfigWidget( QWidget *parent, const char *name = 0 ); 43 KABConfigWidget( QWidget *parent, const char *name = 0 );
43 44
44 void restoreSettings(); 45 void restoreSettings();
45 void saveSettings(); 46 void saveSettings();
46 void defaults(); 47 void defaults();
47 48
48 signals: 49 signals:
49 void changed( bool ); 50 void changed( bool );
50 51
51 public slots: 52 public slots:
52 void modified(); 53 void modified();
53 54
55
56
54 private slots: 57 private slots:
55 void configureExtension(); 58 void configureExtension();
56 void selectionChanged( QListViewItem* ); 59 void selectionChanged( QListViewItem* );
57 void itemClicked( QListViewItem* ); 60 void itemClicked( QListViewItem* );
61 void emailclient_changed( int newClient );
58 62
59 private: 63 private:
60 void restoreExtensionSettings(); 64 void restoreExtensionSettings();
61 void saveExtensionSettings(); 65 void saveExtensionSettings();
62 66
63 KListView *mExtensionView; 67 KListView *mExtensionView;
64 68
65 QCheckBox *mNameParsing; 69 QCheckBox *mNameParsing;
66 QCheckBox *mViewsSingleClickBox; 70 QCheckBox *mViewsSingleClickBox;
67 QPushButton *mConfigureButton; 71 QPushButton *mConfigureButton;
72 QComboBox* mEmailClient;
73 QLineEdit* mEmailChannel;
68 74
69 AddresseeWidget *mAddresseeWidget; 75 AddresseeWidget *mAddresseeWidget;
70}; 76};
71 77
72#endif 78#endif