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