summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/mainwindow.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index ea5aaa1..9366c11 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,478 +1,479 @@
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::setCategoryDefaults() 339void KOPrefs::setCategoryDefaults()
340{ 340{
341 mCustomCategories.clear(); 341 mCustomCategories.clear();
342 mCustomCategories = getDefaultList(); 342 mCustomCategories = getDefaultList();
343 343
344 QStringList::Iterator it; 344 QStringList::Iterator it;
345 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 345 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
346 setCategoryColor(*it,mDefaultCategoryColor); 346 setCategoryColor(*it,mDefaultCategoryColor);
347 } 347 }
348} 348}
349 349
350QStringList KOPrefs::getDefaultList() 350QStringList KOPrefs::getDefaultList()
351{ 351{
352 QStringList retval ; 352 QStringList retval ;
353 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 353 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") 354 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
355 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 355 << 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") 356 << 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") 357 << 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") 358 << 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") 359 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
360 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 360 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
361 retval.sort(); 361 retval.sort();
362 //qDebug("cat %s ", retval.join("-").latin1());
362 return retval; 363 return retval;
363} 364}
364 365
365void KOPrefs::usrReadConfig() 366void KOPrefs::usrReadConfig()
366{ 367{
367 config()->setGroup("General"); 368 config()->setGroup("General");
368 369
369 mCustomCategories = config()->readListEntry("Custom Categories"); 370 mCustomCategories = config()->readListEntry("Custom Categories");
370 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { 371 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) {
371 mLocationDefaults.clear(); 372 mLocationDefaults.clear();
372 mEventSummaryUser.clear(); 373 mEventSummaryUser.clear();
373 mTodoSummaryUser.clear(); 374 mTodoSummaryUser.clear();
374 } 375 }
375 mOldLoadedLanguage = mOldLanguage ; 376 mOldLoadedLanguage = mOldLanguage ;
376 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 377 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
377 if (mLocationDefaults.isEmpty()) { 378 if (mLocationDefaults.isEmpty()) {
378 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 379 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
379 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 380 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
380 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 381 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
381 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 382 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
382 mLocationDefaults.sort(); 383 mLocationDefaults.sort();
383 } 384 }
384 385
385 if (mEventSummaryUser.isEmpty()) { 386 if (mEventSummaryUser.isEmpty()) {
386 mEventSummaryUser = getDefaultList() ; 387 mEventSummaryUser = getDefaultList() ;
387 } 388 }
388 if (mTodoSummaryUser.isEmpty()) { 389 if (mTodoSummaryUser.isEmpty()) {
389 mTodoSummaryUser = getDefaultList() ; 390 mTodoSummaryUser = getDefaultList() ;
390 } 391 }
391 392
392 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 393 if (mCustomCategories.isEmpty()) setCategoryDefaults();
393 394
394 config()->setGroup("Personal Settings"); 395 config()->setGroup("Personal Settings");
395 mName = config()->readEntry("user_name",""); 396 mName = config()->readEntry("user_name","");
396 mEmail = config()->readEntry("user_email",""); 397 mEmail = config()->readEntry("user_email","");
397 fillMailDefaults(); 398 fillMailDefaults();
398 399
399 config()->setGroup("Category Colors"); 400 config()->setGroup("Category Colors");
400 QStringList::Iterator it; 401 QStringList::Iterator it;
401 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 402 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
402 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 403 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
403 404
404 } 405 }
405 406
406 KPimPrefs::usrReadConfig(); 407 KPimPrefs::usrReadConfig();
407} 408}
408 409
409 410
410void KOPrefs::usrWriteConfig() 411void KOPrefs::usrWriteConfig()
411{ 412{
412 config()->setGroup("General"); 413 config()->setGroup("General");
413 config()->writeEntry("Custom Categories",mCustomCategories); 414 config()->writeEntry("Custom Categories",mCustomCategories);
414 415
415 config()->setGroup("Personal Settings"); 416 config()->setGroup("Personal Settings");
416 config()->writeEntry("user_name",mName); 417 config()->writeEntry("user_name",mName);
417 config()->writeEntry("user_email",mEmail); 418 config()->writeEntry("user_email",mEmail);
418 419
419 config()->setGroup("Category Colors"); 420 config()->setGroup("Category Colors");
420 QDictIterator<QColor> it(mCategoryColors); 421 QDictIterator<QColor> it(mCategoryColors);
421 while (it.current()) { 422 while (it.current()) {
422 config()->writeEntry(it.currentKey(),*(it.current())); 423 config()->writeEntry(it.currentKey(),*(it.current()));
423 ++it; 424 ++it;
424 } 425 }
425 426
426 427
427 KPimPrefs::usrWriteConfig(); 428 KPimPrefs::usrWriteConfig();
428} 429}
429 430
430void KOPrefs::setCategoryColor(QString cat,const QColor & color) 431void KOPrefs::setCategoryColor(QString cat,const QColor & color)
431{ 432{
432 mCategoryColors.replace(cat,new QColor(color)); 433 mCategoryColors.replace(cat,new QColor(color));
433} 434}
434 435
435QColor *KOPrefs::categoryColor(QString cat) 436QColor *KOPrefs::categoryColor(QString cat)
436{ 437{
437 QColor *color = 0; 438 QColor *color = 0;
438 439
439 if (!cat.isEmpty()) color = mCategoryColors[cat]; 440 if (!cat.isEmpty()) color = mCategoryColors[cat];
440 441
441 if (color) return color; 442 if (color) return color;
442 else return &mDefaultCategoryColor; 443 else return &mDefaultCategoryColor;
443} 444}
444 445
445void KOPrefs::setFullName(const QString &name) 446void KOPrefs::setFullName(const QString &name)
446{ 447{
447 mName = name; 448 mName = name;
448} 449}
449 450
450void KOPrefs::setEmail(const QString &email) 451void KOPrefs::setEmail(const QString &email)
451{ 452{
452 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 453 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
453 mEmail = email; 454 mEmail = email;
454} 455}
455 456
456QString KOPrefs::fullName() 457QString KOPrefs::fullName()
457{ 458{
458 if (mEmailControlCenter) { 459 if (mEmailControlCenter) {
459 KEMailSettings settings; 460 KEMailSettings settings;
460 return settings.getSetting(KEMailSettings::RealName); 461 return settings.getSetting(KEMailSettings::RealName);
461 } else { 462 } else {
462 return mName; 463 return mName;
463 } 464 }
464} 465}
465 466
466QString KOPrefs::email() 467QString KOPrefs::email()
467{ 468{
468 if (mEmailControlCenter) { 469 if (mEmailControlCenter) {
469 KEMailSettings settings; 470 KEMailSettings settings;
470 return settings.getSetting(KEMailSettings::EmailAddress); 471 return settings.getSetting(KEMailSettings::EmailAddress);
471 } else { 472 } else {
472 return mEmail; 473 return mEmail;
473 } 474 }
474} 475}
475KConfig* KOPrefs::getConfig() 476KConfig* KOPrefs::getConfig()
476{ 477{
477 return config(); 478 return config();
478} 479}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 5bc8c00..9e32c18 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1951 +1,1951 @@
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#ifdef DESKTOP_VERSION 135#ifdef DESKTOP_VERSION
136 setFont( QFont("Arial"), 14 ); 136 setFont( QFont("Arial"), 14 );
137#endif 137#endif
138 mClosed = false; 138 mClosed = false;
139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
140 QString confFile = locateLocal("config","korganizerrc"); 140 QString confFile = locateLocal("config","korganizerrc");
141 QFileInfo finf ( confFile ); 141 QFileInfo finf ( confFile );
142 bool showWarning = !finf.exists(); 142 bool showWarning = !finf.exists();
143 setIcon(SmallIcon( "ko24" ) ); 143 setIcon(SmallIcon( "ko24" ) );
144 mBlockAtStartup = true; 144 mBlockAtStartup = true;
145 mFlagKeyPressed = false; 145 mFlagKeyPressed = false;
146 setCaption("KOrganizer/Pi"); 146 setCaption("KOrganizer/Pi");
147 KOPrefs *p = KOPrefs::instance();
148 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 KOPrefs *p = KOPrefs::instance();
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 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
172 splash->setAlignment ( AlignCenter ); 172 splash->setAlignment ( AlignCenter );
173 setCentralWidget( splash ); 173 setCentralWidget( splash );
174#ifndef DESKTOP_VERSION 174#ifndef DESKTOP_VERSION
175 showMaximized(); 175 showMaximized();
176#endif 176#endif
177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
178 setDefaultPreferences(); 178 setDefaultPreferences();
179 mCalendar = new CalendarLocal(); 179 mCalendar = new CalendarLocal();
180 mView = new CalendarView( mCalendar, this,"mCalendar " ); 180 mView = new CalendarView( mCalendar, this,"mCalendar " );
181 mView->hide(); 181 mView->hide();
182 //mView->resize(splash->size() ); 182 //mView->resize(splash->size() );
183 initActions(); 183 initActions();
184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
185 mSyncManager->setBlockSave(false); 185 mSyncManager->setBlockSave(false);
186 mView->setSyncManager(mSyncManager); 186 mView->setSyncManager(mSyncManager);
187#ifndef DESKTOP_VERSION 187#ifndef DESKTOP_VERSION
188 iconToolBar->show(); 188 iconToolBar->show();
189 qApp->processEvents(); 189 qApp->processEvents();
190#endif 190#endif
191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
192 int vh = height() ; 192 int vh = height() ;
193 int vw = width(); 193 int vw = width();
194 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 194 //qDebug("Toolbar hei %d ",iconToolBar->height() );
195 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 195 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
196 vh -= iconToolBar->height(); 196 vh -= iconToolBar->height();
197 } else { 197 } else {
198 vw -= iconToolBar->height(); 198 vw -= iconToolBar->height();
199 } 199 }
200 //mView->setMaximumSize( splash->size() ); 200 //mView->setMaximumSize( splash->size() );
201 //mView->resize( splash->size() ); 201 //mView->resize( splash->size() );
202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
203 mView->readSettings(); 203 mView->readSettings();
204 bool newFile = false; 204 bool newFile = false;
205 if( !QFile::exists( defaultFileName() ) ) { 205 if( !QFile::exists( defaultFileName() ) ) {
206 QFileInfo finfo ( defaultFileName() ); 206 QFileInfo finfo ( defaultFileName() );
207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
208 qDebug("oldfile %s ", oldFile.latin1()); 208 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"; 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";
210 finfo.setFile( oldFile ); 210 finfo.setFile( oldFile );
211 if (finfo.exists() ) { 211 if (finfo.exists() ) {
212 KMessageBox::information( this, message); 212 KMessageBox::information( this, message);
213 mView->openCalendar( oldFile ); 213 mView->openCalendar( oldFile );
214 qApp->processEvents(); 214 qApp->processEvents();
215 } else { 215 } else {
216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
217 finfo.setFile( oldFile ); 217 finfo.setFile( oldFile );
218 if (finfo.exists() ) { 218 if (finfo.exists() ) {
219 KMessageBox::information( this, message); 219 KMessageBox::information( this, message);
220 mView->openCalendar( oldFile ); 220 mView->openCalendar( oldFile );
221 qApp->processEvents(); 221 qApp->processEvents();
222 } 222 }
223 } 223 }
224 mView->saveCalendar( defaultFileName() ); 224 mView->saveCalendar( defaultFileName() );
225 newFile = true; 225 newFile = true;
226 } 226 }
227 227
228 QTime neededSaveTime = QDateTime::currentDateTime().time(); 228 QTime neededSaveTime = QDateTime::currentDateTime().time();
229 mView->openCalendar( defaultFileName() ); 229 mView->openCalendar( defaultFileName() );
230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
231 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 231 qDebug("KO: Calendar loading time: %d ms",msNeeded );
232 232
233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
234 KOPrefs::instance()->setCategoryDefaults(); 234 KOPrefs::instance()->setCategoryDefaults();
235 int count = mView->addCategories(); 235 int count = mView->addCategories();
236 } 236 }
237 processIncidenceSelection( 0 ); 237 processIncidenceSelection( 0 );
238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
239 SLOT( processIncidenceSelection( Incidence * ) ) ); 239 SLOT( processIncidenceSelection( Incidence * ) ) );
240 connect( mView, SIGNAL( modifiedChanged( bool ) ), 240 connect( mView, SIGNAL( modifiedChanged( bool ) ),
241 SLOT( slotModifiedChanged( bool ) ) ); 241 SLOT( slotModifiedChanged( bool ) ) );
242 242
243 243
244 connect( mView, SIGNAL( tempDisableBR(bool) ), 244 connect( mView, SIGNAL( tempDisableBR(bool) ),
245 SLOT( disableBR(bool) ) ); 245 SLOT( disableBR(bool) ) );
246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
247 mView->setModified( false ); 247 mView->setModified( false );
248 mBlockAtStartup = false; 248 mBlockAtStartup = false;
249 mView->setModified( false ); 249 mView->setModified( false );
250 setCentralWidget( mView ); 250 setCentralWidget( mView );
251 globalFlagBlockStartup = 0; 251 globalFlagBlockStartup = 0;
252 mView->show(); 252 mView->show();
253 delete splash; 253 delete splash;
254 if ( newFile ) 254 if ( newFile )
255 mView->updateConfig(); 255 mView->updateConfig();
256 // qApp->processEvents(); 256 // qApp->processEvents();
257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
258 //fillSyncMenu(); 258 //fillSyncMenu();
259 259
260 260
261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
266 mSyncManager->setDefaultFileName( defaultFileName()); 266 mSyncManager->setDefaultFileName( defaultFileName());
267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
268 mSyncManager->fillSyncMenu(); 268 mSyncManager->fillSyncMenu();
269 269
270 270
271 271
272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
273 if ( showWarning ) { 273 if ( showWarning ) {
274 KMessageBox::information( this, 274 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"); 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");
276 qApp->processEvents(); 276 qApp->processEvents();
277 mView->dialogManager()->showSyncOptions(); 277 mView->dialogManager()->showSyncOptions();
278 } 278 }
279 279
280 //US listen for result adressed from Ka/Pi 280 //US listen for result adressed from Ka/Pi
281#ifndef DESKTOP_VERSION 281#ifndef DESKTOP_VERSION
282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
283#endif 283#endif
284#ifndef DESKTOP_VERSION 284#ifndef DESKTOP_VERSION
285 infrared = 0; 285 infrared = 0;
286#endif 286#endif
287 287
288 mBRdisabled = false; 288 mBRdisabled = false;
289 //toggleBeamReceive(); 289 //toggleBeamReceive();
290} 290}
291MainWindow::~MainWindow() 291MainWindow::~MainWindow()
292{ 292{
293 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 294 //save toolbar location
295 delete mCalendar; 295 delete mCalendar;
296 delete mSyncManager; 296 delete mSyncManager;
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 if ( infrared ) 298 if ( infrared )
299 delete infrared; 299 delete infrared;
300#endif 300#endif
301 301
302 302
303} 303}
304 304
305void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
306{ 306{
307#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
308 if ( b ) { 308 if ( b ) {
309 if ( infrared ) { 309 if ( infrared ) {
310 toggleBeamReceive(); 310 toggleBeamReceive();
311 mBRdisabled = true; 311 mBRdisabled = true;
312 } 312 }
313 mBRdisabled = true; 313 mBRdisabled = true;
314 } else { 314 } else {
315 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
316 mBRdisabled = false; 316 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 318 // toggleBeamReceive();
319 } 319 }
320 } 320 }
321#endif 321#endif
322 322
323} 323}
324bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
325{ 325{
326#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 327 return ( infrared != 0 );
328#endif 328#endif
329 return false; 329 return false;
330} 330}
331 331
332void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
333{ 333{
334 if ( mBRdisabled ) 334 if ( mBRdisabled )
335 return; 335 return;
336#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
337 if ( infrared ) { 337 if ( infrared ) {
338 qDebug("disable BeamReceive "); 338 qDebug("disable BeamReceive ");
339 delete infrared; 339 delete infrared;
340 infrared = 0; 340 infrared = 0;
341 brAction->setOn(false); 341 brAction->setOn(false);
342 return; 342 return;
343 } 343 }
344 qDebug("enable BeamReceive "); 344 qDebug("enable BeamReceive ");
345 brAction->setOn(true); 345 brAction->setOn(true);
346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
348#endif 348#endif
349} 349}
350void MainWindow::showMaximized () 350void MainWindow::showMaximized ()
351{ 351{
352#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
353 if ( ! globalFlagBlockStartup ) 353 if ( ! globalFlagBlockStartup )
354 if ( mClosed ) 354 if ( mClosed )
355 mView->goToday(); 355 mView->goToday();
356#endif 356#endif
357 QWidget::showMaximized () ; 357 QWidget::showMaximized () ;
358 mClosed = false; 358 mClosed = false;
359} 359}
360void MainWindow::closeEvent( QCloseEvent* ce ) 360void MainWindow::closeEvent( QCloseEvent* ce )
361{ 361{
362 362
363 363
364 364
365 if ( ! KOPrefs::instance()->mAskForQuit ) { 365 if ( ! KOPrefs::instance()->mAskForQuit ) {
366 saveOnClose(); 366 saveOnClose();
367 mClosed = true; 367 mClosed = true;
368 ce->accept(); 368 ce->accept();
369 return; 369 return;
370 370
371 } 371 }
372 372
373 switch( QMessageBox::information( this, "KO/Pi", 373 switch( QMessageBox::information( this, "KO/Pi",
374 i18n("Do you really want\nto close KO/Pi?"), 374 i18n("Do you really want\nto close KO/Pi?"),
375 i18n("Close"), i18n("No"), 375 i18n("Close"), i18n("No"),
376 0, 0 ) ) { 376 0, 0 ) ) {
377 case 0: 377 case 0:
378 saveOnClose(); 378 saveOnClose();
379 mClosed = true; 379 mClosed = true;
380 ce->accept(); 380 ce->accept();
381 break; 381 break;
382 case 1: 382 case 1:
383 ce->ignore(); 383 ce->ignore();
384 break; 384 break;
385 case 2: 385 case 2:
386 386
387 default: 387 default:
388 break; 388 break;
389 } 389 }
390 390
391 391
392} 392}
393 393
394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
395{ 395{
396 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
398 //QString datamess; 398 //QString datamess;
399 //qDebug("message "); 399 //qDebug("message ");
400 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 400 qDebug("KO: QCOP message received: %s ", cmsg.data() );
401 401
402 if ( cmsg == "setDocument(QString)" ) { 402 if ( cmsg == "setDocument(QString)" ) {
403 QDataStream stream( data, IO_ReadOnly ); 403 QDataStream stream( data, IO_ReadOnly );
404 QString fileName; 404 QString fileName;
405 stream >> fileName; 405 stream >> fileName;
406 //qDebug("filename %s ", fileName.latin1()); 406 //qDebug("filename %s ", fileName.latin1());
407 showMaximized(); 407 showMaximized();
408 raise(); 408 raise();
409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
410 mSyncManager->slotSyncMenu( 1002 ); 410 mSyncManager->slotSyncMenu( 1002 );
411 return; 411 return;
412 } 412 }
413 413
414 if ( cmsg == "-writeFile" ) { 414 if ( cmsg == "-writeFile" ) {
415 // I made from the "-writeFile" an "-writeAlarm" 415 // I made from the "-writeFile" an "-writeAlarm"
416 mView->viewManager()->showWhatsNextView(); 416 mView->viewManager()->showWhatsNextView();
417 mCalendar->checkAlarmForIncidence( 0, true); 417 mCalendar->checkAlarmForIncidence( 0, true);
418 showMaximized(); 418 showMaximized();
419 raise(); 419 raise();
420 return; 420 return;
421 421
422 } 422 }
423 if ( cmsg == "-writeFileSilent" ) { 423 if ( cmsg == "-writeFileSilent" ) {
424 // I made from the "-writeFile" an "-writeAlarm" 424 // I made from the "-writeFile" an "-writeAlarm"
425 // mView->viewManager()->showWhatsNextView(); 425 // mView->viewManager()->showWhatsNextView();
426 mCalendar->checkAlarmForIncidence( 0, true); 426 mCalendar->checkAlarmForIncidence( 0, true);
427 //showMaximized(); 427 //showMaximized();
428 //raise(); 428 //raise();
429 hide(); 429 hide();
430 return; 430 return;
431 } 431 }
432 if ( cmsg == "-newCountdown" ) { 432 if ( cmsg == "-newCountdown" ) {
433 qDebug("newCountdown "); 433 qDebug("newCountdown ");
434 434
435 } 435 }
436 QString msg ; 436 QString msg ;
437 QString allmsg = cmsg; 437 QString allmsg = cmsg;
438 while ( allmsg.length() > 0 ) { 438 while ( allmsg.length() > 0 ) {
439 int nextC = allmsg.find( "-", 1 ); 439 int nextC = allmsg.find( "-", 1 );
440 if ( nextC == -1 ) { 440 if ( nextC == -1 ) {
441 msg = allmsg; 441 msg = allmsg;
442 allmsg = ""; 442 allmsg = "";
443 } else{ 443 } else{
444 msg = allmsg.left( nextC ); 444 msg = allmsg.left( nextC );
445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
446 } 446 }
447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
448 if ( msg == "-newEvent" ) { 448 if ( msg == "-newEvent" ) {
449 mView->newEvent(); 449 mView->newEvent();
450 } 450 }
451 if ( msg == "-newTodo" ) { 451 if ( msg == "-newTodo" ) {
452 mView->newTodo(); 452 mView->newTodo();
453 453
454 } 454 }
455 if ( msg == "-showWN" ) { 455 if ( msg == "-showWN" ) {
456 mView->viewManager()->showWhatsNextView(); 456 mView->viewManager()->showWhatsNextView();
457 } 457 }
458 if ( msg == "-showTodo" ) { 458 if ( msg == "-showTodo" ) {
459 mView->viewManager()->showTodoView(); 459 mView->viewManager()->showTodoView();
460 } 460 }
461 if ( msg == "-showList" ) { 461 if ( msg == "-showList" ) {
462 mView->viewManager()->showListView(); 462 mView->viewManager()->showListView();
463 } 463 }
464 else if ( msg == "-showDay" ) { 464 else if ( msg == "-showDay" ) {
465 mView->viewManager()->showDayView(); 465 mView->viewManager()->showDayView();
466 } 466 }
467 else if ( msg == "-showWWeek" ) { 467 else if ( msg == "-showWWeek" ) {
468 mView->viewManager()->showWorkWeekView(); 468 mView->viewManager()->showWorkWeekView();
469 } 469 }
470 else if ( msg == "-ringSync" ) { 470 else if ( msg == "-ringSync" ) {
471 mSyncManager->multiSync( false ); 471 mSyncManager->multiSync( false );
472 } 472 }
473 else if ( msg == "-showWeek" ) { 473 else if ( msg == "-showWeek" ) {
474 mView->viewManager()->showWeekView(); 474 mView->viewManager()->showWeekView();
475 } 475 }
476 else if ( msg == "-showTodo" ) { 476 else if ( msg == "-showTodo" ) {
477 mView->viewManager()->showTodoView(); 477 mView->viewManager()->showTodoView();
478 } 478 }
479 else if ( msg == "-showJournal" ) { 479 else if ( msg == "-showJournal" ) {
480 mView->dateNavigator()->selectDates( 1 ); 480 mView->dateNavigator()->selectDates( 1 );
481 mView->dateNavigator()->selectToday(); 481 mView->dateNavigator()->selectToday();
482 mView->viewManager()->showJournalView(); 482 mView->viewManager()->showJournalView();
483 } 483 }
484 else if ( msg == "-showKO" ) { 484 else if ( msg == "-showKO" ) {
485 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
486 } 486 }
487 else if ( msg == "-showWNext" || msg == "nextView()" ) { 487 else if ( msg == "-showWNext" || msg == "nextView()" ) {
488 mView->viewManager()->showWhatsNextView(); 488 mView->viewManager()->showWhatsNextView();
489 } 489 }
490 else if ( msg == "-showNextXView" ) { 490 else if ( msg == "-showNextXView" ) {
491 mView->viewManager()->showNextXView(); 491 mView->viewManager()->showNextXView();
492 } 492 }
493 493
494 494
495 } 495 }
496 496
497 showMaximized(); 497 showMaximized();
498 raise(); 498 raise();
499} 499}
500 500
501QPixmap MainWindow::loadPixmap( QString name ) 501QPixmap MainWindow::loadPixmap( QString name )
502{ 502{
503 return SmallIcon( name ); 503 return SmallIcon( name );
504 504
505} 505}
506void MainWindow::initActions() 506void MainWindow::initActions()
507{ 507{
508 //KOPrefs::instance()->mShowFullMenu 508 //KOPrefs::instance()->mShowFullMenu
509 iconToolBar->clear(); 509 iconToolBar->clear();
510 KOPrefs *p = KOPrefs::instance(); 510 KOPrefs *p = KOPrefs::instance();
511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
512 512
513 QPopupMenu *viewMenu = new QPopupMenu( this ); 513 QPopupMenu *viewMenu = new QPopupMenu( this );
514 QPopupMenu *actionMenu = new QPopupMenu( this ); 514 QPopupMenu *actionMenu = new QPopupMenu( this );
515 QPopupMenu *importMenu = new QPopupMenu( this ); 515 QPopupMenu *importMenu = new QPopupMenu( this );
516 selectFilterMenu = new QPopupMenu( this ); 516 selectFilterMenu = new QPopupMenu( this );
517 selectFilterMenu->setCheckable( true ); 517 selectFilterMenu->setCheckable( true );
518 syncMenu = new QPopupMenu( this ); 518 syncMenu = new QPopupMenu( this );
519 configureAgendaMenu = new QPopupMenu( this ); 519 configureAgendaMenu = new QPopupMenu( this );
520 configureToolBarMenu = new QPopupMenu( this ); 520 configureToolBarMenu = new QPopupMenu( this );
521 QPopupMenu *helpMenu = new QPopupMenu( this ); 521 QPopupMenu *helpMenu = new QPopupMenu( this );
522 if ( KOPrefs::instance()->mShowFullMenu ) { 522 if ( KOPrefs::instance()->mShowFullMenu ) {
523 QMenuBar *menuBar1; 523 QMenuBar *menuBar1;
524 menuBar1 = menuBar(); 524 menuBar1 = menuBar();
525 menuBar1->insertItem( i18n("File"), importMenu ); 525 menuBar1->insertItem( i18n("File"), importMenu );
526 menuBar1->insertItem( i18n("View"), viewMenu ); 526 menuBar1->insertItem( i18n("View"), viewMenu );
527 menuBar1->insertItem( i18n("Actions"), actionMenu ); 527 menuBar1->insertItem( i18n("Actions"), actionMenu );
528#ifdef DESKTOP_VERSION 528#ifdef DESKTOP_VERSION
529 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 529 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
530 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 530 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
531#else 531#else
532 menuBar1->insertItem( i18n("Sync"), syncMenu ); 532 menuBar1->insertItem( i18n("Sync"), syncMenu );
533 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 533 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
534#endif 534#endif
535 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 535 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
536 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 536 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
537 menuBar1->insertItem( i18n("Help"), helpMenu ); 537 menuBar1->insertItem( i18n("Help"), helpMenu );
538 } else { 538 } else {
539 QPEMenuBar *menuBar1; 539 QPEMenuBar *menuBar1;
540 menuBar1 = new QPEMenuBar( iconToolBar ); 540 menuBar1 = new QPEMenuBar( iconToolBar );
541 QPopupMenu *menuBar = new QPopupMenu( this ); 541 QPopupMenu *menuBar = new QPopupMenu( this );
542 menuBar1->insertItem( i18n("ME"), menuBar); 542 menuBar1->insertItem( i18n("ME"), menuBar);
543 menuBar->insertItem( i18n("File"), importMenu ); 543 menuBar->insertItem( i18n("File"), importMenu );
544 menuBar->insertItem( i18n("View"), viewMenu ); 544 menuBar->insertItem( i18n("View"), viewMenu );
545 menuBar->insertItem( i18n("Actions"), actionMenu ); 545 menuBar->insertItem( i18n("Actions"), actionMenu );
546 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 546 menuBar->insertItem( i18n("Synchronize"), syncMenu );
547 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 547 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
548 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 548 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
549 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 549 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
550 menuBar->insertItem( i18n("Help"), helpMenu ); 550 menuBar->insertItem( i18n("Help"), helpMenu );
551 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 551 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
552 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 552 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
553 } 553 }
554 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 554 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
555 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 555 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
556 556
557 // ****************** 557 // ******************
558 QAction *action; 558 QAction *action;
559 QIconSet icon; 559 QIconSet icon;
560 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 560 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
561 configureToolBarMenu->setCheckable( true ); 561 configureToolBarMenu->setCheckable( true );
562 562
563 QString pathString = ""; 563 QString pathString = "";
564 if ( !p->mToolBarMiniIcons ) { 564 if ( !p->mToolBarMiniIcons ) {
565 if ( QApplication::desktop()->width() < 480 ) 565 if ( QApplication::desktop()->width() < 480 )
566 pathString += "icons16/"; 566 pathString += "icons16/";
567 } else 567 } else
568 pathString += "iconsmini/"; 568 pathString += "iconsmini/";
569 configureAgendaMenu->setCheckable( true ); 569 configureAgendaMenu->setCheckable( true );
570 int iii ; 570 int iii ;
571 for ( iii = 1;iii<= 10 ;++iii ){ 571 for ( iii = 1;iii<= 10 ;++iii ){
572 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 572 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
573 } 573 }
574 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 574 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
575 575
576 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 576 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
577 this, SLOT( showConfigureAgenda( ) ) ); 577 this, SLOT( showConfigureAgenda( ) ) );
578 578
579 icon = loadPixmap( pathString + "configure" ); 579 icon = loadPixmap( pathString + "configure" );
580 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 580 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
581 action->addTo( actionMenu ); 581 action->addTo( actionMenu );
582 connect( action, SIGNAL( activated() ), 582 connect( action, SIGNAL( activated() ),
583 mView, SLOT( edit_options() ) ); 583 mView, SLOT( edit_options() ) );
584 actionMenu->insertSeparator(); 584 actionMenu->insertSeparator();
585 585
586 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 586 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
587 action->addTo( actionMenu ); 587 action->addTo( actionMenu );
588 connect( action, SIGNAL( activated() ), 588 connect( action, SIGNAL( activated() ),
589 mView, SLOT( undo_delete() ) ); 589 mView, SLOT( undo_delete() ) );
590 actionMenu->insertSeparator(); 590 actionMenu->insertSeparator();
591 591
592 icon = loadPixmap( pathString + "newevent" ); 592 icon = loadPixmap( pathString + "newevent" );
593 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 593 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
594 configureToolBarMenu->insertSeparator(); 594 configureToolBarMenu->insertSeparator();
595 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 595 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
596 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 596 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
597 ne_action->addTo( actionMenu ); 597 ne_action->addTo( actionMenu );
598 connect( ne_action, SIGNAL( activated() ), 598 connect( ne_action, SIGNAL( activated() ),
599 mView, SLOT( newEvent() ) ); 599 mView, SLOT( newEvent() ) );
600 icon = loadPixmap( pathString + "newtodo" ); 600 icon = loadPixmap( pathString + "newtodo" );
601 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 601 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
602 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 602 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
603 nt_action->addTo( actionMenu ); 603 nt_action->addTo( actionMenu );
604 connect( nt_action, SIGNAL( activated() ), 604 connect( nt_action, SIGNAL( activated() ),
605 mView, SLOT( newTodo() ) ); 605 mView, SLOT( newTodo() ) );
606 606
607 icon = loadPixmap( pathString + "today" ); 607 icon = loadPixmap( pathString + "today" );
608 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 608 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
609 today_action->addTo( viewMenu ); 609 today_action->addTo( viewMenu );
610 connect( today_action, SIGNAL( activated() ), 610 connect( today_action, SIGNAL( activated() ),
611 mView, SLOT( goToday() ) ); 611 mView, SLOT( goToday() ) );
612 viewMenu->insertSeparator(); 612 viewMenu->insertSeparator();
613 613
614 icon = loadPixmap( pathString + "navi" ); 614 icon = loadPixmap( pathString + "navi" );
615 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 615 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
616 action->addTo( viewMenu ); 616 action->addTo( viewMenu );
617 connect( action, SIGNAL( activated() ), 617 connect( action, SIGNAL( activated() ),
618 mView, SLOT( toggleDateNavigatorWidget() ) ); 618 mView, SLOT( toggleDateNavigatorWidget() ) );
619 mToggleNav = action ; 619 mToggleNav = action ;
620 icon = loadPixmap( pathString + "filter" ); 620 icon = loadPixmap( pathString + "filter" );
621 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 621 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
622 action->addTo( viewMenu ); 622 action->addTo( viewMenu );
623 connect( action, SIGNAL( activated() ), 623 connect( action, SIGNAL( activated() ),
624 mView, SLOT( toggleFilter() ) ); 624 mView, SLOT( toggleFilter() ) );
625 mToggleFilter = action; 625 mToggleFilter = action;
626 icon = loadPixmap( pathString + "allday" ); 626 icon = loadPixmap( pathString + "allday" );
627 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 627 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
628 action->addTo( viewMenu ); 628 action->addTo( viewMenu );
629 connect( action, SIGNAL( activated() ), 629 connect( action, SIGNAL( activated() ),
630 mView, SLOT( toggleAllDaySize() ) ); 630 mView, SLOT( toggleAllDaySize() ) );
631 mToggleAllday = action; 631 mToggleAllday = action;
632 632
633 633
634 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 634 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
635 mToggleNav, SLOT( setEnabled ( bool ) ) ); 635 mToggleNav, SLOT( setEnabled ( bool ) ) );
636 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 636 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
637 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 637 mToggleFilter, SLOT( setEnabled ( bool ) ) );
638 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 638 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
639 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 639 mToggleAllday, SLOT( setEnabled ( bool ) ) );
640 640
641 viewMenu->insertSeparator(); 641 viewMenu->insertSeparator();
642 icon = loadPixmap( pathString + "picker" ); 642 icon = loadPixmap( pathString + "picker" );
643 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 643 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
644 action->addTo( viewMenu ); 644 action->addTo( viewMenu );
645 connect( action, SIGNAL( activated() ), 645 connect( action, SIGNAL( activated() ),
646 mView, SLOT( showDatePicker() ) ); 646 mView, SLOT( showDatePicker() ) );
647 action->addTo( iconToolBar ); 647 action->addTo( iconToolBar );
648 viewMenu->insertSeparator(); 648 viewMenu->insertSeparator();
649 icon = loadPixmap( pathString + "list" ); 649 icon = loadPixmap( pathString + "list" );
650 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 650 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
651 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 651 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
652 showlist_action->addTo( viewMenu ); 652 showlist_action->addTo( viewMenu );
653 connect( showlist_action, SIGNAL( activated() ), 653 connect( showlist_action, SIGNAL( activated() ),
654 mView->viewManager(), SLOT( showListView() ) ); 654 mView->viewManager(), SLOT( showListView() ) );
655 655
656 656
657 icon = loadPixmap( pathString + "day" ); 657 icon = loadPixmap( pathString + "day" );
658 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 658 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
659 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 659 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
660 day1_action->addTo( viewMenu ); 660 day1_action->addTo( viewMenu );
661 // action->addTo( toolBar ); 661 // action->addTo( toolBar );
662 connect( day1_action, SIGNAL( activated() ), 662 connect( day1_action, SIGNAL( activated() ),
663 mView->viewManager(), SLOT( showDayView() ) ); 663 mView->viewManager(), SLOT( showDayView() ) );
664 664
665 icon = loadPixmap( pathString + "workweek" ); 665 icon = loadPixmap( pathString + "workweek" );
666 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 666 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
667 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 667 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
668 day5_action->addTo( viewMenu ); 668 day5_action->addTo( viewMenu );
669 connect( day5_action, SIGNAL( activated() ), 669 connect( day5_action, SIGNAL( activated() ),
670 mView->viewManager(), SLOT( showWorkWeekView() ) ); 670 mView->viewManager(), SLOT( showWorkWeekView() ) );
671 671
672 icon = loadPixmap( pathString + "week" ); 672 icon = loadPixmap( pathString + "week" );
673 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 673 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
674 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 674 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
675 day7_action->addTo( viewMenu ); 675 day7_action->addTo( viewMenu );
676 connect( day7_action, SIGNAL( activated() ), 676 connect( day7_action, SIGNAL( activated() ),
677 mView->viewManager(), SLOT( showWeekView() ) ); 677 mView->viewManager(), SLOT( showWeekView() ) );
678 678
679 icon = loadPixmap( pathString + "month" ); 679 icon = loadPixmap( pathString + "month" );
680 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 680 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
681 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 681 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
682 month_action->addTo( viewMenu ); 682 month_action->addTo( viewMenu );
683 connect( month_action, SIGNAL( activated() ), 683 connect( month_action, SIGNAL( activated() ),
684 mView->viewManager(), SLOT( showMonthView() ) ); 684 mView->viewManager(), SLOT( showMonthView() ) );
685 685
686 icon = loadPixmap( pathString + "todo" ); 686 icon = loadPixmap( pathString + "todo" );
687 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 687 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
688 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 688 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
689 todoview_action->addTo( viewMenu ); 689 todoview_action->addTo( viewMenu );
690 connect( todoview_action, SIGNAL( activated() ), 690 connect( todoview_action, SIGNAL( activated() ),
691 mView->viewManager(), SLOT( showTodoView() ) ); 691 mView->viewManager(), SLOT( showTodoView() ) );
692 692
693 icon = loadPixmap( pathString + "journal" ); 693 icon = loadPixmap( pathString + "journal" );
694 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 694 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
695 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 695 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
696 viewjournal_action->addTo( viewMenu ); 696 viewjournal_action->addTo( viewMenu );
697 connect( viewjournal_action, SIGNAL( activated() ), 697 connect( viewjournal_action, SIGNAL( activated() ),
698 mView->viewManager(), SLOT( showJournalView() ) ); 698 mView->viewManager(), SLOT( showJournalView() ) );
699 699
700 icon = loadPixmap( pathString + "xdays" ); 700 icon = loadPixmap( pathString + "xdays" );
701 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 701 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
702 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 702 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
703 xdays_action->addTo( viewMenu ); 703 xdays_action->addTo( viewMenu );
704 connect( xdays_action, SIGNAL( activated() ), 704 connect( xdays_action, SIGNAL( activated() ),
705 mView->viewManager(), SLOT( showNextXView() ) ); 705 mView->viewManager(), SLOT( showNextXView() ) );
706 706
707 icon = loadPixmap( pathString + "whatsnext" ); 707 icon = loadPixmap( pathString + "whatsnext" );
708 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 708 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
709 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 709 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
710 whatsnext_action->addTo( viewMenu ); 710 whatsnext_action->addTo( viewMenu );
711 connect( whatsnext_action, SIGNAL( activated() ), 711 connect( whatsnext_action, SIGNAL( activated() ),
712 mView->viewManager(), SLOT( showWhatsNextView() ) ); 712 mView->viewManager(), SLOT( showWhatsNextView() ) );
713 713
714#if 0 714#if 0
715 action = new QAction( "view_timespan", "Time Span", 0, this ); 715 action = new QAction( "view_timespan", "Time Span", 0, this );
716 action->addTo( viewMenu ); 716 action->addTo( viewMenu );
717 connect( action, SIGNAL( activated() ), 717 connect( action, SIGNAL( activated() ),
718 mView->viewManager(), SLOT( showTimeSpanView() ) ); 718 mView->viewManager(), SLOT( showTimeSpanView() ) );
719#endif 719#endif
720 720
721 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 721 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
722 this ); 722 this );
723 mNewSubTodoAction->addTo( actionMenu ); 723 mNewSubTodoAction->addTo( actionMenu );
724 connect( mNewSubTodoAction, SIGNAL( activated() ), 724 connect( mNewSubTodoAction, SIGNAL( activated() ),
725 mView, SLOT( newSubTodo() ) ); 725 mView, SLOT( newSubTodo() ) );
726 726
727 actionMenu->insertSeparator(); 727 actionMenu->insertSeparator();
728 728
729 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 729 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
730 mShowAction->addTo( actionMenu ); 730 mShowAction->addTo( actionMenu );
731 connect( mShowAction, SIGNAL( activated() ), 731 connect( mShowAction, SIGNAL( activated() ),
732 mView, SLOT( showIncidence() ) ); 732 mView, SLOT( showIncidence() ) );
733 733
734 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 734 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
735 mEditAction->addTo( actionMenu ); 735 mEditAction->addTo( actionMenu );
736 connect( mEditAction, SIGNAL( activated() ), 736 connect( mEditAction, SIGNAL( activated() ),
737 mView, SLOT( editIncidence() ) ); 737 mView, SLOT( editIncidence() ) );
738 738
739 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 739 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
740 mDeleteAction->addTo( actionMenu ); 740 mDeleteAction->addTo( actionMenu );
741 connect( mDeleteAction, SIGNAL( activated() ), 741 connect( mDeleteAction, SIGNAL( activated() ),
742 mView, SLOT( deleteIncidence() ) ); 742 mView, SLOT( deleteIncidence() ) );
743 743
744 744
745 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 745 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
746 mCloneAction->addTo( actionMenu ); 746 mCloneAction->addTo( actionMenu );
747 connect( mCloneAction, SIGNAL( activated() ), 747 connect( mCloneAction, SIGNAL( activated() ),
748 mView, SLOT( cloneIncidence() ) ); 748 mView, SLOT( cloneIncidence() ) );
749 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 749 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
750 mMoveAction->addTo( actionMenu ); 750 mMoveAction->addTo( actionMenu );
751 connect( mMoveAction, SIGNAL( activated() ), 751 connect( mMoveAction, SIGNAL( activated() ),
752 mView, SLOT( moveIncidence() ) ); 752 mView, SLOT( moveIncidence() ) );
753 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 753 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
754 mBeamAction->addTo( actionMenu ); 754 mBeamAction->addTo( actionMenu );
755 connect( mBeamAction, SIGNAL( activated() ), 755 connect( mBeamAction, SIGNAL( activated() ),
756 mView, SLOT( beamIncidence() ) ); 756 mView, SLOT( beamIncidence() ) );
757 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 757 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
758 mCancelAction->addTo( actionMenu ); 758 mCancelAction->addTo( actionMenu );
759 connect( mCancelAction, SIGNAL( activated() ), 759 connect( mCancelAction, SIGNAL( activated() ),
760 mView, SLOT( toggleCancelIncidence() ) ); 760 mView, SLOT( toggleCancelIncidence() ) );
761 761
762 actionMenu->insertSeparator(); 762 actionMenu->insertSeparator();
763 763
764 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 764 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
765 this ); 765 this );
766 action->addTo( actionMenu ); 766 action->addTo( actionMenu );
767 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 767 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
768 768
769 icon = loadPixmap( pathString + "search" ); 769 icon = loadPixmap( pathString + "search" );
770 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 770 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
771 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 771 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
772 search_action->addTo( actionMenu ); 772 search_action->addTo( actionMenu );
773 connect( search_action, SIGNAL( activated() ), 773 connect( search_action, SIGNAL( activated() ),
774 mView->dialogManager(), SLOT( showSearchDialog() ) ); 774 mView->dialogManager(), SLOT( showSearchDialog() ) );
775 775
776 776
777 777
778 if ( KOPrefs::instance()->mShowFullMenu ) { 778 if ( KOPrefs::instance()->mShowFullMenu ) {
779 actionMenu->insertSeparator(); 779 actionMenu->insertSeparator();
780 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 780 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
781 781
782 } 782 }
783 // actionMenu->insertSeparator(); 783 // actionMenu->insertSeparator();
784 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 784 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
785 this ); 785 this );
786 action->addTo( importMenu ); 786 action->addTo( importMenu );
787 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 787 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
788 action = new QAction( "import_quick", i18n("Import last file"), 0, 788 action = new QAction( "import_quick", i18n("Import last file"), 0,
789 this ); 789 this );
790 action->addTo( importMenu ); 790 action->addTo( importMenu );
791 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 791 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
792 importMenu->insertSeparator(); 792 importMenu->insertSeparator();
793 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 793 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
794 this ); 794 this );
795 action->addTo( importMenu ); 795 action->addTo( importMenu );
796 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 796 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
797#ifndef DESKTOP_VERSION 797#ifndef DESKTOP_VERSION
798 importMenu->insertSeparator(); 798 importMenu->insertSeparator();
799 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 799 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
800 this ); 800 this );
801 action->addTo( importMenu ); 801 action->addTo( importMenu );
802 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 802 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
803#else 803#else
804#ifdef _OL_IMPORT_ 804#ifdef _OL_IMPORT_
805 importMenu->insertSeparator(); 805 importMenu->insertSeparator();
806 action = new QAction( "import_ol", i18n("Import from OL"), 0, 806 action = new QAction( "import_ol", i18n("Import from OL"), 0,
807 this ); 807 this );
808 action->addTo( importMenu ); 808 action->addTo( importMenu );
809 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 809 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
810#endif 810#endif
811#endif 811#endif
812 812
813 importMenu->insertSeparator(); 813 importMenu->insertSeparator();
814 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 814 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
815 this ); 815 this );
816 action->addTo( importMenu ); 816 action->addTo( importMenu );
817 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 817 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
818 818
819 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 819 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
820 this ); 820 this );
821 action->addTo( importMenu ); 821 action->addTo( importMenu );
822 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 822 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
823 823
824 importMenu->insertSeparator(); 824 importMenu->insertSeparator();
825 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 825 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
826 this ); 826 this );
827 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 827 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
828 828
829 829
830 //LR 830 //LR
831 QPopupMenu *ex2phone = new QPopupMenu( this ); 831 QPopupMenu *ex2phone = new QPopupMenu( this );
832 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 832 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
833 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 833 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
834 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 834 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
835 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 835 importMenu->insertItem( i18n("Export to phone"), ex2phone );
836 836
837 importMenu->insertSeparator(); 837 importMenu->insertSeparator();
838 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 838 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
839 this ); 839 this );
840 action->addTo( importMenu ); 840 action->addTo( importMenu );
841 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 841 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
842#ifndef DESKTOP_VERSION 842#ifndef DESKTOP_VERSION
843 importMenu->insertSeparator(); 843 importMenu->insertSeparator();
844 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 844 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
845 this ); 845 this );
846 brAction->addTo( importMenu ); 846 brAction->addTo( importMenu );
847 brAction->setToggleAction (true ) ; 847 brAction->setToggleAction (true ) ;
848 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 848 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
849 849
850 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 850 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
851 this ); 851 this );
852 action->addTo( importMenu ); 852 action->addTo( importMenu );
853 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 853 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
854 854
855 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 855 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
856 this ); 856 this );
857 action->addTo( importMenu ); 857 action->addTo( importMenu );
858 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 858 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
859#else 859#else
860 importMenu->insertSeparator(); 860 importMenu->insertSeparator();
861 icon = loadPixmap( pathString + "print" ); 861 icon = loadPixmap( pathString + "print" );
862 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 862 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
863 action->addTo( importMenu ); 863 action->addTo( importMenu );
864 connect( action, SIGNAL( activated() ), 864 connect( action, SIGNAL( activated() ),
865 this, SLOT( printCal() ) ); 865 this, SLOT( printCal() ) );
866 866
867 icon = loadPixmap( pathString + "print" ); 867 icon = loadPixmap( pathString + "print" );
868 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 868 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
869 action->addTo( importMenu ); 869 action->addTo( importMenu );
870 connect( action, SIGNAL( activated() ), 870 connect( action, SIGNAL( activated() ),
871 this, SLOT( printSel() ) ); 871 this, SLOT( printSel() ) );
872 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 872 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
873 action->addTo( importMenu ); 873 action->addTo( importMenu );
874 connect( action, SIGNAL( activated() ), 874 connect( action, SIGNAL( activated() ),
875 mView->viewManager(), SIGNAL( printWNV() ) ); 875 mView->viewManager(), SIGNAL( printWNV() ) );
876#endif 876#endif
877 importMenu->insertSeparator(); 877 importMenu->insertSeparator();
878 action = new QAction( "beam all", i18n("Save"), 0, 878 action = new QAction( "beam all", i18n("Save"), 0,
879 this ); 879 this );
880 action->addTo( importMenu ); 880 action->addTo( importMenu );
881 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 881 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
882 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 882 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
883 this ); 883 this );
884 action->addTo( importMenu ); 884 action->addTo( importMenu );
885 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 885 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
886 886
887 //menuBar->insertItem( "Configure",configureMenu ); 887 //menuBar->insertItem( "Configure",configureMenu );
888 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 888 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
889 icon = loadPixmap( "korganizer/korganizer" ); 889 icon = loadPixmap( "korganizer/korganizer" );
890 890
891 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 891 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
892 action->addTo( helpMenu ); 892 action->addTo( helpMenu );
893 connect( action, SIGNAL( activated() ), 893 connect( action, SIGNAL( activated() ),
894 SLOT( whatsNew() ) ); 894 SLOT( whatsNew() ) );
895 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 895 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
896 action->addTo( helpMenu ); 896 action->addTo( helpMenu );
897 connect( action, SIGNAL( activated() ), 897 connect( action, SIGNAL( activated() ),
898 SLOT( features() ) ); 898 SLOT( features() ) );
899 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 899 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
900 action->addTo( helpMenu ); 900 action->addTo( helpMenu );
901 connect( action, SIGNAL( activated() ), 901 connect( action, SIGNAL( activated() ),
902 SLOT( keyBindings() ) ); 902 SLOT( keyBindings() ) );
903 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 903 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
904 action->addTo( helpMenu ); 904 action->addTo( helpMenu );
905 connect( action, SIGNAL( activated() ), 905 connect( action, SIGNAL( activated() ),
906 SLOT( synchowto() ) ); 906 SLOT( synchowto() ) );
907 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 907 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
908 action->addTo( helpMenu ); 908 action->addTo( helpMenu );
909 connect( action, SIGNAL( activated() ), 909 connect( action, SIGNAL( activated() ),
910 SLOT( kdesynchowto() ) ); 910 SLOT( kdesynchowto() ) );
911 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 911 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
912 action->addTo( helpMenu ); 912 action->addTo( helpMenu );
913 connect( action, SIGNAL( activated() ), 913 connect( action, SIGNAL( activated() ),
914 SLOT( multisynchowto() ) ); 914 SLOT( multisynchowto() ) );
915 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 915 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
916 action->addTo( helpMenu ); 916 action->addTo( helpMenu );
917 connect( action, SIGNAL( activated() ), 917 connect( action, SIGNAL( activated() ),
918 SLOT( aboutAutoSaving() ) ); 918 SLOT( aboutAutoSaving() ) );
919 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 919 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
920 action->addTo( helpMenu ); 920 action->addTo( helpMenu );
921 connect( action, SIGNAL( activated() ), 921 connect( action, SIGNAL( activated() ),
922 SLOT( aboutKnownBugs() ) ); 922 SLOT( aboutKnownBugs() ) );
923 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 923 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
924 action->addTo( helpMenu ); 924 action->addTo( helpMenu );
925 connect( action, SIGNAL( activated() ), 925 connect( action, SIGNAL( activated() ),
926 SLOT( usertrans() ) ); 926 SLOT( usertrans() ) );
927 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 927 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
928 action->addTo( helpMenu ); 928 action->addTo( helpMenu );
929 connect( action, SIGNAL( activated() ), 929 connect( action, SIGNAL( activated() ),
930 SLOT( faq() ) ); 930 SLOT( faq() ) );
931 action = new QAction( "licence", i18n("Licence..."), 0, this ); 931 action = new QAction( "licence", i18n("Licence..."), 0, this );
932 action->addTo( helpMenu ); 932 action->addTo( helpMenu );
933 connect( action, SIGNAL( activated() ), 933 connect( action, SIGNAL( activated() ),
934 SLOT( licence() ) ); 934 SLOT( licence() ) );
935 action = new QAction( "about", i18n("About..."), 0, this ); 935 action = new QAction( "about", i18n("About..."), 0, this );
936 action->addTo( helpMenu ); 936 action->addTo( helpMenu );
937 connect( action, SIGNAL( activated() ), 937 connect( action, SIGNAL( activated() ),
938 SLOT( about() ) ); 938 SLOT( about() ) );
939 //menuBar->insertSeparator(); 939 //menuBar->insertSeparator();
940 940
941 // ****************************************************** 941 // ******************************************************
942 // menubar icons 942 // menubar icons
943 943
944 944
945 iconToolBar->setHorizontalStretchable (true ); 945 iconToolBar->setHorizontalStretchable (true );
946 //menuBar->insertItem( iconToolBar ); 946 //menuBar->insertItem( iconToolBar );
947 //xdays_action 947 //xdays_action
948 if (p-> mShowIconNewEvent) 948 if (p-> mShowIconNewEvent)
949 ne_action->addTo( iconToolBar ); 949 ne_action->addTo( iconToolBar );
950 if (p->mShowIconNewTodo ) 950 if (p->mShowIconNewTodo )
951 nt_action->addTo( iconToolBar ); 951 nt_action->addTo( iconToolBar );
952 if (p-> mShowIconSearch) 952 if (p-> mShowIconSearch)
953 search_action->addTo( iconToolBar ); 953 search_action->addTo( iconToolBar );
954 if (p-> mShowIconNext) 954 if (p-> mShowIconNext)
955 whatsnext_action->addTo( iconToolBar ); 955 whatsnext_action->addTo( iconToolBar );
956 if (p-> mShowIconNextDays) 956 if (p-> mShowIconNextDays)
957 xdays_action->addTo( iconToolBar ); 957 xdays_action->addTo( iconToolBar );
958 if (p-> mShowIconList) 958 if (p-> mShowIconList)
959 showlist_action->addTo( iconToolBar ); 959 showlist_action->addTo( iconToolBar );
960 if (p-> mShowIconDay1) 960 if (p-> mShowIconDay1)
961 day1_action->addTo( iconToolBar ); 961 day1_action->addTo( iconToolBar );
962 if (p-> mShowIconDay5) 962 if (p-> mShowIconDay5)
963 day5_action->addTo( iconToolBar ); 963 day5_action->addTo( iconToolBar );
964 if (p-> mShowIconDay7) 964 if (p-> mShowIconDay7)
965 day7_action->addTo( iconToolBar ); 965 day7_action->addTo( iconToolBar );
966 if (p-> mShowIconMonth) 966 if (p-> mShowIconMonth)
967 month_action->addTo( iconToolBar ); 967 month_action->addTo( iconToolBar );
968 if (p-> mShowIconTodoview) 968 if (p-> mShowIconTodoview)
969 todoview_action->addTo( iconToolBar ); 969 todoview_action->addTo( iconToolBar );
970 if (p-> mShowIconJournal) 970 if (p-> mShowIconJournal)
971 viewjournal_action->addTo( iconToolBar ); 971 viewjournal_action->addTo( iconToolBar );
972 icon = loadPixmap( pathString + "2leftarrowB" ); 972 icon = loadPixmap( pathString + "2leftarrowB" );
973 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 973 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
974 if (p-> mShowIconBackFast) { 974 if (p-> mShowIconBackFast) {
975 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 975 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
976 connect( action, SIGNAL( activated() ), 976 connect( action, SIGNAL( activated() ),
977 mView, SLOT( goPreviousMonth() ) ); 977 mView, SLOT( goPreviousMonth() ) );
978 action->addTo( iconToolBar ); 978 action->addTo( iconToolBar );
979 } 979 }
980 icon = loadPixmap( pathString + "1leftarrowB" ); 980 icon = loadPixmap( pathString + "1leftarrowB" );
981 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 981 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
982 if (p-> mShowIconBack) { 982 if (p-> mShowIconBack) {
983 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 983 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
984 connect( action, SIGNAL( activated() ), 984 connect( action, SIGNAL( activated() ),
985 mView, SLOT( goPrevious() ) ); 985 mView, SLOT( goPrevious() ) );
986 action->addTo( iconToolBar ); 986 action->addTo( iconToolBar );
987 } 987 }
988 icon = loadPixmap( pathString + "today" ); 988 icon = loadPixmap( pathString + "today" );
989 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 989 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
990 if (p-> mShowIconToday) 990 if (p-> mShowIconToday)
991 today_action->addTo( iconToolBar ); 991 today_action->addTo( iconToolBar );
992 icon = loadPixmap( pathString + "1rightarrowB" ); 992 icon = loadPixmap( pathString + "1rightarrowB" );
993 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 993 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
994 if (p-> mShowIconForward) { 994 if (p-> mShowIconForward) {
995 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 995 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
996 connect( action, SIGNAL( activated() ), 996 connect( action, SIGNAL( activated() ),
997 mView, SLOT( goNext() ) ); 997 mView, SLOT( goNext() ) );
998 action->addTo( iconToolBar ); 998 action->addTo( iconToolBar );
999 } 999 }
1000 icon = loadPixmap( pathString + "2rightarrowB" ); 1000 icon = loadPixmap( pathString + "2rightarrowB" );
1001 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1001 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1002 if (p-> mShowIconForwardFast) { 1002 if (p-> mShowIconForwardFast) {
1003 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1003 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1004 connect( action, SIGNAL( activated() ), 1004 connect( action, SIGNAL( activated() ),
1005 mView, SLOT( goNextMonth() ) ); 1005 mView, SLOT( goNextMonth() ) );
1006 action->addTo( iconToolBar ); 1006 action->addTo( iconToolBar );
1007 } 1007 }
1008 1008
1009 1009
1010 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1010 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1011 1011
1012 if (p-> mShowIconNewEvent) 1012 if (p-> mShowIconNewEvent)
1013 configureToolBarMenu->setItemChecked( 10, true ); 1013 configureToolBarMenu->setItemChecked( 10, true );
1014 if (p->mShowIconNewTodo ) 1014 if (p->mShowIconNewTodo )
1015 configureToolBarMenu->setItemChecked( 20, true ); 1015 configureToolBarMenu->setItemChecked( 20, true );
1016 if (p-> mShowIconSearch) 1016 if (p-> mShowIconSearch)
1017 configureToolBarMenu->setItemChecked( 120, true ); 1017 configureToolBarMenu->setItemChecked( 120, true );
1018 if (p-> mShowIconList) 1018 if (p-> mShowIconList)
1019 configureToolBarMenu->setItemChecked( 30, true ); 1019 configureToolBarMenu->setItemChecked( 30, true );
1020 if (p-> mShowIconDay1) 1020 if (p-> mShowIconDay1)
1021 configureToolBarMenu->setItemChecked( 40, true ); 1021 configureToolBarMenu->setItemChecked( 40, true );
1022 if (p-> mShowIconDay5) 1022 if (p-> mShowIconDay5)
1023 configureToolBarMenu->setItemChecked( 50, true ); 1023 configureToolBarMenu->setItemChecked( 50, true );
1024 if (p-> mShowIconDay7) 1024 if (p-> mShowIconDay7)
1025 configureToolBarMenu->setItemChecked( 60, true ); 1025 configureToolBarMenu->setItemChecked( 60, true );
1026 if (p-> mShowIconMonth) 1026 if (p-> mShowIconMonth)
1027 configureToolBarMenu->setItemChecked( 70, true ); 1027 configureToolBarMenu->setItemChecked( 70, true );
1028 if (p-> mShowIconTodoview) 1028 if (p-> mShowIconTodoview)
1029 configureToolBarMenu->setItemChecked( 80, true ); 1029 configureToolBarMenu->setItemChecked( 80, true );
1030 if (p-> mShowIconBackFast) 1030 if (p-> mShowIconBackFast)
1031 configureToolBarMenu->setItemChecked( 200, true ); 1031 configureToolBarMenu->setItemChecked( 200, true );
1032 if (p-> mShowIconBack) 1032 if (p-> mShowIconBack)
1033 configureToolBarMenu->setItemChecked( 210, true ); 1033 configureToolBarMenu->setItemChecked( 210, true );
1034 if (p-> mShowIconToday) 1034 if (p-> mShowIconToday)
1035 configureToolBarMenu->setItemChecked( 130, true ); 1035 configureToolBarMenu->setItemChecked( 130, true );
1036 if (p-> mShowIconForward) 1036 if (p-> mShowIconForward)
1037 configureToolBarMenu->setItemChecked( 220, true ); 1037 configureToolBarMenu->setItemChecked( 220, true );
1038 if (p-> mShowIconForwardFast) 1038 if (p-> mShowIconForwardFast)
1039 configureToolBarMenu->setItemChecked( 230, true ); 1039 configureToolBarMenu->setItemChecked( 230, true );
1040 if (p-> mShowIconNextDays) 1040 if (p-> mShowIconNextDays)
1041 configureToolBarMenu->setItemChecked( 100, true ); 1041 configureToolBarMenu->setItemChecked( 100, true );
1042 if (p-> mShowIconNext) 1042 if (p-> mShowIconNext)
1043 configureToolBarMenu->setItemChecked( 110, true ); 1043 configureToolBarMenu->setItemChecked( 110, true );
1044 if (p-> mShowIconJournal) 1044 if (p-> mShowIconJournal)
1045 configureToolBarMenu->setItemChecked( 90, true ); 1045 configureToolBarMenu->setItemChecked( 90, true );
1046 if (p-> mShowIconWhatsThis) 1046 if (p-> mShowIconWhatsThis)
1047 configureToolBarMenu->setItemChecked( 300, true ); 1047 configureToolBarMenu->setItemChecked( 300, true );
1048 1048
1049 QLabel* dummy = new QLabel( iconToolBar ); 1049 QLabel* dummy = new QLabel( iconToolBar );
1050 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1050 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1051 if (!p-> mShowIconStretch) 1051 if (!p-> mShowIconStretch)
1052 iconToolBar->setStretchableWidget ( dummy ) ; 1052 iconToolBar->setStretchableWidget ( dummy ) ;
1053 else 1053 else
1054 configureToolBarMenu->setItemChecked( 5, true ); 1054 configureToolBarMenu->setItemChecked( 5, true );
1055 if (p-> mShowIconWhatsThis) 1055 if (p-> mShowIconWhatsThis)
1056 QWhatsThis::whatsThisButton ( iconToolBar ); 1056 QWhatsThis::whatsThisButton ( iconToolBar );
1057 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1057 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1058 configureAgenda( p->mHourSize ); 1058 configureAgenda( p->mHourSize );
1059 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1059 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1060} 1060}
1061 1061
1062void MainWindow::exportToPhone( int mode ) 1062void MainWindow::exportToPhone( int mode )
1063{ 1063{
1064 1064
1065 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1065 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1066 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1066 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1067 KOex2phonePrefs ex2phone; 1067 KOex2phonePrefs ex2phone;
1068 1068
1069 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1069 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1070 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1070 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1071 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1071 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1072 if ( mode == 1 ) 1072 if ( mode == 1 )
1073 ex2phone.setCaption(i18n("Export complete calendar")); 1073 ex2phone.setCaption(i18n("Export complete calendar"));
1074 if ( mode == 2 ) 1074 if ( mode == 2 )
1075 ex2phone.setCaption(i18n("Export filtered calendar")); 1075 ex2phone.setCaption(i18n("Export filtered calendar"));
1076 1076
1077 if ( !ex2phone.exec() ) { 1077 if ( !ex2phone.exec() ) {
1078 return; 1078 return;
1079 } 1079 }
1080 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1080 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1081 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1081 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1082 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1082 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1083 1083
1084 int inFuture = 0; 1084 int inFuture = 0;
1085 if ( ex2phone.mWriteBackFuture->isChecked() ) 1085 if ( ex2phone.mWriteBackFuture->isChecked() )
1086 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1086 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1087 QPtrList<Incidence> delSel; 1087 QPtrList<Incidence> delSel;
1088 if ( mode == 1 ) 1088 if ( mode == 1 )
1089 delSel = mCalendar->rawIncidences(); 1089 delSel = mCalendar->rawIncidences();
1090 if ( mode == 2 ) 1090 if ( mode == 2 )
1091 delSel = mCalendar->incidences(); 1091 delSel = mCalendar->incidences();
1092 CalendarLocal* cal = new CalendarLocal(); 1092 CalendarLocal* cal = new CalendarLocal();
1093 cal->setLocalTime(); 1093 cal->setLocalTime();
1094 Incidence *incidence = delSel.first(); 1094 Incidence *incidence = delSel.first();
1095 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1095 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1096 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1096 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1097 while ( incidence ) { 1097 while ( incidence ) {
1098 if ( incidence->type() != "Journal" ) { 1098 if ( incidence->type() != "Journal" ) {
1099 bool add = true; 1099 bool add = true;
1100 if ( inFuture ) { 1100 if ( inFuture ) {
1101 QDateTime dt; 1101 QDateTime dt;
1102 if ( incidence->type() == "Todo" ) { 1102 if ( incidence->type() == "Todo" ) {
1103 Todo * t = (Todo*)incidence; 1103 Todo * t = (Todo*)incidence;
1104 if ( t->hasDueDate() ) 1104 if ( t->hasDueDate() )
1105 dt = t->dtDue(); 1105 dt = t->dtDue();
1106 else 1106 else
1107 dt = cur.addSecs( 62 ); 1107 dt = cur.addSecs( 62 );
1108 } 1108 }
1109 else { 1109 else {
1110 bool ok; 1110 bool ok;
1111 dt = incidence->getNextOccurence( cur, &ok ); 1111 dt = incidence->getNextOccurence( cur, &ok );
1112 if ( !ok ) 1112 if ( !ok )
1113 dt = cur.addSecs( -62 ); 1113 dt = cur.addSecs( -62 );
1114 } 1114 }
1115 if ( dt < cur || dt > end ) { 1115 if ( dt < cur || dt > end ) {
1116 add = false; 1116 add = false;
1117 } 1117 }
1118 } 1118 }
1119 if ( add ) { 1119 if ( add ) {
1120 Incidence *in = incidence->clone(); 1120 Incidence *in = incidence->clone();
1121 cal->addIncidence( in ); 1121 cal->addIncidence( in );
1122 } 1122 }
1123 } 1123 }
1124 incidence = delSel.next(); 1124 incidence = delSel.next();
1125 } 1125 }
1126 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1126 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1127 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1127 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1128 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1128 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1129 1129
1130 setCaption( i18n("Writing to phone...")); 1130 setCaption( i18n("Writing to phone..."));
1131 if ( PhoneFormat::writeToPhone( cal ) ) 1131 if ( PhoneFormat::writeToPhone( cal ) )
1132 setCaption( i18n("Export to phone successful!")); 1132 setCaption( i18n("Export to phone successful!"));
1133 else 1133 else
1134 setCaption( i18n("Error exporting to phone!")); 1134 setCaption( i18n("Error exporting to phone!"));
1135 delete cal; 1135 delete cal;
1136} 1136}
1137 1137
1138 1138
1139void MainWindow::setDefaultPreferences() 1139void MainWindow::setDefaultPreferences()
1140{ 1140{
1141 KOPrefs *p = KOPrefs::instance(); 1141 KOPrefs *p = KOPrefs::instance();
1142 1142
1143 p->mCompactDialogs = true; 1143 p->mCompactDialogs = true;
1144 p->mConfirm = true; 1144 p->mConfirm = true;
1145 // p->mEnableQuickTodo = false; 1145 // p->mEnableQuickTodo = false;
1146 1146
1147} 1147}
1148 1148
1149QString MainWindow::resourcePath() 1149QString MainWindow::resourcePath()
1150{ 1150{
1151 return KGlobal::iconLoader()->iconPath(); 1151 return KGlobal::iconLoader()->iconPath();
1152} 1152}
1153 1153
1154void MainWindow::displayText( QString text ,QString cap ) 1154void MainWindow::displayText( QString text ,QString cap )
1155{ 1155{
1156 QDialog dia( this, "name", true ); ; 1156 QDialog dia( this, "name", true ); ;
1157 dia.setCaption( cap ); 1157 dia.setCaption( cap );
1158 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1158 QVBoxLayout* lay = new QVBoxLayout( &dia );
1159 lay->setSpacing( 3 ); 1159 lay->setSpacing( 3 );
1160 lay->setMargin( 3 ); 1160 lay->setMargin( 3 );
1161 QTextBrowser tb ( &dia ); 1161 QTextBrowser tb ( &dia );
1162 lay->addWidget( &tb ); 1162 lay->addWidget( &tb );
1163 tb.setText( text ); 1163 tb.setText( text );
1164#ifdef DESKTOP_VERSION 1164#ifdef DESKTOP_VERSION
1165 dia.resize( 640, 480); 1165 dia.resize( 640, 480);
1166#else 1166#else
1167 dia.showMaximized(); 1167 dia.showMaximized();
1168#endif 1168#endif
1169 dia.exec(); 1169 dia.exec();
1170} 1170}
1171 1171
1172void MainWindow::features() 1172void MainWindow::features()
1173{ 1173{
1174 1174
1175 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1175 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1176} 1176}
1177 1177
1178void MainWindow::usertrans() 1178void MainWindow::usertrans()
1179{ 1179{
1180 1180
1181 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1181 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1182} 1182}
1183 1183
1184void MainWindow::kdesynchowto() 1184void MainWindow::kdesynchowto()
1185{ 1185{
1186 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1186 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1187} 1187}
1188void MainWindow::multisynchowto() 1188void MainWindow::multisynchowto()
1189{ 1189{
1190 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1190 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1191} 1191}
1192void MainWindow::synchowto() 1192void MainWindow::synchowto()
1193{ 1193{
1194 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1194 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1195} 1195}
1196void MainWindow::faq() 1196void MainWindow::faq()
1197{ 1197{
1198 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1198 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1199 1199
1200} 1200}
1201void MainWindow::whatsNew() 1201void MainWindow::whatsNew()
1202{ 1202{
1203 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1203 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1204 1204
1205} 1205}
1206void MainWindow::licence() 1206void MainWindow::licence()
1207{ 1207{
1208 KApplication::showLicence(); 1208 KApplication::showLicence();
1209 1209
1210} 1210}
1211void MainWindow::about() 1211void MainWindow::about()
1212{ 1212{
1213 QString version; 1213 QString version;
1214#include <../version> 1214#include <../version>
1215 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1215 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1216 i18n("KOrganizer/Platform-independent\n") + 1216 i18n("KOrganizer/Platform-independent\n") +
1217 "(KO/Pi) " + version + " - " + 1217 "(KO/Pi) " + version + " - " +
1218 1218
1219#ifdef DESKTOP_VERSION 1219#ifdef DESKTOP_VERSION
1220 i18n("Desktop Edition\n") + 1220 i18n("Desktop Edition\n") +
1221#else 1221#else
1222 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1222 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1223#endif 1223#endif
1224 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") ); 1224 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") );
1225} 1225}
1226void MainWindow::keyBindings() 1226void MainWindow::keyBindings()
1227{ 1227{
1228 QString cap = i18n("KO/Pi Keys + Colors"); 1228 QString cap = i18n("KO/Pi Keys + Colors");
1229 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1229 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1230 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1230 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1231 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1231 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1232 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1232 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1233 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1233 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1234 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1234 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1235 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1235 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1236 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1236 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1237 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1237 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1238 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1238 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1239 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1239 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1240 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1240 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1241 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1241 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1242 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1242 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1243 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1243 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1244 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1244 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1245 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1245 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1246 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1246 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1247 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1247 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1248 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1248 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1249 i18n("<p><h3>In agenda view:</h3></p>\n") + 1249 i18n("<p><h3>In agenda view:</h3></p>\n") +
1250 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1250 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1251 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1251 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1252 i18n("<p><h3>In todo view:</h3></p>\n") + 1252 i18n("<p><h3>In todo view:</h3></p>\n") +
1253 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1253 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1254 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1254 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1255 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1255 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1256 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1256 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1257 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1257 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1258 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1258 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1259 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1259 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1260 i18n("<p><h3>In list view:</h3></p>\n") + 1260 i18n("<p><h3>In list view:</h3></p>\n") +
1261 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1261 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1262 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1262 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1263 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1263 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1264 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1264 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1265 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1265 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1266 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1266 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1267 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1267 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1268 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1268 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1269 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1269 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1270 i18n("<p><b>E</b>: Edit item</p>\n") + 1270 i18n("<p><b>E</b>: Edit item</p>\n") +
1271 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1271 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1272 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1272 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1273 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1273 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1274 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1274 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1275 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1275 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1276 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1276 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1277 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1277 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1278 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1278 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1279 i18n("<p><b>White</b>: Item readonly</p>\n"); 1279 i18n("<p><b>White</b>: Item readonly</p>\n");
1280 displayText( text, cap); 1280 displayText( text, cap);
1281} 1281}
1282void MainWindow::aboutAutoSaving() 1282void MainWindow::aboutAutoSaving()
1283{ 1283{
1284 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"); 1284 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");
1285 1285
1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1287 1287
1288} 1288}
1289void MainWindow::aboutKnownBugs() 1289void MainWindow::aboutKnownBugs()
1290{ 1290{
1291 QMessageBox* msg; 1291 QMessageBox* msg;
1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1293 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")+ 1293 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")+
1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1296 i18n("\nor report them in the bugtracker on\n") + 1296 i18n("\nor report them in the bugtracker on\n") +
1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1298 QMessageBox::NoIcon, 1298 QMessageBox::NoIcon,
1299 QMessageBox::Ok, 1299 QMessageBox::Ok,
1300 QMessageBox::NoButton, 1300 QMessageBox::NoButton,
1301 QMessageBox::NoButton); 1301 QMessageBox::NoButton);
1302 msg->exec(); 1302 msg->exec();
1303 delete msg; 1303 delete msg;
1304 1304
1305} 1305}
1306 1306
1307QString MainWindow::defaultFileName() 1307QString MainWindow::defaultFileName()
1308{ 1308{
1309 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1309 return locateLocal( "data", "korganizer/mycalendar.ics" );
1310} 1310}
1311QString MainWindow::syncFileName() 1311QString MainWindow::syncFileName()
1312{ 1312{
1313#ifdef DESKTOP_VERSION 1313#ifdef DESKTOP_VERSION
1314 return locateLocal( "tmp", "synccalendar.ics" ); 1314 return locateLocal( "tmp", "synccalendar.ics" );
1315#else 1315#else
1316 return QString( "/tmp/synccalendar.ics" ); 1316 return QString( "/tmp/synccalendar.ics" );
1317#endif 1317#endif
1318} 1318}
1319 1319
1320void MainWindow::processIncidenceSelection( Incidence *incidence ) 1320void MainWindow::processIncidenceSelection( Incidence *incidence )
1321{ 1321{
1322 if ( !incidence ) { 1322 if ( !incidence ) {
1323 enableIncidenceActions( false ); 1323 enableIncidenceActions( false );
1324 1324
1325 mNewSubTodoAction->setEnabled( false ); 1325 mNewSubTodoAction->setEnabled( false );
1326 setCaptionToDates(); 1326 setCaptionToDates();
1327 return; 1327 return;
1328 1328
1329 } 1329 }
1330 1330
1331 //KGlobal::locale()->formatDateTime(nextA, true); 1331 //KGlobal::locale()->formatDateTime(nextA, true);
1332 QString startString = ""; 1332 QString startString = "";
1333 if ( incidence->type() != "Todo" ) { 1333 if ( incidence->type() != "Todo" ) {
1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1335 if ( incidence->doesFloat() ) { 1335 if ( incidence->doesFloat() ) {
1336 startString += ": "+incidence->dtStartDateStr( true ); 1336 startString += ": "+incidence->dtStartDateStr( true );
1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1338 1338
1339 } else { 1339 } else {
1340 startString = ": "+incidence->dtStartStr(true); 1340 startString = ": "+incidence->dtStartStr(true);
1341 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1341 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1342 1342
1343 } 1343 }
1344 1344
1345 } else { 1345 } else {
1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1349 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1349 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1350 bool ok; 1350 bool ok;
1351 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1351 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1352 if ( ok ) { 1352 if ( ok ) {
1353 int years = noc.date().year() - incidence->dtStart().date().year(); 1353 int years = noc.date().year() - incidence->dtStart().date().year();
1354 startString += i18n(" (%1 y.)"). arg( years ); 1354 startString += i18n(" (%1 y.)"). arg( years );
1355 } 1355 }
1356 } 1356 }
1357 else 1357 else
1358 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1358 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1359 } 1359 }
1360 1360
1361 } 1361 }
1362 else 1362 else
1363 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1363 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1364 if ( !incidence->location().isEmpty() ) 1364 if ( !incidence->location().isEmpty() )
1365 startString += " (" +incidence->location()+")"; 1365 startString += " (" +incidence->location()+")";
1366 setCaption( incidence->summary()+startString); 1366 setCaption( incidence->summary()+startString);
1367 1367
1368 enableIncidenceActions( true ); 1368 enableIncidenceActions( true );
1369 1369
1370 if ( incidence->type() == "Event" ) { 1370 if ( incidence->type() == "Event" ) {
1371 mShowAction->setText( i18n("Show Event...") ); 1371 mShowAction->setText( i18n("Show Event...") );
1372 mEditAction->setText( i18n("Edit Event...") ); 1372 mEditAction->setText( i18n("Edit Event...") );
1373 mDeleteAction->setText( i18n("Delete Event...") ); 1373 mDeleteAction->setText( i18n("Delete Event...") );
1374 1374
1375 mNewSubTodoAction->setEnabled( false ); 1375 mNewSubTodoAction->setEnabled( false );
1376 } else if ( incidence->type() == "Todo" ) { 1376 } else if ( incidence->type() == "Todo" ) {
1377 mShowAction->setText( i18n("Show Todo...") ); 1377 mShowAction->setText( i18n("Show Todo...") );
1378 mEditAction->setText( i18n("Edit Todo...") ); 1378 mEditAction->setText( i18n("Edit Todo...") );
1379 mDeleteAction->setText( i18n("Delete Todo...") ); 1379 mDeleteAction->setText( i18n("Delete Todo...") );
1380 1380
1381 mNewSubTodoAction->setEnabled( true ); 1381 mNewSubTodoAction->setEnabled( true );
1382 } else { 1382 } else {
1383 mShowAction->setText( i18n("Show...") ); 1383 mShowAction->setText( i18n("Show...") );
1384 mShowAction->setText( i18n("Edit...") ); 1384 mShowAction->setText( i18n("Edit...") );
1385 mShowAction->setText( i18n("Delete...") ); 1385 mShowAction->setText( i18n("Delete...") );
1386 1386
1387 mNewSubTodoAction->setEnabled( false ); 1387 mNewSubTodoAction->setEnabled( false );
1388 } 1388 }
1389} 1389}
1390 1390
1391void MainWindow::enableIncidenceActions( bool enabled ) 1391void MainWindow::enableIncidenceActions( bool enabled )
1392{ 1392{
1393 mShowAction->setEnabled( enabled ); 1393 mShowAction->setEnabled( enabled );
1394 mEditAction->setEnabled( enabled ); 1394 mEditAction->setEnabled( enabled );
1395 mDeleteAction->setEnabled( enabled ); 1395 mDeleteAction->setEnabled( enabled );
1396 1396
1397 mCloneAction->setEnabled( enabled ); 1397 mCloneAction->setEnabled( enabled );
1398 mMoveAction->setEnabled( enabled ); 1398 mMoveAction->setEnabled( enabled );
1399 mBeamAction->setEnabled( enabled ); 1399 mBeamAction->setEnabled( enabled );
1400 mCancelAction->setEnabled( enabled ); 1400 mCancelAction->setEnabled( enabled );
1401} 1401}
1402 1402
1403void MainWindow::importOL() 1403void MainWindow::importOL()
1404{ 1404{
1405#ifdef _OL_IMPORT_ 1405#ifdef _OL_IMPORT_
1406 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1406 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1407 id->exec(); 1407 id->exec();
1408 delete id; 1408 delete id;
1409 mView->updateView(); 1409 mView->updateView();
1410#endif 1410#endif
1411} 1411}
1412void MainWindow::importBday() 1412void MainWindow::importBday()
1413{ 1413{
1414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1415 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1415 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1416 i18n("Import!"), i18n("Cancel"), 0, 1416 i18n("Import!"), i18n("Cancel"), 0,
1417 0, 1 ); 1417 0, 1 );
1418 if ( result == 0 ) { 1418 if ( result == 0 ) {
1419 mView->importBday(); 1419 mView->importBday();
1420 1420
1421 } 1421 }
1422 1422
1423 1423
1424} 1424}
1425void MainWindow::importQtopia() 1425void MainWindow::importQtopia()
1426{ 1426{
1427#ifndef DESKTOP_VERSION 1427#ifndef DESKTOP_VERSION
1428 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1428 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1429 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"), 1429 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"),
1430 i18n("Import!"), i18n("Cancel"), 0, 1430 i18n("Import!"), i18n("Cancel"), 0,
1431 0, 1 ); 1431 0, 1 );
1432 if ( result == 0 ) { 1432 if ( result == 0 ) {
1433 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1433 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1434 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1434 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1435 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1435 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1436 mView->importQtopia( categories, datebook, todolist ); 1436 mView->importQtopia( categories, datebook, todolist );
1437 } 1437 }
1438#else 1438#else
1439 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1439 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1440 i18n("Not supported \non desktop!\n"), 1440 i18n("Not supported \non desktop!\n"),
1441 i18n("Ok"), i18n("Cancel"), 0, 1441 i18n("Ok"), i18n("Cancel"), 0,
1442 0, 1 ); 1442 0, 1 );
1443 1443
1444#endif 1444#endif
1445} 1445}
1446 1446
1447void MainWindow::saveOnClose() 1447void MainWindow::saveOnClose()
1448{ 1448{
1449 KOPrefs *p = KOPrefs::instance(); 1449 KOPrefs *p = KOPrefs::instance();
1450 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1450 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1451 p->mToolBarUp = iconToolBar->x() > width()/2 || 1451 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1452 iconToolBar->y() > height()/2; 1452 iconToolBar->y() > height()/2;
1453 mView->writeSettings(); 1453 mView->writeSettings();
1454 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1454 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1455 save(); 1455 save();
1456} 1456}
1457void MainWindow::slotModifiedChanged( bool changed ) 1457void MainWindow::slotModifiedChanged( bool changed )
1458{ 1458{
1459 if ( mBlockAtStartup ) 1459 if ( mBlockAtStartup )
1460 return; 1460 return;
1461 1461
1462 int msec; 1462 int msec;
1463 // we store the changes after 1 minute, 1463 // we store the changes after 1 minute,
1464 // and for safety reasons after 10 minutes again 1464 // and for safety reasons after 10 minutes again
1465 if ( !mSyncManager->blockSave() ) 1465 if ( !mSyncManager->blockSave() )
1466 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1466 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1467 else 1467 else
1468 msec = 1000 * 600; 1468 msec = 1000 * 600;
1469 mSaveTimer.start( msec, true ); // 1 minute 1469 mSaveTimer.start( msec, true ); // 1 minute
1470 qDebug("KO: Saving File in %d secs!", msec/1000); 1470 qDebug("KO: Saving File in %d secs!", msec/1000);
1471 mCalendarModifiedFlag = true; 1471 mCalendarModifiedFlag = true;
1472} 1472}
1473void MainWindow::saveStopTimer() 1473void MainWindow::saveStopTimer()
1474{ 1474{
1475 mSaveTimer.stop(); 1475 mSaveTimer.stop();
1476 if (mSaveTimer.isActive() ) 1476 if (mSaveTimer.isActive() )
1477 qDebug("ti active "); 1477 qDebug("ti active ");
1478 else 1478 else
1479 qDebug("KO: Save timer stopped"); 1479 qDebug("KO: Save timer stopped");
1480} 1480}
1481void MainWindow::save() 1481void MainWindow::save()
1482{ 1482{
1483 if ( !mCalendarModifiedFlag ) { 1483 if ( !mCalendarModifiedFlag ) {
1484 qDebug("KO: Calendar not modified. Nothing saved."); 1484 qDebug("KO: Calendar not modified. Nothing saved.");
1485 return; 1485 return;
1486 } 1486 }
1487 if ( mSyncManager->blockSave() ) 1487 if ( mSyncManager->blockSave() )
1488 return; 1488 return;
1489 mSyncManager->setBlockSave(true); 1489 mSyncManager->setBlockSave(true);
1490 if ( mView->checkFileVersion( defaultFileName()) ) { 1490 if ( mView->checkFileVersion( defaultFileName()) ) {
1491 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1491 QTime neededSaveTime = QDateTime::currentDateTime().time();
1492 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1492 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1493 qDebug("KO: Start saving data to file!"); 1493 qDebug("KO: Start saving data to file!");
1494 mView->saveCalendar( defaultFileName() ); 1494 mView->saveCalendar( defaultFileName() );
1495 mCalendarModifiedFlag = false; 1495 mCalendarModifiedFlag = false;
1496 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1496 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1497 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1497 qDebug("KO: Needed %d ms for saving.",msNeeded );
1498 QString savemes; 1498 QString savemes;
1499 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1499 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1500 setCaption(savemes); 1500 setCaption(savemes);
1501 } else 1501 } else
1502 setCaption(i18n("Saving cancelled!")); 1502 setCaption(i18n("Saving cancelled!"));
1503 mSyncManager->setBlockSave( false ); 1503 mSyncManager->setBlockSave( false );
1504} 1504}
1505 1505
1506void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1506void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1507{ 1507{
1508 if ( !e->isAutoRepeat() ) { 1508 if ( !e->isAutoRepeat() ) {
1509 mFlagKeyPressed = false; 1509 mFlagKeyPressed = false;
1510 } 1510 }
1511} 1511}
1512void MainWindow::keyPressEvent ( QKeyEvent * e ) 1512void MainWindow::keyPressEvent ( QKeyEvent * e )
1513{ 1513{
1514 qApp->processEvents(); 1514 qApp->processEvents();
1515 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1515 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1516 e->ignore(); 1516 e->ignore();
1517 // qDebug(" ignore %d",e->isAutoRepeat() ); 1517 // qDebug(" ignore %d",e->isAutoRepeat() );
1518 return; 1518 return;
1519 } 1519 }
1520 if (! e->isAutoRepeat() ) 1520 if (! e->isAutoRepeat() )
1521 mFlagKeyPressed = true; 1521 mFlagKeyPressed = true;
1522 KOPrefs *p = KOPrefs::instance(); 1522 KOPrefs *p = KOPrefs::instance();
1523 bool showSelectedDates = false; 1523 bool showSelectedDates = false;
1524 int size; 1524 int size;
1525 int pro = 0; 1525 int pro = 0;
1526 //qDebug("MainWindow::keyPressEvent "); 1526 //qDebug("MainWindow::keyPressEvent ");
1527 switch ( e->key() ) { 1527 switch ( e->key() ) {
1528 case Qt::Key_Right: 1528 case Qt::Key_Right:
1529 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1529 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1530 mView->goNextMonth(); 1530 mView->goNextMonth();
1531 else 1531 else
1532 mView->goNext(); 1532 mView->goNext();
1533 showSelectedDates = true; 1533 showSelectedDates = true;
1534 break; 1534 break;
1535 case Qt::Key_Left: 1535 case Qt::Key_Left:
1536 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1536 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1537 mView->goPreviousMonth(); 1537 mView->goPreviousMonth();
1538 else 1538 else
1539 mView->goPrevious(); 1539 mView->goPrevious();
1540 showSelectedDates = true; 1540 showSelectedDates = true;
1541 break; 1541 break;
1542 case Qt::Key_Down: 1542 case Qt::Key_Down:
1543 mView->viewManager()->agendaView()->scrollOneHourDown(); 1543 mView->viewManager()->agendaView()->scrollOneHourDown();
1544 break; 1544 break;
1545 case Qt::Key_Up: 1545 case Qt::Key_Up:
1546 mView->viewManager()->agendaView()->scrollOneHourUp(); 1546 mView->viewManager()->agendaView()->scrollOneHourUp();
1547 break; 1547 break;
1548 case Qt::Key_I: 1548 case Qt::Key_I:
1549 mView->showIncidence(); 1549 mView->showIncidence();
1550 break; 1550 break;
1551 case Qt::Key_Delete: 1551 case Qt::Key_Delete:
1552 case Qt::Key_Backspace: 1552 case Qt::Key_Backspace:
1553 mView->deleteIncidence(); 1553 mView->deleteIncidence();
1554 break; 1554 break;
1555 case Qt::Key_D: 1555 case Qt::Key_D:
1556 mView->viewManager()->showDayView(); 1556 mView->viewManager()->showDayView();
1557 showSelectedDates = true; 1557 showSelectedDates = true;
1558 break; 1558 break;
1559 case Qt::Key_O: 1559 case Qt::Key_O:
1560 mView->toggleFilerEnabled( ); 1560 mView->toggleFilerEnabled( );
1561 break; 1561 break;
1562 case Qt::Key_0: 1562 case Qt::Key_0:
1563 case Qt::Key_1: 1563 case Qt::Key_1:
1564 case Qt::Key_2: 1564 case Qt::Key_2:
1565 case Qt::Key_3: 1565 case Qt::Key_3:
1566 case Qt::Key_4: 1566 case Qt::Key_4:
1567 case Qt::Key_5: 1567 case Qt::Key_5:
1568 case Qt::Key_6: 1568 case Qt::Key_6:
1569 case Qt::Key_7: 1569 case Qt::Key_7:
1570 case Qt::Key_8: 1570 case Qt::Key_8:
1571 case Qt::Key_9: 1571 case Qt::Key_9:
1572 pro = e->key()-48; 1572 pro = e->key()-48;
1573 if ( pro == 0 ) 1573 if ( pro == 0 )
1574 pro = 10; 1574 pro = 10;
1575 if ( e->state() == Qt::ControlButton) 1575 if ( e->state() == Qt::ControlButton)
1576 pro += 10; 1576 pro += 10;
1577 break; 1577 break;
1578 case Qt::Key_M: 1578 case Qt::Key_M:
1579 mView->viewManager()->showMonthView(); 1579 mView->viewManager()->showMonthView();
1580 showSelectedDates = true; 1580 showSelectedDates = true;
1581 break; 1581 break;
1582 case Qt::Key_Insert: 1582 case Qt::Key_Insert:
1583 mView->newEvent(); 1583 mView->newEvent();
1584 break; 1584 break;
1585 case Qt::Key_S : 1585 case Qt::Key_S :
1586 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1586 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1587 mView->newSubTodo(); 1587 mView->newSubTodo();
1588 else 1588 else
1589 mView->dialogManager()->showSearchDialog(); 1589 mView->dialogManager()->showSearchDialog();
1590 break; 1590 break;
1591 case Qt::Key_Y : 1591 case Qt::Key_Y :
1592 case Qt::Key_Z : 1592 case Qt::Key_Z :
1593 mView->viewManager()->showWorkWeekView(); 1593 mView->viewManager()->showWorkWeekView();
1594 showSelectedDates = true; 1594 showSelectedDates = true;
1595 break; 1595 break;
1596 case Qt::Key_U : 1596 case Qt::Key_U :
1597 mView->viewManager()->showWeekView(); 1597 mView->viewManager()->showWeekView();
1598 showSelectedDates = true; 1598 showSelectedDates = true;
1599 break; 1599 break;
1600 case Qt::Key_H : 1600 case Qt::Key_H :
1601 keyBindings(); 1601 keyBindings();
1602 break; 1602 break;
1603 case Qt::Key_W: 1603 case Qt::Key_W:
1604 mView->viewManager()->showWhatsNextView(); 1604 mView->viewManager()->showWhatsNextView();
1605 break; 1605 break;
1606 case Qt::Key_L: 1606 case Qt::Key_L:
1607 mView->viewManager()->showListView(); 1607 mView->viewManager()->showListView();
1608 break; 1608 break;
1609 case Qt::Key_N: 1609 case Qt::Key_N:
1610 mView->viewManager()->showNextXView(); 1610 mView->viewManager()->showNextXView();
1611 showSelectedDates = true; 1611 showSelectedDates = true;
1612 break; 1612 break;
1613 case Qt::Key_V: 1613 case Qt::Key_V:
1614 mView->viewManager()->showTodoView(); 1614 mView->viewManager()->showTodoView();
1615 break; 1615 break;
1616 case Qt::Key_C: 1616 case Qt::Key_C:
1617 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1617 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1618 break; 1618 break;
1619 case Qt::Key_P: 1619 case Qt::Key_P:
1620 mView->showDatePicker( ); 1620 mView->showDatePicker( );
1621 break; 1621 break;
1622 case Qt::Key_F: 1622 case Qt::Key_F:
1623 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1623 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1624 mView->editFilters(); 1624 mView->editFilters();
1625 else 1625 else
1626 mView->toggleFilter(); 1626 mView->toggleFilter();
1627 break; 1627 break;
1628 case Qt::Key_X: 1628 case Qt::Key_X:
1629 mView->toggleDateNavigatorWidget(); 1629 mView->toggleDateNavigatorWidget();
1630 break; 1630 break;
1631 case Qt::Key_Space: 1631 case Qt::Key_Space:
1632 mView->toggleExpand(); 1632 mView->toggleExpand();
1633 break; 1633 break;
1634 case Qt::Key_A: 1634 case Qt::Key_A:
1635 mView->toggleAllDaySize(); 1635 mView->toggleAllDaySize();
1636 break; 1636 break;
1637 case Qt::Key_T: 1637 case Qt::Key_T:
1638 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1638 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1639 mView->newTodo(); 1639 mView->newTodo();
1640 else { 1640 else {
1641 mView->goToday(); 1641 mView->goToday();
1642 showSelectedDates = true; 1642 showSelectedDates = true;
1643 } 1643 }
1644 break; 1644 break;
1645 case Qt::Key_J: 1645 case Qt::Key_J:
1646 mView->viewManager()->showJournalView(); 1646 mView->viewManager()->showJournalView();
1647 break; 1647 break;
1648 case Qt::Key_B: 1648 case Qt::Key_B:
1649 mView->editIncidenceDescription();; 1649 mView->editIncidenceDescription();;
1650 break; 1650 break;
1651 // case Qt::Key_Return: 1651 // case Qt::Key_Return:
1652 case Qt::Key_E: 1652 case Qt::Key_E:
1653 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1653 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1654 mView->newEvent(); 1654 mView->newEvent();
1655 else 1655 else
1656 mView->editIncidence(); 1656 mView->editIncidence();
1657 break; 1657 break;
1658 case Qt::Key_Plus: 1658 case Qt::Key_Plus:
1659 size = p->mHourSize +2; 1659 size = p->mHourSize +2;
1660 if ( size <= 18 ) 1660 if ( size <= 18 )
1661 configureAgenda( size ); 1661 configureAgenda( size );
1662 break; 1662 break;
1663 case Qt::Key_Minus: 1663 case Qt::Key_Minus:
1664 size = p->mHourSize - 2; 1664 size = p->mHourSize - 2;
1665 if ( size >= 4 ) 1665 if ( size >= 4 )
1666 configureAgenda( size ); 1666 configureAgenda( size );
1667 break; 1667 break;
1668 1668
1669 1669
1670 default: 1670 default:
1671 e->ignore(); 1671 e->ignore();
1672 } 1672 }
1673 if ( pro > 0 ) { 1673 if ( pro > 0 ) {
1674 mView->selectFilter( pro-1 ); 1674 mView->selectFilter( pro-1 );
1675 } 1675 }
1676 if ( showSelectedDates ) { 1676 if ( showSelectedDates ) {
1677 ;// setCaptionToDates(); 1677 ;// setCaptionToDates();
1678 } 1678 }
1679 1679
1680} 1680}
1681 1681
1682void MainWindow::fillFilterMenu() 1682void MainWindow::fillFilterMenu()
1683{ 1683{
1684 selectFilterMenu->clear(); 1684 selectFilterMenu->clear();
1685 bool disable = false; 1685 bool disable = false;
1686 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1686 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1687 selectFilterMenu->insertSeparator(); 1687 selectFilterMenu->insertSeparator();
1688 if ( mView->filterView()->filtersEnabled() ) { 1688 if ( mView->filterView()->filtersEnabled() ) {
1689 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1689 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1690 } 1690 }
1691 else { 1691 else {
1692 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1692 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1693 disable = true; 1693 disable = true;
1694 } 1694 }
1695 selectFilterMenu->insertSeparator(); 1695 selectFilterMenu->insertSeparator();
1696 QPtrList<CalFilter> fili = mView->filters(); 1696 QPtrList<CalFilter> fili = mView->filters();
1697 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1697 CalFilter *curfilter = mView->filterView()->selectedFilter();
1698 CalFilter *filter = fili.first(); 1698 CalFilter *filter = fili.first();
1699 int iii = 2; 1699 int iii = 2;
1700 while(filter) { 1700 while(filter) {
1701 selectFilterMenu->insertItem( filter->name(), iii ); 1701 selectFilterMenu->insertItem( filter->name(), iii );
1702 if ( filter == curfilter) 1702 if ( filter == curfilter)
1703 selectFilterMenu->setItemChecked( iii, true ); 1703 selectFilterMenu->setItemChecked( iii, true );
1704 if ( disable ) 1704 if ( disable )
1705 selectFilterMenu->setItemEnabled( iii, false ); 1705 selectFilterMenu->setItemEnabled( iii, false );
1706 filter = fili.next(); 1706 filter = fili.next();
1707 ++iii; 1707 ++iii;
1708 } 1708 }
1709} 1709}
1710void MainWindow::selectFilter( int fil ) 1710void MainWindow::selectFilter( int fil )
1711{ 1711{
1712 if ( fil == 0 ) { 1712 if ( fil == 0 ) {
1713 mView->editFilters( ); 1713 mView->editFilters( );
1714 } else if ( fil == 1 ){ 1714 } else if ( fil == 1 ){
1715 mView->toggleFilerEnabled( ); 1715 mView->toggleFilerEnabled( );
1716 } else { 1716 } else {
1717 mView->selectFilter( fil-2 ); 1717 mView->selectFilter( fil-2 );
1718 } 1718 }
1719} 1719}
1720void MainWindow::configureToolBar( int item ) 1720void MainWindow::configureToolBar( int item )
1721{ 1721{
1722 1722
1723 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1723 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1724 KOPrefs *p = KOPrefs::instance(); 1724 KOPrefs *p = KOPrefs::instance();
1725 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1725 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1726 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1726 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1727 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1727 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1728 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1728 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1729 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1729 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1730 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1730 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1731 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1731 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1732 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1732 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1733 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1733 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1734 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1734 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1735 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1735 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1736 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1736 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1737 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1737 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1738 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1738 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1739 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1739 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1740 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1740 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1741 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1741 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1742 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1742 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1743 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1743 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1744 // initActions(); 1744 // initActions();
1745} 1745}
1746 1746
1747void MainWindow::setCaptionToDates() 1747void MainWindow::setCaptionToDates()
1748{ 1748{
1749 QString selDates; 1749 QString selDates;
1750 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1750 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1751 if (mView->startDate() < mView->endDate() ) 1751 if (mView->startDate() < mView->endDate() )
1752 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1752 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1753 else { 1753 else {
1754 QString addString; 1754 QString addString;
1755 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1755 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1756 addString = i18n("Today"); 1756 addString = i18n("Today");
1757 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1757 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1758 addString = i18n("Tomorrow"); 1758 addString = i18n("Tomorrow");
1759 if ( !addString.isEmpty() ) 1759 if ( !addString.isEmpty() )
1760 selDates = addString+", "+selDates ; 1760 selDates = addString+", "+selDates ;
1761 } 1761 }
1762 setCaption( i18n("Dates: ") + selDates ); 1762 setCaption( i18n("Dates: ") + selDates );
1763 1763
1764} 1764}
1765void MainWindow::showConfigureAgenda( ) 1765void MainWindow::showConfigureAgenda( )
1766{ 1766{
1767 int iii; 1767 int iii;
1768 for ( iii = 1;iii<= 10 ;++iii ){ 1768 for ( iii = 1;iii<= 10 ;++iii ){
1769 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1769 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1770 } 1770 }
1771 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1771 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1772} 1772}
1773void MainWindow::configureAgenda( int item ) 1773void MainWindow::configureAgenda( int item )
1774{ 1774{
1775 if ( KOPrefs::instance()->mHourSize == item ) 1775 if ( KOPrefs::instance()->mHourSize == item )
1776 return; 1776 return;
1777 KOPrefs::instance()->mHourSize=item; 1777 KOPrefs::instance()->mHourSize=item;
1778 mView->viewManager()->agendaView()->updateConfig(); 1778 mView->viewManager()->agendaView()->updateConfig();
1779} 1779}
1780 1780
1781void MainWindow::saveCalendar() 1781void MainWindow::saveCalendar()
1782{ 1782{
1783 QString fn = KOPrefs::instance()->mLastSaveFile; 1783 QString fn = KOPrefs::instance()->mLastSaveFile;
1784 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1784 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1785 1785
1786 if ( fn == "" ) 1786 if ( fn == "" )
1787 return; 1787 return;
1788 QFileInfo info; 1788 QFileInfo info;
1789 info.setFile( fn ); 1789 info.setFile( fn );
1790 QString mes; 1790 QString mes;
1791 bool createbup = true; 1791 bool createbup = true;
1792 if ( info. exists() ) { 1792 if ( info. exists() ) {
1793 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1793 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1794 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1794 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1795 i18n("Overwrite!"), i18n("Cancel"), 0, 1795 i18n("Overwrite!"), i18n("Cancel"), 0,
1796 0, 1 ); 1796 0, 1 );
1797 if ( result != 0 ) { 1797 if ( result != 0 ) {
1798 createbup = false; 1798 createbup = false;
1799 } 1799 }
1800 } 1800 }
1801 if ( createbup ) { 1801 if ( createbup ) {
1802 mView->saveCalendar( fn ); 1802 mView->saveCalendar( fn );
1803 mes = i18n("KO/Pi:Saved %1").arg(fn); 1803 mes = i18n("KO/Pi:Saved %1").arg(fn);
1804 KOPrefs::instance()->mLastSaveFile = fn; 1804 KOPrefs::instance()->mLastSaveFile = fn;
1805 setCaption(mes); 1805 setCaption(mes);
1806 } 1806 }
1807} 1807}
1808void MainWindow::loadCalendar() 1808void MainWindow::loadCalendar()
1809{ 1809{
1810 1810
1811 QString fn = KOPrefs::instance()->mLastLoadFile; 1811 QString fn = KOPrefs::instance()->mLastLoadFile;
1812 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1812 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1813 1813
1814 if ( fn == "" ) 1814 if ( fn == "" )
1815 return; 1815 return;
1816 QFileInfo info; 1816 QFileInfo info;
1817 info.setFile( fn ); 1817 info.setFile( fn );
1818 QString mess; 1818 QString mess;
1819 bool loadbup = true; 1819 bool loadbup = true;
1820 if ( info. exists() ) { 1820 if ( info. exists() ) {
1821 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1821 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1822 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1822 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1823 mess, 1823 mess,
1824 i18n("Load!"), i18n("Cancel"), 0, 1824 i18n("Load!"), i18n("Cancel"), 0,
1825 0, 1 ); 1825 0, 1 );
1826 if ( result != 0 ) { 1826 if ( result != 0 ) {
1827 loadbup = false; 1827 loadbup = false;
1828 } 1828 }
1829 } else { 1829 } else {
1830 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1830 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1831 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1831 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1832 0, 1 ); 1832 0, 1 );
1833 1833
1834 return; 1834 return;
1835 } 1835 }
1836 if ( loadbup ) { 1836 if ( loadbup ) {
1837 mView->openCalendar( fn ); 1837 mView->openCalendar( fn );
1838 KOPrefs::instance()->mLastLoadFile = fn; 1838 KOPrefs::instance()->mLastLoadFile = fn;
1839 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1839 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1840 setCaption(mess); 1840 setCaption(mess);
1841 } 1841 }
1842 1842
1843} 1843}
1844void MainWindow::quickImportIcal() 1844void MainWindow::quickImportIcal()
1845{ 1845{
1846 importFile( KOPrefs::instance()->mLastImportFile, false ); 1846 importFile( KOPrefs::instance()->mLastImportFile, false );
1847} 1847}
1848void MainWindow::importFile( QString fn, bool quick ) 1848void MainWindow::importFile( QString fn, bool quick )
1849{ 1849{
1850 QFileInfo info; 1850 QFileInfo info;
1851 info.setFile( fn ); 1851 info.setFile( fn );
1852 QString mess; 1852 QString mess;
1853 bool loadbup = true; 1853 bool loadbup = true;
1854 if ( !info. exists() ) { 1854 if ( !info. exists() ) {
1855 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1855 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1856 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1856 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1857 mess ); 1857 mess );
1858 return; 1858 return;
1859 } 1859 }
1860 int result = 0; 1860 int result = 0;
1861 if ( !quick ) { 1861 if ( !quick ) {
1862 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1862 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1863 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1863 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1864 mess, 1864 mess,
1865 "Import", "Cancel", 0, 1865 "Import", "Cancel", 0,
1866 0, 1 ); 1866 0, 1 );
1867 } 1867 }
1868 if ( result == 0 ) { 1868 if ( result == 0 ) {
1869 if ( mView->openCalendar( fn, true )) { 1869 if ( mView->openCalendar( fn, true )) {
1870 KOPrefs::instance()->mLastImportFile = fn; 1870 KOPrefs::instance()->mLastImportFile = fn;
1871 setCaption(i18n("Imported file successfully")); 1871 setCaption(i18n("Imported file successfully"));
1872 } else { 1872 } else {
1873 setCaption(i18n("Error importing file")); 1873 setCaption(i18n("Error importing file"));
1874 } 1874 }
1875 } 1875 }
1876} 1876}
1877 1877
1878void MainWindow::importIcal() 1878void MainWindow::importIcal()
1879{ 1879{
1880 1880
1881 QString fn =KOPrefs::instance()->mLastImportFile; 1881 QString fn =KOPrefs::instance()->mLastImportFile;
1882 1882
1883 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1883 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1884 if ( fn == "" ) 1884 if ( fn == "" )
1885 return; 1885 return;
1886 importFile( fn, true ); 1886 importFile( fn, true );
1887 1887
1888} 1888}
1889 1889
1890void MainWindow::exportVCalendar() 1890void MainWindow::exportVCalendar()
1891{ 1891{
1892 QString fn = KOPrefs::instance()->mLastVcalFile; 1892 QString fn = KOPrefs::instance()->mLastVcalFile;
1893 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1893 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1894 if ( fn == "" ) 1894 if ( fn == "" )
1895 return; 1895 return;
1896 QFileInfo info; 1896 QFileInfo info;
1897 info.setFile( fn ); 1897 info.setFile( fn );
1898 QString mes; 1898 QString mes;
1899 bool createbup = true; 1899 bool createbup = true;
1900 if ( info. exists() ) { 1900 if ( info. exists() ) {
1901 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1901 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1902 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1902 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1903 i18n("Overwrite!"), i18n("Cancel"), 0, 1903 i18n("Overwrite!"), i18n("Cancel"), 0,
1904 0, 1 ); 1904 0, 1 );
1905 if ( result != 0 ) { 1905 if ( result != 0 ) {
1906 createbup = false; 1906 createbup = false;
1907 } 1907 }
1908 } 1908 }
1909 if ( createbup ) { 1909 if ( createbup ) {
1910 if ( mView->exportVCalendar( fn ) ) { 1910 if ( mView->exportVCalendar( fn ) ) {
1911 KOPrefs::instance()->mLastVcalFile = fn; 1911 KOPrefs::instance()->mLastVcalFile = fn;
1912 if ( fn.length() > 20 ) 1912 if ( fn.length() > 20 )
1913 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1913 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1914 else 1914 else
1915 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1915 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1916 setCaption(mes); 1916 setCaption(mes);
1917 } 1917 }
1918 } 1918 }
1919 1919
1920} 1920}
1921 1921
1922void MainWindow::syncFileRequest() 1922void MainWindow::syncFileRequest()
1923{ 1923{
1924 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1924 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1925 mSyncManager->slotSyncMenu( 999 ); 1925 mSyncManager->slotSyncMenu( 999 );
1926 } 1926 }
1927 save(); 1927 save();
1928} 1928}
1929void MainWindow::getFile( bool success ) 1929void MainWindow::getFile( bool success )
1930{ 1930{
1931 if ( ! success ) { 1931 if ( ! success ) {
1932 setCaption( i18n("Error receiving file. Nothing changed!") ); 1932 setCaption( i18n("Error receiving file. Nothing changed!") );
1933 return; 1933 return;
1934 } 1934 }
1935 mView->openCalendar( defaultFileName() ); 1935 mView->openCalendar( defaultFileName() );
1936 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1936 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1937 mSyncManager->slotSyncMenu( 999 ); 1937 mSyncManager->slotSyncMenu( 999 );
1938 } 1938 }
1939 setCaption( i18n("Pi-Sync successful!") ); 1939 setCaption( i18n("Pi-Sync successful!") );
1940} 1940}
1941 1941
1942void MainWindow::printSel( ) 1942void MainWindow::printSel( )
1943{ 1943{
1944 mView->viewManager()->agendaView()->agenda()->printSelection(); 1944 mView->viewManager()->agendaView()->agenda()->printSelection();
1945} 1945}
1946 1946
1947void MainWindow::printCal() 1947void MainWindow::printCal()
1948{ 1948{
1949 mView->print();//mCp->showDialog(); 1949 mView->print();//mCp->showDialog();
1950} 1950}
1951 1951