-rw-r--r-- | korganizer/koprefs.cpp | 65 | ||||
-rw-r--r-- | korganizer/koprefs.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
3 files changed, 45 insertions, 30 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 9366c11..8f37793 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,479 +1,490 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 42 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "mainwindow.h" | 47 | #include "mainwindow.h" |
48 | 48 | ||
49 | KOPrefs *KOPrefs::mInstance = 0; | 49 | KOPrefs *KOPrefs::mInstance = 0; |
50 | static KStaticDeleter<KOPrefs> insd; | 50 | static KStaticDeleter<KOPrefs> insd; |
51 | 51 | ||
52 | KOPrefs::KOPrefs() : | 52 | KOPrefs::KOPrefs() : |
53 | KPimPrefs("korganizerrc") | 53 | KPimPrefs("korganizerrc") |
54 | { | 54 | { |
55 | mCategoryColors.setAutoDelete(true); | 55 | mCategoryColors.setAutoDelete(true); |
56 | fillMailDefaults(); | 56 | fillMailDefaults(); |
57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
58 | QColor defaultHolidayColor = QColor(255,0,0); | 58 | QColor defaultHolidayColor = QColor(255,0,0); |
59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
63 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 63 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
64 | 64 | ||
65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | 65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); |
66 | mDefaultViewFont = QFont("helvetica",10); | 66 | mDefaultViewFont = QFont("helvetica",10); |
67 | mDefaultMonthViewFont = QFont("helvetica",8); | 67 | mDefaultMonthViewFont = QFont("helvetica",8); |
68 | mMarcusBainsFont= QFont("helvetica",10); | 68 | mMarcusBainsFont= QFont("helvetica",10); |
69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | 69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); |
70 | mEditBoxFont = QFont("helvetica",12); | 70 | mEditBoxFont = QFont("helvetica",12); |
71 | mJornalViewFont = QFont("helvetica",12); | 71 | mJornalViewFont = QFont("helvetica",12); |
72 | 72 | ||
73 | KPrefs::setCurrentGroup("General"); | 73 | KPrefs::setCurrentGroup("General"); |
74 | 74 | ||
75 | 75 | ||
76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
77 | 77 | ||
78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
81 | addItemBool("ShowIconList",&mShowIconList,true); | 81 | addItemBool("ShowIconList",&mShowIconList,true); |
82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
88 | addItemBool("ShowIconBack",&mShowIconBack,true); | 88 | addItemBool("ShowIconBack",&mShowIconBack,true); |
89 | addItemBool("ShowIconToday",&mShowIconToday,true); | 89 | addItemBool("ShowIconToday",&mShowIconToday,true); |
90 | addItemBool("ShowIconForward",&mShowIconForward,true); | 90 | addItemBool("ShowIconForward",&mShowIconForward,true); |
91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
94 | addItemBool("ShowIconNext",&mShowIconNext,true); | 94 | addItemBool("ShowIconNext",&mShowIconNext,true); |
95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
98 | 98 | ||
99 | addItemBool("AskForQuit",&mAskForQuit,false); | 99 | addItemBool("AskForQuit",&mAskForQuit,false); |
100 | 100 | ||
101 | #ifndef DESKTOP_VERSION | 101 | #ifndef DESKTOP_VERSION |
102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
103 | #else | 103 | #else |
104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
105 | #endif | 105 | #endif |
106 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 106 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
107 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 107 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
111 | 111 | ||
112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
113 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 113 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
114 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 114 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
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 | 142 | ||
143 | addItemInt("Default Start Time",&mStartTime,10); | 143 | addItemInt("Default Start Time",&mStartTime,10); |
144 | addItemInt("Default Duration",&mDefaultDuration,2); | 144 | addItemInt("Default Duration",&mDefaultDuration,2); |
145 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 145 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
146 | KPrefs::setCurrentGroup("AlarmSettings"); | 146 | KPrefs::setCurrentGroup("AlarmSettings"); |
147 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 147 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
148 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 148 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
149 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 149 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
150 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 150 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
151 | 151 | ||
152 | 152 | ||
153 | KPrefs::setCurrentGroup("Calendar"); | 153 | KPrefs::setCurrentGroup("Calendar"); |
154 | 154 | ||
155 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 155 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
156 | 156 | ||
157 | KPrefs::setCurrentGroup("Fonts"); | 157 | KPrefs::setCurrentGroup("Fonts"); |
158 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 158 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
159 | addItemFont("TimeBar Font",&mTimeBarFont); | 159 | addItemFont("TimeBar Font",&mTimeBarFont); |
160 | addItemFont("MonthView Font",&mMonthViewFont); | 160 | addItemFont("MonthView Font",&mMonthViewFont); |
161 | addItemFont("AgendaView Font",&mAgendaViewFont); | 161 | addItemFont("AgendaView Font",&mAgendaViewFont); |
162 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 162 | addItemFont("MarcusBains Font",&mMarcusBainsFont); |
163 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 163 | addItemFont("TimeLabels Font",&mTimeLabelsFont); |
164 | addItemFont("TodoView Font",&mTodoViewFont); | 164 | addItemFont("TodoView Font",&mTodoViewFont); |
165 | addItemFont("ListView Font",&mListViewFont); | 165 | addItemFont("ListView Font",&mListViewFont); |
166 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 166 | addItemFont("DateNavigator Font",&mDateNavigatorFont); |
167 | addItemFont("EditBox Font",&mEditBoxFont); | 167 | addItemFont("EditBox Font",&mEditBoxFont); |
168 | addItemFont("JournalView Font",&mJornalViewFont); | 168 | addItemFont("JournalView Font",&mJornalViewFont); |
169 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 169 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
170 | addItemFont("EventView Font",&mEventViewFont); | 170 | addItemFont("EventView Font",&mEventViewFont); |
171 | 171 | ||
172 | KPrefs::setCurrentGroup("RemoteSyncing"); | 172 | KPrefs::setCurrentGroup("RemoteSyncing"); |
173 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 173 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
174 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 174 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
175 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 175 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
176 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 176 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
177 | 177 | ||
178 | #ifdef _WIN32_ | 178 | #ifdef _WIN32_ |
179 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 179 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
180 | #else | 180 | #else |
181 | QString hdp= locateLocal("data","korganizer")+"/"; | 181 | QString hdp= locateLocal("data","korganizer")+"/"; |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 184 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
185 | 185 | ||
186 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 186 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
187 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 187 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
188 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 188 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
189 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 189 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
190 | 190 | ||
191 | 191 | ||
192 | KPrefs::setCurrentGroup("Locale"); | 192 | KPrefs::setCurrentGroup("Locale"); |
193 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 193 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
194 | 194 | ||
195 | 195 | ||
196 | KPrefs::setCurrentGroup("Colors"); | 196 | KPrefs::setCurrentGroup("Colors"); |
197 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 197 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
198 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 198 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
199 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 199 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
200 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 200 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
201 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 201 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
202 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 202 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
203 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 203 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
204 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 204 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
205 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 205 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
206 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 206 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
207 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 207 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
208 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 208 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
209 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 209 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
210 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 210 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
211 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 211 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
212 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 212 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
213 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 213 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
214 | addItemBool("UseAppColors",&mUseAppColors,false); | 214 | addItemBool("UseAppColors",&mUseAppColors,false); |
215 | 215 | ||
216 | 216 | ||
217 | 217 | ||
218 | KPrefs::setCurrentGroup("Views"); | 218 | KPrefs::setCurrentGroup("Views"); |
219 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 219 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
220 | addItemInt("Hour Size",&mHourSize,8); | 220 | addItemInt("Hour Size",&mHourSize,8); |
221 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 221 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
222 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 222 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
223 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 223 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
224 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 224 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
225 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 225 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
226 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 226 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
227 | #ifdef DESKTOP_VERION | 227 | #ifdef DESKTOP_VERION |
228 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 228 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
229 | #else | 229 | #else |
230 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 230 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
231 | #endif | 231 | #endif |
232 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 232 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
233 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 233 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
234 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 234 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
235 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 235 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
236 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 236 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
237 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 237 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
238 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 238 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
239 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 239 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
240 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 240 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
241 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 241 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
242 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 242 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
243 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 243 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
244 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 244 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
245 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 245 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
246 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 246 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
247 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 247 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
248 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 248 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
249 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 249 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
250 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 250 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
251 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 251 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
252 | #ifdef DESKTOP_VERSION | 252 | #ifdef DESKTOP_VERSION |
253 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 253 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
254 | #else | 254 | #else |
255 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 255 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
256 | #endif | 256 | #endif |
257 | addItemInt("Day Begins",&mDayBegins,7); | 257 | addItemInt("Day Begins",&mDayBegins,7); |
258 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 258 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
259 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 259 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
260 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 260 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
261 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 261 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
262 | 262 | ||
263 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 263 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
264 | addItemBool("Full View Month",&mFullViewMonth,true); | 264 | addItemBool("Full View Month",&mFullViewMonth,true); |
265 | addItemBool("Full View Todo",&mFullViewTodo,true); | 265 | addItemBool("Full View Todo",&mFullViewTodo,true); |
266 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 266 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
267 | 267 | ||
268 | addItemInt("Next X Days",&mNextXDays,3); | 268 | addItemInt("Next X Days",&mNextXDays,3); |
269 | 269 | ||
270 | KPrefs::setCurrentGroup("Printer"); | 270 | KPrefs::setCurrentGroup("Printer"); |
271 | 271 | ||
272 | KPrefs::setCurrentGroup("Layout"); | 272 | KPrefs::setCurrentGroup("Layout"); |
273 | 273 | ||
274 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 274 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
275 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 275 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
276 | 276 | ||
277 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 277 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
278 | 278 | ||
279 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 279 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
280 | 280 | ||
281 | KPrefs::setCurrentGroup("Group Scheduling"); | 281 | KPrefs::setCurrentGroup("Group Scheduling"); |
282 | 282 | ||
283 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 283 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
284 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 284 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
285 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 285 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
286 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 286 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
287 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 287 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
288 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 288 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
289 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 289 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
290 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 290 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
291 | 291 | ||
292 | KPrefs::setCurrentGroup( "Editors" ); | 292 | KPrefs::setCurrentGroup( "Editors" ); |
293 | 293 | ||
294 | addItemStringList( "EventTemplates", &mEventTemplates ); | 294 | addItemStringList( "EventTemplates", &mEventTemplates ); |
295 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 295 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
296 | 296 | ||
297 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 297 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
298 | 298 | ||
299 | 299 | ||
300 | 300 | ||
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | KOPrefs::~KOPrefs() | 304 | KOPrefs::~KOPrefs() |
305 | { | 305 | { |
306 | if (mInstance == this) | 306 | if (mInstance == this) |
307 | mInstance = insd.setObject(0); | 307 | mInstance = insd.setObject(0); |
308 | 308 | ||
309 | //qDebug("KOPrefs::~KOPrefs() "); | 309 | //qDebug("KOPrefs::~KOPrefs() "); |
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
313 | KOPrefs *KOPrefs::instance() | 313 | KOPrefs *KOPrefs::instance() |
314 | { | 314 | { |
315 | if (!mInstance) { | 315 | if (!mInstance) { |
316 | mInstance = insd.setObject(new KOPrefs()); | 316 | mInstance = insd.setObject(new KOPrefs()); |
317 | mInstance->readConfig(); | 317 | mInstance->readConfig(); |
318 | } | 318 | } |
319 | 319 | ||
320 | return mInstance; | 320 | return mInstance; |
321 | } | 321 | } |
322 | 322 | ||
323 | void KOPrefs::usrSetDefaults() | 323 | void KOPrefs::usrSetDefaults() |
324 | { | 324 | { |
325 | 325 | ||
326 | } | 326 | } |
327 | 327 | ||
328 | void KOPrefs::fillMailDefaults() | 328 | void KOPrefs::fillMailDefaults() |
329 | { | 329 | { |
330 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 330 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
331 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 331 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
332 | } | 332 | } |
333 | 333 | ||
334 | void KOPrefs::setTimeZoneIdDefault() | 334 | void KOPrefs::setTimeZoneIdDefault() |
335 | { | 335 | { |
336 | ; | 336 | ; |
337 | } | 337 | } |
338 | 338 | ||
339 | void KOPrefs::setAllDefaults() | ||
340 | { | ||
341 | setCategoryDefaults(); | ||
342 | mEventSummaryUser = getDefaultList() ; | ||
343 | mTodoSummaryUser = getDefaultList() ; | ||
344 | mLocationDefaults = getLocationDefaultList(); | ||
345 | } | ||
346 | |||
339 | void KOPrefs::setCategoryDefaults() | 347 | void KOPrefs::setCategoryDefaults() |
340 | { | 348 | { |
341 | mCustomCategories.clear(); | 349 | mCustomCategories.clear(); |
342 | mCustomCategories = getDefaultList(); | 350 | mCustomCategories = getDefaultList(); |
343 | 351 | ||
344 | QStringList::Iterator it; | 352 | QStringList::Iterator it; |
345 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 353 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
346 | setCategoryColor(*it,mDefaultCategoryColor); | 354 | setCategoryColor(*it,mDefaultCategoryColor); |
347 | } | 355 | } |
348 | } | 356 | } |
357 | QStringList KOPrefs::getLocationDefaultList() | ||
358 | { | ||
359 | QStringList retval ; | ||
360 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | ||
361 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | ||
362 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | ||
363 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | ||
364 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | ||
349 | 365 | ||
366 | retval.sort(); | ||
367 | return retval; | ||
368 | } | ||
350 | QStringList KOPrefs::getDefaultList() | 369 | QStringList KOPrefs::getDefaultList() |
351 | { | 370 | { |
352 | QStringList retval ; | 371 | QStringList retval ; |
353 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 372 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
354 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 373 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
355 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 374 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
356 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 375 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
357 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 376 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
358 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 377 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
359 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 378 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
360 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 379 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
361 | retval.sort(); | 380 | retval.sort(); |
362 | //qDebug("cat %s ", retval.join("-").latin1()); | 381 | qDebug("cat %s ", retval.join("-").latin1()); |
363 | return retval; | 382 | return retval; |
364 | } | 383 | } |
365 | 384 | ||
366 | void KOPrefs::usrReadConfig() | 385 | void KOPrefs::usrReadConfig() |
367 | { | 386 | { |
368 | config()->setGroup("General"); | 387 | config()->setGroup("General"); |
369 | 388 | ||
389 | //qDebug("KOPrefs::usrReadConfig() "); | ||
370 | mCustomCategories = config()->readListEntry("Custom Categories"); | 390 | mCustomCategories = config()->readListEntry("Custom Categories"); |
371 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { | ||
372 | mLocationDefaults.clear(); | ||
373 | mEventSummaryUser.clear(); | ||
374 | mTodoSummaryUser.clear(); | ||
375 | } | ||
376 | mOldLoadedLanguage = mOldLanguage ; | 391 | mOldLoadedLanguage = mOldLanguage ; |
377 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 392 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
378 | if (mLocationDefaults.isEmpty()) { | 393 | if (mLocationDefaults.isEmpty()) { |
379 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 394 | mLocationDefaults = getLocationDefaultList(); |
380 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | ||
381 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | ||
382 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | ||
383 | mLocationDefaults.sort(); | ||
384 | } | 395 | } |
385 | 396 | ||
386 | if (mEventSummaryUser.isEmpty()) { | 397 | if (mEventSummaryUser.isEmpty()) { |
387 | mEventSummaryUser = getDefaultList() ; | 398 | mEventSummaryUser = getDefaultList() ; |
388 | } | 399 | } |
389 | if (mTodoSummaryUser.isEmpty()) { | 400 | if (mTodoSummaryUser.isEmpty()) { |
390 | mTodoSummaryUser = getDefaultList() ; | 401 | mTodoSummaryUser = getDefaultList() ; |
391 | } | 402 | } |
392 | 403 | ||
393 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 404 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
394 | 405 | ||
395 | config()->setGroup("Personal Settings"); | 406 | config()->setGroup("Personal Settings"); |
396 | mName = config()->readEntry("user_name",""); | 407 | mName = config()->readEntry("user_name",""); |
397 | mEmail = config()->readEntry("user_email",""); | 408 | mEmail = config()->readEntry("user_email",""); |
398 | fillMailDefaults(); | 409 | fillMailDefaults(); |
399 | 410 | ||
400 | config()->setGroup("Category Colors"); | 411 | config()->setGroup("Category Colors"); |
401 | QStringList::Iterator it; | 412 | QStringList::Iterator it; |
402 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 413 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
403 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 414 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
404 | 415 | ||
405 | } | 416 | } |
406 | 417 | ||
407 | KPimPrefs::usrReadConfig(); | 418 | KPimPrefs::usrReadConfig(); |
408 | } | 419 | } |
409 | 420 | ||
410 | 421 | ||
411 | void KOPrefs::usrWriteConfig() | 422 | void KOPrefs::usrWriteConfig() |
412 | { | 423 | { |
413 | config()->setGroup("General"); | 424 | config()->setGroup("General"); |
414 | config()->writeEntry("Custom Categories",mCustomCategories); | 425 | config()->writeEntry("Custom Categories",mCustomCategories); |
415 | 426 | ||
416 | config()->setGroup("Personal Settings"); | 427 | config()->setGroup("Personal Settings"); |
417 | config()->writeEntry("user_name",mName); | 428 | config()->writeEntry("user_name",mName); |
418 | config()->writeEntry("user_email",mEmail); | 429 | config()->writeEntry("user_email",mEmail); |
419 | 430 | ||
420 | config()->setGroup("Category Colors"); | 431 | config()->setGroup("Category Colors"); |
421 | QDictIterator<QColor> it(mCategoryColors); | 432 | QDictIterator<QColor> it(mCategoryColors); |
422 | while (it.current()) { | 433 | while (it.current()) { |
423 | config()->writeEntry(it.currentKey(),*(it.current())); | 434 | config()->writeEntry(it.currentKey(),*(it.current())); |
424 | ++it; | 435 | ++it; |
425 | } | 436 | } |
426 | 437 | ||
427 | 438 | ||
428 | KPimPrefs::usrWriteConfig(); | 439 | KPimPrefs::usrWriteConfig(); |
429 | } | 440 | } |
430 | 441 | ||
431 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 442 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
432 | { | 443 | { |
433 | mCategoryColors.replace(cat,new QColor(color)); | 444 | mCategoryColors.replace(cat,new QColor(color)); |
434 | } | 445 | } |
435 | 446 | ||
436 | QColor *KOPrefs::categoryColor(QString cat) | 447 | QColor *KOPrefs::categoryColor(QString cat) |
437 | { | 448 | { |
438 | QColor *color = 0; | 449 | QColor *color = 0; |
439 | 450 | ||
440 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 451 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
441 | 452 | ||
442 | if (color) return color; | 453 | if (color) return color; |
443 | else return &mDefaultCategoryColor; | 454 | else return &mDefaultCategoryColor; |
444 | } | 455 | } |
445 | 456 | ||
446 | void KOPrefs::setFullName(const QString &name) | 457 | void KOPrefs::setFullName(const QString &name) |
447 | { | 458 | { |
448 | mName = name; | 459 | mName = name; |
449 | } | 460 | } |
450 | 461 | ||
451 | void KOPrefs::setEmail(const QString &email) | 462 | void KOPrefs::setEmail(const QString &email) |
452 | { | 463 | { |
453 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 464 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
454 | mEmail = email; | 465 | mEmail = email; |
455 | } | 466 | } |
456 | 467 | ||
457 | QString KOPrefs::fullName() | 468 | QString KOPrefs::fullName() |
458 | { | 469 | { |
459 | if (mEmailControlCenter) { | 470 | if (mEmailControlCenter) { |
460 | KEMailSettings settings; | 471 | KEMailSettings settings; |
461 | return settings.getSetting(KEMailSettings::RealName); | 472 | return settings.getSetting(KEMailSettings::RealName); |
462 | } else { | 473 | } else { |
463 | return mName; | 474 | return mName; |
464 | } | 475 | } |
465 | } | 476 | } |
466 | 477 | ||
467 | QString KOPrefs::email() | 478 | QString KOPrefs::email() |
468 | { | 479 | { |
469 | if (mEmailControlCenter) { | 480 | if (mEmailControlCenter) { |
470 | KEMailSettings settings; | 481 | KEMailSettings settings; |
471 | return settings.getSetting(KEMailSettings::EmailAddress); | 482 | return settings.getSetting(KEMailSettings::EmailAddress); |
472 | } else { | 483 | } else { |
473 | return mEmail; | 484 | return mEmail; |
474 | } | 485 | } |
475 | } | 486 | } |
476 | KConfig* KOPrefs::getConfig() | 487 | KConfig* KOPrefs::getConfig() |
477 | { | 488 | { |
478 | return config(); | 489 | return config(); |
479 | } | 490 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index dddcdca..fa69d52 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,281 +1,283 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | class KOPrefs : public KPimPrefs | 35 | class KOPrefs : public KPimPrefs |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 38 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 39 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 40 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 41 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 42 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 43 | enum { standardDestination, askDestination }; |
44 | 44 | ||
45 | virtual ~KOPrefs(); | 45 | virtual ~KOPrefs(); |
46 | 46 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 47 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 48 | instance. */ |
49 | static KOPrefs *instance(); | 49 | static KOPrefs *instance(); |
50 | 50 | ||
51 | /** Set preferences to default values */ | 51 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | void setAllDefaults(); | ||
60 | 61 | ||
61 | protected: | 62 | protected: |
62 | void setTimeZoneIdDefault(); | 63 | void setTimeZoneIdDefault(); |
63 | 64 | ||
64 | /** Fill empty mail fields with default values. */ | 65 | /** Fill empty mail fields with default values. */ |
65 | void fillMailDefaults(); | 66 | void fillMailDefaults(); |
66 | 67 | ||
67 | private: | 68 | private: |
68 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 69 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
69 | object. */ | 70 | object. */ |
70 | KOPrefs(); | 71 | KOPrefs(); |
71 | 72 | ||
72 | static KOPrefs *mInstance; | 73 | static KOPrefs *mInstance; |
73 | QStringList getDefaultList(); | 74 | QStringList getDefaultList(); |
75 | QStringList getLocationDefaultList(); | ||
74 | public: | 76 | public: |
75 | // preferences data | 77 | // preferences data |
76 | KConfig* getConfig(); | 78 | KConfig* getConfig(); |
77 | void setFullName(const QString &); | 79 | void setFullName(const QString &); |
78 | QString fullName(); | 80 | QString fullName(); |
79 | void setEmail(const QString &); | 81 | void setEmail(const QString &); |
80 | QString email(); | 82 | QString email(); |
81 | 83 | ||
82 | QString mAdditional; | 84 | QString mAdditional; |
83 | 85 | ||
84 | bool mEmailControlCenter; | 86 | bool mEmailControlCenter; |
85 | 87 | ||
86 | bool mBcc; | 88 | bool mBcc; |
87 | bool mAutoSave; | 89 | bool mAutoSave; |
88 | int mAutoSaveInterval; | 90 | int mAutoSaveInterval; |
89 | bool mConfirm; | 91 | bool mConfirm; |
90 | 92 | ||
91 | bool mEnableGroupScheduling; | 93 | bool mEnableGroupScheduling; |
92 | bool mEnableProjectView; | 94 | bool mEnableProjectView; |
93 | 95 | ||
94 | int mDefaultFormat; | 96 | int mDefaultFormat; |
95 | int mMailClient; | 97 | int mMailClient; |
96 | 98 | ||
97 | int mStartTime; | 99 | int mStartTime; |
98 | int mDefaultDuration; | 100 | int mDefaultDuration; |
99 | int mAlarmTime; | 101 | int mAlarmTime; |
100 | 102 | ||
101 | int mWorkingHoursStart; | 103 | int mWorkingHoursStart; |
102 | int mWorkingHoursEnd; | 104 | int mWorkingHoursEnd; |
103 | bool mExcludeHolidays; | 105 | bool mExcludeHolidays; |
104 | bool mExcludeSaturdays; | 106 | bool mExcludeSaturdays; |
105 | bool mMarcusBainsShowSeconds; | 107 | bool mMarcusBainsShowSeconds; |
106 | 108 | ||
107 | QFont mTimeBarFont; | 109 | QFont mTimeBarFont; |
108 | QFont mMonthViewFont; | 110 | QFont mMonthViewFont; |
109 | QFont mAgendaViewFont; | 111 | QFont mAgendaViewFont; |
110 | QFont mMarcusBainsFont; | 112 | QFont mMarcusBainsFont; |
111 | QFont mTimeLabelsFont; | 113 | QFont mTimeLabelsFont; |
112 | QFont mTodoViewFont; | 114 | QFont mTodoViewFont; |
113 | QFont mListViewFont; | 115 | QFont mListViewFont; |
114 | QFont mDateNavigatorFont; | 116 | QFont mDateNavigatorFont; |
115 | QFont mEditBoxFont; | 117 | QFont mEditBoxFont; |
116 | QFont mJornalViewFont; | 118 | QFont mJornalViewFont; |
117 | QFont mWhatsNextFont; | 119 | QFont mWhatsNextFont; |
118 | QFont mEventViewFont; | 120 | QFont mEventViewFont; |
119 | 121 | ||
120 | 122 | ||
121 | 123 | ||
122 | 124 | ||
123 | QColor mHolidayColor; | 125 | QColor mHolidayColor; |
124 | QColor mHighlightColor; | 126 | QColor mHighlightColor; |
125 | QColor mEventColor; | 127 | QColor mEventColor; |
126 | QColor mTodoDoneColor; | 128 | QColor mTodoDoneColor; |
127 | QColor mAgendaBgColor; | 129 | QColor mAgendaBgColor; |
128 | QColor mWorkingHoursColor; | 130 | QColor mWorkingHoursColor; |
129 | QColor mTodoDueTodayColor; | 131 | QColor mTodoDueTodayColor; |
130 | QColor mTodoOverdueColor; | 132 | QColor mTodoOverdueColor; |
131 | QColor mMonthViewEvenColor; | 133 | QColor mMonthViewEvenColor; |
132 | QColor mMonthViewOddColor; | 134 | QColor mMonthViewOddColor; |
133 | QColor mMonthViewHolidayColor; | 135 | QColor mMonthViewHolidayColor; |
134 | bool mMonthViewUsesDayColors; | 136 | bool mMonthViewUsesDayColors; |
135 | bool mMonthViewSatSunTog; | 137 | bool mMonthViewSatSunTog; |
136 | bool mMonthViewWeek; | 138 | bool mMonthViewWeek; |
137 | QColor mAppColor1; | 139 | QColor mAppColor1; |
138 | QColor mAppColor2; | 140 | QColor mAppColor2; |
139 | bool mUseAppColors; | 141 | bool mUseAppColors; |
140 | 142 | ||
141 | int mDayBegins; | 143 | int mDayBegins; |
142 | int mHourSize; | 144 | int mHourSize; |
143 | int mAllDaySize; | 145 | int mAllDaySize; |
144 | bool mShowFullMenu; | 146 | bool mShowFullMenu; |
145 | bool mDailyRecur; | 147 | bool mDailyRecur; |
146 | bool mWeeklyRecur; | 148 | bool mWeeklyRecur; |
147 | bool mMonthDailyRecur; | 149 | bool mMonthDailyRecur; |
148 | bool mMonthWeeklyRecur; | 150 | bool mMonthWeeklyRecur; |
149 | bool mMonthShowIcons; | 151 | bool mMonthShowIcons; |
150 | bool mMonthShowShort; | 152 | bool mMonthShowShort; |
151 | bool mEnableToolTips; | 153 | bool mEnableToolTips; |
152 | bool mEnableMonthScroll; | 154 | bool mEnableMonthScroll; |
153 | bool mFullViewMonth; | 155 | bool mFullViewMonth; |
154 | bool mMonthViewUsesCategoryColor; | 156 | bool mMonthViewUsesCategoryColor; |
155 | bool mFullViewTodo; | 157 | bool mFullViewTodo; |
156 | bool mShowCompletedTodo; | 158 | bool mShowCompletedTodo; |
157 | bool mMarcusBainsEnabled; | 159 | bool mMarcusBainsEnabled; |
158 | int mNextXDays; | 160 | int mNextXDays; |
159 | int mWhatsNextDays; | 161 | int mWhatsNextDays; |
160 | int mWhatsNextPrios; | 162 | int mWhatsNextPrios; |
161 | bool mEnableQuickTodo; | 163 | bool mEnableQuickTodo; |
162 | 164 | ||
163 | bool mCompactDialogs; | 165 | bool mCompactDialogs; |
164 | bool mVerticalScreen; | 166 | bool mVerticalScreen; |
165 | 167 | ||
166 | bool mShowIconNewTodo; | 168 | bool mShowIconNewTodo; |
167 | bool mShowIconNewEvent; | 169 | bool mShowIconNewEvent; |
168 | bool mShowIconSearch; | 170 | bool mShowIconSearch; |
169 | bool mShowIconList; | 171 | bool mShowIconList; |
170 | bool mShowIconDay1; | 172 | bool mShowIconDay1; |
171 | bool mShowIconDay5; | 173 | bool mShowIconDay5; |
172 | bool mShowIconDay7; | 174 | bool mShowIconDay7; |
173 | bool mShowIconMonth; | 175 | bool mShowIconMonth; |
174 | bool mShowIconTodoview; | 176 | bool mShowIconTodoview; |
175 | bool mShowIconBackFast; | 177 | bool mShowIconBackFast; |
176 | bool mShowIconBack; | 178 | bool mShowIconBack; |
177 | bool mShowIconToday; | 179 | bool mShowIconToday; |
178 | bool mShowIconForward; | 180 | bool mShowIconForward; |
179 | bool mShowIconForwardFast; | 181 | bool mShowIconForwardFast; |
180 | bool mShowIconWhatsThis; | 182 | bool mShowIconWhatsThis; |
181 | bool mShowIconNextDays; | 183 | bool mShowIconNextDays; |
182 | bool mShowIconNext; | 184 | bool mShowIconNext; |
183 | bool mShowIconJournal; | 185 | bool mShowIconJournal; |
184 | 186 | ||
185 | bool mShowIconStretch; | 187 | bool mShowIconStretch; |
186 | 188 | ||
187 | bool mToolBarHor; | 189 | bool mToolBarHor; |
188 | bool mToolBarUp; | 190 | bool mToolBarUp; |
189 | bool mToolBarMiniIcons; | 191 | bool mToolBarMiniIcons; |
190 | 192 | ||
191 | bool mAskForQuit; | 193 | bool mAskForQuit; |
192 | bool mUsePassWd; | 194 | bool mUsePassWd; |
193 | bool mShowSyncEvents; | 195 | bool mShowSyncEvents; |
194 | bool mShowTodoInAgenda; | 196 | bool mShowTodoInAgenda; |
195 | bool mShowTimeInAgenda; | 197 | bool mShowTimeInAgenda; |
196 | bool mHideNonStartedTodos; | 198 | bool mHideNonStartedTodos; |
197 | 199 | ||
198 | int mLastSyncTime; | 200 | int mLastSyncTime; |
199 | void setCategoryColor(QString cat,const QColor & color); | 201 | void setCategoryColor(QString cat,const QColor & color); |
200 | QColor *categoryColor(QString cat); | 202 | QColor *categoryColor(QString cat); |
201 | 203 | ||
202 | QString mArchiveFile; | 204 | QString mArchiveFile; |
203 | QString mHtmlExportFile; | 205 | QString mHtmlExportFile; |
204 | bool mHtmlWithSave; | 206 | bool mHtmlWithSave; |
205 | 207 | ||
206 | QStringList mSelectedPlugins; | 208 | QStringList mSelectedPlugins; |
207 | 209 | ||
208 | QString mLastImportFile; | 210 | QString mLastImportFile; |
209 | QString mLastVcalFile; | 211 | QString mLastVcalFile; |
210 | QString mLastSaveFile; | 212 | QString mLastSaveFile; |
211 | QString mLastLoadFile; | 213 | QString mLastLoadFile; |
212 | 214 | ||
213 | 215 | ||
214 | QString mDefaultAlarmFile; | 216 | QString mDefaultAlarmFile; |
215 | int mIMIPScheduler; | 217 | int mIMIPScheduler; |
216 | int mIMIPSend; | 218 | int mIMIPSend; |
217 | QStringList mAdditionalMails; | 219 | QStringList mAdditionalMails; |
218 | int mIMIPAutoRefresh; | 220 | int mIMIPAutoRefresh; |
219 | int mIMIPAutoInsertReply; | 221 | int mIMIPAutoInsertReply; |
220 | int mIMIPAutoInsertRequest; | 222 | int mIMIPAutoInsertRequest; |
221 | int mIMIPAutoFreeBusy; | 223 | int mIMIPAutoFreeBusy; |
222 | int mIMIPAutoFreeBusyReply; | 224 | int mIMIPAutoFreeBusyReply; |
223 | 225 | ||
224 | QStringList mTodoTemplates; | 226 | QStringList mTodoTemplates; |
225 | QStringList mEventTemplates; | 227 | QStringList mEventTemplates; |
226 | 228 | ||
227 | int mDestination; | 229 | int mDestination; |
228 | 230 | ||
229 | 231 | ||
230 | bool mEditOnDoubleClick; | 232 | bool mEditOnDoubleClick; |
231 | bool mViewChangeHoldFullscreen; | 233 | bool mViewChangeHoldFullscreen; |
232 | bool mViewChangeHoldNonFullscreen; | 234 | bool mViewChangeHoldNonFullscreen; |
233 | bool mCenterOnCurrentTime; | 235 | bool mCenterOnCurrentTime; |
234 | bool mSetTimeToDayStartAt; | 236 | bool mSetTimeToDayStartAt; |
235 | bool mHighlightCurrentDay; | 237 | bool mHighlightCurrentDay; |
236 | bool mUseHighlightLightColor; | 238 | bool mUseHighlightLightColor; |
237 | bool mListViewMonthTimespan; | 239 | bool mListViewMonthTimespan; |
238 | bool mWNViewShowsParents; | 240 | bool mWNViewShowsParents; |
239 | bool mWNViewShowsPast; | 241 | bool mWNViewShowsPast; |
240 | bool mWNViewShowLocation; | 242 | bool mWNViewShowLocation; |
241 | bool mTodoViewShowsPercentage; | 243 | bool mTodoViewShowsPercentage; |
242 | bool mTodoViewUsesCatColors; | 244 | bool mTodoViewUsesCatColors; |
243 | bool mMonthViewUsesBigFont; | 245 | bool mMonthViewUsesBigFont; |
244 | bool mTodoViewUsesSmallFont; | 246 | bool mTodoViewUsesSmallFont; |
245 | bool mTodoViewUsesForegroundColor; | 247 | bool mTodoViewUsesForegroundColor; |
246 | bool mMonthViewUsesForegroundColor; | 248 | bool mMonthViewUsesForegroundColor; |
247 | 249 | ||
248 | bool mHightlightDateTimeEdit; | 250 | bool mHightlightDateTimeEdit; |
249 | bool mShortDateInViewer; | 251 | bool mShortDateInViewer; |
250 | 252 | ||
251 | bool mShowDateNavigator; | 253 | bool mShowDateNavigator; |
252 | 254 | ||
253 | QStringList mLocationDefaults; | 255 | QStringList mLocationDefaults; |
254 | QStringList mEventSummaryUser; | 256 | QStringList mEventSummaryUser; |
255 | QStringList mTodoSummaryUser; | 257 | QStringList mTodoSummaryUser; |
256 | 258 | ||
257 | bool mUseInternalAlarmNotification; | 259 | bool mUseInternalAlarmNotification; |
258 | int mAlarmPlayBeeps; | 260 | int mAlarmPlayBeeps; |
259 | int mAlarmSuspendTime; | 261 | int mAlarmSuspendTime; |
260 | int mAlarmSuspendCount; | 262 | int mAlarmSuspendCount; |
261 | int mAlarmBeepInterval; | 263 | int mAlarmBeepInterval; |
262 | int mOldLanguage; | 264 | int mOldLanguage; |
263 | int mOldLoadedLanguage; | 265 | int mOldLoadedLanguage; |
264 | 266 | ||
265 | 267 | ||
266 | QString mActiveSyncPort; | 268 | QString mActiveSyncPort; |
267 | QString mActiveSyncIP; | 269 | QString mActiveSyncIP; |
268 | 270 | ||
269 | private: | 271 | private: |
270 | QDict<QColor> mCategoryColors; | 272 | QDict<QColor> mCategoryColors; |
271 | QColor mDefaultCategoryColor; | 273 | QColor mDefaultCategoryColor; |
272 | 274 | ||
273 | QFont mDefaultTimeBarFont; | 275 | QFont mDefaultTimeBarFont; |
274 | QFont mDefaultViewFont; | 276 | QFont mDefaultViewFont; |
275 | QFont mDefaultMonthViewFont; | 277 | QFont mDefaultMonthViewFont; |
276 | 278 | ||
277 | QString mName; | 279 | QString mName; |
278 | QString mEmail; | 280 | QString mEmail; |
279 | }; | 281 | }; |
280 | 282 | ||
281 | #endif | 283 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 1c74307..348dd5e 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,618 +1,620 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | class KOex2phonePrefs : public QDialog | 75 | class KOex2phonePrefs : public QDialog |
76 | { | 76 | { |
77 | public: | 77 | public: |
78 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 78 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
79 | QDialog( parent, name, true ) | 79 | QDialog( parent, name, true ) |
80 | { | 80 | { |
81 | setCaption( i18n("Export to phone options") ); | 81 | setCaption( i18n("Export to phone options") ); |
82 | QVBoxLayout* lay = new QVBoxLayout( this ); | 82 | QVBoxLayout* lay = new QVBoxLayout( this ); |
83 | lay->setSpacing( 3 ); | 83 | lay->setSpacing( 3 ); |
84 | lay->setMargin( 3 ); | 84 | lay->setMargin( 3 ); |
85 | QLabel *lab; | 85 | QLabel *lab; |
86 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 86 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
87 | lab->setAlignment (AlignHCenter ); | 87 | lab->setAlignment (AlignHCenter ); |
88 | QHBox* temphb; | 88 | QHBox* temphb; |
89 | temphb = new QHBox( this ); | 89 | temphb = new QHBox( this ); |
90 | new QLabel( i18n("I/O device: "), temphb ); | 90 | new QLabel( i18n("I/O device: "), temphb ); |
91 | mPhoneDevice = new QLineEdit( temphb); | 91 | mPhoneDevice = new QLineEdit( temphb); |
92 | lay->addWidget( temphb ); | 92 | lay->addWidget( temphb ); |
93 | temphb = new QHBox( this ); | 93 | temphb = new QHBox( this ); |
94 | new QLabel( i18n("Connection: "), temphb ); | 94 | new QLabel( i18n("Connection: "), temphb ); |
95 | mPhoneConnection = new QLineEdit( temphb); | 95 | mPhoneConnection = new QLineEdit( temphb); |
96 | lay->addWidget( temphb ); | 96 | lay->addWidget( temphb ); |
97 | temphb = new QHBox( this ); | 97 | temphb = new QHBox( this ); |
98 | new QLabel( i18n("Model(opt.): "), temphb ); | 98 | new QLabel( i18n("Model(opt.): "), temphb ); |
99 | mPhoneModel = new QLineEdit( temphb); | 99 | mPhoneModel = new QLineEdit( temphb); |
100 | lay->addWidget( temphb ); | 100 | lay->addWidget( temphb ); |
101 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 101 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
102 | mWriteBackFuture->setChecked( true ); | 102 | mWriteBackFuture->setChecked( true ); |
103 | lay->addWidget( mWriteBackFuture ); | 103 | lay->addWidget( mWriteBackFuture ); |
104 | temphb = new QHBox( this ); | 104 | temphb = new QHBox( this ); |
105 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 105 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
106 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 106 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
107 | mWriteBackFutureWeeks->setValue( 8 ); | 107 | mWriteBackFutureWeeks->setValue( 8 ); |
108 | lay->addWidget( temphb ); | 108 | lay->addWidget( temphb ); |
109 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 109 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
110 | lab->setAlignment (AlignHCenter ); | 110 | lab->setAlignment (AlignHCenter ); |
111 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 111 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
112 | lay->addWidget( ok ); | 112 | lay->addWidget( ok ); |
113 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 113 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
114 | lay->addWidget( cancel ); | 114 | lay->addWidget( cancel ); |
115 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 115 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
116 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 116 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
117 | resize( 220, 240 ); | 117 | resize( 220, 240 ); |
118 | qApp->processEvents(); | 118 | qApp->processEvents(); |
119 | int dw = QApplication::desktop()->width(); | 119 | int dw = QApplication::desktop()->width(); |
120 | int dh = QApplication::desktop()->height(); | 120 | int dh = QApplication::desktop()->height(); |
121 | move( (dw-width())/2, (dh - height() )/2 ); | 121 | move( (dw-width())/2, (dh - height() )/2 ); |
122 | } | 122 | } |
123 | 123 | ||
124 | public: | 124 | public: |
125 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 125 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
126 | QCheckBox* mWriteBackFuture; | 126 | QCheckBox* mWriteBackFuture; |
127 | QSpinBox* mWriteBackFutureWeeks; | 127 | QSpinBox* mWriteBackFutureWeeks; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | int globalFlagBlockStartup; | 130 | int globalFlagBlockStartup; |
131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
132 | QMainWindow( parent, name ) | 132 | QMainWindow( parent, name ) |
133 | { | 133 | { |
134 | 134 | ||
135 | |||
135 | #ifdef DESKTOP_VERSION | 136 | #ifdef DESKTOP_VERSION |
136 | setFont( QFont("Arial"), 14 ); | 137 | setFont( QFont("Arial"), 14 ); |
137 | #endif | 138 | #endif |
138 | mClosed = false; | 139 | mClosed = false; |
139 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 140 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
140 | QString confFile = locateLocal("config","korganizerrc"); | 141 | QString confFile = locateLocal("config","korganizerrc"); |
141 | QFileInfo finf ( confFile ); | 142 | QFileInfo finf ( confFile ); |
142 | bool showWarning = !finf.exists(); | 143 | bool showWarning = !finf.exists(); |
143 | setIcon(SmallIcon( "ko24" ) ); | 144 | setIcon(SmallIcon( "ko24" ) ); |
144 | mBlockAtStartup = true; | 145 | mBlockAtStartup = true; |
145 | mFlagKeyPressed = false; | 146 | mFlagKeyPressed = false; |
146 | setCaption("KOrganizer/Pi"); | ||
147 | KPimGlobalPrefs::instance()->setGlobalConfig(); | ||
148 | KOPrefs *p = KOPrefs::instance(); | 147 | KOPrefs *p = KOPrefs::instance(); |
148 | KPimGlobalPrefs::instance()->setGlobalConfig(); | ||
149 | if ( p->mHourSize > 18 ) | 149 | if ( p->mHourSize > 18 ) |
150 | p->mHourSize = 18; | 150 | p->mHourSize = 18; |
151 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 154 | tbd = Bottom; |
155 | else | 155 | else |
156 | tbd = Top; | 156 | tbd = Top; |
157 | } | 157 | } |
158 | else { | 158 | else { |
159 | if ( p->mToolBarUp ) | 159 | if ( p->mToolBarUp ) |
160 | tbd = Right; | 160 | tbd = Right; |
161 | else | 161 | else |
162 | tbd = Left; | 162 | tbd = Left; |
163 | } | 163 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 164 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
169 | mCalendarModifiedFlag = false; | 169 | mCalendarModifiedFlag = false; |
170 | 170 | ||
171 | setCaption("KOrganizer/Pi"); | ||
171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 172 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
172 | splash->setAlignment ( AlignCenter ); | 173 | splash->setAlignment ( AlignCenter ); |
173 | setCentralWidget( splash ); | 174 | setCentralWidget( splash ); |
174 | #ifndef DESKTOP_VERSION | 175 | #ifndef DESKTOP_VERSION |
175 | showMaximized(); | 176 | showMaximized(); |
176 | #endif | 177 | #endif |
178 | |||
177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 179 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
178 | setDefaultPreferences(); | 180 | setDefaultPreferences(); |
179 | mCalendar = new CalendarLocal(); | 181 | mCalendar = new CalendarLocal(); |
180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 182 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
181 | mView->hide(); | 183 | mView->hide(); |
182 | //mView->resize(splash->size() ); | 184 | //mView->resize(splash->size() ); |
183 | initActions(); | 185 | initActions(); |
184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 186 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
185 | mSyncManager->setBlockSave(false); | 187 | mSyncManager->setBlockSave(false); |
186 | mView->setSyncManager(mSyncManager); | 188 | mView->setSyncManager(mSyncManager); |
187 | #ifndef DESKTOP_VERSION | 189 | #ifndef DESKTOP_VERSION |
188 | iconToolBar->show(); | 190 | iconToolBar->show(); |
189 | qApp->processEvents(); | 191 | qApp->processEvents(); |
190 | #endif | 192 | #endif |
191 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 193 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
192 | int vh = height() ; | 194 | int vh = height() ; |
193 | int vw = width(); | 195 | int vw = width(); |
194 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 196 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
195 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 197 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
196 | vh -= iconToolBar->height(); | 198 | vh -= iconToolBar->height(); |
197 | } else { | 199 | } else { |
198 | vw -= iconToolBar->height(); | 200 | vw -= iconToolBar->height(); |
199 | } | 201 | } |
200 | //mView->setMaximumSize( splash->size() ); | 202 | //mView->setMaximumSize( splash->size() ); |
201 | //mView->resize( splash->size() ); | 203 | //mView->resize( splash->size() ); |
202 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 204 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
203 | mView->readSettings(); | 205 | mView->readSettings(); |
204 | bool newFile = false; | 206 | bool newFile = false; |
205 | if( !QFile::exists( defaultFileName() ) ) { | 207 | if( !QFile::exists( defaultFileName() ) ) { |
206 | QFileInfo finfo ( defaultFileName() ); | 208 | QFileInfo finfo ( defaultFileName() ); |
207 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 209 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
208 | qDebug("oldfile %s ", oldFile.latin1()); | 210 | qDebug("oldfile %s ", oldFile.latin1()); |
209 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 211 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
210 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
211 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
212 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
213 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
214 | qApp->processEvents(); | 216 | qApp->processEvents(); |
215 | } else { | 217 | } else { |
216 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 218 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
217 | finfo.setFile( oldFile ); | 219 | finfo.setFile( oldFile ); |
218 | if (finfo.exists() ) { | 220 | if (finfo.exists() ) { |
219 | KMessageBox::information( this, message); | 221 | KMessageBox::information( this, message); |
220 | mView->openCalendar( oldFile ); | 222 | mView->openCalendar( oldFile ); |
221 | qApp->processEvents(); | 223 | qApp->processEvents(); |
222 | } | 224 | } |
223 | } | 225 | } |
224 | mView->saveCalendar( defaultFileName() ); | 226 | mView->saveCalendar( defaultFileName() ); |
225 | newFile = true; | 227 | newFile = true; |
226 | } | 228 | } |
227 | 229 | ||
228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 230 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
229 | mView->openCalendar( defaultFileName() ); | 231 | mView->openCalendar( defaultFileName() ); |
230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 232 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 233 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
232 | 234 | ||
233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 235 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
234 | KOPrefs::instance()->setCategoryDefaults(); | 236 | KOPrefs::instance()->setAllDefaults(); |
235 | int count = mView->addCategories(); | 237 | int count = mView->addCategories(); |
236 | } | 238 | } |
237 | processIncidenceSelection( 0 ); | 239 | processIncidenceSelection( 0 ); |
238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 240 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
239 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 241 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 242 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
241 | SLOT( slotModifiedChanged( bool ) ) ); | 243 | SLOT( slotModifiedChanged( bool ) ) ); |
242 | 244 | ||
243 | 245 | ||
244 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 246 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
245 | SLOT( disableBR(bool) ) ); | 247 | SLOT( disableBR(bool) ) ); |
246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 248 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
247 | mView->setModified( false ); | 249 | mView->setModified( false ); |
248 | mBlockAtStartup = false; | 250 | mBlockAtStartup = false; |
249 | mView->setModified( false ); | 251 | mView->setModified( false ); |
250 | setCentralWidget( mView ); | 252 | setCentralWidget( mView ); |
251 | globalFlagBlockStartup = 0; | 253 | globalFlagBlockStartup = 0; |
252 | mView->show(); | 254 | mView->show(); |
253 | delete splash; | 255 | delete splash; |
254 | if ( newFile ) | 256 | if ( newFile ) |
255 | mView->updateConfig(); | 257 | mView->updateConfig(); |
256 | // qApp->processEvents(); | 258 | // qApp->processEvents(); |
257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 259 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
258 | //fillSyncMenu(); | 260 | //fillSyncMenu(); |
259 | 261 | ||
260 | 262 | ||
261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 263 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
262 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 264 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
263 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 265 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
264 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 266 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
265 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 267 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
266 | mSyncManager->setDefaultFileName( defaultFileName()); | 268 | mSyncManager->setDefaultFileName( defaultFileName()); |
267 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 269 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
268 | mSyncManager->fillSyncMenu(); | 270 | mSyncManager->fillSyncMenu(); |
269 | 271 | ||
270 | 272 | ||
271 | 273 | ||
272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 274 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
273 | if ( showWarning ) { | 275 | if ( showWarning ) { |
274 | KMessageBox::information( this, | 276 | KMessageBox::information( this, |
275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 277 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
276 | qApp->processEvents(); | 278 | qApp->processEvents(); |
277 | mView->dialogManager()->showSyncOptions(); | 279 | mView->dialogManager()->showSyncOptions(); |
278 | } | 280 | } |
279 | 281 | ||
280 | //US listen for result adressed from Ka/Pi | 282 | //US listen for result adressed from Ka/Pi |
281 | #ifndef DESKTOP_VERSION | 283 | #ifndef DESKTOP_VERSION |
282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 284 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
283 | #endif | 285 | #endif |
284 | #ifndef DESKTOP_VERSION | 286 | #ifndef DESKTOP_VERSION |
285 | infrared = 0; | 287 | infrared = 0; |
286 | #endif | 288 | #endif |
287 | updateWeek( mView->startDate() ); | 289 | updateWeek( mView->startDate() ); |
288 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 290 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
289 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 291 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
290 | mBRdisabled = false; | 292 | mBRdisabled = false; |
291 | //toggleBeamReceive(); | 293 | //toggleBeamReceive(); |
292 | } | 294 | } |
293 | MainWindow::~MainWindow() | 295 | MainWindow::~MainWindow() |
294 | { | 296 | { |
295 | //qDebug("MainWindow::~MainWindow() "); | 297 | //qDebug("MainWindow::~MainWindow() "); |
296 | //save toolbar location | 298 | //save toolbar location |
297 | delete mCalendar; | 299 | delete mCalendar; |
298 | delete mSyncManager; | 300 | delete mSyncManager; |
299 | #ifndef DESKTOP_VERSION | 301 | #ifndef DESKTOP_VERSION |
300 | if ( infrared ) | 302 | if ( infrared ) |
301 | delete infrared; | 303 | delete infrared; |
302 | #endif | 304 | #endif |
303 | 305 | ||
304 | 306 | ||
305 | } | 307 | } |
306 | 308 | ||
307 | void MainWindow::disableBR(bool b) | 309 | void MainWindow::disableBR(bool b) |
308 | { | 310 | { |
309 | #ifndef DESKTOP_VERSION | 311 | #ifndef DESKTOP_VERSION |
310 | if ( b ) { | 312 | if ( b ) { |
311 | if ( infrared ) { | 313 | if ( infrared ) { |
312 | toggleBeamReceive(); | 314 | toggleBeamReceive(); |
313 | mBRdisabled = true; | 315 | mBRdisabled = true; |
314 | } | 316 | } |
315 | mBRdisabled = true; | 317 | mBRdisabled = true; |
316 | } else { | 318 | } else { |
317 | if ( mBRdisabled ) { | 319 | if ( mBRdisabled ) { |
318 | mBRdisabled = false; | 320 | mBRdisabled = false; |
319 | //makes no sense,because other cal ap is probably running | 321 | //makes no sense,because other cal ap is probably running |
320 | // toggleBeamReceive(); | 322 | // toggleBeamReceive(); |
321 | } | 323 | } |
322 | } | 324 | } |
323 | #endif | 325 | #endif |
324 | 326 | ||
325 | } | 327 | } |
326 | bool MainWindow::beamReceiveEnabled() | 328 | bool MainWindow::beamReceiveEnabled() |
327 | { | 329 | { |
328 | #ifndef DESKTOP_VERSION | 330 | #ifndef DESKTOP_VERSION |
329 | return ( infrared != 0 ); | 331 | return ( infrared != 0 ); |
330 | #endif | 332 | #endif |
331 | return false; | 333 | return false; |
332 | } | 334 | } |
333 | 335 | ||
334 | void MainWindow::toggleBeamReceive() | 336 | void MainWindow::toggleBeamReceive() |
335 | { | 337 | { |
336 | if ( mBRdisabled ) | 338 | if ( mBRdisabled ) |
337 | return; | 339 | return; |
338 | #ifndef DESKTOP_VERSION | 340 | #ifndef DESKTOP_VERSION |
339 | if ( infrared ) { | 341 | if ( infrared ) { |
340 | qDebug("disable BeamReceive "); | 342 | qDebug("disable BeamReceive "); |
341 | delete infrared; | 343 | delete infrared; |
342 | infrared = 0; | 344 | infrared = 0; |
343 | brAction->setOn(false); | 345 | brAction->setOn(false); |
344 | return; | 346 | return; |
345 | } | 347 | } |
346 | qDebug("enable BeamReceive "); | 348 | qDebug("enable BeamReceive "); |
347 | brAction->setOn(true); | 349 | brAction->setOn(true); |
348 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 350 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
349 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 351 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
350 | #endif | 352 | #endif |
351 | } | 353 | } |
352 | void MainWindow::showMaximized () | 354 | void MainWindow::showMaximized () |
353 | { | 355 | { |
354 | #ifndef DESKTOP_VERSION | 356 | #ifndef DESKTOP_VERSION |
355 | if ( ! globalFlagBlockStartup ) | 357 | if ( ! globalFlagBlockStartup ) |
356 | if ( mClosed ) | 358 | if ( mClosed ) |
357 | mView->goToday(); | 359 | mView->goToday(); |
358 | #endif | 360 | #endif |
359 | QWidget::showMaximized () ; | 361 | QWidget::showMaximized () ; |
360 | mClosed = false; | 362 | mClosed = false; |
361 | } | 363 | } |
362 | void MainWindow::closeEvent( QCloseEvent* ce ) | 364 | void MainWindow::closeEvent( QCloseEvent* ce ) |
363 | { | 365 | { |
364 | 366 | ||
365 | 367 | ||
366 | 368 | ||
367 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 369 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
368 | saveOnClose(); | 370 | saveOnClose(); |
369 | mClosed = true; | 371 | mClosed = true; |
370 | ce->accept(); | 372 | ce->accept(); |
371 | return; | 373 | return; |
372 | 374 | ||
373 | } | 375 | } |
374 | 376 | ||
375 | switch( QMessageBox::information( this, "KO/Pi", | 377 | switch( QMessageBox::information( this, "KO/Pi", |
376 | i18n("Do you really want\nto close KO/Pi?"), | 378 | i18n("Do you really want\nto close KO/Pi?"), |
377 | i18n("Close"), i18n("No"), | 379 | i18n("Close"), i18n("No"), |
378 | 0, 0 ) ) { | 380 | 0, 0 ) ) { |
379 | case 0: | 381 | case 0: |
380 | saveOnClose(); | 382 | saveOnClose(); |
381 | mClosed = true; | 383 | mClosed = true; |
382 | ce->accept(); | 384 | ce->accept(); |
383 | break; | 385 | break; |
384 | case 1: | 386 | case 1: |
385 | ce->ignore(); | 387 | ce->ignore(); |
386 | break; | 388 | break; |
387 | case 2: | 389 | case 2: |
388 | 390 | ||
389 | default: | 391 | default: |
390 | break; | 392 | break; |
391 | } | 393 | } |
392 | 394 | ||
393 | 395 | ||
394 | } | 396 | } |
395 | 397 | ||
396 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 398 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
397 | { | 399 | { |
398 | QDataStream stream( data, IO_ReadOnly ); | 400 | QDataStream stream( data, IO_ReadOnly ); |
399 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 401 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
400 | //QString datamess; | 402 | //QString datamess; |
401 | //qDebug("message "); | 403 | //qDebug("message "); |
402 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 404 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
403 | 405 | ||
404 | if ( cmsg == "setDocument(QString)" ) { | 406 | if ( cmsg == "setDocument(QString)" ) { |
405 | QDataStream stream( data, IO_ReadOnly ); | 407 | QDataStream stream( data, IO_ReadOnly ); |
406 | QString fileName; | 408 | QString fileName; |
407 | stream >> fileName; | 409 | stream >> fileName; |
408 | //qDebug("filename %s ", fileName.latin1()); | 410 | //qDebug("filename %s ", fileName.latin1()); |
409 | showMaximized(); | 411 | showMaximized(); |
410 | raise(); | 412 | raise(); |
411 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 413 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
412 | mSyncManager->slotSyncMenu( 1002 ); | 414 | mSyncManager->slotSyncMenu( 1002 ); |
413 | return; | 415 | return; |
414 | } | 416 | } |
415 | 417 | ||
416 | if ( cmsg == "-writeFile" ) { | 418 | if ( cmsg == "-writeFile" ) { |
417 | // I made from the "-writeFile" an "-writeAlarm" | 419 | // I made from the "-writeFile" an "-writeAlarm" |
418 | mView->viewManager()->showWhatsNextView(); | 420 | mView->viewManager()->showWhatsNextView(); |
419 | mCalendar->checkAlarmForIncidence( 0, true); | 421 | mCalendar->checkAlarmForIncidence( 0, true); |
420 | showMaximized(); | 422 | showMaximized(); |
421 | raise(); | 423 | raise(); |
422 | return; | 424 | return; |
423 | 425 | ||
424 | } | 426 | } |
425 | if ( cmsg == "-writeFileSilent" ) { | 427 | if ( cmsg == "-writeFileSilent" ) { |
426 | // I made from the "-writeFile" an "-writeAlarm" | 428 | // I made from the "-writeFile" an "-writeAlarm" |
427 | // mView->viewManager()->showWhatsNextView(); | 429 | // mView->viewManager()->showWhatsNextView(); |
428 | mCalendar->checkAlarmForIncidence( 0, true); | 430 | mCalendar->checkAlarmForIncidence( 0, true); |
429 | //showMaximized(); | 431 | //showMaximized(); |
430 | //raise(); | 432 | //raise(); |
431 | hide(); | 433 | hide(); |
432 | return; | 434 | return; |
433 | } | 435 | } |
434 | if ( cmsg == "-newCountdown" ) { | 436 | if ( cmsg == "-newCountdown" ) { |
435 | qDebug("newCountdown "); | 437 | qDebug("newCountdown "); |
436 | 438 | ||
437 | } | 439 | } |
438 | QString msg ; | 440 | QString msg ; |
439 | QString allmsg = cmsg; | 441 | QString allmsg = cmsg; |
440 | while ( allmsg.length() > 0 ) { | 442 | while ( allmsg.length() > 0 ) { |
441 | int nextC = allmsg.find( "-", 1 ); | 443 | int nextC = allmsg.find( "-", 1 ); |
442 | if ( nextC == -1 ) { | 444 | if ( nextC == -1 ) { |
443 | msg = allmsg; | 445 | msg = allmsg; |
444 | allmsg = ""; | 446 | allmsg = ""; |
445 | } else{ | 447 | } else{ |
446 | msg = allmsg.left( nextC ); | 448 | msg = allmsg.left( nextC ); |
447 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 449 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
448 | } | 450 | } |
449 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 451 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
450 | if ( msg == "-newEvent" ) { | 452 | if ( msg == "-newEvent" ) { |
451 | mView->newEvent(); | 453 | mView->newEvent(); |
452 | } | 454 | } |
453 | if ( msg == "-newTodo" ) { | 455 | if ( msg == "-newTodo" ) { |
454 | mView->newTodo(); | 456 | mView->newTodo(); |
455 | 457 | ||
456 | } | 458 | } |
457 | if ( msg == "-showWN" ) { | 459 | if ( msg == "-showWN" ) { |
458 | mView->viewManager()->showWhatsNextView(); | 460 | mView->viewManager()->showWhatsNextView(); |
459 | } | 461 | } |
460 | if ( msg == "-showTodo" ) { | 462 | if ( msg == "-showTodo" ) { |
461 | mView->viewManager()->showTodoView(); | 463 | mView->viewManager()->showTodoView(); |
462 | } | 464 | } |
463 | if ( msg == "-showList" ) { | 465 | if ( msg == "-showList" ) { |
464 | mView->viewManager()->showListView(); | 466 | mView->viewManager()->showListView(); |
465 | } | 467 | } |
466 | else if ( msg == "-showDay" ) { | 468 | else if ( msg == "-showDay" ) { |
467 | mView->viewManager()->showDayView(); | 469 | mView->viewManager()->showDayView(); |
468 | } | 470 | } |
469 | else if ( msg == "-showWWeek" ) { | 471 | else if ( msg == "-showWWeek" ) { |
470 | mView->viewManager()->showWorkWeekView(); | 472 | mView->viewManager()->showWorkWeekView(); |
471 | } | 473 | } |
472 | else if ( msg == "-ringSync" ) { | 474 | else if ( msg == "-ringSync" ) { |
473 | mSyncManager->multiSync( false ); | 475 | mSyncManager->multiSync( false ); |
474 | } | 476 | } |
475 | else if ( msg == "-showWeek" ) { | 477 | else if ( msg == "-showWeek" ) { |
476 | mView->viewManager()->showWeekView(); | 478 | mView->viewManager()->showWeekView(); |
477 | } | 479 | } |
478 | else if ( msg == "-showTodo" ) { | 480 | else if ( msg == "-showTodo" ) { |
479 | mView->viewManager()->showTodoView(); | 481 | mView->viewManager()->showTodoView(); |
480 | } | 482 | } |
481 | else if ( msg == "-showJournal" ) { | 483 | else if ( msg == "-showJournal" ) { |
482 | mView->dateNavigator()->selectDates( 1 ); | 484 | mView->dateNavigator()->selectDates( 1 ); |
483 | mView->dateNavigator()->selectToday(); | 485 | mView->dateNavigator()->selectToday(); |
484 | mView->viewManager()->showJournalView(); | 486 | mView->viewManager()->showJournalView(); |
485 | } | 487 | } |
486 | else if ( msg == "-showKO" ) { | 488 | else if ( msg == "-showKO" ) { |
487 | mView->viewManager()->showNextXView(); | 489 | mView->viewManager()->showNextXView(); |
488 | } | 490 | } |
489 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 491 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
490 | mView->viewManager()->showWhatsNextView(); | 492 | mView->viewManager()->showWhatsNextView(); |
491 | } | 493 | } |
492 | else if ( msg == "-showNextXView" ) { | 494 | else if ( msg == "-showNextXView" ) { |
493 | mView->viewManager()->showNextXView(); | 495 | mView->viewManager()->showNextXView(); |
494 | } | 496 | } |
495 | 497 | ||
496 | 498 | ||
497 | } | 499 | } |
498 | 500 | ||
499 | showMaximized(); | 501 | showMaximized(); |
500 | raise(); | 502 | raise(); |
501 | } | 503 | } |
502 | 504 | ||
503 | QPixmap MainWindow::loadPixmap( QString name ) | 505 | QPixmap MainWindow::loadPixmap( QString name ) |
504 | { | 506 | { |
505 | return SmallIcon( name ); | 507 | return SmallIcon( name ); |
506 | 508 | ||
507 | } | 509 | } |
508 | void MainWindow::initActions() | 510 | void MainWindow::initActions() |
509 | { | 511 | { |
510 | //KOPrefs::instance()->mShowFullMenu | 512 | //KOPrefs::instance()->mShowFullMenu |
511 | iconToolBar->clear(); | 513 | iconToolBar->clear(); |
512 | KOPrefs *p = KOPrefs::instance(); | 514 | KOPrefs *p = KOPrefs::instance(); |
513 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 515 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
514 | 516 | ||
515 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 517 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
516 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 518 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
517 | QPopupMenu *importMenu = new QPopupMenu( this ); | 519 | QPopupMenu *importMenu = new QPopupMenu( this ); |
518 | selectFilterMenu = new QPopupMenu( this ); | 520 | selectFilterMenu = new QPopupMenu( this ); |
519 | selectFilterMenu->setCheckable( true ); | 521 | selectFilterMenu->setCheckable( true ); |
520 | syncMenu = new QPopupMenu( this ); | 522 | syncMenu = new QPopupMenu( this ); |
521 | configureAgendaMenu = new QPopupMenu( this ); | 523 | configureAgendaMenu = new QPopupMenu( this ); |
522 | configureToolBarMenu = new QPopupMenu( this ); | 524 | configureToolBarMenu = new QPopupMenu( this ); |
523 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 525 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
524 | if ( KOPrefs::instance()->mShowFullMenu ) { | 526 | if ( KOPrefs::instance()->mShowFullMenu ) { |
525 | QMenuBar *menuBar1; | 527 | QMenuBar *menuBar1; |
526 | menuBar1 = menuBar(); | 528 | menuBar1 = menuBar(); |
527 | menuBar1->insertItem( i18n("File"), importMenu ); | 529 | menuBar1->insertItem( i18n("File"), importMenu ); |
528 | menuBar1->insertItem( i18n("View"), viewMenu ); | 530 | menuBar1->insertItem( i18n("View"), viewMenu ); |
529 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 531 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
530 | #ifdef DESKTOP_VERSION | 532 | #ifdef DESKTOP_VERSION |
531 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 533 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
532 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 534 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
533 | #else | 535 | #else |
534 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 536 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
535 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 537 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
536 | #endif | 538 | #endif |
537 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 539 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
538 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 540 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
539 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 541 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
540 | } else { | 542 | } else { |
541 | QPEMenuBar *menuBar1; | 543 | QPEMenuBar *menuBar1; |
542 | menuBar1 = new QPEMenuBar( iconToolBar ); | 544 | menuBar1 = new QPEMenuBar( iconToolBar ); |
543 | QPopupMenu *menuBar = new QPopupMenu( this ); | 545 | QPopupMenu *menuBar = new QPopupMenu( this ); |
544 | menuBar1->insertItem( i18n("ME"), menuBar); | 546 | menuBar1->insertItem( i18n("ME"), menuBar); |
545 | menuBar->insertItem( i18n("File"), importMenu ); | 547 | menuBar->insertItem( i18n("File"), importMenu ); |
546 | menuBar->insertItem( i18n("View"), viewMenu ); | 548 | menuBar->insertItem( i18n("View"), viewMenu ); |
547 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 549 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
548 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 550 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
549 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 551 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
550 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 552 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
551 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 553 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
552 | menuBar->insertItem( i18n("Help"), helpMenu ); | 554 | menuBar->insertItem( i18n("Help"), helpMenu ); |
553 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 555 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
554 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 556 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
555 | } | 557 | } |
556 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 558 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
557 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 559 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
558 | 560 | ||
559 | menuBarWeek = new QPEMenuBar( iconToolBar ); | 561 | menuBarWeek = new QPEMenuBar( iconToolBar ); |
560 | QPopupMenu * wpo = new QPopupMenu (this); | 562 | QPopupMenu * wpo = new QPopupMenu (this); |
561 | QPopupMenu * all = new QPopupMenu (this); | 563 | QPopupMenu * all = new QPopupMenu (this); |
562 | //wpo->insertItem( i18n("W#"), 0 ); | 564 | //wpo->insertItem( i18n("W#"), 0 ); |
563 | int first = 1; | 565 | int first = 1; |
564 | int i; | 566 | int i; |
565 | for ( i = 1; i < 50; ++i ) { | 567 | for ( i = 1; i < 50; ++i ) { |
566 | if ( !(i%10) ) { | 568 | if ( !(i%10) ) { |
567 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | 569 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); |
568 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | 570 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); |
569 | first = i; | 571 | first = i; |
570 | wpo = new QPopupMenu (this); | 572 | wpo = new QPopupMenu (this); |
571 | } | 573 | } |
572 | wpo->insertItem( QString::number(i), i ); | 574 | wpo->insertItem( QString::number(i), i ); |
573 | } | 575 | } |
574 | for ( i = 50; i < 53; ++i ) { | 576 | for ( i = 50; i < 53; ++i ) { |
575 | wpo->insertItem( QString::number(i), i); | 577 | wpo->insertItem( QString::number(i), i); |
576 | } | 578 | } |
577 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | 579 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); |
578 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | 580 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); |
579 | menuBarWeek->insertItem( "00",all,1); | 581 | menuBarWeek->insertItem( "00",all,1); |
580 | menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( )); | 582 | menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( )); |
581 | 583 | ||
582 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 584 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
583 | // ****************** | 585 | // ****************** |
584 | QAction *action; | 586 | QAction *action; |
585 | QIconSet icon; | 587 | QIconSet icon; |
586 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 588 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
587 | configureToolBarMenu->setCheckable( true ); | 589 | configureToolBarMenu->setCheckable( true ); |
588 | 590 | ||
589 | QString pathString = ""; | 591 | QString pathString = ""; |
590 | if ( !p->mToolBarMiniIcons ) { | 592 | if ( !p->mToolBarMiniIcons ) { |
591 | if ( QApplication::desktop()->width() < 480 ) | 593 | if ( QApplication::desktop()->width() < 480 ) |
592 | pathString += "icons16/"; | 594 | pathString += "icons16/"; |
593 | } else | 595 | } else |
594 | pathString += "iconsmini/"; | 596 | pathString += "iconsmini/"; |
595 | configureAgendaMenu->setCheckable( true ); | 597 | configureAgendaMenu->setCheckable( true ); |
596 | int iii ; | 598 | int iii ; |
597 | for ( iii = 1;iii<= 10 ;++iii ){ | 599 | for ( iii = 1;iii<= 10 ;++iii ){ |
598 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 600 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
599 | } | 601 | } |
600 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 602 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
601 | 603 | ||
602 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 604 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
603 | this, SLOT( showConfigureAgenda( ) ) ); | 605 | this, SLOT( showConfigureAgenda( ) ) ); |
604 | 606 | ||
605 | icon = loadPixmap( pathString + "configure" ); | 607 | icon = loadPixmap( pathString + "configure" ); |
606 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 608 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
607 | action->addTo( actionMenu ); | 609 | action->addTo( actionMenu ); |
608 | connect( action, SIGNAL( activated() ), | 610 | connect( action, SIGNAL( activated() ), |
609 | mView, SLOT( edit_options() ) ); | 611 | mView, SLOT( edit_options() ) ); |
610 | actionMenu->insertSeparator(); | 612 | actionMenu->insertSeparator(); |
611 | 613 | ||
612 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 614 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
613 | action->addTo( actionMenu ); | 615 | action->addTo( actionMenu ); |
614 | connect( action, SIGNAL( activated() ), | 616 | connect( action, SIGNAL( activated() ), |
615 | mView, SLOT( undo_delete() ) ); | 617 | mView, SLOT( undo_delete() ) ); |
616 | actionMenu->insertSeparator(); | 618 | actionMenu->insertSeparator(); |
617 | 619 | ||
618 | icon = loadPixmap( pathString + "newevent" ); | 620 | icon = loadPixmap( pathString + "newevent" ); |