summaryrefslogtreecommitdiffabout
path: root/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
authorzautrix <zautrix>2005-07-27 16:02:58 (UTC)
committer zautrix <zautrix>2005-07-27 16:02:58 (UTC)
commit136f9082862e7a56abb3a201e96f5e7386c4f1b9 (patch) (unidiff)
treeebddba3dd07aa3ac5ea5f75cb962606d84d4fec0 /libkdepim/kcmconfigs/kdepimconfigwidget.cpp
parentcdd39d566d5d054edf26bd142d6be05cb35451dd (diff)
downloadkdepimpi-136f9082862e7a56abb3a201e96f5e7386c4f1b9.zip
kdepimpi-136f9082862e7a56abb3a201e96f5e7386c4f1b9.tar.gz
kdepimpi-136f9082862e7a56abb3a201e96f5e7386c4f1b9.tar.bz2
fixxxuuu
Diffstat (limited to 'libkdepim/kcmconfigs/kdepimconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index ff1e240..764c495 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -105,238 +105,256 @@ KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent,
105 KDialog::spacingHint() ); 105 KDialog::spacingHint() );
106 106
107 tabWidget = new QTabWidget( this ); 107 tabWidget = new QTabWidget( this );
108 topLayout->addWidget( tabWidget ); 108 topLayout->addWidget( tabWidget );
109 109
110 110
111 setupLocaleTab(); 111 setupLocaleTab();
112 setupLocaleDateTab(); 112 setupLocaleDateTab();
113 setupTimeZoneTab(); 113 setupTimeZoneTab();
114 setupExternalAppTab(); 114 setupExternalAppTab();
115 setupStoreTab(); 115 setupStoreTab();
116 setupBackupTab(); 116 setupBackupTab();
117} 117}
118void KDEPIMConfigWidget::showTimeZoneTab() 118void KDEPIMConfigWidget::showTimeZoneTab()
119{ 119{
120 tabWidget->setCurrentPage ( 3 ) ; 120 tabWidget->setCurrentPage ( 3 ) ;
121} 121}
122void KDEPIMConfigWidget::setupBackupTab() 122void KDEPIMConfigWidget::setupBackupTab()
123{ 123{
124 QVBox *colorPage = new QVBox( this ); 124 QVBox *colorPage = new QVBox( this );
125 tabWidget->addTab( colorPage, i18n( "Backup" ) ); 125 tabWidget->addTab( colorPage, i18n( "Backup" ) );
126 QWidget* topFrame = new QWidget( colorPage ); 126 QWidget* topFrame = new QWidget( colorPage );
127 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 127 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
128 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), 128 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"),
129 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); 129 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame);
130 topLayout->addWidget((QWidget*)sb->checkBox()); 130 topLayout->addWidget((QWidget*)sb->checkBox());
131 QWidget* bupFrame = new QWidget( topFrame ); 131 QWidget* bupFrame = new QWidget( topFrame );
132 topLayout->addWidget((bupFrame)); 132 topLayout->addWidget((bupFrame));
133 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); 133 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
134 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); 134 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
135 sb = addWidBool(i18n("Use standard backup dir"), 135 sb = addWidBool(i18n("Use standard backup dir"),
136 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); 136 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame);
137 bupLayout->addWidget((QWidget*)sb->checkBox()); 137 bupLayout->addWidget((QWidget*)sb->checkBox());
138 mBackupUrl = new KURLRequester( bupFrame ); 138 mBackupUrl = new KURLRequester( bupFrame );
139 mBackupUrl->setPathIsDir(); 139 mBackupUrl->setPathIsDir();
140 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 140 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
141 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); 141 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
142 bupLayout->addWidget( mBackupUrl ); 142 bupLayout->addWidget( mBackupUrl );
143 143
144 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); 144 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir );
145 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); 145 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled );
146 QHBox *dummy = new QHBox(bupFrame); 146 QHBox *dummy = new QHBox(bupFrame);
147 new QLabel(i18n("Number of Backups:"),dummy); 147 new QLabel(i18n("Number of Backups:"),dummy);
148 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); 148 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
149 new QLabel(i18n(" "),dummy); 149 new QLabel(i18n(" "),dummy);
150 bupLayout->addWidget( dummy ); 150 bupLayout->addWidget( dummy );
151 151
152 dummy = new QHBox(bupFrame); 152 dummy = new QHBox(bupFrame);
153 new QLabel(i18n("Make backup every "),dummy); 153 new QLabel(i18n("Make backup every "),dummy);
154 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); 154 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
155 new QLabel(i18n(" days"),dummy); 155 new QLabel(i18n(" days"),dummy);
156 new QLabel(i18n(" "),dummy); 156 new QLabel(i18n(" "),dummy);
157 bupLayout->addWidget( dummy ); 157 bupLayout->addWidget( dummy );
158 QString localKdeDir; 158 QString localKdeDir;
159 localKdeDir = readEnvPath("LOCALMICROKDEHOME"); 159 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
160 if ( ! localKdeDir.isEmpty() ) { 160 if ( ! localKdeDir.isEmpty() ) {
161 sb->checkBox()->setEnabled( false ); 161 sb->checkBox()->setEnabled( false );
162 sb->checkBox()->setChecked( true ); 162 sb->checkBox()->setChecked( true );
163 mBackupUrl->setEnabled( false ); 163 mBackupUrl->setEnabled( false );
164 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; 164 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true;
165 } 165 }
166 166
167} 167}
168void KDEPIMConfigWidget::setupStoreTab() 168void KDEPIMConfigWidget::setupStoreTab()
169{ 169{
170 QVBox *colorPage = new QVBox( this ); 170 QVBox *colorPage = new QVBox( this );
171 tabWidget->addTab( colorPage, i18n( "Colors" ) ); 171 tabWidget->addTab( colorPage, i18n( "Colors" ) );
172 QWidget* cw = new QWidget( colorPage ); 172 QWidget* cw = new QWidget( colorPage );
173 KPrefsWidColor *holidayColor = 173 KPrefsWidColor *holidayColor =
174 addWidColor(i18n("Alternating background of list views"), 174 addWidColor(i18n("Alternating background of list views"),
175 &(KPimGlobalPrefs::instance()->mAlternateColor),cw); 175 &(KPimGlobalPrefs::instance()->mAlternateColor),cw);
176 QHBoxLayout *topLayout = new QHBoxLayout(cw); 176 QHBoxLayout *topLayout = new QHBoxLayout(cw);
177 topLayout->addWidget(holidayColor->label()); 177 topLayout->addWidget(holidayColor->label());
178 topLayout->addWidget( (QWidget* )holidayColor->button()); 178 topLayout->addWidget( (QWidget* )holidayColor->button());
179 179
180 180
181 QVBox *storePage = new QVBox( this ); 181 QVBox *storePage = new QVBox( this );
182 if ( QApplication::desktop()->height() > 240 ) 182 if ( QApplication::desktop()->height() > 240 )
183 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 ); 183 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 );
184 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 184 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
185 mStoreUrl = new KURLRequester( storePage ); 185 mStoreUrl = new KURLRequester( storePage );
186 mStoreUrl->setPathIsDir(); 186 mStoreUrl->setPathIsDir();
187 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 187 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
188#ifdef DESKTOP_VERSION 188#ifdef DESKTOP_VERSION
189 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; 189 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
190 QFileInfo fi ( confFile ); 190 QFileInfo fi ( confFile );
191 if ( fi.exists() ) { 191 if ( fi.exists() ) {
192 KConfig cfg ( confFile ); 192 KConfig cfg ( confFile );
193 cfg.setGroup("Global"); 193 cfg.setGroup("Global");
194 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); 194 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
195 if ( localKdeDir != "x_x_x" ) { 195 if ( localKdeDir != "x_x_x" ) {
196 mStoreUrl->setURL( localKdeDir ); 196 mStoreUrl->setURL( localKdeDir );
197 qDebug("Reading config from %s ", confFile.latin1()); 197 qDebug("Reading config from %s ", confFile.latin1());
198 } 198 }
199 } 199 }
200 200
201#endif 201#endif
202 new QLabel( i18n("New dirs are created automatically"), storePage ); 202 new QLabel( i18n("New dirs are created automatically"), storePage );
203 QHBox *bb = new QHBox( storePage ); 203 QHBox *bb = new QHBox( storePage );
204 QPushButton * pb; 204 QPushButton * pb;
205 if ( QApplication::desktop()->width() < 640 ) 205 if ( QApplication::desktop()->width() < 640 )
206 pb = new QPushButton ( i18n("Save"), bb ); 206 pb = new QPushButton ( i18n("Save"), bb );
207 else 207 else
208 pb = new QPushButton ( i18n("Save settings"), bb ); 208 pb = new QPushButton ( i18n("Save settings"), bb );
209 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 209 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
210 pb = new QPushButton ( i18n("Save standard"), bb ); 210 pb = new QPushButton ( i18n("Save standard"), bb );
211 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 211 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
212#ifdef DESKTOP_VERSION 212#ifdef DESKTOP_VERSION
213 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); 213 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
214 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); 214 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
215#endif 215#endif
216 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); 216 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
217 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); 217 mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
218 tabWidget->addTab( storePage, i18n( "Data storage path" ) ); 218 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
219
220#ifdef DESKTOP_VERSION
221 if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) {
222 mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" ));
223 }
224#endif
219} 225}
220void KDEPIMConfigWidget::setLocalStore() 226void KDEPIMConfigWidget::setLocalStore()
221{ 227{
222 mStoreUrl->setURL( "LOCAL:kdepimpi" ); 228 mStoreUrl->setURL( "LOCAL:kdepimpi" );
223 saveStoreSettings(); 229 saveStoreSettings();
224 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."); 230 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.");
225 KMessageBox::information( this, message); 231 KMessageBox::information( this, message);
226} 232}
227void KDEPIMConfigWidget::setStandardStore() 233void KDEPIMConfigWidget::setStandardStore()
228{ 234{
229 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 235 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
230 saveStoreSettings(); 236 saveStoreSettings();
231} 237}
232void KDEPIMConfigWidget::saveStoreSettings() 238void KDEPIMConfigWidget::saveStoreSettings()
233{ 239{
240#ifdef DESKTOP_VERSION
241 if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) {
242 QString file = qApp->applicationDirPath ()+"/.microkdehome";
243 QFileInfo fi ( file );
244 if ( fi.exists() ) {
245 bool res = QFile::remove( file );
246 if ( ! res )
247 KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file ));
248 }
249 }
250#endif
234 if ( !mStoreUrl->url().isEmpty() ) { 251 if ( !mStoreUrl->url().isEmpty() ) {
235 QString path = QDir::homeDirPath(); 252 QString path = QDir::homeDirPath();
236 QString url = mStoreUrl->url(); 253 QString url = mStoreUrl->url();
237#ifdef DESKTOP_VERSION 254#ifdef DESKTOP_VERSION
238 if ( url.startsWith( "LOCAL:" ) ) { 255 if ( url.startsWith( "LOCAL:" ) ) {
239 path = qApp->applicationDirPath () ; 256 path = qApp->applicationDirPath () ;
240 } 257 }
241#endif 258#endif
242 KConfig cfg ( path + "/.microkdehome" ); 259 KConfig cfg ( path + "/.microkdehome" );
243 cfg.setGroup("Global"); 260 cfg.setGroup("Global");
244 cfg.writeEntry( "MICROKDEHOME", url ); 261 cfg.writeEntry( "MICROKDEHOME", url );
245 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); 262 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1());
246 cfg.sync(); 263 cfg.sync();
264 mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" ));
247 } else { 265 } else {
248 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 266 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
249 saveStoreSettings(); 267 saveStoreSettings();
250 } 268 }
251} 269}
252void KDEPIMConfigWidget::setupExternalAppTab() 270void KDEPIMConfigWidget::setupExternalAppTab()
253{ 271{
254 QWidget *externalAppsPage = new QWidget( this ); 272 QWidget *externalAppsPage = new QWidget( this );
255 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 273 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
256 KDialog::spacingHintSmall() ); 274 KDialog::spacingHintSmall() );
257 275
258 mExternalApps = new QComboBox( externalAppsPage ); 276 mExternalApps = new QComboBox( externalAppsPage );
259 277
260 QMap<ExternalAppHandler::Types, QString>::Iterator it; 278 QMap<ExternalAppHandler::Types, QString>::Iterator it;
261 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 279 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
262 mExternalApps->insertItem( it.data(), it.key() ); 280 mExternalApps->insertItem( it.data(), it.key() );
263 281
264 layout->addWidget( mExternalApps ); 282 layout->addWidget( mExternalApps );
265 283
266 connect( mExternalApps, SIGNAL( activated( int ) ), 284 connect( mExternalApps, SIGNAL( activated( int ) ),
267 this, SLOT (externalapp_changed( int ) ) ); 285 this, SLOT (externalapp_changed( int ) ) );
268 286
269 287
270 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 288 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
271 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 289 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
272 mExternalAppGroupBox->layout()->setMargin(4); 290 mExternalAppGroupBox->layout()->setMargin(4);
273 291
274 mClient = new QComboBox( mExternalAppGroupBox ); 292 mClient = new QComboBox( mExternalAppGroupBox );
275 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 293 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
276 294
277 connect( mClient, SIGNAL( activated( int ) ), 295 connect( mClient, SIGNAL( activated( int ) ),
278 this, SLOT (client_changed( int ) ) ); 296 this, SLOT (client_changed( int ) ) );
279 297
280 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 298 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
281 boxLayout->addWidget( lab, 1, 0 ); 299 boxLayout->addWidget( lab, 1, 0 );
282 mChannel = new QLineEdit(mExternalAppGroupBox); 300 mChannel = new QLineEdit(mExternalAppGroupBox);
283 mChannel->setReadOnly(true); 301 mChannel->setReadOnly(true);
284 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 302 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
285 303
286 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 304 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
287 boxLayout->addWidget( lab, 3, 0 ); 305 boxLayout->addWidget( lab, 3, 0 );
288 mMessage = new QLineEdit(mExternalAppGroupBox); 306 mMessage = new QLineEdit(mExternalAppGroupBox);
289 mMessage->setReadOnly(true); 307 mMessage->setReadOnly(true);
290 boxLayout->addWidget( mMessage , 4, 0); 308 boxLayout->addWidget( mMessage , 4, 0);
291 309
292 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 310 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
293 boxLayout->addWidget( lab, 3, 1 ); 311 boxLayout->addWidget( lab, 3, 1 );
294 mParameters = new QLineEdit(mExternalAppGroupBox); 312 mParameters = new QLineEdit(mExternalAppGroupBox);
295 mParameters->setReadOnly(true); 313 mParameters->setReadOnly(true);
296 boxLayout->addWidget( mParameters, 4, 1 ); 314 boxLayout->addWidget( mParameters, 4, 1 );
297 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 315 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
298 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 316 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
299 317
300 318
301 if ( QApplication::desktop()->height() > 240 ) { 319 if ( QApplication::desktop()->height() > 240 ) {
302 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 320 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
303 boxLayout->addWidget( lab, 6, 0 ); 321 boxLayout->addWidget( lab, 6, 0 );
304 mMessage2 = new QLineEdit(mExternalAppGroupBox); 322 mMessage2 = new QLineEdit(mExternalAppGroupBox);
305 mMessage2->setReadOnly(true); 323 mMessage2->setReadOnly(true);
306 boxLayout->addWidget( mMessage2 , 7, 0); 324 boxLayout->addWidget( mMessage2 , 7, 0);
307 325
308 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 326 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
309 boxLayout->addWidget( lab, 6, 1 ); 327 boxLayout->addWidget( lab, 6, 1 );
310 mParameters2 = new QLineEdit(mExternalAppGroupBox); 328 mParameters2 = new QLineEdit(mExternalAppGroupBox);
311 mParameters2->setReadOnly(true); 329 mParameters2->setReadOnly(true);
312 boxLayout->addWidget( mParameters2, 7, 1 ); 330 boxLayout->addWidget( mParameters2, 7, 1 );
313 331
314 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 332 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
315 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 333 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
316 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 334 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
317 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 335 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
318 } else { 336 } else {
319 mMessage2 = 0; 337 mMessage2 = 0;
320 mParameters2 = 0; 338 mParameters2 = 0;
321 } 339 }
322 340
323 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 341 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
324 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 342 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
325 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 343 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
326 344
327 345
328 layout->addWidget( mExternalAppGroupBox ); 346 layout->addWidget( mExternalAppGroupBox );
329 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 347 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
330 348
331} 349}
332 350
333 351
334void KDEPIMConfigWidget::setupLocaleDateTab() 352void KDEPIMConfigWidget::setupLocaleDateTab()
335{ 353{
336 QWidget *topFrame = new QWidget( this ); 354 QWidget *topFrame = new QWidget( this );
337 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); 355 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
338 356
339 topLayout->setSpacing(KDialog::spacingHintSmall()); 357 topLayout->setSpacing(KDialog::spacingHintSmall());
340 topLayout->setMargin(KDialog::marginHintSmall()); 358 topLayout->setMargin(KDialog::marginHintSmall());
341 int iii = 0; 359 int iii = 0;
342 360
@@ -748,194 +766,196 @@ void KDEPIMConfigWidget::updateClientWidgets()
748 } 766 }
749 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 767 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
750 { 768 {
751 mChannel->setText(mSipOtherChannel); 769 mChannel->setText(mSipOtherChannel);
752 mMessage->setText(mSipOtherMessage); 770 mMessage->setText(mSipOtherMessage);
753 mParameters->setText(mSipOtherMessageParameters); 771 mParameters->setText(mSipOtherMessageParameters);
754 } 772 }
755 } 773 }
756 774
757 } 775 }
758 776
759 bool readonly; 777 bool readonly;
760 bool enabled; 778 bool enabled;
761 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 779 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
762 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 780 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
763 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 781 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
764 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 782 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
765 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 783 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
766 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) 784 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
767 { 785 {
768 readonly = false; 786 readonly = false;
769 } 787 }
770 else 788 else
771 { 789 {
772 readonly = true; 790 readonly = true;
773 } 791 }
774 792
775 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 793 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
776 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 794 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
777 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 795 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
778 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 796 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
779 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 797 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
780 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 798 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
781 { 799 {
782 enabled = false; 800 enabled = false;
783 } 801 }
784 else 802 else
785 { 803 {
786 enabled = true; 804 enabled = true;
787 } 805 }
788 806
789 807
790 mChannel->setReadOnly(readonly); 808 mChannel->setReadOnly(readonly);
791 mMessage->setReadOnly(readonly); 809 mMessage->setReadOnly(readonly);
792 mParameters->setReadOnly(readonly); 810 mParameters->setReadOnly(readonly);
793 if ( mMessage2 ) 811 if ( mMessage2 )
794 mMessage2->setReadOnly(readonly); 812 mMessage2->setReadOnly(readonly);
795 if ( mParameters2 ) 813 if ( mParameters2 )
796 mParameters2->setReadOnly(readonly); 814 mParameters2->setReadOnly(readonly);
797 815
798 mChannel->setEnabled(enabled); 816 mChannel->setEnabled(enabled);
799 mMessage->setEnabled(enabled); 817 mMessage->setEnabled(enabled);
800 mParameters->setEnabled(enabled); 818 mParameters->setEnabled(enabled);
801 if ( mMessage2 ) 819 if ( mMessage2 )
802 mMessage2->setEnabled(enabled); 820 mMessage2->setEnabled(enabled);
803 if ( mParameters2 ) 821 if ( mParameters2 )
804 mParameters2->setEnabled(enabled); 822 mParameters2->setEnabled(enabled);
805 823
806 824
807 825
808 mClient->setCurrentItem(mCurrentClient); 826 mClient->setCurrentItem(mCurrentClient);
809 827
810 828
811 // enable/disable the extra message/parameter field 829 // enable/disable the extra message/parameter field
812 if (mCurrentApp == ExternalAppHandler::EMAIL) 830 if (mCurrentApp == ExternalAppHandler::EMAIL)
813 { 831 {
814 } 832 }
815 else 833 else
816 { 834 {
817 if ( mMessage2 ) 835 if ( mMessage2 )
818 mMessage2->setText( "" ); 836 mMessage2->setText( "" );
819 if ( mParameters2 ) 837 if ( mParameters2 )
820 mParameters2->setText( "" ); 838 mParameters2->setText( "" );
821 } 839 }
822 840
823 if (enabled == true) { 841 if (enabled == true) {
824 if ( mMessage2 ) 842 if ( mMessage2 )
825 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 843 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
826 if ( mParameters2 ) 844 if ( mParameters2 )
827 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 845 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
828 } 846 }
829 847
830 848
831 blockSignals( blocked ); 849 blockSignals( blocked );
832 850
833} 851}
834 852
835void KDEPIMConfigWidget::usrReadConfig() 853void KDEPIMConfigWidget::usrReadConfig()
836{ 854{
837 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 855 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
838 856
839 bool blocked = signalsBlocked(); 857 bool blocked = signalsBlocked();
840 blockSignals( true ); 858 blockSignals( true );
841 859
842 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) 860 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir )
843 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 861 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
844 else 862 else {
845 mBackupUrl->setURL(prefs->mBackupDatadir); 863 mBackupUrl->setURL(prefs->mBackupDatadir);
864
865 }
846 mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); 866 mBackupNumbersSpin->setValue( prefs->mBackupNumbers );
847 mBackupDayCountSpin->setValue( prefs->mBackupDayCount); 867 mBackupDayCountSpin->setValue( prefs->mBackupDayCount);
848 868
849 QString dummy = prefs->mUserDateFormatLong; 869 QString dummy = prefs->mUserDateFormatLong;
850 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 870 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
851 dummy = prefs->mUserDateFormatShort; 871 dummy = prefs->mUserDateFormatShort;
852 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 872 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
853 873
854 QDate current ( 2001, 1,1); 874 QDate current ( 2001, 1,1);
855 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 875 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
856 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 876 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
857 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 877 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
858 878
859 mEmailClient = prefs->mEmailClient; 879 mEmailClient = prefs->mEmailClient;
860 mEmailOtherChannel = prefs->mEmailOtherChannel; 880 mEmailOtherChannel = prefs->mEmailOtherChannel;
861 mEmailOtherMessage = prefs->mEmailOtherMessage; 881 mEmailOtherMessage = prefs->mEmailOtherMessage;
862 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 882 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
863 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 883 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
864 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 884 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
865 885
866 mPhoneClient = prefs->mPhoneClient; 886 mPhoneClient = prefs->mPhoneClient;
867 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 887 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
868 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 888 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
869 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 889 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
870 890
871 mFaxClient = prefs->mFaxClient; 891 mFaxClient = prefs->mFaxClient;
872 mFaxOtherChannel = prefs->mFaxOtherChannel; 892 mFaxOtherChannel = prefs->mFaxOtherChannel;
873 mFaxOtherMessage = prefs->mFaxOtherMessage; 893 mFaxOtherMessage = prefs->mFaxOtherMessage;
874 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 894 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
875 895
876 mSMSClient = prefs->mSMSClient; 896 mSMSClient = prefs->mSMSClient;
877 mSMSOtherChannel = prefs->mSMSOtherChannel; 897 mSMSOtherChannel = prefs->mSMSOtherChannel;
878 mSMSOtherMessage = prefs->mSMSOtherMessage; 898 mSMSOtherMessage = prefs->mSMSOtherMessage;
879 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 899 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
880 900
881 mPagerClient = prefs->mPagerClient; 901 mPagerClient = prefs->mPagerClient;
882 mPagerOtherChannel = prefs->mPagerOtherChannel; 902 mPagerOtherChannel = prefs->mPagerOtherChannel;
883 mPagerOtherMessage = prefs->mPagerOtherMessage; 903 mPagerOtherMessage = prefs->mPagerOtherMessage;
884 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 904 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
885 905
886 mSipClient = prefs->mSipClient; 906 mSipClient = prefs->mSipClient;
887 mSipOtherChannel = prefs->mSipOtherChannel; 907 mSipOtherChannel = prefs->mSipOtherChannel;
888 mSipOtherMessage = prefs->mSipOtherMessage; 908 mSipOtherMessage = prefs->mSipOtherMessage;
889 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 909 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
890 910
891 mCurrentApp = ExternalAppHandler::EMAIL; 911 mCurrentApp = ExternalAppHandler::EMAIL;
892 mCurrentClient = mEmailClient; 912 mCurrentClient = mEmailClient;
893 913
894 updateClientWidgets(); 914 updateClientWidgets();
895 915
896 blockSignals( blocked ); 916 blockSignals( blocked );
897 917
898} 918}
899 919
900void KDEPIMConfigWidget::usrWriteConfig() 920void KDEPIMConfigWidget::usrWriteConfig()
901{ 921{
902 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 922 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
903 923
904 saveEditFieldSettings(); 924 saveEditFieldSettings();
905 925
906 prefs->mBackupNumbers = mBackupNumbersSpin->value(); 926 prefs->mBackupNumbers = mBackupNumbersSpin->value();
907 prefs->mBackupDayCount = mBackupDayCountSpin->value(); 927 prefs->mBackupDayCount = mBackupDayCountSpin->value();
908 prefs->mBackupDatadir = mBackupUrl->url(); 928 prefs->mBackupDatadir = mBackupUrl->url();
909 929
910 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 930 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
911 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 931 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
912 932
913 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 933 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
914 QDate date; 934 QDate date;
915 date = mStartDateSavingEdit->date(); 935 date = mStartDateSavingEdit->date();
916 int sub = 0; 936 int sub = 0;
917 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 937 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
918 sub = 1; 938 sub = 1;
919 prefs->mDaylightsavingStart = date.dayOfYear()-sub; 939 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
920 date = mEndDateSavingEdit->date(); 940 date = mEndDateSavingEdit->date();
921 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 941 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
922 sub = 1; 942 sub = 1;
923 else 943 else
924 sub = 0; 944 sub = 0;
925 prefs->mDaylightsavingEnd = date.dayOfYear()-sub; 945 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
926 946
927 947
928 prefs->mEmailClient = mEmailClient; 948 prefs->mEmailClient = mEmailClient;
929 prefs->mEmailOtherChannel = mEmailOtherChannel; 949 prefs->mEmailOtherChannel = mEmailOtherChannel;
930 prefs->mEmailOtherMessage = mEmailOtherMessage; 950 prefs->mEmailOtherMessage = mEmailOtherMessage;
931 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 951 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
932 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 952 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
933 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 953 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
934 954
935 prefs->mPhoneClient = mPhoneClient; 955 prefs->mPhoneClient = mPhoneClient;
936 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 956 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
937 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 957 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
938 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 958 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
939 959
940 prefs->mFaxClient = mFaxClient; 960 prefs->mFaxClient = mFaxClient;
941 prefs->mFaxOtherChannel = mFaxOtherChannel; 961 prefs->mFaxOtherChannel = mFaxOtherChannel;