-rw-r--r-- | korganizer/koprefs.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 8f37793..576c265 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -285,193 +285,193 @@ KOPrefs::KOPrefs() : | |||
285 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 285 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
286 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 286 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
287 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 287 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
288 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 288 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
289 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 289 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
290 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 290 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
291 | 291 | ||
292 | KPrefs::setCurrentGroup( "Editors" ); | 292 | KPrefs::setCurrentGroup( "Editors" ); |
293 | 293 | ||
294 | addItemStringList( "EventTemplates", &mEventTemplates ); | 294 | addItemStringList( "EventTemplates", &mEventTemplates ); |
295 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 295 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
296 | 296 | ||
297 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 297 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
298 | 298 | ||
299 | 299 | ||
300 | 300 | ||
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | KOPrefs::~KOPrefs() | 304 | KOPrefs::~KOPrefs() |
305 | { | 305 | { |
306 | if (mInstance == this) | 306 | if (mInstance == this) |
307 | mInstance = insd.setObject(0); | 307 | mInstance = insd.setObject(0); |
308 | 308 | ||
309 | //qDebug("KOPrefs::~KOPrefs() "); | 309 | //qDebug("KOPrefs::~KOPrefs() "); |
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
313 | KOPrefs *KOPrefs::instance() | 313 | KOPrefs *KOPrefs::instance() |
314 | { | 314 | { |
315 | if (!mInstance) { | 315 | if (!mInstance) { |
316 | mInstance = insd.setObject(new KOPrefs()); | 316 | mInstance = insd.setObject(new KOPrefs()); |
317 | mInstance->readConfig(); | 317 | mInstance->readConfig(); |
318 | } | 318 | } |
319 | 319 | ||
320 | return mInstance; | 320 | return mInstance; |
321 | } | 321 | } |
322 | 322 | ||
323 | void KOPrefs::usrSetDefaults() | 323 | void KOPrefs::usrSetDefaults() |
324 | { | 324 | { |
325 | 325 | ||
326 | } | 326 | } |
327 | 327 | ||
328 | void KOPrefs::fillMailDefaults() | 328 | void KOPrefs::fillMailDefaults() |
329 | { | 329 | { |
330 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 330 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
331 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 331 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
332 | } | 332 | } |
333 | 333 | ||
334 | void KOPrefs::setTimeZoneIdDefault() | 334 | void KOPrefs::setTimeZoneIdDefault() |
335 | { | 335 | { |
336 | ; | 336 | ; |
337 | } | 337 | } |
338 | 338 | ||
339 | void KOPrefs::setAllDefaults() | 339 | void KOPrefs::setAllDefaults() |
340 | { | 340 | { |
341 | setCategoryDefaults(); | 341 | setCategoryDefaults(); |
342 | mEventSummaryUser = getDefaultList() ; | 342 | mEventSummaryUser = getDefaultList() ; |
343 | mTodoSummaryUser = getDefaultList() ; | 343 | mTodoSummaryUser = getDefaultList() ; |
344 | mLocationDefaults = getLocationDefaultList(); | 344 | mLocationDefaults = getLocationDefaultList(); |
345 | } | 345 | } |
346 | 346 | ||
347 | void KOPrefs::setCategoryDefaults() | 347 | void KOPrefs::setCategoryDefaults() |
348 | { | 348 | { |
349 | mCustomCategories.clear(); | 349 | mCustomCategories.clear(); |
350 | mCustomCategories = getDefaultList(); | 350 | mCustomCategories = getDefaultList(); |
351 | 351 | ||
352 | QStringList::Iterator it; | 352 | QStringList::Iterator it; |
353 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 353 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
354 | setCategoryColor(*it,mDefaultCategoryColor); | 354 | setCategoryColor(*it,mDefaultCategoryColor); |
355 | } | 355 | } |
356 | } | 356 | } |
357 | QStringList KOPrefs::getLocationDefaultList() | 357 | QStringList KOPrefs::getLocationDefaultList() |
358 | { | 358 | { |
359 | QStringList retval ; | 359 | QStringList retval ; |
360 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 360 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
361 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 361 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
362 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 362 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
363 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 363 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
364 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 364 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
365 | 365 | ||
366 | retval.sort(); | 366 | retval.sort(); |
367 | return retval; | 367 | return retval; |
368 | } | 368 | } |
369 | QStringList KOPrefs::getDefaultList() | 369 | QStringList KOPrefs::getDefaultList() |
370 | { | 370 | { |
371 | QStringList retval ; | 371 | QStringList retval ; |
372 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 372 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
373 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 373 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
374 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 374 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
375 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 375 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
376 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 376 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
377 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 377 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
378 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 378 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
379 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 379 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
380 | retval.sort(); | 380 | retval.sort(); |
381 | qDebug("cat %s ", retval.join("-").latin1()); | 381 | //qDebug("cat %s ", retval.join("-").latin1()); |
382 | return retval; | 382 | return retval; |
383 | } | 383 | } |
384 | 384 | ||
385 | void KOPrefs::usrReadConfig() | 385 | void KOPrefs::usrReadConfig() |
386 | { | 386 | { |
387 | config()->setGroup("General"); | 387 | config()->setGroup("General"); |
388 | 388 | ||
389 | //qDebug("KOPrefs::usrReadConfig() "); | 389 | //qDebug("KOPrefs::usrReadConfig() "); |
390 | mCustomCategories = config()->readListEntry("Custom Categories"); | 390 | mCustomCategories = config()->readListEntry("Custom Categories"); |
391 | mOldLoadedLanguage = mOldLanguage ; | 391 | mOldLoadedLanguage = mOldLanguage ; |
392 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 392 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
393 | if (mLocationDefaults.isEmpty()) { | 393 | if (mLocationDefaults.isEmpty()) { |
394 | mLocationDefaults = getLocationDefaultList(); | 394 | mLocationDefaults = getLocationDefaultList(); |
395 | } | 395 | } |
396 | 396 | ||
397 | if (mEventSummaryUser.isEmpty()) { | 397 | if (mEventSummaryUser.isEmpty()) { |
398 | mEventSummaryUser = getDefaultList() ; | 398 | mEventSummaryUser = getDefaultList() ; |
399 | } | 399 | } |
400 | if (mTodoSummaryUser.isEmpty()) { | 400 | if (mTodoSummaryUser.isEmpty()) { |
401 | mTodoSummaryUser = getDefaultList() ; | 401 | mTodoSummaryUser = getDefaultList() ; |
402 | } | 402 | } |
403 | 403 | ||
404 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 404 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
405 | 405 | ||
406 | config()->setGroup("Personal Settings"); | 406 | config()->setGroup("Personal Settings"); |
407 | mName = config()->readEntry("user_name",""); | 407 | mName = config()->readEntry("user_name",""); |
408 | mEmail = config()->readEntry("user_email",""); | 408 | mEmail = config()->readEntry("user_email",""); |
409 | fillMailDefaults(); | 409 | fillMailDefaults(); |
410 | 410 | ||
411 | config()->setGroup("Category Colors"); | 411 | config()->setGroup("Category Colors"); |
412 | QStringList::Iterator it; | 412 | QStringList::Iterator it; |
413 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 413 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
414 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 414 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
415 | 415 | ||
416 | } | 416 | } |
417 | 417 | ||
418 | KPimPrefs::usrReadConfig(); | 418 | KPimPrefs::usrReadConfig(); |
419 | } | 419 | } |
420 | 420 | ||
421 | 421 | ||
422 | void KOPrefs::usrWriteConfig() | 422 | void KOPrefs::usrWriteConfig() |
423 | { | 423 | { |
424 | config()->setGroup("General"); | 424 | config()->setGroup("General"); |
425 | config()->writeEntry("Custom Categories",mCustomCategories); | 425 | config()->writeEntry("Custom Categories",mCustomCategories); |
426 | 426 | ||
427 | config()->setGroup("Personal Settings"); | 427 | config()->setGroup("Personal Settings"); |
428 | config()->writeEntry("user_name",mName); | 428 | config()->writeEntry("user_name",mName); |
429 | config()->writeEntry("user_email",mEmail); | 429 | config()->writeEntry("user_email",mEmail); |
430 | 430 | ||
431 | config()->setGroup("Category Colors"); | 431 | config()->setGroup("Category Colors"); |
432 | QDictIterator<QColor> it(mCategoryColors); | 432 | QDictIterator<QColor> it(mCategoryColors); |
433 | while (it.current()) { | 433 | while (it.current()) { |
434 | config()->writeEntry(it.currentKey(),*(it.current())); | 434 | config()->writeEntry(it.currentKey(),*(it.current())); |
435 | ++it; | 435 | ++it; |
436 | } | 436 | } |
437 | 437 | ||
438 | 438 | ||
439 | KPimPrefs::usrWriteConfig(); | 439 | KPimPrefs::usrWriteConfig(); |
440 | } | 440 | } |
441 | 441 | ||
442 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 442 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
443 | { | 443 | { |
444 | mCategoryColors.replace(cat,new QColor(color)); | 444 | mCategoryColors.replace(cat,new QColor(color)); |
445 | } | 445 | } |
446 | 446 | ||
447 | QColor *KOPrefs::categoryColor(QString cat) | 447 | QColor *KOPrefs::categoryColor(QString cat) |
448 | { | 448 | { |
449 | QColor *color = 0; | 449 | QColor *color = 0; |
450 | 450 | ||
451 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 451 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
452 | 452 | ||
453 | if (color) return color; | 453 | if (color) return color; |
454 | else return &mDefaultCategoryColor; | 454 | else return &mDefaultCategoryColor; |
455 | } | 455 | } |
456 | 456 | ||
457 | void KOPrefs::setFullName(const QString &name) | 457 | void KOPrefs::setFullName(const QString &name) |
458 | { | 458 | { |
459 | mName = name; | 459 | mName = name; |
460 | } | 460 | } |
461 | 461 | ||
462 | void KOPrefs::setEmail(const QString &email) | 462 | void KOPrefs::setEmail(const QString &email) |
463 | { | 463 | { |
464 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 464 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
465 | mEmail = email; | 465 | mEmail = email; |
466 | } | 466 | } |
467 | 467 | ||
468 | QString KOPrefs::fullName() | 468 | QString KOPrefs::fullName() |
469 | { | 469 | { |
470 | if (mEmailControlCenter) { | 470 | if (mEmailControlCenter) { |
471 | KEMailSettings settings; | 471 | KEMailSettings settings; |
472 | return settings.getSetting(KEMailSettings::RealName); | 472 | return settings.getSetting(KEMailSettings::RealName); |
473 | } else { | 473 | } else { |
474 | return mName; | 474 | return mName; |
475 | } | 475 | } |
476 | } | 476 | } |
477 | 477 | ||