summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-28 10:17:06 (UTC)
committer zautrix <zautrix>2005-03-28 10:17:06 (UTC)
commit9ff0641f33e63cc88e96d0066dba43b4699ca489 (patch) (unidiff)
tree166f6ed4fe4b98f2e49278ab2a27b793f301537f
parent67dc8738c14716e18e4c433e5c0da474456c9859 (diff)
downloadkdepimpi-9ff0641f33e63cc88e96d0066dba43b4699ca489.zip
kdepimpi-9ff0641f33e63cc88e96d0066dba43b4699ca489.tar.gz
kdepimpi-9ff0641f33e63cc88e96d0066dba43b4699ca489.tar.bz2
filter settings
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp7
-rw-r--r--korganizer/koprefs.h7
-rw-r--r--korganizer/mainwindow.cpp206
-rw-r--r--korganizer/mainwindow.h11
4 files changed, 196 insertions, 35 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 7e3deff..2168094 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,295 +1,302 @@
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 <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "mainwindow.h" 48#include "mainwindow.h"
49 49
50KOPrefs *KOPrefs::mInstance = 0; 50KOPrefs *KOPrefs::mInstance = 0;
51static KStaticDeleter<KOPrefs> insd; 51static KStaticDeleter<KOPrefs> insd;
52 52
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mCategoryColors.setAutoDelete(true); 56 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 57 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 59 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 65
66 66
67 KPrefs::setCurrentGroup("General"); 67 KPrefs::setCurrentGroup("General");
68 68
69 69
70 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 70 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
71 71
72 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 72 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
73 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 73 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
74 addItemBool("ShowIconSearch",&mShowIconSearch,true); 74 addItemBool("ShowIconSearch",&mShowIconSearch,true);
75 addItemBool("ShowIconList",&mShowIconList,true); 75 addItemBool("ShowIconList",&mShowIconList,true);
76 addItemBool("ShowIconDay1",&mShowIconDay1,true); 76 addItemBool("ShowIconDay1",&mShowIconDay1,true);
77 addItemBool("ShowIconDay5",&mShowIconDay5,true); 77 addItemBool("ShowIconDay5",&mShowIconDay5,true);
78 addItemBool("ShowIconDay6",&mShowIconDay6,true); 78 addItemBool("ShowIconDay6",&mShowIconDay6,true);
79 addItemBool("ShowIconDay7",&mShowIconDay7,true); 79 addItemBool("ShowIconDay7",&mShowIconDay7,true);
80 addItemBool("ShowIconMonth",&mShowIconMonth,true); 80 addItemBool("ShowIconMonth",&mShowIconMonth,true);
81 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 81 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
82 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 82 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
83 addItemBool("ShowIconBack",&mShowIconBack,true); 83 addItemBool("ShowIconBack",&mShowIconBack,true);
84 addItemBool("ShowIconToday",&mShowIconToday,true); 84 addItemBool("ShowIconToday",&mShowIconToday,true);
85 addItemBool("ShowIconForward",&mShowIconForward,true); 85 addItemBool("ShowIconForward",&mShowIconForward,true);
86 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 86 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
87 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 87 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
88 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); 88 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true);
89 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 89 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
90 addItemBool("ShowIconNext",&mShowIconNext,true); 90 addItemBool("ShowIconNext",&mShowIconNext,true);
91 addItemBool("ShowIconJournal",&mShowIconJournal,true); 91 addItemBool("ShowIconJournal",&mShowIconJournal,true);
92 addItemBool("ShowIconStretch",&mShowIconStretch,true); 92 addItemBool("ShowIconStretch",&mShowIconStretch,true);
93 addItemBool("ShowIconFilter",&mShowIconFilter,false);
93 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 94 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
94 95
95 addItemBool("AskForQuit",&mAskForQuit,false); 96 addItemBool("AskForQuit",&mAskForQuit,false);
96 97
97#ifndef DESKTOP_VERSION 98#ifndef DESKTOP_VERSION
98 addItemBool("ShowFullMenu",&mShowFullMenu,false); 99 addItemBool("ShowFullMenu",&mShowFullMenu,false);
99#else 100#else
100 addItemBool("ShowFullMenu",&mShowFullMenu,true); 101 addItemBool("ShowFullMenu",&mShowFullMenu,true);
101#endif 102#endif
102 addItemBool("ToolBarHor",&mToolBarHor, true ); 103 addItemBool("ToolBarHor",&mToolBarHor, true );
103 addItemBool("ToolBarUp",&mToolBarUp, false ); 104 addItemBool("ToolBarUp",&mToolBarUp, false );
105 addItemBool("ToolBarHorV",&mToolBarHorV, true );
106 addItemBool("ToolBarUpV",&mToolBarUpV, false );
107 addItemBool("ToolBarHorN",&mToolBarHorN, true );
108 addItemBool("ToolBarUpN",&mToolBarUpN, false );
109 addItemBool("ToolBarHorF",&mToolBarHorF, true );
110 addItemBool("ToolBarUpF",&mToolBarUpF, false );
104 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 111 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
105 addItemInt("Whats Next Days",&mWhatsNextDays,3); 112 addItemInt("Whats Next Days",&mWhatsNextDays,3);
106 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 113 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
107 114
108 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 115 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
109 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 116 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
110 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 117 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
111 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 118 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
112 addItemInt("AllDay Size",&mAllDaySize,28); 119 addItemInt("AllDay Size",&mAllDaySize,28);
113 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 120 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
114 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 121 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
115 122
116 addItemStringList("LocationDefaults",&mLocationDefaults ); 123 addItemStringList("LocationDefaults",&mLocationDefaults );
117 addItemStringList("EventSummary User",&mEventSummaryUser); 124 addItemStringList("EventSummary User",&mEventSummaryUser);
118 addItemStringList("TodoSummary User",&mTodoSummaryUser); 125 addItemStringList("TodoSummary User",&mTodoSummaryUser);
119 126
120 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 127 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
121 addItemBool("Enable Project View",&mEnableProjectView,false); 128 addItemBool("Enable Project View",&mEnableProjectView,false);
122 addItemBool("Auto Save",&mAutoSave,false); 129 addItemBool("Auto Save",&mAutoSave,false);
123 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 130 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
124 addItemBool("Confirm Deletes",&mConfirm,true); 131 addItemBool("Confirm Deletes",&mConfirm,true);
125 addItemString("Archive File",&mArchiveFile); 132 addItemString("Archive File",&mArchiveFile);
126 addItemString("Html Export File",&mHtmlExportFile, 133 addItemString("Html Export File",&mHtmlExportFile,
127 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 134 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
128 addItemBool("Html With Save",&mHtmlWithSave,false); 135 addItemBool("Html With Save",&mHtmlWithSave,false);
129 136
130 KPrefs::setCurrentGroup("Personal Settings"); 137 KPrefs::setCurrentGroup("Personal Settings");
131 138
132 addItemInt("Mail Client",&mMailClient,MailClientKMail); 139 addItemInt("Mail Client",&mMailClient,MailClientKMail);
133 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 140 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
134 addItemBool("Bcc",&mBcc,false); 141 addItemBool("Bcc",&mBcc,false);
135 142
136 KPrefs::setCurrentGroup("Time & Date"); 143 KPrefs::setCurrentGroup("Time & Date");
137 144
138 145
139 addItemInt("Default Start Time",&mStartTime,10); 146 addItemInt("Default Start Time",&mStartTime,10);
140 addItemInt("Default Duration",&mDefaultDuration,2); 147 addItemInt("Default Duration",&mDefaultDuration,2);
141 addItemInt("Default Alarm Time",&mAlarmTime,3); 148 addItemInt("Default Alarm Time",&mAlarmTime,3);
142 KPrefs::setCurrentGroup("AlarmSettings"); 149 KPrefs::setCurrentGroup("AlarmSettings");
143 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 150 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
144 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 151 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
145 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 152 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
146 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 153 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
147 154
148 155
149 KPrefs::setCurrentGroup("Calendar"); 156 KPrefs::setCurrentGroup("Calendar");
150 157
151 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 158 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
152 159
153 KPrefs::setCurrentGroup("Fonts"); 160 KPrefs::setCurrentGroup("Fonts");
154 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 161 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
155 addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); 162 addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() );
156 addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); 163 addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont());
157 addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); 164 addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont());
158 addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); 165 addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont());
159 addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); 166 addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont());
160 addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); 167 addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont());
161 addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); 168 addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont());
162 addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); 169 addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont());
163 addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); 170 addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont());
164 addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); 171 addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont());
165 addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); 172 addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont());
166 addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); 173 addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont());
167 174
168 KPrefs::setCurrentGroup("RemoteSyncing"); 175 KPrefs::setCurrentGroup("RemoteSyncing");
169 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 176 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
170 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 177 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
171 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 178 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
172 addItemInt("LastSyncTime",&mLastSyncTime,0); 179 addItemInt("LastSyncTime",&mLastSyncTime,0);
173 180
174#ifdef _WIN32_ 181#ifdef _WIN32_
175 QString hdp= locateLocal("data","korganizer")+"\\\\"; 182 QString hdp= locateLocal("data","korganizer")+"\\\\";
176#else 183#else
177 QString hdp= locateLocal("data","korganizer")+"/"; 184 QString hdp= locateLocal("data","korganizer")+"/";
178#endif 185#endif
179 186
180 KPrefs::setCurrentGroup("LoadSaveFileNames"); 187 KPrefs::setCurrentGroup("LoadSaveFileNames");
181 188
182 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 189 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
183 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 190 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
184 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 191 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
185 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 192 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
186 193
187 194
188 KPrefs::setCurrentGroup("Locale"); 195 KPrefs::setCurrentGroup("Locale");
189 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 196 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
190 197
191 198
192 KPrefs::setCurrentGroup("Colors"); 199 KPrefs::setCurrentGroup("Colors");
193 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 200 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
194 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 201 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
195 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 202 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
196 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 203 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
197 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 204 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
198 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 205 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
199 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 206 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
200 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 207 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
201 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 208 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
202 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 209 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
203 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 210 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
204 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 211 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
205 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 212 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
206 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 213 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
207 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 214 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
208 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 215 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
209 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 216 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
210 addItemBool("UseAppColors",&mUseAppColors,false); 217 addItemBool("UseAppColors",&mUseAppColors,false);
211 218
212 219
213 220
214 KPrefs::setCurrentGroup("Views"); 221 KPrefs::setCurrentGroup("Views");
215 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 222 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
216 addItemInt("Hour Size",&mHourSize,8); 223 addItemInt("Hour Size",&mHourSize,8);
217 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 224 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
218 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 225 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
219 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 226 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
220 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 227 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
221 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 228 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
222 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 229 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
223#ifdef DESKTOP_VERION 230#ifdef DESKTOP_VERION
224 addItemBool("Enable ToolTips",&mEnableToolTips,true); 231 addItemBool("Enable ToolTips",&mEnableToolTips,true);
225#else 232#else
226 addItemBool("Enable ToolTips",&mEnableToolTips,false); 233 addItemBool("Enable ToolTips",&mEnableToolTips,false);
227#endif 234#endif
228 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 235 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
229 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 236 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
230 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 237 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
231 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 238 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
232 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 239 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
233 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 240 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
234 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 241 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
235 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 242 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
236 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 243 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
237 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 244 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
238 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 245 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
239 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 246 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
240 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 247 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
241 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 248 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
242 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 249 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
243 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 250 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
244 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 251 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
245 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 252 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
246 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 253 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
247 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 254 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
248#ifdef DESKTOP_VERSION 255#ifdef DESKTOP_VERSION
249 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 256 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
250#else 257#else
251 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 258 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
252#endif 259#endif
253 addItemInt("Day Begins",&mDayBegins,7); 260 addItemInt("Day Begins",&mDayBegins,7);
254 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 261 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
255 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 262 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
256 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 263 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
257 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 264 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
258 265
259 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 266 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
260 addItemBool("Full View Month",&mFullViewMonth,true); 267 addItemBool("Full View Month",&mFullViewMonth,true);
261 addItemBool("Full View Todo",&mFullViewTodo,true); 268 addItemBool("Full View Todo",&mFullViewTodo,true);
262 addItemBool("Quick Todo",&mEnableQuickTodo,false); 269 addItemBool("Quick Todo",&mEnableQuickTodo,false);
263 270
264 addItemInt("Next X Days",&mNextXDays,3); 271 addItemInt("Next X Days",&mNextXDays,3);
265 272
266 KPrefs::setCurrentGroup("Printer"); 273 KPrefs::setCurrentGroup("Printer");
267 274
268 KPrefs::setCurrentGroup("Layout"); 275 KPrefs::setCurrentGroup("Layout");
269 276
270 addItemBool("CompactDialogs",&mCompactDialogs,false); 277 addItemBool("CompactDialogs",&mCompactDialogs,false);
271 addItemBool("VerticalScreen",&mVerticalScreen,true); 278 addItemBool("VerticalScreen",&mVerticalScreen,true);
272 279
273 KPrefs::setCurrentGroup("KOrganizer Plugins"); 280 KPrefs::setCurrentGroup("KOrganizer Plugins");
274 281
275 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 282 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
276 283
277 KPrefs::setCurrentGroup("Group Scheduling"); 284 KPrefs::setCurrentGroup("Group Scheduling");
278 285
279 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 286 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
280 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 287 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
281 addItemStringList("AdditionalMails",&mAdditionalMails,""); 288 addItemStringList("AdditionalMails",&mAdditionalMails,"");
282 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 289 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
283 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 290 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
284 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 291 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
285 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 292 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
286 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 293 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
287 294
288 KPrefs::setCurrentGroup( "Editors" ); 295 KPrefs::setCurrentGroup( "Editors" );
289 296
290 addItemStringList( "EventTemplates", &mEventTemplates ); 297 addItemStringList( "EventTemplates", &mEventTemplates );
291 addItemStringList( "TodoTemplates", &mTodoTemplates ); 298 addItemStringList( "TodoTemplates", &mTodoTemplates );
292 299
293 addItemInt("DestinationPolicy",&mDestination,standardDestination); 300 addItemInt("DestinationPolicy",&mDestination,standardDestination);
294 301
295 KPrefs::setCurrentGroup( "ViewOptions" ); 302 KPrefs::setCurrentGroup( "ViewOptions" );
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 09a0dce..8dfdf69 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,293 +1,300 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h> 28#include <qdict.h>
29 29
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35class KOPrefs : public KPimPrefs 35class KOPrefs : public KPimPrefs
36{ 36{
37 public: 37 public:
38 enum { FormatVCalendar, FormatICalendar }; 38 enum { FormatVCalendar, FormatICalendar };
39 enum { MailClientKMail, MailClientSendmail }; 39 enum { MailClientKMail, MailClientSendmail };
40 enum { IMIPDummy, IMIPKMail }; 40 enum { IMIPDummy, IMIPKMail };
41 enum { IMIPOutbox, IMIPdirectsend }; 41 enum { IMIPOutbox, IMIPdirectsend };
42 enum { neverAuto, addressbookAuto, selectedAuto }; 42 enum { neverAuto, addressbookAuto, selectedAuto };
43 enum { standardDestination, askDestination }; 43 enum { standardDestination, askDestination };
44 44
45 virtual ~KOPrefs(); 45 virtual ~KOPrefs();
46 46
47 /** Get instance of KOPrefs. It is made sure that there is only one 47 /** Get instance of KOPrefs. It is made sure that there is only one
48 instance. */ 48 instance. */
49 static KOPrefs *instance(); 49 static KOPrefs *instance();
50 50
51 /** Set preferences to default values */ 51 /** Set preferences to default values */
52 void usrSetDefaults(); 52 void usrSetDefaults();
53 53
54 /** Read preferences from config file */ 54 /** Read preferences from config file */
55 void usrReadConfig(); 55 void usrReadConfig();
56 56
57 /** Write preferences to config file */ 57 /** Write preferences to config file */
58 void usrWriteConfig(); 58 void usrWriteConfig();
59 void setCategoryDefaults(); 59 void setCategoryDefaults();
60 void setAllDefaults(); 60 void setAllDefaults();
61 61
62 protected: 62 protected:
63 void setTimeZoneIdDefault(); 63 void setTimeZoneIdDefault();
64 64
65 /** Fill empty mail fields with default values. */ 65 /** Fill empty mail fields with default values. */
66 void fillMailDefaults(); 66 void fillMailDefaults();
67 67
68 private: 68 private:
69 /** Constructor disabled for public. Use instance() to create a KOPrefs 69 /** Constructor disabled for public. Use instance() to create a KOPrefs
70 object. */ 70 object. */
71 KOPrefs(); 71 KOPrefs();
72 72
73 static KOPrefs *mInstance; 73 static KOPrefs *mInstance;
74 QStringList getDefaultList(); 74 QStringList getDefaultList();
75 QStringList getLocationDefaultList(); 75 QStringList getLocationDefaultList();
76 public: 76 public:
77 // preferences data 77 // preferences data
78 KConfig* getConfig(); 78 KConfig* getConfig();
79 void setFullName(const QString &); 79 void setFullName(const QString &);
80 QString fullName(); 80 QString fullName();
81 void setEmail(const QString &); 81 void setEmail(const QString &);
82 QString email(); 82 QString email();
83 83
84 QString mAdditional; 84 QString mAdditional;
85 85
86 bool mEmailControlCenter; 86 bool mEmailControlCenter;
87 87
88 bool mBcc; 88 bool mBcc;
89 bool mAutoSave; 89 bool mAutoSave;
90 int mAutoSaveInterval; 90 int mAutoSaveInterval;
91 bool mConfirm; 91 bool mConfirm;
92 92
93 bool mEnableGroupScheduling; 93 bool mEnableGroupScheduling;
94 bool mEnableProjectView; 94 bool mEnableProjectView;
95 95
96 int mDefaultFormat; 96 int mDefaultFormat;
97 int mMailClient; 97 int mMailClient;
98 98
99 int mStartTime; 99 int mStartTime;
100 int mDefaultDuration; 100 int mDefaultDuration;
101 int mAlarmTime; 101 int mAlarmTime;
102 102
103 int mWorkingHoursStart; 103 int mWorkingHoursStart;
104 int mWorkingHoursEnd; 104 int mWorkingHoursEnd;
105 bool mExcludeHolidays; 105 bool mExcludeHolidays;
106 bool mExcludeSaturdays; 106 bool mExcludeSaturdays;
107 bool mMarcusBainsShowSeconds; 107 bool mMarcusBainsShowSeconds;
108 108
109 QFont mTimeBarFont; 109 QFont mTimeBarFont;
110 QFont mMonthViewFont; 110 QFont mMonthViewFont;
111 QFont mAgendaViewFont; 111 QFont mAgendaViewFont;
112 QFont mMarcusBainsFont; 112 QFont mMarcusBainsFont;
113 QFont mTimeLabelsFont; 113 QFont mTimeLabelsFont;
114 QFont mTodoViewFont; 114 QFont mTodoViewFont;
115 QFont mListViewFont; 115 QFont mListViewFont;
116 QFont mDateNavigatorFont; 116 QFont mDateNavigatorFont;
117 QFont mEditBoxFont; 117 QFont mEditBoxFont;
118 QFont mJornalViewFont; 118 QFont mJornalViewFont;
119 QFont mWhatsNextFont; 119 QFont mWhatsNextFont;
120 QFont mEventViewFont; 120 QFont mEventViewFont;
121 121
122 122
123 123
124 124
125 QColor mHolidayColor; 125 QColor mHolidayColor;
126 QColor mHighlightColor; 126 QColor mHighlightColor;
127 QColor mEventColor; 127 QColor mEventColor;
128 QColor mTodoDoneColor; 128 QColor mTodoDoneColor;
129 QColor mAgendaBgColor; 129 QColor mAgendaBgColor;
130 QColor mWorkingHoursColor; 130 QColor mWorkingHoursColor;
131 QColor mTodoDueTodayColor; 131 QColor mTodoDueTodayColor;
132 QColor mTodoOverdueColor; 132 QColor mTodoOverdueColor;
133 QColor mMonthViewEvenColor; 133 QColor mMonthViewEvenColor;
134 QColor mMonthViewOddColor; 134 QColor mMonthViewOddColor;
135 QColor mMonthViewHolidayColor; 135 QColor mMonthViewHolidayColor;
136 bool mMonthViewUsesDayColors; 136 bool mMonthViewUsesDayColors;
137 bool mMonthViewSatSunTog; 137 bool mMonthViewSatSunTog;
138 bool mMonthViewWeek; 138 bool mMonthViewWeek;
139 QColor mAppColor1; 139 QColor mAppColor1;
140 QColor mAppColor2; 140 QColor mAppColor2;
141 bool mUseAppColors; 141 bool mUseAppColors;
142 142
143 int mDayBegins; 143 int mDayBegins;
144 int mHourSize; 144 int mHourSize;
145 int mAllDaySize; 145 int mAllDaySize;
146 bool mShowFullMenu; 146 bool mShowFullMenu;
147 bool mDailyRecur; 147 bool mDailyRecur;
148 bool mWeeklyRecur; 148 bool mWeeklyRecur;
149 bool mMonthDailyRecur; 149 bool mMonthDailyRecur;
150 bool mMonthWeeklyRecur; 150 bool mMonthWeeklyRecur;
151 bool mMonthShowIcons; 151 bool mMonthShowIcons;
152 bool mMonthShowShort; 152 bool mMonthShowShort;
153 bool mEnableToolTips; 153 bool mEnableToolTips;
154 bool mEnableMonthScroll; 154 bool mEnableMonthScroll;
155 bool mFullViewMonth; 155 bool mFullViewMonth;
156 bool mMonthViewUsesCategoryColor; 156 bool mMonthViewUsesCategoryColor;
157 bool mFullViewTodo; 157 bool mFullViewTodo;
158 bool mShowCompletedTodo; 158 bool mShowCompletedTodo;
159 bool mMarcusBainsEnabled; 159 bool mMarcusBainsEnabled;
160 int mNextXDays; 160 int mNextXDays;
161 int mWhatsNextDays; 161 int mWhatsNextDays;
162 int mWhatsNextPrios; 162 int mWhatsNextPrios;
163 bool mEnableQuickTodo; 163 bool mEnableQuickTodo;
164 164
165 bool mCompactDialogs; 165 bool mCompactDialogs;
166 bool mVerticalScreen; 166 bool mVerticalScreen;
167 167
168 bool mShowIconNewTodo; 168 bool mShowIconNewTodo;
169 bool mShowIconNewEvent; 169 bool mShowIconNewEvent;
170 bool mShowIconSearch; 170 bool mShowIconSearch;
171 bool mShowIconList; 171 bool mShowIconList;
172 bool mShowIconDay1; 172 bool mShowIconDay1;
173 bool mShowIconDay5; 173 bool mShowIconDay5;
174 bool mShowIconDay6; 174 bool mShowIconDay6;
175 bool mShowIconDay7; 175 bool mShowIconDay7;
176 bool mShowIconMonth; 176 bool mShowIconMonth;
177 bool mShowIconTodoview; 177 bool mShowIconTodoview;
178 bool mShowIconBackFast; 178 bool mShowIconBackFast;
179 bool mShowIconBack; 179 bool mShowIconBack;
180 bool mShowIconToday; 180 bool mShowIconToday;
181 bool mShowIconForward; 181 bool mShowIconForward;
182 bool mShowIconForwardFast; 182 bool mShowIconForwardFast;
183 bool mShowIconWhatsThis; 183 bool mShowIconWhatsThis;
184 bool mShowIconWeekNum; 184 bool mShowIconWeekNum;
185 bool mShowIconNextDays; 185 bool mShowIconNextDays;
186 bool mShowIconNext; 186 bool mShowIconNext;
187 bool mShowIconJournal; 187 bool mShowIconJournal;
188 bool mShowIconFilter;
188 189
189 bool mShowIconStretch; 190 bool mShowIconStretch;
190 191
191 bool mToolBarHor; 192 bool mToolBarHor;
192 bool mToolBarUp; 193 bool mToolBarUp;
194 bool mToolBarHorV;
195 bool mToolBarUpV;
196 bool mToolBarHorN;
197 bool mToolBarUpN;
198 bool mToolBarHorF;
199 bool mToolBarUpF;
193 bool mToolBarMiniIcons; 200 bool mToolBarMiniIcons;
194 201
195 bool mAskForQuit; 202 bool mAskForQuit;
196 bool mUsePassWd; 203 bool mUsePassWd;
197 bool mShowSyncEvents; 204 bool mShowSyncEvents;
198 bool mShowTodoInAgenda; 205 bool mShowTodoInAgenda;
199 bool mShowTimeInAgenda; 206 bool mShowTimeInAgenda;
200 bool mHideNonStartedTodos; 207 bool mHideNonStartedTodos;
201 208
202 int mLastSyncTime; 209 int mLastSyncTime;
203 void setCategoryColor(QString cat,const QColor & color); 210 void setCategoryColor(QString cat,const QColor & color);
204 QColor *categoryColor(QString cat); 211 QColor *categoryColor(QString cat);
205 212
206 QString mArchiveFile; 213 QString mArchiveFile;
207 QString mHtmlExportFile; 214 QString mHtmlExportFile;
208 bool mHtmlWithSave; 215 bool mHtmlWithSave;
209 216
210 QStringList mSelectedPlugins; 217 QStringList mSelectedPlugins;
211 218
212 QString mLastImportFile; 219 QString mLastImportFile;
213 QString mLastVcalFile; 220 QString mLastVcalFile;
214 QString mLastSaveFile; 221 QString mLastSaveFile;
215 QString mLastLoadFile; 222 QString mLastLoadFile;
216 223
217 224
218 QString mDefaultAlarmFile; 225 QString mDefaultAlarmFile;
219 int mIMIPScheduler; 226 int mIMIPScheduler;
220 int mIMIPSend; 227 int mIMIPSend;
221 QStringList mAdditionalMails; 228 QStringList mAdditionalMails;
222 int mIMIPAutoRefresh; 229 int mIMIPAutoRefresh;
223 int mIMIPAutoInsertReply; 230 int mIMIPAutoInsertReply;
224 int mIMIPAutoInsertRequest; 231 int mIMIPAutoInsertRequest;
225 int mIMIPAutoFreeBusy; 232 int mIMIPAutoFreeBusy;
226 int mIMIPAutoFreeBusyReply; 233 int mIMIPAutoFreeBusyReply;
227 234
228 QStringList mTodoTemplates; 235 QStringList mTodoTemplates;
229 QStringList mEventTemplates; 236 QStringList mEventTemplates;
230 237
231 int mDestination; 238 int mDestination;
232 239
233 240
234 bool mEditOnDoubleClick; 241 bool mEditOnDoubleClick;
235 bool mViewChangeHoldFullscreen; 242 bool mViewChangeHoldFullscreen;
236 bool mViewChangeHoldNonFullscreen; 243 bool mViewChangeHoldNonFullscreen;
237 bool mCenterOnCurrentTime; 244 bool mCenterOnCurrentTime;
238 bool mSetTimeToDayStartAt; 245 bool mSetTimeToDayStartAt;
239 bool mHighlightCurrentDay; 246 bool mHighlightCurrentDay;
240 bool mUseHighlightLightColor; 247 bool mUseHighlightLightColor;
241 bool mListViewMonthTimespan; 248 bool mListViewMonthTimespan;
242 bool mWNViewShowsParents; 249 bool mWNViewShowsParents;
243 bool mWNViewShowsPast; 250 bool mWNViewShowsPast;
244 bool mWNViewShowLocation; 251 bool mWNViewShowLocation;
245 bool mTodoViewShowsPercentage; 252 bool mTodoViewShowsPercentage;
246 bool mTodoViewUsesCatColors; 253 bool mTodoViewUsesCatColors;
247 bool mMonthViewUsesBigFont; 254 bool mMonthViewUsesBigFont;
248 bool mTodoViewUsesSmallFont; 255 bool mTodoViewUsesSmallFont;
249 bool mTodoViewUsesForegroundColor; 256 bool mTodoViewUsesForegroundColor;
250 bool mMonthViewUsesForegroundColor; 257 bool mMonthViewUsesForegroundColor;
251 258
252 bool mHightlightDateTimeEdit; 259 bool mHightlightDateTimeEdit;
253 bool mShortDateInViewer; 260 bool mShortDateInViewer;
254 261
255 bool mShowDateNavigator; 262 bool mShowDateNavigator;
256 263
257 QStringList mLocationDefaults; 264 QStringList mLocationDefaults;
258 QStringList mEventSummaryUser; 265 QStringList mEventSummaryUser;
259 QStringList mTodoSummaryUser; 266 QStringList mTodoSummaryUser;
260 267
261 bool mUseInternalAlarmNotification; 268 bool mUseInternalAlarmNotification;
262 int mAlarmPlayBeeps; 269 int mAlarmPlayBeeps;
263 int mAlarmSuspendTime; 270 int mAlarmSuspendTime;
264 int mAlarmSuspendCount; 271 int mAlarmSuspendCount;
265 int mAlarmBeepInterval; 272 int mAlarmBeepInterval;
266 int mOldLanguage; 273 int mOldLanguage;
267 int mOldLoadedLanguage; 274 int mOldLoadedLanguage;
268 275
269 276
270 QString mActiveSyncPort; 277 QString mActiveSyncPort;
271 QString mActiveSyncIP; 278 QString mActiveSyncIP;
272 279
273 // settings for eventviewer 280 // settings for eventviewer
274 bool mEVshowDetails; 281 bool mEVshowDetails;
275 bool mEVshowCreated; 282 bool mEVshowCreated;
276 bool mEVshowChanged; 283 bool mEVshowChanged;
277 bool mWTshowDetails; 284 bool mWTshowDetails;
278 bool mWTshowCreated; 285 bool mWTshowCreated;
279 bool mWTshowChanged; 286 bool mWTshowChanged;
280 287
281 private: 288 private:
282 QDict<QColor> mCategoryColors; 289 QDict<QColor> mCategoryColors;
283 QColor mDefaultCategoryColor; 290 QColor mDefaultCategoryColor;
284 291
285 QFont mDefaultTimeBarFont; 292 QFont mDefaultTimeBarFont;
286 QFont mDefaultViewFont; 293 QFont mDefaultViewFont;
287 QFont mDefaultMonthViewFont; 294 QFont mDefaultMonthViewFont;
288 295
289 QString mName; 296 QString mName;
290 QString mEmail; 297 QString mEmail;
291}; 298};
292 299
293#endif 300#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ca0d542..c6ae868 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,358 +1,421 @@
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 "ktoolbar.h"
60#include "klocale.h" 61#include "klocale.h"
61#include "kconfig.h" 62#include "kconfig.h"
62#include "simplealarmclient.h" 63#include "simplealarmclient.h"
63#include "externalapphandler.h" 64#include "externalapphandler.h"
64 65
65using namespace KCal; 66using namespace KCal;
66#ifndef _WIN32_ 67#ifndef _WIN32_
67#include <unistd.h> 68#include <unistd.h>
68#else 69#else
69#ifdef _OL_IMPORT_ 70#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 71#include "koimportoldialog.h"
71#endif 72#endif
72#endif 73#endif
73#include "mainwindow.h" 74#include "mainwindow.h"
74 75
75 76
76class KOex2phonePrefs : public QDialog 77class KOex2phonePrefs : public QDialog
77{ 78{
78 public: 79 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 81 QDialog( parent, name, true )
81 { 82 {
82 setCaption( i18n("Export to phone options") ); 83 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 84 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 85 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 86 lay->setMargin( 3 );
86 QLabel *lab; 87 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 89 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 90 QHBox* temphb;
90 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 92 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 93 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 114 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 119 resize( 220, 240 );
119 qApp->processEvents(); 120 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
123 } 124 }
124 125
125public: 126public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
129}; 130};
130 131
131int globalFlagBlockStartup; 132int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 134 QMainWindow( parent, name )
134{ 135{
135 136
136 mClosed = false; 137 mClosed = false;
137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
138 QString confFile = locateLocal("config","korganizerrc"); 139 QString confFile = locateLocal("config","korganizerrc");
139 QFileInfo finf ( confFile ); 140 QFileInfo finf ( confFile );
140 bool showWarning = !finf.exists(); 141 bool showWarning = !finf.exists();
141 setIcon(SmallIcon( "ko24" ) ); 142 setIcon(SmallIcon( "ko24" ) );
142 mBlockAtStartup = true; 143 mBlockAtStartup = true;
143 mFlagKeyPressed = false; 144 mFlagKeyPressed = false;
144 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
145 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
146 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
147 if ( p->mHourSize > 22 ) 148 if ( p->mHourSize > 22 )
148 p->mHourSize = 22; 149 p->mHourSize = 22;
149 QMainWindow::ToolBarDock tbd; 150 QMainWindow::ToolBarDock tbd;
150 if ( p->mToolBarHor ) { 151 if ( p->mToolBarHor ) {
151 if ( p->mToolBarUp ) 152 if ( p->mToolBarUp )
152 tbd = Bottom; 153 tbd = Bottom;
153 else 154 else
154 tbd = Top; 155 tbd = Top;
155 } 156 }
156 else { 157 else {
157 if ( p->mToolBarUp ) 158 if ( p->mToolBarUp )
158 tbd = Right; 159 tbd = Right;
159 else 160 else
160 tbd = Left; 161 tbd = Left;
161 } 162 }
162 if ( KOPrefs::instance()->mUseAppColors ) 163 if ( KOPrefs::instance()->mUseAppColors )
163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
164 globalFlagBlockStartup = 1; 165 globalFlagBlockStartup = 1;
165 iconToolBar = new QPEToolBar( this ); 166 iconToolBar = new QPEToolBar( this );
166 addToolBar (iconToolBar , tbd ); 167 addToolBar (iconToolBar , tbd );
168
169 if ( KOPrefs::instance()->mShowIconFilter ) {
170 if ( p->mToolBarHorF ) {
171 if ( p->mToolBarUpF )
172 tbd = Bottom;
173 else
174 tbd = Top;
175 }
176 else {
177 if ( p->mToolBarUpF )
178 tbd = Right;
179 else
180 tbd = Left;
181 }
182 filterToolBar = new QPEToolBar ( this );
183 filterMenubar = new QPEMenuBar( filterToolBar );
184 QFontMetrics fm ( filterMenubar->font() );
185
186 filterPopupMenu = new QPopupMenu( this );
187 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
188 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+"Ax" ) );
189 addToolBar (filterToolBar , tbd );
190 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
191 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
192 } else {
193 filterToolBar = 0;
194 filterMenubar = 0;
195 filterPopupMenu = 0;
196 }
197
198 if ( p->mToolBarHorV ) {
199 if ( p->mToolBarUpV )
200 tbd = Bottom;
201 else
202 tbd = Top;
203 }
204 else {
205 if ( p->mToolBarUpV )
206 tbd = Right;
207 else
208 tbd = Left;
209 }
210 viewToolBar = new QPEToolBar( this );
211 addToolBar (viewToolBar , tbd );
212 if ( p->mToolBarHorN ) {
213 if ( p->mToolBarUpN )
214 tbd = Bottom;
215 else
216 tbd = Top;
217 }
218 else {
219 if ( p->mToolBarUpN )
220 tbd = Right;
221 else
222 tbd = Left;
223 }
224 navigatorToolBar = new QPEToolBar( this );
225 addToolBar (navigatorToolBar , tbd );
226
227
228
229
167 mCalendarModifiedFlag = false; 230 mCalendarModifiedFlag = false;
168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 231 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
169 splash->setAlignment ( AlignCenter ); 232 splash->setAlignment ( AlignCenter );
170 setCentralWidget( splash ); 233 setCentralWidget( splash );
171#ifndef DESKTOP_VERSION 234#ifndef DESKTOP_VERSION
172 showMaximized(); 235 showMaximized();
173#endif 236#endif
174 237
175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 238 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
176 setDefaultPreferences(); 239 setDefaultPreferences();
177 mCalendar = new CalendarLocal(); 240 mCalendar = new CalendarLocal();
178 mView = new CalendarView( mCalendar, this,"mCalendar " ); 241 mView = new CalendarView( mCalendar, this,"mCalendar " );
179 mView->hide(); 242 mView->hide();
180 //mView->resize(splash->size() ); 243 //mView->resize(splash->size() );
181 initActions(); 244 initActions();
182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 245 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
183 mSyncManager->setBlockSave(false); 246 mSyncManager->setBlockSave(false);
184 mView->setSyncManager(mSyncManager); 247 mView->setSyncManager(mSyncManager);
185#ifndef DESKTOP_VERSION 248#ifndef DESKTOP_VERSION
186 iconToolBar->show(); 249 iconToolBar->show();
187 qApp->processEvents(); 250 qApp->processEvents();
188#endif 251#endif
189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 252 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
190 int vh = height() ; 253 int vh = height() ;
191 int vw = width(); 254 int vw = width();
192 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 255 //qDebug("Toolbar hei %d ",iconToolBar->height() );
193 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 256 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
194 vh -= iconToolBar->height(); 257 vh -= iconToolBar->height();
195 } else { 258 } else {
196 vw -= iconToolBar->height(); 259 vw -= iconToolBar->height();
197 } 260 }
198 //mView->setMaximumSize( splash->size() ); 261 //mView->setMaximumSize( splash->size() );
199 //mView->resize( splash->size() ); 262 //mView->resize( splash->size() );
200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 263 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
201 mView->readSettings(); 264 mView->readSettings();
202 bool newFile = false; 265 bool newFile = false;
203 if( !QFile::exists( defaultFileName() ) ) { 266 if( !QFile::exists( defaultFileName() ) ) {
204 QFileInfo finfo ( defaultFileName() ); 267 QFileInfo finfo ( defaultFileName() );
205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 268 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
206 qDebug("oldfile %s ", oldFile.latin1()); 269 qDebug("oldfile %s ", oldFile.latin1());
207 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"; 270 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";
208 finfo.setFile( oldFile ); 271 finfo.setFile( oldFile );
209 if (finfo.exists() ) { 272 if (finfo.exists() ) {
210 KMessageBox::information( this, message); 273 KMessageBox::information( this, message);
211 mView->openCalendar( oldFile ); 274 mView->openCalendar( oldFile );
212 qApp->processEvents(); 275 qApp->processEvents();
213 } else { 276 } else {
214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 277 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
215 finfo.setFile( oldFile ); 278 finfo.setFile( oldFile );
216 if (finfo.exists() ) { 279 if (finfo.exists() ) {
217 KMessageBox::information( this, message); 280 KMessageBox::information( this, message);
218 mView->openCalendar( oldFile ); 281 mView->openCalendar( oldFile );
219 qApp->processEvents(); 282 qApp->processEvents();
220 } 283 }
221 } 284 }
222 mView->saveCalendar( defaultFileName() ); 285 mView->saveCalendar( defaultFileName() );
223 newFile = true; 286 newFile = true;
224 } 287 }
225 288
226 QTime neededSaveTime = QDateTime::currentDateTime().time(); 289 QTime neededSaveTime = QDateTime::currentDateTime().time();
227 mView->openCalendar( defaultFileName() ); 290 mView->openCalendar( defaultFileName() );
228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 291 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
229 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 292 qDebug("KO: Calendar loading time: %d ms",msNeeded );
230 293
231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 294 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
232 KOPrefs::instance()->setAllDefaults(); 295 KOPrefs::instance()->setAllDefaults();
233 int count = mView->addCategories(); 296 int count = mView->addCategories();
234 } 297 }
235 processIncidenceSelection( 0 ); 298 processIncidenceSelection( 0 );
236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 299 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
237 SLOT( processIncidenceSelection( Incidence * ) ) ); 300 SLOT( processIncidenceSelection( Incidence * ) ) );
238 connect( mView, SIGNAL( modifiedChanged( bool ) ), 301 connect( mView, SIGNAL( modifiedChanged( bool ) ),
239 SLOT( slotModifiedChanged( bool ) ) ); 302 SLOT( slotModifiedChanged( bool ) ) );
240 303
241 304
242 connect( mView, SIGNAL( tempDisableBR(bool) ), 305 connect( mView, SIGNAL( tempDisableBR(bool) ),
243 SLOT( disableBR(bool) ) ); 306 SLOT( disableBR(bool) ) );
244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 307 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
245 mView->setModified( false ); 308 mView->setModified( false );
246 mBlockAtStartup = false; 309 mBlockAtStartup = false;
247 mView->setModified( false ); 310 mView->setModified( false );
248 setCentralWidget( mView ); 311 setCentralWidget( mView );
249 globalFlagBlockStartup = 0; 312 globalFlagBlockStartup = 0;
250 mView->show(); 313 mView->show();
251 delete splash; 314 delete splash;
252 if ( newFile ) 315 if ( newFile )
253 mView->updateConfig(); 316 mView->updateConfig();
254 // qApp->processEvents(); 317 // qApp->processEvents();
255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 318 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
256 //fillSyncMenu(); 319 //fillSyncMenu();
257 320
258 321
259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 322 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 323 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 324 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 325 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 326 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( sentSyncFile()); 327 mSyncManager->setDefaultFileName( sentSyncFile());
265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 328 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
266 mSyncManager->fillSyncMenu(); 329 mSyncManager->fillSyncMenu();
267 330
268 331
269 332
270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 333 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
271 if ( showWarning ) { 334 if ( showWarning ) {
272 KMessageBox::information( this, 335 KMessageBox::information( this,
273 "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"); 336 "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");
274 qApp->processEvents(); 337 qApp->processEvents();
275 mView->dialogManager()->showSyncOptions(); 338 mView->dialogManager()->showSyncOptions();
276 } 339 }
277 340
278 //US listen for result adressed from Ka/Pi 341 //US listen for result adressed from Ka/Pi
279#ifndef DESKTOP_VERSION 342#ifndef DESKTOP_VERSION
280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 343 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
281#endif 344#endif
282#ifndef DESKTOP_VERSION 345#ifndef DESKTOP_VERSION
283 infrared = 0; 346 infrared = 0;
284#endif 347#endif
285 updateWeek( mView->startDate() ); 348 updateWeek( mView->startDate() );
286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 349 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
287 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 350 SLOT( updateWeekNum( const KCal::DateList & ) ) );
288 mBRdisabled = false; 351 mBRdisabled = false;
289 //toggleBeamReceive(); 352 //toggleBeamReceive();
290} 353}
291MainWindow::~MainWindow() 354MainWindow::~MainWindow()
292{ 355{
293 //qDebug("MainWindow::~MainWindow() "); 356 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 357 //save toolbar location
295 delete mCalendar; 358 delete mCalendar;
296 delete mSyncManager; 359 delete mSyncManager;
297#ifndef DESKTOP_VERSION 360#ifndef DESKTOP_VERSION
298 if ( infrared ) 361 if ( infrared )
299 delete infrared; 362 delete infrared;
300#endif 363#endif
301 364
302 365
303} 366}
304 367
305void MainWindow::disableBR(bool b) 368void MainWindow::disableBR(bool b)
306{ 369{
307#ifndef DESKTOP_VERSION 370#ifndef DESKTOP_VERSION
308 if ( b ) { 371 if ( b ) {
309 if ( infrared ) { 372 if ( infrared ) {
310 toggleBeamReceive(); 373 toggleBeamReceive();
311 mBRdisabled = true; 374 mBRdisabled = true;
312 } 375 }
313 mBRdisabled = true; 376 mBRdisabled = true;
314 } else { 377 } else {
315 if ( mBRdisabled ) { 378 if ( mBRdisabled ) {
316 mBRdisabled = false; 379 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 380 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 381 // toggleBeamReceive();
319 } 382 }
320 } 383 }
321#endif 384#endif
322 385
323} 386}
324bool MainWindow::beamReceiveEnabled() 387bool MainWindow::beamReceiveEnabled()
325{ 388{
326#ifndef DESKTOP_VERSION 389#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 390 return ( infrared != 0 );
328#endif 391#endif
329 return false; 392 return false;
330} 393}
331 394
332void MainWindow::toggleBeamReceive() 395void MainWindow::toggleBeamReceive()
333{ 396{
334 if ( mBRdisabled ) 397 if ( mBRdisabled )
335 return; 398 return;
336#ifndef DESKTOP_VERSION 399#ifndef DESKTOP_VERSION
337 if ( infrared ) { 400 if ( infrared ) {
338 qDebug("disable BeamReceive "); 401 qDebug("disable BeamReceive ");
339 delete infrared; 402 delete infrared;
340 infrared = 0; 403 infrared = 0;
341 brAction->setOn(false); 404 brAction->setOn(false);
342 return; 405 return;
343 } 406 }
344 qDebug("enable BeamReceive "); 407 qDebug("enable BeamReceive ");
345 brAction->setOn(true); 408 brAction->setOn(true);
346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 409 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& ))); 410 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
348#endif 411#endif
349} 412}
350void MainWindow::showMaximized () 413void MainWindow::showMaximized ()
351{ 414{
352#ifndef DESKTOP_VERSION 415#ifndef DESKTOP_VERSION
353 if ( ! globalFlagBlockStartup ) 416 if ( ! globalFlagBlockStartup )
354 if ( mClosed ) 417 if ( mClosed )
355 mView->goToday(); 418 mView->goToday();
356#endif 419#endif
357 QWidget::showMaximized () ; 420 QWidget::showMaximized () ;
358 mClosed = false; 421 mClosed = false;
@@ -442,870 +505,887 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
442 allmsg = ""; 505 allmsg = "";
443 } else{ 506 } else{
444 msg = allmsg.left( nextC ); 507 msg = allmsg.left( nextC );
445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 508 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
446 } 509 }
447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 510 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
448 if ( msg == "-newEvent" ) { 511 if ( msg == "-newEvent" ) {
449 mView->newEvent(); 512 mView->newEvent();
450 } 513 }
451 if ( msg == "-newTodo" ) { 514 if ( msg == "-newTodo" ) {
452 mView->newTodo(); 515 mView->newTodo();
453 516
454 } 517 }
455 if ( msg == "-showWN" ) { 518 if ( msg == "-showWN" ) {
456 mView->viewManager()->showWhatsNextView(); 519 mView->viewManager()->showWhatsNextView();
457 } 520 }
458 if ( msg == "-showTodo" ) { 521 if ( msg == "-showTodo" ) {
459 mView->viewManager()->showTodoView(); 522 mView->viewManager()->showTodoView();
460 } 523 }
461 if ( msg == "-showList" ) { 524 if ( msg == "-showList" ) {
462 mView->viewManager()->showListView(); 525 mView->viewManager()->showListView();
463 } 526 }
464 else if ( msg == "-showDay" ) { 527 else if ( msg == "-showDay" ) {
465 mView->viewManager()->showDayView(); 528 mView->viewManager()->showDayView();
466 } 529 }
467 else if ( msg == "-showWWeek" ) { 530 else if ( msg == "-showWWeek" ) {
468 mView->viewManager()->showWorkWeekView(); 531 mView->viewManager()->showWorkWeekView();
469 } 532 }
470 else if ( msg == "-ringSync" ) { 533 else if ( msg == "-ringSync" ) {
471 mSyncManager->multiSync( false ); 534 mSyncManager->multiSync( false );
472 } 535 }
473 else if ( msg == "-showWeek" ) { 536 else if ( msg == "-showWeek" ) {
474 mView->viewManager()->showWeekView(); 537 mView->viewManager()->showWeekView();
475 } 538 }
476 else if ( msg == "-showTodo" ) { 539 else if ( msg == "-showTodo" ) {
477 mView->viewManager()->showTodoView(); 540 mView->viewManager()->showTodoView();
478 } 541 }
479 else if ( msg == "-showJournal" ) { 542 else if ( msg == "-showJournal" ) {
480 mView->dateNavigator()->selectDates( 1 ); 543 mView->dateNavigator()->selectDates( 1 );
481 mView->dateNavigator()->selectToday(); 544 mView->dateNavigator()->selectToday();
482 mView->viewManager()->showJournalView(); 545 mView->viewManager()->showJournalView();
483 } 546 }
484 else if ( msg == "-showKO" ) { 547 else if ( msg == "-showKO" ) {
485 mView->viewManager()->showNextXView(); 548 mView->viewManager()->showNextXView();
486 } 549 }
487 else if ( msg == "-showWNext" ) { 550 else if ( msg == "-showWNext" ) {
488 mView->viewManager()->showWhatsNextView(); 551 mView->viewManager()->showWhatsNextView();
489 } 552 }
490 else if ( msg == "nextView()" ) { 553 else if ( msg == "nextView()" ) {
491 mView->viewManager()->showNextView(); 554 mView->viewManager()->showNextView();
492 } 555 }
493 else if ( msg == "-showNextXView" ) { 556 else if ( msg == "-showNextXView" ) {
494 mView->viewManager()->showNextXView(); 557 mView->viewManager()->showNextXView();
495 } 558 }
496 559
497 560
498 } 561 }
499 562
500 showMaximized(); 563 showMaximized();
501 raise(); 564 raise();
502} 565}
503 566
504QPixmap MainWindow::loadPixmap( QString name ) 567QPixmap MainWindow::loadPixmap( QString name )
505{ 568{
506 return SmallIcon( name ); 569 return SmallIcon( name );
507 570
508} 571}
509void MainWindow::initActions() 572void MainWindow::initActions()
510{ 573{
511 //KOPrefs::instance()->mShowFullMenu 574 //KOPrefs::instance()->mShowFullMenu
512 iconToolBar->clear(); 575 iconToolBar->clear();
513 KOPrefs *p = KOPrefs::instance(); 576 KOPrefs *p = KOPrefs::instance();
514 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 577 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
515 578
516 QPopupMenu *viewMenu = new QPopupMenu( this ); 579 QPopupMenu *viewMenu = new QPopupMenu( this );
517 QPopupMenu *actionMenu = new QPopupMenu( this ); 580 QPopupMenu *actionMenu = new QPopupMenu( this );
518 QPopupMenu *importMenu = new QPopupMenu( this ); 581 QPopupMenu *importMenu = new QPopupMenu( this );
519 QPopupMenu *importMenu_X = new QPopupMenu( this ); 582 QPopupMenu *importMenu_X = new QPopupMenu( this );
520 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 583 QPopupMenu *exportMenu_X = new QPopupMenu( this );
521 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 584 QPopupMenu *beamMenu_X = new QPopupMenu( this );
522 selectFilterMenu = new QPopupMenu( this ); 585 selectFilterMenu = new QPopupMenu( this );
523 selectFilterMenu->setCheckable( true ); 586 selectFilterMenu->setCheckable( true );
524 syncMenu = new QPopupMenu( this ); 587 syncMenu = new QPopupMenu( this );
525 configureAgendaMenu = new QPopupMenu( this ); 588 configureAgendaMenu = new QPopupMenu( this );
526 configureToolBarMenu = new QPopupMenu( this ); 589 configureToolBarMenu = new QPopupMenu( this );
527 QPopupMenu *helpMenu = new QPopupMenu( this ); 590 QPopupMenu *helpMenu = new QPopupMenu( this );
528 QIconSet icon; 591 QIconSet icon;
529 int pixWid = 22, pixHei = 22; 592 int pixWid = 22, pixHei = 22;
530 QString pathString = ""; 593 QString pathString = "";
531 if ( !p->mToolBarMiniIcons ) { 594 if ( !p->mToolBarMiniIcons ) {
532 if ( QApplication::desktop()->width() < 480 ) { 595 if ( QApplication::desktop()->width() < 480 ) {
533 pathString += "icons16/"; 596 pathString += "icons16/";
534 pixWid = 18; pixHei = 16; 597 pixWid = 18; pixHei = 16;
535 } 598 }
536 } else { 599 } else {
537 pathString += "iconsmini/"; 600 pathString += "iconsmini/";
538 pixWid = 18; pixHei = 16; 601 pixWid = 18; pixHei = 16;
539 } 602 }
540 if ( KOPrefs::instance()->mShowFullMenu ) { 603 if ( KOPrefs::instance()->mShowFullMenu ) {
541 QMenuBar *menuBar1; 604 QMenuBar *menuBar1;
542 menuBar1 = menuBar(); 605 menuBar1 = menuBar();
543 menuBar1->insertItem( i18n("File"), importMenu ); 606 menuBar1->insertItem( i18n("File"), importMenu );
544 menuBar1->insertItem( i18n("View"), viewMenu ); 607 menuBar1->insertItem( i18n("View"), viewMenu );
545 menuBar1->insertItem( i18n("Actions"), actionMenu ); 608 menuBar1->insertItem( i18n("Actions"), actionMenu );
546#ifdef DESKTOP_VERSION 609#ifdef DESKTOP_VERSION
547 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 610 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
548 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 611 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
549#else 612#else
550 menuBar1->insertItem( i18n("Sync"), syncMenu ); 613 menuBar1->insertItem( i18n("Sync"), syncMenu );
551 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 614 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
552#endif 615#endif
553 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 616 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
554 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 617 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
555 menuBar1->insertItem( i18n("Help"), helpMenu ); 618 menuBar1->insertItem( i18n("Help"), helpMenu );
556 } else { 619 } else {
557 QPEMenuBar *menuBar1; 620 QPEMenuBar *menuBar1;
558 menuBar1 = new QPEMenuBar( iconToolBar ); 621 menuBar1 = new QPEMenuBar( iconToolBar );
559 QPopupMenu *menuBar = new QPopupMenu( this ); 622 QPopupMenu *menuBar = new QPopupMenu( this );
560 icon = loadPixmap( pathString + "z_menu" ); 623 icon = loadPixmap( pathString + "z_menu" );
561 menuBar1->insertItem( icon.pixmap(), menuBar); 624 menuBar1->insertItem( icon.pixmap(), menuBar);
562 //menuBar1->insertItem( i18n("ME"), menuBar); 625 //menuBar1->insertItem( i18n("ME"), menuBar);
563 menuBar->insertItem( i18n("File"), importMenu ); 626 menuBar->insertItem( i18n("File"), importMenu );
564 menuBar->insertItem( i18n("View"), viewMenu ); 627 menuBar->insertItem( i18n("View"), viewMenu );
565 menuBar->insertItem( i18n("Actions"), actionMenu ); 628 menuBar->insertItem( i18n("Actions"), actionMenu );
566 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 629 menuBar->insertItem( i18n("Synchronize"), syncMenu );
567 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 630 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
568 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 631 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
569 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 632 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
570 menuBar->insertItem( i18n("Help"), helpMenu ); 633 menuBar->insertItem( i18n("Help"), helpMenu );
571 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 634 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
572 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 635 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
573 } 636 }
574 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 637 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
575 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 638 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
576 mWeekBgColor = iconToolBar->backgroundColor(); 639 mWeekBgColor = iconToolBar->backgroundColor();
577 mWeekPixmap.resize( pixWid , pixHei ); 640 mWeekPixmap.resize( pixWid , pixHei );
578 mWeekPixmap.fill( mWeekBgColor ); 641 mWeekPixmap.fill( mWeekBgColor );
579 icon = mWeekPixmap; 642 icon = mWeekPixmap;
580 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 643 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
581 if ( p-> mShowIconWeekNum ) 644 if ( p-> mShowIconWeekNum )
582 mWeekAction->addTo( iconToolBar ); 645 mWeekAction->addTo( iconToolBar );
583 mWeekFont = font(); 646 mWeekFont = font();
584 647
585 int fontPoint = mWeekFont.pointSize(); 648 int fontPoint = mWeekFont.pointSize();
586 QFontMetrics f( mWeekFont ); 649 QFontMetrics f( mWeekFont );
587 int fontWid = f.width( "30" ); 650 int fontWid = f.width( "30" );
588 while ( fontWid > pixWid ) { 651 while ( fontWid > pixWid ) {
589 --fontPoint; 652 --fontPoint;
590 mWeekFont.setPointSize( fontPoint ); 653 mWeekFont.setPointSize( fontPoint );
591 QFontMetrics f( mWeekFont ); 654 QFontMetrics f( mWeekFont );
592 fontWid = f.width( "30" ); 655 fontWid = f.width( "30" );
593 //qDebug("dec-- "); 656 //qDebug("dec-- ");
594 } 657 }
595 658
596 connect( mWeekAction, SIGNAL( activated() ), 659 connect( mWeekAction, SIGNAL( activated() ),
597 this, SLOT( weekAction() ) ); 660 this, SLOT( weekAction() ) );
598 661
599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 662 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
600 663
601 //#endif 664 //#endif
602 // ****************** 665 // ******************
603 QAction *action; 666 QAction *action;
604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 667 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
605 configureToolBarMenu->setCheckable( true ); 668 configureToolBarMenu->setCheckable( true );
606 669
607 670
608 configureAgendaMenu->setCheckable( true ); 671 configureAgendaMenu->setCheckable( true );
609 int iii ; 672 int iii ;
610 for ( iii = 1;iii<= 10 ;++iii ){ 673 for ( iii = 1;iii<= 10 ;++iii ){
611 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 674 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
612 } 675 }
613 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 676 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
614 677
615 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 678 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
616 this, SLOT( showConfigureAgenda( ) ) ); 679 this, SLOT( showConfigureAgenda( ) ) );
617 680
618 icon = loadPixmap( pathString + "configure" ); 681 icon = loadPixmap( pathString + "configure" );
619 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 682 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
620 action->addTo( actionMenu ); 683 action->addTo( actionMenu );
621 connect( action, SIGNAL( activated() ), 684 connect( action, SIGNAL( activated() ),
622 mView, SLOT( edit_options() ) ); 685 mView, SLOT( edit_options() ) );
623 actionMenu->insertSeparator(); 686 actionMenu->insertSeparator();
624 687
625 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 688 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
626 action->addTo( actionMenu ); 689 action->addTo( actionMenu );
627 connect( action, SIGNAL( activated() ), 690 connect( action, SIGNAL( activated() ),
628 mView, SLOT( undo_delete() ) ); 691 mView, SLOT( undo_delete() ) );
629 actionMenu->insertSeparator(); 692 actionMenu->insertSeparator();
630 693
631 icon = loadPixmap( pathString + "newevent" ); 694 icon = loadPixmap( pathString + "newevent" );
632 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 695 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
633 configureToolBarMenu->insertSeparator(); 696 configureToolBarMenu->insertSeparator();
697 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
698 configureToolBarMenu->insertSeparator();
634 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 699 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
635 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 700 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
636 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 701 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
637 ne_action->addTo( actionMenu ); 702 ne_action->addTo( actionMenu );
638 connect( ne_action, SIGNAL( activated() ), 703 connect( ne_action, SIGNAL( activated() ),
639 mView, SLOT( newEvent() ) ); 704 mView, SLOT( newEvent() ) );
640 icon = loadPixmap( pathString + "newtodo" ); 705 icon = loadPixmap( pathString + "newtodo" );
641 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 706 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
642 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 707 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
643 nt_action->addTo( actionMenu ); 708 nt_action->addTo( actionMenu );
644 connect( nt_action, SIGNAL( activated() ), 709 connect( nt_action, SIGNAL( activated() ),
645 mView, SLOT( newTodo() ) ); 710 mView, SLOT( newTodo() ) );
646 711
647 icon = loadPixmap( pathString + "today" ); 712 icon = loadPixmap( pathString + "today" );
648 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 713 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
649 today_action->addTo( viewMenu ); 714 today_action->addTo( viewMenu );
650 connect( today_action, SIGNAL( activated() ), 715 connect( today_action, SIGNAL( activated() ),
651 mView, SLOT( goToday() ) ); 716 mView, SLOT( goToday() ) );
652 viewMenu->insertSeparator(); 717 viewMenu->insertSeparator();
653 718
654 icon = loadPixmap( pathString + "navi" ); 719 icon = loadPixmap( pathString + "navi" );
655 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 720 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
656 action->addTo( viewMenu ); 721 action->addTo( viewMenu );
657 connect( action, SIGNAL( activated() ), 722 connect( action, SIGNAL( activated() ),
658 mView, SLOT( toggleDateNavigatorWidget() ) ); 723 mView, SLOT( toggleDateNavigatorWidget() ) );
659 mToggleNav = action ; 724 mToggleNav = action ;
660 icon = loadPixmap( pathString + "filter" ); 725 icon = loadPixmap( pathString + "filter" );
661 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 726 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
662 action->addTo( viewMenu ); 727 action->addTo( viewMenu );
663 connect( action, SIGNAL( activated() ), 728 connect( action, SIGNAL( activated() ),
664 mView, SLOT( toggleFilter() ) ); 729 mView, SLOT( toggleFilter() ) );
665 mToggleFilter = action; 730 mToggleFilter = action;
666 icon = loadPixmap( pathString + "allday" ); 731 icon = loadPixmap( pathString + "allday" );
667 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 732 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
668 action->addTo( viewMenu ); 733 action->addTo( viewMenu );
669 connect( action, SIGNAL( activated() ), 734 connect( action, SIGNAL( activated() ),
670 mView, SLOT( toggleAllDaySize() ) ); 735 mView, SLOT( toggleAllDaySize() ) );
671 mToggleAllday = action; 736 mToggleAllday = action;
672 737
673 738
674 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 739 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
675 mToggleNav, SLOT( setEnabled ( bool ) ) ); 740 mToggleNav, SLOT( setEnabled ( bool ) ) );
676 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 741 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
677 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 742 mToggleFilter, SLOT( setEnabled ( bool ) ) );
678 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 743 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
679 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 744 mToggleAllday, SLOT( setEnabled ( bool ) ) );
680 745
681 viewMenu->insertSeparator(); 746 viewMenu->insertSeparator();
682 icon = loadPixmap( pathString + "picker" ); 747 icon = loadPixmap( pathString + "picker" );
683 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 748 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
684 action->addTo( viewMenu ); 749 action->addTo( viewMenu );
685 connect( action, SIGNAL( activated() ), 750 connect( action, SIGNAL( activated() ),
686 mView, SLOT( showDatePicker() ) ); 751 mView, SLOT( showDatePicker() ) );
687 action->addTo( iconToolBar ); 752 action->addTo( iconToolBar );
688 viewMenu->insertSeparator(); 753 viewMenu->insertSeparator();
689 754
690 755
691 icon = loadPixmap( pathString + "whatsnext" ); 756 icon = loadPixmap( pathString + "whatsnext" );
692 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 757 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
693 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 758 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
694 whatsnext_action->addTo( viewMenu ); 759 whatsnext_action->addTo( viewMenu );
695 connect( whatsnext_action, SIGNAL( activated() ), 760 connect( whatsnext_action, SIGNAL( activated() ),
696 mView->viewManager(), SLOT( showWhatsNextView() ) ); 761 mView->viewManager(), SLOT( showWhatsNextView() ) );
697 762
698 icon = loadPixmap( pathString + "xdays" ); 763 icon = loadPixmap( pathString + "xdays" );
699 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 764 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
700 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 765 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
701 xdays_action->addTo( viewMenu ); 766 xdays_action->addTo( viewMenu );
702 connect( xdays_action, SIGNAL( activated() ), 767 connect( xdays_action, SIGNAL( activated() ),
703 mView->viewManager(), SLOT( showNextXView() ) ); 768 mView->viewManager(), SLOT( showNextXView() ) );
704 769
705 770
706 icon = loadPixmap( pathString + "journal" ); 771 icon = loadPixmap( pathString + "journal" );
707 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 772 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
708 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 773 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
709 viewjournal_action->addTo( viewMenu ); 774 viewjournal_action->addTo( viewMenu );
710 connect( viewjournal_action, SIGNAL( activated() ), 775 connect( viewjournal_action, SIGNAL( activated() ),
711 mView->viewManager(), SLOT( showJournalView() ) ); 776 mView->viewManager(), SLOT( showJournalView() ) );
712 777
713 778
714 icon = loadPixmap( pathString + "day" ); 779 icon = loadPixmap( pathString + "day" );
715 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 780 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
716 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 781 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
717 day1_action->addTo( viewMenu ); 782 day1_action->addTo( viewMenu );
718 // action->addTo( toolBar ); 783 // action->addTo( toolBar );
719 connect( day1_action, SIGNAL( activated() ), 784 connect( day1_action, SIGNAL( activated() ),
720 mView->viewManager(), SLOT( showDayView() ) ); 785 mView->viewManager(), SLOT( showDayView() ) );
721 786
722 icon = loadPixmap( pathString + "workweek" ); 787 icon = loadPixmap( pathString + "workweek" );
723 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 788 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
724 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 789 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
725 day5_action->addTo( viewMenu ); 790 day5_action->addTo( viewMenu );
726 connect( day5_action, SIGNAL( activated() ), 791 connect( day5_action, SIGNAL( activated() ),
727 mView->viewManager(), SLOT( showWorkWeekView() ) ); 792 mView->viewManager(), SLOT( showWorkWeekView() ) );
728 793
729 icon = loadPixmap( pathString + "week" ); 794 icon = loadPixmap( pathString + "week" );
730 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 795 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
731 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 796 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
732 day7_action->addTo( viewMenu ); 797 day7_action->addTo( viewMenu );
733 connect( day7_action, SIGNAL( activated() ), 798 connect( day7_action, SIGNAL( activated() ),
734 mView->viewManager(), SLOT( showWeekView() ) ); 799 mView->viewManager(), SLOT( showWeekView() ) );
735 800
736 icon = loadPixmap( pathString + "workweek2" ); 801 icon = loadPixmap( pathString + "workweek2" );
737 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 802 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
738 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 803 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
739 day6_action->addTo( viewMenu ); 804 day6_action->addTo( viewMenu );
740 connect( day6_action, SIGNAL( activated() ), 805 connect( day6_action, SIGNAL( activated() ),
741 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 806 mView->viewManager(), SLOT( showMonthViewWeek() ) );
742 807
743 icon = loadPixmap( pathString + "month" ); 808 icon = loadPixmap( pathString + "month" );
744 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 809 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
745 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 810 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
746 month_action->addTo( viewMenu ); 811 month_action->addTo( viewMenu );
747 connect( month_action, SIGNAL( activated() ), 812 connect( month_action, SIGNAL( activated() ),
748 mView->viewManager(), SLOT( showMonthView() ) ); 813 mView->viewManager(), SLOT( showMonthView() ) );
749 814
750 icon = loadPixmap( pathString + "list" ); 815 icon = loadPixmap( pathString + "list" );
751 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 816 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
752 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 817 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
753 showlist_action->addTo( viewMenu ); 818 showlist_action->addTo( viewMenu );
754 connect( showlist_action, SIGNAL( activated() ), 819 connect( showlist_action, SIGNAL( activated() ),
755 mView->viewManager(), SLOT( showListView() ) ); 820 mView->viewManager(), SLOT( showListView() ) );
756 821
757 icon = loadPixmap( pathString + "todo" ); 822 icon = loadPixmap( pathString + "todo" );
758 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 823 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
759 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 824 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
760 todoview_action->addTo( viewMenu ); 825 todoview_action->addTo( viewMenu );
761 connect( todoview_action, SIGNAL( activated() ), 826 connect( todoview_action, SIGNAL( activated() ),
762 mView->viewManager(), SLOT( showTodoView() ) ); 827 mView->viewManager(), SLOT( showTodoView() ) );
763 828
764 829
765 830
766#if 0 831#if 0
767 action = new QAction( "view_timespan", "Time Span", 0, this ); 832 action = new QAction( "view_timespan", "Time Span", 0, this );
768 action->addTo( viewMenu ); 833 action->addTo( viewMenu );
769 connect( action, SIGNAL( activated() ), 834 connect( action, SIGNAL( activated() ),
770 mView->viewManager(), SLOT( showTimeSpanView() ) ); 835 mView->viewManager(), SLOT( showTimeSpanView() ) );
771#endif 836#endif
772 837
773 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 838 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
774 this ); 839 this );
775 mNewSubTodoAction->addTo( actionMenu ); 840 mNewSubTodoAction->addTo( actionMenu );
776 connect( mNewSubTodoAction, SIGNAL( activated() ), 841 connect( mNewSubTodoAction, SIGNAL( activated() ),
777 mView, SLOT( newSubTodo() ) ); 842 mView, SLOT( newSubTodo() ) );
778 843
779 actionMenu->insertSeparator(); 844 actionMenu->insertSeparator();
780 845
781 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 846 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
782 mShowAction->addTo( actionMenu ); 847 mShowAction->addTo( actionMenu );
783 connect( mShowAction, SIGNAL( activated() ), 848 connect( mShowAction, SIGNAL( activated() ),
784 mView, SLOT( showIncidence() ) ); 849 mView, SLOT( showIncidence() ) );
785 850
786 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 851 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
787 mEditAction->addTo( actionMenu ); 852 mEditAction->addTo( actionMenu );
788 connect( mEditAction, SIGNAL( activated() ), 853 connect( mEditAction, SIGNAL( activated() ),
789 mView, SLOT( editIncidence() ) ); 854 mView, SLOT( editIncidence() ) );
790 855
791 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 856 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
792 mDeleteAction->addTo( actionMenu ); 857 mDeleteAction->addTo( actionMenu );
793 connect( mDeleteAction, SIGNAL( activated() ), 858 connect( mDeleteAction, SIGNAL( activated() ),
794 mView, SLOT( deleteIncidence() ) ); 859 mView, SLOT( deleteIncidence() ) );
795 860
796 861
797 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 862 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
798 mCloneAction->addTo( actionMenu ); 863 mCloneAction->addTo( actionMenu );
799 connect( mCloneAction, SIGNAL( activated() ), 864 connect( mCloneAction, SIGNAL( activated() ),
800 mView, SLOT( cloneIncidence() ) ); 865 mView, SLOT( cloneIncidence() ) );
801 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 866 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
802 mMoveAction->addTo( actionMenu ); 867 mMoveAction->addTo( actionMenu );
803 connect( mMoveAction, SIGNAL( activated() ), 868 connect( mMoveAction, SIGNAL( activated() ),
804 mView, SLOT( moveIncidence() ) ); 869 mView, SLOT( moveIncidence() ) );
805 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 870 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
806 mBeamAction->addTo( actionMenu ); 871 mBeamAction->addTo( actionMenu );
807 connect( mBeamAction, SIGNAL( activated() ), 872 connect( mBeamAction, SIGNAL( activated() ),
808 mView, SLOT( beamIncidence() ) ); 873 mView, SLOT( beamIncidence() ) );
809 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 874 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
810 mCancelAction->addTo( actionMenu ); 875 mCancelAction->addTo( actionMenu );
811 connect( mCancelAction, SIGNAL( activated() ), 876 connect( mCancelAction, SIGNAL( activated() ),
812 mView, SLOT( toggleCancelIncidence() ) ); 877 mView, SLOT( toggleCancelIncidence() ) );
813 878
814 actionMenu->insertSeparator(); 879 actionMenu->insertSeparator();
815 880
816 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 881 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
817 this ); 882 this );
818 action->addTo( actionMenu ); 883 action->addTo( actionMenu );
819 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 884 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
820 885
821 icon = loadPixmap( pathString + "search" ); 886 icon = loadPixmap( pathString + "search" );
822 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 887 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
823 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 888 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
824 search_action->addTo( actionMenu ); 889 search_action->addTo( actionMenu );
825 connect( search_action, SIGNAL( activated() ), 890 connect( search_action, SIGNAL( activated() ),
826 mView->dialogManager(), SLOT( showSearchDialog() ) ); 891 mView->dialogManager(), SLOT( showSearchDialog() ) );
827 892
828 893
829 894
830 if ( KOPrefs::instance()->mShowFullMenu ) { 895 if ( KOPrefs::instance()->mShowFullMenu ) {
831 actionMenu->insertSeparator(); 896 actionMenu->insertSeparator();
832 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 897 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
833 898
834 } 899 }
835 // actionMenu->insertSeparator(); 900 // actionMenu->insertSeparator();
836 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 901 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
837 this ); 902 this );
838 action->addTo( importMenu_X ); 903 action->addTo( importMenu_X );
839 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 904 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
840 action = new QAction( "import_quick", i18n("Import last file"), 0, 905 action = new QAction( "import_quick", i18n("Import last file"), 0,
841 this ); 906 this );
842 action->addTo( importMenu_X ); 907 action->addTo( importMenu_X );
843 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 908 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
844 importMenu_X->insertSeparator(); 909 importMenu_X->insertSeparator();
845 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 910 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
846 this ); 911 this );
847 action->addTo( importMenu_X ); 912 action->addTo( importMenu_X );
848 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 913 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
849 //#ifndef DESKTOP_VERSION 914 //#ifndef DESKTOP_VERSION
850 importMenu_X->insertSeparator(); 915 importMenu_X->insertSeparator();
851 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 916 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
852 this ); 917 this );
853 action->addTo( importMenu_X ); 918 action->addTo( importMenu_X );
854 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 919 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
855 //#else 920 //#else
856#ifdef _OL_IMPORT_ 921#ifdef _OL_IMPORT_
857 importMenu_X->insertSeparator(); 922 importMenu_X->insertSeparator();
858 action = new QAction( "import_ol", i18n("Import from OL"), 0, 923 action = new QAction( "import_ol", i18n("Import from OL"), 0,
859 this ); 924 this );
860 action->addTo( importMenu_X ); 925 action->addTo( importMenu_X );
861 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 926 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
862#endif 927#endif
863 //#endif 928 //#endif
864 929
865 //importMenu->insertSeparator(); 930 //importMenu->insertSeparator();
866 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 931 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
867 this ); 932 this );
868 action->addTo( importMenu ); 933 action->addTo( importMenu );
869 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 934 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
870 935
871 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 936 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
872 this ); 937 this );
873 action->addTo( importMenu ); 938 action->addTo( importMenu );
874 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 939 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
875 importMenu->insertSeparator(); 940 importMenu->insertSeparator();
876 importMenu->insertItem( i18n("Import"), importMenu_X ); 941 importMenu->insertItem( i18n("Import"), importMenu_X );
877 //importMenu->insertSeparator(); 942 //importMenu->insertSeparator();
878 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 943 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
879 this ); 944 this );
880 action->addTo( exportMenu_X ); 945 action->addTo( exportMenu_X );
881 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 946 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
882 947
883 948
884 //LR 949 //LR
885 QPopupMenu *ex2phone = new QPopupMenu( this ); 950 QPopupMenu *ex2phone = new QPopupMenu( this );
886 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 951 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
887 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 952 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
888 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 953 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
889 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 954 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
890 955
891 importMenu->insertItem( i18n("Export"), exportMenu_X ); 956 importMenu->insertItem( i18n("Export"), exportMenu_X );
892#ifndef DESKTOP_VERSION 957#ifndef DESKTOP_VERSION
893 //importMenu->insertSeparator(); 958 //importMenu->insertSeparator();
894 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 959 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
895 this ); 960 this );
896 brAction->addTo( beamMenu_X ); 961 brAction->addTo( beamMenu_X );
897 brAction->setToggleAction (true ) ; 962 brAction->setToggleAction (true ) ;
898 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 963 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
899 964
900 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 965 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
901 this ); 966 this );
902 action->addTo( beamMenu_X ); 967 action->addTo( beamMenu_X );
903 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 968 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
904 969
905 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 970 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
906 this ); 971 this );
907 action->addTo( beamMenu_X ); 972 action->addTo( beamMenu_X );
908 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 973 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
909 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 974 importMenu->insertItem( i18n("Beam"), beamMenu_X );
910#else 975#else
911 //importMenu->insertSeparator(); 976 //importMenu->insertSeparator();
912 icon = loadPixmap( pathString + "print" ); 977 icon = loadPixmap( pathString + "print" );
913 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 978 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
914 action->addTo( beamMenu_X ); 979 action->addTo( beamMenu_X );
915 connect( action, SIGNAL( activated() ), 980 connect( action, SIGNAL( activated() ),
916 this, SLOT( printCal() ) ); 981 this, SLOT( printCal() ) );
917 982
918 icon = loadPixmap( pathString + "print" ); 983 icon = loadPixmap( pathString + "print" );
919 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 984 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
920 action->addTo( beamMenu_X ); 985 action->addTo( beamMenu_X );
921 connect( action, SIGNAL( activated() ), 986 connect( action, SIGNAL( activated() ),
922 this, SLOT( printSel() ) ); 987 this, SLOT( printSel() ) );
923 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 988 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
924 action->addTo( beamMenu_X ); 989 action->addTo( beamMenu_X );
925 connect( action, SIGNAL( activated() ), 990 connect( action, SIGNAL( activated() ),
926 mView->viewManager(), SIGNAL( printWNV() ) ); 991 mView->viewManager(), SIGNAL( printWNV() ) );
927 importMenu->insertItem( i18n("Print"), beamMenu_X ); 992 importMenu->insertItem( i18n("Print"), beamMenu_X );
928#endif 993#endif
929 importMenu->insertSeparator(); 994 importMenu->insertSeparator();
930 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 995 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
931 this ); 996 this );
932 action->addTo( importMenu ); 997 action->addTo( importMenu );
933 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 998 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
934 importMenu->insertSeparator(); 999 importMenu->insertSeparator();
935 action = new QAction( "beam all", i18n("Save"), 0, 1000 action = new QAction( "beam all", i18n("Save"), 0,
936 this ); 1001 this );
937 action->addTo( importMenu ); 1002 action->addTo( importMenu );
938 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1003 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
939 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1004 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
940 this ); 1005 this );
941 action->addTo( importMenu ); 1006 action->addTo( importMenu );
942 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1007 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
943 1008
944 //menuBar->insertItem( "Configure",configureMenu ); 1009 //menuBar->insertItem( "Configure",configureMenu );
945 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1010 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
946 icon = loadPixmap( "korganizer/korganizer" ); 1011 icon = loadPixmap( "korganizer/korganizer" );
947 1012
948 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1013 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
949 action->addTo( helpMenu ); 1014 action->addTo( helpMenu );
950 connect( action, SIGNAL( activated() ), 1015 connect( action, SIGNAL( activated() ),
951 SLOT( whatsNew() ) ); 1016 SLOT( whatsNew() ) );
952 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1017 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
953 action->addTo( helpMenu ); 1018 action->addTo( helpMenu );
954 connect( action, SIGNAL( activated() ), 1019 connect( action, SIGNAL( activated() ),
955 SLOT( features() ) ); 1020 SLOT( features() ) );
956 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1021 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
957 action->addTo( helpMenu ); 1022 action->addTo( helpMenu );
958 connect( action, SIGNAL( activated() ), 1023 connect( action, SIGNAL( activated() ),
959 SLOT( keyBindings() ) ); 1024 SLOT( keyBindings() ) );
960 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1025 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
961 action->addTo( helpMenu ); 1026 action->addTo( helpMenu );
962 connect( action, SIGNAL( activated() ), 1027 connect( action, SIGNAL( activated() ),
963 SLOT( synchowto() ) ); 1028 SLOT( synchowto() ) );
964 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1029 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
965 action->addTo( helpMenu ); 1030 action->addTo( helpMenu );
966 connect( action, SIGNAL( activated() ), 1031 connect( action, SIGNAL( activated() ),
967 SLOT( kdesynchowto() ) ); 1032 SLOT( kdesynchowto() ) );
968 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1033 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
969 action->addTo( helpMenu ); 1034 action->addTo( helpMenu );
970 connect( action, SIGNAL( activated() ), 1035 connect( action, SIGNAL( activated() ),
971 SLOT( multisynchowto() ) ); 1036 SLOT( multisynchowto() ) );
972 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1037 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
973 action->addTo( helpMenu ); 1038 action->addTo( helpMenu );
974 connect( action, SIGNAL( activated() ), 1039 connect( action, SIGNAL( activated() ),
975 SLOT( aboutAutoSaving() ) ); 1040 SLOT( aboutAutoSaving() ) );
976 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1041 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
977 action->addTo( helpMenu ); 1042 action->addTo( helpMenu );
978 connect( action, SIGNAL( activated() ), 1043 connect( action, SIGNAL( activated() ),
979 SLOT( aboutKnownBugs() ) ); 1044 SLOT( aboutKnownBugs() ) );
980 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1045 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
981 action->addTo( helpMenu ); 1046 action->addTo( helpMenu );
982 connect( action, SIGNAL( activated() ), 1047 connect( action, SIGNAL( activated() ),
983 SLOT( usertrans() ) ); 1048 SLOT( usertrans() ) );
984 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1049 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
985 action->addTo( helpMenu ); 1050 action->addTo( helpMenu );
986 connect( action, SIGNAL( activated() ), 1051 connect( action, SIGNAL( activated() ),
987 SLOT( faq() ) ); 1052 SLOT( faq() ) );
988 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1053 action = new QAction( "licence", i18n("Licence..."), 0, this );
989 action->addTo( helpMenu ); 1054 action->addTo( helpMenu );
990 connect( action, SIGNAL( activated() ), 1055 connect( action, SIGNAL( activated() ),
991 SLOT( licence() ) ); 1056 SLOT( licence() ) );
992 action = new QAction( "about", i18n("About..."), 0, this ); 1057 action = new QAction( "about", i18n("About..."), 0, this );
993 action->addTo( helpMenu ); 1058 action->addTo( helpMenu );
994 connect( action, SIGNAL( activated() ), 1059 connect( action, SIGNAL( activated() ),
995 SLOT( about() ) ); 1060 SLOT( about() ) );
996 //menuBar->insertSeparator(); 1061 //menuBar->insertSeparator();
997 1062
998 // ****************************************************** 1063 // ******************************************************
999 // menubar icons 1064 // menubar icons
1000 1065
1001 1066
1002 iconToolBar->setHorizontalStretchable (true ); 1067
1003 //menuBar->insertItem( iconToolBar ); 1068 //menuBar->insertItem( iconToolBar );
1004 //xdays_action 1069 //xdays_action
1005 if (p-> mShowIconNewEvent) 1070 if (p-> mShowIconNewEvent)
1006 ne_action->addTo( iconToolBar ); 1071 ne_action->addTo( iconToolBar );
1007 if (p->mShowIconNewTodo ) 1072 if (p->mShowIconNewTodo )
1008 nt_action->addTo( iconToolBar ); 1073 nt_action->addTo( iconToolBar );
1009 if (p-> mShowIconSearch) 1074 if (p-> mShowIconSearch)
1010 search_action->addTo( iconToolBar ); 1075 search_action->addTo( iconToolBar );
1011 if (p-> mShowIconWhatsThis) 1076 if (p-> mShowIconWhatsThis)
1012 QWhatsThis::whatsThisButton ( iconToolBar ); 1077 QWhatsThis::whatsThisButton ( iconToolBar );
1013 if (p-> mShowIconNext) 1078 if (p-> mShowIconNext)
1014 whatsnext_action->addTo( iconToolBar ); 1079 whatsnext_action->addTo( viewToolBar );
1015 if (p-> mShowIconNextDays) 1080 if (p-> mShowIconNextDays)
1016 xdays_action->addTo( iconToolBar ); 1081 xdays_action->addTo( viewToolBar );
1017 if (p-> mShowIconJournal) 1082 if (p-> mShowIconJournal)
1018 viewjournal_action->addTo( iconToolBar ); 1083 viewjournal_action->addTo( viewToolBar );
1019 if (p-> mShowIconDay1) 1084 if (p-> mShowIconDay1)
1020 day1_action->addTo( iconToolBar ); 1085 day1_action->addTo( viewToolBar );
1021 if (p-> mShowIconDay5) 1086 if (p-> mShowIconDay5)
1022 day5_action->addTo( iconToolBar ); 1087 day5_action->addTo( viewToolBar );
1023 if (p-> mShowIconDay7) 1088 if (p-> mShowIconDay7)
1024 day7_action->addTo( iconToolBar ); 1089 day7_action->addTo( viewToolBar );
1025 if (p-> mShowIconDay6) 1090 if (p-> mShowIconDay6)
1026 day6_action->addTo( iconToolBar ); 1091 day6_action->addTo( viewToolBar );
1027 if (p-> mShowIconMonth) 1092 if (p-> mShowIconMonth)
1028 month_action->addTo( iconToolBar ); 1093 month_action->addTo( viewToolBar );
1029 if (p-> mShowIconList) 1094 if (p-> mShowIconList)
1030 showlist_action->addTo( iconToolBar ); 1095 showlist_action->addTo( viewToolBar );
1031 if (p-> mShowIconTodoview) 1096 if (p-> mShowIconTodoview)
1032 todoview_action->addTo( iconToolBar ); 1097 todoview_action->addTo( viewToolBar );
1033 1098
1034 icon = loadPixmap( pathString + "2leftarrowB" ); 1099 icon = loadPixmap( pathString + "2leftarrowB" );
1035 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1100 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1036 if (p-> mShowIconBackFast) { 1101 if (p-> mShowIconBackFast) {
1037 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1102 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1038 connect( action, SIGNAL( activated() ), 1103 connect( action, SIGNAL( activated() ),
1039 mView, SLOT( goPreviousMonth() ) ); 1104 mView, SLOT( goPreviousMonth() ) );
1040 action->addTo( iconToolBar ); 1105 action->addTo( navigatorToolBar );
1041 } 1106 }
1042 icon = loadPixmap( pathString + "1leftarrowB" ); 1107 icon = loadPixmap( pathString + "1leftarrowB" );
1043 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1108 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1044 if (p-> mShowIconBack) { 1109 if (p-> mShowIconBack) {
1045 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1110 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1046 connect( action, SIGNAL( activated() ), 1111 connect( action, SIGNAL( activated() ),
1047 mView, SLOT( goPrevious() ) ); 1112 mView, SLOT( goPrevious() ) );
1048 action->addTo( iconToolBar ); 1113 action->addTo( navigatorToolBar );
1049 } 1114 }
1050 icon = loadPixmap( pathString + "today" ); 1115 icon = loadPixmap( pathString + "today" );
1051 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1116 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1052 if (p-> mShowIconToday) 1117 if (p-> mShowIconToday)
1053 today_action->addTo( iconToolBar ); 1118 today_action->addTo( navigatorToolBar );
1054 icon = loadPixmap( pathString + "1rightarrowB" ); 1119 icon = loadPixmap( pathString + "1rightarrowB" );
1055 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1120 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1056 if (p-> mShowIconForward) { 1121 if (p-> mShowIconForward) {
1057 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1122 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1058 connect( action, SIGNAL( activated() ), 1123 connect( action, SIGNAL( activated() ),
1059 mView, SLOT( goNext() ) ); 1124 mView, SLOT( goNext() ) );
1060 action->addTo( iconToolBar ); 1125 action->addTo( navigatorToolBar );
1061 } 1126 }
1062 icon = loadPixmap( pathString + "2rightarrowB" ); 1127 icon = loadPixmap( pathString + "2rightarrowB" );
1063 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1128 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1064 if (p-> mShowIconForwardFast) { 1129 if (p-> mShowIconForwardFast) {
1065 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1130 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1066 connect( action, SIGNAL( activated() ), 1131 connect( action, SIGNAL( activated() ),
1067 mView, SLOT( goNextMonth() ) ); 1132 mView, SLOT( goNextMonth() ) );
1068 action->addTo( iconToolBar ); 1133 action->addTo( navigatorToolBar );
1069 } 1134 }
1070 1135
1071 1136
1072 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1137 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1073 1138
1074 if (p-> mShowIconNewEvent) 1139 if (p-> mShowIconNewEvent)
1075 configureToolBarMenu->setItemChecked( 10, true ); 1140 configureToolBarMenu->setItemChecked( 10, true );
1076 if (p->mShowIconNewTodo ) 1141 if (p->mShowIconNewTodo )
1077 configureToolBarMenu->setItemChecked( 20, true ); 1142 configureToolBarMenu->setItemChecked( 20, true );
1078 if (p-> mShowIconSearch) 1143 if (p-> mShowIconSearch)
1079 configureToolBarMenu->setItemChecked( 120, true ); 1144 configureToolBarMenu->setItemChecked( 120, true );
1080 if (p-> mShowIconList) 1145 if (p-> mShowIconList)
1081 configureToolBarMenu->setItemChecked( 30, true ); 1146 configureToolBarMenu->setItemChecked( 30, true );
1082 if (p-> mShowIconDay1) 1147 if (p-> mShowIconDay1)
1083 configureToolBarMenu->setItemChecked( 40, true ); 1148 configureToolBarMenu->setItemChecked( 40, true );
1084 if (p-> mShowIconDay5) 1149 if (p-> mShowIconDay5)
1085 configureToolBarMenu->setItemChecked( 50, true ); 1150 configureToolBarMenu->setItemChecked( 50, true );
1086 if (p-> mShowIconDay6) 1151 if (p-> mShowIconDay6)
1087 configureToolBarMenu->setItemChecked( 75, true ); 1152 configureToolBarMenu->setItemChecked( 75, true );
1088 if (p-> mShowIconDay7) 1153 if (p-> mShowIconDay7)
1089 configureToolBarMenu->setItemChecked( 60, true ); 1154 configureToolBarMenu->setItemChecked( 60, true );
1090 if (p-> mShowIconMonth) 1155 if (p-> mShowIconMonth)
1091 configureToolBarMenu->setItemChecked( 70, true ); 1156 configureToolBarMenu->setItemChecked( 70, true );
1092 if (p-> mShowIconTodoview) 1157 if (p-> mShowIconTodoview)
1093 configureToolBarMenu->setItemChecked( 80, true ); 1158 configureToolBarMenu->setItemChecked( 80, true );
1094 if (p-> mShowIconBackFast) 1159 if (p-> mShowIconBackFast)
1095 configureToolBarMenu->setItemChecked( 200, true ); 1160 configureToolBarMenu->setItemChecked( 200, true );
1096 if (p-> mShowIconBack) 1161 if (p-> mShowIconBack)
1097 configureToolBarMenu->setItemChecked( 210, true ); 1162 configureToolBarMenu->setItemChecked( 210, true );
1098 if (p-> mShowIconToday) 1163 if (p-> mShowIconToday)
1099 configureToolBarMenu->setItemChecked( 130, true ); 1164 configureToolBarMenu->setItemChecked( 130, true );
1100 if (p-> mShowIconForward) 1165 if (p-> mShowIconForward)
1101 configureToolBarMenu->setItemChecked( 220, true ); 1166 configureToolBarMenu->setItemChecked( 220, true );
1102 if (p-> mShowIconForwardFast) 1167 if (p-> mShowIconForwardFast)
1103 configureToolBarMenu->setItemChecked( 230, true ); 1168 configureToolBarMenu->setItemChecked( 230, true );
1104 if (p-> mShowIconNextDays) 1169 if (p-> mShowIconNextDays)
1105 configureToolBarMenu->setItemChecked( 100, true ); 1170 configureToolBarMenu->setItemChecked( 100, true );
1106 if (p-> mShowIconNext) 1171 if (p-> mShowIconNext)
1107 configureToolBarMenu->setItemChecked( 110, true ); 1172 configureToolBarMenu->setItemChecked( 110, true );
1108 if (p-> mShowIconJournal) 1173 if (p-> mShowIconJournal)
1109 configureToolBarMenu->setItemChecked( 90, true ); 1174 configureToolBarMenu->setItemChecked( 90, true );
1110 if (p-> mShowIconWhatsThis) 1175 if (p-> mShowIconWhatsThis)
1111 configureToolBarMenu->setItemChecked( 300, true ); 1176 configureToolBarMenu->setItemChecked( 300, true );
1112 if (p-> mShowIconWeekNum) 1177 if (p-> mShowIconWeekNum)
1113 configureToolBarMenu->setItemChecked( 400, true ); 1178 configureToolBarMenu->setItemChecked( 400, true );
1114 QLabel* dummy = new QLabel( iconToolBar ); 1179 if (!p-> mShowIconStretch) {
1115 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1180 QLabel* dummy = new QLabel( iconToolBar );
1116 if (!p-> mShowIconStretch) 1181 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1182 dummy->setMinimumWidth( 0 );
1117 iconToolBar->setStretchableWidget ( dummy ) ; 1183 iconToolBar->setStretchableWidget ( dummy ) ;
1118 else 1184 }
1185 else {
1186 iconToolBar->setHorizontalStretchable (true );
1187 viewToolBar->setHorizontalStretchable (true );
1188 navigatorToolBar->setHorizontalStretchable (true );
1189 iconToolBar->setVerticalStretchable (true );
1190 viewToolBar->setVerticalStretchable (true );
1191 navigatorToolBar->setVerticalStretchable (true );
1119 configureToolBarMenu->setItemChecked( 5, true ); 1192 configureToolBarMenu->setItemChecked( 5, true );
1193 }
1194 if (p-> mShowIconFilter)
1195 configureToolBarMenu->setItemChecked( 7, true );
1196
1197
1198 if ( filterMenubar )
1199 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1120 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1200 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1121 configureAgenda( p->mHourSize ); 1201 configureAgenda( p->mHourSize );
1122 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1202 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1123} 1203}
1124 1204
1125void MainWindow::exportToPhone( int mode ) 1205void MainWindow::exportToPhone( int mode )
1126{ 1206{
1127 1207
1128 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1208 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1129 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1209 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1130 KOex2phonePrefs ex2phone; 1210 KOex2phonePrefs ex2phone;
1131 1211
1132 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1212 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1133 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1213 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1134 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1214 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1135 if ( mode == 1 ) 1215 if ( mode == 1 )
1136 ex2phone.setCaption(i18n("Export complete calendar")); 1216 ex2phone.setCaption(i18n("Export complete calendar"));
1137 if ( mode == 2 ) 1217 if ( mode == 2 )
1138 ex2phone.setCaption(i18n("Export filtered calendar")); 1218 ex2phone.setCaption(i18n("Export filtered calendar"));
1139 1219
1140 if ( !ex2phone.exec() ) { 1220 if ( !ex2phone.exec() ) {
1141 return; 1221 return;
1142 } 1222 }
1143 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1223 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1144 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1224 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1145 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1225 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1146 1226
1147 int inFuture = 0; 1227 int inFuture = 0;
1148 if ( ex2phone.mWriteBackFuture->isChecked() ) 1228 if ( ex2phone.mWriteBackFuture->isChecked() )
1149 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1229 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1150 QPtrList<Incidence> delSel; 1230 QPtrList<Incidence> delSel;
1151 if ( mode == 1 ) 1231 if ( mode == 1 )
1152 delSel = mCalendar->rawIncidences(); 1232 delSel = mCalendar->rawIncidences();
1153 if ( mode == 2 ) 1233 if ( mode == 2 )
1154 delSel = mCalendar->incidences(); 1234 delSel = mCalendar->incidences();
1155 CalendarLocal* cal = new CalendarLocal(); 1235 CalendarLocal* cal = new CalendarLocal();
1156 cal->setLocalTime(); 1236 cal->setLocalTime();
1157 Incidence *incidence = delSel.first(); 1237 Incidence *incidence = delSel.first();
1158 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1238 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1159 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1239 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1160 while ( incidence ) { 1240 while ( incidence ) {
1161 if ( incidence->type() != "Journal" ) { 1241 if ( incidence->type() != "Journal" ) {
1162 bool add = true; 1242 bool add = true;
1163 if ( inFuture ) { 1243 if ( inFuture ) {
1164 QDateTime dt; 1244 QDateTime dt;
1165 if ( incidence->type() == "Todo" ) { 1245 if ( incidence->type() == "Todo" ) {
1166 Todo * t = (Todo*)incidence; 1246 Todo * t = (Todo*)incidence;
1167 if ( t->hasDueDate() ) 1247 if ( t->hasDueDate() )
1168 dt = t->dtDue(); 1248 dt = t->dtDue();
1169 else 1249 else
1170 dt = cur.addSecs( 62 ); 1250 dt = cur.addSecs( 62 );
1171 } 1251 }
1172 else { 1252 else {
1173 bool ok; 1253 bool ok;
1174 dt = incidence->getNextOccurence( cur, &ok ); 1254 dt = incidence->getNextOccurence( cur, &ok );
1175 if ( !ok ) 1255 if ( !ok )
1176 dt = cur.addSecs( -62 ); 1256 dt = cur.addSecs( -62 );
1177 } 1257 }
1178 if ( dt < cur || dt > end ) { 1258 if ( dt < cur || dt > end ) {
1179 add = false; 1259 add = false;
1180 } 1260 }
1181 } 1261 }
1182 if ( add ) { 1262 if ( add ) {
1183 Incidence *in = incidence->clone(); 1263 Incidence *in = incidence->clone();
1184 cal->addIncidence( in ); 1264 cal->addIncidence( in );
1185 } 1265 }
1186 } 1266 }
1187 incidence = delSel.next(); 1267 incidence = delSel.next();
1188 } 1268 }
1189 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1269 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1190 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1270 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1191 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1271 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1192 1272
1193 setCaption( i18n("Writing to phone...")); 1273 setCaption( i18n("Writing to phone..."));
1194 if ( PhoneFormat::writeToPhone( cal ) ) 1274 if ( PhoneFormat::writeToPhone( cal ) )
1195 setCaption( i18n("Export to phone successful!")); 1275 setCaption( i18n("Export to phone successful!"));
1196 else 1276 else
1197 setCaption( i18n("Error exporting to phone!")); 1277 setCaption( i18n("Error exporting to phone!"));
1198 delete cal; 1278 delete cal;
1199} 1279}
1200 1280
1201 1281
1202void MainWindow::setDefaultPreferences() 1282void MainWindow::setDefaultPreferences()
1203{ 1283{
1204 KOPrefs *p = KOPrefs::instance(); 1284 KOPrefs *p = KOPrefs::instance();
1205 1285
1206 p->mCompactDialogs = true; 1286 p->mCompactDialogs = true;
1207 p->mConfirm = true; 1287 p->mConfirm = true;
1208 // p->mEnableQuickTodo = false; 1288 // p->mEnableQuickTodo = false;
1209 1289
1210} 1290}
1211 1291
1212QString MainWindow::resourcePath() 1292QString MainWindow::resourcePath()
1213{ 1293{
1214 return KGlobal::iconLoader()->iconPath(); 1294 return KGlobal::iconLoader()->iconPath();
1215} 1295}
1216 1296
1217void MainWindow::displayText( QString text ,QString cap ) 1297void MainWindow::displayText( QString text ,QString cap )
1218{ 1298{
1219 QDialog dia( this, "name", true ); ; 1299 QDialog dia( this, "name", true ); ;
1220 dia.setCaption( cap ); 1300 dia.setCaption( cap );
1221 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1301 QVBoxLayout* lay = new QVBoxLayout( &dia );
1222 lay->setSpacing( 3 ); 1302 lay->setSpacing( 3 );
1223 lay->setMargin( 3 ); 1303 lay->setMargin( 3 );
1224 QTextBrowser tb ( &dia ); 1304 QTextBrowser tb ( &dia );
1225 lay->addWidget( &tb ); 1305 lay->addWidget( &tb );
1226 tb.setText( text ); 1306 tb.setText( text );
1227#ifdef DESKTOP_VERSION 1307#ifdef DESKTOP_VERSION
1228 dia.resize( 640, 480); 1308 dia.resize( 640, 480);
1229#else 1309#else
1230 dia.showMaximized(); 1310 dia.showMaximized();
1231#endif 1311#endif
1232 dia.exec(); 1312 dia.exec();
1233} 1313}
1234 1314
1235void MainWindow::features() 1315void MainWindow::features()
1236{ 1316{
1237 1317
1238 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1318 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1239} 1319}
1240 1320
1241void MainWindow::usertrans() 1321void MainWindow::usertrans()
1242{ 1322{
1243 1323
1244 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1324 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1245} 1325}
1246 1326
1247void MainWindow::kdesynchowto() 1327void MainWindow::kdesynchowto()
1248{ 1328{
1249 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1329 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1250} 1330}
1251void MainWindow::multisynchowto() 1331void MainWindow::multisynchowto()
1252{ 1332{
1253 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1333 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1254} 1334}
1255void MainWindow::synchowto() 1335void MainWindow::synchowto()
1256{ 1336{
1257 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1337 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1258} 1338}
1259void MainWindow::faq() 1339void MainWindow::faq()
1260{ 1340{
1261 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1341 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1262 1342
1263} 1343}
1264void MainWindow::whatsNew() 1344void MainWindow::whatsNew()
1265{ 1345{
1266 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1346 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1267 1347
1268} 1348}
1269void MainWindow::licence() 1349void MainWindow::licence()
1270{ 1350{
1271 KApplication::showLicence(); 1351 KApplication::showLicence();
1272 1352
1273} 1353}
1274void MainWindow::about() 1354void MainWindow::about()
1275{ 1355{
1276 QString version; 1356 QString version;
1277#include <../version> 1357#include <../version>
1278 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1358 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1279 i18n("KOrganizer/Platform-independent\n") + 1359 i18n("KOrganizer/Platform-independent\n") +
1280 "(KO/Pi) " + version + " - " + 1360 "(KO/Pi) " + version + " - " +
1281 1361
1282#ifdef DESKTOP_VERSION 1362#ifdef DESKTOP_VERSION
1283 i18n("Desktop Edition\n") + 1363 i18n("Desktop Edition\n") +
1284#else 1364#else
1285 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1365 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1286#endif 1366#endif
1287 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1367 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1288} 1368}
1289void MainWindow::keyBindings() 1369void MainWindow::keyBindings()
1290{ 1370{
1291 QString cap = i18n("KO/Pi Keys + Colors"); 1371 QString cap = i18n("KO/Pi Keys + Colors");
1292 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1372 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1293 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1373 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1294 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1374 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1295 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1375 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1296 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1376 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1297 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1377 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1298 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1378 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1299 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1379 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1300 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1380 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1301 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1381 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1302 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1382 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1303 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1383 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1304 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1384 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1305 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1385 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1306 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1386 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1307 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1387 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1308 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1388 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1309 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1389 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1310 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1390 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1311 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1391 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
@@ -1372,669 +1452,727 @@ QString MainWindow::defaultFileName()
1372{ 1452{
1373 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1453 return locateLocal( "data", "korganizer/mycalendar.ics" );
1374} 1454}
1375QString MainWindow::syncFileName() 1455QString MainWindow::syncFileName()
1376{ 1456{
1377#ifdef DESKTOP_VERSION 1457#ifdef DESKTOP_VERSION
1378 return locateLocal( "tmp", "synccalendar.ics" ); 1458 return locateLocal( "tmp", "synccalendar.ics" );
1379#else 1459#else
1380 return QString( "/tmp/synccalendar.ics" ); 1460 return QString( "/tmp/synccalendar.ics" );
1381#endif 1461#endif
1382} 1462}
1383void MainWindow::updateWeek(QDate seda) 1463void MainWindow::updateWeek(QDate seda)
1384{ 1464{
1385 int weekNum = 0; 1465 int weekNum = 0;
1386 QDate d = QDate ( seda.year(), 1,1); 1466 QDate d = QDate ( seda.year(), 1,1);
1387 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1467 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1388 if ( seda.addDays(6).year() != seda.year() ) { 1468 if ( seda.addDays(6).year() != seda.year() ) {
1389 if ( seda.year() != d.year() ) { 1469 if ( seda.year() != d.year() ) {
1390 if ( d.dayOfWeek() > 4 ) 1470 if ( d.dayOfWeek() > 4 )
1391 d = QDate ( seda.year(), 1,1); 1471 d = QDate ( seda.year(), 1,1);
1392 else 1472 else
1393 weekNum = 1; 1473 weekNum = 1;
1394 } else { 1474 } else {
1395 QDate dd( seda.year()+1, 1,1); 1475 QDate dd( seda.year()+1, 1,1);
1396 if ( dd.dayOfWeek() <= 4 ) 1476 if ( dd.dayOfWeek() <= 4 )
1397 weekNum = 1; 1477 weekNum = 1;
1398 } 1478 }
1399 } 1479 }
1400 if ( weekNum == 0 ){ 1480 if ( weekNum == 0 ){
1401 int dow = d.dayOfWeek(); 1481 int dow = d.dayOfWeek();
1402 if ( dow <= 4 ) 1482 if ( dow <= 4 )
1403 d = d.addDays( 1-dow ); 1483 d = d.addDays( 1-dow );
1404 else // 5,6,7 1484 else // 5,6,7
1405 d = d.addDays( 8-dow ); 1485 d = d.addDays( 8-dow );
1406 // we have the first week of the year.we are on monday 1486 // we have the first week of the year.we are on monday
1407 weekNum = d.daysTo( seda ) / 7 +1; 1487 weekNum = d.daysTo( seda ) / 7 +1;
1408 } 1488 }
1409 1489
1410 mWeekPixmap.fill( mWeekBgColor ); 1490 mWeekPixmap.fill( mWeekBgColor );
1411 QPainter p ( &mWeekPixmap ); 1491 QPainter p ( &mWeekPixmap );
1412 p.setFont( mWeekFont ); 1492 p.setFont( mWeekFont );
1413 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1493 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1414 p.end(); 1494 p.end();
1415 QIconSet icon3 ( mWeekPixmap ); 1495 QIconSet icon3 ( mWeekPixmap );
1416 mWeekAction->setIconSet ( icon3 ); 1496 mWeekAction->setIconSet ( icon3 );
1417 1497
1418} 1498}
1419void MainWindow::updateWeekNum(const DateList &selectedDates) 1499void MainWindow::updateWeekNum(const DateList &selectedDates)
1420{ 1500{
1421 updateWeek( selectedDates.first() ); 1501 updateWeek( selectedDates.first() );
1422} 1502}
1423void MainWindow::processIncidenceSelection( Incidence *incidence ) 1503void MainWindow::processIncidenceSelection( Incidence *incidence )
1424{ 1504{
1425 1505
1426 if ( !incidence ) { 1506 if ( !incidence ) {
1427 enableIncidenceActions( false ); 1507 enableIncidenceActions( false );
1428 1508
1429 mNewSubTodoAction->setEnabled( false ); 1509 mNewSubTodoAction->setEnabled( false );
1430 setCaptionToDates(); 1510 setCaptionToDates();
1431 return; 1511 return;
1432 1512
1433 } 1513 }
1434 1514
1435 //KGlobal::locale()->formatDateTime(nextA, true); 1515 //KGlobal::locale()->formatDateTime(nextA, true);
1436 QString startString = ""; 1516 QString startString = "";
1437 if ( incidence->type() != "Todo" ) { 1517 if ( incidence->type() != "Todo" ) {
1438 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1518 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1439 if ( incidence->doesFloat() ) { 1519 if ( incidence->doesFloat() ) {
1440 startString += ": "+incidence->dtStartDateStr( true ); 1520 startString += ": "+incidence->dtStartDateStr( true );
1441 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1521 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1442 1522
1443 } else { 1523 } else {
1444 startString = ": "+incidence->dtStartStr(true); 1524 startString = ": "+incidence->dtStartStr(true);
1445 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1525 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1446 1526
1447 } 1527 }
1448 1528
1449 } else { 1529 } else {
1450 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1530 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1451 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1531 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1452 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1532 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1453 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1533 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1454 bool ok; 1534 bool ok;
1455 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1535 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1456 if ( ok ) { 1536 if ( ok ) {
1457 int years = noc.date().year() - incidence->dtStart().date().year(); 1537 int years = noc.date().year() - incidence->dtStart().date().year();
1458 startString += i18n(" (%1 y.)"). arg( years ); 1538 startString += i18n(" (%1 y.)"). arg( years );
1459 } 1539 }
1460 } 1540 }
1461 else 1541 else
1462 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1542 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1463 } 1543 }
1464 1544
1465 } 1545 }
1466 else 1546 else
1467 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1547 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1468 if ( !incidence->location().isEmpty() ) 1548 if ( !incidence->location().isEmpty() )
1469 startString += " (" +incidence->location()+")"; 1549 startString += " (" +incidence->location()+")";
1470 setCaption( incidence->summary()+startString); 1550 setCaption( incidence->summary()+startString);
1471 1551
1472 enableIncidenceActions( true ); 1552 enableIncidenceActions( true );
1473 1553
1474 if ( incidence->type() == "Event" ) { 1554 if ( incidence->type() == "Event" ) {
1475 mShowAction->setText( i18n("Show Event...") ); 1555 mShowAction->setText( i18n("Show Event...") );
1476 mEditAction->setText( i18n("Edit Event...") ); 1556 mEditAction->setText( i18n("Edit Event...") );
1477 mDeleteAction->setText( i18n("Delete Event...") ); 1557 mDeleteAction->setText( i18n("Delete Event...") );
1478 1558
1479 mNewSubTodoAction->setEnabled( false ); 1559 mNewSubTodoAction->setEnabled( false );
1480 } else if ( incidence->type() == "Todo" ) { 1560 } else if ( incidence->type() == "Todo" ) {
1481 mShowAction->setText( i18n("Show Todo...") ); 1561 mShowAction->setText( i18n("Show Todo...") );
1482 mEditAction->setText( i18n("Edit Todo...") ); 1562 mEditAction->setText( i18n("Edit Todo...") );
1483 mDeleteAction->setText( i18n("Delete Todo...") ); 1563 mDeleteAction->setText( i18n("Delete Todo...") );
1484 1564
1485 mNewSubTodoAction->setEnabled( true ); 1565 mNewSubTodoAction->setEnabled( true );
1486 } else { 1566 } else {
1487 mShowAction->setText( i18n("Show...") ); 1567 mShowAction->setText( i18n("Show...") );
1488 mShowAction->setText( i18n("Edit...") ); 1568 mShowAction->setText( i18n("Edit...") );
1489 mShowAction->setText( i18n("Delete...") ); 1569 mShowAction->setText( i18n("Delete...") );
1490 1570
1491 mNewSubTodoAction->setEnabled( false ); 1571 mNewSubTodoAction->setEnabled( false );
1492 } 1572 }
1493} 1573}
1494 1574
1495void MainWindow::enableIncidenceActions( bool enabled ) 1575void MainWindow::enableIncidenceActions( bool enabled )
1496{ 1576{
1497 mShowAction->setEnabled( enabled ); 1577 mShowAction->setEnabled( enabled );
1498 mEditAction->setEnabled( enabled ); 1578 mEditAction->setEnabled( enabled );
1499 mDeleteAction->setEnabled( enabled ); 1579 mDeleteAction->setEnabled( enabled );
1500 1580
1501 mCloneAction->setEnabled( enabled ); 1581 mCloneAction->setEnabled( enabled );
1502 mMoveAction->setEnabled( enabled ); 1582 mMoveAction->setEnabled( enabled );
1503 mBeamAction->setEnabled( enabled ); 1583 mBeamAction->setEnabled( enabled );
1504 mCancelAction->setEnabled( enabled ); 1584 mCancelAction->setEnabled( enabled );
1505} 1585}
1506 1586
1507void MainWindow::importOL() 1587void MainWindow::importOL()
1508{ 1588{
1509#ifdef _OL_IMPORT_ 1589#ifdef _OL_IMPORT_
1510 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1590 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1511 id->exec(); 1591 id->exec();
1512 delete id; 1592 delete id;
1513 mView->updateView(); 1593 mView->updateView();
1514#endif 1594#endif
1515} 1595}
1516void MainWindow::importBday() 1596void MainWindow::importBday()
1517{ 1597{
1518 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1598 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1519 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1599 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1520 i18n("Import!"), i18n("Cancel"), 0, 1600 i18n("Import!"), i18n("Cancel"), 0,
1521 0, 1 ); 1601 0, 1 );
1522 if ( result == 0 ) { 1602 if ( result == 0 ) {
1523 mView->importBday(); 1603 mView->importBday();
1524 1604
1525 } 1605 }
1526 1606
1527 1607
1528} 1608}
1529void MainWindow::importQtopia() 1609void MainWindow::importQtopia()
1530{ 1610{
1531 //#ifndef DESKTOP_VERSION 1611 //#ifndef DESKTOP_VERSION
1532 QString mess = 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"); 1612 QString mess = 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");
1533#ifdef DESKTOP_VERSION 1613#ifdef DESKTOP_VERSION
1534 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1614 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1535#endif 1615#endif
1536 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1616 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1537 i18n("Import!"), i18n("Cancel"), 0, 1617 i18n("Import!"), i18n("Cancel"), 0,
1538 0, 1 ); 1618 0, 1 );
1539 if ( result == 0 ) { 1619 if ( result == 0 ) {
1540#ifndef DESKTOP_VERSION 1620#ifndef DESKTOP_VERSION
1541 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1621 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1542 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1622 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1543 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1623 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1544#else 1624#else
1545 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1625 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1546 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1626 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1547 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1627 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1548#endif 1628#endif
1549 mView->importQtopia( categories, datebook, todolist ); 1629 mView->importQtopia( categories, datebook, todolist );
1550 } 1630 }
1551#if 0 1631#if 0
1552 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1632 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1553 i18n("Not supported \non desktop!\n"), 1633 i18n("Not supported \non desktop!\n"),
1554 i18n("Ok"), i18n("Cancel"), 0, 1634 i18n("Ok"), i18n("Cancel"), 0,
1555 0, 1 ); 1635 0, 1 );
1556 1636
1557#endif 1637#endif
1558} 1638}
1559 1639
1560void MainWindow::saveOnClose() 1640void MainWindow::saveOnClose()
1561{ 1641{
1562 KOPrefs *p = KOPrefs::instance(); 1642 KOPrefs *p = KOPrefs::instance();
1563 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1643 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1564 p->mToolBarUp = iconToolBar->x() > width()/2 || 1644 if ( p->mToolBarHor )
1565 iconToolBar->y() > height()/2; 1645 p->mToolBarUp = iconToolBar->y() > height()/2;
1646 else
1647 p->mToolBarUp = iconToolBar->x() > width()/2;
1648 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1649 if ( p->mToolBarHorV )
1650 p->mToolBarUpV = viewToolBar->y() > height()/2;
1651 else
1652 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1653 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1654 if ( p->mToolBarHorN )
1655 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1656 else
1657 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1658 if ( filterToolBar ) {
1659 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1660 if ( p->mToolBarHorF )
1661 p->mToolBarUpF = filterToolBar->y() > height()/2;
1662 else
1663 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1664 }
1566 mView->writeSettings(); 1665 mView->writeSettings();
1567 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1666 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1568 save(); 1667 save();
1569} 1668}
1570void MainWindow::slotModifiedChanged( bool changed ) 1669void MainWindow::slotModifiedChanged( bool changed )
1571{ 1670{
1572 if ( mBlockAtStartup ) 1671 if ( mBlockAtStartup )
1573 return; 1672 return;
1574 1673
1575 int msec; 1674 int msec;
1576 // we store the changes after 1 minute, 1675 // we store the changes after 1 minute,
1577 // and for safety reasons after 10 minutes again 1676 // and for safety reasons after 10 minutes again
1578 if ( !mSyncManager->blockSave() ) 1677 if ( !mSyncManager->blockSave() )
1579 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1678 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1580 else 1679 else
1581 msec = 1000 * 600; 1680 msec = 1000 * 600;
1582 mSaveTimer.start( msec, true ); // 1 minute 1681 mSaveTimer.start( msec, true ); // 1 minute
1583 qDebug("KO: Saving File in %d secs!", msec/1000); 1682 qDebug("KO: Saving File in %d secs!", msec/1000);
1584 mCalendarModifiedFlag = true; 1683 mCalendarModifiedFlag = true;
1585} 1684}
1586void MainWindow::saveStopTimer() 1685void MainWindow::saveStopTimer()
1587{ 1686{
1588 mSaveTimer.stop(); 1687 mSaveTimer.stop();
1589 if (mSaveTimer.isActive() ) 1688 if (mSaveTimer.isActive() )
1590 qDebug("ti active "); 1689 qDebug("ti active ");
1591 else 1690 else
1592 qDebug("KO: Save timer stopped"); 1691 qDebug("KO: Save timer stopped");
1593} 1692}
1594void MainWindow::save() 1693void MainWindow::save()
1595{ 1694{
1596 if ( !mCalendarModifiedFlag ) { 1695 if ( !mCalendarModifiedFlag ) {
1597 qDebug("KO: Calendar not modified. Nothing saved."); 1696 qDebug("KO: Calendar not modified. Nothing saved.");
1598 return; 1697 return;
1599 } 1698 }
1600 if ( mSyncManager->blockSave() ) 1699 if ( mSyncManager->blockSave() )
1601 return; 1700 return;
1602 mSyncManager->setBlockSave(true); 1701 mSyncManager->setBlockSave(true);
1603 if ( mView->checkFileVersion( defaultFileName()) ) { 1702 if ( mView->checkFileVersion( defaultFileName()) ) {
1604 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1703 QTime neededSaveTime = QDateTime::currentDateTime().time();
1605 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1704 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1606 qDebug("KO: Start saving data to file!"); 1705 qDebug("KO: Start saving data to file!");
1607 mView->saveCalendar( defaultFileName() ); 1706 mView->saveCalendar( defaultFileName() );
1608 mCalendarModifiedFlag = false; 1707 mCalendarModifiedFlag = false;
1609 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1708 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1610 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1709 qDebug("KO: Needed %d ms for saving.",msNeeded );
1611 QString savemes; 1710 QString savemes;
1612 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1711 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1613 setCaption(savemes); 1712 setCaption(savemes);
1614 } else 1713 } else
1615 setCaption(i18n("Saving cancelled!")); 1714 setCaption(i18n("Saving cancelled!"));
1616 mSyncManager->setBlockSave( false ); 1715 mSyncManager->setBlockSave( false );
1617} 1716}
1618 1717
1619void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1718void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1620{ 1719{
1621 if ( !e->isAutoRepeat() ) { 1720 if ( !e->isAutoRepeat() ) {
1622 mFlagKeyPressed = false; 1721 mFlagKeyPressed = false;
1623 } 1722 }
1624} 1723}
1625void MainWindow::keyPressEvent ( QKeyEvent * e ) 1724void MainWindow::keyPressEvent ( QKeyEvent * e )
1626{ 1725{
1627 qApp->processEvents(); 1726 qApp->processEvents();
1628 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1727 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1629 e->ignore(); 1728 e->ignore();
1630 // qDebug(" ignore %d",e->isAutoRepeat() ); 1729 // qDebug(" ignore %d",e->isAutoRepeat() );
1631 return; 1730 return;
1632 } 1731 }
1633 if (! e->isAutoRepeat() ) 1732 if (! e->isAutoRepeat() )
1634 mFlagKeyPressed = true; 1733 mFlagKeyPressed = true;
1635 KOPrefs *p = KOPrefs::instance(); 1734 KOPrefs *p = KOPrefs::instance();
1636 bool showSelectedDates = false; 1735 bool showSelectedDates = false;
1637 int size; 1736 int size;
1638 int pro = 0; 1737 int pro = 0;
1639 //qDebug("MainWindow::keyPressEvent "); 1738 //qDebug("MainWindow::keyPressEvent ");
1640 switch ( e->key() ) { 1739 switch ( e->key() ) {
1641 case Qt::Key_Right: 1740 case Qt::Key_Right:
1642 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1741 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1643 mView->goNextMonth(); 1742 mView->goNextMonth();
1644 else 1743 else
1645 mView->goNext(); 1744 mView->goNext();
1646 showSelectedDates = true; 1745 showSelectedDates = true;
1647 break; 1746 break;
1648 case Qt::Key_Left: 1747 case Qt::Key_Left:
1649 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1748 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1650 mView->goPreviousMonth(); 1749 mView->goPreviousMonth();
1651 else 1750 else
1652 mView->goPrevious(); 1751 mView->goPrevious();
1653 showSelectedDates = true; 1752 showSelectedDates = true;
1654 break; 1753 break;
1655 case Qt::Key_Down: 1754 case Qt::Key_Down:
1656 mView->viewManager()->agendaView()->scrollOneHourDown(); 1755 mView->viewManager()->agendaView()->scrollOneHourDown();
1657 break; 1756 break;
1658 case Qt::Key_Up: 1757 case Qt::Key_Up:
1659 mView->viewManager()->agendaView()->scrollOneHourUp(); 1758 mView->viewManager()->agendaView()->scrollOneHourUp();
1660 break; 1759 break;
1661 case Qt::Key_K: 1760 case Qt::Key_K:
1662 mView->viewManager()->showMonthViewWeek(); 1761 mView->viewManager()->showMonthViewWeek();
1663 break; 1762 break;
1664 case Qt::Key_I: 1763 case Qt::Key_I:
1665 mView->showIncidence(); 1764 mView->showIncidence();
1666 break; 1765 break;
1667 case Qt::Key_Delete: 1766 case Qt::Key_Delete:
1668 case Qt::Key_Backspace: 1767 case Qt::Key_Backspace:
1669 mView->deleteIncidence(); 1768 mView->deleteIncidence();
1670 break; 1769 break;
1671 case Qt::Key_D: 1770 case Qt::Key_D:
1672 mView->viewManager()->showDayView(); 1771 mView->viewManager()->showDayView();
1673 showSelectedDates = true; 1772 showSelectedDates = true;
1674 break; 1773 break;
1675 case Qt::Key_O: 1774 case Qt::Key_O:
1676 mView->toggleFilerEnabled( ); 1775 mView->toggleFilerEnabled( );
1677 break; 1776 break;
1678 case Qt::Key_0: 1777 case Qt::Key_0:
1679 case Qt::Key_1: 1778 case Qt::Key_1:
1680 case Qt::Key_2: 1779 case Qt::Key_2:
1681 case Qt::Key_3: 1780 case Qt::Key_3:
1682 case Qt::Key_4: 1781 case Qt::Key_4:
1683 case Qt::Key_5: 1782 case Qt::Key_5:
1684 case Qt::Key_6: 1783 case Qt::Key_6:
1685 case Qt::Key_7: 1784 case Qt::Key_7:
1686 case Qt::Key_8: 1785 case Qt::Key_8:
1687 case Qt::Key_9: 1786 case Qt::Key_9:
1688 pro = e->key()-48; 1787 pro = e->key()-48;
1689 if ( pro == 0 ) 1788 if ( pro == 0 )
1690 pro = 10; 1789 pro = 10;
1691 if ( e->state() == Qt::ControlButton) 1790 if ( e->state() == Qt::ControlButton)
1692 pro += 10; 1791 pro += 10;
1693 break; 1792 break;
1694 case Qt::Key_M: 1793 case Qt::Key_M:
1695 mView->viewManager()->showMonthView(); 1794 mView->viewManager()->showMonthView();
1696 showSelectedDates = true; 1795 showSelectedDates = true;
1697 break; 1796 break;
1698 case Qt::Key_Insert: 1797 case Qt::Key_Insert:
1699 mView->newEvent(); 1798 mView->newEvent();
1700 break; 1799 break;
1701 case Qt::Key_S : 1800 case Qt::Key_S :
1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1801 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1703 mView->newSubTodo(); 1802 mView->newSubTodo();
1704 else 1803 else
1705 mView->dialogManager()->showSearchDialog(); 1804 mView->dialogManager()->showSearchDialog();
1706 break; 1805 break;
1707 case Qt::Key_Y : 1806 case Qt::Key_Y :
1708 case Qt::Key_Z : 1807 case Qt::Key_Z :
1709 mView->viewManager()->showWorkWeekView(); 1808 mView->viewManager()->showWorkWeekView();
1710 showSelectedDates = true; 1809 showSelectedDates = true;
1711 break; 1810 break;
1712 case Qt::Key_U : 1811 case Qt::Key_U :
1713 mView->viewManager()->showWeekView(); 1812 mView->viewManager()->showWeekView();
1714 showSelectedDates = true; 1813 showSelectedDates = true;
1715 break; 1814 break;
1716 case Qt::Key_H : 1815 case Qt::Key_H :
1717 keyBindings(); 1816 keyBindings();
1718 break; 1817 break;
1719 case Qt::Key_W: 1818 case Qt::Key_W:
1720 mView->viewManager()->showWhatsNextView(); 1819 mView->viewManager()->showWhatsNextView();
1721 break; 1820 break;
1722 case Qt::Key_L: 1821 case Qt::Key_L:
1723 mView->viewManager()->showListView(); 1822 mView->viewManager()->showListView();
1724 break; 1823 break;
1725 case Qt::Key_N: 1824 case Qt::Key_N:
1726 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1825 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1727 mView->viewManager()->showNextView(); 1826 mView->viewManager()->showNextView();
1728 else { 1827 else {
1729 mView->viewManager()->showNextXView(); 1828 mView->viewManager()->showNextXView();
1730 showSelectedDates = true; 1829 showSelectedDates = true;
1731 } 1830 }
1732 break; 1831 break;
1733 case Qt::Key_V: 1832 case Qt::Key_V:
1734 mView->viewManager()->showTodoView(); 1833 mView->viewManager()->showTodoView();
1735 break; 1834 break;
1736 case Qt::Key_C: 1835 case Qt::Key_C:
1737 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1836 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1738 break; 1837 break;
1739 case Qt::Key_P: 1838 case Qt::Key_P:
1740 mView->showDatePicker( ); 1839 mView->showDatePicker( );
1741 break; 1840 break;
1742 case Qt::Key_F: 1841 case Qt::Key_F:
1743 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1842 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1744 mView->editFilters(); 1843 mView->editFilters();
1745 else 1844 else
1746 mView->toggleFilter(); 1845 mView->toggleFilter();
1747 break; 1846 break;
1748 case Qt::Key_X: 1847 case Qt::Key_X:
1749 mView->toggleDateNavigatorWidget(); 1848 mView->toggleDateNavigatorWidget();
1750 break; 1849 break;
1751 case Qt::Key_Space: 1850 case Qt::Key_Space:
1752 mView->toggleExpand(); 1851 mView->toggleExpand();
1753 break; 1852 break;
1754 case Qt::Key_A: 1853 case Qt::Key_A:
1755 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1854 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1756 mView->showNextAlarms(); 1855 mView->showNextAlarms();
1757 else 1856 else
1758 mView->toggleAllDaySize(); 1857 mView->toggleAllDaySize();
1759 break; 1858 break;
1760 case Qt::Key_T: 1859 case Qt::Key_T:
1761 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1860 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1762 mView->newTodo(); 1861 mView->newTodo();
1763 else { 1862 else {
1764 mView->goToday(); 1863 mView->goToday();
1765 showSelectedDates = true; 1864 showSelectedDates = true;
1766 } 1865 }
1767 break; 1866 break;
1768 case Qt::Key_J: 1867 case Qt::Key_J:
1769 mView->viewManager()->showJournalView(); 1868 mView->viewManager()->showJournalView();
1770 break; 1869 break;
1771 case Qt::Key_B: 1870 case Qt::Key_B:
1772 mView->editIncidenceDescription();; 1871 mView->editIncidenceDescription();;
1773 break; 1872 break;
1774 // case Qt::Key_Return: 1873 // case Qt::Key_Return:
1775 case Qt::Key_E: 1874 case Qt::Key_E:
1776 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1875 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1777 mView->newEvent(); 1876 mView->newEvent();
1778 else 1877 else
1779 mView->editIncidence(); 1878 mView->editIncidence();
1780 break; 1879 break;
1781 case Qt::Key_Plus: 1880 case Qt::Key_Plus:
1782 size = p->mHourSize +2; 1881 size = p->mHourSize +2;
1783 if ( size <= 22 ) 1882 if ( size <= 22 )
1784 configureAgenda( size ); 1883 configureAgenda( size );
1785 break; 1884 break;
1786 case Qt::Key_Minus: 1885 case Qt::Key_Minus:
1787 size = p->mHourSize - 2; 1886 size = p->mHourSize - 2;
1788 if ( size >= 4 ) 1887 if ( size >= 4 )
1789 configureAgenda( size ); 1888 configureAgenda( size );
1790 break; 1889 break;
1791 1890
1792 1891
1793 default: 1892 default:
1794 e->ignore(); 1893 e->ignore();
1795 } 1894 }
1796 if ( pro > 0 ) { 1895 if ( pro > 0 ) {
1797 mView->selectFilter( pro-1 ); 1896 mView->selectFilter( pro-1 );
1798 } 1897 }
1799 if ( showSelectedDates ) { 1898 if ( showSelectedDates ) {
1800 ;// setCaptionToDates(); 1899 ;// setCaptionToDates();
1801 } 1900 }
1802 1901
1803} 1902}
1804 1903
1805void MainWindow::fillFilterMenu() 1904void MainWindow::fillFilterMenu()
1806{ 1905{
1807 selectFilterMenu->clear(); 1906 selectFilterMenu->clear();
1808 bool disable = false;
1809 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1907 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1810 selectFilterMenu->insertSeparator(); 1908 selectFilterMenu->insertSeparator();
1811 if ( mView->filterView()->filtersEnabled() ) { 1909 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
1812 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1910
1813 }
1814 else {
1815 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1816 disable = true;
1817 }
1818 selectFilterMenu->insertSeparator(); 1911 selectFilterMenu->insertSeparator();
1819 QPtrList<CalFilter> fili = mView->filters(); 1912 QPtrList<CalFilter> fili = mView->filters();
1820 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1913 CalFilter *curfilter = mView->filterView()->selectedFilter();
1821 CalFilter *filter = fili.first(); 1914 CalFilter *filter = fili.first();
1822 int iii = 2; 1915 int iii = 2;
1916 bool checkitem = mView->filterView()->filtersEnabled();
1823 while(filter) { 1917 while(filter) {
1824 selectFilterMenu->insertItem( filter->name(), iii ); 1918 selectFilterMenu->insertItem( filter->name(), iii );
1825 if ( filter == curfilter) 1919 if ( filter == curfilter)
1826 selectFilterMenu->setItemChecked( iii, true ); 1920 selectFilterMenu->setItemChecked( iii, checkitem );
1827 if ( disable )
1828 selectFilterMenu->setItemEnabled( iii, false );
1829 filter = fili.next(); 1921 filter = fili.next();
1830 ++iii; 1922 ++iii;
1831 } 1923 }
1924 if ( !checkitem )
1925 selectFilterMenu->setItemChecked( 1, true );
1926}
1927void MainWindow::fillFilterMenuPopup()
1928{
1929 filterPopupMenu->clear();
1930 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
1931
1932 filterPopupMenu->insertSeparator();
1933 QPtrList<CalFilter> fili = mView->filters();
1934 CalFilter *curfilter = mView->filterView()->selectedFilter();
1935 CalFilter *filter = fili.first();
1936 int iii = 1;
1937 bool checkitem = mView->filterView()->filtersEnabled();
1938 while(filter) {
1939 filterPopupMenu->insertItem( filter->name(), iii );
1940 if ( filter == curfilter)
1941 filterPopupMenu->setItemChecked( iii, checkitem );
1942 filter = fili.next();
1943 ++iii;
1944 }
1945 if ( !checkitem )
1946 filterPopupMenu->setItemChecked( 0, true );
1832} 1947}
1833void MainWindow::selectFilter( int fil ) 1948void MainWindow::selectFilter( int fil )
1834{ 1949{
1950
1835 if ( fil == 0 ) { 1951 if ( fil == 0 ) {
1836 mView->editFilters( ); 1952 mView->editFilters( );
1837 } else if ( fil == 1 ){ 1953 } else if ( fil == 1 ){
1838 mView->toggleFilerEnabled( ); 1954 if ( mView->filterView()->filtersEnabled() )
1955 mView->toggleFilerEnabled( );
1839 } else { 1956 } else {
1957 if ( !mView->filterView()->filtersEnabled() )
1958 mView->toggleFilerEnabled( );
1840 mView->selectFilter( fil-2 ); 1959 mView->selectFilter( fil-2 );
1960 }
1961}
1962void MainWindow::updateFilterToolbar()
1963{
1964 if ( filterMenubar ) {
1965 if ( !mView->filterView()->filtersEnabled() ) {
1966 filterMenubar->changeItem( 0, i18n("No Filter") );
1967 } else {
1968 CalFilter *curfilter = mView->filterView()->selectedFilter();
1969 if ( curfilter ) {
1970 filterMenubar->changeItem( 0, curfilter->name() );
1971 }
1972 }
1841 } 1973 }
1842} 1974}
1975void MainWindow::selectFilterPopup( int fil )
1976{
1977 selectFilter( fil + 1 );
1978
1979}
1843void MainWindow::configureToolBar( int item ) 1980void MainWindow::configureToolBar( int item )
1844{ 1981{
1845 1982
1846 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1983 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1847 KOPrefs *p = KOPrefs::instance(); 1984 KOPrefs *p = KOPrefs::instance();
1848 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1985 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1986 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
1849 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1987 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1850 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1988 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1851 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1989 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1852 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1990 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1853 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1991 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1854 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1992 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1855 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 1993 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
1856 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1994 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1857 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1995 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1858 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1996 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1859 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1997 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1860 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1998 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1861 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1999 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1862 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2000 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1863 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2001 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1864 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2002 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1865 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2003 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1866 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2004 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1867 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2005 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1868 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2006 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
1869 // initActions(); 2007 // initActions();
1870} 2008}
1871void MainWindow::setCaption ( const QString & c ) 2009void MainWindow::setCaption ( const QString & c )
1872{ 2010{
1873 QString cap = c; 2011 QString cap = c;
1874 cap.replace( QRegExp("\n"), " " ); 2012 cap.replace( QRegExp("\n"), " " );
1875 cap = cap.stripWhiteSpace(); 2013 cap = cap.stripWhiteSpace();
1876 if ( cap.isEmpty() ) 2014 if ( cap.isEmpty() )
1877 cap = "KO/Pi"; 2015 cap = "KO/Pi";
1878 QWidget::setCaption( cap ); 2016 QWidget::setCaption( cap );
1879} 2017}
1880void MainWindow::setCaptionToDates() 2018void MainWindow::setCaptionToDates()
1881{ 2019{
1882 QString selDates; 2020 QString selDates;
1883 QDate date = mView->startDate(); 2021 QDate date = mView->startDate();
1884 if ( ! date.isValid() ) { 2022 if ( ! date.isValid() ) {
1885 setCaption(""); 2023 setCaption("");
1886 return; 2024 return;
1887 } 2025 }
1888 selDates = KGlobal::locale()->formatDate( date, true); 2026 selDates = KGlobal::locale()->formatDate( date, true);
1889 if (mView->startDate() < mView->endDate() ) 2027 if (mView->startDate() < mView->endDate() )
1890 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2028 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1891 else { 2029 else {
1892 QString addString; 2030 QString addString;
1893 if ( date == QDateTime::currentDateTime().date() ) 2031 if ( date == QDateTime::currentDateTime().date() )
1894 addString = i18n("Today"); 2032 addString = i18n("Today");
1895 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2033 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
1896 addString = i18n("Tomorrow"); 2034 addString = i18n("Tomorrow");
1897 if ( !addString.isEmpty() ) 2035 if ( !addString.isEmpty() )
1898 selDates = addString+", "+selDates ; 2036 selDates = addString+", "+selDates ;
1899 } 2037 }
1900 setCaption( i18n("Dates: ") + selDates ); 2038 setCaption( i18n("Dates: ") + selDates );
1901 2039
1902} 2040}
1903void MainWindow::showConfigureAgenda( ) 2041void MainWindow::showConfigureAgenda( )
1904{ 2042{
1905 int iii; 2043 int iii;
1906 for ( iii = 1;iii<= 10 ;++iii ){ 2044 for ( iii = 1;iii<= 10 ;++iii ){
1907 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2045 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1908 } 2046 }
1909 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2047 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1910} 2048}
1911void MainWindow::configureAgenda( int item ) 2049void MainWindow::configureAgenda( int item )
1912{ 2050{
1913 if ( KOPrefs::instance()->mHourSize == item ) 2051 if ( KOPrefs::instance()->mHourSize == item )
1914 return; 2052 return;
1915 KOPrefs::instance()->mHourSize=item; 2053 KOPrefs::instance()->mHourSize=item;
1916 mView->viewManager()->agendaView()->updateConfig(); 2054 mView->viewManager()->agendaView()->updateConfig();
1917} 2055}
1918 2056
1919void MainWindow::saveCalendar() 2057void MainWindow::saveCalendar()
1920{ 2058{
1921 QString fn = KOPrefs::instance()->mLastSaveFile; 2059 QString fn = KOPrefs::instance()->mLastSaveFile;
1922 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2060 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1923 2061
1924 if ( fn == "" ) 2062 if ( fn == "" )
1925 return; 2063 return;
1926 QFileInfo info; 2064 QFileInfo info;
1927 info.setFile( fn ); 2065 info.setFile( fn );
1928 QString mes; 2066 QString mes;
1929 bool createbup = true; 2067 bool createbup = true;
1930 if ( info. exists() ) { 2068 if ( info. exists() ) {
1931 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2069 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1932 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2070 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1933 i18n("Overwrite!"), i18n("Cancel"), 0, 2071 i18n("Overwrite!"), i18n("Cancel"), 0,
1934 0, 1 ); 2072 0, 1 );
1935 if ( result != 0 ) { 2073 if ( result != 0 ) {
1936 createbup = false; 2074 createbup = false;
1937 } 2075 }
1938 } 2076 }
1939 if ( createbup ) { 2077 if ( createbup ) {
1940 mView->saveCalendar( fn ); 2078 mView->saveCalendar( fn );
1941 mes = i18n("KO/Pi:Saved %1").arg(fn); 2079 mes = i18n("KO/Pi:Saved %1").arg(fn);
1942 KOPrefs::instance()->mLastSaveFile = fn; 2080 KOPrefs::instance()->mLastSaveFile = fn;
1943 setCaption(mes); 2081 setCaption(mes);
1944 } 2082 }
1945} 2083}
1946void MainWindow::loadCalendar() 2084void MainWindow::loadCalendar()
1947{ 2085{
1948 2086
1949 QString fn = KOPrefs::instance()->mLastLoadFile; 2087 QString fn = KOPrefs::instance()->mLastLoadFile;
1950 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2088 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1951 2089
1952 if ( fn == "" ) 2090 if ( fn == "" )
1953 return; 2091 return;
1954 QFileInfo info; 2092 QFileInfo info;
1955 info.setFile( fn ); 2093 info.setFile( fn );
1956 QString mess; 2094 QString mess;
1957 bool loadbup = true; 2095 bool loadbup = true;
1958 if ( info. exists() ) { 2096 if ( info. exists() ) {
1959 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2097 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1960 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2098 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1961 mess, 2099 mess,
1962 i18n("Load!"), i18n("Cancel"), 0, 2100 i18n("Load!"), i18n("Cancel"), 0,
1963 0, 1 ); 2101 0, 1 );
1964 if ( result != 0 ) { 2102 if ( result != 0 ) {
1965 loadbup = false; 2103 loadbup = false;
1966 } 2104 }
1967 } else { 2105 } else {
1968 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2106 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1969 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2107 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1970 0, 1 ); 2108 0, 1 );
1971 2109
1972 return; 2110 return;
1973 } 2111 }
1974 if ( loadbup ) { 2112 if ( loadbup ) {
1975 mView->openCalendar( fn ); 2113 mView->openCalendar( fn );
1976 KOPrefs::instance()->mLastLoadFile = fn; 2114 KOPrefs::instance()->mLastLoadFile = fn;
1977 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2115 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1978 setCaption(mess); 2116 setCaption(mess);
1979 } 2117 }
1980 2118
1981} 2119}
1982void MainWindow::quickImportIcal() 2120void MainWindow::quickImportIcal()
1983{ 2121{
1984 importFile( KOPrefs::instance()->mLastImportFile, false ); 2122 importFile( KOPrefs::instance()->mLastImportFile, false );
1985} 2123}
1986void MainWindow::importFile( QString fn, bool quick ) 2124void MainWindow::importFile( QString fn, bool quick )
1987{ 2125{
1988 QFileInfo info; 2126 QFileInfo info;
1989 info.setFile( fn ); 2127 info.setFile( fn );
1990 QString mess; 2128 QString mess;
1991 bool loadbup = true; 2129 bool loadbup = true;
1992 if ( !info. exists() ) { 2130 if ( !info. exists() ) {
1993 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2131 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1994 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2132 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1995 mess ); 2133 mess );
1996 return; 2134 return;
1997 } 2135 }
1998 int result = 0; 2136 int result = 0;
1999 if ( !quick ) { 2137 if ( !quick ) {
2000 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 )); 2138 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 ));
2001 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2139 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2002 mess, 2140 mess,
2003 "Import", "Cancel", 0, 2141 "Import", "Cancel", 0,
2004 0, 1 ); 2142 0, 1 );
2005 } 2143 }
2006 if ( result == 0 ) { 2144 if ( result == 0 ) {
2007 if ( mView->openCalendar( fn, true )) { 2145 if ( mView->openCalendar( fn, true )) {
2008 KOPrefs::instance()->mLastImportFile = fn; 2146 KOPrefs::instance()->mLastImportFile = fn;
2009 setCaption(i18n("Imported file successfully")); 2147 setCaption(i18n("Imported file successfully"));
2010 } else { 2148 } else {
2011 setCaption(i18n("Error importing file")); 2149 setCaption(i18n("Error importing file"));
2012 } 2150 }
2013 } 2151 }
2014} 2152}
2015 2153
2016void MainWindow::importIcal() 2154void MainWindow::importIcal()
2017{ 2155{
2018 2156
2019 QString fn =KOPrefs::instance()->mLastImportFile; 2157 QString fn =KOPrefs::instance()->mLastImportFile;
2020 2158
2021 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2159 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2022 if ( fn == "" ) 2160 if ( fn == "" )
2023 return; 2161 return;
2024 importFile( fn, true ); 2162 importFile( fn, true );
2025 2163
2026} 2164}
2027 2165
2028void MainWindow::exportVCalendar() 2166void MainWindow::exportVCalendar()
2029{ 2167{
2030 QString fn = KOPrefs::instance()->mLastVcalFile; 2168 QString fn = KOPrefs::instance()->mLastVcalFile;
2031 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2169 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2032 if ( fn == "" ) 2170 if ( fn == "" )
2033 return; 2171 return;
2034 QFileInfo info; 2172 QFileInfo info;
2035 info.setFile( fn ); 2173 info.setFile( fn );
2036 QString mes; 2174 QString mes;
2037 bool createbup = true; 2175 bool createbup = true;
2038 if ( info. exists() ) { 2176 if ( info. exists() ) {
2039 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2177 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2040 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2178 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index b3041dc..79fb305 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,161 +1,170 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h" 13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 14#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
17#endif 17#endif
18class QAction; 18class QAction;
19class CalendarView; 19class CalendarView;
20class KSyncProfile; 20class KSyncProfile;
21#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
22 22
23#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 24#define QPEMenuBar QMenuBar
25#endif 25#endif
26class QPEToolBar; 26class QPEToolBar;
27class QPEMenuBar;
27 28
28 29
29namespace KCal { 30namespace KCal {
30class CalendarLocal; 31class CalendarLocal;
31} 32}
32 33
33class KOMenuBar : public QMenuBar 34class KOMenuBar : public QMenuBar
34{ 35{
35 public: 36 public:
36 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} 37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
37 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} 38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
38}; 39};
39 40
40using namespace KCal; 41using namespace KCal;
41 42
42class MainWindow : public QMainWindow 43class MainWindow : public QMainWindow
43{ 44{
44 Q_OBJECT 45 Q_OBJECT
45 public: 46 public:
46 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
47 ~MainWindow(); 48 ~MainWindow();
48 bool beamReceiveEnabled(); 49 bool beamReceiveEnabled();
49 static QString defaultFileName(); 50 static QString defaultFileName();
50 static QString syncFileName(); 51 static QString syncFileName();
51 static QString resourcePath(); 52 static QString resourcePath();
52 public slots: 53 public slots:
53 void setCaption ( const QString & ); 54 void setCaption ( const QString & );
54 void updateWeekNum(const KCal::DateList &); 55 void updateWeekNum(const KCal::DateList &);
55 void updateWeek(QDate); 56 void updateWeek(QDate);
57 void updateFilterToolbar();
56 virtual void showMaximized (); 58 virtual void showMaximized ();
57 void configureAgenda( int ); 59 void configureAgenda( int );
58 void recieve( const QCString& msg, const QByteArray& data ); 60 void recieve( const QCString& msg, const QByteArray& data );
59 protected slots: 61 protected slots:
60 void setCaptionToDates(); 62 void setCaptionToDates();
61 void weekAction(); 63 void weekAction();
62 void about(); 64 void about();
63 void licence(); 65 void licence();
64 void faq(); 66 void faq();
65 void usertrans(); 67 void usertrans();
66 void features(); 68 void features();
67 void synchowto(); 69 void synchowto();
68 void kdesynchowto(); 70 void kdesynchowto();
69 void multisynchowto(); 71 void multisynchowto();
70 void whatsNew(); 72 void whatsNew();
71 void keyBindings(); 73 void keyBindings();
72 void aboutAutoSaving();; 74 void aboutAutoSaving();;
73 void aboutKnownBugs(); 75 void aboutKnownBugs();
74 76
75 void processIncidenceSelection( Incidence * ); 77 void processIncidenceSelection( Incidence * );
76 78
77 void importQtopia(); 79 void importQtopia();
78 void importBday(); 80 void importBday();
79 void importOL(); 81 void importOL();
80 void importIcal(); 82 void importIcal();
81 void importFile( QString, bool ); 83 void importFile( QString, bool );
82 void quickImportIcal(); 84 void quickImportIcal();
83 85
84 void slotModifiedChanged( bool ); 86 void slotModifiedChanged( bool );
85 87
86 void save(); 88 void save();
87 void saveStopTimer(); 89 void saveStopTimer();
88 void configureToolBar( int ); 90 void configureToolBar( int );
89 void printSel(); 91 void printSel();
90 void printCal(); 92 void printCal();
91 void saveCalendar(); 93 void saveCalendar();
92 void loadCalendar(); 94 void loadCalendar();
93 void exportVCalendar(); 95 void exportVCalendar();
94 void fillFilterMenu(); 96 void fillFilterMenu();
95 void selectFilter( int ); 97 void selectFilter( int );
98 void fillFilterMenuPopup();
99 void selectFilterPopup( int );
96 void exportToPhone( int ); 100 void exportToPhone( int );
97 void toggleBeamReceive(); 101 void toggleBeamReceive();
98 void disableBR(bool); 102 void disableBR(bool);
99 signals: 103 signals:
100 void selectWeek ( int ); 104 void selectWeek ( int );
101 private slots: 105 private slots:
102 void showConfigureAgenda(); 106 void showConfigureAgenda();
103 void getFile( bool ); 107 void getFile( bool );
104 void syncFileRequest(); 108 void syncFileRequest();
105 109
106 protected: 110 protected:
107 void hideEvent ( QHideEvent * ); 111 void hideEvent ( QHideEvent * );
108 QString sentSyncFile(); 112 QString sentSyncFile();
109 void displayText( QString, QString); 113 void displayText( QString, QString);
110 void enableIncidenceActions( bool ); 114 void enableIncidenceActions( bool );
111 115
112 private: 116 private:
113 bool mBRdisabled; 117 bool mBRdisabled;
114#ifndef DESKTOP_VERSION 118#ifndef DESKTOP_VERSION
115 QCopChannel* infrared; 119 QCopChannel* infrared;
116#endif 120#endif
117 QAction* brAction; 121 QAction* brAction;
118 KSyncManager* mSyncManager; 122 KSyncManager* mSyncManager;
119 bool mClosed; 123 bool mClosed;
120 void saveOnClose(); 124 void saveOnClose();
121 bool mFlagKeyPressed; 125 bool mFlagKeyPressed;
122 bool mBlockAtStartup; 126 bool mBlockAtStartup;
123 QPEToolBar *iconToolBar; 127 QPEToolBar *iconToolBar;
128 QPEToolBar *viewToolBar;
129 QPEToolBar *navigatorToolBar;
130 QPEToolBar *filterToolBar;
131 QPEMenuBar *filterMenubar;
132 QPopupMenu * filterPopupMenu;
124 void initActions(); 133 void initActions();
125 void setDefaultPreferences(); 134 void setDefaultPreferences();
126 void keyPressEvent ( QKeyEvent * ) ; 135 void keyPressEvent ( QKeyEvent * ) ;
127 void keyReleaseEvent ( QKeyEvent * ) ; 136 void keyReleaseEvent ( QKeyEvent * ) ;
128 QPopupMenu *configureToolBarMenu; 137 QPopupMenu *configureToolBarMenu;
129 QPopupMenu *selectFilterMenu; 138 QPopupMenu *selectFilterMenu;
130 QPopupMenu *configureAgendaMenu, *syncMenu; 139 QPopupMenu *configureAgendaMenu, *syncMenu;
131 CalendarLocal *mCalendar; 140 CalendarLocal *mCalendar;
132 CalendarView *mView; 141 CalendarView *mView;
133 QAction *mNewSubTodoAction; 142 QAction *mNewSubTodoAction;
134 QAction *mWeekAction; 143 QAction *mWeekAction;
135 QFont mWeekFont; 144 QFont mWeekFont;
136 QPixmap mWeekPixmap; 145 QPixmap mWeekPixmap;
137 QColor mWeekBgColor; 146 QColor mWeekBgColor;
138 147
139 QAction *mShowAction; 148 QAction *mShowAction;
140 QAction *mEditAction; 149 QAction *mEditAction;
141 QAction *mDeleteAction; 150 QAction *mDeleteAction;
142 QAction *mCloneAction; 151 QAction *mCloneAction;
143 QAction *mMoveAction; 152 QAction *mMoveAction;
144 QAction *mBeamAction; 153 QAction *mBeamAction;
145 QAction *mCancelAction; 154 QAction *mCancelAction;
146 155
147 QAction *mToggleNav; 156 QAction *mToggleNav;
148 QAction *mToggleFilter; 157 QAction *mToggleFilter;
149 QAction *mToggleAllday; 158 QAction *mToggleAllday;
150 159
151 160
152 void closeEvent( QCloseEvent* ce ); 161 void closeEvent( QCloseEvent* ce );
153 SimpleAlarmClient mAlarmClient; 162 SimpleAlarmClient mAlarmClient;
154 QTimer mSaveTimer; 163 QTimer mSaveTimer;
155 //bool mBlockSaveFlag; 164 //bool mBlockSaveFlag;
156 bool mCalendarModifiedFlag; 165 bool mCalendarModifiedFlag;
157 QPixmap loadPixmap( QString ); 166 QPixmap loadPixmap( QString );
158}; 167};
159 168
160 169
161#endif 170#endif