summaryrefslogtreecommitdiffabout
path: root/kmicromail/koprefs.cpp~
authorzautrix <zautrix>2004-09-15 06:19:37 (UTC)
committer zautrix <zautrix>2004-09-15 06:19:37 (UTC)
commit29059299ec9c8705de675b8f70d11c810e4e22a7 (patch) (unidiff)
tree1fba15031b826404cd4692f5b4d45649a292beb0 /kmicromail/koprefs.cpp~
parent35b8948c6c203473866c74f1d13185a848454e04 (diff)
downloadkdepimpi-29059299ec9c8705de675b8f70d11c810e4e22a7.zip
kdepimpi-29059299ec9c8705de675b8f70d11c810e4e22a7.tar.gz
kdepimpi-29059299ec9c8705de675b8f70d11c810e4e22a7.tar.bz2
grumpf
Diffstat (limited to 'kmicromail/koprefs.cpp~') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefs.cpp~568
1 files changed, 0 insertions, 568 deletions
diff --git a/kmicromail/koprefs.cpp~ b/kmicromail/koprefs.cpp~
deleted file mode 100644
index dd978bf..0000000
--- a/kmicromail/koprefs.cpp~
+++ b/dev/null
@@ -1,568 +0,0 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24#include <time.h>
25#ifndef _WIN32_
26#include <unistd.h>
27#endif
28#include <qdir.h>
29#include <qtextstream.h>
30#include <qtextcodec.h>
31#include <qstring.h>
32#include <qregexp.h>
33#include <qfont.h>
34#include <qcolor.h>
35#include <qstringlist.h>
36#include <stdlib.h>
37
38#include <kglobal.h>
39#include <kconfig.h>
40#include <klocale.h>
41#include <kdebug.h>
42#include <kemailsettings.h>
43#include <kstaticdeleter.h>
44
45#include "koprefs.h"
46#include "mainwindow.h"
47
48const char *germanwords[][2] = {
49#include "wordsgerman.h"
50 "", ""
51};
52
53KOPrefs *KOPrefs::mInstance = 0;
54static KStaticDeleter<KOPrefs> insd;
55
56KOPrefs::KOPrefs() :
57 KPimPrefs("korganizerrc")
58{
59 mCategoryColors.setAutoDelete(true);
60 mLocaleDict = 0;
61 fillMailDefaults();
62 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
63 QColor defaultHolidayColor = QColor(255,0,0);
64 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
65 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
66 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
67 QColor defaultTodoDueTodayColor = QColor(255,220,100);
68 QColor defaultTodoOverdueColor = QColor(255,153,125);
69
70 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
71 mDefaultViewFont = QFont("helvetica",10);
72 mDefaultMonthViewFont = QFont("helvetica",8);
73 mMarcusBainsFont= QFont("helvetica",10);
74 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
75 mEditBoxFont = QFont("helvetica",12);
76 mJornalViewFont = QFont("helvetica",12);
77
78 KPrefs::setCurrentGroup("General");
79 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
80
81 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
82 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
83 addItemBool("ShowIconSearch",&mShowIconSearch,true);
84 addItemBool("ShowIconList",&mShowIconList,true);
85 addItemBool("ShowIconDay1",&mShowIconDay1,true);
86 addItemBool("ShowIconDay5",&mShowIconDay5,true);
87 addItemBool("ShowIconDay7",&mShowIconDay7,true);
88 addItemBool("ShowIconMonth",&mShowIconMonth,true);
89 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
90 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
91 addItemBool("ShowIconBack",&mShowIconBack,true);
92 addItemBool("ShowIconToday",&mShowIconToday,true);
93 addItemBool("ShowIconForward",&mShowIconForward,true);
94 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
95 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
96 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
97 addItemBool("ShowIconNext",&mShowIconNext,true);
98 addItemBool("ShowIconJournal",&mShowIconJournal,true);
99 addItemBool("ShowIconStretch",&mShowIconStretch,true);
100 addItemBool("LanguageChanged",&mLanguageChanged,false);
101
102 addItemBool("AskForQuit",&mAskForQuit,false);
103
104#ifndef DESKTOP_VERSION
105 addItemBool("ShowFullMenu",&mShowFullMenu,false);
106#else
107 addItemBool("ShowFullMenu",&mShowFullMenu,true);
108#endif
109 addItemBool("ToolBarHor",&mToolBarHor, true );
110 addItemBool("ToolBarUp",&mToolBarUp, false );
111 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
112 addItemInt("Whats Next Days",&mWhatsNextDays,3);
113 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
114
115 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
116 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
117 addItemInt("AllDay Size",&mAllDaySize,28);
118 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
119 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
120
121 addItemStringList("LocationDefaults",&mLocationDefaults );
122 addItemStringList("EventSummary User",&mEventSummaryUser);
123 addItemStringList("TodoSummary User",&mTodoSummaryUser);
124
125 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
126 addItemBool("Enable Project View",&mEnableProjectView,false);
127 addItemBool("Auto Save",&mAutoSave,false);
128 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
129 addItemBool("Confirm Deletes",&mConfirm,true);
130 addItemString("Archive File",&mArchiveFile);
131 addItemString("Html Export File",&mHtmlExportFile,
132 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
133 addItemBool("Html With Save",&mHtmlWithSave,false);
134
135 KPrefs::setCurrentGroup("Personal Settings");
136
137 addItemInt("Mail Client",&mMailClient,MailClientKMail);
138 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
139 addItemBool("Bcc",&mBcc,false);
140
141 KPrefs::setCurrentGroup("Time & Date");
142
143 // addItemString("Time Zone",&mTimeZone,"+0100");
144 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
145 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
146 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
147 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
148 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
149
150
151 addItemInt("Default Start Time",&mStartTime,10);
152 addItemInt("Default Duration",&mDefaultDuration,2);
153 addItemInt("Default Alarm Time",&mAlarmTime,3);
154 addItemInt("Daylight Savings",&mDaylightSavings,0);
155 KPrefs::setCurrentGroup("AlarmSettings");
156 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
157 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
158 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
159 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
160
161
162 KPrefs::setCurrentGroup("Calendar");
163
164 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
165
166 KPrefs::setCurrentGroup("Fonts");
167 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
168 addItemFont("TimeBar Font",&mTimeBarFont);
169 addItemFont("MonthView Font",&mMonthViewFont);
170 addItemFont("AgendaView Font",&mAgendaViewFont);
171 addItemFont("MarcusBains Font",&mMarcusBainsFont);
172 addItemFont("TimeLabels Font",&mTimeLabelsFont);
173 addItemFont("TodoView Font",&mTodoViewFont);
174 addItemFont("ListView Font",&mListViewFont);
175 addItemFont("DateNavigator Font",&mDateNavigatorFont);
176 addItemFont("EditBox Font",&mEditBoxFont);
177 addItemFont("JournalView Font",&mJornalViewFont);
178 addItemFont("WhatsNextView Font",&mWhatsNextFont);
179 addItemFont("EventView Font",&mEventViewFont);
180
181// KPrefs::setCurrentGroup("SyncProfiles");
182// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
183// addItemStringList("SyncProfileNames",&mSyncProfileNames);
184// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
185
186 KPrefs::setCurrentGroup("RemoteSyncing");
187// addItemBool("UsePasswd",&mUsePassWd,false);
188// addItemBool("WriteBackFile",&mWriteBackFile,true);
189// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
190// addItemBool("AskForPreferences",&mAskForPreferences,true);
191// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
192 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
193 addItemInt("LastSyncTime",&mLastSyncTime,0);
194 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
195 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
196
197#ifdef _WIN32_
198 QString hdp= locateLocal("data","korganizer")+"\\\\";
199#else
200 QString hdp= locateLocal("data","korganizer")+"/";
201#endif
202// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
203// addItemString("RemoteUser",&mRemoteUser, "zaurus");
204// addItemString("RemotePassWd",&mRemotePassWd, "");
205// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
206// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
207
208
209 KPrefs::setCurrentGroup("LoadSaveFileNames");
210
211 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
212 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
213 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
214 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
215 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
216
217
218 KPrefs::setCurrentGroup("Locale");
219 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
220 addItemInt("PreferredTime",&mPreferredTime,0);
221 addItemInt("PreferredDate",&mPreferredDate,0);
222 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
223 addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
224 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
225 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
226 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
227
228
229 KPrefs::setCurrentGroup("Colors");
230 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
231 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
232 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
233 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
234 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
235 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
236 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
237 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
238 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
239 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
240 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
241 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
242 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
243 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
244 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
245 addItemBool("UseAppColors",&mUseAppColors,false);
246
247
248
249 KPrefs::setCurrentGroup("Views");
250 addItemInt("Hour Size",&mHourSize,8);
251 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
252 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
253 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
254 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
255 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
256 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
257 addItemBool("Enable ToolTips",&mEnableToolTips,false);
258 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
259 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
260 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
261 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
262 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
263 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
264 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
265 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
266 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
267 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
268 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
269 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
270 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
271 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
272 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
273 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
274 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
275 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
276#ifdef DESKTOP_VERSION
277 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
278#else
279 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
280#endif
281 addItemInt("Day Begins",&mDayBegins,7);
282 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
283 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
284 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
285 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
286
287 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
288 addItemBool("Full View Month",&mFullViewMonth,true);
289 addItemBool("Full View Todo",&mFullViewTodo,true);
290 addItemBool("Quick Todo",&mEnableQuickTodo,false);
291
292 addItemInt("Next X Days",&mNextXDays,3);
293
294 KPrefs::setCurrentGroup("Printer");
295
296 KPrefs::setCurrentGroup("Layout");
297
298 addItemBool("CompactDialogs",&mCompactDialogs,false);
299 addItemBool("VerticalScreen",&mVerticalScreen,true);
300
301 KPrefs::setCurrentGroup("KOrganizer Plugins");
302
303 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
304
305 KPrefs::setCurrentGroup("Group Scheduling");
306
307 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
308 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
309 addItemStringList("AdditionalMails",&mAdditionalMails,"");
310 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
311 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
312 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
313 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
314 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
315
316 KPrefs::setCurrentGroup( "Editors" );
317
318 addItemStringList( "EventTemplates", &mEventTemplates );
319 addItemStringList( "TodoTemplates", &mTodoTemplates );
320
321 addItemInt("DestinationPolicy",&mDestination,standardDestination);
322
323
324
325}
326
327
328KOPrefs::~KOPrefs()
329{
330 if (mInstance == this)
331 mInstance = insd.setObject(0);
332 setLocaleDict( 0 );
333 if ( mLocaleDict )
334 delete mLocaleDict;
335 //qDebug("KOPrefs::~KOPrefs() ");
336}
337
338
339KOPrefs *KOPrefs::instance()
340{
341 if (!mInstance) {
342 mInstance = insd.setObject(new KOPrefs());
343 mInstance->readConfig();
344 }
345
346 return mInstance;
347}
348
349void KOPrefs::usrSetDefaults()
350{
351
352}
353
354void KOPrefs::fillMailDefaults()
355{
356 if (mName.isEmpty()) mName = i18n("Anonymous");
357 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
358}
359
360void KOPrefs::setTimeZoneIdDefault()
361{
362 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
363}
364
365void KOPrefs::setCategoryDefaults()
366{
367 mCustomCategories.clear();
368 mCustomCategories = getDefaultList();
369
370 QStringList::Iterator it;
371 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
372 setCategoryColor(*it,mDefaultCategoryColor);
373 }
374}
375
376QStringList KOPrefs::getDefaultList()
377{
378 QStringList retval ;
379 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
380 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
381 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
382 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
383 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
384 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
385 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
386 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
387 retval.sort();
388 return retval;
389}
390
391void KOPrefs::usrReadConfig()
392{
393 mLocaleDict = 0;
394 // pending LR fix translation
395 // qDebug("KOPrefs::usrReadConfig() fix translation ");
396 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) {
397 if ( mPreferredLanguage == 1 ) {
398 mLocaleDict = new QDict<QString>;
399 int i = 0;
400 QString fw ( germanwords[i] [0]);
401 while ( !fw.isEmpty() ) {
402 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
403 ++i;
404 fw = germanwords[i] [0];
405 }
406
407 setLocaleDict( mLocaleDict );
408 } else {
409 QString fileName ;
410 if ( mPreferredLanguage == 3 )
411 fileName = MainWindow::resourcePath()+"usertranslation.txt";
412 else if ( mPreferredLanguage == 2 )
413 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
414 QFile file( fileName );
415 if (file.open( IO_ReadOnly ) ) {
416 QTextStream ts( &file );
417 ts.setEncoding( QTextStream::Latin1 );
418 //ts.setCodec( QTextCodec::latin1 );
419 QString text = ts.read();
420 file.close();
421 text.replace( QRegExp("\\\\n"), "\n" );
422 QString line;
423 QString we;
424 QString wt;
425 int br = 0;
426 int nbr;
427 nbr = text.find ( "},", br );
428 line = text.mid( br, nbr - br );
429 br = nbr+1;
430 int se, ee, st, et;
431 mLocaleDict = new QDict<QString>;
432 QString end = "{ \"\",\"\" }";
433 while ( (line != end) && (br > 1) ) {
434 //qDebug("%d *%s* ", br, line.latin1());
435 se = line.find("\"")+1;
436 et = line.findRev("\"",-1);
437 ee = line.find("\",\"");
438 st = ee+3;
439 we = line.mid( se, ee-se );
440 wt = line.mid( st, et-st );
441 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
442 mLocaleDict->insert( we, new QString (wt) );
443 nbr = text.find ( "}", br );
444 line = text.mid( br, nbr - br );
445 br = nbr+1;
446 }
447 //qDebug("end *%s* ", end.latin1());
448
449 setLocaleDict( mLocaleDict );
450 } else {
451 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
452 }
453
454 }
455 }
456 config()->setGroup("General");
457
458 mCustomCategories = config()->readListEntry("Custom Categories");
459 if ( KOPrefs::instance()->mLanguageChanged ) {
460 mLocationDefaults.clear();
461 mEventSummaryUser.clear();
462 mTodoSummaryUser.clear();
463 }
464 if (mLocationDefaults.isEmpty()) {
465 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
466 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
467 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
468 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
469 mLocationDefaults.sort();
470 }
471
472 if (mEventSummaryUser.isEmpty()) {
473 mEventSummaryUser = getDefaultList() ;
474 }
475 if (mTodoSummaryUser.isEmpty()) {
476 mTodoSummaryUser = getDefaultList() ;
477 }
478
479 if (mCustomCategories.isEmpty()) setCategoryDefaults();
480
481 config()->setGroup("Personal Settings");
482 mName = config()->readEntry("user_name","");
483 mEmail = config()->readEntry("user_email","");
484 fillMailDefaults();
485
486 config()->setGroup("Category Colors");
487 QStringList::Iterator it;
488 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
489 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
490
491 }
492
493 if (mTimeZoneId.isEmpty()) {
494 setTimeZoneIdDefault();
495 }
496 KPimPrefs::usrReadConfig();
497}
498
499
500void KOPrefs::usrWriteConfig()
501{
502 config()->setGroup("General");
503 config()->writeEntry("Custom Categories",mCustomCategories);
504
505 config()->setGroup("Personal Settings");
506 config()->writeEntry("user_name",mName);
507 config()->writeEntry("user_email",mEmail);
508
509 config()->setGroup("Category Colors");
510 QDictIterator<QColor> it(mCategoryColors);
511 while (it.current()) {
512 config()->writeEntry(it.currentKey(),*(it.current()));
513 ++it;
514 }
515
516
517 KPimPrefs::usrWriteConfig();
518}
519
520void KOPrefs::setCategoryColor(QString cat,const QColor & color)
521{
522 mCategoryColors.replace(cat,new QColor(color));
523}
524
525QColor *KOPrefs::categoryColor(QString cat)
526{
527 QColor *color = 0;
528
529 if (!cat.isEmpty()) color = mCategoryColors[cat];
530
531 if (color) return color;
532 else return &mDefaultCategoryColor;
533}
534
535void KOPrefs::setFullName(const QString &name)
536{
537 mName = name;
538}
539
540void KOPrefs::setEmail(const QString &email)
541{
542 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
543 mEmail = email;
544}
545
546QString KOPrefs::fullName()
547{
548 if (mEmailControlCenter) {
549 KEMailSettings settings;
550 return settings.getSetting(KEMailSettings::RealName);
551 } else {
552 return mName;
553 }
554}
555
556QString KOPrefs::email()
557{
558 if (mEmailControlCenter) {
559 KEMailSettings settings;
560 return settings.getSetting(KEMailSettings::EmailAddress);
561 } else {
562 return mEmail;
563 }
564}
565KConfig* KOPrefs::getConfig()
566{
567 return config();
568}