summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp65
-rw-r--r--korganizer/koprefs.h2
-rw-r--r--korganizer/mainwindow.cpp8
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
49KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
50static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
51 51
52KOPrefs::KOPrefs() : 52KOPrefs::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
304KOPrefs::~KOPrefs() 304KOPrefs::~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
313KOPrefs *KOPrefs::instance() 313KOPrefs *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
323void KOPrefs::usrSetDefaults() 323void KOPrefs::usrSetDefaults()
324{ 324{
325 325
326} 326}
327 327
328void KOPrefs::fillMailDefaults() 328void 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
334void KOPrefs::setTimeZoneIdDefault() 334void KOPrefs::setTimeZoneIdDefault()
335{ 335{
336 ; 336 ;
337} 337}
338 338
339void KOPrefs::setAllDefaults()
340{
341 setCategoryDefaults();
342 mEventSummaryUser = getDefaultList() ;
343 mTodoSummaryUser = getDefaultList() ;
344 mLocationDefaults = getLocationDefaultList();
345}
346
339void KOPrefs::setCategoryDefaults() 347void 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}
357QStringList 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}
350QStringList KOPrefs::getDefaultList() 369QStringList 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
366void KOPrefs::usrReadConfig() 385void 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
411void KOPrefs::usrWriteConfig() 422void 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
431void KOPrefs::setCategoryColor(QString cat,const QColor & color) 442void 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
436QColor *KOPrefs::categoryColor(QString cat) 447QColor *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
446void KOPrefs::setFullName(const QString &name) 457void KOPrefs::setFullName(const QString &name)
447{ 458{
448 mName = name; 459 mName = name;
449} 460}
450 461
451void KOPrefs::setEmail(const QString &email) 462void 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
457QString KOPrefs::fullName() 468QString 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
467QString KOPrefs::email() 478QString 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}
476KConfig* KOPrefs::getConfig() 487KConfig* 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
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35class KOPrefs : public KPimPrefs 35class 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,1770 +1,1772 @@
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
65using namespace KCal; 65using 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
75class KOex2phonePrefs : public QDialog 75class 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
124public: 124public:
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
130int globalFlagBlockStartup; 130int globalFlagBlockStartup;
131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 131MainWindow::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}
293MainWindow::~MainWindow() 295MainWindow::~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
307void MainWindow::disableBR(bool b) 309void 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}
326bool MainWindow::beamReceiveEnabled() 328bool 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
334void MainWindow::toggleBeamReceive() 336void 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}
352void MainWindow::showMaximized () 354void 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}
362void MainWindow::closeEvent( QCloseEvent* ce ) 364void 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
396void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 398void 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
503QPixmap MainWindow::loadPixmap( QString name ) 505QPixmap MainWindow::loadPixmap( QString name )
504{ 506{
505 return SmallIcon( name ); 507 return SmallIcon( name );
506 508
507} 509}
508void MainWindow::initActions() 510void 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" );
619 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 621 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
620 configureToolBarMenu->insertSeparator(); 622 configureToolBarMenu->insertSeparator();
621 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 623 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
622 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 624 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
623 ne_action->addTo( actionMenu ); 625 ne_action->addTo( actionMenu );
624 connect( ne_action, SIGNAL( activated() ), 626 connect( ne_action, SIGNAL( activated() ),
625 mView, SLOT( newEvent() ) ); 627 mView, SLOT( newEvent() ) );
626 icon = loadPixmap( pathString + "newtodo" ); 628 icon = loadPixmap( pathString + "newtodo" );
627 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 629 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
628 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 630 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
629 nt_action->addTo( actionMenu ); 631 nt_action->addTo( actionMenu );
630 connect( nt_action, SIGNAL( activated() ), 632 connect( nt_action, SIGNAL( activated() ),
631 mView, SLOT( newTodo() ) ); 633 mView, SLOT( newTodo() ) );
632 634
633 icon = loadPixmap( pathString + "today" ); 635 icon = loadPixmap( pathString + "today" );
634 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 636 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
635 today_action->addTo( viewMenu ); 637 today_action->addTo( viewMenu );
636 connect( today_action, SIGNAL( activated() ), 638 connect( today_action, SIGNAL( activated() ),
637 mView, SLOT( goToday() ) ); 639 mView, SLOT( goToday() ) );
638 viewMenu->insertSeparator(); 640 viewMenu->insertSeparator();
639 641
640 icon = loadPixmap( pathString + "navi" ); 642 icon = loadPixmap( pathString + "navi" );
641 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 643 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
642 action->addTo( viewMenu ); 644 action->addTo( viewMenu );
643 connect( action, SIGNAL( activated() ), 645 connect( action, SIGNAL( activated() ),
644 mView, SLOT( toggleDateNavigatorWidget() ) ); 646 mView, SLOT( toggleDateNavigatorWidget() ) );
645 mToggleNav = action ; 647 mToggleNav = action ;
646 icon = loadPixmap( pathString + "filter" ); 648 icon = loadPixmap( pathString + "filter" );
647 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 649 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
648 action->addTo( viewMenu ); 650 action->addTo( viewMenu );
649 connect( action, SIGNAL( activated() ), 651 connect( action, SIGNAL( activated() ),
650 mView, SLOT( toggleFilter() ) ); 652 mView, SLOT( toggleFilter() ) );
651 mToggleFilter = action; 653 mToggleFilter = action;
652 icon = loadPixmap( pathString + "allday" ); 654 icon = loadPixmap( pathString + "allday" );
653 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 655 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
654 action->addTo( viewMenu ); 656 action->addTo( viewMenu );
655 connect( action, SIGNAL( activated() ), 657 connect( action, SIGNAL( activated() ),
656 mView, SLOT( toggleAllDaySize() ) ); 658 mView, SLOT( toggleAllDaySize() ) );
657 mToggleAllday = action; 659 mToggleAllday = action;
658 660
659 661
660 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 662 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
661 mToggleNav, SLOT( setEnabled ( bool ) ) ); 663 mToggleNav, SLOT( setEnabled ( bool ) ) );
662 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 664 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
663 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 665 mToggleFilter, SLOT( setEnabled ( bool ) ) );
664 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 666 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
665 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 667 mToggleAllday, SLOT( setEnabled ( bool ) ) );
666 668
667 viewMenu->insertSeparator(); 669 viewMenu->insertSeparator();
668 icon = loadPixmap( pathString + "picker" ); 670 icon = loadPixmap( pathString + "picker" );
669 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 671 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
670 action->addTo( viewMenu ); 672 action->addTo( viewMenu );
671 connect( action, SIGNAL( activated() ), 673 connect( action, SIGNAL( activated() ),
672 mView, SLOT( showDatePicker() ) ); 674 mView, SLOT( showDatePicker() ) );
673 action->addTo( iconToolBar ); 675 action->addTo( iconToolBar );
674 viewMenu->insertSeparator(); 676 viewMenu->insertSeparator();
675 icon = loadPixmap( pathString + "list" ); 677 icon = loadPixmap( pathString + "list" );
676 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 678 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
677 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 679 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
678 showlist_action->addTo( viewMenu ); 680 showlist_action->addTo( viewMenu );
679 connect( showlist_action, SIGNAL( activated() ), 681 connect( showlist_action, SIGNAL( activated() ),
680 mView->viewManager(), SLOT( showListView() ) ); 682 mView->viewManager(), SLOT( showListView() ) );
681 683
682 684
683 icon = loadPixmap( pathString + "day" ); 685 icon = loadPixmap( pathString + "day" );
684 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 686 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
685 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 687 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
686 day1_action->addTo( viewMenu ); 688 day1_action->addTo( viewMenu );
687 // action->addTo( toolBar ); 689 // action->addTo( toolBar );
688 connect( day1_action, SIGNAL( activated() ), 690 connect( day1_action, SIGNAL( activated() ),
689 mView->viewManager(), SLOT( showDayView() ) ); 691 mView->viewManager(), SLOT( showDayView() ) );
690 692
691 icon = loadPixmap( pathString + "workweek" ); 693 icon = loadPixmap( pathString + "workweek" );
692 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 694 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
693 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 695 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
694 day5_action->addTo( viewMenu ); 696 day5_action->addTo( viewMenu );
695 connect( day5_action, SIGNAL( activated() ), 697 connect( day5_action, SIGNAL( activated() ),
696 mView->viewManager(), SLOT( showWorkWeekView() ) ); 698 mView->viewManager(), SLOT( showWorkWeekView() ) );
697 699
698 icon = loadPixmap( pathString + "week" ); 700 icon = loadPixmap( pathString + "week" );
699 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 701 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
700 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 702 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
701 day7_action->addTo( viewMenu ); 703 day7_action->addTo( viewMenu );
702 connect( day7_action, SIGNAL( activated() ), 704 connect( day7_action, SIGNAL( activated() ),
703 mView->viewManager(), SLOT( showWeekView() ) ); 705 mView->viewManager(), SLOT( showWeekView() ) );
704 706
705 icon = loadPixmap( pathString + "month" ); 707 icon = loadPixmap( pathString + "month" );
706 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 708 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
707 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 709 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
708 month_action->addTo( viewMenu ); 710 month_action->addTo( viewMenu );
709 connect( month_action, SIGNAL( activated() ), 711 connect( month_action, SIGNAL( activated() ),
710 mView->viewManager(), SLOT( showMonthView() ) ); 712 mView->viewManager(), SLOT( showMonthView() ) );
711 713
712 icon = loadPixmap( pathString + "todo" ); 714 icon = loadPixmap( pathString + "todo" );
713 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 715 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
714 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 716 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
715 todoview_action->addTo( viewMenu ); 717 todoview_action->addTo( viewMenu );
716 connect( todoview_action, SIGNAL( activated() ), 718 connect( todoview_action, SIGNAL( activated() ),
717 mView->viewManager(), SLOT( showTodoView() ) ); 719 mView->viewManager(), SLOT( showTodoView() ) );
718 720
719 icon = loadPixmap( pathString + "journal" ); 721 icon = loadPixmap( pathString + "journal" );
720 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 722 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
721 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 723 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
722 viewjournal_action->addTo( viewMenu ); 724 viewjournal_action->addTo( viewMenu );
723 connect( viewjournal_action, SIGNAL( activated() ), 725 connect( viewjournal_action, SIGNAL( activated() ),
724 mView->viewManager(), SLOT( showJournalView() ) ); 726 mView->viewManager(), SLOT( showJournalView() ) );
725 727
726 icon = loadPixmap( pathString + "xdays" ); 728 icon = loadPixmap( pathString + "xdays" );
727 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 729 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
728 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 730 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
729 xdays_action->addTo( viewMenu ); 731 xdays_action->addTo( viewMenu );
730 connect( xdays_action, SIGNAL( activated() ), 732 connect( xdays_action, SIGNAL( activated() ),
731 mView->viewManager(), SLOT( showNextXView() ) ); 733 mView->viewManager(), SLOT( showNextXView() ) );
732 734
733 icon = loadPixmap( pathString + "whatsnext" ); 735 icon = loadPixmap( pathString + "whatsnext" );
734 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 736 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
735 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 737 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
736 whatsnext_action->addTo( viewMenu ); 738 whatsnext_action->addTo( viewMenu );
737 connect( whatsnext_action, SIGNAL( activated() ), 739 connect( whatsnext_action, SIGNAL( activated() ),
738 mView->viewManager(), SLOT( showWhatsNextView() ) ); 740 mView->viewManager(), SLOT( showWhatsNextView() ) );
739 741
740#if 0 742#if 0
741 action = new QAction( "view_timespan", "Time Span", 0, this ); 743 action = new QAction( "view_timespan", "Time Span", 0, this );
742 action->addTo( viewMenu ); 744 action->addTo( viewMenu );
743 connect( action, SIGNAL( activated() ), 745 connect( action, SIGNAL( activated() ),
744 mView->viewManager(), SLOT( showTimeSpanView() ) ); 746 mView->viewManager(), SLOT( showTimeSpanView() ) );
745#endif 747#endif
746 748
747 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 749 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
748 this ); 750 this );
749 mNewSubTodoAction->addTo( actionMenu ); 751 mNewSubTodoAction->addTo( actionMenu );
750 connect( mNewSubTodoAction, SIGNAL( activated() ), 752 connect( mNewSubTodoAction, SIGNAL( activated() ),
751 mView, SLOT( newSubTodo() ) ); 753 mView, SLOT( newSubTodo() ) );
752 754
753 actionMenu->insertSeparator(); 755 actionMenu->insertSeparator();
754 756
755 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 757 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
756 mShowAction->addTo( actionMenu ); 758 mShowAction->addTo( actionMenu );
757 connect( mShowAction, SIGNAL( activated() ), 759 connect( mShowAction, SIGNAL( activated() ),
758 mView, SLOT( showIncidence() ) ); 760 mView, SLOT( showIncidence() ) );
759 761
760 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 762 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
761 mEditAction->addTo( actionMenu ); 763 mEditAction->addTo( actionMenu );
762 connect( mEditAction, SIGNAL( activated() ), 764 connect( mEditAction, SIGNAL( activated() ),
763 mView, SLOT( editIncidence() ) ); 765 mView, SLOT( editIncidence() ) );
764 766
765 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 767 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
766 mDeleteAction->addTo( actionMenu ); 768 mDeleteAction->addTo( actionMenu );
767 connect( mDeleteAction, SIGNAL( activated() ), 769 connect( mDeleteAction, SIGNAL( activated() ),
768 mView, SLOT( deleteIncidence() ) ); 770 mView, SLOT( deleteIncidence() ) );
769 771
770 772
771 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 773 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
772 mCloneAction->addTo( actionMenu ); 774 mCloneAction->addTo( actionMenu );
773 connect( mCloneAction, SIGNAL( activated() ), 775 connect( mCloneAction, SIGNAL( activated() ),
774 mView, SLOT( cloneIncidence() ) ); 776 mView, SLOT( cloneIncidence() ) );
775 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 777 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
776 mMoveAction->addTo( actionMenu ); 778 mMoveAction->addTo( actionMenu );
777 connect( mMoveAction, SIGNAL( activated() ), 779 connect( mMoveAction, SIGNAL( activated() ),
778 mView, SLOT( moveIncidence() ) ); 780 mView, SLOT( moveIncidence() ) );
779 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 781 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
780 mBeamAction->addTo( actionMenu ); 782 mBeamAction->addTo( actionMenu );
781 connect( mBeamAction, SIGNAL( activated() ), 783 connect( mBeamAction, SIGNAL( activated() ),
782 mView, SLOT( beamIncidence() ) ); 784 mView, SLOT( beamIncidence() ) );
783 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 785 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
784 mCancelAction->addTo( actionMenu ); 786 mCancelAction->addTo( actionMenu );
785 connect( mCancelAction, SIGNAL( activated() ), 787 connect( mCancelAction, SIGNAL( activated() ),
786 mView, SLOT( toggleCancelIncidence() ) ); 788 mView, SLOT( toggleCancelIncidence() ) );
787 789
788 actionMenu->insertSeparator(); 790 actionMenu->insertSeparator();
789 791
790 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 792 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
791 this ); 793 this );
792 action->addTo( actionMenu ); 794 action->addTo( actionMenu );
793 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 795 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
794 796
795 icon = loadPixmap( pathString + "search" ); 797 icon = loadPixmap( pathString + "search" );
796 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 798 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
797 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 799 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
798 search_action->addTo( actionMenu ); 800 search_action->addTo( actionMenu );
799 connect( search_action, SIGNAL( activated() ), 801 connect( search_action, SIGNAL( activated() ),
800 mView->dialogManager(), SLOT( showSearchDialog() ) ); 802 mView->dialogManager(), SLOT( showSearchDialog() ) );
801 803
802 804
803 805
804 if ( KOPrefs::instance()->mShowFullMenu ) { 806 if ( KOPrefs::instance()->mShowFullMenu ) {
805 actionMenu->insertSeparator(); 807 actionMenu->insertSeparator();
806 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 808 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
807 809
808 } 810 }
809 // actionMenu->insertSeparator(); 811 // actionMenu->insertSeparator();
810 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 812 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
811 this ); 813 this );
812 action->addTo( importMenu ); 814 action->addTo( importMenu );
813 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 815 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
814 action = new QAction( "import_quick", i18n("Import last file"), 0, 816 action = new QAction( "import_quick", i18n("Import last file"), 0,
815 this ); 817 this );
816 action->addTo( importMenu ); 818 action->addTo( importMenu );
817 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 819 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
818 importMenu->insertSeparator(); 820 importMenu->insertSeparator();
819 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 821 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
820 this ); 822 this );
821 action->addTo( importMenu ); 823 action->addTo( importMenu );
822 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 824 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
823#ifndef DESKTOP_VERSION 825#ifndef DESKTOP_VERSION
824 importMenu->insertSeparator(); 826 importMenu->insertSeparator();
825 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 827 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
826 this ); 828 this );
827 action->addTo( importMenu ); 829 action->addTo( importMenu );
828 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 830 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
829#else 831#else
830#ifdef _OL_IMPORT_ 832#ifdef _OL_IMPORT_
831 importMenu->insertSeparator(); 833 importMenu->insertSeparator();
832 action = new QAction( "import_ol", i18n("Import from OL"), 0, 834 action = new QAction( "import_ol", i18n("Import from OL"), 0,
833 this ); 835 this );
834 action->addTo( importMenu ); 836 action->addTo( importMenu );
835 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 837 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
836#endif 838#endif
837#endif 839#endif
838 840
839 importMenu->insertSeparator(); 841 importMenu->insertSeparator();
840 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 842 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
841 this ); 843 this );
842 action->addTo( importMenu ); 844 action->addTo( importMenu );
843 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 845 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
844 846
845 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 847 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
846 this ); 848 this );
847 action->addTo( importMenu ); 849 action->addTo( importMenu );
848 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 850 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
849 851
850 importMenu->insertSeparator(); 852 importMenu->insertSeparator();
851 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 853 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
852 this ); 854 this );
853 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 855 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
854 856
855 857
856 //LR 858 //LR
857 QPopupMenu *ex2phone = new QPopupMenu( this ); 859 QPopupMenu *ex2phone = new QPopupMenu( this );
858 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 860 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
859 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 861 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
860 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 862 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
861 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 863 importMenu->insertItem( i18n("Export to phone"), ex2phone );
862 864
863 importMenu->insertSeparator(); 865 importMenu->insertSeparator();
864 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 866 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
865 this ); 867 this );
866 action->addTo( importMenu ); 868 action->addTo( importMenu );
867 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 869 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
868#ifndef DESKTOP_VERSION 870#ifndef DESKTOP_VERSION
869 importMenu->insertSeparator(); 871 importMenu->insertSeparator();
870 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 872 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
871 this ); 873 this );
872 brAction->addTo( importMenu ); 874 brAction->addTo( importMenu );
873 brAction->setToggleAction (true ) ; 875 brAction->setToggleAction (true ) ;
874 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 876 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
875 877
876 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 878 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
877 this ); 879 this );
878 action->addTo( importMenu ); 880 action->addTo( importMenu );
879 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 881 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
880 882
881 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 883 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
882 this ); 884 this );
883 action->addTo( importMenu ); 885 action->addTo( importMenu );
884 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 886 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
885#else 887#else
886 importMenu->insertSeparator(); 888 importMenu->insertSeparator();
887 icon = loadPixmap( pathString + "print" ); 889 icon = loadPixmap( pathString + "print" );
888 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 890 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
889 action->addTo( importMenu ); 891 action->addTo( importMenu );
890 connect( action, SIGNAL( activated() ), 892 connect( action, SIGNAL( activated() ),
891 this, SLOT( printCal() ) ); 893 this, SLOT( printCal() ) );
892 894
893 icon = loadPixmap( pathString + "print" ); 895 icon = loadPixmap( pathString + "print" );
894 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 896 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
895 action->addTo( importMenu ); 897 action->addTo( importMenu );
896 connect( action, SIGNAL( activated() ), 898 connect( action, SIGNAL( activated() ),
897 this, SLOT( printSel() ) ); 899 this, SLOT( printSel() ) );
898 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 900 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
899 action->addTo( importMenu ); 901 action->addTo( importMenu );
900 connect( action, SIGNAL( activated() ), 902 connect( action, SIGNAL( activated() ),
901 mView->viewManager(), SIGNAL( printWNV() ) ); 903 mView->viewManager(), SIGNAL( printWNV() ) );
902#endif 904#endif
903 importMenu->insertSeparator(); 905 importMenu->insertSeparator();
904 action = new QAction( "beam all", i18n("Save"), 0, 906 action = new QAction( "beam all", i18n("Save"), 0,
905 this ); 907 this );
906 action->addTo( importMenu ); 908 action->addTo( importMenu );
907 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 909 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
908 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 910 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
909 this ); 911 this );
910 action->addTo( importMenu ); 912 action->addTo( importMenu );
911 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 913 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
912 914
913 //menuBar->insertItem( "Configure",configureMenu ); 915 //menuBar->insertItem( "Configure",configureMenu );
914 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 916 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
915 icon = loadPixmap( "korganizer/korganizer" ); 917 icon = loadPixmap( "korganizer/korganizer" );
916 918
917 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 919 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
918 action->addTo( helpMenu ); 920 action->addTo( helpMenu );
919 connect( action, SIGNAL( activated() ), 921 connect( action, SIGNAL( activated() ),
920 SLOT( whatsNew() ) ); 922 SLOT( whatsNew() ) );
921 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 923 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
922 action->addTo( helpMenu ); 924 action->addTo( helpMenu );
923 connect( action, SIGNAL( activated() ), 925 connect( action, SIGNAL( activated() ),
924 SLOT( features() ) ); 926 SLOT( features() ) );
925 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 927 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
926 action->addTo( helpMenu ); 928 action->addTo( helpMenu );
927 connect( action, SIGNAL( activated() ), 929 connect( action, SIGNAL( activated() ),
928 SLOT( keyBindings() ) ); 930 SLOT( keyBindings() ) );
929 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 931 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
930 action->addTo( helpMenu ); 932 action->addTo( helpMenu );
931 connect( action, SIGNAL( activated() ), 933 connect( action, SIGNAL( activated() ),
932 SLOT( synchowto() ) ); 934 SLOT( synchowto() ) );
933 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 935 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
934 action->addTo( helpMenu ); 936 action->addTo( helpMenu );
935 connect( action, SIGNAL( activated() ), 937 connect( action, SIGNAL( activated() ),
936 SLOT( kdesynchowto() ) ); 938 SLOT( kdesynchowto() ) );
937 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 939 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
938 action->addTo( helpMenu ); 940 action->addTo( helpMenu );
939 connect( action, SIGNAL( activated() ), 941 connect( action, SIGNAL( activated() ),
940 SLOT( multisynchowto() ) ); 942 SLOT( multisynchowto() ) );
941 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 943 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
942 action->addTo( helpMenu ); 944 action->addTo( helpMenu );
943 connect( action, SIGNAL( activated() ), 945 connect( action, SIGNAL( activated() ),
944 SLOT( aboutAutoSaving() ) ); 946 SLOT( aboutAutoSaving() ) );
945 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 947 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
946 action->addTo( helpMenu ); 948 action->addTo( helpMenu );
947 connect( action, SIGNAL( activated() ), 949 connect( action, SIGNAL( activated() ),
948 SLOT( aboutKnownBugs() ) ); 950 SLOT( aboutKnownBugs() ) );
949 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 951 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
950 action->addTo( helpMenu ); 952 action->addTo( helpMenu );
951 connect( action, SIGNAL( activated() ), 953 connect( action, SIGNAL( activated() ),
952 SLOT( usertrans() ) ); 954 SLOT( usertrans() ) );
953 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 955 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
954 action->addTo( helpMenu ); 956 action->addTo( helpMenu );
955 connect( action, SIGNAL( activated() ), 957 connect( action, SIGNAL( activated() ),
956 SLOT( faq() ) ); 958 SLOT( faq() ) );
957 action = new QAction( "licence", i18n("Licence..."), 0, this ); 959 action = new QAction( "licence", i18n("Licence..."), 0, this );
958 action->addTo( helpMenu ); 960 action->addTo( helpMenu );
959 connect( action, SIGNAL( activated() ), 961 connect( action, SIGNAL( activated() ),
960 SLOT( licence() ) ); 962 SLOT( licence() ) );
961 action = new QAction( "about", i18n("About..."), 0, this ); 963 action = new QAction( "about", i18n("About..."), 0, this );
962 action->addTo( helpMenu ); 964 action->addTo( helpMenu );
963 connect( action, SIGNAL( activated() ), 965 connect( action, SIGNAL( activated() ),
964 SLOT( about() ) ); 966 SLOT( about() ) );
965 //menuBar->insertSeparator(); 967 //menuBar->insertSeparator();
966 968
967 // ****************************************************** 969 // ******************************************************
968 // menubar icons 970 // menubar icons
969 971
970 972
971 iconToolBar->setHorizontalStretchable (true ); 973 iconToolBar->setHorizontalStretchable (true );
972 //menuBar->insertItem( iconToolBar ); 974 //menuBar->insertItem( iconToolBar );
973 //xdays_action 975 //xdays_action
974 if (p-> mShowIconNewEvent) 976 if (p-> mShowIconNewEvent)
975 ne_action->addTo( iconToolBar ); 977 ne_action->addTo( iconToolBar );
976 if (p->mShowIconNewTodo ) 978 if (p->mShowIconNewTodo )
977 nt_action->addTo( iconToolBar ); 979 nt_action->addTo( iconToolBar );
978 if (p-> mShowIconSearch) 980 if (p-> mShowIconSearch)
979 search_action->addTo( iconToolBar ); 981 search_action->addTo( iconToolBar );
980 if (p-> mShowIconNext) 982 if (p-> mShowIconNext)
981 whatsnext_action->addTo( iconToolBar ); 983 whatsnext_action->addTo( iconToolBar );
982 if (p-> mShowIconNextDays) 984 if (p-> mShowIconNextDays)
983 xdays_action->addTo( iconToolBar ); 985 xdays_action->addTo( iconToolBar );
984 if (p-> mShowIconList) 986 if (p-> mShowIconList)
985 showlist_action->addTo( iconToolBar ); 987 showlist_action->addTo( iconToolBar );
986 if (p-> mShowIconDay1) 988 if (p-> mShowIconDay1)
987 day1_action->addTo( iconToolBar ); 989 day1_action->addTo( iconToolBar );
988 if (p-> mShowIconDay5) 990 if (p-> mShowIconDay5)
989 day5_action->addTo( iconToolBar ); 991 day5_action->addTo( iconToolBar );
990 if (p-> mShowIconDay7) 992 if (p-> mShowIconDay7)
991 day7_action->addTo( iconToolBar ); 993 day7_action->addTo( iconToolBar );
992 if (p-> mShowIconMonth) 994 if (p-> mShowIconMonth)
993 month_action->addTo( iconToolBar ); 995 month_action->addTo( iconToolBar );
994 if (p-> mShowIconTodoview) 996 if (p-> mShowIconTodoview)
995 todoview_action->addTo( iconToolBar ); 997 todoview_action->addTo( iconToolBar );
996 if (p-> mShowIconJournal) 998 if (p-> mShowIconJournal)
997 viewjournal_action->addTo( iconToolBar ); 999 viewjournal_action->addTo( iconToolBar );
998 icon = loadPixmap( pathString + "2leftarrowB" ); 1000 icon = loadPixmap( pathString + "2leftarrowB" );
999 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1001 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1000 if (p-> mShowIconBackFast) { 1002 if (p-> mShowIconBackFast) {
1001 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1003 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1002 connect( action, SIGNAL( activated() ), 1004 connect( action, SIGNAL( activated() ),
1003 mView, SLOT( goPreviousMonth() ) ); 1005 mView, SLOT( goPreviousMonth() ) );
1004 action->addTo( iconToolBar ); 1006 action->addTo( iconToolBar );
1005 } 1007 }
1006 icon = loadPixmap( pathString + "1leftarrowB" ); 1008 icon = loadPixmap( pathString + "1leftarrowB" );
1007 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1009 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1008 if (p-> mShowIconBack) { 1010 if (p-> mShowIconBack) {
1009 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1011 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1010 connect( action, SIGNAL( activated() ), 1012 connect( action, SIGNAL( activated() ),
1011 mView, SLOT( goPrevious() ) ); 1013 mView, SLOT( goPrevious() ) );
1012 action->addTo( iconToolBar ); 1014 action->addTo( iconToolBar );
1013 } 1015 }
1014 icon = loadPixmap( pathString + "today" ); 1016 icon = loadPixmap( pathString + "today" );
1015 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1017 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1016 if (p-> mShowIconToday) 1018 if (p-> mShowIconToday)
1017 today_action->addTo( iconToolBar ); 1019 today_action->addTo( iconToolBar );
1018 icon = loadPixmap( pathString + "1rightarrowB" ); 1020 icon = loadPixmap( pathString + "1rightarrowB" );
1019 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1021 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1020 if (p-> mShowIconForward) { 1022 if (p-> mShowIconForward) {
1021 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1023 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1022 connect( action, SIGNAL( activated() ), 1024 connect( action, SIGNAL( activated() ),
1023 mView, SLOT( goNext() ) ); 1025 mView, SLOT( goNext() ) );
1024 action->addTo( iconToolBar ); 1026 action->addTo( iconToolBar );
1025 } 1027 }
1026 icon = loadPixmap( pathString + "2rightarrowB" ); 1028 icon = loadPixmap( pathString + "2rightarrowB" );
1027 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1029 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1028 if (p-> mShowIconForwardFast) { 1030 if (p-> mShowIconForwardFast) {
1029 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1031 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1030 connect( action, SIGNAL( activated() ), 1032 connect( action, SIGNAL( activated() ),
1031 mView, SLOT( goNextMonth() ) ); 1033 mView, SLOT( goNextMonth() ) );
1032 action->addTo( iconToolBar ); 1034 action->addTo( iconToolBar );
1033 } 1035 }
1034 1036
1035 1037
1036 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1038 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1037 1039
1038 if (p-> mShowIconNewEvent) 1040 if (p-> mShowIconNewEvent)
1039 configureToolBarMenu->setItemChecked( 10, true ); 1041 configureToolBarMenu->setItemChecked( 10, true );
1040 if (p->mShowIconNewTodo ) 1042 if (p->mShowIconNewTodo )
1041 configureToolBarMenu->setItemChecked( 20, true ); 1043 configureToolBarMenu->setItemChecked( 20, true );
1042 if (p-> mShowIconSearch) 1044 if (p-> mShowIconSearch)
1043 configureToolBarMenu->setItemChecked( 120, true ); 1045 configureToolBarMenu->setItemChecked( 120, true );
1044 if (p-> mShowIconList) 1046 if (p-> mShowIconList)
1045 configureToolBarMenu->setItemChecked( 30, true ); 1047 configureToolBarMenu->setItemChecked( 30, true );
1046 if (p-> mShowIconDay1) 1048 if (p-> mShowIconDay1)
1047 configureToolBarMenu->setItemChecked( 40, true ); 1049 configureToolBarMenu->setItemChecked( 40, true );
1048 if (p-> mShowIconDay5) 1050 if (p-> mShowIconDay5)
1049 configureToolBarMenu->setItemChecked( 50, true ); 1051 configureToolBarMenu->setItemChecked( 50, true );
1050 if (p-> mShowIconDay7) 1052 if (p-> mShowIconDay7)
1051 configureToolBarMenu->setItemChecked( 60, true ); 1053 configureToolBarMenu->setItemChecked( 60, true );
1052 if (p-> mShowIconMonth) 1054 if (p-> mShowIconMonth)
1053 configureToolBarMenu->setItemChecked( 70, true ); 1055 configureToolBarMenu->setItemChecked( 70, true );
1054 if (p-> mShowIconTodoview) 1056 if (p-> mShowIconTodoview)
1055 configureToolBarMenu->setItemChecked( 80, true ); 1057 configureToolBarMenu->setItemChecked( 80, true );
1056 if (p-> mShowIconBackFast) 1058 if (p-> mShowIconBackFast)
1057 configureToolBarMenu->setItemChecked( 200, true ); 1059 configureToolBarMenu->setItemChecked( 200, true );
1058 if (p-> mShowIconBack) 1060 if (p-> mShowIconBack)
1059 configureToolBarMenu->setItemChecked( 210, true ); 1061 configureToolBarMenu->setItemChecked( 210, true );
1060 if (p-> mShowIconToday) 1062 if (p-> mShowIconToday)
1061 configureToolBarMenu->setItemChecked( 130, true ); 1063 configureToolBarMenu->setItemChecked( 130, true );
1062 if (p-> mShowIconForward) 1064 if (p-> mShowIconForward)
1063 configureToolBarMenu->setItemChecked( 220, true ); 1065 configureToolBarMenu->setItemChecked( 220, true );
1064 if (p-> mShowIconForwardFast) 1066 if (p-> mShowIconForwardFast)
1065 configureToolBarMenu->setItemChecked( 230, true ); 1067 configureToolBarMenu->setItemChecked( 230, true );
1066 if (p-> mShowIconNextDays) 1068 if (p-> mShowIconNextDays)
1067 configureToolBarMenu->setItemChecked( 100, true ); 1069 configureToolBarMenu->setItemChecked( 100, true );
1068 if (p-> mShowIconNext) 1070 if (p-> mShowIconNext)
1069 configureToolBarMenu->setItemChecked( 110, true ); 1071 configureToolBarMenu->setItemChecked( 110, true );
1070 if (p-> mShowIconJournal) 1072 if (p-> mShowIconJournal)
1071 configureToolBarMenu->setItemChecked( 90, true ); 1073 configureToolBarMenu->setItemChecked( 90, true );
1072 if (p-> mShowIconWhatsThis) 1074 if (p-> mShowIconWhatsThis)
1073 configureToolBarMenu->setItemChecked( 300, true ); 1075 configureToolBarMenu->setItemChecked( 300, true );
1074 1076
1075 QLabel* dummy = new QLabel( iconToolBar ); 1077 QLabel* dummy = new QLabel( iconToolBar );
1076 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1078 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1077 if (!p-> mShowIconStretch) 1079 if (!p-> mShowIconStretch)
1078 iconToolBar->setStretchableWidget ( dummy ) ; 1080 iconToolBar->setStretchableWidget ( dummy ) ;
1079 else 1081 else
1080 configureToolBarMenu->setItemChecked( 5, true ); 1082 configureToolBarMenu->setItemChecked( 5, true );
1081 if (p-> mShowIconWhatsThis) 1083 if (p-> mShowIconWhatsThis)
1082 QWhatsThis::whatsThisButton ( iconToolBar ); 1084 QWhatsThis::whatsThisButton ( iconToolBar );
1083 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1085 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1084 configureAgenda( p->mHourSize ); 1086 configureAgenda( p->mHourSize );
1085 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1087 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1086} 1088}
1087 1089
1088void MainWindow::exportToPhone( int mode ) 1090void MainWindow::exportToPhone( int mode )
1089{ 1091{
1090 1092
1091 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1093 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1092 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1094 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1093 KOex2phonePrefs ex2phone; 1095 KOex2phonePrefs ex2phone;
1094 1096
1095 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1097 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1096 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1098 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1097 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1099 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1098 if ( mode == 1 ) 1100 if ( mode == 1 )
1099 ex2phone.setCaption(i18n("Export complete calendar")); 1101 ex2phone.setCaption(i18n("Export complete calendar"));
1100 if ( mode == 2 ) 1102 if ( mode == 2 )
1101 ex2phone.setCaption(i18n("Export filtered calendar")); 1103 ex2phone.setCaption(i18n("Export filtered calendar"));
1102 1104
1103 if ( !ex2phone.exec() ) { 1105 if ( !ex2phone.exec() ) {
1104 return; 1106 return;
1105 } 1107 }
1106 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1108 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1107 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1109 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1108 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1110 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1109 1111
1110 int inFuture = 0; 1112 int inFuture = 0;
1111 if ( ex2phone.mWriteBackFuture->isChecked() ) 1113 if ( ex2phone.mWriteBackFuture->isChecked() )
1112 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1114 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1113 QPtrList<Incidence> delSel; 1115 QPtrList<Incidence> delSel;
1114 if ( mode == 1 ) 1116 if ( mode == 1 )
1115 delSel = mCalendar->rawIncidences(); 1117 delSel = mCalendar->rawIncidences();
1116 if ( mode == 2 ) 1118 if ( mode == 2 )
1117 delSel = mCalendar->incidences(); 1119 delSel = mCalendar->incidences();
1118 CalendarLocal* cal = new CalendarLocal(); 1120 CalendarLocal* cal = new CalendarLocal();
1119 cal->setLocalTime(); 1121 cal->setLocalTime();
1120 Incidence *incidence = delSel.first(); 1122 Incidence *incidence = delSel.first();
1121 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1123 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1122 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1124 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1123 while ( incidence ) { 1125 while ( incidence ) {
1124 if ( incidence->type() != "Journal" ) { 1126 if ( incidence->type() != "Journal" ) {
1125 bool add = true; 1127 bool add = true;
1126 if ( inFuture ) { 1128 if ( inFuture ) {
1127 QDateTime dt; 1129 QDateTime dt;
1128 if ( incidence->type() == "Todo" ) { 1130 if ( incidence->type() == "Todo" ) {
1129 Todo * t = (Todo*)incidence; 1131 Todo * t = (Todo*)incidence;
1130 if ( t->hasDueDate() ) 1132 if ( t->hasDueDate() )
1131 dt = t->dtDue(); 1133 dt = t->dtDue();
1132 else 1134 else
1133 dt = cur.addSecs( 62 ); 1135 dt = cur.addSecs( 62 );
1134 } 1136 }
1135 else { 1137 else {
1136 bool ok; 1138 bool ok;
1137 dt = incidence->getNextOccurence( cur, &ok ); 1139 dt = incidence->getNextOccurence( cur, &ok );
1138 if ( !ok ) 1140 if ( !ok )
1139 dt = cur.addSecs( -62 ); 1141 dt = cur.addSecs( -62 );
1140 } 1142 }
1141 if ( dt < cur || dt > end ) { 1143 if ( dt < cur || dt > end ) {
1142 add = false; 1144 add = false;
1143 } 1145 }
1144 } 1146 }
1145 if ( add ) { 1147 if ( add ) {
1146 Incidence *in = incidence->clone(); 1148 Incidence *in = incidence->clone();
1147 cal->addIncidence( in ); 1149 cal->addIncidence( in );
1148 } 1150 }
1149 } 1151 }
1150 incidence = delSel.next(); 1152 incidence = delSel.next();
1151 } 1153 }
1152 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1154 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1153 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1155 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1154 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1156 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1155 1157
1156 setCaption( i18n("Writing to phone...")); 1158 setCaption( i18n("Writing to phone..."));
1157 if ( PhoneFormat::writeToPhone( cal ) ) 1159 if ( PhoneFormat::writeToPhone( cal ) )
1158 setCaption( i18n("Export to phone successful!")); 1160 setCaption( i18n("Export to phone successful!"));
1159 else 1161 else
1160 setCaption( i18n("Error exporting to phone!")); 1162 setCaption( i18n("Error exporting to phone!"));
1161 delete cal; 1163 delete cal;
1162} 1164}
1163 1165
1164 1166
1165void MainWindow::setDefaultPreferences() 1167void MainWindow::setDefaultPreferences()
1166{ 1168{
1167 KOPrefs *p = KOPrefs::instance(); 1169 KOPrefs *p = KOPrefs::instance();
1168 1170
1169 p->mCompactDialogs = true; 1171 p->mCompactDialogs = true;
1170 p->mConfirm = true; 1172 p->mConfirm = true;
1171 // p->mEnableQuickTodo = false; 1173 // p->mEnableQuickTodo = false;
1172 1174
1173} 1175}
1174 1176
1175QString MainWindow::resourcePath() 1177QString MainWindow::resourcePath()
1176{ 1178{
1177 return KGlobal::iconLoader()->iconPath(); 1179 return KGlobal::iconLoader()->iconPath();
1178} 1180}
1179 1181
1180void MainWindow::displayText( QString text ,QString cap ) 1182void MainWindow::displayText( QString text ,QString cap )
1181{ 1183{
1182 QDialog dia( this, "name", true ); ; 1184 QDialog dia( this, "name", true ); ;
1183 dia.setCaption( cap ); 1185 dia.setCaption( cap );
1184 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1186 QVBoxLayout* lay = new QVBoxLayout( &dia );
1185 lay->setSpacing( 3 ); 1187 lay->setSpacing( 3 );
1186 lay->setMargin( 3 ); 1188 lay->setMargin( 3 );
1187 QTextBrowser tb ( &dia ); 1189 QTextBrowser tb ( &dia );
1188 lay->addWidget( &tb ); 1190 lay->addWidget( &tb );
1189 tb.setText( text ); 1191 tb.setText( text );
1190#ifdef DESKTOP_VERSION 1192#ifdef DESKTOP_VERSION
1191 dia.resize( 640, 480); 1193 dia.resize( 640, 480);
1192#else 1194#else
1193 dia.showMaximized(); 1195 dia.showMaximized();
1194#endif 1196#endif
1195 dia.exec(); 1197 dia.exec();
1196} 1198}
1197 1199
1198void MainWindow::features() 1200void MainWindow::features()
1199{ 1201{
1200 1202
1201 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1203 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1202} 1204}
1203 1205
1204void MainWindow::usertrans() 1206void MainWindow::usertrans()
1205{ 1207{
1206 1208
1207 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1209 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1208} 1210}
1209 1211
1210void MainWindow::kdesynchowto() 1212void MainWindow::kdesynchowto()
1211{ 1213{
1212 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1214 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1213} 1215}
1214void MainWindow::multisynchowto() 1216void MainWindow::multisynchowto()
1215{ 1217{
1216 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1218 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1217} 1219}
1218void MainWindow::synchowto() 1220void MainWindow::synchowto()
1219{ 1221{
1220 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1222 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1221} 1223}
1222void MainWindow::faq() 1224void MainWindow::faq()
1223{ 1225{
1224 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1226 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1225 1227
1226} 1228}
1227void MainWindow::whatsNew() 1229void MainWindow::whatsNew()
1228{ 1230{
1229 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1231 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1230 1232
1231} 1233}
1232void MainWindow::licence() 1234void MainWindow::licence()
1233{ 1235{
1234 KApplication::showLicence(); 1236 KApplication::showLicence();
1235 1237
1236} 1238}
1237void MainWindow::about() 1239void MainWindow::about()
1238{ 1240{
1239 QString version; 1241 QString version;
1240#include <../version> 1242#include <../version>
1241 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1243 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1242 i18n("KOrganizer/Platform-independent\n") + 1244 i18n("KOrganizer/Platform-independent\n") +
1243 "(KO/Pi) " + version + " - " + 1245 "(KO/Pi) " + version + " - " +
1244 1246
1245#ifdef DESKTOP_VERSION 1247#ifdef DESKTOP_VERSION
1246 i18n("Desktop Edition\n") + 1248 i18n("Desktop Edition\n") +
1247#else 1249#else
1248 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1250 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1249#endif 1251#endif
1250 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1252 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1251} 1253}
1252void MainWindow::keyBindings() 1254void MainWindow::keyBindings()
1253{ 1255{
1254 QString cap = i18n("KO/Pi Keys + Colors"); 1256 QString cap = i18n("KO/Pi Keys + Colors");
1255 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1257 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1256 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1258 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1257 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1259 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1258 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1260 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1259 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1261 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1260 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1262 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1261 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1263 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1262 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1264 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1263 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1265 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1264 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1266 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1265 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1267 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1266 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1268 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1267 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1269 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1268 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1270 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1269 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1271 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1270 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1272 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1271 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1273 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1272 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1274 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1273 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1275 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1274 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1276 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1275 i18n("<p><h3>In agenda view:</h3></p>\n") + 1277 i18n("<p><h3>In agenda view:</h3></p>\n") +
1276 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1278 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1277 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1279 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1278 i18n("<p><h3>In todo view:</h3></p>\n") + 1280 i18n("<p><h3>In todo view:</h3></p>\n") +
1279 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1281 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1280 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1282 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1281 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1283 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1282 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1284 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1283 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1285 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1284 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1286 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1285 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1287 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1286 i18n("<p><h3>In list view:</h3></p>\n") + 1288 i18n("<p><h3>In list view:</h3></p>\n") +
1287 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1289 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1288 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1290 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1289 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1291 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1290 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1292 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1291 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1293 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1292 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1294 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1293 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1295 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1294 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1296 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1295 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1297 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1296 i18n("<p><b>E</b>: Edit item</p>\n") + 1298 i18n("<p><b>E</b>: Edit item</p>\n") +
1297 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1299 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1298 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1300 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1299 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1301 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1300 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1302 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1301 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1303 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1302 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1304 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1303 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1305 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1304 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1306 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1305 i18n("<p><b>White</b>: Item readonly</p>\n"); 1307 i18n("<p><b>White</b>: Item readonly</p>\n");
1306 displayText( text, cap); 1308 displayText( text, cap);
1307} 1309}
1308void MainWindow::aboutAutoSaving() 1310void MainWindow::aboutAutoSaving()
1309{ 1311{
1310 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1312 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1311 1313
1312 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1314 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1313 1315
1314} 1316}
1315void MainWindow::aboutKnownBugs() 1317void MainWindow::aboutKnownBugs()
1316{ 1318{
1317 QMessageBox* msg; 1319 QMessageBox* msg;
1318 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1320 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1319 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1321 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1320 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1322 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1321 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1323 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1322 i18n("\nor report them in the bugtracker on\n") + 1324 i18n("\nor report them in the bugtracker on\n") +
1323 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1325 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1324 QMessageBox::NoIcon, 1326 QMessageBox::NoIcon,
1325 QMessageBox::Ok, 1327 QMessageBox::Ok,
1326 QMessageBox::NoButton, 1328 QMessageBox::NoButton,
1327 QMessageBox::NoButton); 1329 QMessageBox::NoButton);
1328 msg->exec(); 1330 msg->exec();
1329 delete msg; 1331 delete msg;
1330 1332
1331} 1333}
1332 1334
1333QString MainWindow::defaultFileName() 1335QString MainWindow::defaultFileName()
1334{ 1336{
1335 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1337 return locateLocal( "data", "korganizer/mycalendar.ics" );
1336} 1338}
1337QString MainWindow::syncFileName() 1339QString MainWindow::syncFileName()
1338{ 1340{
1339#ifdef DESKTOP_VERSION 1341#ifdef DESKTOP_VERSION
1340 return locateLocal( "tmp", "synccalendar.ics" ); 1342 return locateLocal( "tmp", "synccalendar.ics" );
1341#else 1343#else
1342 return QString( "/tmp/synccalendar.ics" ); 1344 return QString( "/tmp/synccalendar.ics" );
1343#endif 1345#endif
1344} 1346}
1345void MainWindow::updateWeek(QDate seda) 1347void MainWindow::updateWeek(QDate seda)
1346{ 1348{
1347 int weekNum = 0; 1349 int weekNum = 0;
1348 QDate d = QDate ( seda.year(), 1,1); 1350 QDate d = QDate ( seda.year(), 1,1);
1349 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1351 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1350 if ( seda.addDays(6).year() != seda.year() ) { 1352 if ( seda.addDays(6).year() != seda.year() ) {
1351 if ( seda.year() != d.year() ) { 1353 if ( seda.year() != d.year() ) {
1352 if ( d.dayOfWeek() > 4 ) 1354 if ( d.dayOfWeek() > 4 )
1353 d = QDate ( seda.year(), 1,1); 1355 d = QDate ( seda.year(), 1,1);
1354 else 1356 else
1355 weekNum = 1; 1357 weekNum = 1;
1356 } else { 1358 } else {
1357 QDate dd( seda.year()+1, 1,1); 1359 QDate dd( seda.year()+1, 1,1);
1358 if ( dd.dayOfWeek() <= 4 ) 1360 if ( dd.dayOfWeek() <= 4 )
1359 weekNum = 1; 1361 weekNum = 1;
1360 } 1362 }
1361 } 1363 }
1362 if ( weekNum == 0 ){ 1364 if ( weekNum == 0 ){
1363 int dow = d.dayOfWeek(); 1365 int dow = d.dayOfWeek();
1364 if ( dow <= 4 ) 1366 if ( dow <= 4 )
1365 d = d.addDays( 1-dow ); 1367 d = d.addDays( 1-dow );
1366 else // 5,6,7 1368 else // 5,6,7
1367 d = d.addDays( 8-dow ); 1369 d = d.addDays( 8-dow );
1368 // we have the first week of the year.we are on monday 1370 // we have the first week of the year.we are on monday
1369 weekNum = d.daysTo( seda ) / 7 +1; 1371 weekNum = d.daysTo( seda ) / 7 +1;
1370 } 1372 }
1371 //qDebug("weeknum %s ", QString::number( weekNum).latin1()); 1373 //qDebug("weeknum %s ", QString::number( weekNum).latin1());
1372 menuBarWeek-> changeItem(1, QString::number( weekNum) ); 1374 menuBarWeek-> changeItem(1, QString::number( weekNum) );
1373 1375
1374} 1376}
1375void MainWindow::updateWeekNum(const DateList &selectedDates) 1377void MainWindow::updateWeekNum(const DateList &selectedDates)
1376{ 1378{
1377 updateWeek( selectedDates.first() ); 1379 updateWeek( selectedDates.first() );
1378} 1380}
1379void MainWindow::processIncidenceSelection( Incidence *incidence ) 1381void MainWindow::processIncidenceSelection( Incidence *incidence )
1380{ 1382{
1381 1383
1382 if ( !incidence ) { 1384 if ( !incidence ) {
1383 enableIncidenceActions( false ); 1385 enableIncidenceActions( false );
1384 1386
1385 mNewSubTodoAction->setEnabled( false ); 1387 mNewSubTodoAction->setEnabled( false );
1386 setCaptionToDates(); 1388 setCaptionToDates();
1387 return; 1389 return;
1388 1390
1389 } 1391 }
1390 1392
1391 //KGlobal::locale()->formatDateTime(nextA, true); 1393 //KGlobal::locale()->formatDateTime(nextA, true);
1392 QString startString = ""; 1394 QString startString = "";
1393 if ( incidence->type() != "Todo" ) { 1395 if ( incidence->type() != "Todo" ) {
1394 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1396 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1395 if ( incidence->doesFloat() ) { 1397 if ( incidence->doesFloat() ) {
1396 startString += ": "+incidence->dtStartDateStr( true ); 1398 startString += ": "+incidence->dtStartDateStr( true );
1397 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1399 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1398 1400
1399 } else { 1401 } else {
1400 startString = ": "+incidence->dtStartStr(true); 1402 startString = ": "+incidence->dtStartStr(true);
1401 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1403 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1402 1404
1403 } 1405 }
1404 1406
1405 } else { 1407 } else {
1406 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1408 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1407 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1409 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1408 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1410 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1409 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1411 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1410 bool ok; 1412 bool ok;
1411 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1413 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1412 if ( ok ) { 1414 if ( ok ) {
1413 int years = noc.date().year() - incidence->dtStart().date().year(); 1415 int years = noc.date().year() - incidence->dtStart().date().year();
1414 startString += i18n(" (%1 y.)"). arg( years ); 1416 startString += i18n(" (%1 y.)"). arg( years );
1415 } 1417 }
1416 } 1418 }
1417 else 1419 else
1418 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1420 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1419 } 1421 }
1420 1422
1421 } 1423 }
1422 else 1424 else
1423 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1425 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1424 if ( !incidence->location().isEmpty() ) 1426 if ( !incidence->location().isEmpty() )
1425 startString += " (" +incidence->location()+")"; 1427 startString += " (" +incidence->location()+")";
1426 setCaption( incidence->summary()+startString); 1428 setCaption( incidence->summary()+startString);
1427 1429
1428 enableIncidenceActions( true ); 1430 enableIncidenceActions( true );
1429 1431
1430 if ( incidence->type() == "Event" ) { 1432 if ( incidence->type() == "Event" ) {
1431 mShowAction->setText( i18n("Show Event...") ); 1433 mShowAction->setText( i18n("Show Event...") );
1432 mEditAction->setText( i18n("Edit Event...") ); 1434 mEditAction->setText( i18n("Edit Event...") );
1433 mDeleteAction->setText( i18n("Delete Event...") ); 1435 mDeleteAction->setText( i18n("Delete Event...") );
1434 1436
1435 mNewSubTodoAction->setEnabled( false ); 1437 mNewSubTodoAction->setEnabled( false );
1436 } else if ( incidence->type() == "Todo" ) { 1438 } else if ( incidence->type() == "Todo" ) {
1437 mShowAction->setText( i18n("Show Todo...") ); 1439 mShowAction->setText( i18n("Show Todo...") );
1438 mEditAction->setText( i18n("Edit Todo...") ); 1440 mEditAction->setText( i18n("Edit Todo...") );
1439 mDeleteAction->setText( i18n("Delete Todo...") ); 1441 mDeleteAction->setText( i18n("Delete Todo...") );
1440 1442
1441 mNewSubTodoAction->setEnabled( true ); 1443 mNewSubTodoAction->setEnabled( true );
1442 } else { 1444 } else {
1443 mShowAction->setText( i18n("Show...") ); 1445 mShowAction->setText( i18n("Show...") );
1444 mShowAction->setText( i18n("Edit...") ); 1446 mShowAction->setText( i18n("Edit...") );
1445 mShowAction->setText( i18n("Delete...") ); 1447 mShowAction->setText( i18n("Delete...") );
1446 1448
1447 mNewSubTodoAction->setEnabled( false ); 1449 mNewSubTodoAction->setEnabled( false );
1448 } 1450 }
1449} 1451}
1450 1452
1451void MainWindow::enableIncidenceActions( bool enabled ) 1453void MainWindow::enableIncidenceActions( bool enabled )
1452{ 1454{
1453 mShowAction->setEnabled( enabled ); 1455 mShowAction->setEnabled( enabled );
1454 mEditAction->setEnabled( enabled ); 1456 mEditAction->setEnabled( enabled );
1455 mDeleteAction->setEnabled( enabled ); 1457 mDeleteAction->setEnabled( enabled );
1456 1458
1457 mCloneAction->setEnabled( enabled ); 1459 mCloneAction->setEnabled( enabled );
1458 mMoveAction->setEnabled( enabled ); 1460 mMoveAction->setEnabled( enabled );
1459 mBeamAction->setEnabled( enabled ); 1461 mBeamAction->setEnabled( enabled );
1460 mCancelAction->setEnabled( enabled ); 1462 mCancelAction->setEnabled( enabled );
1461} 1463}
1462 1464
1463void MainWindow::importOL() 1465void MainWindow::importOL()
1464{ 1466{
1465#ifdef _OL_IMPORT_ 1467#ifdef _OL_IMPORT_
1466 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1468 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1467 id->exec(); 1469 id->exec();
1468 delete id; 1470 delete id;
1469 mView->updateView(); 1471 mView->updateView();
1470#endif 1472#endif
1471} 1473}
1472void MainWindow::importBday() 1474void MainWindow::importBday()
1473{ 1475{
1474 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1476 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1475 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1477 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1476 i18n("Import!"), i18n("Cancel"), 0, 1478 i18n("Import!"), i18n("Cancel"), 0,
1477 0, 1 ); 1479 0, 1 );
1478 if ( result == 0 ) { 1480 if ( result == 0 ) {
1479 mView->importBday(); 1481 mView->importBday();
1480 1482
1481 } 1483 }
1482 1484
1483 1485
1484} 1486}
1485void MainWindow::importQtopia() 1487void MainWindow::importQtopia()
1486{ 1488{
1487#ifndef DESKTOP_VERSION 1489#ifndef DESKTOP_VERSION
1488 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1490 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1489 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1491 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1490 i18n("Import!"), i18n("Cancel"), 0, 1492 i18n("Import!"), i18n("Cancel"), 0,
1491 0, 1 ); 1493 0, 1 );
1492 if ( result == 0 ) { 1494 if ( result == 0 ) {
1493 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1495 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1494 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1496 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1495 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1497 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1496 mView->importQtopia( categories, datebook, todolist ); 1498 mView->importQtopia( categories, datebook, todolist );
1497 } 1499 }
1498#else 1500#else
1499 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1501 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1500 i18n("Not supported \non desktop!\n"), 1502 i18n("Not supported \non desktop!\n"),
1501 i18n("Ok"), i18n("Cancel"), 0, 1503 i18n("Ok"), i18n("Cancel"), 0,
1502 0, 1 ); 1504 0, 1 );
1503 1505
1504#endif 1506#endif
1505} 1507}
1506 1508
1507void MainWindow::saveOnClose() 1509void MainWindow::saveOnClose()
1508{ 1510{
1509 KOPrefs *p = KOPrefs::instance(); 1511 KOPrefs *p = KOPrefs::instance();
1510 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1512 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1511 p->mToolBarUp = iconToolBar->x() > width()/2 || 1513 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1512 iconToolBar->y() > height()/2; 1514 iconToolBar->y() > height()/2;
1513 mView->writeSettings(); 1515 mView->writeSettings();
1514 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1516 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1515 save(); 1517 save();
1516} 1518}
1517void MainWindow::slotModifiedChanged( bool changed ) 1519void MainWindow::slotModifiedChanged( bool changed )
1518{ 1520{
1519 if ( mBlockAtStartup ) 1521 if ( mBlockAtStartup )
1520 return; 1522 return;
1521 1523
1522 int msec; 1524 int msec;
1523 // we store the changes after 1 minute, 1525 // we store the changes after 1 minute,
1524 // and for safety reasons after 10 minutes again 1526 // and for safety reasons after 10 minutes again
1525 if ( !mSyncManager->blockSave() ) 1527 if ( !mSyncManager->blockSave() )
1526 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1528 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1527 else 1529 else
1528 msec = 1000 * 600; 1530 msec = 1000 * 600;
1529 mSaveTimer.start( msec, true ); // 1 minute 1531 mSaveTimer.start( msec, true ); // 1 minute
1530 qDebug("KO: Saving File in %d secs!", msec/1000); 1532 qDebug("KO: Saving File in %d secs!", msec/1000);
1531 mCalendarModifiedFlag = true; 1533 mCalendarModifiedFlag = true;
1532} 1534}
1533void MainWindow::saveStopTimer() 1535void MainWindow::saveStopTimer()
1534{ 1536{
1535 mSaveTimer.stop(); 1537 mSaveTimer.stop();
1536 if (mSaveTimer.isActive() ) 1538 if (mSaveTimer.isActive() )
1537 qDebug("ti active "); 1539 qDebug("ti active ");
1538 else 1540 else
1539 qDebug("KO: Save timer stopped"); 1541 qDebug("KO: Save timer stopped");
1540} 1542}
1541void MainWindow::save() 1543void MainWindow::save()
1542{ 1544{
1543 if ( !mCalendarModifiedFlag ) { 1545 if ( !mCalendarModifiedFlag ) {
1544 qDebug("KO: Calendar not modified. Nothing saved."); 1546 qDebug("KO: Calendar not modified. Nothing saved.");
1545 return; 1547 return;
1546 } 1548 }
1547 if ( mSyncManager->blockSave() ) 1549 if ( mSyncManager->blockSave() )
1548 return; 1550 return;
1549 mSyncManager->setBlockSave(true); 1551 mSyncManager->setBlockSave(true);
1550 if ( mView->checkFileVersion( defaultFileName()) ) { 1552 if ( mView->checkFileVersion( defaultFileName()) ) {
1551 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1553 QTime neededSaveTime = QDateTime::currentDateTime().time();
1552 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1554 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1553 qDebug("KO: Start saving data to file!"); 1555 qDebug("KO: Start saving data to file!");
1554 mView->saveCalendar( defaultFileName() ); 1556 mView->saveCalendar( defaultFileName() );
1555 mCalendarModifiedFlag = false; 1557 mCalendarModifiedFlag = false;
1556 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1558 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1557 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1559 qDebug("KO: Needed %d ms for saving.",msNeeded );
1558 QString savemes; 1560 QString savemes;
1559 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1561 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1560 setCaption(savemes); 1562 setCaption(savemes);
1561 } else 1563 } else
1562 setCaption(i18n("Saving cancelled!")); 1564 setCaption(i18n("Saving cancelled!"));
1563 mSyncManager->setBlockSave( false ); 1565 mSyncManager->setBlockSave( false );
1564} 1566}
1565 1567
1566void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1568void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1567{ 1569{
1568 if ( !e->isAutoRepeat() ) { 1570 if ( !e->isAutoRepeat() ) {
1569 mFlagKeyPressed = false; 1571 mFlagKeyPressed = false;
1570 } 1572 }
1571} 1573}
1572void MainWindow::keyPressEvent ( QKeyEvent * e ) 1574void MainWindow::keyPressEvent ( QKeyEvent * e )
1573{ 1575{
1574 qApp->processEvents(); 1576 qApp->processEvents();
1575 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1577 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1576 e->ignore(); 1578 e->ignore();
1577 // qDebug(" ignore %d",e->isAutoRepeat() ); 1579 // qDebug(" ignore %d",e->isAutoRepeat() );
1578 return; 1580 return;
1579 } 1581 }
1580 if (! e->isAutoRepeat() ) 1582 if (! e->isAutoRepeat() )
1581 mFlagKeyPressed = true; 1583 mFlagKeyPressed = true;
1582 KOPrefs *p = KOPrefs::instance(); 1584 KOPrefs *p = KOPrefs::instance();
1583 bool showSelectedDates = false; 1585 bool showSelectedDates = false;
1584 int size; 1586 int size;
1585 int pro = 0; 1587 int pro = 0;
1586 //qDebug("MainWindow::keyPressEvent "); 1588 //qDebug("MainWindow::keyPressEvent ");
1587 switch ( e->key() ) { 1589 switch ( e->key() ) {
1588 case Qt::Key_Right: 1590 case Qt::Key_Right:
1589 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1591 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1590 mView->goNextMonth(); 1592 mView->goNextMonth();
1591 else 1593 else
1592 mView->goNext(); 1594 mView->goNext();
1593 showSelectedDates = true; 1595 showSelectedDates = true;
1594 break; 1596 break;
1595 case Qt::Key_Left: 1597 case Qt::Key_Left:
1596 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1598 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1597 mView->goPreviousMonth(); 1599 mView->goPreviousMonth();
1598 else 1600 else
1599 mView->goPrevious(); 1601 mView->goPrevious();
1600 showSelectedDates = true; 1602 showSelectedDates = true;
1601 break; 1603 break;
1602 case Qt::Key_Down: 1604 case Qt::Key_Down:
1603 mView->viewManager()->agendaView()->scrollOneHourDown(); 1605 mView->viewManager()->agendaView()->scrollOneHourDown();
1604 break; 1606 break;
1605 case Qt::Key_Up: 1607 case Qt::Key_Up:
1606 mView->viewManager()->agendaView()->scrollOneHourUp(); 1608 mView->viewManager()->agendaView()->scrollOneHourUp();
1607 break; 1609 break;
1608 case Qt::Key_I: 1610 case Qt::Key_I:
1609 mView->showIncidence(); 1611 mView->showIncidence();
1610 break; 1612 break;
1611 case Qt::Key_Delete: 1613 case Qt::Key_Delete:
1612 case Qt::Key_Backspace: 1614 case Qt::Key_Backspace:
1613 mView->deleteIncidence(); 1615 mView->deleteIncidence();
1614 break; 1616 break;
1615 case Qt::Key_D: 1617 case Qt::Key_D:
1616 mView->viewManager()->showDayView(); 1618 mView->viewManager()->showDayView();
1617 showSelectedDates = true; 1619 showSelectedDates = true;
1618 break; 1620 break;
1619 case Qt::Key_O: 1621 case Qt::Key_O:
1620 mView->toggleFilerEnabled( ); 1622 mView->toggleFilerEnabled( );
1621 break; 1623 break;
1622 case Qt::Key_0: 1624 case Qt::Key_0:
1623 case Qt::Key_1: 1625 case Qt::Key_1:
1624 case Qt::Key_2: 1626 case Qt::Key_2:
1625 case Qt::Key_3: 1627 case Qt::Key_3:
1626 case Qt::Key_4: 1628 case Qt::Key_4:
1627 case Qt::Key_5: 1629 case Qt::Key_5:
1628 case Qt::Key_6: 1630 case Qt::Key_6:
1629 case Qt::Key_7: 1631 case Qt::Key_7:
1630 case Qt::Key_8: 1632 case Qt::Key_8:
1631 case Qt::Key_9: 1633 case Qt::Key_9:
1632 pro = e->key()-48; 1634 pro = e->key()-48;
1633 if ( pro == 0 ) 1635 if ( pro == 0 )
1634 pro = 10; 1636 pro = 10;
1635 if ( e->state() == Qt::ControlButton) 1637 if ( e->state() == Qt::ControlButton)
1636 pro += 10; 1638 pro += 10;
1637 break; 1639 break;
1638 case Qt::Key_M: 1640 case Qt::Key_M:
1639 mView->viewManager()->showMonthView(); 1641 mView->viewManager()->showMonthView();
1640 showSelectedDates = true; 1642 showSelectedDates = true;
1641 break; 1643 break;
1642 case Qt::Key_Insert: 1644 case Qt::Key_Insert:
1643 mView->newEvent(); 1645 mView->newEvent();
1644 break; 1646 break;
1645 case Qt::Key_S : 1647 case Qt::Key_S :
1646 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1648 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1647 mView->newSubTodo(); 1649 mView->newSubTodo();
1648 else 1650 else
1649 mView->dialogManager()->showSearchDialog(); 1651 mView->dialogManager()->showSearchDialog();
1650 break; 1652 break;
1651 case Qt::Key_Y : 1653 case Qt::Key_Y :
1652 case Qt::Key_Z : 1654 case Qt::Key_Z :
1653 mView->viewManager()->showWorkWeekView(); 1655 mView->viewManager()->showWorkWeekView();
1654 showSelectedDates = true; 1656 showSelectedDates = true;
1655 break; 1657 break;
1656 case Qt::Key_U : 1658 case Qt::Key_U :
1657 mView->viewManager()->showWeekView(); 1659 mView->viewManager()->showWeekView();
1658 showSelectedDates = true; 1660 showSelectedDates = true;
1659 break; 1661 break;
1660 case Qt::Key_H : 1662 case Qt::Key_H :
1661 keyBindings(); 1663 keyBindings();
1662 break; 1664 break;
1663 case Qt::Key_W: 1665 case Qt::Key_W:
1664 mView->viewManager()->showWhatsNextView(); 1666 mView->viewManager()->showWhatsNextView();
1665 break; 1667 break;
1666 case Qt::Key_L: 1668 case Qt::Key_L:
1667 mView->viewManager()->showListView(); 1669 mView->viewManager()->showListView();
1668 break; 1670 break;
1669 case Qt::Key_N: 1671 case Qt::Key_N:
1670 mView->viewManager()->showNextXView(); 1672 mView->viewManager()->showNextXView();
1671 showSelectedDates = true; 1673 showSelectedDates = true;
1672 break; 1674 break;
1673 case Qt::Key_V: 1675 case Qt::Key_V:
1674 mView->viewManager()->showTodoView(); 1676 mView->viewManager()->showTodoView();
1675 break; 1677 break;
1676 case Qt::Key_C: 1678 case Qt::Key_C:
1677 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1679 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1678 break; 1680 break;
1679 case Qt::Key_P: 1681 case Qt::Key_P:
1680 mView->showDatePicker( ); 1682 mView->showDatePicker( );
1681 break; 1683 break;
1682 case Qt::Key_F: 1684 case Qt::Key_F:
1683 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1685 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1684 mView->editFilters(); 1686 mView->editFilters();
1685 else 1687 else
1686 mView->toggleFilter(); 1688 mView->toggleFilter();
1687 break; 1689 break;
1688 case Qt::Key_X: 1690 case Qt::Key_X:
1689 mView->toggleDateNavigatorWidget(); 1691 mView->toggleDateNavigatorWidget();
1690 break; 1692 break;
1691 case Qt::Key_Space: 1693 case Qt::Key_Space:
1692 mView->toggleExpand(); 1694 mView->toggleExpand();
1693 break; 1695 break;
1694 case Qt::Key_A: 1696 case Qt::Key_A:
1695 mView->toggleAllDaySize(); 1697 mView->toggleAllDaySize();
1696 break; 1698 break;
1697 case Qt::Key_T: 1699 case Qt::Key_T:
1698 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1700 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1699 mView->newTodo(); 1701 mView->newTodo();
1700 else { 1702 else {
1701 mView->goToday(); 1703 mView->goToday();
1702 showSelectedDates = true; 1704 showSelectedDates = true;
1703 } 1705 }
1704 break; 1706 break;
1705 case Qt::Key_J: 1707 case Qt::Key_J:
1706 mView->viewManager()->showJournalView(); 1708 mView->viewManager()->showJournalView();
1707 break; 1709 break;
1708 case Qt::Key_B: 1710 case Qt::Key_B:
1709 mView->editIncidenceDescription();; 1711 mView->editIncidenceDescription();;
1710 break; 1712 break;
1711 // case Qt::Key_Return: 1713 // case Qt::Key_Return:
1712 case Qt::Key_E: 1714 case Qt::Key_E:
1713 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1715 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1714 mView->newEvent(); 1716 mView->newEvent();
1715 else 1717 else
1716 mView->editIncidence(); 1718 mView->editIncidence();
1717 break; 1719 break;
1718 case Qt::Key_Plus: 1720 case Qt::Key_Plus:
1719 size = p->mHourSize +2; 1721 size = p->mHourSize +2;
1720 if ( size <= 18 ) 1722 if ( size <= 18 )
1721 configureAgenda( size ); 1723 configureAgenda( size );
1722 break; 1724 break;
1723 case Qt::Key_Minus: 1725 case Qt::Key_Minus:
1724 size = p->mHourSize - 2; 1726 size = p->mHourSize - 2;
1725 if ( size >= 4 ) 1727 if ( size >= 4 )
1726 configureAgenda( size ); 1728 configureAgenda( size );
1727 break; 1729 break;
1728 1730
1729 1731
1730 default: 1732 default:
1731 e->ignore(); 1733 e->ignore();
1732 } 1734 }
1733 if ( pro > 0 ) { 1735 if ( pro > 0 ) {
1734 mView->selectFilter( pro-1 ); 1736 mView->selectFilter( pro-1 );
1735 } 1737 }
1736 if ( showSelectedDates ) { 1738 if ( showSelectedDates ) {
1737 ;// setCaptionToDates(); 1739 ;// setCaptionToDates();
1738 } 1740 }
1739 1741
1740} 1742}
1741 1743
1742void MainWindow::fillFilterMenu() 1744void MainWindow::fillFilterMenu()
1743{ 1745{
1744 selectFilterMenu->clear(); 1746 selectFilterMenu->clear();
1745 bool disable = false; 1747 bool disable = false;
1746 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1748 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1747 selectFilterMenu->insertSeparator(); 1749 selectFilterMenu->insertSeparator();
1748 if ( mView->filterView()->filtersEnabled() ) { 1750 if ( mView->filterView()->filtersEnabled() ) {
1749 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1751 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1750 } 1752 }
1751 else { 1753 else {
1752 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1754 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1753 disable = true; 1755 disable = true;
1754 } 1756 }
1755 selectFilterMenu->insertSeparator(); 1757 selectFilterMenu->insertSeparator();
1756 QPtrList<CalFilter> fili = mView->filters(); 1758 QPtrList<CalFilter> fili = mView->filters();
1757 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1759 CalFilter *curfilter = mView->filterView()->selectedFilter();
1758 CalFilter *filter = fili.first(); 1760 CalFilter *filter = fili.first();
1759 int iii = 2; 1761 int iii = 2;
1760 while(filter) { 1762 while(filter) {
1761 selectFilterMenu->insertItem( filter->name(), iii ); 1763 selectFilterMenu->insertItem( filter->name(), iii );
1762 if ( filter == curfilter) 1764 if ( filter == curfilter)
1763 selectFilterMenu->setItemChecked( iii, true ); 1765 selectFilterMenu->setItemChecked( iii, true );
1764 if ( disable ) 1766 if ( disable )
1765 selectFilterMenu->setItemEnabled( iii, false ); 1767 selectFilterMenu->setItemEnabled( iii, false );
1766 filter = fili.next(); 1768 filter = fili.next();
1767 ++iii; 1769 ++iii;
1768 } 1770 }
1769} 1771}
1770void MainWindow::selectFilter( int fil ) 1772void MainWindow::selectFilter( int fil )