-rw-r--r-- | korganizer/koprefs.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index ea5aaa1..9366c11 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -266,192 +266,193 @@ KOPrefs::KOPrefs() : | |||
266 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 266 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
267 | 267 | ||
268 | addItemInt("Next X Days",&mNextXDays,3); | 268 | addItemInt("Next X Days",&mNextXDays,3); |
269 | 269 | ||
270 | KPrefs::setCurrentGroup("Printer"); | 270 | KPrefs::setCurrentGroup("Printer"); |
271 | 271 | ||
272 | KPrefs::setCurrentGroup("Layout"); | 272 | KPrefs::setCurrentGroup("Layout"); |
273 | 273 | ||
274 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 274 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
275 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 275 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
276 | 276 | ||
277 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 277 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
278 | 278 | ||
279 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 279 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
280 | 280 | ||
281 | KPrefs::setCurrentGroup("Group Scheduling"); | 281 | KPrefs::setCurrentGroup("Group Scheduling"); |
282 | 282 | ||
283 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 283 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
284 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 284 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
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::setCategoryDefaults() | 339 | void KOPrefs::setCategoryDefaults() |
340 | { | 340 | { |
341 | mCustomCategories.clear(); | 341 | mCustomCategories.clear(); |
342 | mCustomCategories = getDefaultList(); | 342 | mCustomCategories = getDefaultList(); |
343 | 343 | ||
344 | QStringList::Iterator it; | 344 | QStringList::Iterator it; |
345 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 345 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
346 | setCategoryColor(*it,mDefaultCategoryColor); | 346 | setCategoryColor(*it,mDefaultCategoryColor); |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | QStringList KOPrefs::getDefaultList() | 350 | QStringList KOPrefs::getDefaultList() |
351 | { | 351 | { |
352 | QStringList retval ; | 352 | QStringList retval ; |
353 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 353 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
354 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 354 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
355 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 355 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
356 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 356 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
357 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 357 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
358 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 358 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
359 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 359 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
360 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 360 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
361 | retval.sort(); | 361 | retval.sort(); |
362 | //qDebug("cat %s ", retval.join("-").latin1()); | ||
362 | return retval; | 363 | return retval; |
363 | } | 364 | } |
364 | 365 | ||
365 | void KOPrefs::usrReadConfig() | 366 | void KOPrefs::usrReadConfig() |
366 | { | 367 | { |
367 | config()->setGroup("General"); | 368 | config()->setGroup("General"); |
368 | 369 | ||
369 | mCustomCategories = config()->readListEntry("Custom Categories"); | 370 | mCustomCategories = config()->readListEntry("Custom Categories"); |
370 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { | 371 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { |
371 | mLocationDefaults.clear(); | 372 | mLocationDefaults.clear(); |
372 | mEventSummaryUser.clear(); | 373 | mEventSummaryUser.clear(); |
373 | mTodoSummaryUser.clear(); | 374 | mTodoSummaryUser.clear(); |
374 | } | 375 | } |
375 | mOldLoadedLanguage = mOldLanguage ; | 376 | mOldLoadedLanguage = mOldLanguage ; |
376 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 377 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
377 | if (mLocationDefaults.isEmpty()) { | 378 | if (mLocationDefaults.isEmpty()) { |
378 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 379 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
379 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 380 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
380 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 381 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
381 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 382 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
382 | mLocationDefaults.sort(); | 383 | mLocationDefaults.sort(); |
383 | } | 384 | } |
384 | 385 | ||
385 | if (mEventSummaryUser.isEmpty()) { | 386 | if (mEventSummaryUser.isEmpty()) { |
386 | mEventSummaryUser = getDefaultList() ; | 387 | mEventSummaryUser = getDefaultList() ; |
387 | } | 388 | } |
388 | if (mTodoSummaryUser.isEmpty()) { | 389 | if (mTodoSummaryUser.isEmpty()) { |
389 | mTodoSummaryUser = getDefaultList() ; | 390 | mTodoSummaryUser = getDefaultList() ; |
390 | } | 391 | } |
391 | 392 | ||
392 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 393 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
393 | 394 | ||
394 | config()->setGroup("Personal Settings"); | 395 | config()->setGroup("Personal Settings"); |
395 | mName = config()->readEntry("user_name",""); | 396 | mName = config()->readEntry("user_name",""); |
396 | mEmail = config()->readEntry("user_email",""); | 397 | mEmail = config()->readEntry("user_email",""); |
397 | fillMailDefaults(); | 398 | fillMailDefaults(); |
398 | 399 | ||
399 | config()->setGroup("Category Colors"); | 400 | config()->setGroup("Category Colors"); |
400 | QStringList::Iterator it; | 401 | QStringList::Iterator it; |
401 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 402 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
402 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 403 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
403 | 404 | ||
404 | } | 405 | } |
405 | 406 | ||
406 | KPimPrefs::usrReadConfig(); | 407 | KPimPrefs::usrReadConfig(); |
407 | } | 408 | } |
408 | 409 | ||
409 | 410 | ||
410 | void KOPrefs::usrWriteConfig() | 411 | void KOPrefs::usrWriteConfig() |
411 | { | 412 | { |
412 | config()->setGroup("General"); | 413 | config()->setGroup("General"); |
413 | config()->writeEntry("Custom Categories",mCustomCategories); | 414 | config()->writeEntry("Custom Categories",mCustomCategories); |
414 | 415 | ||
415 | config()->setGroup("Personal Settings"); | 416 | config()->setGroup("Personal Settings"); |
416 | config()->writeEntry("user_name",mName); | 417 | config()->writeEntry("user_name",mName); |
417 | config()->writeEntry("user_email",mEmail); | 418 | config()->writeEntry("user_email",mEmail); |
418 | 419 | ||
419 | config()->setGroup("Category Colors"); | 420 | config()->setGroup("Category Colors"); |
420 | QDictIterator<QColor> it(mCategoryColors); | 421 | QDictIterator<QColor> it(mCategoryColors); |
421 | while (it.current()) { | 422 | while (it.current()) { |
422 | config()->writeEntry(it.currentKey(),*(it.current())); | 423 | config()->writeEntry(it.currentKey(),*(it.current())); |
423 | ++it; | 424 | ++it; |
424 | } | 425 | } |
425 | 426 | ||
426 | 427 | ||
427 | KPimPrefs::usrWriteConfig(); | 428 | KPimPrefs::usrWriteConfig(); |
428 | } | 429 | } |
429 | 430 | ||
430 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 431 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
431 | { | 432 | { |
432 | mCategoryColors.replace(cat,new QColor(color)); | 433 | mCategoryColors.replace(cat,new QColor(color)); |
433 | } | 434 | } |
434 | 435 | ||
435 | QColor *KOPrefs::categoryColor(QString cat) | 436 | QColor *KOPrefs::categoryColor(QString cat) |
436 | { | 437 | { |
437 | QColor *color = 0; | 438 | QColor *color = 0; |
438 | 439 | ||
439 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 440 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
440 | 441 | ||
441 | if (color) return color; | 442 | if (color) return color; |
442 | else return &mDefaultCategoryColor; | 443 | else return &mDefaultCategoryColor; |
443 | } | 444 | } |
444 | 445 | ||
445 | void KOPrefs::setFullName(const QString &name) | 446 | void KOPrefs::setFullName(const QString &name) |
446 | { | 447 | { |
447 | mName = name; | 448 | mName = name; |
448 | } | 449 | } |
449 | 450 | ||
450 | void KOPrefs::setEmail(const QString &email) | 451 | void KOPrefs::setEmail(const QString &email) |
451 | { | 452 | { |
452 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 453 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
453 | mEmail = email; | 454 | mEmail = email; |
454 | } | 455 | } |
455 | 456 | ||
456 | QString KOPrefs::fullName() | 457 | QString KOPrefs::fullName() |
457 | { | 458 | { |