summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp8
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp30
2 files changed, 24 insertions, 14 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index c8b68c7..936d052 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,312 +1,312 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qvbox.h> 34#include <qvbox.h>
35 35
36#include <kconfig.h> 36#include <kconfig.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include <kdialog.h> 38#include <kdialog.h>
39#include <klistview.h> 39#include <klistview.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kglobal.h> 41#include <kglobal.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <ktrader.h> 46#include <ktrader.h>
47#else // KAB_EMBEDDED 47#else // KAB_EMBEDDED
48#include <mergewidget.h> 48#include <mergewidget.h>
49#include <distributionlistwidget.h> 49#include <distributionlistwidget.h>
50#endif // KAB_EMBEDDED 50#endif // KAB_EMBEDDED
51 51
52#include "addresseewidget.h" 52#include "addresseewidget.h"
53#include "extensionconfigdialog.h" 53#include "extensionconfigdialog.h"
54#include "extensionwidget.h" 54#include "extensionwidget.h"
55#include "kabprefs.h" 55#include "kabprefs.h"
56 56
57#include "kabconfigwidget.h" 57#include "kabconfigwidget.h"
58 58
59class ExtensionItem : public QCheckListItem 59class ExtensionItem : public QCheckListItem
60{ 60{
61 public: 61 public:
62 62
63#ifndef KAB_EMBEDDED 63#ifndef KAB_EMBEDDED
64 ExtensionItem( QListView *parent, const QString &text ); 64 ExtensionItem( QListView *parent, const QString &text );
65 void setService( const KService::Ptr &ptr ); 65 void setService( const KService::Ptr &ptr );
66#else //KAB_EMBEDDED 66#else //KAB_EMBEDDED
67 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); 67 ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment );
68 void setFactory( ExtensionFactory* fac ); 68 void setFactory( ExtensionFactory* fac );
69#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
70 70
71 bool configWidgetAvailable() const; 71 bool configWidgetAvailable() const;
72 ExtensionFactory *factory() const; 72 ExtensionFactory *factory() const;
73 73
74 virtual QString text( int column ) const; 74 virtual QString text( int column ) const;
75 75
76 private: 76 private:
77#ifndef KAB_EMBEDDED 77#ifndef KAB_EMBEDDED
78 KService::Ptr mPtr; 78 KService::Ptr mPtr;
79#else //KAB_EMBEDDED 79#else //KAB_EMBEDDED
80 ExtensionFactory* mFactory; 80 ExtensionFactory* mFactory;
81 QString mName; 81 QString mName;
82 QString mComment; 82 QString mComment;
83 83
84#endif //KAB_EMBEDDED 84#endif //KAB_EMBEDDED
85 85
86}; 86};
87 87
88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) 88KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name )
89 : KPrefsWidget( prefs, parent, name ) 89 : KPrefsWidget( prefs, parent, name )
90{ 90{
91 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 91 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
92 KDialog::spacingHint() ); 92 KDialog::spacingHint() );
93 93
94 QTabWidget *tabWidget = new QTabWidget( this ); 94 QTabWidget *tabWidget = new QTabWidget( this );
95 topLayout->addWidget( tabWidget ); 95 topLayout->addWidget( tabWidget );
96 96
97 // General page 97 // General page
98 QWidget *generalPage = new QWidget( this ); 98 QWidget *generalPage = new QWidget( this );
99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
100 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
101 101
102
102 QWidget *hBox = new QWidget( generalPage, "qhbox" ); 103 QWidget *hBox = new QWidget( generalPage, "qhbox" );
103 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); 104 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox);
104 KPrefsWidFont *detailsFont = 105 KPrefsWidFont *detailsFont =
105 addWidFont(i18n("phone:123"),i18n("Details view font"), 106 addWidFont(i18n("phone:123"),i18n("Details view font"),
106 &(KABPrefs::instance()->mDetailsFont),hBox); 107 &(KABPrefs::instance()->mDetailsFont),hBox);
107 hboxLayout->addWidget(detailsFont->label()); 108 hboxLayout->addWidget(detailsFont->label());
108 hboxLayout->addWidget(detailsFont->preview()); 109 hboxLayout->addWidget(detailsFont->preview());
109 hboxLayout->addWidget(detailsFont->button()); 110 hboxLayout->addWidget(detailsFont->button());
110 hboxLayout->setMargin(KDialog::marginHintSmall() ); 111 hboxLayout->setMargin(KDialog::marginHintSmall() );
111 hboxLayout->setSpacing(KDialog::spacingHintSmall()); 112 hboxLayout->setSpacing(KDialog::spacingHintSmall());
113 //hBox->setBackgroundColor( black);
112 layout->addWidget( hBox ); 114 layout->addWidget( hBox );
113 115
114 //general groupbox 116 //general groupbox
115 QVBox *vBox = new QVBox( generalPage, "qvbox" ); 117 QWidget *vBox = new QWidget( generalPage, "qvbox" );
116 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); 118 QVBoxLayout *boxLayout = new QVBoxLayout( vBox );
117 boxLayout->setAlignment( Qt::AlignTop ); 119 boxLayout->setAlignment( Qt::AlignTop );
118 boxLayout->setMargin(KDialog::marginHintSmall() ); 120 boxLayout->setMargin(KDialog::marginHintSmall() );
119 vBox->layout()->setMargin(KDialog::marginHintSmall()) ;
120 vBox->layout()->setSpacing(KDialog::spacingHintSmall());
121 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 121 boxLayout->setSpacing( KDialog::spacingHintSmall() );
122 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 122 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
123 boxLayout->addWidget( mSearchReturnBox ); 123 boxLayout->addWidget( mSearchReturnBox );
124 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); 124 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
125 boxLayout->addWidget( mViewsSingleClickBox ); 125 boxLayout->addWidget( mViewsSingleClickBox );
126 126
127 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); 127 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
128 boxLayout->addWidget( mNameParsing ); 128 boxLayout->addWidget( mNameParsing );
129 129
130 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 130 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
131 boxLayout->addWidget( mMultipleViewsAtOnce ); 131 boxLayout->addWidget( mMultipleViewsAtOnce );
132 132
133 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); 133 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
134 boxLayout->addWidget( mAskForQuit ); 134 boxLayout->addWidget( mAskForQuit );
135 135
136 layout->addWidget( vBox ); 136 layout->addWidget( vBox );
137 137
138 tabWidget->addTab( generalPage, i18n( "General" ) ); 138 tabWidget->addTab( generalPage, i18n( "General" ) );
139 139
140 // Extension page 140 // Extension page
141 QWidget *extensionPage = new QWidget( this ); 141 QWidget *extensionPage = new QWidget( this );
142 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 142 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
143 KDialog::spacingHintSmall() ); 143 KDialog::spacingHintSmall() );
144 144
145 //extensions groupbox 145 //extensions groupbox
146 146
147 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 147 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
148 boxLayout = new QVBoxLayout( groupBox->layout() ); 148 boxLayout = new QVBoxLayout( groupBox->layout() );
149 boxLayout->setAlignment( Qt::AlignTop ); 149 boxLayout->setAlignment( Qt::AlignTop );
150 boxLayout->setMargin(KDialog::marginHintSmall()); 150 boxLayout->setMargin(KDialog::marginHintSmall());
151 boxLayout->setSpacing(KDialog::spacingHintSmall()); 151 boxLayout->setSpacing(KDialog::spacingHintSmall());
152 groupBox->layout()->setMargin(1) ; 152 groupBox->layout()->setMargin(1) ;
153 groupBox->layout()->setSpacing(0); 153 groupBox->layout()->setSpacing(0);
154 mExtensionView = new KListView( groupBox ); 154 mExtensionView = new KListView( groupBox );
155 mExtensionView->setAllColumnsShowFocus( true ); 155 mExtensionView->setAllColumnsShowFocus( true );
156 mExtensionView->addColumn( i18n( "Name" ) ); 156 mExtensionView->addColumn( i18n( "Name" ) );
157 mExtensionView->addColumn( i18n( "Description" ) ); 157 mExtensionView->addColumn( i18n( "Description" ) );
158 mExtensionView->setMaximumHeight(80); 158 mExtensionView->setMaximumHeight(80);
159 159
160 boxLayout->addWidget( mExtensionView ); 160 boxLayout->addWidget( mExtensionView );
161 161
162 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 162 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
163 mConfigureButton->setEnabled( false ); 163 mConfigureButton->setEnabled( false );
164 boxLayout->addWidget( mConfigureButton ); 164 boxLayout->addWidget( mConfigureButton );
165 165
166 extensionLayout->addWidget( groupBox ); 166 extensionLayout->addWidget( groupBox );
167 167
168 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 168 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
169 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 169 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
170 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 170 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
171 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 171 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
172 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 172 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
173 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 173 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
174 SLOT( selectionChanged( QListViewItem* ) ) ); 174 SLOT( selectionChanged( QListViewItem* ) ) );
175 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 175 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
176 SLOT( itemClicked( QListViewItem* ) ) ); 176 SLOT( itemClicked( QListViewItem* ) ) );
177 connect( mConfigureButton, SIGNAL( clicked() ), 177 connect( mConfigureButton, SIGNAL( clicked() ),
178 SLOT( configureExtension() ) ); 178 SLOT( configureExtension() ) );
179 179
180 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 180 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
181 181
182 // Addressee page 182 // Addressee page
183 mAddresseeWidget = new AddresseeWidget( this ); 183 mAddresseeWidget = new AddresseeWidget( this );
184 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 184 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
185 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 185 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
186 186
187} 187}
188 188
189void KABConfigWidget::usrReadConfig() 189void KABConfigWidget::usrReadConfig()
190{ 190{
191 KABPrefs* prefs = KABPrefs::instance(); 191 KABPrefs* prefs = KABPrefs::instance();
192 192
193 bool blocked = signalsBlocked(); 193 bool blocked = signalsBlocked();
194 blockSignals( true ); 194 blockSignals( true );
195 195
196 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 196 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
197 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 197 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
198 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 198 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
199 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 199 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
200 mAskForQuit->setChecked( prefs->mAskForQuit ); 200 mAskForQuit->setChecked( prefs->mAskForQuit );
201 201
202 mAddresseeWidget->restoreSettings(); 202 mAddresseeWidget->restoreSettings();
203 203
204 restoreExtensionSettings(); 204 restoreExtensionSettings();
205 205
206 blockSignals( blocked ); 206 blockSignals( blocked );
207 207
208} 208}
209 209
210void KABConfigWidget::usrWriteConfig() 210void KABConfigWidget::usrWriteConfig()
211{ 211{
212 KABPrefs* prefs = KABPrefs::instance(); 212 KABPrefs* prefs = KABPrefs::instance();
213 213
214 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 214 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
215 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 215 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
216 prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); 216 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
217 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 217 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
218 prefs->mAskForQuit = mAskForQuit->isChecked(); 218 prefs->mAskForQuit = mAskForQuit->isChecked();
219 219
220 mAddresseeWidget->saveSettings(); 220 mAddresseeWidget->saveSettings();
221 221
222 saveExtensionSettings(); 222 saveExtensionSettings();
223 223
224} 224}
225 225
226void KABConfigWidget::restoreExtensionSettings() 226void KABConfigWidget::restoreExtensionSettings()
227{ 227{
228 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 228 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
229 229
230 mExtensionView->clear(); 230 mExtensionView->clear();
231 231
232#ifndef KAB_EMBEDDED 232#ifndef KAB_EMBEDDED
233 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 233 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
234 KTrader::OfferList::ConstIterator it; 234 KTrader::OfferList::ConstIterator it;
235 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 235 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
236 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 236 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
237 continue; 237 continue;
238 238
239 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 239 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
240 item->setService( *it ); 240 item->setService( *it );
241 if ( activeExtensions.contains( item->factory()->identifier() ) ) 241 if ( activeExtensions.contains( item->factory()->identifier() ) )
242 item->setOn( true ); 242 item->setOn( true );
243 } 243 }
244#else //KAB_EMBEDDED 244#else //KAB_EMBEDDED
245 ExtensionFactory *extensionFactory = new MergeFactory(); 245 ExtensionFactory *extensionFactory = new MergeFactory();
246 246
247 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 247 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
248 248
249 item->setFactory( extensionFactory ); 249 item->setFactory( extensionFactory );
250 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 250 if ( activeExtensions.contains( extensionFactory->identifier() ) )
251 item->setOn( true ); 251 item->setOn( true );
252 252
253 253
254 254
255 extensionFactory = new DistributionListFactory(); 255 extensionFactory = new DistributionListFactory();
256 256
257 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 257 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
258 258
259 item->setFactory( extensionFactory ); 259 item->setFactory( extensionFactory );
260 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 260 if ( activeExtensions.contains( extensionFactory->identifier() ) )
261 item->setOn( true ); 261 item->setOn( true );
262 262
263 263
264#endif //KAB_EMBEDDED 264#endif //KAB_EMBEDDED
265 265
266} 266}
267 267
268void KABConfigWidget::saveExtensionSettings() 268void KABConfigWidget::saveExtensionSettings()
269{ 269{
270 QStringList activeExtensions; 270 QStringList activeExtensions;
271 271
272 QPtrList<QListViewItem> list; 272 QPtrList<QListViewItem> list;
273 QListViewItemIterator it( mExtensionView ); 273 QListViewItemIterator it( mExtensionView );
274 while ( it.current() ) { 274 while ( it.current() ) {
275 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); 275 ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
276 if ( item ) { 276 if ( item ) {
277 if ( item->isOn() ) 277 if ( item->isOn() )
278 activeExtensions.append( item->factory()->identifier() ); 278 activeExtensions.append( item->factory()->identifier() );
279 } 279 }
280 ++it; 280 ++it;
281 } 281 }
282 282
283 KABPrefs::instance()->mActiveExtensions = activeExtensions; 283 KABPrefs::instance()->mActiveExtensions = activeExtensions;
284} 284}
285 285
286void KABConfigWidget::configureExtension() 286void KABConfigWidget::configureExtension()
287{ 287{
288 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); 288 ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
289 if ( !item ) 289 if ( !item )
290 return; 290 return;
291 291
292#ifndef KAB_EMBEDDED 292#ifndef KAB_EMBEDDED
293 KConfig config( "kaddressbookrc" ); 293 KConfig config( "kaddressbookrc" );
294#else //KAB_EMBEDDED 294#else //KAB_EMBEDDED
295 KConfig config( locateLocal("config", "kaddressbookrc") ); 295 KConfig config( locateLocal("config", "kaddressbookrc") );
296#endif //KAB_EMBEDDED 296#endif //KAB_EMBEDDED
297 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); 297 config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
298 298
299 ExtensionConfigDialog dlg( item->factory(), &config, this ); 299 ExtensionConfigDialog dlg( item->factory(), &config, this );
300 dlg.exec(); 300 dlg.exec();
301 301
302 config.sync(); 302 config.sync();
303} 303}
304 304
305void KABConfigWidget::selectionChanged( QListViewItem *i ) 305void KABConfigWidget::selectionChanged( QListViewItem *i )
306{ 306{
307 ExtensionItem *item = static_cast<ExtensionItem*>( i ); 307 ExtensionItem *item = static_cast<ExtensionItem*>( i );
308 if ( !item ) 308 if ( !item )
309 return; 309 return;
310 310
311 mConfigureButton->setEnabled( item->configWidgetAvailable() ); 311 mConfigureButton->setEnabled( item->configWidgetAvailable() );
312} 312}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 332f975..6de60fa 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,529 +1,539 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qbuttongroup.h> 37#include <qbuttongroup.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qregexp.h> 39#include <qregexp.h>
40 40
41#include <kdialog.h> 41#include <kdialog.h>
42#include <klocale.h> 42#include <klocale.h>
43#include <kdateedit.h> 43#include <kdateedit.h>
44#include <kglobal.h> 44#include <kglobal.h>
45#include <stdlib.h> 45#include <stdlib.h>
46 46
47/*US 47/*US
48#include <qcheckbox.h> 48#include <qcheckbox.h>
49#include <qframe.h> 49#include <qframe.h>
50#include <qpushbutton.h> 50#include <qpushbutton.h>
51#include <qcombobox.h> 51#include <qcombobox.h>
52#include <qlineedit.h> 52#include <qlineedit.h>
53#include <qlabel.h> 53#include <qlabel.h>
54#include <qfile.h> 54#include <qfile.h>
55 55
56#include <kconfig.h> 56#include <kconfig.h>
57#include <kdebug.h> 57#include <kdebug.h>
58#include <kdialog.h> 58#include <kdialog.h>
59#include <klistview.h> 59#include <klistview.h>
60#include <klocale.h> 60#include <klocale.h>
61#include <kglobal.h> 61#include <kglobal.h>
62#include <kmessagebox.h> 62#include <kmessagebox.h>
63#include <kstandarddirs.h> 63#include <kstandarddirs.h>
64 64
65#ifndef KAB_EMBEDDED 65#ifndef KAB_EMBEDDED
66#include <ktrader.h> 66#include <ktrader.h>
67#else // KAB_EMBEDDED 67#else // KAB_EMBEDDED
68#include <mergewidget.h> 68#include <mergewidget.h>
69#include <distributionlistwidget.h> 69#include <distributionlistwidget.h>
70#endif // KAB_EMBEDDED 70#endif // KAB_EMBEDDED
71 71
72#include "addresseewidget.h" 72#include "addresseewidget.h"
73#include "extensionconfigdialog.h" 73#include "extensionconfigdialog.h"
74#include "extensionwidget.h" 74#include "extensionwidget.h"
75*/ 75*/
76 76
77#include "qapplication.h" 77#include "qapplication.h"
78 78
79#include "kpimglobalprefs.h" 79#include "kpimglobalprefs.h"
80 80
81#include "kdepimconfigwidget.h" 81#include "kdepimconfigwidget.h"
82 82
83 83
84KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 84KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
85 : KPrefsWidget(prefs, parent, name ) 85 : KPrefsWidget(prefs, parent, name )
86{ 86{
87 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 87 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
88 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 88 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
89 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 89 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
90 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 90 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
91 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 91 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
92 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 92 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
93 93
94 94
95 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 95 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
96 KDialog::spacingHint() ); 96 KDialog::spacingHint() );
97 97
98 tabWidget = new QTabWidget( this ); 98 tabWidget = new QTabWidget( this );
99 topLayout->addWidget( tabWidget ); 99 topLayout->addWidget( tabWidget );
100 100
101 101
102 setupLocaleTab(); 102 setupLocaleTab();
103 setupLocaleDateTab(); 103 setupLocaleDateTab();
104 setupTimeZoneTab(); 104 setupTimeZoneTab();
105 setupExternalAppTab(); 105 setupExternalAppTab();
106 106
107} 107}
108void KDEPIMConfigWidget::showTimeZoneTab() 108void KDEPIMConfigWidget::showTimeZoneTab()
109{ 109{
110 tabWidget->setCurrentPage ( 2 ) ; 110 tabWidget->setCurrentPage ( 2 ) ;
111} 111}
112void KDEPIMConfigWidget::setupExternalAppTab() 112void KDEPIMConfigWidget::setupExternalAppTab()
113{ 113{
114 QWidget *externalAppsPage = new QWidget( this ); 114 QWidget *externalAppsPage = new QWidget( this );
115 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 115 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
116 KDialog::spacingHintSmall() ); 116 KDialog::spacingHintSmall() );
117 117
118 mExternalApps = new QComboBox( externalAppsPage ); 118 mExternalApps = new QComboBox( externalAppsPage );
119 119
120 QMap<ExternalAppHandler::Types, QString>::Iterator it; 120 QMap<ExternalAppHandler::Types, QString>::Iterator it;
121 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 121 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
122 mExternalApps->insertItem( it.data(), it.key() ); 122 mExternalApps->insertItem( it.data(), it.key() );
123 123
124 layout->addWidget( mExternalApps ); 124 layout->addWidget( mExternalApps );
125 125
126 connect( mExternalApps, SIGNAL( activated( int ) ), 126 connect( mExternalApps, SIGNAL( activated( int ) ),
127 this, SLOT (externalapp_changed( int ) ) ); 127 this, SLOT (externalapp_changed( int ) ) );
128 128
129 129
130 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 130 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
131 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 131 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
132 132 mExternalAppGroupBox->layout()->setMargin(5);
133 133
134 mClient = new QComboBox( mExternalAppGroupBox ); 134 mClient = new QComboBox( mExternalAppGroupBox );
135 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 135 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
136 136
137 connect( mClient, SIGNAL( activated( int ) ), 137 connect( mClient, SIGNAL( activated( int ) ),
138 this, SLOT (client_changed( int ) ) ); 138 this, SLOT (client_changed( int ) ) );
139 139
140 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 140 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
141 boxLayout->addWidget( lab, 1, 0 ); 141 boxLayout->addWidget( lab, 1, 0 );
142 mChannel = new QLineEdit(mExternalAppGroupBox); 142 mChannel = new QLineEdit(mExternalAppGroupBox);
143 mChannel->setReadOnly(true); 143 mChannel->setReadOnly(true);
144 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 144 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
145 145
146 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 146 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
147 boxLayout->addWidget( lab, 3, 0 ); 147 boxLayout->addWidget( lab, 3, 0 );
148 mMessage = new QLineEdit(mExternalAppGroupBox); 148 mMessage = new QLineEdit(mExternalAppGroupBox);
149 mMessage->setReadOnly(true); 149 mMessage->setReadOnly(true);
150 boxLayout->addWidget( mMessage , 4, 0); 150 boxLayout->addWidget( mMessage , 4, 0);
151 151
152 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 152 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
153 boxLayout->addWidget( lab, 3, 1 ); 153 boxLayout->addWidget( lab, 3, 1 );
154 mParameters = new QLineEdit(mExternalAppGroupBox); 154 mParameters = new QLineEdit(mExternalAppGroupBox);
155 mParameters->setReadOnly(true); 155 mParameters->setReadOnly(true);
156 boxLayout->addWidget( mParameters, 4, 1 ); 156 boxLayout->addWidget( mParameters, 4, 1 );
157 157
158 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 158 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
159 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 159 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
160 160
161
161 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 162 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
162 boxLayout->addWidget( lab, 6, 0 ); 163 boxLayout->addWidget( lab, 6, 0 );
163 mMessage2 = new QLineEdit(mExternalAppGroupBox); 164 mMessage2 = new QLineEdit(mExternalAppGroupBox);
164 mMessage2->setReadOnly(true); 165 mMessage2->setReadOnly(true);
165 boxLayout->addWidget( mMessage2 , 7, 0); 166 boxLayout->addWidget( mMessage2 , 7, 0);
166 167
167 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 168 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
168 boxLayout->addWidget( lab, 6, 1 ); 169 boxLayout->addWidget( lab, 6, 1 );
169 mParameters2 = new QLineEdit(mExternalAppGroupBox); 170 mParameters2 = new QLineEdit(mExternalAppGroupBox);
170 mParameters2->setReadOnly(true); 171 mParameters2->setReadOnly(true);
171 boxLayout->addWidget( mParameters2, 7, 1 ); 172 boxLayout->addWidget( mParameters2, 7, 1 );
172 173
173 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 174 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
174 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 175 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
175 176
176 177
177 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 178 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
178 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 179 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
179 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 180 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
180 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 181 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
181 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 182 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
182 183
183 184
184 layout->addWidget( mExternalAppGroupBox ); 185 layout->addWidget( mExternalAppGroupBox );
185 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 186 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
186 187
187} 188}
188 189
189 190
190void KDEPIMConfigWidget::setupLocaleDateTab() 191void KDEPIMConfigWidget::setupLocaleDateTab()
191{ 192{
192 QWidget *topFrame = new QWidget( this ); 193 QWidget *topFrame = new QWidget( this );
193 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); 194 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
194 195
195 topLayout->setSpacing(KDialog::spacingHint()); 196 topLayout->setSpacing(KDialog::spacingHintSmall());
196 topLayout->setMargin(KDialog::marginHint()); 197 topLayout->setMargin(KDialog::marginHintSmall());
197 int iii = 0; 198 int iii = 0;
198 199
199 200
200 KPrefsWidRadios *syncPrefsGroup = 201 KPrefsWidRadios *syncPrefsGroup =
201 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); 202 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
202 QString format; 203 QString format;
203 if ( QApplication::desktop()->width() < 480 ) 204 if ( QApplication::desktop()->width() < 480 )
204 format = "(%d.%m.%Y)"; 205 format = "(%d.%m.%Y)";
205 else 206 else
206 format = "(%d.%m.%Y|%A %d %B %Y)"; 207 format = "(%d.%m.%Y|%A %d %B %Y)";
207 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 208 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
208 if ( QApplication::desktop()->width() < 480 ) 209 if ( QApplication::desktop()->width() < 480 )
209 format = "(%m.%d.%Y)"; 210 format = "(%m.%d.%Y)";
210 else 211 else
211 format = "(%m.%d.%Y|%A %B %d %Y)"; 212 format = "(%m.%d.%Y|%A %B %d %Y)";
212 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 213 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
213 if ( QApplication::desktop()->width() < 480 ) 214 if ( QApplication::desktop()->width() < 480 )
214 format = "(%Y-%m-%d)"; 215 format = "(%Y-%m-%d)";
215 else 216 else
216 format = "(%Y-%m-%d|%A %Y %B %d)"; 217 format = "(%Y-%m-%d|%A %Y %B %d)";
217 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 218 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
218 syncPrefsGroup->addRadio(i18n("User defined")); 219 syncPrefsGroup->addRadio(i18n("User defined"));
220 if ( QApplication::desktop()->width() < 480 ) {
221 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
222 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
223 }
219 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 224 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
220 ++iii; 225 ++iii;
221 ++iii; 226 ++iii;
222 QLabel * lab; 227 QLabel * lab;
223 mUserDateFormatLong = new QLineEdit(topFrame); 228 mUserDateFormatLong = new QLineEdit(topFrame);
224 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 229 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
225 topLayout->addWidget(lab ,iii,0); 230 topLayout->addWidget(lab ,iii,0);
226 topLayout->addWidget(mUserDateFormatLong,iii,1); 231 topLayout->addWidget(mUserDateFormatLong,iii,1);
227 ++iii; 232 ++iii;
228 mUserDateFormatShort = new QLineEdit(topFrame); 233 mUserDateFormatShort = new QLineEdit(topFrame);
229 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 234 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
230 topLayout->addWidget(lab ,iii,0); 235 topLayout->addWidget(lab ,iii,0);
231 topLayout->addWidget(mUserDateFormatShort,iii,1); 236 topLayout->addWidget(mUserDateFormatShort,iii,1);
232 ++iii; 237 ++iii;
233 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 238 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
234 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 239 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
235 ++iii; 240 ++iii;
236 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 241 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
237 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 242 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
238 ++iii; 243 ++iii;
239 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 244 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
240 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 245 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
241 ++iii; 246 ++iii;
242 247
243 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 248 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
244 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 249 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
245 250
246 251
247 tabWidget->addTab( topFrame, i18n( "Date Format" ) ); 252 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
248} 253}
249 254
250void KDEPIMConfigWidget::setupLocaleTab() 255void KDEPIMConfigWidget::setupLocaleTab()
251{ 256{
252 257
253 QWidget *topFrame = new QWidget( this ); 258 QWidget *topFrame = new QWidget( this );
254 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 259 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
255 260
256 topLayout->setSpacing(KDialog::spacingHint()); 261 topLayout->setSpacing(KDialog::spacingHint());
257 topLayout->setMargin(KDialog::marginHint()); 262 topLayout->setMargin(KDialog::marginHint());
258 int iii = 0; 263 int iii = 0;
259 KPrefsWidRadios *syncPrefsGroup = 264 KPrefsWidRadios *syncPrefsGroup =
260 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); 265 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
261 syncPrefsGroup->addRadio(i18n("English")); 266 syncPrefsGroup->addRadio(i18n("English"));
262 syncPrefsGroup->addRadio(i18n("German")); 267 syncPrefsGroup->addRadio(i18n("German"));
263 syncPrefsGroup->addRadio(i18n("French")); 268 syncPrefsGroup->addRadio(i18n("French"));
264 syncPrefsGroup->addRadio(i18n("Italian")); 269 syncPrefsGroup->addRadio(i18n("Italian"));
265 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 270 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
266 if ( QApplication::desktop()->width() < 300 ) 271 if ( QApplication::desktop()->width() < 300 ) {
267 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 272 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
273 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
274 }
268 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 275 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
269 ++iii; 276 ++iii;
270 277
271 syncPrefsGroup = 278 syncPrefsGroup =
272 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); 279 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
273 if ( QApplication::desktop()->width() > 300 ) 280 if ( QApplication::desktop()->width() > 300 )
274 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 281 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
275 syncPrefsGroup->addRadio(i18n("24:00")); 282 syncPrefsGroup->addRadio(i18n("24:00"));
276 syncPrefsGroup->addRadio(i18n("12:00am")); 283 syncPrefsGroup->addRadio(i18n("12:00am"));
277 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 284 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
278 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 285 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
279 ++iii; 286 ++iii;
280 287
281 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), 288 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
282 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); 289 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
283 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 290 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
284 ++iii; 291 ++iii;
285 292
286 293
287 tabWidget->addTab( topFrame, i18n( "Locale" ) ); 294 tabWidget->addTab( topFrame, i18n( "Locale" ) );
288 295
289} 296}
290 297
291 298
292void KDEPIMConfigWidget::setupTimeZoneTab() 299void KDEPIMConfigWidget::setupTimeZoneTab()
293{ 300{
294 QWidget *topFrame = new QWidget( this ); 301 QWidget *topFrame = new QWidget( this );
295 QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2); 302 QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2);
296 topLayout->setSpacing(KDialog::spacingHint()); 303 topLayout->setSpacing(KDialog::spacingHintSmall());
297 topLayout->setMargin(KDialog::marginHint()); 304 topLayout->setMargin(KDialog::marginHintSmall());
298 305
299 QHBox *timeZoneBox = new QHBox( topFrame ); 306 QHBox *timeZoneBox = new QHBox( topFrame );
300 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 307 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
301 308
302 new QLabel( i18n("Timezone:"), timeZoneBox ); 309 new QLabel( i18n("Timezone:"), timeZoneBox );
303 mTimeZoneCombo = new QComboBox( timeZoneBox ); 310 mTimeZoneCombo = new QComboBox( timeZoneBox );
304 if ( QApplication::desktop()->width() < 300 ) { 311 if ( QApplication::desktop()->width() < 300 ) {
305 mTimeZoneCombo->setMaximumWidth(150); 312 mTimeZoneCombo->setMaximumWidth(150);
306 } 313 }
307 314
308 QStringList list; 315 QStringList list;
309 list = KGlobal::locale()->timeZoneList(); 316 list = KGlobal::locale()->timeZoneList();
310 mTimeZoneCombo->insertStringList(list); 317 mTimeZoneCombo->insertStringList(list);
311 318
312 // find the currently set time zone and select it 319 // find the currently set time zone and select it
313 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; 320 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
314 int nCurrentlySet = 11; 321 int nCurrentlySet = 11;
315 for (int i = 0; i < mTimeZoneCombo->count(); i++) 322 for (int i = 0; i < mTimeZoneCombo->count(); i++)
316 { 323 {
317 if (mTimeZoneCombo->text(i) == sCurrentlySet) 324 if (mTimeZoneCombo->text(i) == sCurrentlySet)
318 { 325 {
319 nCurrentlySet = i; 326 nCurrentlySet = i;
320 break; 327 break;
321 } 328 }
322 } 329 }
323 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 330 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
324 int iii = 1; 331 int iii = 1;
325 KPrefsWidBool *sb = 332 KPrefsWidBool *sb =
326 addWidBool(i18n("Add 30 min (+00:30) to selected Timezone"), 333 addWidBool(i18n("Add 30 min (+00:30) to selected Timezone"),
327 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); 334 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame);
328 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 335 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
329 ++iii; 336 ++iii;
330 sb = 337 sb =
331 addWidBool(i18n("Timezone has daylight saving"), 338 addWidBool(i18n("Timezone has daylight saving"),
332 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); 339 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
333 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 340 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
334 ++iii; 341 ++iii;
335 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 342 QLabel* lab;
343
344 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
336 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 345 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
337 ++iii; 346 ++iii;
347
338 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 348 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
339 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 349 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
340 ++iii; 350 ++iii;
341 lab = new QLabel( i18n("Daylight start:"), topFrame ); 351 lab = new QLabel( i18n("Daylight start:"), topFrame );
342 topLayout->addWidget(lab, iii,0); 352 topLayout->addWidget(lab, iii,0);
343 mStartDateSavingEdit = new KDateEdit(topFrame); 353 mStartDateSavingEdit = new KDateEdit(topFrame);
344 topLayout->addWidget(mStartDateSavingEdit, iii,1); 354 topLayout->addWidget(mStartDateSavingEdit, iii,1);
345 ++iii; 355 ++iii;
346 356
347 lab = new QLabel( i18n("Daylight end:"), topFrame ); 357 lab = new QLabel( i18n("Daylight end:"), topFrame );
348 topLayout->addWidget(lab, iii,0); 358 topLayout->addWidget(lab, iii,0);
349 mEndDateSavingEdit = new KDateEdit(topFrame); 359 mEndDateSavingEdit = new KDateEdit(topFrame);
350 topLayout->addWidget(mEndDateSavingEdit, iii,1); 360 topLayout->addWidget(mEndDateSavingEdit, iii,1);
351 ++iii; 361 ++iii;
352 QDate current ( 2001, 1,1); 362 QDate current ( 2001, 1,1);
353 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); 363 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
354 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); 364 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
355 365
356 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 366 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
357 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 367 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
358 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); 368 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
359 369
360 370
361 371
362 tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); 372 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
363 373
364} 374}
365 375
366void KDEPIMConfigWidget::externalapp_changed( int newApp ) 376void KDEPIMConfigWidget::externalapp_changed( int newApp )
367{ 377{
368 // first store the current data 378 // first store the current data
369 saveEditFieldSettings(); 379 saveEditFieldSettings();
370 380
371 // set mCurrentApp 381 // set mCurrentApp
372 mCurrentApp = (ExternalAppHandler::Types)newApp; 382 mCurrentApp = (ExternalAppHandler::Types)newApp;
373 383
374 // set mCurrentClient 384 // set mCurrentClient
375 switch(mCurrentApp) 385 switch(mCurrentApp)
376 { 386 {
377 case(ExternalAppHandler::EMAIL): 387 case(ExternalAppHandler::EMAIL):
378 mCurrentClient = mEmailClient; 388 mCurrentClient = mEmailClient;
379 break; 389 break;
380 case(ExternalAppHandler::PHONE): 390 case(ExternalAppHandler::PHONE):
381 mCurrentClient = mPhoneClient; 391 mCurrentClient = mPhoneClient;
382 break; 392 break;
383 case(ExternalAppHandler::SMS): 393 case(ExternalAppHandler::SMS):
384 mCurrentClient = mSMSClient; 394 mCurrentClient = mSMSClient;
385 break; 395 break;
386 case(ExternalAppHandler::FAX): 396 case(ExternalAppHandler::FAX):
387 mCurrentClient = mFaxClient; 397 mCurrentClient = mFaxClient;
388 break; 398 break;
389 case(ExternalAppHandler::PAGER): 399 case(ExternalAppHandler::PAGER):
390 mCurrentClient = mPagerClient; 400 mCurrentClient = mPagerClient;
391 break; 401 break;
392 case(ExternalAppHandler::SIP): 402 case(ExternalAppHandler::SIP):
393 mCurrentClient = mSipClient; 403 mCurrentClient = mSipClient;
394 break; 404 break;
395 default: 405 default:
396 return; 406 return;
397 } 407 }
398 408
399 // and at last update the widgets 409 // and at last update the widgets
400 updateClientWidgets(); 410 updateClientWidgets();
401} 411}
402 412
403 413
404 414
405void KDEPIMConfigWidget::client_changed( int newClient ) 415void KDEPIMConfigWidget::client_changed( int newClient )
406{ 416{
407 if (newClient == mCurrentClient) 417 if (newClient == mCurrentClient)
408 return; 418 return;
409 419
410 // first store the current data 420 // first store the current data
411 saveEditFieldSettings(); 421 saveEditFieldSettings();
412 422
413 423
414 //then reset the clientvariable 424 //then reset the clientvariable
415 mCurrentClient = newClient; 425 mCurrentClient = newClient;
416 426
417 // and at last update the widgets 427 // and at last update the widgets
418 updateClientWidgets(); 428 updateClientWidgets();
419 429
420 KPrefsWidget::modified(); 430 KPrefsWidget::modified();
421} 431}
422 432
423void KDEPIMConfigWidget::saveEditFieldSettings() 433void KDEPIMConfigWidget::saveEditFieldSettings()
424{ 434{
425 435
426 switch(mCurrentApp) 436 switch(mCurrentApp)
427 { 437 {
428 case(ExternalAppHandler::EMAIL): 438 case(ExternalAppHandler::EMAIL):
429 mEmailClient = mClient->currentItem(); 439 mEmailClient = mClient->currentItem();
430 break; 440 break;
431 case(ExternalAppHandler::PHONE): 441 case(ExternalAppHandler::PHONE):
432 mPhoneClient= mClient->currentItem(); 442 mPhoneClient= mClient->currentItem();
433 break; 443 break;
434 case(ExternalAppHandler::SMS): 444 case(ExternalAppHandler::SMS):
435 mSMSClient = mClient->currentItem(); 445 mSMSClient = mClient->currentItem();
436 break; 446 break;
437 case(ExternalAppHandler::FAX): 447 case(ExternalAppHandler::FAX):
438 mFaxClient = mClient->currentItem(); 448 mFaxClient = mClient->currentItem();
439 break; 449 break;
440 case(ExternalAppHandler::PAGER): 450 case(ExternalAppHandler::PAGER):
441 mPagerClient = mClient->currentItem(); 451 mPagerClient = mClient->currentItem();
442 break; 452 break;
443 case(ExternalAppHandler::SIP): 453 case(ExternalAppHandler::SIP):
444 mSipClient = mClient->currentItem(); 454 mSipClient = mClient->currentItem();
445 break; 455 break;
446 default: 456 default:
447 return; 457 return;
448 } 458 }
449 459
450 //store the current data back to the apropriate membervariables if we had set it to "other" 460 //store the current data back to the apropriate membervariables if we had set it to "other"
451 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 461 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
452 { 462 {
453 mEmailOtherChannel = mChannel->text(); 463 mEmailOtherChannel = mChannel->text();
454 mEmailOtherMessage = mMessage->text(); 464 mEmailOtherMessage = mMessage->text();
455 mEmailOtherMessageParameters = mParameters->text(); 465 mEmailOtherMessageParameters = mParameters->text();
456 mEmailOtherMessage2 = mMessage2->text(); 466 mEmailOtherMessage2 = mMessage2->text();
457 mEmailOtherMessageParameters2 = mParameters2->text(); 467 mEmailOtherMessageParameters2 = mParameters2->text();
458 } 468 }
459 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 469 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
460 { 470 {
461 mPhoneOtherChannel = mChannel->text(); 471 mPhoneOtherChannel = mChannel->text();
462 mPhoneOtherMessage = mMessage->text(); 472 mPhoneOtherMessage = mMessage->text();
463 mPhoneOtherMessageParameters = mParameters->text(); 473 mPhoneOtherMessageParameters = mParameters->text();
464 } 474 }
465 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 475 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
466 { 476 {
467 mSMSOtherChannel = mChannel->text(); 477 mSMSOtherChannel = mChannel->text();
468 mSMSOtherMessage = mMessage->text(); 478 mSMSOtherMessage = mMessage->text();
469 mSMSOtherMessageParameters = mParameters->text(); 479 mSMSOtherMessageParameters = mParameters->text();
470 } 480 }
471 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 481 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
472 { 482 {
473 mFaxOtherChannel = mChannel->text(); 483 mFaxOtherChannel = mChannel->text();
474 mFaxOtherMessage = mMessage->text(); 484 mFaxOtherMessage = mMessage->text();
475 mFaxOtherMessageParameters = mParameters->text(); 485 mFaxOtherMessageParameters = mParameters->text();
476 } 486 }
477 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 487 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
478 { 488 {
479 mPagerOtherChannel = mChannel->text(); 489 mPagerOtherChannel = mChannel->text();
480 mPagerOtherMessage = mMessage->text(); 490 mPagerOtherMessage = mMessage->text();
481 mPagerOtherMessageParameters = mParameters->text(); 491 mPagerOtherMessageParameters = mParameters->text();
482 } 492 }
483 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 493 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
484 { 494 {
485 mSipOtherChannel = mChannel->text(); 495 mSipOtherChannel = mChannel->text();
486 mSipOtherMessage = mMessage->text(); 496 mSipOtherMessage = mMessage->text();
487 mSipOtherMessageParameters = mParameters->text(); 497 mSipOtherMessageParameters = mParameters->text();
488 } 498 }
489 499
490 500
491} 501}
492 502
493void KDEPIMConfigWidget::updateClientWidgets() 503void KDEPIMConfigWidget::updateClientWidgets()
494{ 504{
495 bool blocked = signalsBlocked(); 505 bool blocked = signalsBlocked();
496 blockSignals( true ); 506 blockSignals( true );
497 507
498 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 508 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
499 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); 509 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
500 if (it == mExternalAppsMap.end()) 510 if (it == mExternalAppsMap.end())
501 return; 511 return;
502 512
503 // update group box 513 // update group box
504 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 514 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
505 515
506 //update the entries in the client combobox 516 //update the entries in the client combobox
507 mClient->clear(); 517 mClient->clear();
508 518
509 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 519 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
510 DefaultAppItem* dai; 520 DefaultAppItem* dai;
511 for ( dai=items.first(); dai != 0; dai=items.next() ) 521 for ( dai=items.first(); dai != 0; dai=items.next() )
512 { 522 {
513 mClient->insertItem( i18n(dai->_label), dai->_id ); 523 mClient->insertItem( i18n(dai->_label), dai->_id );
514 524
515 if (dai->_id == mCurrentClient) 525 if (dai->_id == mCurrentClient)
516 { 526 {
517 //restore the edit fields with the data of the local membervariables if we had set it to "other". 527 //restore the edit fields with the data of the local membervariables if we had set it to "other".
518 //Otherwise take the default data from externalapphandler. 528 //Otherwise take the default data from externalapphandler.
519 mChannel->setText(dai->_channel); 529 mChannel->setText(dai->_channel);
520 mMessage->setText(dai->_message); 530 mMessage->setText(dai->_message);
521 mParameters->setText(dai->_parameters); 531 mParameters->setText(dai->_parameters);
522 mMessage2->setText(dai->_message2); 532 mMessage2->setText(dai->_message2);
523 mParameters2->setText(dai->_parameters2); 533 mParameters2->setText(dai->_parameters2);
524 534
525 535
526 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 536 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
527 { 537 {
528 mChannel->setText(mEmailOtherChannel); 538 mChannel->setText(mEmailOtherChannel);
529 mMessage->setText(mEmailOtherMessage); 539 mMessage->setText(mEmailOtherMessage);