summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp11
-rw-r--r--libkdepim/kpimglobalprefs.cpp5
-rw-r--r--libkdepim/kpimglobalprefs.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index d62d9f9..759b29d 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,631 +1,642 @@
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 <qvbox.h> 39#include <qvbox.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qregexp.h> 41#include <qregexp.h>
42 42
43#include <kdialog.h> 43#include <kdialog.h>
44#include <kprefsdialog.h> 44#include <kprefsdialog.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kdateedit.h> 46#include <kdateedit.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50/*US 50/*US
51#include <qcheckbox.h> 51#include <qcheckbox.h>
52#include <qframe.h> 52#include <qframe.h>
53#include <qpushbutton.h> 53#include <qpushbutton.h>
54#include <qcombobox.h> 54#include <qcombobox.h>
55#include <qlineedit.h> 55#include <qlineedit.h>
56#include <qlabel.h> 56#include <qlabel.h>
57#include <qfile.h> 57#include <qfile.h>
58 58
59#include <kconfig.h> 59#include <kconfig.h>
60#include <kdebug.h> 60#include <kdebug.h>
61#include <kdialog.h> 61#include <kdialog.h>
62#include <klistview.h> 62#include <klistview.h>
63#include <klocale.h> 63#include <klocale.h>
64#include <kglobal.h> 64#include <kglobal.h>
65#include <kmessagebox.h> 65#include <kmessagebox.h>
66#include <kstandarddirs.h> 66#include <kstandarddirs.h>
67 67
68#ifndef KAB_EMBEDDED 68#ifndef KAB_EMBEDDED
69#include <ktrader.h> 69#include <ktrader.h>
70#else // KAB_EMBEDDED 70#else // KAB_EMBEDDED
71#include <mergewidget.h> 71#include <mergewidget.h>
72#include <distributionlistwidget.h> 72#include <distributionlistwidget.h>
73#endif // KAB_EMBEDDED 73#endif // KAB_EMBEDDED
74 74
75#include "addresseewidget.h" 75#include "addresseewidget.h"
76#include "extensionconfigdialog.h" 76#include "extensionconfigdialog.h"
77#include "extensionwidget.h" 77#include "extensionwidget.h"
78*/ 78*/
79 79
80#include "qapplication.h" 80#include "qapplication.h"
81 81
82#include "kpimglobalprefs.h" 82#include "kpimglobalprefs.h"
83 83
84#include "kdepimconfigwidget.h" 84#include "kdepimconfigwidget.h"
85#include <kprefs.h> 85#include <kprefs.h>
86#include <kmessagebox.h> 86#include <kmessagebox.h>
87 87
88 88
89KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 89KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
90 : KPrefsWidget(prefs, parent, name ) 90 : KPrefsWidget(prefs, parent, name )
91{ 91{
92 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 92 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
93 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 93 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
94 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 94 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
95 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 95 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
96 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 96 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
97 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 97 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
98 98
99 99
100 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 100 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
101 KDialog::spacingHint() ); 101 KDialog::spacingHint() );
102 102
103 tabWidget = new QTabWidget( this ); 103 tabWidget = new QTabWidget( this );
104 topLayout->addWidget( tabWidget ); 104 topLayout->addWidget( tabWidget );
105 105
106 106
107 setupLocaleTab(); 107 setupLocaleTab();
108 setupLocaleDateTab(); 108 setupLocaleDateTab();
109 setupTimeZoneTab(); 109 setupTimeZoneTab();
110 setupExternalAppTab(); 110 setupExternalAppTab();
111 setupStoreTab(); 111 setupStoreTab();
112 112
113} 113}
114void KDEPIMConfigWidget::showTimeZoneTab() 114void KDEPIMConfigWidget::showTimeZoneTab()
115{ 115{
116 tabWidget->setCurrentPage ( 3 ) ; 116 tabWidget->setCurrentPage ( 3 ) ;
117} 117}
118void KDEPIMConfigWidget::setupStoreTab() 118void KDEPIMConfigWidget::setupStoreTab()
119{ 119{
120 QVBox *colorPage = new QVBox( this );
121 tabWidget->addTab( colorPage, i18n( "Colors" ) );
122 QWidget* cw = new QWidget( colorPage );
123 KPrefsWidColor *holidayColor =
124 addWidColor(i18n("Alternate background"),
125 &(KPimGlobalPrefs::instance()->mAlternateColor),cw);
126 QHBoxLayout *topLayout = new QHBoxLayout(cw);
127 topLayout->addWidget(holidayColor->label());
128 topLayout->addWidget( (QWidget* )holidayColor->button());
129
130
120 QVBox *storePage = new QVBox( this ); 131 QVBox *storePage = new QVBox( this );
121 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); 132 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
122 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 133 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
123 mStoreUrl = new KURLRequester( storePage ); 134 mStoreUrl = new KURLRequester( storePage );
124 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 135 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
125#ifdef DESKTOP_VERSION 136#ifdef DESKTOP_VERSION
126 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; 137 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
127 QFileInfo fi ( confFile ); 138 QFileInfo fi ( confFile );
128 if ( fi.exists() ) { 139 if ( fi.exists() ) {
129 KConfig cfg ( confFile ); 140 KConfig cfg ( confFile );
130 cfg.setGroup("Global"); 141 cfg.setGroup("Global");
131 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); 142 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
132 if ( localKdeDir != "x_x_x" ) { 143 if ( localKdeDir != "x_x_x" ) {
133 mStoreUrl->setURL( localKdeDir ); 144 mStoreUrl->setURL( localKdeDir );
134 qDebug("Reading config from %s ", confFile.latin1()); 145 qDebug("Reading config from %s ", confFile.latin1());
135 } 146 }
136 } 147 }
137 148
138#endif 149#endif
139 new QLabel( i18n("New dirs are created automatically"), storePage ); 150 new QLabel( i18n("New dirs are created automatically"), storePage );
140 QHBox *bb = new QHBox( storePage ); 151 QHBox *bb = new QHBox( storePage );
141 QPushButton * pb; 152 QPushButton * pb;
142 if ( QApplication::desktop()->width() < 640 ) 153 if ( QApplication::desktop()->width() < 640 )
143 pb = new QPushButton ( i18n("Save"), bb ); 154 pb = new QPushButton ( i18n("Save"), bb );
144 else 155 else
145 pb = new QPushButton ( i18n("Save settings"), bb ); 156 pb = new QPushButton ( i18n("Save settings"), bb );
146 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 157 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
147 pb = new QPushButton ( i18n("Save standard"), bb ); 158 pb = new QPushButton ( i18n("Save standard"), bb );
148 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 159 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
149#ifdef DESKTOP_VERSION 160#ifdef DESKTOP_VERSION
150 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); 161 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
151 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); 162 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
152#endif 163#endif
153 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); 164 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
154 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); 165 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
155 tabWidget->addTab( storePage, i18n( "Data storage path" ) ); 166 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
156} 167}
157void KDEPIMConfigWidget::setLocalStore() 168void KDEPIMConfigWidget::setLocalStore()
158{ 169{
159 mStoreUrl->setURL( "LOCAL:kdepimpi" ); 170 mStoreUrl->setURL( "LOCAL:kdepimpi" );
160 saveStoreSettings(); 171 saveStoreSettings();
161 QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); 172 QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data.");
162 KMessageBox::information( this, message); 173 KMessageBox::information( this, message);
163} 174}
164void KDEPIMConfigWidget::setStandardStore() 175void KDEPIMConfigWidget::setStandardStore()
165{ 176{
166 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 177 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
167 saveStoreSettings(); 178 saveStoreSettings();
168} 179}
169void KDEPIMConfigWidget::saveStoreSettings() 180void KDEPIMConfigWidget::saveStoreSettings()
170{ 181{
171 if ( !mStoreUrl->url().isEmpty() ) { 182 if ( !mStoreUrl->url().isEmpty() ) {
172 QString path = QDir::homeDirPath(); 183 QString path = QDir::homeDirPath();
173 QString url = mStoreUrl->url(); 184 QString url = mStoreUrl->url();
174#ifdef DESKTOP_VERSION 185#ifdef DESKTOP_VERSION
175 if ( url.startsWith( "LOCAL:" ) ) { 186 if ( url.startsWith( "LOCAL:" ) ) {
176 path = qApp->applicationDirPath () ; 187 path = qApp->applicationDirPath () ;
177 } 188 }
178#endif 189#endif
179 KConfig cfg ( path + "/.microkdehome" ); 190 KConfig cfg ( path + "/.microkdehome" );
180 cfg.setGroup("Global"); 191 cfg.setGroup("Global");
181 cfg.writeEntry( "MICROKDEHOME", url ); 192 cfg.writeEntry( "MICROKDEHOME", url );
182 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); 193 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1());
183 cfg.sync(); 194 cfg.sync();
184 } else { 195 } else {
185 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 196 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
186 saveStoreSettings(); 197 saveStoreSettings();
187 } 198 }
188} 199}
189void KDEPIMConfigWidget::setupExternalAppTab() 200void KDEPIMConfigWidget::setupExternalAppTab()
190{ 201{
191 QWidget *externalAppsPage = new QWidget( this ); 202 QWidget *externalAppsPage = new QWidget( this );
192 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 203 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
193 KDialog::spacingHintSmall() ); 204 KDialog::spacingHintSmall() );
194 205
195 mExternalApps = new QComboBox( externalAppsPage ); 206 mExternalApps = new QComboBox( externalAppsPage );
196 207
197 QMap<ExternalAppHandler::Types, QString>::Iterator it; 208 QMap<ExternalAppHandler::Types, QString>::Iterator it;
198 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 209 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
199 mExternalApps->insertItem( it.data(), it.key() ); 210 mExternalApps->insertItem( it.data(), it.key() );
200 211
201 layout->addWidget( mExternalApps ); 212 layout->addWidget( mExternalApps );
202 213
203 connect( mExternalApps, SIGNAL( activated( int ) ), 214 connect( mExternalApps, SIGNAL( activated( int ) ),
204 this, SLOT (externalapp_changed( int ) ) ); 215 this, SLOT (externalapp_changed( int ) ) );
205 216
206 217
207 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 218 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
208 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 219 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
209 mExternalAppGroupBox->layout()->setMargin(4); 220 mExternalAppGroupBox->layout()->setMargin(4);
210 221
211 mClient = new QComboBox( mExternalAppGroupBox ); 222 mClient = new QComboBox( mExternalAppGroupBox );
212 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 223 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
213 224
214 connect( mClient, SIGNAL( activated( int ) ), 225 connect( mClient, SIGNAL( activated( int ) ),
215 this, SLOT (client_changed( int ) ) ); 226 this, SLOT (client_changed( int ) ) );
216 227
217 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 228 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
218 boxLayout->addWidget( lab, 1, 0 ); 229 boxLayout->addWidget( lab, 1, 0 );
219 mChannel = new QLineEdit(mExternalAppGroupBox); 230 mChannel = new QLineEdit(mExternalAppGroupBox);
220 mChannel->setReadOnly(true); 231 mChannel->setReadOnly(true);
221 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 232 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
222 233
223 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 234 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
224 boxLayout->addWidget( lab, 3, 0 ); 235 boxLayout->addWidget( lab, 3, 0 );
225 mMessage = new QLineEdit(mExternalAppGroupBox); 236 mMessage = new QLineEdit(mExternalAppGroupBox);
226 mMessage->setReadOnly(true); 237 mMessage->setReadOnly(true);
227 boxLayout->addWidget( mMessage , 4, 0); 238 boxLayout->addWidget( mMessage , 4, 0);
228 239
229 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 240 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
230 boxLayout->addWidget( lab, 3, 1 ); 241 boxLayout->addWidget( lab, 3, 1 );
231 mParameters = new QLineEdit(mExternalAppGroupBox); 242 mParameters = new QLineEdit(mExternalAppGroupBox);
232 mParameters->setReadOnly(true); 243 mParameters->setReadOnly(true);
233 boxLayout->addWidget( mParameters, 4, 1 ); 244 boxLayout->addWidget( mParameters, 4, 1 );
234 245
235 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 246 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
236 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 247 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
237 248
238 249
239 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 250 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
240 boxLayout->addWidget( lab, 6, 0 ); 251 boxLayout->addWidget( lab, 6, 0 );
241 mMessage2 = new QLineEdit(mExternalAppGroupBox); 252 mMessage2 = new QLineEdit(mExternalAppGroupBox);
242 mMessage2->setReadOnly(true); 253 mMessage2->setReadOnly(true);
243 boxLayout->addWidget( mMessage2 , 7, 0); 254 boxLayout->addWidget( mMessage2 , 7, 0);
244 255
245 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 256 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
246 boxLayout->addWidget( lab, 6, 1 ); 257 boxLayout->addWidget( lab, 6, 1 );
247 mParameters2 = new QLineEdit(mExternalAppGroupBox); 258 mParameters2 = new QLineEdit(mExternalAppGroupBox);
248 mParameters2->setReadOnly(true); 259 mParameters2->setReadOnly(true);
249 boxLayout->addWidget( mParameters2, 7, 1 ); 260 boxLayout->addWidget( mParameters2, 7, 1 );
250 261
251 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 262 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
252 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 263 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
253 264
254 265
255 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 266 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
256 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 267 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
257 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 268 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
258 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 269 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
259 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 270 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
260 271
261 272
262 layout->addWidget( mExternalAppGroupBox ); 273 layout->addWidget( mExternalAppGroupBox );
263 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 274 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
264 275
265} 276}
266 277
267 278
268void KDEPIMConfigWidget::setupLocaleDateTab() 279void KDEPIMConfigWidget::setupLocaleDateTab()
269{ 280{
270 QWidget *topFrame = new QWidget( this ); 281 QWidget *topFrame = new QWidget( this );
271 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); 282 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
272 283
273 topLayout->setSpacing(KDialog::spacingHintSmall()); 284 topLayout->setSpacing(KDialog::spacingHintSmall());
274 topLayout->setMargin(KDialog::marginHintSmall()); 285 topLayout->setMargin(KDialog::marginHintSmall());
275 int iii = 0; 286 int iii = 0;
276 287
277 288
278 KPrefsWidRadios *syncPrefsGroup = 289 KPrefsWidRadios *syncPrefsGroup =
279 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); 290 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
280 QString format; 291 QString format;
281 if ( QApplication::desktop()->width() < 480 ) 292 if ( QApplication::desktop()->width() < 480 )
282 format = "(%d.%m.%Y)"; 293 format = "(%d.%m.%Y)";
283 else 294 else
284 format = "(%d.%m.%Y|%A %d %B %Y)"; 295 format = "(%d.%m.%Y|%A %d %B %Y)";
285 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 296 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
286 if ( QApplication::desktop()->width() < 480 ) 297 if ( QApplication::desktop()->width() < 480 )
287 format = "(%m.%d.%Y)"; 298 format = "(%m.%d.%Y)";
288 else 299 else
289 format = "(%m.%d.%Y|%A %B %d %Y)"; 300 format = "(%m.%d.%Y|%A %B %d %Y)";
290 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 301 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
291 if ( QApplication::desktop()->width() < 480 ) 302 if ( QApplication::desktop()->width() < 480 )
292 format = "(%Y-%m-%d)"; 303 format = "(%Y-%m-%d)";
293 else 304 else
294 format = "(%Y-%m-%d|%A %Y %B %d)"; 305 format = "(%Y-%m-%d|%A %Y %B %d)";
295 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 306 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
296 syncPrefsGroup->addRadio(i18n("User defined")); 307 syncPrefsGroup->addRadio(i18n("User defined"));
297 if ( QApplication::desktop()->width() < 480 ) { 308 if ( QApplication::desktop()->width() < 480 ) {
298 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 309 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
299 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 310 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
300 } 311 }
301 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 312 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
302 ++iii; 313 ++iii;
303 ++iii; 314 ++iii;
304 QLabel * lab; 315 QLabel * lab;
305 mUserDateFormatLong = new QLineEdit(topFrame); 316 mUserDateFormatLong = new QLineEdit(topFrame);
306 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 317 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
307 topLayout->addWidget(lab ,iii,0); 318 topLayout->addWidget(lab ,iii,0);
308 topLayout->addWidget(mUserDateFormatLong,iii,1); 319 topLayout->addWidget(mUserDateFormatLong,iii,1);
309 ++iii; 320 ++iii;
310 mUserDateFormatShort = new QLineEdit(topFrame); 321 mUserDateFormatShort = new QLineEdit(topFrame);
311 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 322 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
312 topLayout->addWidget(lab ,iii,0); 323 topLayout->addWidget(lab ,iii,0);
313 topLayout->addWidget(mUserDateFormatShort,iii,1); 324 topLayout->addWidget(mUserDateFormatShort,iii,1);
314 ++iii; 325 ++iii;
315 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 326 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
316 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 327 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
317 ++iii; 328 ++iii;
318 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 329 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
319 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 330 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
320 ++iii; 331 ++iii;
321 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 332 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
322 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 333 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
323 ++iii; 334 ++iii;
324 335
325 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 336 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
326 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 337 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
327 338
328 339
329 tabWidget->addTab( topFrame, i18n( "Date Format" ) ); 340 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
330} 341}
331 342
332void KDEPIMConfigWidget::setupLocaleTab() 343void KDEPIMConfigWidget::setupLocaleTab()
333{ 344{
334 345
335 QWidget *topFrame = new QWidget( this ); 346 QWidget *topFrame = new QWidget( this );
336 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 347 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
337 348
338 topLayout->setSpacing(KDialog::spacingHint()); 349 topLayout->setSpacing(KDialog::spacingHint());
339 topLayout->setMargin(KDialog::marginHint()); 350 topLayout->setMargin(KDialog::marginHint());
340 int iii = 0; 351 int iii = 0;
341 KPrefsWidRadios *syncPrefsGroup = 352 KPrefsWidRadios *syncPrefsGroup =
342 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); 353 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
343 syncPrefsGroup->addRadio(i18n("English")); 354 syncPrefsGroup->addRadio(i18n("English"));
344 syncPrefsGroup->addRadio(i18n("German")); 355 syncPrefsGroup->addRadio(i18n("German"));
345 syncPrefsGroup->addRadio(i18n("French")); 356 syncPrefsGroup->addRadio(i18n("French"));
346 syncPrefsGroup->addRadio(i18n("Italian")); 357 syncPrefsGroup->addRadio(i18n("Italian"));
347 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 358 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
348 if ( QApplication::desktop()->width() < 300 ) { 359 if ( QApplication::desktop()->width() < 300 ) {
349 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 360 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
350 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 361 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
351 } 362 }
352 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 363 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
353 ++iii; 364 ++iii;
354 365
355 366
356 tabWidget->addTab( topFrame, i18n( "Language" ) ); 367 tabWidget->addTab( topFrame, i18n( "Language" ) );
357 topFrame = new QWidget( this ); 368 topFrame = new QWidget( this );
358 topLayout = new QGridLayout(topFrame,4,2); 369 topLayout = new QGridLayout(topFrame,4,2);
359 370
360 topLayout->setSpacing(KDialog::spacingHint()); 371 topLayout->setSpacing(KDialog::spacingHint());
361 topLayout->setMargin(KDialog::marginHint()); 372 topLayout->setMargin(KDialog::marginHint());
362 iii = 0; 373 iii = 0;
363 syncPrefsGroup = 374 syncPrefsGroup =
364 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); 375 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
365 if ( QApplication::desktop()->width() > 300 ) 376 if ( QApplication::desktop()->width() > 300 )
366 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 377 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
367 syncPrefsGroup->addRadio(i18n("24:00")); 378 syncPrefsGroup->addRadio(i18n("24:00"));
368 syncPrefsGroup->addRadio(i18n("12:00am")); 379 syncPrefsGroup->addRadio(i18n("12:00am"));
369 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 380 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
370 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 381 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
371 ++iii; 382 ++iii;
372 383
373 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), 384 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
374 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); 385 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
375 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 386 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
376 ++iii; 387 ++iii;
377 388
378 389
379 tabWidget->addTab( topFrame, i18n( "Time Format" ) ); 390 tabWidget->addTab( topFrame, i18n( "Time Format" ) );
380 391
381} 392}
382 393
383 394
384void KDEPIMConfigWidget::setupTimeZoneTab() 395void KDEPIMConfigWidget::setupTimeZoneTab()
385{ 396{
386 QWidget *topFrame; 397 QWidget *topFrame;
387 QGridLayout *topLayout ; 398 QGridLayout *topLayout ;
388 399
389 400
390 401
391 402
392 403
393 404
394 topFrame = new QWidget( this ); 405 topFrame = new QWidget( this );
395 topLayout = new QGridLayout( topFrame, 5, 2); 406 topLayout = new QGridLayout( topFrame, 5, 2);
396 topLayout->setSpacing(KDialog::spacingHintSmall()); 407 topLayout->setSpacing(KDialog::spacingHintSmall());
397 topLayout->setMargin(KDialog::marginHintSmall()); 408 topLayout->setMargin(KDialog::marginHintSmall());
398 409
399 QHBox *timeZoneBox = new QHBox( topFrame ); 410 QHBox *timeZoneBox = new QHBox( topFrame );
400 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 411 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
401 412
402 new QLabel( i18n("Timezone:"), timeZoneBox ); 413 new QLabel( i18n("Timezone:"), timeZoneBox );
403 mTimeZoneCombo = new QComboBox( timeZoneBox ); 414 mTimeZoneCombo = new QComboBox( timeZoneBox );
404 if ( QApplication::desktop()->width() < 300 ) { 415 if ( QApplication::desktop()->width() < 300 ) {
405 mTimeZoneCombo->setMaximumWidth(150); 416 mTimeZoneCombo->setMaximumWidth(150);
406 } 417 }
407 418
408 QStringList list; 419 QStringList list;
409 list = KGlobal::locale()->timeZoneList(); 420 list = KGlobal::locale()->timeZoneList();
410 mTimeZoneCombo->insertStringList(list); 421 mTimeZoneCombo->insertStringList(list);
411 422
412 // find the currently set time zone and select it 423 // find the currently set time zone and select it
413 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; 424 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
414 int nCurrentlySet = 11; 425 int nCurrentlySet = 11;
415 for (int i = 0; i < mTimeZoneCombo->count(); i++) 426 for (int i = 0; i < mTimeZoneCombo->count(); i++)
416 { 427 {
417 if (mTimeZoneCombo->text(i) == sCurrentlySet) 428 if (mTimeZoneCombo->text(i) == sCurrentlySet)
418 { 429 {
419 nCurrentlySet = i; 430 nCurrentlySet = i;
420 break; 431 break;
421 } 432 }
422 } 433 }
423 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 434 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
424 int iii = 1; 435 int iii = 1;
425 KPrefsWidBool *sb = 436 KPrefsWidBool *sb =
426 addWidBool(i18n("Add 30 min to selected Timezone"), 437 addWidBool(i18n("Add 30 min to selected Timezone"),
427 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); 438 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame);
428 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 439 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
429 ++iii; 440 ++iii;
430 sb = 441 sb =
431 addWidBool(i18n("Timezone has daylight saving"), 442 addWidBool(i18n("Timezone has daylight saving"),
432 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); 443 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
433 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 444 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
434 ++iii; 445 ++iii;
435 QLabel* lab; 446 QLabel* lab;
436 447
437 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 448 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
438 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 449 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
439 ++iii; 450 ++iii;
440 451
441 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 452 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
442 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 453 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
443 ++iii; 454 ++iii;
444 lab = new QLabel( i18n("Daylight start:"), topFrame ); 455 lab = new QLabel( i18n("Daylight start:"), topFrame );
445 topLayout->addWidget(lab, iii,0); 456 topLayout->addWidget(lab, iii,0);
446 mStartDateSavingEdit = new KDateEdit(topFrame); 457 mStartDateSavingEdit = new KDateEdit(topFrame);
447 topLayout->addWidget(mStartDateSavingEdit, iii,1); 458 topLayout->addWidget(mStartDateSavingEdit, iii,1);
448 ++iii; 459 ++iii;
449 460
450 lab = new QLabel( i18n("Daylight end:"), topFrame ); 461 lab = new QLabel( i18n("Daylight end:"), topFrame );
451 topLayout->addWidget(lab, iii,0); 462 topLayout->addWidget(lab, iii,0);
452 mEndDateSavingEdit = new KDateEdit(topFrame); 463 mEndDateSavingEdit = new KDateEdit(topFrame);
453 topLayout->addWidget(mEndDateSavingEdit, iii,1); 464 topLayout->addWidget(mEndDateSavingEdit, iii,1);
454 ++iii; 465 ++iii;
455 QDate current ( 2001, 1,1); 466 QDate current ( 2001, 1,1);
456 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); 467 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
457 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); 468 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
458 469
459 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 470 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
460 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 471 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
461 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); 472 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
462 tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); 473 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
463 474
464 475
465 topFrame = new QWidget( this ); 476 topFrame = new QWidget( this );
466 topLayout = new QGridLayout( topFrame, 3, 2); 477 topLayout = new QGridLayout( topFrame, 3, 2);
467 topLayout->setSpacing(KDialog::spacingHintSmall()); 478 topLayout->setSpacing(KDialog::spacingHintSmall());
468 topLayout->setMargin(KDialog::marginHintSmall()); 479 topLayout->setMargin(KDialog::marginHintSmall());
469 tabWidget->addTab( topFrame, i18n( "Fonts" ) ); 480 tabWidget->addTab( topFrame, i18n( "Fonts" ) );
470 481
471 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); 482 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame );
472 topLayout->addMultiCellWidget(labb,0,0,0,2); 483 topLayout->addMultiCellWidget(labb,0,0,0,2);
473 int i = 1; 484 int i = 1;
474 KPrefsWidFont *timeLabelsFont = 485 KPrefsWidFont *timeLabelsFont =
475 addWidFont(i18n("Kx/Pi"),i18n("Application Font"), 486 addWidFont(i18n("Kx/Pi"),i18n("Application Font"),
476 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); 487 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame);
477 topLayout->addWidget(timeLabelsFont->label(),i,0); 488 topLayout->addWidget(timeLabelsFont->label(),i,0);
478 topLayout->addWidget(timeLabelsFont->preview(),i,1); 489 topLayout->addWidget(timeLabelsFont->preview(),i,1);
479 topLayout->addWidget(timeLabelsFont->button(),i,2); 490 topLayout->addWidget(timeLabelsFont->button(),i,2);
480} 491}
481 492
482void KDEPIMConfigWidget::externalapp_changed( int newApp ) 493void KDEPIMConfigWidget::externalapp_changed( int newApp )
483{ 494{
484 // first store the current data 495 // first store the current data
485 saveEditFieldSettings(); 496 saveEditFieldSettings();
486 497
487 // set mCurrentApp 498 // set mCurrentApp
488 mCurrentApp = (ExternalAppHandler::Types)newApp; 499 mCurrentApp = (ExternalAppHandler::Types)newApp;
489 500
490 // set mCurrentClient 501 // set mCurrentClient
491 switch(mCurrentApp) 502 switch(mCurrentApp)
492 { 503 {
493 case(ExternalAppHandler::EMAIL): 504 case(ExternalAppHandler::EMAIL):
494 mCurrentClient = mEmailClient; 505 mCurrentClient = mEmailClient;
495 break; 506 break;
496 case(ExternalAppHandler::PHONE): 507 case(ExternalAppHandler::PHONE):
497 mCurrentClient = mPhoneClient; 508 mCurrentClient = mPhoneClient;
498 break; 509 break;
499 case(ExternalAppHandler::SMS): 510 case(ExternalAppHandler::SMS):
500 mCurrentClient = mSMSClient; 511 mCurrentClient = mSMSClient;
501 break; 512 break;
502 case(ExternalAppHandler::FAX): 513 case(ExternalAppHandler::FAX):
503 mCurrentClient = mFaxClient; 514 mCurrentClient = mFaxClient;
504 break; 515 break;
505 case(ExternalAppHandler::PAGER): 516 case(ExternalAppHandler::PAGER):
506 mCurrentClient = mPagerClient; 517 mCurrentClient = mPagerClient;
507 break; 518 break;
508 case(ExternalAppHandler::SIP): 519 case(ExternalAppHandler::SIP):
509 mCurrentClient = mSipClient; 520 mCurrentClient = mSipClient;
510 break; 521 break;
511 default: 522 default:
512 return; 523 return;
513 } 524 }
514 525
515 // and at last update the widgets 526 // and at last update the widgets
516 updateClientWidgets(); 527 updateClientWidgets();
517} 528}
518 529
519 530
520 531
521void KDEPIMConfigWidget::client_changed( int newClient ) 532void KDEPIMConfigWidget::client_changed( int newClient )
522{ 533{
523 if (newClient == mCurrentClient) 534 if (newClient == mCurrentClient)
524 return; 535 return;
525 536
526 // first store the current data 537 // first store the current data
527 saveEditFieldSettings(); 538 saveEditFieldSettings();
528 539
529 540
530 //then reset the clientvariable 541 //then reset the clientvariable
531 mCurrentClient = newClient; 542 mCurrentClient = newClient;
532 543
533 // and at last update the widgets 544 // and at last update the widgets
534 updateClientWidgets(); 545 updateClientWidgets();
535 546
536 KPrefsWidget::modified(); 547 KPrefsWidget::modified();
537} 548}
538 549
539void KDEPIMConfigWidget::saveEditFieldSettings() 550void KDEPIMConfigWidget::saveEditFieldSettings()
540{ 551{
541 552
542 switch(mCurrentApp) 553 switch(mCurrentApp)
543 { 554 {
544 case(ExternalAppHandler::EMAIL): 555 case(ExternalAppHandler::EMAIL):
545 mEmailClient = mClient->currentItem(); 556 mEmailClient = mClient->currentItem();
546 break; 557 break;
547 case(ExternalAppHandler::PHONE): 558 case(ExternalAppHandler::PHONE):
548 mPhoneClient= mClient->currentItem(); 559 mPhoneClient= mClient->currentItem();
549 break; 560 break;
550 case(ExternalAppHandler::SMS): 561 case(ExternalAppHandler::SMS):
551 mSMSClient = mClient->currentItem(); 562 mSMSClient = mClient->currentItem();
552 break; 563 break;
553 case(ExternalAppHandler::FAX): 564 case(ExternalAppHandler::FAX):
554 mFaxClient = mClient->currentItem(); 565 mFaxClient = mClient->currentItem();
555 break; 566 break;
556 case(ExternalAppHandler::PAGER): 567 case(ExternalAppHandler::PAGER):
557 mPagerClient = mClient->currentItem(); 568 mPagerClient = mClient->currentItem();
558 break; 569 break;
559 case(ExternalAppHandler::SIP): 570 case(ExternalAppHandler::SIP):
560 mSipClient = mClient->currentItem(); 571 mSipClient = mClient->currentItem();
561 break; 572 break;
562 default: 573 default:
563 return; 574 return;
564 } 575 }
565 576
566 //store the current data back to the apropriate membervariables if we had set it to "other" 577 //store the current data back to the apropriate membervariables if we had set it to "other"
567 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 578 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
568 { 579 {
569 mEmailOtherChannel = mChannel->text(); 580 mEmailOtherChannel = mChannel->text();
570 mEmailOtherMessage = mMessage->text(); 581 mEmailOtherMessage = mMessage->text();
571 mEmailOtherMessageParameters = mParameters->text(); 582 mEmailOtherMessageParameters = mParameters->text();
572 mEmailOtherMessage2 = mMessage2->text(); 583 mEmailOtherMessage2 = mMessage2->text();
573 mEmailOtherMessageParameters2 = mParameters2->text(); 584 mEmailOtherMessageParameters2 = mParameters2->text();
574 } 585 }
575 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 586 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
576 { 587 {
577 mPhoneOtherChannel = mChannel->text(); 588 mPhoneOtherChannel = mChannel->text();
578 mPhoneOtherMessage = mMessage->text(); 589 mPhoneOtherMessage = mMessage->text();
579 mPhoneOtherMessageParameters = mParameters->text(); 590 mPhoneOtherMessageParameters = mParameters->text();
580 } 591 }
581 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 592 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
582 { 593 {
583 mSMSOtherChannel = mChannel->text(); 594 mSMSOtherChannel = mChannel->text();
584 mSMSOtherMessage = mMessage->text(); 595 mSMSOtherMessage = mMessage->text();
585 mSMSOtherMessageParameters = mParameters->text(); 596 mSMSOtherMessageParameters = mParameters->text();
586 } 597 }
587 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 598 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
588 { 599 {
589 mFaxOtherChannel = mChannel->text(); 600 mFaxOtherChannel = mChannel->text();
590 mFaxOtherMessage = mMessage->text(); 601 mFaxOtherMessage = mMessage->text();
591 mFaxOtherMessageParameters = mParameters->text(); 602 mFaxOtherMessageParameters = mParameters->text();
592 } 603 }
593 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 604 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
594 { 605 {
595 mPagerOtherChannel = mChannel->text(); 606 mPagerOtherChannel = mChannel->text();
596 mPagerOtherMessage = mMessage->text(); 607 mPagerOtherMessage = mMessage->text();
597 mPagerOtherMessageParameters = mParameters->text(); 608 mPagerOtherMessageParameters = mParameters->text();
598 } 609 }
599 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 610 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
600 { 611 {
601 mSipOtherChannel = mChannel->text(); 612 mSipOtherChannel = mChannel->text();
602 mSipOtherMessage = mMessage->text(); 613 mSipOtherMessage = mMessage->text();
603 mSipOtherMessageParameters = mParameters->text(); 614 mSipOtherMessageParameters = mParameters->text();
604 } 615 }
605 616
606 617
607} 618}
608 619
609void KDEPIMConfigWidget::updateClientWidgets() 620void KDEPIMConfigWidget::updateClientWidgets()
610{ 621{
611 bool blocked = signalsBlocked(); 622 bool blocked = signalsBlocked();
612 blockSignals( true ); 623 blockSignals( true );
613 624
614 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 625 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
615 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); 626 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
616 if (it == mExternalAppsMap.end()) 627 if (it == mExternalAppsMap.end())
617 return; 628 return;
618 629
619 // update group box 630 // update group box
620 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 631 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
621 632
622 //update the entries in the client combobox 633 //update the entries in the client combobox
623 mClient->clear(); 634 mClient->clear();
624 635
625 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 636 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
626 DefaultAppItem* dai; 637 DefaultAppItem* dai;
627 for ( dai=items.first(); dai != 0; dai=items.next() ) 638 for ( dai=items.first(); dai != 0; dai=items.next() )
628 { 639 {
629 mClient->insertItem( i18n(dai->_label), dai->_id ); 640 mClient->insertItem( i18n(dai->_label), dai->_id );
630 641
631 if (dai->_id == mCurrentClient) 642 if (dai->_id == mCurrentClient)
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index a09b278..873f0eb 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,211 +1,216 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@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/* 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 <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kglobalsettings.h> 35#include <kglobalsettings.h>
36#include <kstaticdeleter.h> 36#include <kstaticdeleter.h>
37 37
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <stdlib.h> 40#include <stdlib.h>
41#include <qtextstream.h> 41#include <qtextstream.h>
42#include <qapplication.h> 42#include <qapplication.h>
43#include "kpimglobalprefs.h" 43#include "kpimglobalprefs.h"
44 44
45KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 45KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
46static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; 46static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP;
47 47
48 48
49KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 49KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
50 : KPrefs("microkdeglobalrc") 50 : KPrefs("microkdeglobalrc")
51{ 51{
52 mLocaleDict = 0; 52 mLocaleDict = 0;
53 KPrefs::setCurrentGroup("Fonts"); 53 KPrefs::setCurrentGroup("Fonts");
54 addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); 54 addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() );
55 KPrefs::setCurrentGroup("Locale"); 55 KPrefs::setCurrentGroup("Locale");
56 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 56 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
57 addItemInt("PreferredTime",&mPreferredTime,0); 57 addItemInt("PreferredTime",&mPreferredTime,0);
58 addItemInt("PreferredDate",&mPreferredDate,0); 58 addItemInt("PreferredDate",&mPreferredDate,0);
59 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 59 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
60 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); 60 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y");
61 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 61 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
62 62
63 KPrefs::setCurrentGroup("Colors");
64 addItemColor("AlternateBGcolor",&mAlternateColor,KGlobalSettings::alternateBackgroundColor());
65
66
63 KPrefs::setCurrentGroup("Time & Date"); 67 KPrefs::setCurrentGroup("Time & Date");
64 68
65 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); 69 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") );
66 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 70 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
67 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); 71 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false);
68 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 72 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
69 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 73 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
70 74
71 KPrefs::setCurrentGroup( "ExternalApplications" ); 75 KPrefs::setCurrentGroup( "ExternalApplications" );
72 76
73 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 77 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
74 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 78 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
75 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 79 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
76 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 80 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
77 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 81 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
78 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 82 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
79 83
80 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 84 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
81 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 85 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
82 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 86 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
83 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 87 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
84 88
85 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 89 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
86 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 90 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
87 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 91 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
88 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 92 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
89 93
90 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 94 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
91 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 95 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
92 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 96 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
93 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 97 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
94 98
95 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 99 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
96 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 100 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
97 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 101 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
98 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 102 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
99 103
100 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); 104 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
101 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 105 addItemString( "SIPChannel", &mSipOtherChannel, "" );
102 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 106 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
103 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 107 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
104 108
105 KPrefs::setCurrentGroup( "PhoneAccess" ); 109 KPrefs::setCurrentGroup( "PhoneAccess" );
106 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); 110 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
107 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); 111 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
108 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); 112 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
109 113
110} 114}
111 115
112void KPimGlobalPrefs::setGlobalConfig() 116void KPimGlobalPrefs::setGlobalConfig()
113{ 117{
114 if ( mLocaleDict == 0 ) { 118 if ( mLocaleDict == 0 ) {
115 QString fileName ; 119 QString fileName ;
116 QString name = KGlobal::getAppName() +"/"; 120 QString name = KGlobal::getAppName() +"/";
117#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
118 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; 122 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name;
119#else 123#else
120 fileName = qApp->applicationDirPath () + "/kdepim/"+ name; 124 fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
121#endif 125#endif
122 mLocaleDict = 0; 126 mLocaleDict = 0;
123 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { 127 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
124 128
125 if ( mPreferredLanguage == 1 ) 129 if ( mPreferredLanguage == 1 )
126 fileName = fileName+"germantranslation.txt"; 130 fileName = fileName+"germantranslation.txt";
127 else if ( mPreferredLanguage == 4 ) 131 else if ( mPreferredLanguage == 4 )
128 fileName = fileName+"usertranslation.txt"; 132 fileName = fileName+"usertranslation.txt";
129 else if ( mPreferredLanguage == 2 ) 133 else if ( mPreferredLanguage == 2 )
130 fileName = fileName+"frenchtranslation.txt"; 134 fileName = fileName+"frenchtranslation.txt";
131 else if ( mPreferredLanguage == 3 ) 135 else if ( mPreferredLanguage == 3 )
132 fileName = fileName+"italiantranslation.txt"; 136 fileName = fileName+"italiantranslation.txt";
133 QFile file( fileName ); 137 QFile file( fileName );
134 if (file.open( IO_ReadOnly ) ) { 138 if (file.open( IO_ReadOnly ) ) {
135 QTextStream ts( &file ); 139 QTextStream ts( &file );
136 ts.setEncoding( QTextStream::Latin1 ); 140 ts.setEncoding( QTextStream::Latin1 );
137 //ts.setCodec( QTextCodec::latin1 ); 141 //ts.setCodec( QTextCodec::latin1 );
138 QString text = ts.read(); 142 QString text = ts.read();
139 file.close(); 143 file.close();
140 text.replace( QRegExp("\\\\n"), "\n" ); 144 text.replace( QRegExp("\\\\n"), "\n" );
141 QString line; 145 QString line;
142 QString we; 146 QString we;
143 QString wt; 147 QString wt;
144 int br = 0; 148 int br = 0;
145 int nbr; 149 int nbr;
146 nbr = text.find ( "},", br ); 150 nbr = text.find ( "},", br );
147 line = text.mid( br, nbr - br ); 151 line = text.mid( br, nbr - br );
148 br = nbr+1; 152 br = nbr+1;
149 int se, ee, st, et; 153 int se, ee, st, et;
150 mLocaleDict = new QDict<QString>; 154 mLocaleDict = new QDict<QString>;
151 mLocaleDict->setAutoDelete( true ); 155 mLocaleDict->setAutoDelete( true );
152 QString end = "{ \"\",\"\" }"; 156 QString end = "{ \"\",\"\" }";
153 while ( (line != end) && (br > 1) ) { 157 while ( (line != end) && (br > 1) ) {
154 //qDebug("%d *%s* ", br, line.latin1()); 158 //qDebug("%d *%s* ", br, line.latin1());
155 se = line.find("\"")+1; 159 se = line.find("\"")+1;
156 et = line.findRev("\"",-1); 160 et = line.findRev("\"",-1);
157 ee = line.find("\",\""); 161 ee = line.find("\",\"");
158 st = ee+3; 162 st = ee+3;
159 we = line.mid( se, ee-se ); 163 we = line.mid( se, ee-se );
160 if ( mPreferredLanguage == 4 ) 164 if ( mPreferredLanguage == 4 )
161 wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); 165 wt = QString::fromUtf8(line.mid( st, et-st ).latin1());
162 else 166 else
163 wt = line.mid( st, et-st ); 167 wt = line.mid( st, et-st );
164 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 168 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
165 mLocaleDict->insert( we, new QString (wt) ); 169 mLocaleDict->insert( we, new QString (wt) );
166 nbr = text.find ( "}", br ); 170 nbr = text.find ( "}", br );
167 line = text.mid( br, nbr - br ); 171 line = text.mid( br, nbr - br );
168 br = nbr+1; 172 br = nbr+1;
169 } 173 }
170 //qDebug("end *%s* ", end.latin1()); 174 //qDebug("end *%s* ", end.latin1());
171 175
172 setLocaleDict( mLocaleDict ); 176 setLocaleDict( mLocaleDict );
173 } else { 177 } else {
174 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 178 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
175 } 179 }
176 } 180 }
177 } 181 }
178 182
179 KGlobal::locale()->setHore24Format( !mPreferredTime ); 183 KGlobal::locale()->setHore24Format( !mPreferredTime );
180 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 184 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
181 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 185 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
182 KGlobal::locale()->setLanguage( mPreferredLanguage ); 186 KGlobal::locale()->setLanguage( mPreferredLanguage );
183 QString dummy = mUserDateFormatLong; 187 QString dummy = mUserDateFormatLong;
184 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 188 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
185 dummy = mUserDateFormatShort; 189 dummy = mUserDateFormatShort;
186 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 190 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
187 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 191 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
188 mDaylightsavingStart, 192 mDaylightsavingStart,
189 mDaylightsavingEnd ); 193 mDaylightsavingEnd );
190 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 194 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
195 KGlobalSettings::setAlternateBackgroundColor(mAlternateColor);
191 196
192} 197}
193KPimGlobalPrefs::~KPimGlobalPrefs() 198KPimGlobalPrefs::~KPimGlobalPrefs()
194{ 199{
195 if (sInstance == this) 200 if (sInstance == this)
196 sInstance = staticDeleterGP.setObject(0); 201 sInstance = staticDeleterGP.setObject(0);
197 else 202 else
198 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); 203 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
199 if ( mLocaleDict ) 204 if ( mLocaleDict )
200 delete mLocaleDict; 205 delete mLocaleDict;
201} 206}
202 207
203KPimGlobalPrefs *KPimGlobalPrefs::instance() 208KPimGlobalPrefs *KPimGlobalPrefs::instance()
204{ 209{
205 if ( !sInstance ) { 210 if ( !sInstance ) {
206 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); 211 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
207 sInstance->readConfig(); 212 sInstance->readConfig();
208 } 213 }
209 214
210 return sInstance; 215 return sInstance;
211} 216}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index bf17338..36cc25a 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -1,144 +1,145 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
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#ifndef KPIMGLOBALPREFS_H 31#ifndef KPIMGLOBALPREFS_H
32#define KPIMGLOBALPREFS_H 32#define KPIMGLOBALPREFS_H
33 33
34#include "kprefs.h" 34#include "kprefs.h"
35#include <qdict.h> 35#include <qdict.h>
36 36
37class KPimGlobalPrefs : public KPrefs 37class KPimGlobalPrefs : public KPrefs
38{ 38{
39 public: 39 public:
40 40
41 void setGlobalConfig(); 41 void setGlobalConfig();
42 static KPimGlobalPrefs *instance(); 42 static KPimGlobalPrefs *instance();
43 43
44 44
45 virtual ~KPimGlobalPrefs(); 45 virtual ~KPimGlobalPrefs();
46 46
47 47
48 enum EMailClients { 48 enum EMailClients {
49 NONE_EMC = 0, 49 NONE_EMC = 0,
50 OTHER_EMC = 1, 50 OTHER_EMC = 1,
51 OMPI_EMC = 2, 51 OMPI_EMC = 2,
52 QTOPIA_EMC = 3, 52 QTOPIA_EMC = 3,
53 OPIE_EMC = 4, 53 OPIE_EMC = 4,
54 OPIE_MAILIT_EMC = 5 54 OPIE_MAILIT_EMC = 5
55 }; 55 };
56 56
57 enum PhoneClients { 57 enum PhoneClients {
58 NONE_PHC = 0, 58 NONE_PHC = 0,
59 OTHER_PHC = 1, 59 OTHER_PHC = 1,
60 KPPI_PHC = 2 60 KPPI_PHC = 2
61 }; 61 };
62 62
63 enum FaxClients { 63 enum FaxClients {
64 NONE_FAC = 0, 64 NONE_FAC = 0,
65 OTHER_FAC = 1 65 OTHER_FAC = 1
66 }; 66 };
67 67
68 enum SMSClients { 68 enum SMSClients {
69 NONE_SMC = 0, 69 NONE_SMC = 0,
70 OTHER_SMC = 1 70 OTHER_SMC = 1
71 }; 71 };
72 72
73 enum PagerClients { 73 enum PagerClients {
74 NONE_PAC = 0, 74 NONE_PAC = 0,
75 OTHER_PAC = 1 75 OTHER_PAC = 1
76 }; 76 };
77 77
78 enum SIPClients { 78 enum SIPClients {
79 NONE_SIC = 0, 79 NONE_SIC = 0,
80 OTHER_SIC = 1, 80 OTHER_SIC = 1,
81 KPPI_SIC = 2 81 KPPI_SIC = 2
82 }; 82 };
83 83
84 private: 84 private:
85 KPimGlobalPrefs( const QString &name = QString::null ); 85 KPimGlobalPrefs( const QString &name = QString::null );
86 86
87 static KPimGlobalPrefs *sInstance; 87 static KPimGlobalPrefs *sInstance;
88 QDict<QString> *mLocaleDict; 88 QDict<QString> *mLocaleDict;
89 89
90 90
91 public: 91 public:
92 //US I copied the following "locale" settings from KOPrefs 92 //US I copied the following "locale" settings from KOPrefs
93 int mPreferredDate; 93 int mPreferredDate;
94 QString mUserDateFormatLong; 94 QString mUserDateFormatLong;
95 QString mUserDateFormatShort; 95 QString mUserDateFormatShort;
96 int mPreferredLanguage; 96 int mPreferredLanguage;
97 int mPreferredTime; 97 int mPreferredTime;
98 bool mWeekStartsOnSunday; 98 bool mWeekStartsOnSunday;
99 QString mTimeZoneId; 99 QString mTimeZoneId;
100 bool mUseDaylightsaving; 100 bool mUseDaylightsaving;
101 int mDaylightsavingStart; 101 int mDaylightsavingStart;
102 int mDaylightsavingEnd; 102 int mDaylightsavingEnd;
103 bool mTimeZoneAdd30min; 103 bool mTimeZoneAdd30min;
104 QFont mApplicationFont; 104 QFont mApplicationFont;
105 QColor mAlternateColor;
105 106
106 int mEmailClient; 107 int mEmailClient;
107 QString mEmailOtherChannel; 108 QString mEmailOtherChannel;
108 QString mEmailOtherMessage; 109 QString mEmailOtherMessage;
109 QString mEmailOtherMessageParameters; 110 QString mEmailOtherMessageParameters;
110 QString mEmailOtherMessage2; 111 QString mEmailOtherMessage2;
111 QString mEmailOtherMessageParameters2; 112 QString mEmailOtherMessageParameters2;
112 113
113 int mPhoneClient; 114 int mPhoneClient;
114 QString mPhoneOtherChannel; 115 QString mPhoneOtherChannel;
115 QString mPhoneOtherMessage; 116 QString mPhoneOtherMessage;
116 QString mPhoneOtherMessageParameters; 117 QString mPhoneOtherMessageParameters;
117 118
118 int mFaxClient; 119 int mFaxClient;
119 QString mFaxOtherChannel; 120 QString mFaxOtherChannel;
120 QString mFaxOtherMessage; 121 QString mFaxOtherMessage;
121 QString mFaxOtherMessageParameters; 122 QString mFaxOtherMessageParameters;
122 123
123 int mSMSClient; 124 int mSMSClient;
124 QString mSMSOtherChannel; 125 QString mSMSOtherChannel;
125 QString mSMSOtherMessage; 126 QString mSMSOtherMessage;
126 QString mSMSOtherMessageParameters; 127 QString mSMSOtherMessageParameters;
127 128
128 int mPagerClient; 129 int mPagerClient;
129 QString mPagerOtherChannel; 130 QString mPagerOtherChannel;
130 QString mPagerOtherMessage; 131 QString mPagerOtherMessage;
131 QString mPagerOtherMessageParameters; 132 QString mPagerOtherMessageParameters;
132 133
133 int mSipClient; 134 int mSipClient;
134 QString mSipOtherChannel; 135 QString mSipOtherChannel;
135 QString mSipOtherMessage; 136 QString mSipOtherMessage;
136 QString mSipOtherMessageParameters; 137 QString mSipOtherMessageParameters;
137 138
138 QString mEx2PhoneDevice; 139 QString mEx2PhoneDevice;
139 QString mEx2PhoneConnection; 140 QString mEx2PhoneConnection;
140 QString mEx2PhoneModel; 141 QString mEx2PhoneModel;
141 142
142}; 143};
143 144
144#endif 145#endif