summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefs.cpp381
1 files changed, 1 insertions, 380 deletions
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index 6484c45..c0200ff 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -65,281 +65,21 @@ KOPrefs::KOPrefs() :
65 65
66 KPrefs::setCurrentGroup("Fonts"); 66 KPrefs::setCurrentGroup("Fonts");
67 addItemFont("Application Font",&mAppFont); 67 addItemFont("Application Font",&mAppFont);
68 addItemFont("Compose Font",&mComposeFont); 68 addItemFont("Compose Font",&mComposeFont);
69 addItemFont("Read Font",&mReadFont); 69 addItemFont("Read Font",&mReadFont);
70 70
71#if 0
72 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
73 mDefaultViewFont = QFont("helvetica",10);
74 mDefaultMonthViewFont = QFont("helvetica",8);
75 mMarcusBainsFont= QFont("helvetica",10);
76 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
77 mEditBoxFont = QFont("helvetica",12);
78 mJornalViewFont = QFont("helvetica",12);
79
80 KPrefs::setCurrentGroup("General");
81 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
82
83 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
84 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
85 addItemBool("ShowIconSearch",&mShowIconSearch,true);
86 addItemBool("ShowIconList",&mShowIconList,true);
87 addItemBool("ShowIconDay1",&mShowIconDay1,true);
88 addItemBool("ShowIconDay5",&mShowIconDay5,true);
89 addItemBool("ShowIconDay7",&mShowIconDay7,true);
90 addItemBool("ShowIconMonth",&mShowIconMonth,true);
91 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
92 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
93 addItemBool("ShowIconBack",&mShowIconBack,true);
94 addItemBool("ShowIconToday",&mShowIconToday,true);
95 addItemBool("ShowIconForward",&mShowIconForward,true);
96 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
97 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
98 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
99 addItemBool("ShowIconNext",&mShowIconNext,true);
100 addItemBool("ShowIconJournal",&mShowIconJournal,true);
101 addItemBool("ShowIconStretch",&mShowIconStretch,true);
102 addItemBool("LanguageChanged",&mLanguageChanged,false);
103
104 addItemBool("AskForQuit",&mAskForQuit,false);
105
106#ifndef DESKTOP_VERSION
107 addItemBool("ShowFullMenu",&mShowFullMenu,false);
108#else
109 addItemBool("ShowFullMenu",&mShowFullMenu,true);
110#endif
111 addItemBool("ToolBarHor",&mToolBarHor, true );
112 addItemBool("ToolBarUp",&mToolBarUp, false );
113 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
114 addItemInt("Whats Next Days",&mWhatsNextDays,3);
115 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
116
117 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
118 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
119 addItemInt("AllDay Size",&mAllDaySize,28);
120 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
121 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
122
123 addItemStringList("LocationDefaults",&mLocationDefaults );
124 addItemStringList("EventSummary User",&mEventSummaryUser);
125 addItemStringList("TodoSummary User",&mTodoSummaryUser);
126
127 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
128 addItemBool("Enable Project View",&mEnableProjectView,false);
129 addItemBool("Auto Save",&mAutoSave,false);
130 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
131 addItemBool("Confirm Deletes",&mConfirm,true);
132 addItemString("Archive File",&mArchiveFile);
133 addItemString("Html Export File",&mHtmlExportFile,
134 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
135 addItemBool("Html With Save",&mHtmlWithSave,false);
136
137 KPrefs::setCurrentGroup("Personal Settings");
138
139 addItemInt("Mail Client",&mMailClient,MailClientKMail);
140 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
141 addItemBool("Bcc",&mBcc,false);
142
143 KPrefs::setCurrentGroup("Time & Date");
144
145 // addItemString("Time Zone",&mTimeZone,"+0100");
146 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
147 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
148 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
149 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
150 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
151
152
153 addItemInt("Default Start Time",&mStartTime,10);
154 addItemInt("Default Duration",&mDefaultDuration,2);
155 addItemInt("Default Alarm Time",&mAlarmTime,3);
156 addItemInt("Daylight Savings",&mDaylightSavings,0);
157 KPrefs::setCurrentGroup("AlarmSettings");
158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
162
163
164 KPrefs::setCurrentGroup("Calendar");
165
166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
167
168 KPrefs::setCurrentGroup("Fonts");
169 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
170 addItemFont("TimeBar Font",&mTimeBarFont);
171 addItemFont("MonthView Font",&mMonthViewFont);
172 addItemFont("AgendaView Font",&mAgendaViewFont);
173 addItemFont("MarcusBains Font",&mMarcusBainsFont);
174 addItemFont("TimeLabels Font",&mTimeLabelsFont);
175 addItemFont("TodoView Font",&mTodoViewFont);
176 addItemFont("ListView Font",&mListViewFont);
177 addItemFont("DateNavigator Font",&mDateNavigatorFont);
178 addItemFont("EditBox Font",&mEditBoxFont);
179 addItemFont("JournalView Font",&mJornalViewFont);
180 addItemFont("WhatsNextView Font",&mWhatsNextFont);
181 addItemFont("EventView Font",&mEventViewFont);
182
183// KPrefs::setCurrentGroup("SyncProfiles");
184// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
185// addItemStringList("SyncProfileNames",&mSyncProfileNames);
186// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
187
188 KPrefs::setCurrentGroup("RemoteSyncing");
189// addItemBool("UsePasswd",&mUsePassWd,false);
190// addItemBool("WriteBackFile",&mWriteBackFile,true);
191// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
192// addItemBool("AskForPreferences",&mAskForPreferences,true);
193// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
194 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
195 addItemInt("LastSyncTime",&mLastSyncTime,0);
196 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
197 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
198
199#ifdef _WIN32_
200 QString hdp= locateLocal("data","korganizer")+"\\\\";
201#else
202 QString hdp= locateLocal("data","korganizer")+"/";
203#endif
204// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
205// addItemString("RemoteUser",&mRemoteUser, "zaurus");
206// addItemString("RemotePassWd",&mRemotePassWd, "");
207// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
208// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
209
210
211 KPrefs::setCurrentGroup("LoadSaveFileNames");
212
213 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
214 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
215 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
216 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
217 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
218
219
220 KPrefs::setCurrentGroup("Locale");
221 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
222 addItemInt("PreferredTime",&mPreferredTime,0);
223 addItemInt("PreferredDate",&mPreferredDate,0);
224 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
225 addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
226 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
227 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
228 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
229
230
231 KPrefs::setCurrentGroup("Colors");
232 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
233 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
234 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
235 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
236 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
237 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
238 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
239 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
240 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
241 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
242 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
243 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
244 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
245 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
246 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
247 addItemBool("UseAppColors",&mUseAppColors,false);
248
249
250
251 KPrefs::setCurrentGroup("Views");
252 addItemInt("Hour Size",&mHourSize,8);
253 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
254 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
255 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
256 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
257 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
258 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
259 addItemBool("Enable ToolTips",&mEnableToolTips,false);
260 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
261 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
262 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
263 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
264 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
265 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
266 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
267 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
268 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
269 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
270 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
271 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
272 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
273 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
274 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
275 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
276 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
277 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
278#ifdef DESKTOP_VERSION
279 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
280#else
281 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
282#endif
283 addItemInt("Day Begins",&mDayBegins,7);
284 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
285 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
286 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
287 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
288
289 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
290 addItemBool("Full View Month",&mFullViewMonth,true);
291 addItemBool("Full View Todo",&mFullViewTodo,true);
292 addItemBool("Quick Todo",&mEnableQuickTodo,false);
293
294 addItemInt("Next X Days",&mNextXDays,3);
295
296 KPrefs::setCurrentGroup("Printer");
297
298 KPrefs::setCurrentGroup("Layout");
299
300 addItemBool("CompactDialogs",&mCompactDialogs,false);
301 addItemBool("VerticalScreen",&mVerticalScreen,true);
302
303 KPrefs::setCurrentGroup("KOrganizer Plugins");
304
305 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
306
307 KPrefs::setCurrentGroup("Group Scheduling");
308
309 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
310 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
311 addItemStringList("AdditionalMails",&mAdditionalMails,"");
312 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
313 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
314 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
315 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
316 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
317
318 KPrefs::setCurrentGroup( "Editors" );
319
320 addItemStringList( "EventTemplates", &mEventTemplates );
321 addItemStringList( "TodoTemplates", &mTodoTemplates );
322
323 addItemInt("DestinationPolicy",&mDestination,standardDestination);
324
325#endif
326 71
327} 72}
328 73
329 74
330KOPrefs::~KOPrefs() 75KOPrefs::~KOPrefs()
331{ 76{
332 if (mInstance == this) 77 if (mInstance == this)
333 mInstance = insd.setObject(0); 78 mInstance = insd.setObject(0);
334#if 0 79
335 setLocaleDict( 0 );
336 if ( mLocaleDict )
337 delete mLocaleDict;
338 //qDebug("KOPrefs::~KOPrefs() ");
339#endif
340} 80}
341 81
342 82
343KOPrefs *KOPrefs::instance() 83KOPrefs *KOPrefs::instance()
344{ 84{
345 if (!mInstance) { 85 if (!mInstance) {
@@ -366,139 +106,20 @@ void KOPrefs::setTimeZoneIdDefault()
366 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); 106 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
367} 107}
368 108
369 109
370void KOPrefs::usrReadConfig() 110void KOPrefs::usrReadConfig()
371{ 111{
372#if 0
373 mLocaleDict = 0;
374 // pending LR fix translation
375 // qDebug("KOPrefs::usrReadConfig() fix translation ");
376 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) {
377 if ( mPreferredLanguage == 1 ) {
378 mLocaleDict = new QDict<QString>;
379 int i = 0;
380 QString fw ( germanwords[i] [0]);
381 while ( !fw.isEmpty() ) {
382 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
383 ++i;
384 fw = germanwords[i] [0];
385 }
386
387 setLocaleDict( mLocaleDict );
388 } else {
389 QString fileName ;
390 if ( mPreferredLanguage == 3 )
391 fileName = MainWindow::resourcePath()+"usertranslation.txt";
392 else if ( mPreferredLanguage == 2 )
393 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
394 QFile file( fileName );
395 if (file.open( IO_ReadOnly ) ) {
396 QTextStream ts( &file );
397 ts.setEncoding( QTextStream::Latin1 );
398 //ts.setCodec( QTextCodec::latin1 );
399 QString text = ts.read();
400 file.close();
401 text.replace( QRegExp("\\\\n"), "\n" );
402 QString line;
403 QString we;
404 QString wt;
405 int br = 0;
406 int nbr;
407 nbr = text.find ( "},", br );
408 line = text.mid( br, nbr - br );
409 br = nbr+1;
410 int se, ee, st, et;
411 mLocaleDict = new QDict<QString>;
412 QString end = "{ \"\",\"\" }";
413 while ( (line != end) && (br > 1) ) {
414 //qDebug("%d *%s* ", br, line.latin1());
415 se = line.find("\"")+1;
416 et = line.findRev("\"",-1);
417 ee = line.find("\",\"");
418 st = ee+3;
419 we = line.mid( se, ee-se );
420 wt = line.mid( st, et-st );
421 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
422 mLocaleDict->insert( we, new QString (wt) );
423 nbr = text.find ( "}", br );
424 line = text.mid( br, nbr - br );
425 br = nbr+1;
426 }
427 //qDebug("end *%s* ", end.latin1());
428
429 setLocaleDict( mLocaleDict );
430 } else {
431 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
432 }
433
434 }
435 }
436 config()->setGroup("General");
437
438 mCustomCategories = config()->readListEntry("Custom Categories");
439 if ( KOPrefs::instance()->mLanguageChanged ) {
440 mLocationDefaults.clear();
441 mEventSummaryUser.clear();
442 mTodoSummaryUser.clear();
443 }
444 if (mLocationDefaults.isEmpty()) {
445 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
446 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
447 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
448 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
449 mLocationDefaults.sort();
450 }
451
452 if (mEventSummaryUser.isEmpty()) {
453 mEventSummaryUser = getDefaultList() ;
454 }
455 if (mTodoSummaryUser.isEmpty()) {
456 mTodoSummaryUser = getDefaultList() ;
457 }
458
459 if (mCustomCategories.isEmpty()) setCategoryDefaults();
460
461 config()->setGroup("Personal Settings");
462 mName = config()->readEntry("user_name","");
463 mEmail = config()->readEntry("user_email","");
464 fillMailDefaults();
465 112
466 config()->setGroup("Category Colors");
467 QStringList::Iterator it;
468 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
469 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
470
471 }
472
473 if (mTimeZoneId.isEmpty()) {
474 setTimeZoneIdDefault();
475 }
476#endif
477 KPimPrefs::usrReadConfig(); 113 KPimPrefs::usrReadConfig();
478} 114}
479 115
480 116
481void KOPrefs::usrWriteConfig() 117void KOPrefs::usrWriteConfig()
482{ 118{
483#if 0
484 config()->setGroup("General");
485 config()->writeEntry("Custom Categories",mCustomCategories);
486
487 config()->setGroup("Personal Settings");
488 config()->writeEntry("user_name",mName);
489 config()->writeEntry("user_email",mEmail);
490 119
491 config()->setGroup("Category Colors");
492 QDictIterator<QColor> it(mCategoryColors);
493 while (it.current()) {
494 config()->writeEntry(it.currentKey(),*(it.current()));
495 ++it;
496 }
497
498#endif
499 KPimPrefs::usrWriteConfig(); 120 KPimPrefs::usrWriteConfig();
500} 121}
501 122
502 123
503 124
504KConfig* KOPrefs::getConfig() 125KConfig* KOPrefs::getConfig()