author | zautrix <zautrix> | 2004-07-10 10:29:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-10 10:29:33 (UTC) |
commit | abac12317e02aa83579102d04a75e027e45ec667 (patch) (unidiff) | |
tree | 2348fa00a852184b4d0e6b6ab9e882918b8d0748 | |
parent | adaa664ac87d6b78e9431d3376f7a24461edf469 (diff) | |
download | kdepimpi-abac12317e02aa83579102d04a75e027e45ec667.zip kdepimpi-abac12317e02aa83579102d04a75e027e45ec667.tar.gz kdepimpi-abac12317e02aa83579102d04a75e027e45ec667.tar.bz2 |
Turned on internal alarm on dektop as default
-rw-r--r-- | korganizer/koprefs.cpp | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 2900a40..3ba5ab2 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,555 +1,559 @@ | |||
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 <qfont.h> | 32 | #include <qfont.h> |
33 | #include <qcolor.h> | 33 | #include <qcolor.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | 36 | ||
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kconfig.h> | 38 | #include <kconfig.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kdebug.h> | 40 | #include <kdebug.h> |
41 | #include <kemailsettings.h> | 41 | #include <kemailsettings.h> |
42 | #include <kstaticdeleter.h> | 42 | #include <kstaticdeleter.h> |
43 | 43 | ||
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "mainwindow.h" | 45 | #include "mainwindow.h" |
46 | 46 | ||
47 | const char *germanwords[][2] = { | 47 | const char *germanwords[][2] = { |
48 | #include "wordsgerman.h" | 48 | #include "wordsgerman.h" |
49 | "", "" | 49 | "", "" |
50 | }; | 50 | }; |
51 | 51 | ||
52 | KOPrefs *KOPrefs::mInstance = 0; | 52 | KOPrefs *KOPrefs::mInstance = 0; |
53 | static KStaticDeleter<KOPrefs> insd; | 53 | static KStaticDeleter<KOPrefs> insd; |
54 | 54 | ||
55 | KOPrefs::KOPrefs() : | 55 | KOPrefs::KOPrefs() : |
56 | KPimPrefs("korganizerrc") | 56 | KPimPrefs("korganizerrc") |
57 | { | 57 | { |
58 | mCategoryColors.setAutoDelete(true); | 58 | mCategoryColors.setAutoDelete(true); |
59 | mLocaleDict = 0; | 59 | mLocaleDict = 0; |
60 | fillMailDefaults(); | 60 | fillMailDefaults(); |
61 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 61 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
62 | QColor defaultHolidayColor = QColor(255,0,0); | 62 | QColor defaultHolidayColor = QColor(255,0,0); |
63 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 63 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
64 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 64 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
65 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 65 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
66 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 66 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
67 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 67 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
68 | 68 | ||
69 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | 69 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); |
70 | mDefaultViewFont = QFont("helvetica",10); | 70 | mDefaultViewFont = QFont("helvetica",10); |
71 | mDefaultMonthViewFont = QFont("helvetica",8); | 71 | mDefaultMonthViewFont = QFont("helvetica",8); |
72 | mMarcusBainsFont= QFont("helvetica",10); | 72 | mMarcusBainsFont= QFont("helvetica",10); |
73 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | 73 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); |
74 | mEditBoxFont = QFont("helvetica",12); | 74 | mEditBoxFont = QFont("helvetica",12); |
75 | mJornalViewFont = QFont("helvetica",12); | 75 | mJornalViewFont = QFont("helvetica",12); |
76 | 76 | ||
77 | KPrefs::setCurrentGroup("General"); | 77 | KPrefs::setCurrentGroup("General"); |
78 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 78 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
79 | 79 | ||
80 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 80 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
81 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 81 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
82 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 82 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
83 | addItemBool("ShowIconList",&mShowIconList,true); | 83 | addItemBool("ShowIconList",&mShowIconList,true); |
84 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 84 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
85 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 85 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
86 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 86 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
87 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 87 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
88 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 88 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
89 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 89 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
90 | addItemBool("ShowIconBack",&mShowIconBack,true); | 90 | addItemBool("ShowIconBack",&mShowIconBack,true); |
91 | addItemBool("ShowIconToday",&mShowIconToday,true); | 91 | addItemBool("ShowIconToday",&mShowIconToday,true); |
92 | addItemBool("ShowIconForward",&mShowIconForward,true); | 92 | addItemBool("ShowIconForward",&mShowIconForward,true); |
93 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 93 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
94 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); | 94 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); |
95 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 95 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
96 | addItemBool("ShowIconNext",&mShowIconNext,true); | 96 | addItemBool("ShowIconNext",&mShowIconNext,true); |
97 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 97 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
98 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 98 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
99 | addItemBool("LanguageChanged",&mLanguageChanged,false); | 99 | addItemBool("LanguageChanged",&mLanguageChanged,false); |
100 | 100 | ||
101 | addItemBool("AskForQuit",&mAskForQuit,false); | 101 | addItemBool("AskForQuit",&mAskForQuit,false); |
102 | 102 | ||
103 | #ifndef DESKTOP_VERSION | 103 | #ifndef DESKTOP_VERSION |
104 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 104 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
105 | #else | 105 | #else |
106 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 106 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
107 | #endif | 107 | #endif |
108 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 108 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
109 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 109 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
110 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 110 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
111 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 111 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
112 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 112 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
113 | 113 | ||
114 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 114 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
115 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 115 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
116 | addItemInt("AllDay Size",&mAllDaySize,28); | 116 | addItemInt("AllDay Size",&mAllDaySize,28); |
117 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 117 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
118 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 118 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
119 | 119 | ||
120 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 120 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
121 | addItemStringList("EventSummary User",&mEventSummaryUser); | 121 | addItemStringList("EventSummary User",&mEventSummaryUser); |
122 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 122 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
123 | 123 | ||
124 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 124 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
125 | addItemBool("Enable Project View",&mEnableProjectView,false); | 125 | addItemBool("Enable Project View",&mEnableProjectView,false); |
126 | addItemBool("Auto Save",&mAutoSave,false); | 126 | addItemBool("Auto Save",&mAutoSave,false); |
127 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 127 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
128 | addItemBool("Confirm Deletes",&mConfirm,true); | 128 | addItemBool("Confirm Deletes",&mConfirm,true); |
129 | addItemString("Archive File",&mArchiveFile); | 129 | addItemString("Archive File",&mArchiveFile); |
130 | addItemString("Html Export File",&mHtmlExportFile, | 130 | addItemString("Html Export File",&mHtmlExportFile, |
131 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 131 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
132 | addItemBool("Html With Save",&mHtmlWithSave,false); | 132 | addItemBool("Html With Save",&mHtmlWithSave,false); |
133 | 133 | ||
134 | KPrefs::setCurrentGroup("Personal Settings"); | 134 | KPrefs::setCurrentGroup("Personal Settings"); |
135 | 135 | ||
136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
138 | addItemBool("Bcc",&mBcc,false); | 138 | addItemBool("Bcc",&mBcc,false); |
139 | 139 | ||
140 | KPrefs::setCurrentGroup("Time & Date"); | 140 | KPrefs::setCurrentGroup("Time & Date"); |
141 | 141 | ||
142 | // addItemString("Time Zone",&mTimeZone,"+0100"); | 142 | // addItemString("Time Zone",&mTimeZone,"+0100"); |
143 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); | 143 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); |
144 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); | 144 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); |
145 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 145 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
146 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 146 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
147 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 147 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
148 | 148 | ||
149 | 149 | ||
150 | addItemInt("Default Start Time",&mStartTime,10); | 150 | addItemInt("Default Start Time",&mStartTime,10); |
151 | addItemInt("Default Duration",&mDefaultDuration,2); | 151 | addItemInt("Default Duration",&mDefaultDuration,2); |
152 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 152 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
153 | addItemInt("Daylight Savings",&mDaylightSavings,0); | 153 | addItemInt("Daylight Savings",&mDaylightSavings,0); |
154 | KPrefs::setCurrentGroup("AlarmSettings"); | 154 | KPrefs::setCurrentGroup("AlarmSettings"); |
155 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 155 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
156 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 156 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
157 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 157 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
158 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 158 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
159 | 159 | ||
160 | 160 | ||
161 | KPrefs::setCurrentGroup("Calendar"); | 161 | KPrefs::setCurrentGroup("Calendar"); |
162 | 162 | ||
163 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 163 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
164 | 164 | ||
165 | KPrefs::setCurrentGroup("Fonts"); | 165 | KPrefs::setCurrentGroup("Fonts"); |
166 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 166 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
167 | addItemFont("TimeBar Font",&mTimeBarFont); | 167 | addItemFont("TimeBar Font",&mTimeBarFont); |
168 | addItemFont("MonthView Font",&mMonthViewFont); | 168 | addItemFont("MonthView Font",&mMonthViewFont); |
169 | addItemFont("AgendaView Font",&mAgendaViewFont); | 169 | addItemFont("AgendaView Font",&mAgendaViewFont); |
170 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 170 | addItemFont("MarcusBains Font",&mMarcusBainsFont); |
171 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 171 | addItemFont("TimeLabels Font",&mTimeLabelsFont); |
172 | addItemFont("TodoView Font",&mTodoViewFont); | 172 | addItemFont("TodoView Font",&mTodoViewFont); |
173 | addItemFont("ListView Font",&mListViewFont); | 173 | addItemFont("ListView Font",&mListViewFont); |
174 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 174 | addItemFont("DateNavigator Font",&mDateNavigatorFont); |
175 | addItemFont("EditBox Font",&mEditBoxFont); | 175 | addItemFont("EditBox Font",&mEditBoxFont); |
176 | addItemFont("JournalView Font",&mJornalViewFont); | 176 | addItemFont("JournalView Font",&mJornalViewFont); |
177 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 177 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
178 | addItemFont("EventView Font",&mEventViewFont); | 178 | addItemFont("EventView Font",&mEventViewFont); |
179 | 179 | ||
180 | KPrefs::setCurrentGroup("SyncProfiles"); | 180 | KPrefs::setCurrentGroup("SyncProfiles"); |
181 | addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | 181 | addItemString("LocalMachineName",&mLocalMachineName, "undefined"); |
182 | addItemStringList("SyncProfileNames",&mSyncProfileNames); | 182 | addItemStringList("SyncProfileNames",&mSyncProfileNames); |
183 | 183 | ||
184 | KPrefs::setCurrentGroup("RemoteSyncing"); | 184 | KPrefs::setCurrentGroup("RemoteSyncing"); |
185 | addItemBool("UsePasswd",&mUsePassWd,false); | 185 | addItemBool("UsePasswd",&mUsePassWd,false); |
186 | addItemBool("WriteBackFile",&mWriteBackFile,true); | 186 | addItemBool("WriteBackFile",&mWriteBackFile,true); |
187 | addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | 187 | addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); |
188 | addItemBool("AskForPreferences",&mAskForPreferences,true); | 188 | addItemBool("AskForPreferences",&mAskForPreferences,true); |
189 | addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | 189 | addItemBool("ShowSyncSummary",&mShowSyncSummary,true); |
190 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 190 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
191 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 191 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
192 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | 192 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); |
193 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 193 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
194 | 194 | ||
195 | #ifdef _WIN32_ | 195 | #ifdef _WIN32_ |
196 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 196 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
197 | #else | 197 | #else |
198 | QString hdp= locateLocal("data","korganizer")+"/"; | 198 | QString hdp= locateLocal("data","korganizer")+"/"; |
199 | #endif | 199 | #endif |
200 | addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | 200 | addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); |
201 | addItemString("RemoteUser",&mRemoteUser, "zaurus"); | 201 | addItemString("RemoteUser",&mRemoteUser, "zaurus"); |
202 | addItemString("RemotePassWd",&mRemotePassWd, ""); | 202 | addItemString("RemotePassWd",&mRemotePassWd, ""); |
203 | addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | 203 | addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); |
204 | addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); | 204 | addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); |
205 | 205 | ||
206 | 206 | ||
207 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 207 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
208 | 208 | ||
209 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 209 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
210 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 210 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
211 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 211 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
212 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 212 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
213 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 213 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
214 | 214 | ||
215 | 215 | ||
216 | KPrefs::setCurrentGroup("Locale"); | 216 | KPrefs::setCurrentGroup("Locale"); |
217 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 217 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
218 | addItemInt("PreferredTime",&mPreferredTime,0); | 218 | addItemInt("PreferredTime",&mPreferredTime,0); |
219 | addItemInt("PreferredDate",&mPreferredDate,0); | 219 | addItemInt("PreferredDate",&mPreferredDate,0); |
220 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 220 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
221 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | 221 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); |
222 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 222 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
223 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 223 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
224 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 224 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
225 | 225 | ||
226 | 226 | ||
227 | KPrefs::setCurrentGroup("Colors"); | 227 | KPrefs::setCurrentGroup("Colors"); |
228 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 228 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
229 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 229 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
230 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 230 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
231 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 231 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
232 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 232 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
233 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 233 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
234 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 234 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
235 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 235 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
236 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 236 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
237 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 237 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
238 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 238 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
239 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 239 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
240 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 240 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
241 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 241 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
242 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 242 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
243 | addItemBool("UseAppColors",&mUseAppColors,false); | 243 | addItemBool("UseAppColors",&mUseAppColors,false); |
244 | 244 | ||
245 | 245 | ||
246 | 246 | ||
247 | KPrefs::setCurrentGroup("Views"); | 247 | KPrefs::setCurrentGroup("Views"); |
248 | addItemInt("Hour Size",&mHourSize,8); | 248 | addItemInt("Hour Size",&mHourSize,8); |
249 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 249 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
250 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 250 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
251 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 251 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
252 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 252 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
253 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 253 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
254 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 254 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
255 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 255 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
256 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 256 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
257 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 257 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
258 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 258 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
259 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 259 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
260 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); | 260 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); |
261 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 261 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
262 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 262 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
263 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 263 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
264 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 264 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
265 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | 265 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); |
266 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 266 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
267 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 267 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
268 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 268 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
269 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 269 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
270 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 270 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
271 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | 271 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); |
272 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 272 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
273 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 273 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
274 | #ifdef DESKTOP_VERSION | ||
275 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | ||
276 | #else | ||
274 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 277 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
278 | #endif | ||
275 | addItemInt("Day Begins",&mDayBegins,7); | 279 | addItemInt("Day Begins",&mDayBegins,7); |
276 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 280 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
277 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 281 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
278 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 282 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
279 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 283 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
280 | 284 | ||
281 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 285 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
282 | addItemBool("Full View Month",&mFullViewMonth,true); | 286 | addItemBool("Full View Month",&mFullViewMonth,true); |
283 | addItemBool("Full View Todo",&mFullViewTodo,true); | 287 | addItemBool("Full View Todo",&mFullViewTodo,true); |
284 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 288 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
285 | 289 | ||
286 | addItemInt("Next X Days",&mNextXDays,3); | 290 | addItemInt("Next X Days",&mNextXDays,3); |
287 | 291 | ||
288 | KPrefs::setCurrentGroup("Printer"); | 292 | KPrefs::setCurrentGroup("Printer"); |
289 | 293 | ||
290 | KPrefs::setCurrentGroup("Layout"); | 294 | KPrefs::setCurrentGroup("Layout"); |
291 | 295 | ||
292 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 296 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
293 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 297 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
294 | 298 | ||
295 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 299 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
296 | 300 | ||
297 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 301 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
298 | 302 | ||
299 | KPrefs::setCurrentGroup("Group Scheduling"); | 303 | KPrefs::setCurrentGroup("Group Scheduling"); |
300 | 304 | ||
301 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 305 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
302 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 306 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
303 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 307 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
304 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 308 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
305 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 309 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
306 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 310 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
307 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 311 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
308 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 312 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
309 | 313 | ||
310 | KPrefs::setCurrentGroup( "Editors" ); | 314 | KPrefs::setCurrentGroup( "Editors" ); |
311 | 315 | ||
312 | addItemStringList( "EventTemplates", &mEventTemplates ); | 316 | addItemStringList( "EventTemplates", &mEventTemplates ); |
313 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 317 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
314 | 318 | ||
315 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 319 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
316 | 320 | ||
317 | 321 | ||
318 | 322 | ||
319 | } | 323 | } |
320 | 324 | ||
321 | 325 | ||
322 | KOPrefs::~KOPrefs() | 326 | KOPrefs::~KOPrefs() |
323 | { | 327 | { |
324 | if (mInstance == this) | 328 | if (mInstance == this) |
325 | mInstance = insd.setObject(0); | 329 | mInstance = insd.setObject(0); |
326 | setLocaleDict( 0 ); | 330 | setLocaleDict( 0 ); |
327 | if ( mLocaleDict ) | 331 | if ( mLocaleDict ) |
328 | delete mLocaleDict; | 332 | delete mLocaleDict; |
329 | //qDebug("KOPrefs::~KOPrefs() "); | 333 | //qDebug("KOPrefs::~KOPrefs() "); |
330 | } | 334 | } |
331 | 335 | ||
332 | 336 | ||
333 | KOPrefs *KOPrefs::instance() | 337 | KOPrefs *KOPrefs::instance() |
334 | { | 338 | { |
335 | if (!mInstance) { | 339 | if (!mInstance) { |
336 | mInstance = insd.setObject(new KOPrefs()); | 340 | mInstance = insd.setObject(new KOPrefs()); |
337 | mInstance->readConfig(); | 341 | mInstance->readConfig(); |
338 | } | 342 | } |
339 | 343 | ||
340 | return mInstance; | 344 | return mInstance; |
341 | } | 345 | } |
342 | 346 | ||
343 | void KOPrefs::usrSetDefaults() | 347 | void KOPrefs::usrSetDefaults() |
344 | { | 348 | { |
345 | 349 | ||
346 | } | 350 | } |
347 | 351 | ||
348 | void KOPrefs::fillMailDefaults() | 352 | void KOPrefs::fillMailDefaults() |
349 | { | 353 | { |
350 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 354 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
351 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 355 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
352 | } | 356 | } |
353 | 357 | ||
354 | void KOPrefs::setTimeZoneIdDefault() | 358 | void KOPrefs::setTimeZoneIdDefault() |
355 | { | 359 | { |
356 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); | 360 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); |
357 | } | 361 | } |
358 | 362 | ||
359 | void KOPrefs::setCategoryDefaults() | 363 | void KOPrefs::setCategoryDefaults() |
360 | { | 364 | { |
361 | mCustomCategories.clear(); | 365 | mCustomCategories.clear(); |
362 | mCustomCategories = getDefaultList(); | 366 | mCustomCategories = getDefaultList(); |
363 | 367 | ||
364 | QStringList::Iterator it; | 368 | QStringList::Iterator it; |
365 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 369 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
366 | setCategoryColor(*it,mDefaultCategoryColor); | 370 | setCategoryColor(*it,mDefaultCategoryColor); |
367 | } | 371 | } |
368 | } | 372 | } |
369 | 373 | ||
370 | QStringList KOPrefs::getDefaultList() | 374 | QStringList KOPrefs::getDefaultList() |
371 | { | 375 | { |
372 | QStringList retval ; | 376 | QStringList retval ; |
373 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 377 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
374 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 378 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
375 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 379 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
376 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 380 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
377 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 381 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
378 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 382 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
379 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 383 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
380 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 384 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
381 | retval.sort(); | 385 | retval.sort(); |
382 | return retval; | 386 | return retval; |
383 | } | 387 | } |
384 | 388 | ||
385 | void KOPrefs::usrReadConfig() | 389 | void KOPrefs::usrReadConfig() |
386 | { | 390 | { |
387 | mLocaleDict = 0; | 391 | mLocaleDict = 0; |
388 | // pending LR fix translation | 392 | // pending LR fix translation |
389 | // qDebug("KOPrefs::usrReadConfig() fix translation "); | 393 | // qDebug("KOPrefs::usrReadConfig() fix translation "); |
390 | if ( mPreferredLanguage == 1 ) { | 394 | if ( mPreferredLanguage == 1 ) { |
391 | mLocaleDict = new QDict<QString>; | 395 | mLocaleDict = new QDict<QString>; |
392 | int i = 0; | 396 | int i = 0; |
393 | QString fw ( germanwords[i] [0]); | 397 | QString fw ( germanwords[i] [0]); |
394 | while ( !fw.isEmpty() ) { | 398 | while ( !fw.isEmpty() ) { |
395 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); | 399 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); |
396 | ++i; | 400 | ++i; |
397 | fw = germanwords[i] [0]; | 401 | fw = germanwords[i] [0]; |
398 | } | 402 | } |
399 | 403 | ||
400 | setLocaleDict( mLocaleDict ); | 404 | setLocaleDict( mLocaleDict ); |
401 | } | 405 | } |
402 | if ( mPreferredLanguage == 3 ) { | 406 | if ( mPreferredLanguage == 3 ) { |
403 | QString fileName = MainWindow::resourcePath()+"usertranslation.txt"; | 407 | QString fileName = MainWindow::resourcePath()+"usertranslation.txt"; |
404 | QFile file( fileName ); | 408 | QFile file( fileName ); |
405 | if (file.open( IO_ReadOnly ) ) { | 409 | if (file.open( IO_ReadOnly ) ) { |
406 | QTextStream ts( &file ); | 410 | QTextStream ts( &file ); |
407 | ts.setCodec( QTextCodec::codecForLocale() ); | 411 | ts.setCodec( QTextCodec::codecForLocale() ); |
408 | QString text = ts.read(); | 412 | QString text = ts.read(); |
409 | file.close(); | 413 | file.close(); |
410 | 414 | ||
411 | QString line; | 415 | QString line; |
412 | QString we; | 416 | QString we; |
413 | QString wt; | 417 | QString wt; |
414 | int br = 0; | 418 | int br = 0; |
415 | int nbr; | 419 | int nbr; |
416 | nbr = text.find ( "},", br ); | 420 | nbr = text.find ( "},", br ); |
417 | line = text.mid( br, nbr - br ); | 421 | line = text.mid( br, nbr - br ); |
418 | br = nbr+1; | 422 | br = nbr+1; |
419 | int se, ee, st, et; | 423 | int se, ee, st, et; |
420 | mLocaleDict = new QDict<QString>; | 424 | mLocaleDict = new QDict<QString>; |
421 | QString end = "{ \"\",\"\" }"; | 425 | QString end = "{ \"\",\"\" }"; |
422 | while ( (line != end) && (br > 1) ) { | 426 | while ( (line != end) && (br > 1) ) { |
423 | //qDebug("%d *%s* ", br, line.latin1()); | 427 | //qDebug("%d *%s* ", br, line.latin1()); |
424 | se = line.find("\"")+1; | 428 | se = line.find("\"")+1; |
425 | et = line.findRev("\"",-1); | 429 | et = line.findRev("\"",-1); |
426 | ee = line.find("\",\""); | 430 | ee = line.find("\",\""); |
427 | st = ee+3; | 431 | st = ee+3; |
428 | we = line.mid( se, ee-se ); | 432 | we = line.mid( se, ee-se ); |
429 | wt = line.mid( st, et-st ); | 433 | wt = line.mid( st, et-st ); |
430 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | 434 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); |
431 | mLocaleDict->insert( we, new QString (wt) ); | 435 | mLocaleDict->insert( we, new QString (wt) ); |
432 | nbr = text.find ( "}", br ); | 436 | nbr = text.find ( "}", br ); |
433 | line = text.mid( br, nbr - br ); | 437 | line = text.mid( br, nbr - br ); |
434 | br = nbr+1; | 438 | br = nbr+1; |
435 | } | 439 | } |
436 | //qDebug("end *%s* ", end.latin1()); | 440 | //qDebug("end *%s* ", end.latin1()); |
437 | 441 | ||
438 | setLocaleDict( mLocaleDict ); | 442 | setLocaleDict( mLocaleDict ); |
439 | } else { | 443 | } else { |
440 | qDebug("KO: Cannot find translation file usertranslation.txt"); | 444 | qDebug("KO: Cannot find translation file usertranslation.txt"); |
441 | } | 445 | } |
442 | } | 446 | } |
443 | config()->setGroup("General"); | 447 | config()->setGroup("General"); |
444 | 448 | ||
445 | mCustomCategories = config()->readListEntry("Custom Categories"); | 449 | mCustomCategories = config()->readListEntry("Custom Categories"); |
446 | if ( KOPrefs::instance()->mLanguageChanged ) { | 450 | if ( KOPrefs::instance()->mLanguageChanged ) { |
447 | mLocationDefaults.clear(); | 451 | mLocationDefaults.clear(); |
448 | mEventSummaryUser.clear(); | 452 | mEventSummaryUser.clear(); |
449 | mTodoSummaryUser.clear(); | 453 | mTodoSummaryUser.clear(); |
450 | } | 454 | } |
451 | if (mLocationDefaults.isEmpty()) { | 455 | if (mLocationDefaults.isEmpty()) { |
452 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Libary") << i18n("School") << i18n("Doctor") << i18n("Beach") | 456 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Libary") << i18n("School") << i18n("Doctor") << i18n("Beach") |
453 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarden") | 457 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarden") |
454 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 458 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
455 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 459 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
456 | mLocationDefaults.sort(); | 460 | mLocationDefaults.sort(); |
457 | } | 461 | } |
458 | 462 | ||
459 | if (mEventSummaryUser.isEmpty()) { | 463 | if (mEventSummaryUser.isEmpty()) { |
460 | mEventSummaryUser = getDefaultList() ; | 464 | mEventSummaryUser = getDefaultList() ; |
461 | } | 465 | } |
462 | if (mTodoSummaryUser.isEmpty()) { | 466 | if (mTodoSummaryUser.isEmpty()) { |
463 | mTodoSummaryUser = getDefaultList() ; | 467 | mTodoSummaryUser = getDefaultList() ; |
464 | } | 468 | } |
465 | 469 | ||
466 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 470 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
467 | 471 | ||
468 | config()->setGroup("Personal Settings"); | 472 | config()->setGroup("Personal Settings"); |
469 | mName = config()->readEntry("user_name",""); | 473 | mName = config()->readEntry("user_name",""); |
470 | mEmail = config()->readEntry("user_email",""); | 474 | mEmail = config()->readEntry("user_email",""); |
471 | fillMailDefaults(); | 475 | fillMailDefaults(); |
472 | 476 | ||
473 | config()->setGroup("Category Colors"); | 477 | config()->setGroup("Category Colors"); |
474 | QStringList::Iterator it; | 478 | QStringList::Iterator it; |
475 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 479 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
476 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 480 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
477 | 481 | ||
478 | } | 482 | } |
479 | 483 | ||
480 | if (mTimeZoneId.isEmpty()) { | 484 | if (mTimeZoneId.isEmpty()) { |
481 | setTimeZoneIdDefault(); | 485 | setTimeZoneIdDefault(); |
482 | } | 486 | } |
483 | KPimPrefs::usrReadConfig(); | 487 | KPimPrefs::usrReadConfig(); |
484 | } | 488 | } |
485 | 489 | ||
486 | 490 | ||
487 | void KOPrefs::usrWriteConfig() | 491 | void KOPrefs::usrWriteConfig() |
488 | { | 492 | { |
489 | config()->setGroup("General"); | 493 | config()->setGroup("General"); |
490 | config()->writeEntry("Custom Categories",mCustomCategories); | 494 | config()->writeEntry("Custom Categories",mCustomCategories); |
491 | 495 | ||
492 | config()->setGroup("Personal Settings"); | 496 | config()->setGroup("Personal Settings"); |
493 | config()->writeEntry("user_name",mName); | 497 | config()->writeEntry("user_name",mName); |
494 | config()->writeEntry("user_email",mEmail); | 498 | config()->writeEntry("user_email",mEmail); |
495 | 499 | ||
496 | config()->setGroup("Category Colors"); | 500 | config()->setGroup("Category Colors"); |
497 | QDictIterator<QColor> it(mCategoryColors); | 501 | QDictIterator<QColor> it(mCategoryColors); |
498 | while (it.current()) { | 502 | while (it.current()) { |
499 | config()->writeEntry(it.currentKey(),*(it.current())); | 503 | config()->writeEntry(it.currentKey(),*(it.current())); |
500 | ++it; | 504 | ++it; |
501 | } | 505 | } |
502 | 506 | ||
503 | 507 | ||
504 | KPimPrefs::usrWriteConfig(); | 508 | KPimPrefs::usrWriteConfig(); |
505 | } | 509 | } |
506 | 510 | ||
507 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 511 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
508 | { | 512 | { |
509 | mCategoryColors.replace(cat,new QColor(color)); | 513 | mCategoryColors.replace(cat,new QColor(color)); |
510 | } | 514 | } |
511 | 515 | ||
512 | QColor *KOPrefs::categoryColor(QString cat) | 516 | QColor *KOPrefs::categoryColor(QString cat) |
513 | { | 517 | { |
514 | QColor *color = 0; | 518 | QColor *color = 0; |
515 | 519 | ||
516 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 520 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
517 | 521 | ||
518 | if (color) return color; | 522 | if (color) return color; |
519 | else return &mDefaultCategoryColor; | 523 | else return &mDefaultCategoryColor; |
520 | } | 524 | } |
521 | 525 | ||
522 | void KOPrefs::setFullName(const QString &name) | 526 | void KOPrefs::setFullName(const QString &name) |
523 | { | 527 | { |
524 | mName = name; | 528 | mName = name; |
525 | } | 529 | } |
526 | 530 | ||
527 | void KOPrefs::setEmail(const QString &email) | 531 | void KOPrefs::setEmail(const QString &email) |
528 | { | 532 | { |
529 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 533 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
530 | mEmail = email; | 534 | mEmail = email; |
531 | } | 535 | } |
532 | 536 | ||
533 | QString KOPrefs::fullName() | 537 | QString KOPrefs::fullName() |
534 | { | 538 | { |
535 | if (mEmailControlCenter) { | 539 | if (mEmailControlCenter) { |
536 | KEMailSettings settings; | 540 | KEMailSettings settings; |
537 | return settings.getSetting(KEMailSettings::RealName); | 541 | return settings.getSetting(KEMailSettings::RealName); |
538 | } else { | 542 | } else { |
539 | return mName; | 543 | return mName; |
540 | } | 544 | } |
541 | } | 545 | } |
542 | 546 | ||
543 | QString KOPrefs::email() | 547 | QString KOPrefs::email() |
544 | { | 548 | { |
545 | if (mEmailControlCenter) { | 549 | if (mEmailControlCenter) { |
546 | KEMailSettings settings; | 550 | KEMailSettings settings; |
547 | return settings.getSetting(KEMailSettings::EmailAddress); | 551 | return settings.getSetting(KEMailSettings::EmailAddress); |
548 | } else { | 552 | } else { |
549 | return mEmail; | 553 | return mEmail; |
550 | } | 554 | } |
551 | } | 555 | } |
552 | KConfig* KOPrefs::getConfig() | 556 | KConfig* KOPrefs::getConfig() |
553 | { | 557 | { |
554 | return config(); | 558 | return config(); |
555 | } | 559 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index be69be7..a487f14 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -620,1025 +620,1025 @@ void MainWindow::initActions() | |||
620 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 620 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
621 | this ); | 621 | this ); |
622 | action->addTo( importMenu ); | 622 | action->addTo( importMenu ); |
623 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 623 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
624 | 624 | ||
625 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 625 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
626 | this ); | 626 | this ); |
627 | action->addTo( importMenu ); | 627 | action->addTo( importMenu ); |
628 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 628 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
629 | #else | 629 | #else |
630 | importMenu->insertSeparator(); | 630 | importMenu->insertSeparator(); |
631 | icon = loadPixmap( pathString + "print" ); | 631 | icon = loadPixmap( pathString + "print" ); |
632 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 632 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
633 | action->addTo( importMenu ); | 633 | action->addTo( importMenu ); |
634 | connect( action, SIGNAL( activated() ), | 634 | connect( action, SIGNAL( activated() ), |
635 | this, SLOT( printCal() ) ); | 635 | this, SLOT( printCal() ) ); |
636 | 636 | ||
637 | icon = loadPixmap( pathString + "print" ); | 637 | icon = loadPixmap( pathString + "print" ); |
638 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 638 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
639 | action->addTo( importMenu ); | 639 | action->addTo( importMenu ); |
640 | connect( action, SIGNAL( activated() ), | 640 | connect( action, SIGNAL( activated() ), |
641 | this, SLOT( printSel() ) ); | 641 | this, SLOT( printSel() ) ); |
642 | #endif | 642 | #endif |
643 | importMenu->insertSeparator(); | 643 | importMenu->insertSeparator(); |
644 | action = new QAction( "beam all", i18n("Save"), 0, | 644 | action = new QAction( "beam all", i18n("Save"), 0, |
645 | this ); | 645 | this ); |
646 | action->addTo( importMenu ); | 646 | action->addTo( importMenu ); |
647 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 647 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
648 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 648 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
649 | this ); | 649 | this ); |
650 | action->addTo( importMenu ); | 650 | action->addTo( importMenu ); |
651 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 651 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
652 | 652 | ||
653 | //menuBar->insertItem( "Configure",configureMenu ); | 653 | //menuBar->insertItem( "Configure",configureMenu ); |
654 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 654 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
655 | icon = loadPixmap( "korganizer/korganizer" ); | 655 | icon = loadPixmap( "korganizer/korganizer" ); |
656 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 656 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
657 | action->addTo( helpMenu ); | 657 | action->addTo( helpMenu ); |
658 | connect( action, SIGNAL( activated() ), | 658 | connect( action, SIGNAL( activated() ), |
659 | SLOT( keyBindings() ) ); | 659 | SLOT( keyBindings() ) ); |
660 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 660 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
661 | action->addTo( helpMenu ); | 661 | action->addTo( helpMenu ); |
662 | connect( action, SIGNAL( activated() ), | 662 | connect( action, SIGNAL( activated() ), |
663 | SLOT( features() ) ); | 663 | SLOT( features() ) ); |
664 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 664 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
665 | action->addTo( helpMenu ); | 665 | action->addTo( helpMenu ); |
666 | connect( action, SIGNAL( activated() ), | 666 | connect( action, SIGNAL( activated() ), |
667 | SLOT( aboutAutoSaving() ) ); | 667 | SLOT( aboutAutoSaving() ) ); |
668 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 668 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
669 | action->addTo( helpMenu ); | 669 | action->addTo( helpMenu ); |
670 | connect( action, SIGNAL( activated() ), | 670 | connect( action, SIGNAL( activated() ), |
671 | SLOT( aboutKnownBugs() ) ); | 671 | SLOT( aboutKnownBugs() ) ); |
672 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 672 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
673 | action->addTo( helpMenu ); | 673 | action->addTo( helpMenu ); |
674 | connect( action, SIGNAL( activated() ), | 674 | connect( action, SIGNAL( activated() ), |
675 | SLOT( usertrans() ) ); | 675 | SLOT( usertrans() ) ); |
676 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 676 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
677 | action->addTo( helpMenu ); | 677 | action->addTo( helpMenu ); |
678 | connect( action, SIGNAL( activated() ), | 678 | connect( action, SIGNAL( activated() ), |
679 | SLOT( synchowto() ) ); | 679 | SLOT( synchowto() ) ); |
680 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 680 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
681 | action->addTo( helpMenu ); | 681 | action->addTo( helpMenu ); |
682 | connect( action, SIGNAL( activated() ), | 682 | connect( action, SIGNAL( activated() ), |
683 | SLOT( whatsNew() ) ); | 683 | SLOT( whatsNew() ) ); |
684 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 684 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
685 | action->addTo( helpMenu ); | 685 | action->addTo( helpMenu ); |
686 | connect( action, SIGNAL( activated() ), | 686 | connect( action, SIGNAL( activated() ), |
687 | SLOT( faq() ) ); | 687 | SLOT( faq() ) ); |
688 | 688 | ||
689 | 689 | ||
690 | action = new QAction( "about", i18n("About..."), 0, this ); | 690 | action = new QAction( "about", i18n("About..."), 0, this ); |
691 | action->addTo( helpMenu ); | 691 | action->addTo( helpMenu ); |
692 | connect( action, SIGNAL( activated() ), | 692 | connect( action, SIGNAL( activated() ), |
693 | SLOT( about() ) ); | 693 | SLOT( about() ) ); |
694 | //menuBar->insertSeparator(); | 694 | //menuBar->insertSeparator(); |
695 | 695 | ||
696 | // ****************************************************** | 696 | // ****************************************************** |
697 | // menubar icons | 697 | // menubar icons |
698 | 698 | ||
699 | 699 | ||
700 | iconToolBar->setHorizontalStretchable (true ); | 700 | iconToolBar->setHorizontalStretchable (true ); |
701 | //menuBar->insertItem( iconToolBar ); | 701 | //menuBar->insertItem( iconToolBar ); |
702 | //xdays_action | 702 | //xdays_action |
703 | if (p-> mShowIconNewEvent) | 703 | if (p-> mShowIconNewEvent) |
704 | ne_action->addTo( iconToolBar ); | 704 | ne_action->addTo( iconToolBar ); |
705 | if (p->mShowIconNewTodo ) | 705 | if (p->mShowIconNewTodo ) |
706 | nt_action->addTo( iconToolBar ); | 706 | nt_action->addTo( iconToolBar ); |
707 | if (p-> mShowIconSearch) | 707 | if (p-> mShowIconSearch) |
708 | search_action->addTo( iconToolBar ); | 708 | search_action->addTo( iconToolBar ); |
709 | if (p-> mShowIconNext) | 709 | if (p-> mShowIconNext) |
710 | whatsnext_action->addTo( iconToolBar ); | 710 | whatsnext_action->addTo( iconToolBar ); |
711 | if (p-> mShowIconNextDays) | 711 | if (p-> mShowIconNextDays) |
712 | xdays_action->addTo( iconToolBar ); | 712 | xdays_action->addTo( iconToolBar ); |
713 | if (p-> mShowIconList) | 713 | if (p-> mShowIconList) |
714 | showlist_action->addTo( iconToolBar ); | 714 | showlist_action->addTo( iconToolBar ); |
715 | if (p-> mShowIconDay1) | 715 | if (p-> mShowIconDay1) |
716 | day1_action->addTo( iconToolBar ); | 716 | day1_action->addTo( iconToolBar ); |
717 | if (p-> mShowIconDay5) | 717 | if (p-> mShowIconDay5) |
718 | day5_action->addTo( iconToolBar ); | 718 | day5_action->addTo( iconToolBar ); |
719 | if (p-> mShowIconDay7) | 719 | if (p-> mShowIconDay7) |
720 | day7_action->addTo( iconToolBar ); | 720 | day7_action->addTo( iconToolBar ); |
721 | if (p-> mShowIconMonth) | 721 | if (p-> mShowIconMonth) |
722 | month_action->addTo( iconToolBar ); | 722 | month_action->addTo( iconToolBar ); |
723 | if (p-> mShowIconTodoview) | 723 | if (p-> mShowIconTodoview) |
724 | todoview_action->addTo( iconToolBar ); | 724 | todoview_action->addTo( iconToolBar ); |
725 | if (p-> mShowIconJournal) | 725 | if (p-> mShowIconJournal) |
726 | viewjournal_action->addTo( iconToolBar ); | 726 | viewjournal_action->addTo( iconToolBar ); |
727 | icon = loadPixmap( pathString + "2leftarrowB" ); | 727 | icon = loadPixmap( pathString + "2leftarrowB" ); |
728 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 728 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
729 | if (p-> mShowIconBackFast) { | 729 | if (p-> mShowIconBackFast) { |
730 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 730 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
731 | connect( action, SIGNAL( activated() ), | 731 | connect( action, SIGNAL( activated() ), |
732 | mView, SLOT( goPreviousMonth() ) ); | 732 | mView, SLOT( goPreviousMonth() ) ); |
733 | action->addTo( iconToolBar ); | 733 | action->addTo( iconToolBar ); |
734 | } | 734 | } |
735 | icon = loadPixmap( pathString + "1leftarrowB" ); | 735 | icon = loadPixmap( pathString + "1leftarrowB" ); |
736 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 736 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
737 | if (p-> mShowIconBack) { | 737 | if (p-> mShowIconBack) { |
738 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 738 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
739 | connect( action, SIGNAL( activated() ), | 739 | connect( action, SIGNAL( activated() ), |
740 | mView, SLOT( goPrevious() ) ); | 740 | mView, SLOT( goPrevious() ) ); |
741 | action->addTo( iconToolBar ); | 741 | action->addTo( iconToolBar ); |
742 | } | 742 | } |
743 | if (p-> mShowIconToday) | 743 | if (p-> mShowIconToday) |
744 | today_action->addTo( iconToolBar ); | 744 | today_action->addTo( iconToolBar ); |
745 | icon = loadPixmap( pathString + "1rightarrowB" ); | 745 | icon = loadPixmap( pathString + "1rightarrowB" ); |
746 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 746 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
747 | if (p-> mShowIconForward) { | 747 | if (p-> mShowIconForward) { |
748 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 748 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
749 | connect( action, SIGNAL( activated() ), | 749 | connect( action, SIGNAL( activated() ), |
750 | mView, SLOT( goNext() ) ); | 750 | mView, SLOT( goNext() ) ); |
751 | action->addTo( iconToolBar ); | 751 | action->addTo( iconToolBar ); |
752 | } | 752 | } |
753 | icon = loadPixmap( pathString + "2rightarrowB" ); | 753 | icon = loadPixmap( pathString + "2rightarrowB" ); |
754 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 754 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
755 | if (p-> mShowIconForwardFast) { | 755 | if (p-> mShowIconForwardFast) { |
756 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 756 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
757 | connect( action, SIGNAL( activated() ), | 757 | connect( action, SIGNAL( activated() ), |
758 | mView, SLOT( goNextMonth() ) ); | 758 | mView, SLOT( goNextMonth() ) ); |
759 | action->addTo( iconToolBar ); | 759 | action->addTo( iconToolBar ); |
760 | } | 760 | } |
761 | 761 | ||
762 | 762 | ||
763 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 763 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
764 | 764 | ||
765 | if (p-> mShowIconNewEvent) | 765 | if (p-> mShowIconNewEvent) |
766 | configureToolBarMenu->setItemChecked( 10, true ); | 766 | configureToolBarMenu->setItemChecked( 10, true ); |
767 | if (p->mShowIconNewTodo ) | 767 | if (p->mShowIconNewTodo ) |
768 | configureToolBarMenu->setItemChecked( 20, true ); | 768 | configureToolBarMenu->setItemChecked( 20, true ); |
769 | if (p-> mShowIconSearch) | 769 | if (p-> mShowIconSearch) |
770 | configureToolBarMenu->setItemChecked( 120, true ); | 770 | configureToolBarMenu->setItemChecked( 120, true ); |
771 | if (p-> mShowIconList) | 771 | if (p-> mShowIconList) |
772 | configureToolBarMenu->setItemChecked( 30, true ); | 772 | configureToolBarMenu->setItemChecked( 30, true ); |
773 | if (p-> mShowIconDay1) | 773 | if (p-> mShowIconDay1) |
774 | configureToolBarMenu->setItemChecked( 40, true ); | 774 | configureToolBarMenu->setItemChecked( 40, true ); |
775 | if (p-> mShowIconDay5) | 775 | if (p-> mShowIconDay5) |
776 | configureToolBarMenu->setItemChecked( 50, true ); | 776 | configureToolBarMenu->setItemChecked( 50, true ); |
777 | if (p-> mShowIconDay7) | 777 | if (p-> mShowIconDay7) |
778 | configureToolBarMenu->setItemChecked( 60, true ); | 778 | configureToolBarMenu->setItemChecked( 60, true ); |
779 | if (p-> mShowIconMonth) | 779 | if (p-> mShowIconMonth) |
780 | configureToolBarMenu->setItemChecked( 70, true ); | 780 | configureToolBarMenu->setItemChecked( 70, true ); |
781 | if (p-> mShowIconTodoview) | 781 | if (p-> mShowIconTodoview) |
782 | configureToolBarMenu->setItemChecked( 80, true ); | 782 | configureToolBarMenu->setItemChecked( 80, true ); |
783 | if (p-> mShowIconBackFast) | 783 | if (p-> mShowIconBackFast) |
784 | configureToolBarMenu->setItemChecked( 200, true ); | 784 | configureToolBarMenu->setItemChecked( 200, true ); |
785 | if (p-> mShowIconBack) | 785 | if (p-> mShowIconBack) |
786 | configureToolBarMenu->setItemChecked( 210, true ); | 786 | configureToolBarMenu->setItemChecked( 210, true ); |
787 | if (p-> mShowIconToday) | 787 | if (p-> mShowIconToday) |
788 | configureToolBarMenu->setItemChecked( 130, true ); | 788 | configureToolBarMenu->setItemChecked( 130, true ); |
789 | if (p-> mShowIconForward) | 789 | if (p-> mShowIconForward) |
790 | configureToolBarMenu->setItemChecked( 220, true ); | 790 | configureToolBarMenu->setItemChecked( 220, true ); |
791 | if (p-> mShowIconForwardFast) | 791 | if (p-> mShowIconForwardFast) |
792 | configureToolBarMenu->setItemChecked( 230, true ); | 792 | configureToolBarMenu->setItemChecked( 230, true ); |
793 | if (p-> mShowIconNextDays) | 793 | if (p-> mShowIconNextDays) |
794 | configureToolBarMenu->setItemChecked( 100, true ); | 794 | configureToolBarMenu->setItemChecked( 100, true ); |
795 | if (p-> mShowIconNext) | 795 | if (p-> mShowIconNext) |
796 | configureToolBarMenu->setItemChecked( 110, true ); | 796 | configureToolBarMenu->setItemChecked( 110, true ); |
797 | if (p-> mShowIconJournal) | 797 | if (p-> mShowIconJournal) |
798 | configureToolBarMenu->setItemChecked( 90, true ); | 798 | configureToolBarMenu->setItemChecked( 90, true ); |
799 | if (p-> mShowIconWhatsThis) | 799 | if (p-> mShowIconWhatsThis) |
800 | configureToolBarMenu->setItemChecked( 300, true ); | 800 | configureToolBarMenu->setItemChecked( 300, true ); |
801 | 801 | ||
802 | QLabel* dummy = new QLabel( iconToolBar ); | 802 | QLabel* dummy = new QLabel( iconToolBar ); |
803 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 803 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
804 | if (!p-> mShowIconStretch) | 804 | if (!p-> mShowIconStretch) |
805 | iconToolBar->setStretchableWidget ( dummy ) ; | 805 | iconToolBar->setStretchableWidget ( dummy ) ; |
806 | else | 806 | else |
807 | configureToolBarMenu->setItemChecked( 5, true ); | 807 | configureToolBarMenu->setItemChecked( 5, true ); |
808 | if (p-> mShowIconWhatsThis) | 808 | if (p-> mShowIconWhatsThis) |
809 | QWhatsThis::whatsThisButton ( iconToolBar ); | 809 | QWhatsThis::whatsThisButton ( iconToolBar ); |
810 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 810 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
811 | configureAgenda( p->mHourSize ); | 811 | configureAgenda( p->mHourSize ); |
812 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 812 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
813 | } | 813 | } |
814 | void MainWindow::fillSyncMenu() | 814 | void MainWindow::fillSyncMenu() |
815 | { | 815 | { |
816 | syncMenu->clear(); | 816 | syncMenu->clear(); |
817 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 817 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
818 | syncMenu->insertSeparator(); | 818 | syncMenu->insertSeparator(); |
819 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 819 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
820 | syncMenu->insertSeparator(); | 820 | syncMenu->insertSeparator(); |
821 | 821 | ||
822 | QStringList prof = KOPrefs::instance()->mSyncProfileNames; | 822 | QStringList prof = KOPrefs::instance()->mSyncProfileNames; |
823 | 823 | ||
824 | if ( prof.count() < 3 ) { | 824 | if ( prof.count() < 3 ) { |
825 | KConfig *config = KOGlobals::config(); | 825 | KConfig *config = KOGlobals::config(); |
826 | prof.clear(); | 826 | prof.clear(); |
827 | prof << i18n("Sharp-DTM"); | 827 | prof << i18n("Sharp-DTM"); |
828 | prof << i18n("Local file"); | 828 | prof << i18n("Local file"); |
829 | prof << i18n("Last file"); | 829 | prof << i18n("Last file"); |
830 | KSyncProfile* temp = new KSyncProfile (); | 830 | KSyncProfile* temp = new KSyncProfile (); |
831 | temp->setName( prof[0] ); | 831 | temp->setName( prof[0] ); |
832 | temp->writeConfig(config); | 832 | temp->writeConfig(config); |
833 | temp->setName( prof[1] ); | 833 | temp->setName( prof[1] ); |
834 | temp->writeConfig(config); | 834 | temp->writeConfig(config); |
835 | temp->setName( prof[2] ); | 835 | temp->setName( prof[2] ); |
836 | temp->writeConfig(config); | 836 | temp->writeConfig(config); |
837 | config->sync(); | 837 | config->sync(); |
838 | delete temp; | 838 | delete temp; |
839 | KOPrefs::instance()->mSyncProfileNames = prof; | 839 | KOPrefs::instance()->mSyncProfileNames = prof; |
840 | } | 840 | } |
841 | 841 | ||
842 | int i; | 842 | int i; |
843 | for ( i = 0; i < prof.count(); ++i ) { | 843 | for ( i = 0; i < prof.count(); ++i ) { |
844 | 844 | ||
845 | syncMenu->insertItem( prof[i], 1000+i ); | 845 | syncMenu->insertItem( prof[i], 1000+i ); |
846 | if ( i == 2 ) | 846 | if ( i == 2 ) |
847 | syncMenu->insertSeparator(); | 847 | syncMenu->insertSeparator(); |
848 | } | 848 | } |
849 | QDir app_dir; | 849 | QDir app_dir; |
850 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 850 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
851 | syncMenu->setItemEnabled( false , 1000 ); | 851 | syncMenu->setItemEnabled( false , 1000 ); |
852 | } | 852 | } |
853 | } | 853 | } |
854 | 854 | ||
855 | int MainWindow::ringSync() | 855 | int MainWindow::ringSync() |
856 | { | 856 | { |
857 | int syncedProfiles = 0; | 857 | int syncedProfiles = 0; |
858 | int i; | 858 | int i; |
859 | QTime timer; | 859 | QTime timer; |
860 | KConfig *config = KOGlobals::config(); | 860 | KConfig *config = KOGlobals::config(); |
861 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 861 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
862 | KSyncProfile* temp = new KSyncProfile (); | 862 | KSyncProfile* temp = new KSyncProfile (); |
863 | KOPrefs::instance()->mAskForPreferences = false; | 863 | KOPrefs::instance()->mAskForPreferences = false; |
864 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 864 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
865 | mCurrentSyncProfile = i; | 865 | mCurrentSyncProfile = i; |
866 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 866 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
867 | temp->readConfig(config); | 867 | temp->readConfig(config); |
868 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 868 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
869 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 869 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
870 | ++syncedProfiles; | 870 | ++syncedProfiles; |
871 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 871 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
872 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 872 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
873 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 873 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
874 | KOPrefs::instance()->mShowSyncSummary = false; | 874 | KOPrefs::instance()->mShowSyncSummary = false; |
875 | mView->setSyncDevice(syncProfileNames[i] ); | 875 | mView->setSyncDevice(syncProfileNames[i] ); |
876 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 876 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
877 | if ( i == 0 ) { | 877 | if ( i == 0 ) { |
878 | syncSharp(); | 878 | syncSharp(); |
879 | } else { | 879 | } else { |
880 | if ( temp->getIsLocalFileSync() ) { | 880 | if ( temp->getIsLocalFileSync() ) { |
881 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 881 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
882 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 882 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
883 | } else { | 883 | } else { |
884 | syncRemote( temp, false ); | 884 | syncRemote( temp, false ); |
885 | 885 | ||
886 | } | 886 | } |
887 | } | 887 | } |
888 | timer.start(); | 888 | timer.start(); |
889 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 889 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
890 | while ( timer.elapsed () < 2000 ) { | 890 | while ( timer.elapsed () < 2000 ) { |
891 | qApp->processEvents(); | 891 | qApp->processEvents(); |
892 | #ifndef _WIN32_ | 892 | #ifndef _WIN32_ |
893 | sleep (1); | 893 | sleep (1); |
894 | #endif | 894 | #endif |
895 | } | 895 | } |
896 | 896 | ||
897 | } | 897 | } |
898 | 898 | ||
899 | } | 899 | } |
900 | delete temp; | 900 | delete temp; |
901 | return syncedProfiles; | 901 | return syncedProfiles; |
902 | } | 902 | } |
903 | 903 | ||
904 | void MainWindow::multiSync( bool askforPrefs ) | 904 | void MainWindow::multiSync( bool askforPrefs ) |
905 | { | 905 | { |
906 | if (mBlockSaveFlag) | 906 | if (mBlockSaveFlag) |
907 | return; | 907 | return; |
908 | mBlockSaveFlag = true; | 908 | mBlockSaveFlag = true; |
909 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 909 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
910 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 910 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
911 | question, | 911 | question, |
912 | i18n("Yes"), i18n("No"), | 912 | i18n("Yes"), i18n("No"), |
913 | 0, 0 ) != 0 ) { | 913 | 0, 0 ) != 0 ) { |
914 | mBlockSaveFlag = false; | 914 | mBlockSaveFlag = false; |
915 | setCaption(i18n("Aborted! Nothing synced!")); | 915 | setCaption(i18n("Aborted! Nothing synced!")); |
916 | return; | 916 | return; |
917 | } | 917 | } |
918 | mView->setSyncDevice(i18n("Multiple profiles") ); | 918 | mView->setSyncDevice(i18n("Multiple profiles") ); |
919 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 919 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
920 | if ( askforPrefs ) { | 920 | if ( askforPrefs ) { |
921 | mView->edit_sync_options(); | 921 | mView->edit_sync_options(); |
922 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 922 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
923 | } | 923 | } |
924 | setCaption(i18n("Multiple sync started.") ); | 924 | setCaption(i18n("Multiple sync started.") ); |
925 | qApp->processEvents(); | 925 | qApp->processEvents(); |
926 | int num = ringSync() ; | 926 | int num = ringSync() ; |
927 | if ( num > 1 ) | 927 | if ( num > 1 ) |
928 | ringSync(); | 928 | ringSync(); |
929 | mBlockSaveFlag = false; | 929 | mBlockSaveFlag = false; |
930 | if ( num ) | 930 | if ( num ) |
931 | save(); | 931 | save(); |
932 | if ( num ) | 932 | if ( num ) |
933 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 933 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
934 | else | 934 | else |
935 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 935 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
936 | return; | 936 | return; |
937 | } | 937 | } |
938 | void MainWindow::slotSyncMenu( int action ) | 938 | void MainWindow::slotSyncMenu( int action ) |
939 | { | 939 | { |
940 | //qDebug("syncaction %d ", action); | 940 | //qDebug("syncaction %d ", action); |
941 | if ( action == 0 ) { | 941 | if ( action == 0 ) { |
942 | 942 | ||
943 | confSync(); | 943 | confSync(); |
944 | 944 | ||
945 | return; | 945 | return; |
946 | } | 946 | } |
947 | if ( action == 1 ) { | 947 | if ( action == 1 ) { |
948 | multiSync( true ); | 948 | multiSync( true ); |
949 | return; | 949 | return; |
950 | } | 950 | } |
951 | 951 | ||
952 | if (mBlockSaveFlag) | 952 | if (mBlockSaveFlag) |
953 | return; | 953 | return; |
954 | mBlockSaveFlag = true; | 954 | mBlockSaveFlag = true; |
955 | mCurrentSyncProfile = action - 1000 ; | 955 | mCurrentSyncProfile = action - 1000 ; |
956 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 956 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
957 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 957 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
958 | KConfig *config = KOGlobals::config(); | 958 | KConfig *config = KOGlobals::config(); |
959 | KSyncProfile* temp = new KSyncProfile (); | 959 | KSyncProfile* temp = new KSyncProfile (); |
960 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 960 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
961 | temp->readConfig(config); | 961 | temp->readConfig(config); |
962 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 962 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
963 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 963 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
964 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 964 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
965 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 965 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
966 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 966 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
967 | if ( action == 1000 ) { | 967 | if ( action == 1000 ) { |
968 | syncSharp(); | 968 | syncSharp(); |
969 | 969 | ||
970 | } else if ( action == 1001 ) { | 970 | } else if ( action == 1001 ) { |
971 | syncLocalFile(); | 971 | syncLocalFile(); |
972 | 972 | ||
973 | } else if ( action == 1002 ) { | 973 | } else if ( action == 1002 ) { |
974 | quickSyncLocalFile(); | 974 | quickSyncLocalFile(); |
975 | 975 | ||
976 | } else if ( action >= 1003 ) { | 976 | } else if ( action >= 1003 ) { |
977 | if ( temp->getIsLocalFileSync() ) { | 977 | if ( temp->getIsLocalFileSync() ) { |
978 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 978 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
979 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 979 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
980 | } else { | 980 | } else { |
981 | syncRemote( temp ); | 981 | syncRemote( temp ); |
982 | 982 | ||
983 | } | 983 | } |
984 | } | 984 | } |
985 | delete temp; | 985 | delete temp; |
986 | mBlockSaveFlag = false; | 986 | mBlockSaveFlag = false; |
987 | } | 987 | } |
988 | void MainWindow::setDefaultPreferences() | 988 | void MainWindow::setDefaultPreferences() |
989 | { | 989 | { |
990 | KOPrefs *p = KOPrefs::instance(); | 990 | KOPrefs *p = KOPrefs::instance(); |
991 | 991 | ||
992 | p->mCompactDialogs = true; | 992 | p->mCompactDialogs = true; |
993 | p->mConfirm = true; | 993 | p->mConfirm = true; |
994 | // p->mEnableQuickTodo = false; | 994 | // p->mEnableQuickTodo = false; |
995 | } | 995 | } |
996 | 996 | ||
997 | QString MainWindow::resourcePath() | 997 | QString MainWindow::resourcePath() |
998 | { | 998 | { |
999 | return KGlobal::iconLoader()->iconPath(); | 999 | return KGlobal::iconLoader()->iconPath(); |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | void MainWindow::displayText( QString text ,QString cap ) | 1002 | void MainWindow::displayText( QString text ,QString cap ) |
1003 | { | 1003 | { |
1004 | QDialog dia( this, "name", true ); ; | 1004 | QDialog dia( this, "name", true ); ; |
1005 | dia.setCaption( cap ); | 1005 | dia.setCaption( cap ); |
1006 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1006 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1007 | lay->setSpacing( 3 ); | 1007 | lay->setSpacing( 3 ); |
1008 | lay->setMargin( 3 ); | 1008 | lay->setMargin( 3 ); |
1009 | QTextBrowser tb ( &dia ); | 1009 | QTextBrowser tb ( &dia ); |
1010 | lay->addWidget( &tb ); | 1010 | lay->addWidget( &tb ); |
1011 | tb.setText( text ); | 1011 | tb.setText( text ); |
1012 | #ifdef DESKTOP_VERSION | 1012 | #ifdef DESKTOP_VERSION |
1013 | dia.resize( 640, 480); | 1013 | dia.resize( 640, 480); |
1014 | #else | 1014 | #else |
1015 | dia.showMaximized(); | 1015 | dia.showMaximized(); |
1016 | #endif | 1016 | #endif |
1017 | dia.exec(); | 1017 | dia.exec(); |
1018 | } | 1018 | } |
1019 | void MainWindow::displayFile( QString fn, QString cap ) | 1019 | void MainWindow::displayFile( QString fn, QString cap ) |
1020 | { | 1020 | { |
1021 | QString fileName = resourcePath() + fn; | 1021 | QString fileName = resourcePath() + fn; |
1022 | QString text; | 1022 | QString text; |
1023 | QFile file( fileName ); | 1023 | QFile file( fileName ); |
1024 | if (!file.open( IO_ReadOnly ) ) { | 1024 | if (!file.open( IO_ReadOnly ) ) { |
1025 | return ; | 1025 | return ; |
1026 | 1026 | ||
1027 | } | 1027 | } |
1028 | QTextStream ts( &file ); | 1028 | QTextStream ts( &file ); |
1029 | text = ts.read(); | 1029 | text = ts.read(); |
1030 | file.close(); | 1030 | file.close(); |
1031 | displayText( text, cap); | 1031 | displayText( text, cap); |
1032 | } | 1032 | } |
1033 | void MainWindow::features() | 1033 | void MainWindow::features() |
1034 | { | 1034 | { |
1035 | 1035 | ||
1036 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1036 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | void MainWindow::usertrans() | 1039 | void MainWindow::usertrans() |
1040 | { | 1040 | { |
1041 | 1041 | ||
1042 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1042 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1043 | } | 1043 | } |
1044 | void MainWindow::synchowto() | 1044 | void MainWindow::synchowto() |
1045 | { | 1045 | { |
1046 | 1046 | ||
1047 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); | 1047 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); |
1048 | } | 1048 | } |
1049 | void MainWindow::faq() | 1049 | void MainWindow::faq() |
1050 | { | 1050 | { |
1051 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1051 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1052 | 1052 | ||
1053 | } | 1053 | } |
1054 | void MainWindow::whatsNew() | 1054 | void MainWindow::whatsNew() |
1055 | { | 1055 | { |
1056 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); | 1056 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); |
1057 | 1057 | ||
1058 | } | 1058 | } |
1059 | void MainWindow::about() | 1059 | void MainWindow::about() |
1060 | { | 1060 | { |
1061 | QString version; | 1061 | QString version; |
1062 | #include <../version> | 1062 | #include <../version> |
1063 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1063 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1064 | i18n("KOrganizer/Platform-independent\n") + | 1064 | i18n("KOrganizer/Platform-independent\n") + |
1065 | "(KO/Pi) " + version + " - " + | 1065 | "(KO/Pi) " + version + " - " + |
1066 | 1066 | ||
1067 | #ifdef DESKTOP_VERSION | 1067 | #ifdef DESKTOP_VERSION |
1068 | i18n("Desktop Edition\n") + | 1068 | i18n("Desktop Edition\n") + |
1069 | #else | 1069 | #else |
1070 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1070 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1071 | #endif | 1071 | #endif |
1072 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1072 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1073 | } | 1073 | } |
1074 | void MainWindow::keyBindings() | 1074 | void MainWindow::keyBindings() |
1075 | { | 1075 | { |
1076 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1076 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1077 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1077 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1078 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1078 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1079 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1079 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1080 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1080 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1081 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1081 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1082 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1082 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1083 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1083 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1084 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1084 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1085 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1085 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1086 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1086 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1087 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1087 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1088 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1088 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1089 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1089 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1090 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1090 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1091 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1091 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1092 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1092 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1093 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1093 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1094 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1094 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1095 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1095 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1096 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1096 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1097 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1097 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1098 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1098 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1099 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1099 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1100 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1100 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1101 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1101 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1102 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1102 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1103 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1103 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1104 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1104 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1105 | i18n("<p><h3>In list view:</h3></p>\n") + | 1105 | i18n("<p><h3>In list view:</h3></p>\n") + |
1106 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1106 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1107 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1107 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1108 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1108 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1109 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1109 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1110 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1110 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1111 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1111 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1112 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1112 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1113 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1113 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1114 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1114 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1115 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1115 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1116 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1116 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1117 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1117 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1118 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1118 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1119 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1119 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1120 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1120 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1121 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1121 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1122 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1122 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1123 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1123 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1124 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1124 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1125 | displayText( text, cap); | 1125 | displayText( text, cap); |
1126 | 1126 | ||
1127 | } | 1127 | } |
1128 | void MainWindow::aboutAutoSaving() | 1128 | void MainWindow::aboutAutoSaving() |
1129 | { | 1129 | { |
1130 | QMessageBox* msg; | 1130 | QMessageBox* msg; |
1131 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1131 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1132 | i18n("After changing something, the data is\nautomatically saved to the file\n~/Applications/korganizer/calendar/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1132 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1133 | QMessageBox::Ok, | 1133 | QMessageBox::Ok, |
1134 | QMessageBox::NoButton, | 1134 | QMessageBox::NoButton, |
1135 | QMessageBox::NoButton); | 1135 | QMessageBox::NoButton); |
1136 | msg->exec(); | 1136 | msg->exec(); |
1137 | delete msg; | 1137 | delete msg; |
1138 | 1138 | ||
1139 | 1139 | ||
1140 | } | 1140 | } |
1141 | void MainWindow::aboutKnownBugs() | 1141 | void MainWindow::aboutKnownBugs() |
1142 | { | 1142 | { |
1143 | QMessageBox* msg; | 1143 | QMessageBox* msg; |
1144 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1144 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1145 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1145 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1146 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1146 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1147 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1147 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1148 | i18n("\nor report them in the bugtracker on\n") + | 1148 | i18n("\nor report them in the bugtracker on\n") + |
1149 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1149 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1150 | QMessageBox::NoIcon, | 1150 | QMessageBox::NoIcon, |
1151 | QMessageBox::Ok, | 1151 | QMessageBox::Ok, |
1152 | QMessageBox::NoButton, | 1152 | QMessageBox::NoButton, |
1153 | QMessageBox::NoButton); | 1153 | QMessageBox::NoButton); |
1154 | msg->exec(); | 1154 | msg->exec(); |
1155 | delete msg; | 1155 | delete msg; |
1156 | 1156 | ||
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | QString MainWindow::defaultFileName() | 1159 | QString MainWindow::defaultFileName() |
1160 | { | 1160 | { |
1161 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1161 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1164 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1165 | { | 1165 | { |
1166 | if ( !incidence ) { | 1166 | if ( !incidence ) { |
1167 | enableIncidenceActions( false ); | 1167 | enableIncidenceActions( false ); |
1168 | 1168 | ||
1169 | mNewSubTodoAction->setEnabled( false ); | 1169 | mNewSubTodoAction->setEnabled( false ); |
1170 | setCaptionToDates(); | 1170 | setCaptionToDates(); |
1171 | return; | 1171 | return; |
1172 | 1172 | ||
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | //KGlobal::locale()->formatDateTime(nextA, true); | 1175 | //KGlobal::locale()->formatDateTime(nextA, true); |
1176 | QString startString = ""; | 1176 | QString startString = ""; |
1177 | if ( incidence->type() != "Todo" ) { | 1177 | if ( incidence->type() != "Todo" ) { |
1178 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1178 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1179 | if ( incidence->doesFloat() ) { | 1179 | if ( incidence->doesFloat() ) { |
1180 | startString += ": "+incidence->dtStartDateStr( true ); | 1180 | startString += ": "+incidence->dtStartDateStr( true ); |
1181 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1181 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1182 | 1182 | ||
1183 | } else { | 1183 | } else { |
1184 | startString = ": "+incidence->dtStartStr(true); | 1184 | startString = ": "+incidence->dtStartStr(true); |
1185 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1185 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1186 | 1186 | ||
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | } else { | 1189 | } else { |
1190 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1190 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1191 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1191 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1192 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1192 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1193 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1193 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | } | 1196 | } |
1197 | else | 1197 | else |
1198 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1198 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1199 | if ( !incidence->location().isEmpty() ) | 1199 | if ( !incidence->location().isEmpty() ) |
1200 | startString += " (" +incidence->location()+")"; | 1200 | startString += " (" +incidence->location()+")"; |
1201 | setCaption( incidence->summary()+startString); | 1201 | setCaption( incidence->summary()+startString); |
1202 | 1202 | ||
1203 | enableIncidenceActions( true ); | 1203 | enableIncidenceActions( true ); |
1204 | 1204 | ||
1205 | if ( incidence->type() == "Event" ) { | 1205 | if ( incidence->type() == "Event" ) { |
1206 | mShowAction->setText( i18n("Show Event...") ); | 1206 | mShowAction->setText( i18n("Show Event...") ); |
1207 | mEditAction->setText( i18n("Edit Event...") ); | 1207 | mEditAction->setText( i18n("Edit Event...") ); |
1208 | mDeleteAction->setText( i18n("Delete Event...") ); | 1208 | mDeleteAction->setText( i18n("Delete Event...") ); |
1209 | 1209 | ||
1210 | mNewSubTodoAction->setEnabled( false ); | 1210 | mNewSubTodoAction->setEnabled( false ); |
1211 | } else if ( incidence->type() == "Todo" ) { | 1211 | } else if ( incidence->type() == "Todo" ) { |
1212 | mShowAction->setText( i18n("Show Todo...") ); | 1212 | mShowAction->setText( i18n("Show Todo...") ); |
1213 | mEditAction->setText( i18n("Edit Todo...") ); | 1213 | mEditAction->setText( i18n("Edit Todo...") ); |
1214 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1214 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1215 | 1215 | ||
1216 | mNewSubTodoAction->setEnabled( true ); | 1216 | mNewSubTodoAction->setEnabled( true ); |
1217 | } else { | 1217 | } else { |
1218 | mShowAction->setText( i18n("Show...") ); | 1218 | mShowAction->setText( i18n("Show...") ); |
1219 | mShowAction->setText( i18n("Edit...") ); | 1219 | mShowAction->setText( i18n("Edit...") ); |
1220 | mShowAction->setText( i18n("Delete...") ); | 1220 | mShowAction->setText( i18n("Delete...") ); |
1221 | 1221 | ||
1222 | mNewSubTodoAction->setEnabled( false ); | 1222 | mNewSubTodoAction->setEnabled( false ); |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | void MainWindow::enableIncidenceActions( bool enabled ) | 1226 | void MainWindow::enableIncidenceActions( bool enabled ) |
1227 | { | 1227 | { |
1228 | mShowAction->setEnabled( enabled ); | 1228 | mShowAction->setEnabled( enabled ); |
1229 | mEditAction->setEnabled( enabled ); | 1229 | mEditAction->setEnabled( enabled ); |
1230 | mDeleteAction->setEnabled( enabled ); | 1230 | mDeleteAction->setEnabled( enabled ); |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | void MainWindow::importOL() | 1233 | void MainWindow::importOL() |
1234 | { | 1234 | { |
1235 | #ifdef _WIN32_ | 1235 | #ifdef _WIN32_ |
1236 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1236 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1237 | id->exec(); | 1237 | id->exec(); |
1238 | delete id; | 1238 | delete id; |
1239 | mView->updateView(); | 1239 | mView->updateView(); |
1240 | #endif | 1240 | #endif |
1241 | } | 1241 | } |
1242 | void MainWindow::importBday() | 1242 | void MainWindow::importBday() |
1243 | { | 1243 | { |
1244 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1244 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1245 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1245 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1246 | i18n("Import!"), i18n("Cancel"), 0, | 1246 | i18n("Import!"), i18n("Cancel"), 0, |
1247 | 0, 1 ); | 1247 | 0, 1 ); |
1248 | if ( result == 0 ) { | 1248 | if ( result == 0 ) { |
1249 | mView->importBday(); | 1249 | mView->importBday(); |
1250 | 1250 | ||
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | 1253 | ||
1254 | } | 1254 | } |
1255 | void MainWindow::importQtopia() | 1255 | void MainWindow::importQtopia() |
1256 | { | 1256 | { |
1257 | #ifndef DESKTOP_VERSION | 1257 | #ifndef DESKTOP_VERSION |
1258 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1258 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1259 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1259 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1260 | i18n("Import!"), i18n("Cancel"), 0, | 1260 | i18n("Import!"), i18n("Cancel"), 0, |
1261 | 0, 1 ); | 1261 | 0, 1 ); |
1262 | if ( result == 0 ) { | 1262 | if ( result == 0 ) { |
1263 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1263 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1264 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1264 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1265 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1265 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1266 | mView->importQtopia( categories, datebook, todolist ); | 1266 | mView->importQtopia( categories, datebook, todolist ); |
1267 | } | 1267 | } |
1268 | #else | 1268 | #else |
1269 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1269 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1270 | i18n("Not supported \non desktop!\n"), | 1270 | i18n("Not supported \non desktop!\n"), |
1271 | i18n("Ok"), i18n("Cancel"), 0, | 1271 | i18n("Ok"), i18n("Cancel"), 0, |
1272 | 0, 1 ); | 1272 | 0, 1 ); |
1273 | 1273 | ||
1274 | #endif | 1274 | #endif |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | void MainWindow::saveOnClose() | 1277 | void MainWindow::saveOnClose() |
1278 | { | 1278 | { |
1279 | KOPrefs *p = KOPrefs::instance(); | 1279 | KOPrefs *p = KOPrefs::instance(); |
1280 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1280 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1281 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1281 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1282 | iconToolBar->y() > height()/2; | 1282 | iconToolBar->y() > height()/2; |
1283 | mView->writeSettings(); | 1283 | mView->writeSettings(); |
1284 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1284 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1285 | save(); | 1285 | save(); |
1286 | } | 1286 | } |
1287 | void MainWindow::slotModifiedChanged( bool changed ) | 1287 | void MainWindow::slotModifiedChanged( bool changed ) |
1288 | { | 1288 | { |
1289 | if ( mBlockAtStartup ) | 1289 | if ( mBlockAtStartup ) |
1290 | return; | 1290 | return; |
1291 | int msec; | 1291 | int msec; |
1292 | // we store the changes after 1 minute, | 1292 | // we store the changes after 1 minute, |
1293 | // and for safety reasons after 10 minutes again | 1293 | // and for safety reasons after 10 minutes again |
1294 | if ( !mBlockSaveFlag ) | 1294 | if ( !mBlockSaveFlag ) |
1295 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1295 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1296 | else | 1296 | else |
1297 | msec = 1000 * 600; | 1297 | msec = 1000 * 600; |
1298 | mSaveTimer.start( msec, true ); // 1 minute | 1298 | mSaveTimer.start( msec, true ); // 1 minute |
1299 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1299 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1300 | mCalendarModifiedFlag = true; | 1300 | mCalendarModifiedFlag = true; |
1301 | } | 1301 | } |
1302 | #include <qfileinfo.h> | 1302 | #include <qfileinfo.h> |
1303 | void MainWindow::save() | 1303 | void MainWindow::save() |
1304 | { | 1304 | { |
1305 | if ( mBlockSaveFlag ) | 1305 | if ( mBlockSaveFlag ) |
1306 | return; | 1306 | return; |
1307 | bool store = mBlockSaveFlag; | 1307 | bool store = mBlockSaveFlag; |
1308 | mBlockSaveFlag = true; | 1308 | mBlockSaveFlag = true; |
1309 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1309 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1310 | 1310 | ||
1311 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1311 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1312 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1312 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1313 | qDebug("KO: Start saving data to file!"); | 1313 | qDebug("KO: Start saving data to file!"); |
1314 | mView->saveCalendar( defaultFileName() ); | 1314 | mView->saveCalendar( defaultFileName() ); |
1315 | 1315 | ||
1316 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1316 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1317 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); | 1317 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); |
1318 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1318 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1319 | QString savemes; | 1319 | QString savemes; |
1320 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1320 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1321 | setCaption(savemes); | 1321 | setCaption(savemes); |
1322 | } else | 1322 | } else |
1323 | setCaption(i18n("Saving cancelled!")); | 1323 | setCaption(i18n("Saving cancelled!")); |
1324 | mCalendarModifiedFlag = false; | 1324 | mCalendarModifiedFlag = false; |
1325 | mBlockSaveFlag = store; | 1325 | mBlockSaveFlag = store; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1328 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1329 | { | 1329 | { |
1330 | if ( !e->isAutoRepeat() ) { | 1330 | if ( !e->isAutoRepeat() ) { |
1331 | mFlagKeyPressed = false; | 1331 | mFlagKeyPressed = false; |
1332 | } | 1332 | } |
1333 | } | 1333 | } |
1334 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1334 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1335 | { | 1335 | { |
1336 | qApp->processEvents(); | 1336 | qApp->processEvents(); |
1337 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1337 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1338 | e->ignore(); | 1338 | e->ignore(); |
1339 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1339 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1340 | return; | 1340 | return; |
1341 | } | 1341 | } |
1342 | if (! e->isAutoRepeat() ) | 1342 | if (! e->isAutoRepeat() ) |
1343 | mFlagKeyPressed = true; | 1343 | mFlagKeyPressed = true; |
1344 | KOPrefs *p = KOPrefs::instance(); | 1344 | KOPrefs *p = KOPrefs::instance(); |
1345 | bool showSelectedDates = false; | 1345 | bool showSelectedDates = false; |
1346 | int size; | 1346 | int size; |
1347 | int pro = 0; | 1347 | int pro = 0; |
1348 | //qDebug("MainWindow::keyPressEvent "); | 1348 | //qDebug("MainWindow::keyPressEvent "); |
1349 | switch ( e->key() ) { | 1349 | switch ( e->key() ) { |
1350 | case Qt::Key_Right: | 1350 | case Qt::Key_Right: |
1351 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1351 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1352 | mView->goNextMonth(); | 1352 | mView->goNextMonth(); |
1353 | else | 1353 | else |
1354 | mView->goNext(); | 1354 | mView->goNext(); |
1355 | showSelectedDates = true; | 1355 | showSelectedDates = true; |
1356 | break; | 1356 | break; |
1357 | case Qt::Key_Left: | 1357 | case Qt::Key_Left: |
1358 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1358 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1359 | mView->goPreviousMonth(); | 1359 | mView->goPreviousMonth(); |
1360 | else | 1360 | else |
1361 | mView->goPrevious(); | 1361 | mView->goPrevious(); |
1362 | showSelectedDates = true; | 1362 | showSelectedDates = true; |
1363 | break; | 1363 | break; |
1364 | case Qt::Key_Down: | 1364 | case Qt::Key_Down: |
1365 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1365 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1366 | break; | 1366 | break; |
1367 | case Qt::Key_Up: | 1367 | case Qt::Key_Up: |
1368 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1368 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1369 | break; | 1369 | break; |
1370 | case Qt::Key_I: | 1370 | case Qt::Key_I: |
1371 | mView->showIncidence(); | 1371 | mView->showIncidence(); |
1372 | break; | 1372 | break; |
1373 | case Qt::Key_Delete: | 1373 | case Qt::Key_Delete: |
1374 | case Qt::Key_Backspace: | 1374 | case Qt::Key_Backspace: |
1375 | mView->deleteIncidence(); | 1375 | mView->deleteIncidence(); |
1376 | break; | 1376 | break; |
1377 | case Qt::Key_D: | 1377 | case Qt::Key_D: |
1378 | mView->viewManager()->showDayView(); | 1378 | mView->viewManager()->showDayView(); |
1379 | showSelectedDates = true; | 1379 | showSelectedDates = true; |
1380 | break; | 1380 | break; |
1381 | case Qt::Key_O: | 1381 | case Qt::Key_O: |
1382 | mView->toggleFilerEnabled( ); | 1382 | mView->toggleFilerEnabled( ); |
1383 | break; | 1383 | break; |
1384 | case Qt::Key_0: | 1384 | case Qt::Key_0: |
1385 | case Qt::Key_1: | 1385 | case Qt::Key_1: |
1386 | case Qt::Key_2: | 1386 | case Qt::Key_2: |
1387 | case Qt::Key_3: | 1387 | case Qt::Key_3: |
1388 | case Qt::Key_4: | 1388 | case Qt::Key_4: |
1389 | case Qt::Key_5: | 1389 | case Qt::Key_5: |
1390 | case Qt::Key_6: | 1390 | case Qt::Key_6: |
1391 | case Qt::Key_7: | 1391 | case Qt::Key_7: |
1392 | case Qt::Key_8: | 1392 | case Qt::Key_8: |
1393 | case Qt::Key_9: | 1393 | case Qt::Key_9: |
1394 | pro = e->key()-48; | 1394 | pro = e->key()-48; |
1395 | if ( pro == 0 ) | 1395 | if ( pro == 0 ) |
1396 | pro = 10; | 1396 | pro = 10; |
1397 | if ( e->state() == Qt::ControlButton) | 1397 | if ( e->state() == Qt::ControlButton) |
1398 | pro += 10; | 1398 | pro += 10; |
1399 | break; | 1399 | break; |
1400 | case Qt::Key_M: | 1400 | case Qt::Key_M: |
1401 | mView->viewManager()->showMonthView(); | 1401 | mView->viewManager()->showMonthView(); |
1402 | showSelectedDates = true; | 1402 | showSelectedDates = true; |
1403 | break; | 1403 | break; |
1404 | case Qt::Key_Insert: | 1404 | case Qt::Key_Insert: |
1405 | mView->newEvent(); | 1405 | mView->newEvent(); |
1406 | break; | 1406 | break; |
1407 | case Qt::Key_S : | 1407 | case Qt::Key_S : |
1408 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1408 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1409 | mView->newSubTodo(); | 1409 | mView->newSubTodo(); |
1410 | else | 1410 | else |
1411 | mView->dialogManager()->showSearchDialog(); | 1411 | mView->dialogManager()->showSearchDialog(); |
1412 | break; | 1412 | break; |
1413 | case Qt::Key_Y : | 1413 | case Qt::Key_Y : |
1414 | case Qt::Key_Z : | 1414 | case Qt::Key_Z : |
1415 | mView->viewManager()->showWorkWeekView(); | 1415 | mView->viewManager()->showWorkWeekView(); |
1416 | showSelectedDates = true; | 1416 | showSelectedDates = true; |
1417 | break; | 1417 | break; |
1418 | case Qt::Key_U : | 1418 | case Qt::Key_U : |
1419 | mView->viewManager()->showWeekView(); | 1419 | mView->viewManager()->showWeekView(); |
1420 | showSelectedDates = true; | 1420 | showSelectedDates = true; |
1421 | break; | 1421 | break; |
1422 | case Qt::Key_H : | 1422 | case Qt::Key_H : |
1423 | keyBindings(); | 1423 | keyBindings(); |
1424 | break; | 1424 | break; |
1425 | case Qt::Key_W: | 1425 | case Qt::Key_W: |
1426 | mView->viewManager()->showWhatsNextView(); | 1426 | mView->viewManager()->showWhatsNextView(); |
1427 | break; | 1427 | break; |
1428 | case Qt::Key_L: | 1428 | case Qt::Key_L: |
1429 | mView->viewManager()->showListView(); | 1429 | mView->viewManager()->showListView(); |
1430 | break; | 1430 | break; |
1431 | case Qt::Key_N: | 1431 | case Qt::Key_N: |
1432 | mView->viewManager()->showNextXView(); | 1432 | mView->viewManager()->showNextXView(); |
1433 | showSelectedDates = true; | 1433 | showSelectedDates = true; |
1434 | break; | 1434 | break; |
1435 | case Qt::Key_V: | 1435 | case Qt::Key_V: |
1436 | mView->viewManager()->showTodoView(); | 1436 | mView->viewManager()->showTodoView(); |
1437 | break; | 1437 | break; |
1438 | case Qt::Key_C: | 1438 | case Qt::Key_C: |
1439 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1439 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1440 | break; | 1440 | break; |
1441 | case Qt::Key_P: | 1441 | case Qt::Key_P: |
1442 | mView->showDatePicker( ); | 1442 | mView->showDatePicker( ); |
1443 | break; | 1443 | break; |
1444 | case Qt::Key_F: | 1444 | case Qt::Key_F: |
1445 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1445 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1446 | mView->editFilters(); | 1446 | mView->editFilters(); |
1447 | else | 1447 | else |
1448 | mView->toggleFilter(); | 1448 | mView->toggleFilter(); |
1449 | break; | 1449 | break; |
1450 | case Qt::Key_X: | 1450 | case Qt::Key_X: |
1451 | mView->toggleDateNavigatorWidget(); | 1451 | mView->toggleDateNavigatorWidget(); |
1452 | break; | 1452 | break; |
1453 | case Qt::Key_Space: | 1453 | case Qt::Key_Space: |
1454 | mView->toggleExpand(); | 1454 | mView->toggleExpand(); |
1455 | break; | 1455 | break; |
1456 | case Qt::Key_A: | 1456 | case Qt::Key_A: |
1457 | mView->toggleAllDaySize(); | 1457 | mView->toggleAllDaySize(); |
1458 | break; | 1458 | break; |
1459 | case Qt::Key_T: | 1459 | case Qt::Key_T: |
1460 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1460 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1461 | mView->newTodo(); | 1461 | mView->newTodo(); |
1462 | else { | 1462 | else { |
1463 | mView->goToday(); | 1463 | mView->goToday(); |
1464 | showSelectedDates = true; | 1464 | showSelectedDates = true; |
1465 | } | 1465 | } |
1466 | break; | 1466 | break; |
1467 | case Qt::Key_J: | 1467 | case Qt::Key_J: |
1468 | mView->viewManager()->showJournalView(); | 1468 | mView->viewManager()->showJournalView(); |
1469 | break; | 1469 | break; |
1470 | case Qt::Key_B: | 1470 | case Qt::Key_B: |
1471 | mView->editIncidenceDescription();; | 1471 | mView->editIncidenceDescription();; |
1472 | break; | 1472 | break; |
1473 | // case Qt::Key_Return: | 1473 | // case Qt::Key_Return: |
1474 | case Qt::Key_E: | 1474 | case Qt::Key_E: |
1475 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1475 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1476 | mView->newEvent(); | 1476 | mView->newEvent(); |
1477 | else | 1477 | else |
1478 | mView->editIncidence(); | 1478 | mView->editIncidence(); |
1479 | break; | 1479 | break; |
1480 | case Qt::Key_Plus: | 1480 | case Qt::Key_Plus: |
1481 | size = p->mHourSize +2; | 1481 | size = p->mHourSize +2; |
1482 | if ( size <= 18 ) | 1482 | if ( size <= 18 ) |
1483 | configureAgenda( size ); | 1483 | configureAgenda( size ); |
1484 | break; | 1484 | break; |
1485 | case Qt::Key_Minus: | 1485 | case Qt::Key_Minus: |
1486 | size = p->mHourSize - 2; | 1486 | size = p->mHourSize - 2; |
1487 | if ( size >= 4 ) | 1487 | if ( size >= 4 ) |
1488 | configureAgenda( size ); | 1488 | configureAgenda( size ); |
1489 | break; | 1489 | break; |
1490 | 1490 | ||
1491 | 1491 | ||
1492 | default: | 1492 | default: |
1493 | e->ignore(); | 1493 | e->ignore(); |
1494 | } | 1494 | } |
1495 | if ( pro > 0 ) { | 1495 | if ( pro > 0 ) { |
1496 | mView->selectFilter( pro-1 ); | 1496 | mView->selectFilter( pro-1 ); |
1497 | } | 1497 | } |
1498 | if ( showSelectedDates ) { | 1498 | if ( showSelectedDates ) { |
1499 | ;// setCaptionToDates(); | 1499 | ;// setCaptionToDates(); |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | void MainWindow::configureToolBar( int item ) | 1504 | void MainWindow::configureToolBar( int item ) |
1505 | { | 1505 | { |
1506 | 1506 | ||
1507 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1507 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1508 | KOPrefs *p = KOPrefs::instance(); | 1508 | KOPrefs *p = KOPrefs::instance(); |
1509 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1509 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1510 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1510 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1511 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1511 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1512 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1512 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1513 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1513 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1514 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1514 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1515 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1515 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1516 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1516 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1517 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1517 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1518 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1518 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1519 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1519 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1520 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1520 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1521 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1521 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1522 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1522 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1523 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1523 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1524 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1524 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1525 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1525 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1526 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1526 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1527 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1527 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1528 | // initActions(); | 1528 | // initActions(); |
1529 | } | 1529 | } |
1530 | 1530 | ||
1531 | void MainWindow::setCaptionToDates() | 1531 | void MainWindow::setCaptionToDates() |
1532 | { | 1532 | { |
1533 | QString selDates; | 1533 | QString selDates; |
1534 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1534 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1535 | if (mView->startDate() < mView->endDate() ) | 1535 | if (mView->startDate() < mView->endDate() ) |
1536 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1536 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1537 | setCaption( i18n("Dates: ") + selDates ); | 1537 | setCaption( i18n("Dates: ") + selDates ); |
1538 | 1538 | ||
1539 | } | 1539 | } |
1540 | // parameter item == 0: reinit | 1540 | // parameter item == 0: reinit |
1541 | void MainWindow::configureAgenda( int item ) | 1541 | void MainWindow::configureAgenda( int item ) |
1542 | { | 1542 | { |
1543 | 1543 | ||
1544 | KOPrefs *p = KOPrefs::instance(); | 1544 | KOPrefs *p = KOPrefs::instance(); |
1545 | 1545 | ||
1546 | int i; | 1546 | int i; |
1547 | if ( item == 1 ) { | 1547 | if ( item == 1 ) { |
1548 | mView->toggleAllDaySize(); | 1548 | mView->toggleAllDaySize(); |
1549 | return; | 1549 | return; |
1550 | } | 1550 | } |
1551 | // do not allow 4 for widgets higher than 480 | 1551 | // do not allow 4 for widgets higher than 480 |
1552 | // if ( QApplication::desktop()->height() > 480 ) { | 1552 | // if ( QApplication::desktop()->height() > 480 ) { |
1553 | // if ( item == 4 ) | 1553 | // if ( item == 4 ) |
1554 | // item = 6; | 1554 | // item = 6; |
1555 | // } | 1555 | // } |
1556 | for ( i = 4; i <= 18; i= i+2 ) | 1556 | for ( i = 4; i <= 18; i= i+2 ) |
1557 | configureAgendaMenu->setItemChecked( i, false ); | 1557 | configureAgendaMenu->setItemChecked( i, false ); |
1558 | configureAgendaMenu->setItemChecked( item, true ); | 1558 | configureAgendaMenu->setItemChecked( item, true ); |
1559 | if ( p->mHourSize == item ) | 1559 | if ( p->mHourSize == item ) |
1560 | return; | 1560 | return; |
1561 | p->mHourSize=item; | 1561 | p->mHourSize=item; |
1562 | mView->viewManager()->agendaView()->updateConfig(); | 1562 | mView->viewManager()->agendaView()->updateConfig(); |
1563 | } | 1563 | } |
1564 | 1564 | ||
1565 | void MainWindow::saveCalendar() | 1565 | void MainWindow::saveCalendar() |
1566 | { | 1566 | { |
1567 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1567 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1568 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1568 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1569 | 1569 | ||
1570 | if ( fn == "" ) | 1570 | if ( fn == "" ) |
1571 | return; | 1571 | return; |
1572 | QFileInfo info; | 1572 | QFileInfo info; |
1573 | info.setFile( fn ); | 1573 | info.setFile( fn ); |
1574 | QString mes; | 1574 | QString mes; |
1575 | bool createbup = true; | 1575 | bool createbup = true; |
1576 | if ( info. exists() ) { | 1576 | if ( info. exists() ) { |
1577 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1577 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1578 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1578 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1579 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1579 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1580 | 0, 1 ); | 1580 | 0, 1 ); |
1581 | if ( result != 0 ) { | 1581 | if ( result != 0 ) { |
1582 | createbup = false; | 1582 | createbup = false; |
1583 | } | 1583 | } |
1584 | } | 1584 | } |
1585 | if ( createbup ) { | 1585 | if ( createbup ) { |
1586 | mView->saveCalendar( fn ); | 1586 | mView->saveCalendar( fn ); |
1587 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1587 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1588 | KOPrefs::instance()->mLastSaveFile = fn; | 1588 | KOPrefs::instance()->mLastSaveFile = fn; |
1589 | setCaption(mes); | 1589 | setCaption(mes); |
1590 | } | 1590 | } |
1591 | } | 1591 | } |
1592 | void MainWindow::loadCalendar() | 1592 | void MainWindow::loadCalendar() |
1593 | { | 1593 | { |
1594 | 1594 | ||
1595 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1595 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1596 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1596 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1597 | 1597 | ||
1598 | if ( fn == "" ) | 1598 | if ( fn == "" ) |
1599 | return; | 1599 | return; |
1600 | QFileInfo info; | 1600 | QFileInfo info; |
1601 | info.setFile( fn ); | 1601 | info.setFile( fn ); |
1602 | QString mess; | 1602 | QString mess; |
1603 | bool loadbup = true; | 1603 | bool loadbup = true; |
1604 | if ( info. exists() ) { | 1604 | if ( info. exists() ) { |
1605 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1605 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1606 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1606 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1607 | mess, | 1607 | mess, |
1608 | i18n("Load!"), i18n("Cancel"), 0, | 1608 | i18n("Load!"), i18n("Cancel"), 0, |
1609 | 0, 1 ); | 1609 | 0, 1 ); |
1610 | if ( result != 0 ) { | 1610 | if ( result != 0 ) { |
1611 | loadbup = false; | 1611 | loadbup = false; |
1612 | } | 1612 | } |
1613 | } else { | 1613 | } else { |
1614 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1614 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1615 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1615 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1616 | 0, 1 ); | 1616 | 0, 1 ); |
1617 | 1617 | ||
1618 | return; | 1618 | return; |
1619 | } | 1619 | } |
1620 | if ( loadbup ) { | 1620 | if ( loadbup ) { |
1621 | mView->openCalendar( fn ); | 1621 | mView->openCalendar( fn ); |
1622 | KOPrefs::instance()->mLastLoadFile = fn; | 1622 | KOPrefs::instance()->mLastLoadFile = fn; |
1623 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1623 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1624 | setCaption(mess); | 1624 | setCaption(mess); |
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | } | 1627 | } |
1628 | void MainWindow::quickImportIcal() | 1628 | void MainWindow::quickImportIcal() |
1629 | { | 1629 | { |
1630 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1630 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1631 | } | 1631 | } |
1632 | void MainWindow::importFile( QString fn, bool quick ) | 1632 | void MainWindow::importFile( QString fn, bool quick ) |
1633 | { | 1633 | { |
1634 | QFileInfo info; | 1634 | QFileInfo info; |
1635 | info.setFile( fn ); | 1635 | info.setFile( fn ); |
1636 | QString mess; | 1636 | QString mess; |
1637 | bool loadbup = true; | 1637 | bool loadbup = true; |
1638 | if ( !info. exists() ) { | 1638 | if ( !info. exists() ) { |
1639 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1639 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1640 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1640 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1641 | mess ); | 1641 | mess ); |
1642 | return; | 1642 | return; |
1643 | } | 1643 | } |
1644 | int result = 0; | 1644 | int result = 0; |