summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-06 16:02:56 (UTC)
committer zautrix <zautrix>2004-10-06 16:02:56 (UTC)
commita22de800110d8350a5200a994b041e47d51bf4c6 (patch) (unidiff)
treea4de195003d1ceabc3fd9ca4e5cd0510570bcb97 /korganizer
parentef71411c2f248d1dc908aa2f119c9b281e0e8bb9 (diff)
downloadkdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.zip
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.gz
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.bz2
added phone export
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp4
-rw-r--r--korganizer/koprefs.h3
-rw-r--r--korganizer/mainwindow.cpp25
3 files changed, 13 insertions, 19 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 716a125..84e3d00 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,579 +1,575 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "koprefs.h" 46#include "koprefs.h"
47#include "mainwindow.h" 47#include "mainwindow.h"
48 48
49const char *germanwords[][2] = { 49const char *germanwords[][2] = {
50#include "wordsgerman.h" 50#include "wordsgerman.h"
51 "", "" 51 "", ""
52}; 52};
53 53
54KOPrefs *KOPrefs::mInstance = 0; 54KOPrefs *KOPrefs::mInstance = 0;
55static KStaticDeleter<KOPrefs> insd; 55static KStaticDeleter<KOPrefs> insd;
56 56
57KOPrefs::KOPrefs() : 57KOPrefs::KOPrefs() :
58 KPimPrefs("korganizerrc") 58 KPimPrefs("korganizerrc")
59{ 59{
60 mCategoryColors.setAutoDelete(true); 60 mCategoryColors.setAutoDelete(true);
61 mLocaleDict = 0; 61 mLocaleDict = 0;
62 fillMailDefaults(); 62 fillMailDefaults();
63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
64 QColor defaultHolidayColor = QColor(255,0,0); 64 QColor defaultHolidayColor = QColor(255,0,0);
65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
68 QColor defaultTodoDueTodayColor = QColor(255,220,100); 68 QColor defaultTodoDueTodayColor = QColor(255,220,100);
69 QColor defaultTodoOverdueColor = QColor(255,153,125); 69 QColor defaultTodoOverdueColor = QColor(255,153,125);
70 70
71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
72 mDefaultViewFont = QFont("helvetica",10); 72 mDefaultViewFont = QFont("helvetica",10);
73 mDefaultMonthViewFont = QFont("helvetica",8); 73 mDefaultMonthViewFont = QFont("helvetica",8);
74 mMarcusBainsFont= QFont("helvetica",10); 74 mMarcusBainsFont= QFont("helvetica",10);
75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
76 mEditBoxFont = QFont("helvetica",12); 76 mEditBoxFont = QFont("helvetica",12);
77 mJornalViewFont = QFont("helvetica",12); 77 mJornalViewFont = QFont("helvetica",12);
78 78
79 KPrefs::setCurrentGroup("General"); 79 KPrefs::setCurrentGroup("General");
80 80
81 81
82 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
83 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
84 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
85
86 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
87 83
88 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
89 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
90 addItemBool("ShowIconSearch",&mShowIconSearch,true); 86 addItemBool("ShowIconSearch",&mShowIconSearch,true);
91 addItemBool("ShowIconList",&mShowIconList,true); 87 addItemBool("ShowIconList",&mShowIconList,true);
92 addItemBool("ShowIconDay1",&mShowIconDay1,true); 88 addItemBool("ShowIconDay1",&mShowIconDay1,true);
93 addItemBool("ShowIconDay5",&mShowIconDay5,true); 89 addItemBool("ShowIconDay5",&mShowIconDay5,true);
94 addItemBool("ShowIconDay7",&mShowIconDay7,true); 90 addItemBool("ShowIconDay7",&mShowIconDay7,true);
95 addItemBool("ShowIconMonth",&mShowIconMonth,true); 91 addItemBool("ShowIconMonth",&mShowIconMonth,true);
96 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
97 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
98 addItemBool("ShowIconBack",&mShowIconBack,true); 94 addItemBool("ShowIconBack",&mShowIconBack,true);
99 addItemBool("ShowIconToday",&mShowIconToday,true); 95 addItemBool("ShowIconToday",&mShowIconToday,true);
100 addItemBool("ShowIconForward",&mShowIconForward,true); 96 addItemBool("ShowIconForward",&mShowIconForward,true);
101 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
102 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
103 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
104 addItemBool("ShowIconNext",&mShowIconNext,true); 100 addItemBool("ShowIconNext",&mShowIconNext,true);
105 addItemBool("ShowIconJournal",&mShowIconJournal,true); 101 addItemBool("ShowIconJournal",&mShowIconJournal,true);
106 addItemBool("ShowIconStretch",&mShowIconStretch,true); 102 addItemBool("ShowIconStretch",&mShowIconStretch,true);
107 addItemBool("LanguageChanged",&mLanguageChanged,false); 103 addItemBool("LanguageChanged",&mLanguageChanged,false);
108 104
109 addItemBool("AskForQuit",&mAskForQuit,false); 105 addItemBool("AskForQuit",&mAskForQuit,false);
110 106
111#ifndef DESKTOP_VERSION 107#ifndef DESKTOP_VERSION
112 addItemBool("ShowFullMenu",&mShowFullMenu,false); 108 addItemBool("ShowFullMenu",&mShowFullMenu,false);
113#else 109#else
114 addItemBool("ShowFullMenu",&mShowFullMenu,true); 110 addItemBool("ShowFullMenu",&mShowFullMenu,true);
115#endif 111#endif
116 addItemBool("ToolBarHor",&mToolBarHor, true ); 112 addItemBool("ToolBarHor",&mToolBarHor, true );
117 addItemBool("ToolBarUp",&mToolBarUp, false ); 113 addItemBool("ToolBarUp",&mToolBarUp, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 115 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 117
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
124 addItemInt("AllDay Size",&mAllDaySize,28); 120 addItemInt("AllDay Size",&mAllDaySize,28);
125 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
126 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
127 123
128 addItemStringList("LocationDefaults",&mLocationDefaults ); 124 addItemStringList("LocationDefaults",&mLocationDefaults );
129 addItemStringList("EventSummary User",&mEventSummaryUser); 125 addItemStringList("EventSummary User",&mEventSummaryUser);
130 addItemStringList("TodoSummary User",&mTodoSummaryUser); 126 addItemStringList("TodoSummary User",&mTodoSummaryUser);
131 127
132 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
133 addItemBool("Enable Project View",&mEnableProjectView,false); 129 addItemBool("Enable Project View",&mEnableProjectView,false);
134 addItemBool("Auto Save",&mAutoSave,false); 130 addItemBool("Auto Save",&mAutoSave,false);
135 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
136 addItemBool("Confirm Deletes",&mConfirm,true); 132 addItemBool("Confirm Deletes",&mConfirm,true);
137 addItemString("Archive File",&mArchiveFile); 133 addItemString("Archive File",&mArchiveFile);
138 addItemString("Html Export File",&mHtmlExportFile, 134 addItemString("Html Export File",&mHtmlExportFile,
139 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
140 addItemBool("Html With Save",&mHtmlWithSave,false); 136 addItemBool("Html With Save",&mHtmlWithSave,false);
141 137
142 KPrefs::setCurrentGroup("Personal Settings"); 138 KPrefs::setCurrentGroup("Personal Settings");
143 139
144 addItemInt("Mail Client",&mMailClient,MailClientKMail); 140 addItemInt("Mail Client",&mMailClient,MailClientKMail);
145 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 141 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
146 addItemBool("Bcc",&mBcc,false); 142 addItemBool("Bcc",&mBcc,false);
147 143
148 KPrefs::setCurrentGroup("Time & Date"); 144 KPrefs::setCurrentGroup("Time & Date");
149 145
150 // addItemString("Time Zone",&mTimeZone,"+0100"); 146 // addItemString("Time Zone",&mTimeZone,"+0100");
151 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 147 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
152 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); 148 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
153 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 149 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
154 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 150 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
155 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 151 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
156 152
157 153
158 addItemInt("Default Start Time",&mStartTime,10); 154 addItemInt("Default Start Time",&mStartTime,10);
159 addItemInt("Default Duration",&mDefaultDuration,2); 155 addItemInt("Default Duration",&mDefaultDuration,2);
160 addItemInt("Default Alarm Time",&mAlarmTime,3); 156 addItemInt("Default Alarm Time",&mAlarmTime,3);
161 addItemInt("Daylight Savings",&mDaylightSavings,0); 157 addItemInt("Daylight Savings",&mDaylightSavings,0);
162 KPrefs::setCurrentGroup("AlarmSettings"); 158 KPrefs::setCurrentGroup("AlarmSettings");
163 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
164 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
165 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
166 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
167 163
168 164
169 KPrefs::setCurrentGroup("Calendar"); 165 KPrefs::setCurrentGroup("Calendar");
170 166
171 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
172 168
173 KPrefs::setCurrentGroup("Fonts"); 169 KPrefs::setCurrentGroup("Fonts");
174 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 170 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
175 addItemFont("TimeBar Font",&mTimeBarFont); 171 addItemFont("TimeBar Font",&mTimeBarFont);
176 addItemFont("MonthView Font",&mMonthViewFont); 172 addItemFont("MonthView Font",&mMonthViewFont);
177 addItemFont("AgendaView Font",&mAgendaViewFont); 173 addItemFont("AgendaView Font",&mAgendaViewFont);
178 addItemFont("MarcusBains Font",&mMarcusBainsFont); 174 addItemFont("MarcusBains Font",&mMarcusBainsFont);
179 addItemFont("TimeLabels Font",&mTimeLabelsFont); 175 addItemFont("TimeLabels Font",&mTimeLabelsFont);
180 addItemFont("TodoView Font",&mTodoViewFont); 176 addItemFont("TodoView Font",&mTodoViewFont);
181 addItemFont("ListView Font",&mListViewFont); 177 addItemFont("ListView Font",&mListViewFont);
182 addItemFont("DateNavigator Font",&mDateNavigatorFont); 178 addItemFont("DateNavigator Font",&mDateNavigatorFont);
183 addItemFont("EditBox Font",&mEditBoxFont); 179 addItemFont("EditBox Font",&mEditBoxFont);
184 addItemFont("JournalView Font",&mJornalViewFont); 180 addItemFont("JournalView Font",&mJornalViewFont);
185 addItemFont("WhatsNextView Font",&mWhatsNextFont); 181 addItemFont("WhatsNextView Font",&mWhatsNextFont);
186 addItemFont("EventView Font",&mEventViewFont); 182 addItemFont("EventView Font",&mEventViewFont);
187 183
188// KPrefs::setCurrentGroup("SyncProfiles"); 184// KPrefs::setCurrentGroup("SyncProfiles");
189// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 185// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
190// addItemStringList("SyncProfileNames",&mSyncProfileNames); 186// addItemStringList("SyncProfileNames",&mSyncProfileNames);
191// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); 187// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
192 188
193 KPrefs::setCurrentGroup("RemoteSyncing"); 189 KPrefs::setCurrentGroup("RemoteSyncing");
194// addItemBool("UsePasswd",&mUsePassWd,false); 190// addItemBool("UsePasswd",&mUsePassWd,false);
195// addItemBool("WriteBackFile",&mWriteBackFile,true); 191// addItemBool("WriteBackFile",&mWriteBackFile,true);
196// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 192// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
197// addItemBool("AskForPreferences",&mAskForPreferences,true); 193// addItemBool("AskForPreferences",&mAskForPreferences,true);
198// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 194// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
199 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); 195 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
200 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); 196 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
201 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 197 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
202 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 198 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
203 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 199 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
204 addItemInt("LastSyncTime",&mLastSyncTime,0); 200 addItemInt("LastSyncTime",&mLastSyncTime,0);
205 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); 201 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
206 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); 202 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
207 203
208#ifdef _WIN32_ 204#ifdef _WIN32_
209 QString hdp= locateLocal("data","korganizer")+"\\\\"; 205 QString hdp= locateLocal("data","korganizer")+"\\\\";
210#else 206#else
211 QString hdp= locateLocal("data","korganizer")+"/"; 207 QString hdp= locateLocal("data","korganizer")+"/";
212#endif 208#endif
213// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); 209// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
214// addItemString("RemoteUser",&mRemoteUser, "zaurus"); 210// addItemString("RemoteUser",&mRemoteUser, "zaurus");
215// addItemString("RemotePassWd",&mRemotePassWd, ""); 211// addItemString("RemotePassWd",&mRemotePassWd, "");
216// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); 212// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
217// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); 213// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
218 214
219 215
220 KPrefs::setCurrentGroup("LoadSaveFileNames"); 216 KPrefs::setCurrentGroup("LoadSaveFileNames");
221 217
222 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 218 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
223 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 219 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
224 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 220 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
225 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 221 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
226 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); 222 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
227 223
228 224
229 KPrefs::setCurrentGroup("Locale"); 225 KPrefs::setCurrentGroup("Locale");
230 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 226 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
231 addItemInt("PreferredTime",&mPreferredTime,0); 227 addItemInt("PreferredTime",&mPreferredTime,0);
232 addItemInt("PreferredDate",&mPreferredDate,0); 228 addItemInt("PreferredDate",&mPreferredDate,0);
233 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 229 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
234 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 230 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
235 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 231 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
236 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 232 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
237 233
238 234
239 KPrefs::setCurrentGroup("Colors"); 235 KPrefs::setCurrentGroup("Colors");
240 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 236 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
241 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 237 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
242 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 238 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
243 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 239 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
244 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 240 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
245 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 241 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
246 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 242 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
247 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 243 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
248 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 244 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
249 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 245 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
250 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 246 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
251 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 247 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
252 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 248 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
253 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 249 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
254 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 250 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
255 addItemBool("UseAppColors",&mUseAppColors,false); 251 addItemBool("UseAppColors",&mUseAppColors,false);
256 252
257 253
258 254
259 KPrefs::setCurrentGroup("Views"); 255 KPrefs::setCurrentGroup("Views");
260 addItemInt("Hour Size",&mHourSize,8); 256 addItemInt("Hour Size",&mHourSize,8);
261 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 257 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
262 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 258 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
263 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 259 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
264 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 260 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
265 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 261 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
266 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 262 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
267 addItemBool("Enable ToolTips",&mEnableToolTips,false); 263 addItemBool("Enable ToolTips",&mEnableToolTips,false);
268 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 264 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
269 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 265 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
270 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 266 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
271 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 267 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
272 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 268 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
273 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 269 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
274 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 270 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
275 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 271 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
276 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 272 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
277 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); 273 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
278 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 274 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
279 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 275 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
280 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 276 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
281 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 277 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
282 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 278 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
283 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 279 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
284 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 280 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
285 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 281 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
286#ifdef DESKTOP_VERSION 282#ifdef DESKTOP_VERSION
287 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 283 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
288#else 284#else
289 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 285 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
290#endif 286#endif
291 addItemInt("Day Begins",&mDayBegins,7); 287 addItemInt("Day Begins",&mDayBegins,7);
292 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 288 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
293 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 289 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
294 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 290 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
295 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 291 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
296 292
297 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 293 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
298 addItemBool("Full View Month",&mFullViewMonth,true); 294 addItemBool("Full View Month",&mFullViewMonth,true);
299 addItemBool("Full View Todo",&mFullViewTodo,true); 295 addItemBool("Full View Todo",&mFullViewTodo,true);
300 addItemBool("Quick Todo",&mEnableQuickTodo,false); 296 addItemBool("Quick Todo",&mEnableQuickTodo,false);
301 297
302 addItemInt("Next X Days",&mNextXDays,3); 298 addItemInt("Next X Days",&mNextXDays,3);
303 299
304 KPrefs::setCurrentGroup("Printer"); 300 KPrefs::setCurrentGroup("Printer");
305 301
306 KPrefs::setCurrentGroup("Layout"); 302 KPrefs::setCurrentGroup("Layout");
307 303
308 addItemBool("CompactDialogs",&mCompactDialogs,false); 304 addItemBool("CompactDialogs",&mCompactDialogs,false);
309 addItemBool("VerticalScreen",&mVerticalScreen,true); 305 addItemBool("VerticalScreen",&mVerticalScreen,true);
310 306
311 KPrefs::setCurrentGroup("KOrganizer Plugins"); 307 KPrefs::setCurrentGroup("KOrganizer Plugins");
312 308
313 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 309 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
314 310
315 KPrefs::setCurrentGroup("Group Scheduling"); 311 KPrefs::setCurrentGroup("Group Scheduling");
316 312
317 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 313 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
318 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 314 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
319 addItemStringList("AdditionalMails",&mAdditionalMails,""); 315 addItemStringList("AdditionalMails",&mAdditionalMails,"");
320 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 316 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
321 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 317 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
322 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 318 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
323 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 319 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
324 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 320 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
325 321
326 KPrefs::setCurrentGroup( "Editors" ); 322 KPrefs::setCurrentGroup( "Editors" );
327 323
328 addItemStringList( "EventTemplates", &mEventTemplates ); 324 addItemStringList( "EventTemplates", &mEventTemplates );
329 addItemStringList( "TodoTemplates", &mTodoTemplates ); 325 addItemStringList( "TodoTemplates", &mTodoTemplates );
330 326
331 addItemInt("DestinationPolicy",&mDestination,standardDestination); 327 addItemInt("DestinationPolicy",&mDestination,standardDestination);
332 328
333 329
334 330
335} 331}
336 332
337 333
338KOPrefs::~KOPrefs() 334KOPrefs::~KOPrefs()
339{ 335{
340 if (mInstance == this) 336 if (mInstance == this)
341 mInstance = insd.setObject(0); 337 mInstance = insd.setObject(0);
342 setLocaleDict( 0 ); 338 setLocaleDict( 0 );
343 if ( mLocaleDict ) 339 if ( mLocaleDict )
344 delete mLocaleDict; 340 delete mLocaleDict;
345 //qDebug("KOPrefs::~KOPrefs() "); 341 //qDebug("KOPrefs::~KOPrefs() ");
346} 342}
347 343
348 344
349KOPrefs *KOPrefs::instance() 345KOPrefs *KOPrefs::instance()
350{ 346{
351 if (!mInstance) { 347 if (!mInstance) {
352 mInstance = insd.setObject(new KOPrefs()); 348 mInstance = insd.setObject(new KOPrefs());
353 mInstance->readConfig(); 349 mInstance->readConfig();
354 } 350 }
355 351
356 return mInstance; 352 return mInstance;
357} 353}
358 354
359void KOPrefs::usrSetDefaults() 355void KOPrefs::usrSetDefaults()
360{ 356{
361 357
362} 358}
363 359
364void KOPrefs::fillMailDefaults() 360void KOPrefs::fillMailDefaults()
365{ 361{
366 if (mName.isEmpty()) mName = i18n("Anonymous"); 362 if (mName.isEmpty()) mName = i18n("Anonymous");
367 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 363 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
368} 364}
369 365
370void KOPrefs::setTimeZoneIdDefault() 366void KOPrefs::setTimeZoneIdDefault()
371{ 367{
372 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); 368 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
373} 369}
374 370
375void KOPrefs::setCategoryDefaults() 371void KOPrefs::setCategoryDefaults()
376{ 372{
377 mCustomCategories.clear(); 373 mCustomCategories.clear();
378 mCustomCategories = getDefaultList(); 374 mCustomCategories = getDefaultList();
379 375
380 QStringList::Iterator it; 376 QStringList::Iterator it;
381 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 377 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
382 setCategoryColor(*it,mDefaultCategoryColor); 378 setCategoryColor(*it,mDefaultCategoryColor);
383 } 379 }
384} 380}
385 381
386QStringList KOPrefs::getDefaultList() 382QStringList KOPrefs::getDefaultList()
387{ 383{
388 QStringList retval ; 384 QStringList retval ;
389 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 385 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
390 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 386 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
391 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 387 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
392 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 388 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
393 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 389 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
394 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 390 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
395 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 391 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
396 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 392 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
397 retval.sort(); 393 retval.sort();
398 return retval; 394 return retval;
399} 395}
400 396
401void KOPrefs::usrReadConfig() 397void KOPrefs::usrReadConfig()
402{ 398{
403 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 399 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
404 mLocaleDict = 0; 400 mLocaleDict = 0;
405 // pending LR fix translation 401 // pending LR fix translation
406 // qDebug("KOPrefs::usrReadConfig() fix translation "); 402 // qDebug("KOPrefs::usrReadConfig() fix translation ");
407 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { 403 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) {
408 if ( mPreferredLanguage == 1 ) { 404 if ( mPreferredLanguage == 1 ) {
409 mLocaleDict = new QDict<QString>; 405 mLocaleDict = new QDict<QString>;
410 int i = 0; 406 int i = 0;
411 QString fw ( germanwords[i] [0]); 407 QString fw ( germanwords[i] [0]);
412 while ( !fw.isEmpty() ) { 408 while ( !fw.isEmpty() ) {
413 mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); 409 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
414 ++i; 410 ++i;
415 fw = germanwords[i] [0]; 411 fw = germanwords[i] [0];
416 } 412 }
417 413
418 setLocaleDict( mLocaleDict ); 414 setLocaleDict( mLocaleDict );
419 } else { 415 } else {
420 QString fileName ; 416 QString fileName ;
421 if ( mPreferredLanguage == 3 ) 417 if ( mPreferredLanguage == 3 )
422 fileName = MainWindow::resourcePath()+"usertranslation.txt"; 418 fileName = MainWindow::resourcePath()+"usertranslation.txt";
423 else if ( mPreferredLanguage == 2 ) 419 else if ( mPreferredLanguage == 2 )
424 fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; 420 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
425 QFile file( fileName ); 421 QFile file( fileName );
426 if (file.open( IO_ReadOnly ) ) { 422 if (file.open( IO_ReadOnly ) ) {
427 QTextStream ts( &file ); 423 QTextStream ts( &file );
428 ts.setEncoding( QTextStream::Latin1 ); 424 ts.setEncoding( QTextStream::Latin1 );
429 //ts.setCodec( QTextCodec::latin1 ); 425 //ts.setCodec( QTextCodec::latin1 );
430 QString text = ts.read(); 426 QString text = ts.read();
431 file.close(); 427 file.close();
432 text.replace( QRegExp("\\\\n"), "\n" ); 428 text.replace( QRegExp("\\\\n"), "\n" );
433 QString line; 429 QString line;
434 QString we; 430 QString we;
435 QString wt; 431 QString wt;
436 int br = 0; 432 int br = 0;
437 int nbr; 433 int nbr;
438 nbr = text.find ( "},", br ); 434 nbr = text.find ( "},", br );
439 line = text.mid( br, nbr - br ); 435 line = text.mid( br, nbr - br );
440 br = nbr+1; 436 br = nbr+1;
441 int se, ee, st, et; 437 int se, ee, st, et;
442 mLocaleDict = new QDict<QString>; 438 mLocaleDict = new QDict<QString>;
443 QString end = "{ \"\",\"\" }"; 439 QString end = "{ \"\",\"\" }";
444 while ( (line != end) && (br > 1) ) { 440 while ( (line != end) && (br > 1) ) {
445 //qDebug("%d *%s* ", br, line.latin1()); 441 //qDebug("%d *%s* ", br, line.latin1());
446 se = line.find("\"")+1; 442 se = line.find("\"")+1;
447 et = line.findRev("\"",-1); 443 et = line.findRev("\"",-1);
448 ee = line.find("\",\""); 444 ee = line.find("\",\"");
449 st = ee+3; 445 st = ee+3;
450 we = line.mid( se, ee-se ); 446 we = line.mid( se, ee-se );
451 wt = line.mid( st, et-st ); 447 wt = line.mid( st, et-st );
452 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 448 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
453 mLocaleDict->insert( we, new QString (wt) ); 449 mLocaleDict->insert( we, new QString (wt) );
454 nbr = text.find ( "}", br ); 450 nbr = text.find ( "}", br );
455 line = text.mid( br, nbr - br ); 451 line = text.mid( br, nbr - br );
456 br = nbr+1; 452 br = nbr+1;
457 } 453 }
458 //qDebug("end *%s* ", end.latin1()); 454 //qDebug("end *%s* ", end.latin1());
459 455
460 setLocaleDict( mLocaleDict ); 456 setLocaleDict( mLocaleDict );
461 } else { 457 } else {
462 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 458 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
463 } 459 }
464 460
465 } 461 }
466 } 462 }
467 config()->setGroup("General"); 463 config()->setGroup("General");
468 464
469 mCustomCategories = config()->readListEntry("Custom Categories"); 465 mCustomCategories = config()->readListEntry("Custom Categories");
470 if ( KOPrefs::instance()->mLanguageChanged ) { 466 if ( KOPrefs::instance()->mLanguageChanged ) {
471 mLocationDefaults.clear(); 467 mLocationDefaults.clear();
472 mEventSummaryUser.clear(); 468 mEventSummaryUser.clear();
473 mTodoSummaryUser.clear(); 469 mTodoSummaryUser.clear();
474 } 470 }
475 if (mLocationDefaults.isEmpty()) { 471 if (mLocationDefaults.isEmpty()) {
476 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 472 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
477 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 473 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
478 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 474 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
479 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 475 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
480 mLocationDefaults.sort(); 476 mLocationDefaults.sort();
481 } 477 }
482 478
483 if (mEventSummaryUser.isEmpty()) { 479 if (mEventSummaryUser.isEmpty()) {
484 mEventSummaryUser = getDefaultList() ; 480 mEventSummaryUser = getDefaultList() ;
485 } 481 }
486 if (mTodoSummaryUser.isEmpty()) { 482 if (mTodoSummaryUser.isEmpty()) {
487 mTodoSummaryUser = getDefaultList() ; 483 mTodoSummaryUser = getDefaultList() ;
488 } 484 }
489 485
490 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 486 if (mCustomCategories.isEmpty()) setCategoryDefaults();
491 487
492 config()->setGroup("Personal Settings"); 488 config()->setGroup("Personal Settings");
493 mName = config()->readEntry("user_name",""); 489 mName = config()->readEntry("user_name","");
494 mEmail = config()->readEntry("user_email",""); 490 mEmail = config()->readEntry("user_email","");
495 fillMailDefaults(); 491 fillMailDefaults();
496 492
497 config()->setGroup("Category Colors"); 493 config()->setGroup("Category Colors");
498 QStringList::Iterator it; 494 QStringList::Iterator it;
499 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 495 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
500 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 496 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
501 497
502 } 498 }
503 499
504 if (mTimeZoneId.isEmpty()) { 500 if (mTimeZoneId.isEmpty()) {
505 setTimeZoneIdDefault(); 501 setTimeZoneIdDefault();
506 } 502 }
507 KPimPrefs::usrReadConfig(); 503 KPimPrefs::usrReadConfig();
508} 504}
509 505
510 506
511void KOPrefs::usrWriteConfig() 507void KOPrefs::usrWriteConfig()
512{ 508{
513 config()->setGroup("General"); 509 config()->setGroup("General");
514 config()->writeEntry("Custom Categories",mCustomCategories); 510 config()->writeEntry("Custom Categories",mCustomCategories);
515 511
516 config()->setGroup("Personal Settings"); 512 config()->setGroup("Personal Settings");
517 config()->writeEntry("user_name",mName); 513 config()->writeEntry("user_name",mName);
518 config()->writeEntry("user_email",mEmail); 514 config()->writeEntry("user_email",mEmail);
519 515
520 config()->setGroup("Category Colors"); 516 config()->setGroup("Category Colors");
521 QDictIterator<QColor> it(mCategoryColors); 517 QDictIterator<QColor> it(mCategoryColors);
522 while (it.current()) { 518 while (it.current()) {
523 config()->writeEntry(it.currentKey(),*(it.current())); 519 config()->writeEntry(it.currentKey(),*(it.current()));
524 ++it; 520 ++it;
525 } 521 }
526 522
527 523
528 KPimPrefs::usrWriteConfig(); 524 KPimPrefs::usrWriteConfig();
529} 525}
530 526
531void KOPrefs::setCategoryColor(QString cat,const QColor & color) 527void KOPrefs::setCategoryColor(QString cat,const QColor & color)
532{ 528{
533 mCategoryColors.replace(cat,new QColor(color)); 529 mCategoryColors.replace(cat,new QColor(color));
534} 530}
535 531
536QColor *KOPrefs::categoryColor(QString cat) 532QColor *KOPrefs::categoryColor(QString cat)
537{ 533{
538 QColor *color = 0; 534 QColor *color = 0;
539 535
540 if (!cat.isEmpty()) color = mCategoryColors[cat]; 536 if (!cat.isEmpty()) color = mCategoryColors[cat];
541 537
542 if (color) return color; 538 if (color) return color;
543 else return &mDefaultCategoryColor; 539 else return &mDefaultCategoryColor;
544} 540}
545 541
546void KOPrefs::setFullName(const QString &name) 542void KOPrefs::setFullName(const QString &name)
547{ 543{
548 mName = name; 544 mName = name;
549} 545}
550 546
551void KOPrefs::setEmail(const QString &email) 547void KOPrefs::setEmail(const QString &email)
552{ 548{
553 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 549 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
554 mEmail = email; 550 mEmail = email;
555} 551}
556 552
557QString KOPrefs::fullName() 553QString KOPrefs::fullName()
558{ 554{
559 if (mEmailControlCenter) { 555 if (mEmailControlCenter) {
560 KEMailSettings settings; 556 KEMailSettings settings;
561 return settings.getSetting(KEMailSettings::RealName); 557 return settings.getSetting(KEMailSettings::RealName);
562 } else { 558 } else {
563 return mName; 559 return mName;
564 } 560 }
565} 561}
566 562
567QString KOPrefs::email() 563QString KOPrefs::email()
568{ 564{
569 if (mEmailControlCenter) { 565 if (mEmailControlCenter) {
570 KEMailSettings settings; 566 KEMailSettings settings;
571 return settings.getSetting(KEMailSettings::EmailAddress); 567 return settings.getSetting(KEMailSettings::EmailAddress);
572 } else { 568 } else {
573 return mEmail; 569 return mEmail;
574 } 570 }
575} 571}
576KConfig* KOPrefs::getConfig() 572KConfig* KOPrefs::getConfig()
577{ 573{
578 return config(); 574 return config();
579} 575}
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index a1ba8b3..d9ac851 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,316 +1,313 @@
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#include <qdict.h> 26#include <qdict.h>
27 27
28#include <libkdepim/kpimprefs.h> 28#include <libkdepim/kpimprefs.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 60
61 protected: 61 protected:
62 void setTimeZoneIdDefault(); 62 void setTimeZoneIdDefault();
63 63
64 /** Fill empty mail fields with default values. */ 64 /** Fill empty mail fields with default values. */
65 void fillMailDefaults(); 65 void fillMailDefaults();
66 66
67 private: 67 private:
68 /** Constructor disabled for public. Use instance() to create a KOPrefs 68 /** Constructor disabled for public. Use instance() to create a KOPrefs
69 object. */ 69 object. */
70 KOPrefs(); 70 KOPrefs();
71 71
72 static KOPrefs *mInstance; 72 static KOPrefs *mInstance;
73 QDict<QString> *mLocaleDict; 73 QDict<QString> *mLocaleDict;
74 QStringList getDefaultList(); 74 QStringList getDefaultList();
75 public: 75 public:
76 // preferences data 76 // preferences data
77 KConfig* getConfig(); 77 KConfig* getConfig();
78 void setFullName(const QString &); 78 void setFullName(const QString &);
79 QString fullName(); 79 QString fullName();
80 void setEmail(const QString &); 80 void setEmail(const QString &);
81 QString email(); 81 QString email();
82 82
83 QString mAdditional; 83 QString mAdditional;
84 84
85 bool mEmailControlCenter; 85 bool mEmailControlCenter;
86 86
87 bool mBcc; 87 bool mBcc;
88 bool mAutoSave; 88 bool mAutoSave;
89 int mAutoSaveInterval; 89 int mAutoSaveInterval;
90 bool mConfirm; 90 bool mConfirm;
91 91
92 bool mEnableGroupScheduling; 92 bool mEnableGroupScheduling;
93 bool mEnableProjectView; 93 bool mEnableProjectView;
94 94
95 int mDefaultFormat; 95 int mDefaultFormat;
96 int mMailClient; 96 int mMailClient;
97 97
98 QString mTimeZone; 98 QString mTimeZone;
99 //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius 99 //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius
100 //int mTimeZoneOffset; // e.g. -240 min 100 //int mTimeZoneOffset; // e.g. -240 min
101 int mStartTime; 101 int mStartTime;
102 int mDefaultDuration; 102 int mDefaultDuration;
103 int mAlarmTime; 103 int mAlarmTime;
104 int mDaylightSavings; 104 int mDaylightSavings;
105 105
106 int mWorkingHoursStart; 106 int mWorkingHoursStart;
107 int mWorkingHoursEnd; 107 int mWorkingHoursEnd;
108 bool mExcludeHolidays; 108 bool mExcludeHolidays;
109 bool mExcludeSaturdays; 109 bool mExcludeSaturdays;
110 bool mMarcusBainsShowSeconds; 110 bool mMarcusBainsShowSeconds;
111 111
112 QFont mTimeBarFont; 112 QFont mTimeBarFont;
113 QFont mMonthViewFont; 113 QFont mMonthViewFont;
114 QFont mAgendaViewFont; 114 QFont mAgendaViewFont;
115 QFont mMarcusBainsFont; 115 QFont mMarcusBainsFont;
116 QFont mTimeLabelsFont; 116 QFont mTimeLabelsFont;
117 QFont mTodoViewFont; 117 QFont mTodoViewFont;
118 QFont mListViewFont; 118 QFont mListViewFont;
119 QFont mDateNavigatorFont; 119 QFont mDateNavigatorFont;
120 QFont mEditBoxFont; 120 QFont mEditBoxFont;
121 QFont mJornalViewFont; 121 QFont mJornalViewFont;
122 QFont mWhatsNextFont; 122 QFont mWhatsNextFont;
123 QFont mEventViewFont; 123 QFont mEventViewFont;
124 124
125 125
126 126
127 127
128 QColor mHolidayColor; 128 QColor mHolidayColor;
129 QColor mHighlightColor; 129 QColor mHighlightColor;
130 QColor mEventColor; 130 QColor mEventColor;
131 QColor mAgendaBgColor; 131 QColor mAgendaBgColor;
132 QColor mWorkingHoursColor; 132 QColor mWorkingHoursColor;
133 QColor mTodoDueTodayColor; 133 QColor mTodoDueTodayColor;
134 QColor mTodoOverdueColor; 134 QColor mTodoOverdueColor;
135 QColor mMonthViewEvenColor; 135 QColor mMonthViewEvenColor;
136 QColor mMonthViewOddColor; 136 QColor mMonthViewOddColor;
137 QColor mMonthViewHolidayColor; 137 QColor mMonthViewHolidayColor;
138 bool mMonthViewUsesDayColors; 138 bool mMonthViewUsesDayColors;
139 bool mMonthViewSatSunTog; 139 bool mMonthViewSatSunTog;
140 QColor mAppColor1; 140 QColor mAppColor1;
141 QColor mAppColor2; 141 QColor mAppColor2;
142 bool mUseAppColors; 142 bool mUseAppColors;
143 143
144 int mDayBegins; 144 int mDayBegins;
145 int mHourSize; 145 int mHourSize;
146 int mAllDaySize; 146 int mAllDaySize;
147 bool mShowFullMenu; 147 bool mShowFullMenu;
148 bool mDailyRecur; 148 bool mDailyRecur;
149 bool mWeeklyRecur; 149 bool mWeeklyRecur;
150 bool mMonthDailyRecur; 150 bool mMonthDailyRecur;
151 bool mMonthWeeklyRecur; 151 bool mMonthWeeklyRecur;
152 bool mMonthShowIcons; 152 bool mMonthShowIcons;
153 bool mMonthShowShort; 153 bool mMonthShowShort;
154 bool mEnableToolTips; 154 bool mEnableToolTips;
155 bool mEnableMonthScroll; 155 bool mEnableMonthScroll;
156 bool mFullViewMonth; 156 bool mFullViewMonth;
157 bool mMonthViewUsesCategoryColor; 157 bool mMonthViewUsesCategoryColor;
158 bool mFullViewTodo; 158 bool mFullViewTodo;
159 bool mShowCompletedTodo; 159 bool mShowCompletedTodo;
160 bool mMarcusBainsEnabled; 160 bool mMarcusBainsEnabled;
161 int mNextXDays; 161 int mNextXDays;
162 int mWhatsNextDays; 162 int mWhatsNextDays;
163 int mWhatsNextPrios; 163 int mWhatsNextPrios;
164 bool mEnableQuickTodo; 164 bool mEnableQuickTodo;
165 bool mLanguageChanged; 165 bool mLanguageChanged;
166 166
167 bool mCompactDialogs; 167 bool mCompactDialogs;
168 bool mVerticalScreen; 168 bool mVerticalScreen;
169 169
170 bool mShowIconNewTodo; 170 bool mShowIconNewTodo;
171 bool mShowIconNewEvent; 171 bool mShowIconNewEvent;
172 bool mShowIconSearch; 172 bool mShowIconSearch;
173 bool mShowIconList; 173 bool mShowIconList;
174 bool mShowIconDay1; 174 bool mShowIconDay1;
175 bool mShowIconDay5; 175 bool mShowIconDay5;
176 bool mShowIconDay7; 176 bool mShowIconDay7;
177 bool mShowIconMonth; 177 bool mShowIconMonth;
178 bool mShowIconTodoview; 178 bool mShowIconTodoview;
179 bool mShowIconBackFast; 179 bool mShowIconBackFast;
180 bool mShowIconBack; 180 bool mShowIconBack;
181 bool mShowIconToday; 181 bool mShowIconToday;
182 bool mShowIconForward; 182 bool mShowIconForward;
183 bool mShowIconForwardFast; 183 bool mShowIconForwardFast;
184 bool mShowIconWhatsThis; 184 bool mShowIconWhatsThis;
185 bool mShowIconNextDays; 185 bool mShowIconNextDays;
186 bool mShowIconNext; 186 bool mShowIconNext;
187 bool mShowIconJournal; 187 bool mShowIconJournal;
188 188
189 bool mShowIconStretch; 189 bool mShowIconStretch;
190 190
191 bool mToolBarHor; 191 bool mToolBarHor;
192 bool mToolBarUp; 192 bool mToolBarUp;
193 bool mToolBarMiniIcons; 193 bool mToolBarMiniIcons;
194 194
195 bool mAskForQuit; 195 bool mAskForQuit;
196 bool mUsePassWd; 196 bool mUsePassWd;
197 bool mWriteBackFile; 197 bool mWriteBackFile;
198 int mWriteBackInFuture; 198 int mWriteBackInFuture;
199 bool mAskForPreferences; 199 bool mAskForPreferences;
200 bool mShowSyncSummary; 200 bool mShowSyncSummary;
201 bool mShowSyncEvents; 201 bool mShowSyncEvents;
202 bool mShowTodoInAgenda; 202 bool mShowTodoInAgenda;
203 bool mWriteBackExistingOnly; 203 bool mWriteBackExistingOnly;
204 204
205 QString mRemoteIP; 205 QString mRemoteIP;
206 QString mRemoteUser; 206 QString mRemoteUser;
207 QString mRemotePassWd; 207 QString mRemotePassWd;
208 QString mRemoteFile; 208 QString mRemoteFile;
209 QString mLocalTempFile; 209 QString mLocalTempFile;
210 QString mPhoneDevice; 210 QString mPhoneDevice;
211 QString mPhoneConnection; 211 QString mPhoneConnection;
212 QString mPhoneModel; 212 QString mPhoneModel;
213 QString mEx2PhoneDevice;
214 QString mEx2PhoneConnection;
215 QString mEx2PhoneModel;
216 213
217 int mLastSyncTime; 214 int mLastSyncTime;
218 int mSyncAlgoPrefs; 215 int mSyncAlgoPrefs;
219 int mRingSyncAlgoPrefs; 216 int mRingSyncAlgoPrefs;
220 QStringList mSyncProfileNames; 217 QStringList mSyncProfileNames;
221 QStringList mExternSyncProfiles; 218 QStringList mExternSyncProfiles;
222 QString mLocalMachineName; 219 QString mLocalMachineName;
223 void setCategoryColor(QString cat,const QColor & color); 220 void setCategoryColor(QString cat,const QColor & color);
224 QColor *categoryColor(QString cat); 221 QColor *categoryColor(QString cat);
225 222
226 QString mArchiveFile; 223 QString mArchiveFile;
227 QString mHtmlExportFile; 224 QString mHtmlExportFile;
228 bool mHtmlWithSave; 225 bool mHtmlWithSave;
229 226
230 QStringList mSelectedPlugins; 227 QStringList mSelectedPlugins;
231 228
232 QString mLastImportFile; 229 QString mLastImportFile;
233 QString mLastVcalFile; 230 QString mLastVcalFile;
234 QString mLastSaveFile; 231 QString mLastSaveFile;
235 QString mLastLoadFile; 232 QString mLastLoadFile;
236 QString mLastSyncedLocalFile; 233 QString mLastSyncedLocalFile;
237 234
238 235
239 QString mDefaultAlarmFile; 236 QString mDefaultAlarmFile;
240 int mIMIPScheduler; 237 int mIMIPScheduler;
241 int mIMIPSend; 238 int mIMIPSend;
242 QStringList mAdditionalMails; 239 QStringList mAdditionalMails;
243 int mIMIPAutoRefresh; 240 int mIMIPAutoRefresh;
244 int mIMIPAutoInsertReply; 241 int mIMIPAutoInsertReply;
245 int mIMIPAutoInsertRequest; 242 int mIMIPAutoInsertRequest;
246 int mIMIPAutoFreeBusy; 243 int mIMIPAutoFreeBusy;
247 int mIMIPAutoFreeBusyReply; 244 int mIMIPAutoFreeBusyReply;
248 245
249 QStringList mTodoTemplates; 246 QStringList mTodoTemplates;
250 QStringList mEventTemplates; 247 QStringList mEventTemplates;
251 248
252 int mDestination; 249 int mDestination;
253 250
254 251
255 bool mEditOnDoubleClick; 252 bool mEditOnDoubleClick;
256 bool mViewChangeHoldFullscreen; 253 bool mViewChangeHoldFullscreen;
257 bool mViewChangeHoldNonFullscreen; 254 bool mViewChangeHoldNonFullscreen;
258 bool mCenterOnCurrentTime; 255 bool mCenterOnCurrentTime;
259 bool mSetTimeToDayStartAt; 256 bool mSetTimeToDayStartAt;
260 bool mHighlightCurrentDay; 257 bool mHighlightCurrentDay;
261 bool mUseHighlightLightColor; 258 bool mUseHighlightLightColor;
262 bool mListViewMonthTimespan; 259 bool mListViewMonthTimespan;
263 bool mWNViewShowsParents; 260 bool mWNViewShowsParents;
264 bool mWNViewShowLocation; 261 bool mWNViewShowLocation;
265 bool mTodoViewShowsPercentage; 262 bool mTodoViewShowsPercentage;
266 bool mTodoViewUsesCatColors; 263 bool mTodoViewUsesCatColors;
267 bool mTodoViewUsesSmallFont; 264 bool mTodoViewUsesSmallFont;
268 bool mTodoViewUsesForegroundColor; 265 bool mTodoViewUsesForegroundColor;
269 bool mMonthViewUsesForegroundColor; 266 bool mMonthViewUsesForegroundColor;
270 267
271 bool mHightlightDateTimeEdit; 268 bool mHightlightDateTimeEdit;
272 bool mShortDateInViewer; 269 bool mShortDateInViewer;
273 270
274 QStringList mLocationDefaults; 271 QStringList mLocationDefaults;
275 QStringList mEventSummaryUser; 272 QStringList mEventSummaryUser;
276 QStringList mTodoSummaryUser; 273 QStringList mTodoSummaryUser;
277 274
278 bool mUseInternalAlarmNotification; 275 bool mUseInternalAlarmNotification;
279 int mAlarmPlayBeeps; 276 int mAlarmPlayBeeps;
280 int mAlarmSuspendTime; 277 int mAlarmSuspendTime;
281 int mAlarmSuspendCount; 278 int mAlarmSuspendCount;
282 int mAlarmBeepInterval; 279 int mAlarmBeepInterval;
283 280
284 QString mPassiveSyncPort; 281 QString mPassiveSyncPort;
285 QString mPassiveSyncPw; 282 QString mPassiveSyncPw;
286 QString mActiveSyncPort; 283 QString mActiveSyncPort;
287 QString mActiveSyncIP; 284 QString mActiveSyncIP;
288 285
289 286
290 //US I copied the following settings into KPimGlobalPrefs 287 //US I copied the following settings into KPimGlobalPrefs
291 // that allows us later to easily remove the settings from here. 288 // that allows us later to easily remove the settings from here.
292 int mPreferredDate; 289 int mPreferredDate;
293 QString mUserDateFormatLong; 290 QString mUserDateFormatLong;
294 QString mUserDateFormatShort; 291 QString mUserDateFormatShort;
295 int mPreferredLanguage; 292 int mPreferredLanguage;
296 int mPreferredTime; 293 int mPreferredTime;
297 bool mWeekStartsOnSunday; 294 bool mWeekStartsOnSunday;
298 QString mTimeZoneId; 295 QString mTimeZoneId;
299 bool mUseDaylightsaving; 296 bool mUseDaylightsaving;
300 int mDaylightsavingStart; 297 int mDaylightsavingStart;
301 int mDaylightsavingEnd; 298 int mDaylightsavingEnd;
302 299
303 300
304 private: 301 private:
305 QDict<QColor> mCategoryColors; 302 QDict<QColor> mCategoryColors;
306 QColor mDefaultCategoryColor; 303 QColor mDefaultCategoryColor;
307 304
308 QFont mDefaultTimeBarFont; 305 QFont mDefaultTimeBarFont;
309 QFont mDefaultViewFont; 306 QFont mDefaultViewFont;
310 QFont mDefaultMonthViewFont; 307 QFont mDefaultMonthViewFont;
311 308
312 QString mName; 309 QString mName;
313 QString mEmail; 310 QString mEmail;
314}; 311};
315 312
316#endif 313#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index bd14fbf..2f286e0 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,618 +1,618 @@
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 <libkcal/kincidenceformatter.h> 42#include <libkcal/kincidenceformatter.h>
43#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
44 44
45#include "calendarview.h" 45#include "calendarview.h"
46#include "koviewmanager.h" 46#include "koviewmanager.h"
47#include "datenavigator.h" 47#include "datenavigator.h"
48#include "koagendaview.h" 48#include "koagendaview.h"
49#include "koagenda.h" 49#include "koagenda.h"
50#include "kodialogmanager.h" 50#include "kodialogmanager.h"
51#include "kdialogbase.h" 51#include "kdialogbase.h"
52#include "kapplication.h" 52#include "kapplication.h"
53#include "kofilterview.h" 53#include "kofilterview.h"
54#include "kstandarddirs.h" 54#include "kstandarddirs.h"
55#include "koprefs.h" 55#include "koprefs.h"
56#include "kfiledialog.h" 56#include "kfiledialog.h"
57#include "koglobals.h" 57#include "koglobals.h"
58#include "kglobal.h" 58#include "kglobal.h"
59#include "klocale.h" 59#include "klocale.h"
60#include "kconfig.h" 60#include "kconfig.h"
61#include "simplealarmclient.h" 61#include "simplealarmclient.h"
62#include "externalapphandler.h" 62#include "externalapphandler.h"
63 63
64using namespace KCal; 64using namespace KCal;
65#ifndef _WIN32_ 65#ifndef _WIN32_
66#include <unistd.h> 66#include <unistd.h>
67#else 67#else
68#include "koimportoldialog.h" 68#include "koimportoldialog.h"
69#endif 69#endif
70#include "mainwindow.h" 70#include "mainwindow.h"
71 71
72class KOex2phonePrefs : public QDialog 72class KOex2phonePrefs : public QDialog
73{ 73{
74 public: 74 public:
75 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 75 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
76 QDialog( parent, name, true ) 76 QDialog( parent, name, true )
77 { 77 {
78 setCaption( i18n("Export to phone options") ); 78 setCaption( i18n("Export to phone options") );
79 QVBoxLayout* lay = new QVBoxLayout( this ); 79 QVBoxLayout* lay = new QVBoxLayout( this );
80 lay->setSpacing( 3 ); 80 lay->setSpacing( 3 );
81 lay->setMargin( 3 ); 81 lay->setMargin( 3 );
82 QLabel *lab; 82 QLabel *lab;
83 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 83 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
84 lab->setAlignment (AlignHCenter ); 84 lab->setAlignment (AlignHCenter );
85 QHBox* temphb; 85 QHBox* temphb;
86 temphb = new QHBox( this ); 86 temphb = new QHBox( this );
87 new QLabel( i18n("I/O device: "), temphb ); 87 new QLabel( i18n("I/O device: "), temphb );
88 mPhoneDevice = new QLineEdit( temphb); 88 mPhoneDevice = new QLineEdit( temphb);
89 lay->addWidget( temphb ); 89 lay->addWidget( temphb );
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("Connection: "), temphb ); 91 new QLabel( i18n("Connection: "), temphb );
92 mPhoneConnection = new QLineEdit( temphb); 92 mPhoneConnection = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Model(opt.): "), temphb ); 95 new QLabel( i18n("Model(opt.): "), temphb );
96 mPhoneModel = new QLineEdit( temphb); 96 mPhoneModel = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 98 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
99 mWriteBackFuture->setChecked( true ); 99 mWriteBackFuture->setChecked( true );
100 lay->addWidget( mWriteBackFuture ); 100 lay->addWidget( mWriteBackFuture );
101 temphb = new QHBox( this ); 101 temphb = new QHBox( this );
102 new QLabel( i18n("Max. weeks in future: ") , temphb ); 102 new QLabel( i18n("Max. weeks in future: ") , temphb );
103 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 103 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
104 mWriteBackFutureWeeks->setValue( 8 ); 104 mWriteBackFutureWeeks->setValue( 8 );
105 lay->addWidget( temphb ); 105 lay->addWidget( temphb );
106 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\n todo/calendar data on phone!"), this ) ); 106 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
107 lab->setAlignment (AlignHCenter ); 107 lab->setAlignment (AlignHCenter );
108 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 108 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
109 lay->addWidget( ok ); 109 lay->addWidget( ok );
110 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 110 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
111 lay->addWidget( cancel ); 111 lay->addWidget( cancel );
112 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 112 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
113 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 113 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
114 resize( 220, 240 ); 114 resize( 220, 240 );
115 115
116 } 116 }
117 117
118public: 118public:
119 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 119 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
120 QCheckBox* mWriteBackFuture; 120 QCheckBox* mWriteBackFuture;
121 QSpinBox* mWriteBackFutureWeeks; 121 QSpinBox* mWriteBackFutureWeeks;
122}; 122};
123 123
124int globalFlagBlockStartup; 124int globalFlagBlockStartup;
125MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 125MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
126 QMainWindow( parent, name ) 126 QMainWindow( parent, name )
127{ 127{
128 mPassWordPiSync = "abc"; 128 mPassWordPiSync = "abc";
129#ifdef DESKTOP_VERSION 129#ifdef DESKTOP_VERSION
130 setFont( QFont("Arial"), 14 ); 130 setFont( QFont("Arial"), 14 );
131#endif 131#endif
132 mSyncActionDialog = 0; 132 mSyncActionDialog = 0;
133 mServerSocket = 0; 133 mServerSocket = 0;
134 mClosed = false; 134 mClosed = false;
135 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 135 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
136 QString confFile = locateLocal("config","korganizerrc"); 136 QString confFile = locateLocal("config","korganizerrc");
137 QFileInfo finf ( confFile ); 137 QFileInfo finf ( confFile );
138 bool showWarning = !finf.exists(); 138 bool showWarning = !finf.exists();
139 setIcon(SmallIcon( "ko24" ) ); 139 setIcon(SmallIcon( "ko24" ) );
140 mBlockAtStartup = true; 140 mBlockAtStartup = true;
141 mFlagKeyPressed = false; 141 mFlagKeyPressed = false;
142 setCaption("KOrganizer/Pi"); 142 setCaption("KOrganizer/Pi");
143 KOPrefs *p = KOPrefs::instance(); 143 KOPrefs *p = KOPrefs::instance();
144 KPimGlobalPrefs::instance()->setGlobalConfig(); 144 KPimGlobalPrefs::instance()->setGlobalConfig();
145 // if ( QApplication::desktop()->height() > 480 ) { 145 // if ( QApplication::desktop()->height() > 480 ) {
146// if ( p->mHourSize == 4 ) 146// if ( p->mHourSize == 4 )
147// p->mHourSize = 6; 147// p->mHourSize = 6;
148// } 148// }
149 if ( p->mHourSize > 18 ) 149 if ( p->mHourSize > 18 )
150 p->mHourSize = 18; 150 p->mHourSize = 18;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
155 else 155 else
156 tbd = Top; 156 tbd = Top;
157 } 157 }
158 else { 158 else {
159 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
160 tbd = Right; 160 tbd = Right;
161 else 161 else
162 tbd = Left; 162 tbd = Left;
163 } 163 }
164 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
166 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
167 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
168 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
169 mBlockSaveFlag = false; 169 mBlockSaveFlag = false;
170 mCalendarModifiedFlag = false; 170 mCalendarModifiedFlag = false;
171 171
172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
173 splash->setAlignment ( AlignCenter ); 173 splash->setAlignment ( AlignCenter );
174 setCentralWidget( splash ); 174 setCentralWidget( splash );
175#ifndef DESKTOP_VERSION 175#ifndef DESKTOP_VERSION
176 showMaximized(); 176 showMaximized();
177#endif 177#endif
178 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 178 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
179 setDefaultPreferences(); 179 setDefaultPreferences();
180 mCalendar = new CalendarLocal(); 180 mCalendar = new CalendarLocal();
181 mView = new CalendarView( mCalendar, this,"mCalendar " ); 181 mView = new CalendarView( mCalendar, this,"mCalendar " );
182 mView->hide(); 182 mView->hide();
183 //mView->resize(splash->size() ); 183 //mView->resize(splash->size() );
184 initActions(); 184 initActions();
185#ifndef DESKTOP_VERSION 185#ifndef DESKTOP_VERSION
186 iconToolBar->show(); 186 iconToolBar->show();
187 qApp->processEvents(); 187 qApp->processEvents();
188#endif 188#endif
189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
190 int vh = height() ; 190 int vh = height() ;
191 int vw = width(); 191 int vw = width();
192 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 192 //qDebug("Toolbar hei %d ",iconToolBar->height() );
193 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 193 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
194 vh -= iconToolBar->height(); 194 vh -= iconToolBar->height();
195 } else { 195 } else {
196 vw -= iconToolBar->height(); 196 vw -= iconToolBar->height();
197 } 197 }
198 //mView->setMaximumSize( splash->size() ); 198 //mView->setMaximumSize( splash->size() );
199 //mView->resize( splash->size() ); 199 //mView->resize( splash->size() );
200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
201 mView->readSettings(); 201 mView->readSettings();
202 bool newFile = false; 202 bool newFile = false;
203 if( !QFile::exists( defaultFileName() ) ) { 203 if( !QFile::exists( defaultFileName() ) ) {
204 QFileInfo finfo ( defaultFileName() ); 204 QFileInfo finfo ( defaultFileName() );
205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
206 qDebug("oldfile %s ", oldFile.latin1()); 206 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"; 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";
208 finfo.setFile( oldFile ); 208 finfo.setFile( oldFile );
209 if (finfo.exists() ) { 209 if (finfo.exists() ) {
210 KMessageBox::information( this, message); 210 KMessageBox::information( this, message);
211 mView->openCalendar( oldFile ); 211 mView->openCalendar( oldFile );
212 qApp->processEvents(); 212 qApp->processEvents();
213 } else { 213 } else {
214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
215 finfo.setFile( oldFile ); 215 finfo.setFile( oldFile );
216 if (finfo.exists() ) { 216 if (finfo.exists() ) {
217 KMessageBox::information( this, message); 217 KMessageBox::information( this, message);
218 mView->openCalendar( oldFile ); 218 mView->openCalendar( oldFile );
219 qApp->processEvents(); 219 qApp->processEvents();
220 } 220 }
221 } 221 }
222 mView->saveCalendar( defaultFileName() ); 222 mView->saveCalendar( defaultFileName() );
223 newFile = true; 223 newFile = true;
224 } 224 }
225 225
226 QTime neededSaveTime = QDateTime::currentDateTime().time(); 226 QTime neededSaveTime = QDateTime::currentDateTime().time();
227 mView->openCalendar( defaultFileName() ); 227 mView->openCalendar( defaultFileName() );
228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
229 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 229 qDebug("KO: Calendar loading time: %d ms",msNeeded );
230 230
231 if ( KOPrefs::instance()->mLanguageChanged ) { 231 if ( KOPrefs::instance()->mLanguageChanged ) {
232 KOPrefs::instance()->setCategoryDefaults(); 232 KOPrefs::instance()->setCategoryDefaults();
233 int count = mView->addCategories(); 233 int count = mView->addCategories();
234 KOPrefs::instance()->mLanguageChanged = false; 234 KOPrefs::instance()->mLanguageChanged = false;
235 } 235 }
236 processIncidenceSelection( 0 ); 236 processIncidenceSelection( 0 );
237 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 237 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
238 SLOT( processIncidenceSelection( Incidence * ) ) ); 238 SLOT( processIncidenceSelection( Incidence * ) ) );
239 connect( mView, SIGNAL( modifiedChanged( bool ) ), 239 connect( mView, SIGNAL( modifiedChanged( bool ) ),
240 SLOT( slotModifiedChanged( bool ) ) ); 240 SLOT( slotModifiedChanged( bool ) ) );
241 241
242 242
243 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 243 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
244 mView->setModified( false ); 244 mView->setModified( false );
245 mBlockAtStartup = false; 245 mBlockAtStartup = false;
246 mView->setModified( false ); 246 mView->setModified( false );
247 setCentralWidget( mView ); 247 setCentralWidget( mView );
248 globalFlagBlockStartup = 0; 248 globalFlagBlockStartup = 0;
249 mView->show(); 249 mView->show();
250 delete splash; 250 delete splash;
251 if ( newFile ) 251 if ( newFile )
252 mView->updateConfig(); 252 mView->updateConfig();
253 // qApp->processEvents(); 253 // qApp->processEvents();
254 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 254 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
255 fillSyncMenu(); 255 fillSyncMenu();
256 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 256 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
257 if ( showWarning ) { 257 if ( showWarning ) {
258 KMessageBox::information( this, 258 KMessageBox::information( this,
259 "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"); 259 "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");
260 qApp->processEvents(); 260 qApp->processEvents();
261 mView->dialogManager()->showSyncOptions(); 261 mView->dialogManager()->showSyncOptions();
262 } 262 }
263 263
264 //US listen for result adressed from Ka/Pi 264 //US listen for result adressed from Ka/Pi
265#ifndef DESKTOP_VERSION 265#ifndef DESKTOP_VERSION
266 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 266 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
267#endif 267#endif
268} 268}
269MainWindow::~MainWindow() 269MainWindow::~MainWindow()
270{ 270{
271 //qDebug("MainWindow::~MainWindow() "); 271 //qDebug("MainWindow::~MainWindow() ");
272 //save toolbar location 272 //save toolbar location
273 delete mServerSocket; 273 delete mServerSocket;
274 delete mCalendar; 274 delete mCalendar;
275 delete KOPrefs::instance(); 275 delete KOPrefs::instance();
276 delete KIncidenceFormatter::instance(); 276 delete KIncidenceFormatter::instance();
277 277
278 278
279} 279}
280void MainWindow::showMaximized () 280void MainWindow::showMaximized ()
281{ 281{
282#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
283 if ( ! globalFlagBlockStartup ) 283 if ( ! globalFlagBlockStartup )
284 if ( mClosed ) 284 if ( mClosed )
285 mView->goToday(); 285 mView->goToday();
286#endif 286#endif
287 QWidget::showMaximized () ; 287 QWidget::showMaximized () ;
288 mClosed = false; 288 mClosed = false;
289} 289}
290void MainWindow::closeEvent( QCloseEvent* ce ) 290void MainWindow::closeEvent( QCloseEvent* ce )
291{ 291{
292 292
293 293
294 294
295 if ( ! KOPrefs::instance()->mAskForQuit ) { 295 if ( ! KOPrefs::instance()->mAskForQuit ) {
296 saveOnClose(); 296 saveOnClose();
297 mClosed = true; 297 mClosed = true;
298 ce->accept(); 298 ce->accept();
299 return; 299 return;
300 300
301 } 301 }
302 302
303 switch( QMessageBox::information( this, "KO/Pi", 303 switch( QMessageBox::information( this, "KO/Pi",
304 i18n("Do you really want\nto close KO/Pi?"), 304 i18n("Do you really want\nto close KO/Pi?"),
305 i18n("Close"), i18n("No"), 305 i18n("Close"), i18n("No"),
306 0, 0 ) ) { 306 0, 0 ) ) {
307 case 0: 307 case 0:
308 saveOnClose(); 308 saveOnClose();
309 mClosed = true; 309 mClosed = true;
310 ce->accept(); 310 ce->accept();
311 break; 311 break;
312 case 1: 312 case 1:
313 ce->ignore(); 313 ce->ignore();
314 break; 314 break;
315 case 2: 315 case 2:
316 316
317 default: 317 default:
318 break; 318 break;
319 } 319 }
320 320
321 321
322} 322}
323 323
324void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 324void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
325{ 325{
326 QDataStream stream( data, IO_ReadOnly ); 326 QDataStream stream( data, IO_ReadOnly );
327 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 327 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
328 //QString datamess; 328 //QString datamess;
329 //qDebug("message "); 329 //qDebug("message ");
330 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 330 qDebug("KO: QCOP message received: %s ", cmsg.data() );
331 331
332 if ( cmsg == "-writeFile" ) { 332 if ( cmsg == "-writeFile" ) {
333 // I made from the "-writeFile" an "-writeAlarm" 333 // I made from the "-writeFile" an "-writeAlarm"
334 mView->viewManager()->showWhatsNextView(); 334 mView->viewManager()->showWhatsNextView();
335 mCalendar->checkAlarmForIncidence( 0, true); 335 mCalendar->checkAlarmForIncidence( 0, true);
336 showMaximized(); 336 showMaximized();
337 raise(); 337 raise();
338 return; 338 return;
339 } 339 }
340 340
341 if ( cmsg == "-writeFile" ) { 341 if ( cmsg == "-writeFile" ) {
342 // I made from the "-writeFile" an "-writeAlarm" 342 // I made from the "-writeFile" an "-writeAlarm"
343 mView->viewManager()->showWhatsNextView(); 343 mView->viewManager()->showWhatsNextView();
344 mCalendar->checkAlarmForIncidence( 0, true); 344 mCalendar->checkAlarmForIncidence( 0, true);
345 showMaximized(); 345 showMaximized();
346 raise(); 346 raise();
347 return; 347 return;
348 348
349 } 349 }
350 if ( cmsg == "-writeFileSilent" ) { 350 if ( cmsg == "-writeFileSilent" ) {
351 // I made from the "-writeFile" an "-writeAlarm" 351 // I made from the "-writeFile" an "-writeAlarm"
352 // mView->viewManager()->showWhatsNextView(); 352 // mView->viewManager()->showWhatsNextView();
353 mCalendar->checkAlarmForIncidence( 0, true); 353 mCalendar->checkAlarmForIncidence( 0, true);
354 //showMaximized(); 354 //showMaximized();
355 //raise(); 355 //raise();
356 hide(); 356 hide();
357 return; 357 return;
358 } 358 }
359 if ( cmsg == "-newCountdown" ) { 359 if ( cmsg == "-newCountdown" ) {
360 qDebug("newCountdown "); 360 qDebug("newCountdown ");
361 361
362 } 362 }
363 QString msg ; 363 QString msg ;
364 QString allmsg = cmsg; 364 QString allmsg = cmsg;
365 while ( allmsg.length() > 0 ) { 365 while ( allmsg.length() > 0 ) {
366 int nextC = allmsg.find( "-", 1 ); 366 int nextC = allmsg.find( "-", 1 );
367 if ( nextC == -1 ) { 367 if ( nextC == -1 ) {
368 msg = allmsg; 368 msg = allmsg;
369 allmsg = ""; 369 allmsg = "";
370 } else{ 370 } else{
371 msg = allmsg.left( nextC ); 371 msg = allmsg.left( nextC );
372 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 372 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
373 } 373 }
374 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 374 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
375 if ( msg == "-newEvent" ) { 375 if ( msg == "-newEvent" ) {
376 mView->newEvent(); 376 mView->newEvent();
377 } 377 }
378 if ( msg == "-newTodo" ) { 378 if ( msg == "-newTodo" ) {
379 mView->newTodo(); 379 mView->newTodo();
380 380
381 } 381 }
382 if ( msg == "-showWN" ) { 382 if ( msg == "-showWN" ) {
383 mView->viewManager()->showWhatsNextView(); 383 mView->viewManager()->showWhatsNextView();
384 } 384 }
385 if ( msg == "-showTodo" ) { 385 if ( msg == "-showTodo" ) {
386 mView->viewManager()->showTodoView(); 386 mView->viewManager()->showTodoView();
387 } 387 }
388 if ( msg == "-showList" ) { 388 if ( msg == "-showList" ) {
389 mView->viewManager()->showListView(); 389 mView->viewManager()->showListView();
390 } 390 }
391 else if ( msg == "-showDay" ) { 391 else if ( msg == "-showDay" ) {
392 mView->viewManager()->showDayView(); 392 mView->viewManager()->showDayView();
393 } 393 }
394 else if ( msg == "-showWWeek" ) { 394 else if ( msg == "-showWWeek" ) {
395 mView->viewManager()->showWorkWeekView(); 395 mView->viewManager()->showWorkWeekView();
396 } 396 }
397 else if ( msg == "-ringSync" ) { 397 else if ( msg == "-ringSync" ) {
398 multiSync( false ); 398 multiSync( false );
399 } 399 }
400 else if ( msg == "-showWeek" ) { 400 else if ( msg == "-showWeek" ) {
401 mView->viewManager()->showWeekView(); 401 mView->viewManager()->showWeekView();
402 } 402 }
403 else if ( msg == "-showTodo" ) { 403 else if ( msg == "-showTodo" ) {
404 mView->viewManager()->showTodoView(); 404 mView->viewManager()->showTodoView();
405 } 405 }
406 else if ( msg == "-showJournal" ) { 406 else if ( msg == "-showJournal" ) {
407 mView->dateNavigator()->selectDates( 1 ); 407 mView->dateNavigator()->selectDates( 1 );
408 mView->dateNavigator()->selectToday(); 408 mView->dateNavigator()->selectToday();
409 mView->viewManager()->showJournalView(); 409 mView->viewManager()->showJournalView();
410 } 410 }
411 else if ( msg == "-showKO" ) { 411 else if ( msg == "-showKO" ) {
412 mView->viewManager()->showNextXView(); 412 mView->viewManager()->showNextXView();
413 } 413 }
414 else if ( msg == "-showWNext" || msg == "nextView()" ) { 414 else if ( msg == "-showWNext" || msg == "nextView()" ) {
415 mView->viewManager()->showWhatsNextView(); 415 mView->viewManager()->showWhatsNextView();
416 } 416 }
417 else if ( msg == "-showNextXView" ) { 417 else if ( msg == "-showNextXView" ) {
418 mView->viewManager()->showNextXView(); 418 mView->viewManager()->showNextXView();
419 } 419 }
420 420
421 421
422 } 422 }
423 423
424 showMaximized(); 424 showMaximized();
425 raise(); 425 raise();
426} 426}
427 427
428QPixmap MainWindow::loadPixmap( QString name ) 428QPixmap MainWindow::loadPixmap( QString name )
429{ 429{
430 return SmallIcon( name ); 430 return SmallIcon( name );
431 431
432} 432}
433void MainWindow::initActions() 433void MainWindow::initActions()
434{ 434{
435 //KOPrefs::instance()->mShowFullMenu 435 //KOPrefs::instance()->mShowFullMenu
436 iconToolBar->clear(); 436 iconToolBar->clear();
437 KOPrefs *p = KOPrefs::instance(); 437 KOPrefs *p = KOPrefs::instance();
438 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 438 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
439 439
440 QPopupMenu *viewMenu = new QPopupMenu( this ); 440 QPopupMenu *viewMenu = new QPopupMenu( this );
441 QPopupMenu *actionMenu = new QPopupMenu( this ); 441 QPopupMenu *actionMenu = new QPopupMenu( this );
442 QPopupMenu *importMenu = new QPopupMenu( this ); 442 QPopupMenu *importMenu = new QPopupMenu( this );
443 selectFilterMenu = new QPopupMenu( this ); 443 selectFilterMenu = new QPopupMenu( this );
444 selectFilterMenu->setCheckable( true ); 444 selectFilterMenu->setCheckable( true );
445 syncMenu = new QPopupMenu( this ); 445 syncMenu = new QPopupMenu( this );
446 configureAgendaMenu = new QPopupMenu( this ); 446 configureAgendaMenu = new QPopupMenu( this );
447 configureToolBarMenu = new QPopupMenu( this ); 447 configureToolBarMenu = new QPopupMenu( this );
448 QPopupMenu *helpMenu = new QPopupMenu( this ); 448 QPopupMenu *helpMenu = new QPopupMenu( this );
449 if ( KOPrefs::instance()->mShowFullMenu ) { 449 if ( KOPrefs::instance()->mShowFullMenu ) {
450 QMenuBar *menuBar1; 450 QMenuBar *menuBar1;
451 menuBar1 = menuBar(); 451 menuBar1 = menuBar();
452 menuBar1->insertItem( i18n("File"), importMenu ); 452 menuBar1->insertItem( i18n("File"), importMenu );
453 menuBar1->insertItem( i18n("View"), viewMenu ); 453 menuBar1->insertItem( i18n("View"), viewMenu );
454 menuBar1->insertItem( i18n("Actions"), actionMenu ); 454 menuBar1->insertItem( i18n("Actions"), actionMenu );
455 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 455 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
456 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 456 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
457 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 457 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
458 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 458 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
459 menuBar1->insertItem( i18n("Help"), helpMenu ); 459 menuBar1->insertItem( i18n("Help"), helpMenu );
460 } else { 460 } else {
461 QPEMenuBar *menuBar1; 461 QPEMenuBar *menuBar1;
462 menuBar1 = new QPEMenuBar( iconToolBar ); 462 menuBar1 = new QPEMenuBar( iconToolBar );
463 QPopupMenu *menuBar = new QPopupMenu( this ); 463 QPopupMenu *menuBar = new QPopupMenu( this );
464 menuBar1->insertItem( i18n("ME"), menuBar); 464 menuBar1->insertItem( i18n("ME"), menuBar);
465 menuBar->insertItem( i18n("File"), importMenu ); 465 menuBar->insertItem( i18n("File"), importMenu );
466 menuBar->insertItem( i18n("View"), viewMenu ); 466 menuBar->insertItem( i18n("View"), viewMenu );
467 menuBar->insertItem( i18n("Actions"), actionMenu ); 467 menuBar->insertItem( i18n("Actions"), actionMenu );
468 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 468 menuBar->insertItem( i18n("Synchronize"), syncMenu );
469 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 469 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
470 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 470 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
471 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 471 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
472 menuBar->insertItem( i18n("Help"), helpMenu ); 472 menuBar->insertItem( i18n("Help"), helpMenu );
473 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 473 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
474 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 474 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
475 } 475 }
476 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 476 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
477 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 477 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
478 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 478 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
479 479
480 // ****************** 480 // ******************
481 QAction *action; 481 QAction *action;
482 QIconSet icon; 482 QIconSet icon;
483 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 483 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
484 configureToolBarMenu->setCheckable( true ); 484 configureToolBarMenu->setCheckable( true );
485 485
486 QString pathString = ""; 486 QString pathString = "";
487 if ( !p->mToolBarMiniIcons ) { 487 if ( !p->mToolBarMiniIcons ) {
488 if ( QApplication::desktop()->width() < 480 ) 488 if ( QApplication::desktop()->width() < 480 )
489 pathString += "icons16/"; 489 pathString += "icons16/";
490 } else 490 } else
491 pathString += "iconsmini/"; 491 pathString += "iconsmini/";
492 configureAgendaMenu->setCheckable( true ); 492 configureAgendaMenu->setCheckable( true );
493 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 493 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
494 configureAgendaMenu->insertSeparator(); 494 configureAgendaMenu->insertSeparator();
495 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 495 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
496 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 496 configureAgendaMenu->insertItem(i18n("Small"), 6 );
497 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 497 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
498 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 498 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
499 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 499 configureAgendaMenu->insertItem(i18n("Large"), 12 );
500 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 500 configureAgendaMenu->insertItem(i18n("Big"), 14 );
501 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 501 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
502 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 502 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
503 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 503 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
504 504
505 icon = loadPixmap( pathString + "configure" ); 505 icon = loadPixmap( pathString + "configure" );
506 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 506 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
507 action->addTo( actionMenu ); 507 action->addTo( actionMenu );
508 connect( action, SIGNAL( activated() ), 508 connect( action, SIGNAL( activated() ),
509 mView, SLOT( edit_options() ) ); 509 mView, SLOT( edit_options() ) );
510 actionMenu->insertSeparator(); 510 actionMenu->insertSeparator();
511 icon = loadPixmap( pathString + "newevent" ); 511 icon = loadPixmap( pathString + "newevent" );
512 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 512 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
513 configureToolBarMenu->insertSeparator(); 513 configureToolBarMenu->insertSeparator();
514 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 514 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
515 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 515 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
516 ne_action->addTo( actionMenu ); 516 ne_action->addTo( actionMenu );
517 connect( ne_action, SIGNAL( activated() ), 517 connect( ne_action, SIGNAL( activated() ),
518 mView, SLOT( newEvent() ) ); 518 mView, SLOT( newEvent() ) );
519 icon = loadPixmap( pathString + "newtodo" ); 519 icon = loadPixmap( pathString + "newtodo" );
520 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 520 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
521 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 521 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
522 nt_action->addTo( actionMenu ); 522 nt_action->addTo( actionMenu );
523 connect( nt_action, SIGNAL( activated() ), 523 connect( nt_action, SIGNAL( activated() ),
524 mView, SLOT( newTodo() ) ); 524 mView, SLOT( newTodo() ) );
525 icon = loadPixmap( pathString + "navi" ); 525 icon = loadPixmap( pathString + "navi" );
526 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 526 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
527 action->addTo( viewMenu ); 527 action->addTo( viewMenu );
528 connect( action, SIGNAL( activated() ), 528 connect( action, SIGNAL( activated() ),
529 mView, SLOT( toggleDateNavigatorWidget() ) ); 529 mView, SLOT( toggleDateNavigatorWidget() ) );
530 icon = loadPixmap( pathString + "filter" ); 530 icon = loadPixmap( pathString + "filter" );
531 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 531 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
532 action->addTo( viewMenu ); 532 action->addTo( viewMenu );
533 connect( action, SIGNAL( activated() ), 533 connect( action, SIGNAL( activated() ),
534 mView, SLOT( toggleFilter() ) ); 534 mView, SLOT( toggleFilter() ) );
535 535
536 536
537 viewMenu->insertSeparator(); 537 viewMenu->insertSeparator();
538 icon = loadPixmap( pathString + "picker" ); 538 icon = loadPixmap( pathString + "picker" );
539 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 539 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
540 action->addTo( viewMenu ); 540 action->addTo( viewMenu );
541 connect( action, SIGNAL( activated() ), 541 connect( action, SIGNAL( activated() ),
542 mView, SLOT( showDatePicker() ) ); 542 mView, SLOT( showDatePicker() ) );
543 action->addTo( iconToolBar ); 543 action->addTo( iconToolBar );
544 viewMenu->insertSeparator(); 544 viewMenu->insertSeparator();
545 icon = loadPixmap( pathString + "list" ); 545 icon = loadPixmap( pathString + "list" );
546 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 546 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
547 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 547 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
548 showlist_action->addTo( viewMenu ); 548 showlist_action->addTo( viewMenu );
549 connect( showlist_action, SIGNAL( activated() ), 549 connect( showlist_action, SIGNAL( activated() ),
550 mView->viewManager(), SLOT( showListView() ) ); 550 mView->viewManager(), SLOT( showListView() ) );
551 551
552 552
553 icon = loadPixmap( pathString + "day" ); 553 icon = loadPixmap( pathString + "day" );
554 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 554 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
555 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 555 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
556 day1_action->addTo( viewMenu ); 556 day1_action->addTo( viewMenu );
557 // action->addTo( toolBar ); 557 // action->addTo( toolBar );
558 connect( day1_action, SIGNAL( activated() ), 558 connect( day1_action, SIGNAL( activated() ),
559 mView->viewManager(), SLOT( showDayView() ) ); 559 mView->viewManager(), SLOT( showDayView() ) );
560 560
561 icon = loadPixmap( pathString + "workweek" ); 561 icon = loadPixmap( pathString + "workweek" );
562 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 562 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
563 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 563 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
564 day5_action->addTo( viewMenu ); 564 day5_action->addTo( viewMenu );
565 connect( day5_action, SIGNAL( activated() ), 565 connect( day5_action, SIGNAL( activated() ),
566 mView->viewManager(), SLOT( showWorkWeekView() ) ); 566 mView->viewManager(), SLOT( showWorkWeekView() ) );
567 567
568 icon = loadPixmap( pathString + "week" ); 568 icon = loadPixmap( pathString + "week" );
569 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 569 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
570 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 570 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
571 day7_action->addTo( viewMenu ); 571 day7_action->addTo( viewMenu );
572 connect( day7_action, SIGNAL( activated() ), 572 connect( day7_action, SIGNAL( activated() ),
573 mView->viewManager(), SLOT( showWeekView() ) ); 573 mView->viewManager(), SLOT( showWeekView() ) );
574 574
575 icon = loadPixmap( pathString + "month" ); 575 icon = loadPixmap( pathString + "month" );
576 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 576 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
577 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 577 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
578 month_action->addTo( viewMenu ); 578 month_action->addTo( viewMenu );
579 connect( month_action, SIGNAL( activated() ), 579 connect( month_action, SIGNAL( activated() ),
580 mView->viewManager(), SLOT( showMonthView() ) ); 580 mView->viewManager(), SLOT( showMonthView() ) );
581 581
582 icon = loadPixmap( pathString + "todo" ); 582 icon = loadPixmap( pathString + "todo" );
583 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 583 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
584 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 584 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
585 todoview_action->addTo( viewMenu ); 585 todoview_action->addTo( viewMenu );
586 connect( todoview_action, SIGNAL( activated() ), 586 connect( todoview_action, SIGNAL( activated() ),
587 mView->viewManager(), SLOT( showTodoView() ) ); 587 mView->viewManager(), SLOT( showTodoView() ) );
588 588
589 icon = loadPixmap( pathString + "journal" ); 589 icon = loadPixmap( pathString + "journal" );
590 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 590 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
591 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 591 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
592 viewjournal_action->addTo( viewMenu ); 592 viewjournal_action->addTo( viewMenu );
593 connect( viewjournal_action, SIGNAL( activated() ), 593 connect( viewjournal_action, SIGNAL( activated() ),
594 mView->viewManager(), SLOT( showJournalView() ) ); 594 mView->viewManager(), SLOT( showJournalView() ) );
595 595
596 icon = loadPixmap( pathString + "xdays" ); 596 icon = loadPixmap( pathString + "xdays" );
597 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 597 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
598 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 598 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
599 xdays_action->addTo( viewMenu ); 599 xdays_action->addTo( viewMenu );
600 connect( xdays_action, SIGNAL( activated() ), 600 connect( xdays_action, SIGNAL( activated() ),
601 mView->viewManager(), SLOT( showNextXView() ) ); 601 mView->viewManager(), SLOT( showNextXView() ) );
602 602
603 icon = loadPixmap( pathString + "whatsnext" ); 603 icon = loadPixmap( pathString + "whatsnext" );
604 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 604 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
605 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 605 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
606 whatsnext_action->addTo( viewMenu ); 606 whatsnext_action->addTo( viewMenu );
607 connect( whatsnext_action, SIGNAL( activated() ), 607 connect( whatsnext_action, SIGNAL( activated() ),
608 mView->viewManager(), SLOT( showWhatsNextView() ) ); 608 mView->viewManager(), SLOT( showWhatsNextView() ) );
609 609
610#if 0 610#if 0
611 action = new QAction( "view_timespan", "Time Span", 0, this ); 611 action = new QAction( "view_timespan", "Time Span", 0, this );
612 action->addTo( viewMenu ); 612 action->addTo( viewMenu );
613 connect( action, SIGNAL( activated() ), 613 connect( action, SIGNAL( activated() ),
614 mView->viewManager(), SLOT( showTimeSpanView() ) ); 614 mView->viewManager(), SLOT( showTimeSpanView() ) );
615#endif 615#endif
616 616
617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
618 this ); 618 this );
@@ -662,1088 +662,1089 @@ void MainWindow::initActions()
662 action->addTo( actionMenu ); 662 action->addTo( actionMenu );
663 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 663 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
664 664
665 icon = loadPixmap( pathString + "search" ); 665 icon = loadPixmap( pathString + "search" );
666 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 666 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
667 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 667 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
668 search_action->addTo( actionMenu ); 668 search_action->addTo( actionMenu );
669 connect( search_action, SIGNAL( activated() ), 669 connect( search_action, SIGNAL( activated() ),
670 mView->dialogManager(), SLOT( showSearchDialog() ) ); 670 mView->dialogManager(), SLOT( showSearchDialog() ) );
671 671
672 icon = loadPixmap( pathString + "today" ); 672 icon = loadPixmap( pathString + "today" );
673 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 673 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
674 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 674 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
675 today_action->addTo( actionMenu ); 675 today_action->addTo( actionMenu );
676 connect( today_action, SIGNAL( activated() ), 676 connect( today_action, SIGNAL( activated() ),
677 mView, SLOT( goToday() ) ); 677 mView, SLOT( goToday() ) );
678 678
679 if ( KOPrefs::instance()->mShowFullMenu ) { 679 if ( KOPrefs::instance()->mShowFullMenu ) {
680 actionMenu->insertSeparator(); 680 actionMenu->insertSeparator();
681 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 681 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
682 682
683 } 683 }
684 // actionMenu->insertSeparator(); 684 // actionMenu->insertSeparator();
685 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 685 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
686 this ); 686 this );
687 action->addTo( importMenu ); 687 action->addTo( importMenu );
688 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 688 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
689 action = new QAction( "import_quick", i18n("Import last file"), 0, 689 action = new QAction( "import_quick", i18n("Import last file"), 0,
690 this ); 690 this );
691 action->addTo( importMenu ); 691 action->addTo( importMenu );
692 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 692 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
693 importMenu->insertSeparator(); 693 importMenu->insertSeparator();
694 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 694 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
695 this ); 695 this );
696 action->addTo( importMenu ); 696 action->addTo( importMenu );
697 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 697 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
698#ifndef DESKTOP_VERSION 698#ifndef DESKTOP_VERSION
699 importMenu->insertSeparator(); 699 importMenu->insertSeparator();
700 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 700 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
701 this ); 701 this );
702 action->addTo( importMenu ); 702 action->addTo( importMenu );
703 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 703 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
704#else 704#else
705#ifdef _WIN32_ 705#ifdef _WIN32_
706 importMenu->insertSeparator(); 706 importMenu->insertSeparator();
707 action = new QAction( "import_ol", i18n("Import from OL"), 0, 707 action = new QAction( "import_ol", i18n("Import from OL"), 0,
708 this ); 708 this );
709 action->addTo( importMenu ); 709 action->addTo( importMenu );
710 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 710 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
711#endif 711#endif
712#endif 712#endif
713 713
714 importMenu->insertSeparator(); 714 importMenu->insertSeparator();
715 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 715 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
716 this ); 716 this );
717 action->addTo( importMenu ); 717 action->addTo( importMenu );
718 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 718 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
719 719
720 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 720 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
721 this ); 721 this );
722 action->addTo( importMenu ); 722 action->addTo( importMenu );
723 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 723 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
724 724
725 importMenu->insertSeparator(); 725 importMenu->insertSeparator();
726 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 726 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
727 this ); 727 this );
728 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 728 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
729 729
730 730
731 //LR 731 //LR
732 QPopupMenu *ex2phone = new QPopupMenu( this ); 732 QPopupMenu *ex2phone = new QPopupMenu( this );
733 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 733 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
734 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 734 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
735 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 735 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
736 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 736 importMenu->insertItem( i18n("Export to phone"), ex2phone );
737 737
738 importMenu->insertSeparator(); 738 importMenu->insertSeparator();
739 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 739 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
740 this ); 740 this );
741 action->addTo( importMenu ); 741 action->addTo( importMenu );
742 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 742 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
743#ifndef DESKTOP_VERSION 743#ifndef DESKTOP_VERSION
744 importMenu->insertSeparator(); 744 importMenu->insertSeparator();
745 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 745 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
746 this ); 746 this );
747 action->addTo( importMenu ); 747 action->addTo( importMenu );
748 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 748 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
749 749
750 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 750 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
751 this ); 751 this );
752 action->addTo( importMenu ); 752 action->addTo( importMenu );
753 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 753 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
754#else 754#else
755 importMenu->insertSeparator(); 755 importMenu->insertSeparator();
756 icon = loadPixmap( pathString + "print" ); 756 icon = loadPixmap( pathString + "print" );
757 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 757 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
758 action->addTo( importMenu ); 758 action->addTo( importMenu );
759 connect( action, SIGNAL( activated() ), 759 connect( action, SIGNAL( activated() ),
760 this, SLOT( printCal() ) ); 760 this, SLOT( printCal() ) );
761 761
762 icon = loadPixmap( pathString + "print" ); 762 icon = loadPixmap( pathString + "print" );
763 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 763 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
764 action->addTo( importMenu ); 764 action->addTo( importMenu );
765 connect( action, SIGNAL( activated() ), 765 connect( action, SIGNAL( activated() ),
766 this, SLOT( printSel() ) ); 766 this, SLOT( printSel() ) );
767#endif 767#endif
768 importMenu->insertSeparator(); 768 importMenu->insertSeparator();
769 action = new QAction( "beam all", i18n("Save"), 0, 769 action = new QAction( "beam all", i18n("Save"), 0,
770 this ); 770 this );
771 action->addTo( importMenu ); 771 action->addTo( importMenu );
772 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 772 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
773 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 773 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
774 this ); 774 this );
775 action->addTo( importMenu ); 775 action->addTo( importMenu );
776 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 776 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
777 777
778 //menuBar->insertItem( "Configure",configureMenu ); 778 //menuBar->insertItem( "Configure",configureMenu );
779 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 779 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
780 icon = loadPixmap( "korganizer/korganizer" ); 780 icon = loadPixmap( "korganizer/korganizer" );
781 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 781 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
782 action->addTo( helpMenu ); 782 action->addTo( helpMenu );
783 connect( action, SIGNAL( activated() ), 783 connect( action, SIGNAL( activated() ),
784 SLOT( keyBindings() ) ); 784 SLOT( keyBindings() ) );
785 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 785 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
786 action->addTo( helpMenu ); 786 action->addTo( helpMenu );
787 connect( action, SIGNAL( activated() ), 787 connect( action, SIGNAL( activated() ),
788 SLOT( features() ) ); 788 SLOT( features() ) );
789 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 789 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
790 action->addTo( helpMenu ); 790 action->addTo( helpMenu );
791 connect( action, SIGNAL( activated() ), 791 connect( action, SIGNAL( activated() ),
792 SLOT( aboutAutoSaving() ) ); 792 SLOT( aboutAutoSaving() ) );
793 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 793 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
794 action->addTo( helpMenu ); 794 action->addTo( helpMenu );
795 connect( action, SIGNAL( activated() ), 795 connect( action, SIGNAL( activated() ),
796 SLOT( aboutKnownBugs() ) ); 796 SLOT( aboutKnownBugs() ) );
797 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 797 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
798 action->addTo( helpMenu ); 798 action->addTo( helpMenu );
799 connect( action, SIGNAL( activated() ), 799 connect( action, SIGNAL( activated() ),
800 SLOT( usertrans() ) ); 800 SLOT( usertrans() ) );
801 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 801 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
802 action->addTo( helpMenu ); 802 action->addTo( helpMenu );
803 connect( action, SIGNAL( activated() ), 803 connect( action, SIGNAL( activated() ),
804 SLOT( synchowto() ) ); 804 SLOT( synchowto() ) );
805 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 805 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
806 action->addTo( helpMenu ); 806 action->addTo( helpMenu );
807 connect( action, SIGNAL( activated() ), 807 connect( action, SIGNAL( activated() ),
808 SLOT( whatsNew() ) ); 808 SLOT( whatsNew() ) );
809 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 809 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
810 action->addTo( helpMenu ); 810 action->addTo( helpMenu );
811 connect( action, SIGNAL( activated() ), 811 connect( action, SIGNAL( activated() ),
812 SLOT( faq() ) ); 812 SLOT( faq() ) );
813 813
814 814
815 action = new QAction( "about", i18n("About..."), 0, this ); 815 action = new QAction( "about", i18n("About..."), 0, this );
816 action->addTo( helpMenu ); 816 action->addTo( helpMenu );
817 connect( action, SIGNAL( activated() ), 817 connect( action, SIGNAL( activated() ),
818 SLOT( about() ) ); 818 SLOT( about() ) );
819 action = new QAction( "licence", i18n("Licence..."), 0, this ); 819 action = new QAction( "licence", i18n("Licence..."), 0, this );
820 action->addTo( helpMenu ); 820 action->addTo( helpMenu );
821 connect( action, SIGNAL( activated() ), 821 connect( action, SIGNAL( activated() ),
822 SLOT( licence() ) ); 822 SLOT( licence() ) );
823 //menuBar->insertSeparator(); 823 //menuBar->insertSeparator();
824 824
825 // ****************************************************** 825 // ******************************************************
826 // menubar icons 826 // menubar icons
827 827
828 828
829 iconToolBar->setHorizontalStretchable (true ); 829 iconToolBar->setHorizontalStretchable (true );
830 //menuBar->insertItem( iconToolBar ); 830 //menuBar->insertItem( iconToolBar );
831 //xdays_action 831 //xdays_action
832 if (p-> mShowIconNewEvent) 832 if (p-> mShowIconNewEvent)
833 ne_action->addTo( iconToolBar ); 833 ne_action->addTo( iconToolBar );
834 if (p->mShowIconNewTodo ) 834 if (p->mShowIconNewTodo )
835 nt_action->addTo( iconToolBar ); 835 nt_action->addTo( iconToolBar );
836 if (p-> mShowIconSearch) 836 if (p-> mShowIconSearch)
837 search_action->addTo( iconToolBar ); 837 search_action->addTo( iconToolBar );
838 if (p-> mShowIconNext) 838 if (p-> mShowIconNext)
839 whatsnext_action->addTo( iconToolBar ); 839 whatsnext_action->addTo( iconToolBar );
840 if (p-> mShowIconNextDays) 840 if (p-> mShowIconNextDays)
841 xdays_action->addTo( iconToolBar ); 841 xdays_action->addTo( iconToolBar );
842 if (p-> mShowIconList) 842 if (p-> mShowIconList)
843 showlist_action->addTo( iconToolBar ); 843 showlist_action->addTo( iconToolBar );
844 if (p-> mShowIconDay1) 844 if (p-> mShowIconDay1)
845 day1_action->addTo( iconToolBar ); 845 day1_action->addTo( iconToolBar );
846 if (p-> mShowIconDay5) 846 if (p-> mShowIconDay5)
847 day5_action->addTo( iconToolBar ); 847 day5_action->addTo( iconToolBar );
848 if (p-> mShowIconDay7) 848 if (p-> mShowIconDay7)
849 day7_action->addTo( iconToolBar ); 849 day7_action->addTo( iconToolBar );
850 if (p-> mShowIconMonth) 850 if (p-> mShowIconMonth)
851 month_action->addTo( iconToolBar ); 851 month_action->addTo( iconToolBar );
852 if (p-> mShowIconTodoview) 852 if (p-> mShowIconTodoview)
853 todoview_action->addTo( iconToolBar ); 853 todoview_action->addTo( iconToolBar );
854 if (p-> mShowIconJournal) 854 if (p-> mShowIconJournal)
855 viewjournal_action->addTo( iconToolBar ); 855 viewjournal_action->addTo( iconToolBar );
856 icon = loadPixmap( pathString + "2leftarrowB" ); 856 icon = loadPixmap( pathString + "2leftarrowB" );
857 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 857 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
858 if (p-> mShowIconBackFast) { 858 if (p-> mShowIconBackFast) {
859 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 859 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
860 connect( action, SIGNAL( activated() ), 860 connect( action, SIGNAL( activated() ),
861 mView, SLOT( goPreviousMonth() ) ); 861 mView, SLOT( goPreviousMonth() ) );
862 action->addTo( iconToolBar ); 862 action->addTo( iconToolBar );
863 } 863 }
864 icon = loadPixmap( pathString + "1leftarrowB" ); 864 icon = loadPixmap( pathString + "1leftarrowB" );
865 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 865 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
866 if (p-> mShowIconBack) { 866 if (p-> mShowIconBack) {
867 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 867 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
868 connect( action, SIGNAL( activated() ), 868 connect( action, SIGNAL( activated() ),
869 mView, SLOT( goPrevious() ) ); 869 mView, SLOT( goPrevious() ) );
870 action->addTo( iconToolBar ); 870 action->addTo( iconToolBar );
871 } 871 }
872 if (p-> mShowIconToday) 872 if (p-> mShowIconToday)
873 today_action->addTo( iconToolBar ); 873 today_action->addTo( iconToolBar );
874 icon = loadPixmap( pathString + "1rightarrowB" ); 874 icon = loadPixmap( pathString + "1rightarrowB" );
875 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 875 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
876 if (p-> mShowIconForward) { 876 if (p-> mShowIconForward) {
877 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 877 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
878 connect( action, SIGNAL( activated() ), 878 connect( action, SIGNAL( activated() ),
879 mView, SLOT( goNext() ) ); 879 mView, SLOT( goNext() ) );
880 action->addTo( iconToolBar ); 880 action->addTo( iconToolBar );
881 } 881 }
882 icon = loadPixmap( pathString + "2rightarrowB" ); 882 icon = loadPixmap( pathString + "2rightarrowB" );
883 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 883 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
884 if (p-> mShowIconForwardFast) { 884 if (p-> mShowIconForwardFast) {
885 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 885 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
886 connect( action, SIGNAL( activated() ), 886 connect( action, SIGNAL( activated() ),
887 mView, SLOT( goNextMonth() ) ); 887 mView, SLOT( goNextMonth() ) );
888 action->addTo( iconToolBar ); 888 action->addTo( iconToolBar );
889 } 889 }
890 890
891 891
892 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 892 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
893 893
894 if (p-> mShowIconNewEvent) 894 if (p-> mShowIconNewEvent)
895 configureToolBarMenu->setItemChecked( 10, true ); 895 configureToolBarMenu->setItemChecked( 10, true );
896 if (p->mShowIconNewTodo ) 896 if (p->mShowIconNewTodo )
897 configureToolBarMenu->setItemChecked( 20, true ); 897 configureToolBarMenu->setItemChecked( 20, true );
898 if (p-> mShowIconSearch) 898 if (p-> mShowIconSearch)
899 configureToolBarMenu->setItemChecked( 120, true ); 899 configureToolBarMenu->setItemChecked( 120, true );
900 if (p-> mShowIconList) 900 if (p-> mShowIconList)
901 configureToolBarMenu->setItemChecked( 30, true ); 901 configureToolBarMenu->setItemChecked( 30, true );
902 if (p-> mShowIconDay1) 902 if (p-> mShowIconDay1)
903 configureToolBarMenu->setItemChecked( 40, true ); 903 configureToolBarMenu->setItemChecked( 40, true );
904 if (p-> mShowIconDay5) 904 if (p-> mShowIconDay5)
905 configureToolBarMenu->setItemChecked( 50, true ); 905 configureToolBarMenu->setItemChecked( 50, true );
906 if (p-> mShowIconDay7) 906 if (p-> mShowIconDay7)
907 configureToolBarMenu->setItemChecked( 60, true ); 907 configureToolBarMenu->setItemChecked( 60, true );
908 if (p-> mShowIconMonth) 908 if (p-> mShowIconMonth)
909 configureToolBarMenu->setItemChecked( 70, true ); 909 configureToolBarMenu->setItemChecked( 70, true );
910 if (p-> mShowIconTodoview) 910 if (p-> mShowIconTodoview)
911 configureToolBarMenu->setItemChecked( 80, true ); 911 configureToolBarMenu->setItemChecked( 80, true );
912 if (p-> mShowIconBackFast) 912 if (p-> mShowIconBackFast)
913 configureToolBarMenu->setItemChecked( 200, true ); 913 configureToolBarMenu->setItemChecked( 200, true );
914 if (p-> mShowIconBack) 914 if (p-> mShowIconBack)
915 configureToolBarMenu->setItemChecked( 210, true ); 915 configureToolBarMenu->setItemChecked( 210, true );
916 if (p-> mShowIconToday) 916 if (p-> mShowIconToday)
917 configureToolBarMenu->setItemChecked( 130, true ); 917 configureToolBarMenu->setItemChecked( 130, true );
918 if (p-> mShowIconForward) 918 if (p-> mShowIconForward)
919 configureToolBarMenu->setItemChecked( 220, true ); 919 configureToolBarMenu->setItemChecked( 220, true );
920 if (p-> mShowIconForwardFast) 920 if (p-> mShowIconForwardFast)
921 configureToolBarMenu->setItemChecked( 230, true ); 921 configureToolBarMenu->setItemChecked( 230, true );
922 if (p-> mShowIconNextDays) 922 if (p-> mShowIconNextDays)
923 configureToolBarMenu->setItemChecked( 100, true ); 923 configureToolBarMenu->setItemChecked( 100, true );
924 if (p-> mShowIconNext) 924 if (p-> mShowIconNext)
925 configureToolBarMenu->setItemChecked( 110, true ); 925 configureToolBarMenu->setItemChecked( 110, true );
926 if (p-> mShowIconJournal) 926 if (p-> mShowIconJournal)
927 configureToolBarMenu->setItemChecked( 90, true ); 927 configureToolBarMenu->setItemChecked( 90, true );
928 if (p-> mShowIconWhatsThis) 928 if (p-> mShowIconWhatsThis)
929 configureToolBarMenu->setItemChecked( 300, true ); 929 configureToolBarMenu->setItemChecked( 300, true );
930 930
931 QLabel* dummy = new QLabel( iconToolBar ); 931 QLabel* dummy = new QLabel( iconToolBar );
932 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 932 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
933 if (!p-> mShowIconStretch) 933 if (!p-> mShowIconStretch)
934 iconToolBar->setStretchableWidget ( dummy ) ; 934 iconToolBar->setStretchableWidget ( dummy ) ;
935 else 935 else
936 configureToolBarMenu->setItemChecked( 5, true ); 936 configureToolBarMenu->setItemChecked( 5, true );
937 if (p-> mShowIconWhatsThis) 937 if (p-> mShowIconWhatsThis)
938 QWhatsThis::whatsThisButton ( iconToolBar ); 938 QWhatsThis::whatsThisButton ( iconToolBar );
939 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 939 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
940 configureAgenda( p->mHourSize ); 940 configureAgenda( p->mHourSize );
941 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 941 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
942} 942}
943void MainWindow::fillSyncMenu() 943void MainWindow::fillSyncMenu()
944{ 944{
945 if ( syncMenu->count() ) 945 if ( syncMenu->count() )
946 syncMenu->clear(); 946 syncMenu->clear();
947 syncMenu->insertItem( i18n("Configure..."), 0 ); 947 syncMenu->insertItem( i18n("Configure..."), 0 );
948 syncMenu->insertSeparator(); 948 syncMenu->insertSeparator();
949 if ( mServerSocket == 0 ) { 949 if ( mServerSocket == 0 ) {
950 syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 950 syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
951 } else { 951 } else {
952 syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 952 syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
953 } 953 }
954 syncMenu->insertSeparator(); 954 syncMenu->insertSeparator();
955 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 955 syncMenu->insertItem( i18n("Multiple sync"), 1 );
956 syncMenu->insertSeparator(); 956 syncMenu->insertSeparator();
957 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 957 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
958 config.setGroup("General"); 958 config.setGroup("General");
959 QStringList prof = config.readListEntry("SyncProfileNames"); 959 QStringList prof = config.readListEntry("SyncProfileNames");
960 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 960 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
961 if ( prof.count() < 3 ) { 961 if ( prof.count() < 3 ) {
962 prof.clear(); 962 prof.clear();
963 prof << i18n("Sharp_DTM"); 963 prof << i18n("Sharp_DTM");
964 prof << i18n("Local_file"); 964 prof << i18n("Local_file");
965 prof << i18n("Last_file"); 965 prof << i18n("Last_file");
966 KSyncProfile* temp = new KSyncProfile (); 966 KSyncProfile* temp = new KSyncProfile ();
967 temp->setName( prof[0] ); 967 temp->setName( prof[0] );
968 temp->writeConfig(&config); 968 temp->writeConfig(&config);
969 temp->setName( prof[1] ); 969 temp->setName( prof[1] );
970 temp->writeConfig(&config); 970 temp->writeConfig(&config);
971 temp->setName( prof[2] ); 971 temp->setName( prof[2] );
972 temp->writeConfig(&config); 972 temp->writeConfig(&config);
973 config.setGroup("General"); 973 config.setGroup("General");
974 config.writeEntry("SyncProfileNames",prof); 974 config.writeEntry("SyncProfileNames",prof);
975 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 975 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
976 config.sync(); 976 config.sync();
977 delete temp; 977 delete temp;
978 } 978 }
979 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 979 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
980 KOPrefs::instance()->mSyncProfileNames = prof; 980 KOPrefs::instance()->mSyncProfileNames = prof;
981 int i; 981 int i;
982 for ( i = 0; i < prof.count(); ++i ) { 982 for ( i = 0; i < prof.count(); ++i ) {
983 983
984 syncMenu->insertItem( prof[i], 1000+i ); 984 syncMenu->insertItem( prof[i], 1000+i );
985 if ( i == 2 ) 985 if ( i == 2 )
986 syncMenu->insertSeparator(); 986 syncMenu->insertSeparator();
987 } 987 }
988 QDir app_dir; 988 QDir app_dir;
989 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 989 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
990 syncMenu->setItemEnabled( false , 1000 ); 990 syncMenu->setItemEnabled( false , 1000 );
991 } 991 }
992 mView->setupExternSyncProfiles(); 992 mView->setupExternSyncProfiles();
993} 993}
994 994
995int MainWindow::ringSync() 995int MainWindow::ringSync()
996{ 996{
997 int syncedProfiles = 0; 997 int syncedProfiles = 0;
998 int i; 998 int i;
999 QTime timer; 999 QTime timer;
1000 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 1000 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
1001 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 1001 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
1002 KSyncProfile* temp = new KSyncProfile (); 1002 KSyncProfile* temp = new KSyncProfile ();
1003 KOPrefs::instance()->mAskForPreferences = false; 1003 KOPrefs::instance()->mAskForPreferences = false;
1004 for ( i = 0; i < syncProfileNames.count(); ++i ) { 1004 for ( i = 0; i < syncProfileNames.count(); ++i ) {
1005 mCurrentSyncProfile = i; 1005 mCurrentSyncProfile = i;
1006 temp->setName(syncProfileNames[mCurrentSyncProfile]); 1006 temp->setName(syncProfileNames[mCurrentSyncProfile]);
1007 temp->readConfig(&config); 1007 temp->readConfig(&config);
1008 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 1008 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
1009 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 1009 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
1010 ++syncedProfiles; 1010 ++syncedProfiles;
1011 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 1011 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
1012 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 1012 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
1013 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 1013 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
1014 KOPrefs::instance()->mWriteBackInFuture = 0; 1014 KOPrefs::instance()->mWriteBackInFuture = 0;
1015 if ( temp->getWriteBackFuture() ) 1015 if ( temp->getWriteBackFuture() )
1016 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 1016 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
1017 KOPrefs::instance()->mShowSyncSummary = false; 1017 KOPrefs::instance()->mShowSyncSummary = false;
1018 mView->setSyncDevice(syncProfileNames[i] ); 1018 mView->setSyncDevice(syncProfileNames[i] );
1019 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 1019 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
1020 if ( i == 0 ) { 1020 if ( i == 0 ) {
1021 syncSharp(); 1021 syncSharp();
1022 } else { 1022 } else {
1023 if ( temp->getIsLocalFileSync() ) { 1023 if ( temp->getIsLocalFileSync() ) {
1024 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 1024 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
1025 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 1025 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
1026 } else { 1026 } else {
1027 if ( temp->getIsPhoneSync() ) { 1027 if ( temp->getIsPhoneSync() ) {
1028 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 1028 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
1029 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 1029 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
1030 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 1030 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
1031 syncPhone(); 1031 syncPhone();
1032 } else if ( temp->getIsPiSync() ) { 1032 } else if ( temp->getIsPiSync() ) {
1033 mPassWordPiSync = temp->getRemotePw(); 1033 mPassWordPiSync = temp->getRemotePw();
1034 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); 1034 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
1035 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); 1035 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
1036 syncPi(); 1036 syncPi();
1037 } else 1037 } else
1038 syncRemote( temp, false ); 1038 syncRemote( temp, false );
1039 1039
1040 } 1040 }
1041 } 1041 }
1042 timer.start(); 1042 timer.start();
1043 setCaption(i18n("Multiple sync in progress ... please wait!") ); 1043 setCaption(i18n("Multiple sync in progress ... please wait!") );
1044 while ( timer.elapsed () < 2000 ) { 1044 while ( timer.elapsed () < 2000 ) {
1045 qApp->processEvents(); 1045 qApp->processEvents();
1046#ifndef _WIN32_ 1046#ifndef _WIN32_
1047 sleep (1); 1047 sleep (1);
1048#endif 1048#endif
1049 } 1049 }
1050 1050
1051 } 1051 }
1052 1052
1053 } 1053 }
1054 delete temp; 1054 delete temp;
1055 return syncedProfiles; 1055 return syncedProfiles;
1056} 1056}
1057 1057
1058void MainWindow::multiSync( bool askforPrefs ) 1058void MainWindow::multiSync( bool askforPrefs )
1059{ 1059{
1060 if (mBlockSaveFlag) 1060 if (mBlockSaveFlag)
1061 return; 1061 return;
1062 mBlockSaveFlag = true; 1062 mBlockSaveFlag = true;
1063 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 1063 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
1064 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1064 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1065 question, 1065 question,
1066 i18n("Yes"), i18n("No"), 1066 i18n("Yes"), i18n("No"),
1067 0, 0 ) != 0 ) { 1067 0, 0 ) != 0 ) {
1068 mBlockSaveFlag = false; 1068 mBlockSaveFlag = false;
1069 setCaption(i18n("Aborted! Nothing synced!")); 1069 setCaption(i18n("Aborted! Nothing synced!"));
1070 return; 1070 return;
1071 } 1071 }
1072 mView->setSyncDevice(i18n("Multiple profiles") ); 1072 mView->setSyncDevice(i18n("Multiple profiles") );
1073 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 1073 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
1074 if ( askforPrefs ) { 1074 if ( askforPrefs ) {
1075 mView->edit_sync_options(); 1075 mView->edit_sync_options();
1076 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 1076 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
1077 } 1077 }
1078 setCaption(i18n("Multiple sync started.") ); 1078 setCaption(i18n("Multiple sync started.") );
1079 qApp->processEvents(); 1079 qApp->processEvents();
1080 int num = ringSync() ; 1080 int num = ringSync() ;
1081 if ( num > 1 ) 1081 if ( num > 1 )
1082 ringSync(); 1082 ringSync();
1083 mBlockSaveFlag = false; 1083 mBlockSaveFlag = false;
1084 if ( num ) 1084 if ( num )
1085 save(); 1085 save();
1086 if ( num ) 1086 if ( num )
1087 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 1087 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
1088 else 1088 else
1089 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 1089 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
1090 return; 1090 return;
1091} 1091}
1092void MainWindow::slotSyncMenu( int action ) 1092void MainWindow::slotSyncMenu( int action )
1093{ 1093{
1094 qDebug("syncaction %d ", action); 1094 qDebug("syncaction %d ", action);
1095 if ( action == 0 ) { 1095 if ( action == 0 ) {
1096 1096
1097 // seems to be a Qt2 event handling bug 1097 // seems to be a Qt2 event handling bug
1098 // syncmenu.clear causes a segfault at first time 1098 // syncmenu.clear causes a segfault at first time
1099 // when we call it after the main event loop, it is ok 1099 // when we call it after the main event loop, it is ok
1100 // same behaviour when calling OM/Pi via QCOP for the first time 1100 // same behaviour when calling OM/Pi via QCOP for the first time
1101 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 1101 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
1102 //confSync(); 1102 //confSync();
1103 1103
1104 return; 1104 return;
1105 } 1105 }
1106 if ( action == 1 ) { 1106 if ( action == 1 ) {
1107 multiSync( true ); 1107 multiSync( true );
1108 return; 1108 return;
1109 } 1109 }
1110 if ( action == 2 ) { 1110 if ( action == 2 ) {
1111 enableQuick(); 1111 enableQuick();
1112 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 1112 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
1113 return; 1113 return;
1114 } 1114 }
1115 if ( action == 3 ) { 1115 if ( action == 3 ) {
1116 delete mServerSocket; 1116 delete mServerSocket;
1117 mServerSocket = 0; 1117 mServerSocket = 0;
1118 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 1118 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
1119 return; 1119 return;
1120 } 1120 }
1121 1121
1122 if (mBlockSaveFlag) 1122 if (mBlockSaveFlag)
1123 return; 1123 return;
1124 mBlockSaveFlag = true; 1124 mBlockSaveFlag = true;
1125 mCurrentSyncProfile = action - 1000 ; 1125 mCurrentSyncProfile = action - 1000 ;
1126 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 1126 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
1127 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 1127 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
1128 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 1128 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
1129 KSyncProfile* temp = new KSyncProfile (); 1129 KSyncProfile* temp = new KSyncProfile ();
1130 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1130 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1131 temp->readConfig(&config); 1131 temp->readConfig(&config);
1132 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 1132 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
1133 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 1133 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
1134 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 1134 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
1135 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 1135 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
1136 KOPrefs::instance()->mWriteBackInFuture = 0; 1136 KOPrefs::instance()->mWriteBackInFuture = 0;
1137 if ( temp->getWriteBackFuture() ) 1137 if ( temp->getWriteBackFuture() )
1138 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 1138 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
1139 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 1139 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
1140 if ( action == 1000 ) { 1140 if ( action == 1000 ) {
1141 syncSharp(); 1141 syncSharp();
1142 1142
1143 } else if ( action == 1001 ) { 1143 } else if ( action == 1001 ) {
1144 syncLocalFile(); 1144 syncLocalFile();
1145 1145
1146 } else if ( action == 1002 ) { 1146 } else if ( action == 1002 ) {
1147 quickSyncLocalFile(); 1147 quickSyncLocalFile();
1148 1148
1149 } else if ( action >= 1003 ) { 1149 } else if ( action >= 1003 ) {
1150 if ( temp->getIsLocalFileSync() ) { 1150 if ( temp->getIsLocalFileSync() ) {
1151 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 1151 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
1152 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 1152 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
1153 } else { 1153 } else {
1154 if ( temp->getIsPhoneSync() ) { 1154 if ( temp->getIsPhoneSync() ) {
1155 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 1155 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
1156 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 1156 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
1157 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 1157 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
1158 syncPhone(); 1158 syncPhone();
1159 } else if ( temp->getIsPiSync() ) { 1159 } else if ( temp->getIsPiSync() ) {
1160 mPassWordPiSync = temp->getRemotePw(); 1160 mPassWordPiSync = temp->getRemotePw();
1161 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); 1161 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
1162 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); 1162 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
1163 syncPi(); 1163 syncPi();
1164 } else 1164 } else
1165 syncRemote( temp ); 1165 syncRemote( temp );
1166 1166
1167 } 1167 }
1168 } 1168 }
1169 delete temp; 1169 delete temp;
1170 mBlockSaveFlag = false; 1170 mBlockSaveFlag = false;
1171} 1171}
1172void MainWindow::exportToPhone( int mode ) 1172void MainWindow::exportToPhone( int mode )
1173{ 1173{
1174 1174
1175 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1175 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1176 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1176 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1177 KOex2phonePrefs ex2phone; 1177 KOex2phonePrefs ex2phone;
1178 ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection ); 1178
1179 ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice ); 1179 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1180 ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel ); 1180 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1181 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1181 if ( mode == 1 ) 1182 if ( mode == 1 )
1182 ex2phone.setCaption(i18n("Export complete calendar")); 1183 ex2phone.setCaption(i18n("Export complete calendar"));
1183 if ( mode == 2 ) 1184 if ( mode == 2 )
1184 ex2phone.setCaption(i18n("Export filtered calendar")); 1185 ex2phone.setCaption(i18n("Export filtered calendar"));
1185 1186
1186 if ( !ex2phone.exec() ) { 1187 if ( !ex2phone.exec() ) {
1187 return; 1188 return;
1188 } 1189 }
1189 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1190 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1190 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1191 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1191 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1192 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1192 1193
1193 int inFuture = 0; 1194 int inFuture = 0;
1194 if ( ex2phone.mWriteBackFuture->isChecked() ) 1195 if ( ex2phone.mWriteBackFuture->isChecked() )
1195 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1196 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1196 QPtrList<Incidence> delSel; 1197 QPtrList<Incidence> delSel;
1197 if ( mode == 1 ) 1198 if ( mode == 1 )
1198 delSel = mCalendar->rawIncidences(); 1199 delSel = mCalendar->rawIncidences();
1199 if ( mode == 2 ) 1200 if ( mode == 2 )
1200 delSel = mCalendar->incidences(); 1201 delSel = mCalendar->incidences();
1201 CalendarLocal* cal = new CalendarLocal(); 1202 CalendarLocal* cal = new CalendarLocal();
1202 cal->setLocalTime(); 1203 cal->setLocalTime();
1203 Incidence *incidence = delSel.first(); 1204 Incidence *incidence = delSel.first();
1204 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1205 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1205 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1206 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1206 while ( incidence ) { 1207 while ( incidence ) {
1207 if ( incidence->type() != "Journal" ) { 1208 if ( incidence->type() != "Journal" ) {
1208 bool add = true; 1209 bool add = true;
1209 if ( inFuture ) { 1210 if ( inFuture ) {
1210 QDateTime dt; 1211 QDateTime dt;
1211 if ( incidence->type() == "Todo" ) { 1212 if ( incidence->type() == "Todo" ) {
1212 Todo * t = (Todo*)incidence; 1213 Todo * t = (Todo*)incidence;
1213 if ( t->hasDueDate() ) 1214 if ( t->hasDueDate() )
1214 dt = t->dtDue(); 1215 dt = t->dtDue();
1215 else 1216 else
1216 dt = cur.addSecs( 62 ); 1217 dt = cur.addSecs( 62 );
1217 } 1218 }
1218 else { 1219 else {
1219 bool ok; 1220 bool ok;
1220 dt = incidence->getNextOccurence( cur, &ok ); 1221 dt = incidence->getNextOccurence( cur, &ok );
1221 if ( !ok ) 1222 if ( !ok )
1222 dt = cur.addSecs( -62 ); 1223 dt = cur.addSecs( -62 );
1223 } 1224 }
1224 if ( dt < cur || dt > end ) { 1225 if ( dt < cur || dt > end ) {
1225 add = false; 1226 add = false;
1226 } 1227 }
1227 } 1228 }
1228 if ( add ) { 1229 if ( add ) {
1229 Incidence *in = incidence->clone(); 1230 Incidence *in = incidence->clone();
1230 cal->addIncidence( in ); 1231 cal->addIncidence( in );
1231 } 1232 }
1232 } 1233 }
1233 incidence = delSel.next(); 1234 incidence = delSel.next();
1234 } 1235 }
1235 PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice, 1236 PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1236 KOPrefs::instance()->mEx2PhoneConnection, 1237 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1237 KOPrefs::instance()->mEx2PhoneModel ); 1238 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1238 1239
1239 setCaption( i18n("Writing to phone...")); 1240 setCaption( i18n("Writing to phone..."));
1240 if ( PhoneFormat::writeToPhone( cal ) ) 1241 if ( PhoneFormat::writeToPhone( cal ) )
1241 setCaption( i18n("Export to phone successful!")); 1242 setCaption( i18n("Export to phone successful!"));
1242 else 1243 else
1243 setCaption( i18n("Error exporting to phone!")); 1244 setCaption( i18n("Error exporting to phone!"));
1244 delete cal; 1245 delete cal;
1245} 1246}
1246 1247
1247 1248
1248void MainWindow::setDefaultPreferences() 1249void MainWindow::setDefaultPreferences()
1249{ 1250{
1250 KOPrefs *p = KOPrefs::instance(); 1251 KOPrefs *p = KOPrefs::instance();
1251 1252
1252 p->mCompactDialogs = true; 1253 p->mCompactDialogs = true;
1253 p->mConfirm = true; 1254 p->mConfirm = true;
1254 // p->mEnableQuickTodo = false; 1255 // p->mEnableQuickTodo = false;
1255 1256
1256} 1257}
1257 1258
1258QString MainWindow::resourcePath() 1259QString MainWindow::resourcePath()
1259{ 1260{
1260 return KGlobal::iconLoader()->iconPath(); 1261 return KGlobal::iconLoader()->iconPath();
1261} 1262}
1262 1263
1263void MainWindow::displayText( QString text ,QString cap ) 1264void MainWindow::displayText( QString text ,QString cap )
1264{ 1265{
1265 QDialog dia( this, "name", true ); ; 1266 QDialog dia( this, "name", true ); ;
1266 dia.setCaption( cap ); 1267 dia.setCaption( cap );
1267 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1268 QVBoxLayout* lay = new QVBoxLayout( &dia );
1268 lay->setSpacing( 3 ); 1269 lay->setSpacing( 3 );
1269 lay->setMargin( 3 ); 1270 lay->setMargin( 3 );
1270 QTextBrowser tb ( &dia ); 1271 QTextBrowser tb ( &dia );
1271 lay->addWidget( &tb ); 1272 lay->addWidget( &tb );
1272 tb.setText( text ); 1273 tb.setText( text );
1273#ifdef DESKTOP_VERSION 1274#ifdef DESKTOP_VERSION
1274 dia.resize( 640, 480); 1275 dia.resize( 640, 480);
1275#else 1276#else
1276 dia.showMaximized(); 1277 dia.showMaximized();
1277#endif 1278#endif
1278 dia.exec(); 1279 dia.exec();
1279} 1280}
1280void MainWindow::displayFile( QString fn, QString cap ) 1281void MainWindow::displayFile( QString fn, QString cap )
1281{ 1282{
1282 QString fileName = resourcePath() + fn; 1283 QString fileName = resourcePath() + fn;
1283 QString text; 1284 QString text;
1284 QFile file( fileName ); 1285 QFile file( fileName );
1285 if (!file.open( IO_ReadOnly ) ) { 1286 if (!file.open( IO_ReadOnly ) ) {
1286 return ; 1287 return ;
1287 1288
1288 } 1289 }
1289 QTextStream ts( &file ); 1290 QTextStream ts( &file );
1290 text = ts.read(); 1291 text = ts.read();
1291 file.close(); 1292 file.close();
1292 displayText( text, cap); 1293 displayText( text, cap);
1293} 1294}
1294void MainWindow::features() 1295void MainWindow::features()
1295{ 1296{
1296 1297
1297 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1298 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1298} 1299}
1299 1300
1300void MainWindow::usertrans() 1301void MainWindow::usertrans()
1301{ 1302{
1302 1303
1303 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1304 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1304} 1305}
1305 1306
1306void MainWindow::synchowto() 1307void MainWindow::synchowto()
1307{ 1308{
1308#if 0 1309#if 0
1309 QPtrList<Incidence> er = mCalendar->rawIncidences(); 1310 QPtrList<Incidence> er = mCalendar->rawIncidences();
1310 Incidence* inR = er.first(); 1311 Incidence* inR = er.first();
1311 VCalFormat vf; 1312 VCalFormat vf;
1312 QString strout; 1313 QString strout;
1313 while ( inR ) { 1314 while ( inR ) {
1314 if ( inR->type() == "Todo" ) 1315 if ( inR->type() == "Todo" )
1315 strout = vf.todoToString( (Todo *) inR ); 1316 strout = vf.todoToString( (Todo *) inR );
1316 if ( inR->type() == "Event" ) 1317 if ( inR->type() == "Event" )
1317 strout = vf.eventToString( (Event *) inR ); 1318 strout = vf.eventToString( (Event *) inR );
1318 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); 1319 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() );
1319 inR = er.next(); 1320 inR = er.next();
1320 } 1321 }
1321#endif 1322#endif
1322 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); 1323 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
1323} 1324}
1324void MainWindow::faq() 1325void MainWindow::faq()
1325{ 1326{
1326 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1327 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1327 1328
1328} 1329}
1329void MainWindow::whatsNew() 1330void MainWindow::whatsNew()
1330{ 1331{
1331 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); 1332 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
1332 1333
1333} 1334}
1334void MainWindow::licence() 1335void MainWindow::licence()
1335{ 1336{
1336 KApplication::showLicence(); 1337 KApplication::showLicence();
1337 1338
1338} 1339}
1339void MainWindow::about() 1340void MainWindow::about()
1340{ 1341{
1341 QString version; 1342 QString version;
1342#include <../version> 1343#include <../version>
1343 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1344 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1344 i18n("KOrganizer/Platform-independent\n") + 1345 i18n("KOrganizer/Platform-independent\n") +
1345 "(KO/Pi) " + version + " - " + 1346 "(KO/Pi) " + version + " - " +
1346 1347
1347#ifdef DESKTOP_VERSION 1348#ifdef DESKTOP_VERSION
1348 i18n("Desktop Edition\n") + 1349 i18n("Desktop Edition\n") +
1349#else 1350#else
1350 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1351 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1351#endif 1352#endif
1352 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1353 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1353} 1354}
1354void MainWindow::keyBindings() 1355void MainWindow::keyBindings()
1355{ 1356{
1356 QString cap = i18n("Key bindings KOrganizer/Pi"); 1357 QString cap = i18n("Key bindings KOrganizer/Pi");
1357 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1358 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1358 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1359 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1359 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1360 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1360 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1361 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1361 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1362 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1362 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1363 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1363 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1364 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1364 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1365 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1365 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1366 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1366 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1367 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1367 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1368 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1368 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1369 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1369 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1370 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1370 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1371 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1371 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1372 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1372 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1373 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1373 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1374 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1374 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1375 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1375 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1376 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1376 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1377 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1377 i18n("<p><h3>In agenda view:</h3></p>\n") + 1378 i18n("<p><h3>In agenda view:</h3></p>\n") +
1378 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1379 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1379 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1380 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1380 i18n("<p><h3>In todo view:</h3></p>\n") + 1381 i18n("<p><h3>In todo view:</h3></p>\n") +
1381 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1382 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1382 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1383 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1383 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1384 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1384 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1385 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1385 i18n("<p><h3>In list view:</h3></p>\n") + 1386 i18n("<p><h3>In list view:</h3></p>\n") +
1386 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1387 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1387 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1388 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1388 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1389 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1389 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1390 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1390 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1391 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1391 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1392 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1392 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1393 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1393 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1394 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1394 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1395 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1395 i18n("<p><b>E</b>: Edit item</p>\n") + 1396 i18n("<p><b>E</b>: Edit item</p>\n") +
1396 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1397 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1397 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1398 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1398 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1399 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1399 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1400 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1400 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1401 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1401 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1402 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1402 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1403 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1403 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1404 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1404 i18n("<p><b>White</b>: Item readonly</p>\n"); 1405 i18n("<p><b>White</b>: Item readonly</p>\n");
1405 displayText( text, cap); 1406 displayText( text, cap);
1406 1407
1407} 1408}
1408void MainWindow::aboutAutoSaving() 1409void MainWindow::aboutAutoSaving()
1409{ 1410{
1410 QMessageBox* msg; 1411 QMessageBox* msg;
1411 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1412 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1412 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1413 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1413 QMessageBox::Ok, 1414 QMessageBox::Ok,
1414 QMessageBox::NoButton, 1415 QMessageBox::NoButton,
1415 QMessageBox::NoButton); 1416 QMessageBox::NoButton);
1416 msg->exec(); 1417 msg->exec();
1417 delete msg; 1418 delete msg;
1418 1419
1419 1420
1420} 1421}
1421void MainWindow::aboutKnownBugs() 1422void MainWindow::aboutKnownBugs()
1422{ 1423{
1423 QMessageBox* msg; 1424 QMessageBox* msg;
1424 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1425 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1425 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1426 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1426 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1427 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1427 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1428 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1428 i18n("\nor report them in the bugtracker on\n") + 1429 i18n("\nor report them in the bugtracker on\n") +
1429 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1430 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1430 QMessageBox::NoIcon, 1431 QMessageBox::NoIcon,
1431 QMessageBox::Ok, 1432 QMessageBox::Ok,
1432 QMessageBox::NoButton, 1433 QMessageBox::NoButton,
1433 QMessageBox::NoButton); 1434 QMessageBox::NoButton);
1434 msg->exec(); 1435 msg->exec();
1435 delete msg; 1436 delete msg;
1436 1437
1437} 1438}
1438 1439
1439QString MainWindow::defaultFileName() 1440QString MainWindow::defaultFileName()
1440{ 1441{
1441 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1442 return locateLocal( "data", "korganizer/mycalendar.ics" );
1442} 1443}
1443QString MainWindow::syncFileName() 1444QString MainWindow::syncFileName()
1444{ 1445{
1445#ifdef _WIN32_ 1446#ifdef _WIN32_
1446 return locateLocal( "tmp", "synccalendar.ics" ); 1447 return locateLocal( "tmp", "synccalendar.ics" );
1447#else 1448#else
1448 return QString( "/tmp/kopitempfile.ics" ); 1449 return QString( "/tmp/kopitempfile.ics" );
1449#endif 1450#endif
1450} 1451}
1451 1452
1452void MainWindow::processIncidenceSelection( Incidence *incidence ) 1453void MainWindow::processIncidenceSelection( Incidence *incidence )
1453{ 1454{
1454 if ( !incidence ) { 1455 if ( !incidence ) {
1455 enableIncidenceActions( false ); 1456 enableIncidenceActions( false );
1456 1457
1457 mNewSubTodoAction->setEnabled( false ); 1458 mNewSubTodoAction->setEnabled( false );
1458 setCaptionToDates(); 1459 setCaptionToDates();
1459 return; 1460 return;
1460 1461
1461 } 1462 }
1462 1463
1463 //KGlobal::locale()->formatDateTime(nextA, true); 1464 //KGlobal::locale()->formatDateTime(nextA, true);
1464 QString startString = ""; 1465 QString startString = "";
1465 if ( incidence->type() != "Todo" ) { 1466 if ( incidence->type() != "Todo" ) {
1466 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1467 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1467 if ( incidence->doesFloat() ) { 1468 if ( incidence->doesFloat() ) {
1468 startString += ": "+incidence->dtStartDateStr( true ); 1469 startString += ": "+incidence->dtStartDateStr( true );
1469 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1470 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1470 1471
1471 } else { 1472 } else {
1472 startString = ": "+incidence->dtStartStr(true); 1473 startString = ": "+incidence->dtStartStr(true);
1473 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1474 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1474 1475
1475 } 1476 }
1476 1477
1477 } else { 1478 } else {
1478 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1479 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1479 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1480 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1480 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1481 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1481 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1482 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1482 } 1483 }
1483 1484
1484 } 1485 }
1485 else 1486 else
1486 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1487 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1487 if ( !incidence->location().isEmpty() ) 1488 if ( !incidence->location().isEmpty() )
1488 startString += " (" +incidence->location()+")"; 1489 startString += " (" +incidence->location()+")";
1489 setCaption( incidence->summary()+startString); 1490 setCaption( incidence->summary()+startString);
1490 1491
1491 enableIncidenceActions( true ); 1492 enableIncidenceActions( true );
1492 1493
1493 if ( incidence->type() == "Event" ) { 1494 if ( incidence->type() == "Event" ) {
1494 mShowAction->setText( i18n("Show Event...") ); 1495 mShowAction->setText( i18n("Show Event...") );
1495 mEditAction->setText( i18n("Edit Event...") ); 1496 mEditAction->setText( i18n("Edit Event...") );
1496 mDeleteAction->setText( i18n("Delete Event...") ); 1497 mDeleteAction->setText( i18n("Delete Event...") );
1497 1498
1498 mNewSubTodoAction->setEnabled( false ); 1499 mNewSubTodoAction->setEnabled( false );
1499 } else if ( incidence->type() == "Todo" ) { 1500 } else if ( incidence->type() == "Todo" ) {
1500 mShowAction->setText( i18n("Show Todo...") ); 1501 mShowAction->setText( i18n("Show Todo...") );
1501 mEditAction->setText( i18n("Edit Todo...") ); 1502 mEditAction->setText( i18n("Edit Todo...") );
1502 mDeleteAction->setText( i18n("Delete Todo...") ); 1503 mDeleteAction->setText( i18n("Delete Todo...") );
1503 1504
1504 mNewSubTodoAction->setEnabled( true ); 1505 mNewSubTodoAction->setEnabled( true );
1505 } else { 1506 } else {
1506 mShowAction->setText( i18n("Show...") ); 1507 mShowAction->setText( i18n("Show...") );
1507 mShowAction->setText( i18n("Edit...") ); 1508 mShowAction->setText( i18n("Edit...") );
1508 mShowAction->setText( i18n("Delete...") ); 1509 mShowAction->setText( i18n("Delete...") );
1509 1510
1510 mNewSubTodoAction->setEnabled( false ); 1511 mNewSubTodoAction->setEnabled( false );
1511 } 1512 }
1512} 1513}
1513 1514
1514void MainWindow::enableIncidenceActions( bool enabled ) 1515void MainWindow::enableIncidenceActions( bool enabled )
1515{ 1516{
1516 mShowAction->setEnabled( enabled ); 1517 mShowAction->setEnabled( enabled );
1517 mEditAction->setEnabled( enabled ); 1518 mEditAction->setEnabled( enabled );
1518 mDeleteAction->setEnabled( enabled ); 1519 mDeleteAction->setEnabled( enabled );
1519 1520
1520 mCloneAction->setEnabled( enabled ); 1521 mCloneAction->setEnabled( enabled );
1521 mMoveAction->setEnabled( enabled ); 1522 mMoveAction->setEnabled( enabled );
1522 mBeamAction->setEnabled( enabled ); 1523 mBeamAction->setEnabled( enabled );
1523 mCancelAction->setEnabled( enabled ); 1524 mCancelAction->setEnabled( enabled );
1524} 1525}
1525 1526
1526void MainWindow::importOL() 1527void MainWindow::importOL()
1527{ 1528{
1528#ifdef _WIN32_ 1529#ifdef _WIN32_
1529 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1530 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1530 id->exec(); 1531 id->exec();
1531 delete id; 1532 delete id;
1532 mView->updateView(); 1533 mView->updateView();
1533#endif 1534#endif
1534} 1535}
1535void MainWindow::importBday() 1536void MainWindow::importBday()
1536{ 1537{
1537 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1538 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1538 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1539 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1539 i18n("Import!"), i18n("Cancel"), 0, 1540 i18n("Import!"), i18n("Cancel"), 0,
1540 0, 1 ); 1541 0, 1 );
1541 if ( result == 0 ) { 1542 if ( result == 0 ) {
1542 mView->importBday(); 1543 mView->importBday();
1543 1544
1544 } 1545 }
1545 1546
1546 1547
1547} 1548}
1548void MainWindow::importQtopia() 1549void MainWindow::importQtopia()
1549{ 1550{
1550#ifndef DESKTOP_VERSION 1551#ifndef DESKTOP_VERSION
1551 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1552 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1552 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"), 1553 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"),
1553 i18n("Import!"), i18n("Cancel"), 0, 1554 i18n("Import!"), i18n("Cancel"), 0,
1554 0, 1 ); 1555 0, 1 );
1555 if ( result == 0 ) { 1556 if ( result == 0 ) {
1556 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1557 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1557 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1558 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1558 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1559 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1559 mView->importQtopia( categories, datebook, todolist ); 1560 mView->importQtopia( categories, datebook, todolist );
1560 } 1561 }
1561#else 1562#else
1562 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1563 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1563 i18n("Not supported \non desktop!\n"), 1564 i18n("Not supported \non desktop!\n"),
1564 i18n("Ok"), i18n("Cancel"), 0, 1565 i18n("Ok"), i18n("Cancel"), 0,
1565 0, 1 ); 1566 0, 1 );
1566 1567
1567#endif 1568#endif
1568} 1569}
1569 1570
1570void MainWindow::saveOnClose() 1571void MainWindow::saveOnClose()
1571{ 1572{
1572 KOPrefs *p = KOPrefs::instance(); 1573 KOPrefs *p = KOPrefs::instance();
1573 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1574 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1574 p->mToolBarUp = iconToolBar->x() > width()/2 || 1575 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1575 iconToolBar->y() > height()/2; 1576 iconToolBar->y() > height()/2;
1576 mView->writeSettings(); 1577 mView->writeSettings();
1577 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1578 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1578 save(); 1579 save();
1579} 1580}
1580void MainWindow::slotModifiedChanged( bool changed ) 1581void MainWindow::slotModifiedChanged( bool changed )
1581{ 1582{
1582 if ( mBlockAtStartup ) 1583 if ( mBlockAtStartup )
1583 return; 1584 return;
1584 int msec; 1585 int msec;
1585 // we store the changes after 1 minute, 1586 // we store the changes after 1 minute,
1586 // and for safety reasons after 10 minutes again 1587 // and for safety reasons after 10 minutes again
1587 if ( !mBlockSaveFlag ) 1588 if ( !mBlockSaveFlag )
1588 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1589 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1589 else 1590 else
1590 msec = 1000 * 600; 1591 msec = 1000 * 600;
1591 mSaveTimer.start( msec, true ); // 1 minute 1592 mSaveTimer.start( msec, true ); // 1 minute
1592 qDebug("KO: Saving File in %d secs!", msec/1000); 1593 qDebug("KO: Saving File in %d secs!", msec/1000);
1593 mCalendarModifiedFlag = true; 1594 mCalendarModifiedFlag = true;
1594} 1595}
1595void MainWindow::save() 1596void MainWindow::save()
1596{ 1597{
1597 if ( mBlockSaveFlag ) 1598 if ( mBlockSaveFlag )
1598 return; 1599 return;
1599 bool store = mBlockSaveFlag; 1600 bool store = mBlockSaveFlag;
1600 mBlockSaveFlag = true; 1601 mBlockSaveFlag = true;
1601 if ( mView->checkFileVersion( defaultFileName()) ) { 1602 if ( mView->checkFileVersion( defaultFileName()) ) {
1602 1603
1603 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1604 QTime neededSaveTime = QDateTime::currentDateTime().time();
1604 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1605 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1605 qDebug("KO: Start saving data to file!"); 1606 qDebug("KO: Start saving data to file!");
1606 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1607 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1607 mView->saveCalendar( defaultFileName() ); 1608 mView->saveCalendar( defaultFileName() );
1608 1609
1609 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1610 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1610 mView->watchSavedFile(); 1611 mView->watchSavedFile();
1611 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1612 qDebug("KO: Needed %d ms for saving.",msNeeded );
1612 QString savemes; 1613 QString savemes;
1613 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1614 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1614 setCaption(savemes); 1615 setCaption(savemes);
1615 } else 1616 } else
1616 setCaption(i18n("Saving cancelled!")); 1617 setCaption(i18n("Saving cancelled!"));
1617 mCalendarModifiedFlag = false; 1618 mCalendarModifiedFlag = false;
1618 mBlockSaveFlag = store; 1619 mBlockSaveFlag = store;
1619} 1620}
1620 1621
1621void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1622void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1622{ 1623{
1623 if ( !e->isAutoRepeat() ) { 1624 if ( !e->isAutoRepeat() ) {
1624 mFlagKeyPressed = false; 1625 mFlagKeyPressed = false;
1625 } 1626 }
1626} 1627}
1627void MainWindow::keyPressEvent ( QKeyEvent * e ) 1628void MainWindow::keyPressEvent ( QKeyEvent * e )
1628{ 1629{
1629 qApp->processEvents(); 1630 qApp->processEvents();
1630 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1631 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1631 e->ignore(); 1632 e->ignore();
1632 // qDebug(" ignore %d",e->isAutoRepeat() ); 1633 // qDebug(" ignore %d",e->isAutoRepeat() );
1633 return; 1634 return;
1634 } 1635 }
1635 if (! e->isAutoRepeat() ) 1636 if (! e->isAutoRepeat() )
1636 mFlagKeyPressed = true; 1637 mFlagKeyPressed = true;
1637 KOPrefs *p = KOPrefs::instance(); 1638 KOPrefs *p = KOPrefs::instance();
1638 bool showSelectedDates = false; 1639 bool showSelectedDates = false;
1639 int size; 1640 int size;
1640 int pro = 0; 1641 int pro = 0;
1641 //qDebug("MainWindow::keyPressEvent "); 1642 //qDebug("MainWindow::keyPressEvent ");
1642 switch ( e->key() ) { 1643 switch ( e->key() ) {
1643 case Qt::Key_Right: 1644 case Qt::Key_Right:
1644 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1645 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1645 mView->goNextMonth(); 1646 mView->goNextMonth();
1646 else 1647 else
1647 mView->goNext(); 1648 mView->goNext();
1648 showSelectedDates = true; 1649 showSelectedDates = true;
1649 break; 1650 break;
1650 case Qt::Key_Left: 1651 case Qt::Key_Left:
1651 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1652 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1652 mView->goPreviousMonth(); 1653 mView->goPreviousMonth();
1653 else 1654 else
1654 mView->goPrevious(); 1655 mView->goPrevious();
1655 showSelectedDates = true; 1656 showSelectedDates = true;
1656 break; 1657 break;
1657 case Qt::Key_Down: 1658 case Qt::Key_Down:
1658 mView->viewManager()->agendaView()->scrollOneHourDown(); 1659 mView->viewManager()->agendaView()->scrollOneHourDown();
1659 break; 1660 break;
1660 case Qt::Key_Up: 1661 case Qt::Key_Up:
1661 mView->viewManager()->agendaView()->scrollOneHourUp(); 1662 mView->viewManager()->agendaView()->scrollOneHourUp();
1662 break; 1663 break;
1663 case Qt::Key_I: 1664 case Qt::Key_I:
1664 mView->showIncidence(); 1665 mView->showIncidence();
1665 break; 1666 break;
1666 case Qt::Key_Delete: 1667 case Qt::Key_Delete:
1667 case Qt::Key_Backspace: 1668 case Qt::Key_Backspace:
1668 mView->deleteIncidence(); 1669 mView->deleteIncidence();
1669 break; 1670 break;
1670 case Qt::Key_D: 1671 case Qt::Key_D:
1671 mView->viewManager()->showDayView(); 1672 mView->viewManager()->showDayView();
1672 showSelectedDates = true; 1673 showSelectedDates = true;
1673 break; 1674 break;
1674 case Qt::Key_O: 1675 case Qt::Key_O:
1675 mView->toggleFilerEnabled( ); 1676 mView->toggleFilerEnabled( );
1676 break; 1677 break;
1677 case Qt::Key_0: 1678 case Qt::Key_0:
1678 case Qt::Key_1: 1679 case Qt::Key_1:
1679 case Qt::Key_2: 1680 case Qt::Key_2:
1680 case Qt::Key_3: 1681 case Qt::Key_3:
1681 case Qt::Key_4: 1682 case Qt::Key_4:
1682 case Qt::Key_5: 1683 case Qt::Key_5:
1683 case Qt::Key_6: 1684 case Qt::Key_6:
1684 case Qt::Key_7: 1685 case Qt::Key_7:
1685 case Qt::Key_8: 1686 case Qt::Key_8:
1686 case Qt::Key_9: 1687 case Qt::Key_9:
1687 pro = e->key()-48; 1688 pro = e->key()-48;
1688 if ( pro == 0 ) 1689 if ( pro == 0 )
1689 pro = 10; 1690 pro = 10;
1690 if ( e->state() == Qt::ControlButton) 1691 if ( e->state() == Qt::ControlButton)
1691 pro += 10; 1692 pro += 10;
1692 break; 1693 break;
1693 case Qt::Key_M: 1694 case Qt::Key_M:
1694 mView->viewManager()->showMonthView(); 1695 mView->viewManager()->showMonthView();
1695 showSelectedDates = true; 1696 showSelectedDates = true;
1696 break; 1697 break;
1697 case Qt::Key_Insert: 1698 case Qt::Key_Insert:
1698 mView->newEvent(); 1699 mView->newEvent();
1699 break; 1700 break;
1700 case Qt::Key_S : 1701 case Qt::Key_S :
1701 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1702 mView->newSubTodo(); 1703 mView->newSubTodo();
1703 else 1704 else
1704 mView->dialogManager()->showSearchDialog(); 1705 mView->dialogManager()->showSearchDialog();
1705 break; 1706 break;
1706 case Qt::Key_Y : 1707 case Qt::Key_Y :
1707 case Qt::Key_Z : 1708 case Qt::Key_Z :
1708 mView->viewManager()->showWorkWeekView(); 1709 mView->viewManager()->showWorkWeekView();
1709 showSelectedDates = true; 1710 showSelectedDates = true;
1710 break; 1711 break;
1711 case Qt::Key_U : 1712 case Qt::Key_U :
1712 mView->viewManager()->showWeekView(); 1713 mView->viewManager()->showWeekView();
1713 showSelectedDates = true; 1714 showSelectedDates = true;
1714 break; 1715 break;
1715 case Qt::Key_H : 1716 case Qt::Key_H :
1716 keyBindings(); 1717 keyBindings();
1717 break; 1718 break;
1718 case Qt::Key_W: 1719 case Qt::Key_W:
1719 mView->viewManager()->showWhatsNextView(); 1720 mView->viewManager()->showWhatsNextView();
1720 break; 1721 break;
1721 case Qt::Key_L: 1722 case Qt::Key_L:
1722 mView->viewManager()->showListView(); 1723 mView->viewManager()->showListView();
1723 break; 1724 break;
1724 case Qt::Key_N: 1725 case Qt::Key_N:
1725 mView->viewManager()->showNextXView(); 1726 mView->viewManager()->showNextXView();
1726 showSelectedDates = true; 1727 showSelectedDates = true;
1727 break; 1728 break;
1728 case Qt::Key_V: 1729 case Qt::Key_V:
1729 mView->viewManager()->showTodoView(); 1730 mView->viewManager()->showTodoView();
1730 break; 1731 break;
1731 case Qt::Key_C: 1732 case Qt::Key_C:
1732 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1733 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1733 break; 1734 break;
1734 case Qt::Key_P: 1735 case Qt::Key_P:
1735 mView->showDatePicker( ); 1736 mView->showDatePicker( );
1736 break; 1737 break;
1737 case Qt::Key_F: 1738 case Qt::Key_F:
1738 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1739 mView->editFilters(); 1740 mView->editFilters();
1740 else 1741 else
1741 mView->toggleFilter(); 1742 mView->toggleFilter();
1742 break; 1743 break;
1743 case Qt::Key_X: 1744 case Qt::Key_X:
1744 mView->toggleDateNavigatorWidget(); 1745 mView->toggleDateNavigatorWidget();
1745 break; 1746 break;
1746 case Qt::Key_Space: 1747 case Qt::Key_Space:
1747 mView->toggleExpand(); 1748 mView->toggleExpand();
1748 break; 1749 break;
1749 case Qt::Key_A: 1750 case Qt::Key_A: