summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
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,341 +1,337 @@
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);
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,362 +1,362 @@
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 }
@@ -918,576 +918,577 @@ void MainWindow::initActions()
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" ) {