summaryrefslogtreecommitdiffabout
path: root/libkdepim/kcmconfigs
Unidiff
Diffstat (limited to 'libkdepim/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp30
1 files changed, 20 insertions, 10 deletions
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,781 +1,791 @@
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);
530 mParameters->setText(mEmailOtherMessageParameters); 540 mParameters->setText(mEmailOtherMessageParameters);
531 mMessage2->setText(mEmailOtherMessage2); 541 mMessage2->setText(mEmailOtherMessage2);
532 mParameters2->setText(mEmailOtherMessageParameters2); 542 mParameters2->setText(mEmailOtherMessageParameters2);
533 } 543 }
534 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 544 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
535 { 545 {
536 mChannel->setText(mPhoneOtherChannel); 546 mChannel->setText(mPhoneOtherChannel);
537 mMessage->setText(mPhoneOtherMessage); 547 mMessage->setText(mPhoneOtherMessage);
538 mParameters->setText(mPhoneOtherMessageParameters); 548 mParameters->setText(mPhoneOtherMessageParameters);
539 } 549 }
540 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 550 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
541 { 551 {
542 mChannel->setText(mSMSOtherChannel); 552 mChannel->setText(mSMSOtherChannel);
543 mMessage->setText(mSMSOtherMessage); 553 mMessage->setText(mSMSOtherMessage);
544 mParameters->setText(mSMSOtherMessageParameters); 554 mParameters->setText(mSMSOtherMessageParameters);
545 } 555 }
546 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 556 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
547 { 557 {
548 mChannel->setText(mFaxOtherChannel); 558 mChannel->setText(mFaxOtherChannel);
549 mMessage->setText(mFaxOtherMessage); 559 mMessage->setText(mFaxOtherMessage);
550 mParameters->setText(mFaxOtherMessageParameters); 560 mParameters->setText(mFaxOtherMessageParameters);
551 } 561 }
552 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 562 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
553 { 563 {
554 mChannel->setText(mPagerOtherChannel); 564 mChannel->setText(mPagerOtherChannel);
555 mMessage->setText(mPagerOtherMessage); 565 mMessage->setText(mPagerOtherMessage);
556 mParameters->setText(mPagerOtherMessageParameters); 566 mParameters->setText(mPagerOtherMessageParameters);
557 } 567 }
558 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 568 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
559 { 569 {
560 mChannel->setText(mSipOtherChannel); 570 mChannel->setText(mSipOtherChannel);
561 mMessage->setText(mSipOtherMessage); 571 mMessage->setText(mSipOtherMessage);
562 mParameters->setText(mSipOtherMessageParameters); 572 mParameters->setText(mSipOtherMessageParameters);
563 } 573 }
564 } 574 }
565 575
566 } 576 }
567 577
568 bool readonly; 578 bool readonly;
569 bool enabled; 579 bool enabled;
570 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 580 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
571 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 581 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
572 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 582 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
573 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 583 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
574 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 584 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
575 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) 585 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
576 { 586 {
577 readonly = false; 587 readonly = false;
578 } 588 }
579 else 589 else
580 { 590 {
581 readonly = true; 591 readonly = true;
582 } 592 }
583 593
584 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 594 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
585 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 595 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
586 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 596 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
587 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 597 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
588 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 598 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
589 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 599 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
590 { 600 {
591 enabled = false; 601 enabled = false;
592 } 602 }
593 else 603 else
594 { 604 {
595 enabled = true; 605 enabled = true;
596 } 606 }
597 607
598 608
599 mChannel->setReadOnly(readonly); 609 mChannel->setReadOnly(readonly);
600 mMessage->setReadOnly(readonly); 610 mMessage->setReadOnly(readonly);
601 mParameters->setReadOnly(readonly); 611 mParameters->setReadOnly(readonly);
602 mMessage2->setReadOnly(readonly); 612 mMessage2->setReadOnly(readonly);
603 mParameters2->setReadOnly(readonly); 613 mParameters2->setReadOnly(readonly);
604 614
605 mChannel->setEnabled(enabled); 615 mChannel->setEnabled(enabled);
606 mMessage->setEnabled(enabled); 616 mMessage->setEnabled(enabled);
607 mParameters->setEnabled(enabled); 617 mParameters->setEnabled(enabled);
608 mMessage2->setEnabled(enabled); 618 mMessage2->setEnabled(enabled);
609 mParameters2->setEnabled(enabled); 619 mParameters2->setEnabled(enabled);
610 620
611 621
612 622
613 mClient->setCurrentItem(mCurrentClient); 623 mClient->setCurrentItem(mCurrentClient);
614 624
615 625
616 // enable/disable the extra message/parameter field 626 // enable/disable the extra message/parameter field
617 if (mCurrentApp == ExternalAppHandler::EMAIL) 627 if (mCurrentApp == ExternalAppHandler::EMAIL)
618 { 628 {
619 } 629 }
620 else 630 else
621 { 631 {
622 mMessage2->setText( "" ); 632 mMessage2->setText( "" );
623 mParameters2->setText( "" ); 633 mParameters2->setText( "" );
624 } 634 }
625 635
626 if (enabled == true) { 636 if (enabled == true) {
627 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 637 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
628 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 638 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
629 } 639 }
630 640
631 641
632 blockSignals( blocked ); 642 blockSignals( blocked );
633 643
634} 644}
635 645
636void KDEPIMConfigWidget::usrReadConfig() 646void KDEPIMConfigWidget::usrReadConfig()
637{ 647{
638 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 648 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
639 649
640 bool blocked = signalsBlocked(); 650 bool blocked = signalsBlocked();
641 blockSignals( true ); 651 blockSignals( true );
642 652
643 QString dummy = prefs->mUserDateFormatLong; 653 QString dummy = prefs->mUserDateFormatLong;
644 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 654 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
645 dummy = prefs->mUserDateFormatShort; 655 dummy = prefs->mUserDateFormatShort;
646 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 656 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
647 657
648 QDate current ( 2001, 1,1); 658 QDate current ( 2001, 1,1);
649 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 659 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
650 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 660 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
651 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 661 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
652 662
653 663
654 664
655 665
656 mEmailClient = prefs->mEmailClient; 666 mEmailClient = prefs->mEmailClient;
657 mEmailOtherChannel = prefs->mEmailOtherChannel; 667 mEmailOtherChannel = prefs->mEmailOtherChannel;
658 mEmailOtherMessage = prefs->mEmailOtherMessage; 668 mEmailOtherMessage = prefs->mEmailOtherMessage;
659 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 669 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
660 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 670 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
661 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 671 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
662 672
663 mPhoneClient = prefs->mPhoneClient; 673 mPhoneClient = prefs->mPhoneClient;
664 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 674 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
665 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 675 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
666 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 676 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
667 677
668 mFaxClient = prefs->mFaxClient; 678 mFaxClient = prefs->mFaxClient;
669 mFaxOtherChannel = prefs->mFaxOtherChannel; 679 mFaxOtherChannel = prefs->mFaxOtherChannel;
670 mFaxOtherMessage = prefs->mFaxOtherMessage; 680 mFaxOtherMessage = prefs->mFaxOtherMessage;
671 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 681 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
672 682
673 mSMSClient = prefs->mSMSClient; 683 mSMSClient = prefs->mSMSClient;
674 mSMSOtherChannel = prefs->mSMSOtherChannel; 684 mSMSOtherChannel = prefs->mSMSOtherChannel;
675 mSMSOtherMessage = prefs->mSMSOtherMessage; 685 mSMSOtherMessage = prefs->mSMSOtherMessage;
676 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 686 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
677 687
678 mPagerClient = prefs->mPagerClient; 688 mPagerClient = prefs->mPagerClient;
679 mPagerOtherChannel = prefs->mPagerOtherChannel; 689 mPagerOtherChannel = prefs->mPagerOtherChannel;
680 mPagerOtherMessage = prefs->mPagerOtherMessage; 690 mPagerOtherMessage = prefs->mPagerOtherMessage;
681 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 691 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
682 692
683 mSipClient = prefs->mPagerClient; 693 mSipClient = prefs->mPagerClient;
684 mSipOtherChannel = prefs->mSipOtherChannel; 694 mSipOtherChannel = prefs->mSipOtherChannel;
685 mSipOtherMessage = prefs->mSipOtherMessage; 695 mSipOtherMessage = prefs->mSipOtherMessage;
686 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 696 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
687 697
688 mCurrentApp = ExternalAppHandler::EMAIL; 698 mCurrentApp = ExternalAppHandler::EMAIL;
689 mCurrentClient = mEmailClient; 699 mCurrentClient = mEmailClient;
690 700
691 updateClientWidgets(); 701 updateClientWidgets();
692 702
693 blockSignals( blocked ); 703 blockSignals( blocked );
694 704
695} 705}
696 706
697void KDEPIMConfigWidget::usrWriteConfig() 707void KDEPIMConfigWidget::usrWriteConfig()
698{ 708{
699 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 709 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
700 710
701 saveEditFieldSettings(); 711 saveEditFieldSettings();
702 712
703 713
704 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 714 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
705 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 715 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
706 716
707 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 717 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
708 QDate date; 718 QDate date;
709 date = mStartDateSavingEdit->date(); 719 date = mStartDateSavingEdit->date();
710 int sub = 0; 720 int sub = 0;
711 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 721 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
712 sub = 1; 722 sub = 1;
713 prefs->mDaylightsavingStart = date.dayOfYear()-sub; 723 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
714 date = mEndDateSavingEdit->date(); 724 date = mEndDateSavingEdit->date();
715 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 725 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
716 sub = 1; 726 sub = 1;
717 else 727 else
718 sub = 0; 728 sub = 0;
719 prefs->mDaylightsavingEnd = date.dayOfYear()-sub; 729 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
720 730
721 731
722 prefs->mEmailClient = mEmailClient; 732 prefs->mEmailClient = mEmailClient;
723 prefs->mEmailOtherChannel = mEmailOtherChannel; 733 prefs->mEmailOtherChannel = mEmailOtherChannel;
724 prefs->mEmailOtherMessage = mEmailOtherMessage; 734 prefs->mEmailOtherMessage = mEmailOtherMessage;
725 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 735 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
726 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 736 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
727 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 737 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
728 738
729 prefs->mPhoneClient = mPhoneClient; 739 prefs->mPhoneClient = mPhoneClient;
730 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 740 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
731 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 741 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
732 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 742 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
733 743
734 prefs->mFaxClient = mFaxClient; 744 prefs->mFaxClient = mFaxClient;
735 prefs->mFaxOtherChannel = mFaxOtherChannel; 745 prefs->mFaxOtherChannel = mFaxOtherChannel;
736 prefs->mFaxOtherMessage = mFaxOtherMessage; 746 prefs->mFaxOtherMessage = mFaxOtherMessage;
737 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 747 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
738 748
739 prefs->mSMSClient = mSMSClient; 749 prefs->mSMSClient = mSMSClient;
740 prefs->mSMSOtherChannel = mSMSOtherChannel; 750 prefs->mSMSOtherChannel = mSMSOtherChannel;
741 prefs->mSMSOtherMessage = mSMSOtherMessage; 751 prefs->mSMSOtherMessage = mSMSOtherMessage;
742 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 752 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
743 753
744 prefs->mPagerClient = mPagerClient; 754 prefs->mPagerClient = mPagerClient;
745 prefs->mPagerOtherChannel = mPagerOtherChannel; 755 prefs->mPagerOtherChannel = mPagerOtherChannel;
746 prefs->mPagerOtherMessage = mPagerOtherMessage; 756 prefs->mPagerOtherMessage = mPagerOtherMessage;
747 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 757 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
748 758
749 759
750 prefs->mSipClient = mSipClient; 760 prefs->mSipClient = mSipClient;
751 prefs->mSipOtherChannel = mSipOtherChannel; 761 prefs->mSipOtherChannel = mSipOtherChannel;
752 prefs->mSipOtherMessage = mSipOtherMessage; 762 prefs->mSipOtherMessage = mSipOtherMessage;
753 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; 763 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
754 764
755 //release the cache that other views can access the changed values instantanious 765 //release the cache that other views can access the changed values instantanious
756 ExternalAppHandler::instance()->loadConfig(); 766 ExternalAppHandler::instance()->loadConfig();
757 KPimGlobalPrefs::instance()->setGlobalConfig(); 767 KPimGlobalPrefs::instance()->setGlobalConfig();
758} 768}
759 769
760 770
761void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, 771void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
762 const QStringList *tags) 772 const QStringList *tags)
763{ 773{
764 if (tags) { 774 if (tags) {
765 int i = tags->findIndex(text); 775 int i = tags->findIndex(text);
766 if (i > 0) combo->setCurrentItem(i); 776 if (i > 0) combo->setCurrentItem(i);
767 } else { 777 } else {
768 for(int i=0;i<combo->count();++i) { 778 for(int i=0;i<combo->count();++i) {
769 if (combo->text(i) == text) { 779 if (combo->text(i) == text) {
770 combo->setCurrentItem(i); 780 combo->setCurrentItem(i);
771 break; 781 break;
772 } 782 }
773 } 783 }
774 } 784 }
775} 785}
776 786
777 787
778void KDEPIMConfigWidget::textChanged( const QString& text ) 788void KDEPIMConfigWidget::textChanged( const QString& text )
779{ 789{
780 emit changed( true ); 790 emit changed( true );
781} 791}