-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 36 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
4 files changed, 23 insertions, 16 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index e0623d5..c28da9a 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -2,384 +2,385 @@ | |||
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 | ||
49 | const char *germanwords[][2] = { | 49 | const char *germanwords[][2] = { |
50 | #include "wordsgerman.h" | 50 | #include "wordsgerman.h" |
51 | "", "" | 51 | "", "" |
52 | }; | 52 | }; |
53 | 53 | ||
54 | KOPrefs *KOPrefs::mInstance = 0; | 54 | KOPrefs *KOPrefs::mInstance = 0; |
55 | static KStaticDeleter<KOPrefs> insd; | 55 | static KStaticDeleter<KOPrefs> insd; |
56 | 56 | ||
57 | KOPrefs::KOPrefs() : | 57 | KOPrefs::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 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 80 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
81 | 81 | ||
82 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 82 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
83 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 83 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
84 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 84 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
85 | addItemBool("ShowIconList",&mShowIconList,true); | 85 | addItemBool("ShowIconList",&mShowIconList,true); |
86 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 86 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
87 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 87 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
88 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 88 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
89 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 89 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
90 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 90 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
91 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 91 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
92 | addItemBool("ShowIconBack",&mShowIconBack,true); | 92 | addItemBool("ShowIconBack",&mShowIconBack,true); |
93 | addItemBool("ShowIconToday",&mShowIconToday,true); | 93 | addItemBool("ShowIconToday",&mShowIconToday,true); |
94 | addItemBool("ShowIconForward",&mShowIconForward,true); | 94 | addItemBool("ShowIconForward",&mShowIconForward,true); |
95 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 95 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
96 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); | 96 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); |
97 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 97 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
98 | addItemBool("ShowIconNext",&mShowIconNext,true); | 98 | addItemBool("ShowIconNext",&mShowIconNext,true); |
99 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 99 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
100 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 100 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
101 | addItemBool("LanguageChanged",&mLanguageChanged,false); | 101 | addItemBool("LanguageChanged",&mLanguageChanged,false); |
102 | 102 | ||
103 | addItemBool("AskForQuit",&mAskForQuit,false); | 103 | addItemBool("AskForQuit",&mAskForQuit,false); |
104 | 104 | ||
105 | #ifndef DESKTOP_VERSION | 105 | #ifndef DESKTOP_VERSION |
106 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 106 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
107 | #else | 107 | #else |
108 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 108 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
109 | #endif | 109 | #endif |
110 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 110 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
111 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 111 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
112 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 112 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
113 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 113 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
114 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 114 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
115 | 115 | ||
116 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 116 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
117 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 117 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
118 | addItemInt("AllDay Size",&mAllDaySize,28); | 118 | addItemInt("AllDay Size",&mAllDaySize,28); |
119 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 119 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
120 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 120 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
121 | 121 | ||
122 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 122 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
123 | addItemStringList("EventSummary User",&mEventSummaryUser); | 123 | addItemStringList("EventSummary User",&mEventSummaryUser); |
124 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 124 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
125 | 125 | ||
126 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 126 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
127 | addItemBool("Enable Project View",&mEnableProjectView,false); | 127 | addItemBool("Enable Project View",&mEnableProjectView,false); |
128 | addItemBool("Auto Save",&mAutoSave,false); | 128 | addItemBool("Auto Save",&mAutoSave,false); |
129 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 129 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
130 | addItemBool("Confirm Deletes",&mConfirm,true); | 130 | addItemBool("Confirm Deletes",&mConfirm,true); |
131 | addItemString("Archive File",&mArchiveFile); | 131 | addItemString("Archive File",&mArchiveFile); |
132 | addItemString("Html Export File",&mHtmlExportFile, | 132 | addItemString("Html Export File",&mHtmlExportFile, |
133 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 133 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
134 | addItemBool("Html With Save",&mHtmlWithSave,false); | 134 | addItemBool("Html With Save",&mHtmlWithSave,false); |
135 | 135 | ||
136 | KPrefs::setCurrentGroup("Personal Settings"); | 136 | KPrefs::setCurrentGroup("Personal Settings"); |
137 | 137 | ||
138 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 138 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
139 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 139 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
140 | addItemBool("Bcc",&mBcc,false); | 140 | addItemBool("Bcc",&mBcc,false); |
141 | 141 | ||
142 | KPrefs::setCurrentGroup("Time & Date"); | 142 | KPrefs::setCurrentGroup("Time & Date"); |
143 | 143 | ||
144 | // addItemString("Time Zone",&mTimeZone,"+0100"); | 144 | // addItemString("Time Zone",&mTimeZone,"+0100"); |
145 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); | 145 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); |
146 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); | 146 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); |
147 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 147 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
148 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 148 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
149 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 149 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
150 | 150 | ||
151 | 151 | ||
152 | addItemInt("Default Start Time",&mStartTime,10); | 152 | addItemInt("Default Start Time",&mStartTime,10); |
153 | addItemInt("Default Duration",&mDefaultDuration,2); | 153 | addItemInt("Default Duration",&mDefaultDuration,2); |
154 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 154 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
155 | addItemInt("Daylight Savings",&mDaylightSavings,0); | 155 | addItemInt("Daylight Savings",&mDaylightSavings,0); |
156 | KPrefs::setCurrentGroup("AlarmSettings"); | 156 | KPrefs::setCurrentGroup("AlarmSettings"); |
157 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 157 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
158 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 158 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
159 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 159 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
160 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 160 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
161 | 161 | ||
162 | 162 | ||
163 | KPrefs::setCurrentGroup("Calendar"); | 163 | KPrefs::setCurrentGroup("Calendar"); |
164 | 164 | ||
165 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 165 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
166 | 166 | ||
167 | KPrefs::setCurrentGroup("Fonts"); | 167 | KPrefs::setCurrentGroup("Fonts"); |
168 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 168 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
169 | addItemFont("TimeBar Font",&mTimeBarFont); | 169 | addItemFont("TimeBar Font",&mTimeBarFont); |
170 | addItemFont("MonthView Font",&mMonthViewFont); | 170 | addItemFont("MonthView Font",&mMonthViewFont); |
171 | addItemFont("AgendaView Font",&mAgendaViewFont); | 171 | addItemFont("AgendaView Font",&mAgendaViewFont); |
172 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 172 | addItemFont("MarcusBains Font",&mMarcusBainsFont); |
173 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 173 | addItemFont("TimeLabels Font",&mTimeLabelsFont); |
174 | addItemFont("TodoView Font",&mTodoViewFont); | 174 | addItemFont("TodoView Font",&mTodoViewFont); |
175 | addItemFont("ListView Font",&mListViewFont); | 175 | addItemFont("ListView Font",&mListViewFont); |
176 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 176 | addItemFont("DateNavigator Font",&mDateNavigatorFont); |
177 | addItemFont("EditBox Font",&mEditBoxFont); | 177 | addItemFont("EditBox Font",&mEditBoxFont); |
178 | addItemFont("JournalView Font",&mJornalViewFont); | 178 | addItemFont("JournalView Font",&mJornalViewFont); |
179 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 179 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
180 | addItemFont("EventView Font",&mEventViewFont); | 180 | addItemFont("EventView Font",&mEventViewFont); |
181 | 181 | ||
182 | // KPrefs::setCurrentGroup("SyncProfiles"); | 182 | // KPrefs::setCurrentGroup("SyncProfiles"); |
183 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | 183 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); |
184 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); | 184 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); |
185 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | 185 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); |
186 | 186 | ||
187 | KPrefs::setCurrentGroup("RemoteSyncing"); | 187 | KPrefs::setCurrentGroup("RemoteSyncing"); |
188 | // addItemBool("UsePasswd",&mUsePassWd,false); | 188 | // addItemBool("UsePasswd",&mUsePassWd,false); |
189 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | 189 | // addItemBool("WriteBackFile",&mWriteBackFile,true); |
190 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | 190 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); |
191 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | 191 | // addItemBool("AskForPreferences",&mAskForPreferences,true); |
192 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | 192 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); |
193 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); | 193 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); |
194 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); | ||
194 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 195 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
195 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 196 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
196 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 197 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
197 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 198 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
198 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | 199 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); |
199 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 200 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
200 | 201 | ||
201 | #ifdef _WIN32_ | 202 | #ifdef _WIN32_ |
202 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 203 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
203 | #else | 204 | #else |
204 | QString hdp= locateLocal("data","korganizer")+"/"; | 205 | QString hdp= locateLocal("data","korganizer")+"/"; |
205 | #endif | 206 | #endif |
206 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | 207 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); |
207 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); | 208 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); |
208 | // addItemString("RemotePassWd",&mRemotePassWd, ""); | 209 | // addItemString("RemotePassWd",&mRemotePassWd, ""); |
209 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | 210 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); |
210 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); | 211 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); |
211 | 212 | ||
212 | 213 | ||
213 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 214 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
214 | 215 | ||
215 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 216 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
216 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 217 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
217 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 218 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
218 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 219 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
219 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 220 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
220 | 221 | ||
221 | 222 | ||
222 | KPrefs::setCurrentGroup("Locale"); | 223 | KPrefs::setCurrentGroup("Locale"); |
223 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 224 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
224 | addItemInt("PreferredTime",&mPreferredTime,0); | 225 | addItemInt("PreferredTime",&mPreferredTime,0); |
225 | addItemInt("PreferredDate",&mPreferredDate,0); | 226 | addItemInt("PreferredDate",&mPreferredDate,0); |
226 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 227 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
227 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 228 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
228 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 229 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
229 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 230 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
230 | 231 | ||
231 | 232 | ||
232 | KPrefs::setCurrentGroup("Colors"); | 233 | KPrefs::setCurrentGroup("Colors"); |
233 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 234 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
234 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 235 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
235 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 236 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
236 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 237 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
237 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 238 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
238 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 239 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
239 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 240 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
240 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 241 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
241 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 242 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
242 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 243 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
243 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 244 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
244 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 245 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
245 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 246 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
246 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 247 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
247 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 248 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
248 | addItemBool("UseAppColors",&mUseAppColors,false); | 249 | addItemBool("UseAppColors",&mUseAppColors,false); |
249 | 250 | ||
250 | 251 | ||
251 | 252 | ||
252 | KPrefs::setCurrentGroup("Views"); | 253 | KPrefs::setCurrentGroup("Views"); |
253 | addItemInt("Hour Size",&mHourSize,8); | 254 | addItemInt("Hour Size",&mHourSize,8); |
254 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 255 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
255 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 256 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
256 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 257 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
257 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 258 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
258 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 259 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
259 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 260 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
260 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 261 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
261 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 262 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
262 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 263 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
263 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 264 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
264 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 265 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
265 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); | 266 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); |
266 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 267 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
267 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 268 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
268 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 269 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
269 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 270 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
270 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | 271 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); |
271 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 272 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
272 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 273 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
273 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 274 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
274 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 275 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
275 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 276 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
276 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | 277 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); |
277 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 278 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
278 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 279 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
279 | #ifdef DESKTOP_VERSION | 280 | #ifdef DESKTOP_VERSION |
280 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 281 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
281 | #else | 282 | #else |
282 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 283 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
283 | #endif | 284 | #endif |
284 | addItemInt("Day Begins",&mDayBegins,7); | 285 | addItemInt("Day Begins",&mDayBegins,7); |
285 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 286 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
286 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 287 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
287 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 288 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
288 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 289 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
289 | 290 | ||
290 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 291 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
291 | addItemBool("Full View Month",&mFullViewMonth,true); | 292 | addItemBool("Full View Month",&mFullViewMonth,true); |
292 | addItemBool("Full View Todo",&mFullViewTodo,true); | 293 | addItemBool("Full View Todo",&mFullViewTodo,true); |
293 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 294 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
294 | 295 | ||
295 | addItemInt("Next X Days",&mNextXDays,3); | 296 | addItemInt("Next X Days",&mNextXDays,3); |
296 | 297 | ||
297 | KPrefs::setCurrentGroup("Printer"); | 298 | KPrefs::setCurrentGroup("Printer"); |
298 | 299 | ||
299 | KPrefs::setCurrentGroup("Layout"); | 300 | KPrefs::setCurrentGroup("Layout"); |
300 | 301 | ||
301 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 302 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
302 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 303 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
303 | 304 | ||
304 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 305 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
305 | 306 | ||
306 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 307 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
307 | 308 | ||
308 | KPrefs::setCurrentGroup("Group Scheduling"); | 309 | KPrefs::setCurrentGroup("Group Scheduling"); |
309 | 310 | ||
310 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 311 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
311 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 312 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
312 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 313 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
313 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 314 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
314 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 315 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
315 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 316 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
316 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 317 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
317 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 318 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
318 | 319 | ||
319 | KPrefs::setCurrentGroup( "Editors" ); | 320 | KPrefs::setCurrentGroup( "Editors" ); |
320 | 321 | ||
321 | addItemStringList( "EventTemplates", &mEventTemplates ); | 322 | addItemStringList( "EventTemplates", &mEventTemplates ); |
322 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 323 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
323 | 324 | ||
324 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 325 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
325 | 326 | ||
326 | 327 | ||
327 | 328 | ||
328 | } | 329 | } |
329 | 330 | ||
330 | 331 | ||
331 | KOPrefs::~KOPrefs() | 332 | KOPrefs::~KOPrefs() |
332 | { | 333 | { |
333 | if (mInstance == this) | 334 | if (mInstance == this) |
334 | mInstance = insd.setObject(0); | 335 | mInstance = insd.setObject(0); |
335 | setLocaleDict( 0 ); | 336 | setLocaleDict( 0 ); |
336 | if ( mLocaleDict ) | 337 | if ( mLocaleDict ) |
337 | delete mLocaleDict; | 338 | delete mLocaleDict; |
338 | //qDebug("KOPrefs::~KOPrefs() "); | 339 | //qDebug("KOPrefs::~KOPrefs() "); |
339 | } | 340 | } |
340 | 341 | ||
341 | 342 | ||
342 | KOPrefs *KOPrefs::instance() | 343 | KOPrefs *KOPrefs::instance() |
343 | { | 344 | { |
344 | if (!mInstance) { | 345 | if (!mInstance) { |
345 | mInstance = insd.setObject(new KOPrefs()); | 346 | mInstance = insd.setObject(new KOPrefs()); |
346 | mInstance->readConfig(); | 347 | mInstance->readConfig(); |
347 | } | 348 | } |
348 | 349 | ||
349 | return mInstance; | 350 | return mInstance; |
350 | } | 351 | } |
351 | 352 | ||
352 | void KOPrefs::usrSetDefaults() | 353 | void KOPrefs::usrSetDefaults() |
353 | { | 354 | { |
354 | 355 | ||
355 | } | 356 | } |
356 | 357 | ||
357 | void KOPrefs::fillMailDefaults() | 358 | void KOPrefs::fillMailDefaults() |
358 | { | 359 | { |
359 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 360 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
360 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 361 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
361 | } | 362 | } |
362 | 363 | ||
363 | void KOPrefs::setTimeZoneIdDefault() | 364 | void KOPrefs::setTimeZoneIdDefault() |
364 | { | 365 | { |
365 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); | 366 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); |
366 | } | 367 | } |
367 | 368 | ||
368 | void KOPrefs::setCategoryDefaults() | 369 | void KOPrefs::setCategoryDefaults() |
369 | { | 370 | { |
370 | mCustomCategories.clear(); | 371 | mCustomCategories.clear(); |
371 | mCustomCategories = getDefaultList(); | 372 | mCustomCategories = getDefaultList(); |
372 | 373 | ||
373 | QStringList::Iterator it; | 374 | QStringList::Iterator it; |
374 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 375 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
375 | setCategoryColor(*it,mDefaultCategoryColor); | 376 | setCategoryColor(*it,mDefaultCategoryColor); |
376 | } | 377 | } |
377 | } | 378 | } |
378 | 379 | ||
379 | QStringList KOPrefs::getDefaultList() | 380 | QStringList KOPrefs::getDefaultList() |
380 | { | 381 | { |
381 | QStringList retval ; | 382 | QStringList retval ; |
382 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 383 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
383 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 384 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
384 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 385 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
385 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 386 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 7abd741..d9ac851 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -90,223 +90,224 @@ class KOPrefs : public KPimPrefs | |||
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 | 213 | ||
214 | int mLastSyncTime; | 214 | int mLastSyncTime; |
215 | int mSyncAlgoPrefs; | 215 | int mSyncAlgoPrefs; |
216 | int mRingSyncAlgoPrefs; | 216 | int mRingSyncAlgoPrefs; |
217 | QStringList mSyncProfileNames; | 217 | QStringList mSyncProfileNames; |
218 | QStringList mExternSyncProfiles; | 218 | QStringList mExternSyncProfiles; |
219 | QString mLocalMachineName; | 219 | QString mLocalMachineName; |
220 | void setCategoryColor(QString cat,const QColor & color); | 220 | void setCategoryColor(QString cat,const QColor & color); |
221 | QColor *categoryColor(QString cat); | 221 | QColor *categoryColor(QString cat); |
222 | 222 | ||
223 | QString mArchiveFile; | 223 | QString mArchiveFile; |
224 | QString mHtmlExportFile; | 224 | QString mHtmlExportFile; |
225 | bool mHtmlWithSave; | 225 | bool mHtmlWithSave; |
226 | 226 | ||
227 | QStringList mSelectedPlugins; | 227 | QStringList mSelectedPlugins; |
228 | 228 | ||
229 | QString mLastImportFile; | 229 | QString mLastImportFile; |
230 | QString mLastVcalFile; | 230 | QString mLastVcalFile; |
231 | QString mLastSaveFile; | 231 | QString mLastSaveFile; |
232 | QString mLastLoadFile; | 232 | QString mLastLoadFile; |
233 | QString mLastSyncedLocalFile; | 233 | QString mLastSyncedLocalFile; |
234 | 234 | ||
235 | 235 | ||
236 | QString mDefaultAlarmFile; | 236 | QString mDefaultAlarmFile; |
237 | int mIMIPScheduler; | 237 | int mIMIPScheduler; |
238 | int mIMIPSend; | 238 | int mIMIPSend; |
239 | QStringList mAdditionalMails; | 239 | QStringList mAdditionalMails; |
240 | int mIMIPAutoRefresh; | 240 | int mIMIPAutoRefresh; |
241 | int mIMIPAutoInsertReply; | 241 | int mIMIPAutoInsertReply; |
242 | int mIMIPAutoInsertRequest; | 242 | int mIMIPAutoInsertRequest; |
243 | int mIMIPAutoFreeBusy; | 243 | int mIMIPAutoFreeBusy; |
244 | int mIMIPAutoFreeBusyReply; | 244 | int mIMIPAutoFreeBusyReply; |
245 | 245 | ||
246 | QStringList mTodoTemplates; | 246 | QStringList mTodoTemplates; |
247 | QStringList mEventTemplates; | 247 | QStringList mEventTemplates; |
248 | 248 | ||
249 | int mDestination; | 249 | int mDestination; |
250 | 250 | ||
251 | 251 | ||
252 | bool mEditOnDoubleClick; | 252 | bool mEditOnDoubleClick; |
253 | bool mViewChangeHoldFullscreen; | 253 | bool mViewChangeHoldFullscreen; |
254 | bool mViewChangeHoldNonFullscreen; | 254 | bool mViewChangeHoldNonFullscreen; |
255 | bool mCenterOnCurrentTime; | 255 | bool mCenterOnCurrentTime; |
256 | bool mSetTimeToDayStartAt; | 256 | bool mSetTimeToDayStartAt; |
257 | bool mHighlightCurrentDay; | 257 | bool mHighlightCurrentDay; |
258 | bool mUseHighlightLightColor; | 258 | bool mUseHighlightLightColor; |
259 | bool mListViewMonthTimespan; | 259 | bool mListViewMonthTimespan; |
260 | bool mWNViewShowsParents; | 260 | bool mWNViewShowsParents; |
261 | bool mWNViewShowLocation; | 261 | bool mWNViewShowLocation; |
262 | bool mTodoViewShowsPercentage; | 262 | bool mTodoViewShowsPercentage; |
263 | bool mTodoViewUsesCatColors; | 263 | bool mTodoViewUsesCatColors; |
264 | bool mTodoViewUsesSmallFont; | 264 | bool mTodoViewUsesSmallFont; |
265 | bool mTodoViewUsesForegroundColor; | 265 | bool mTodoViewUsesForegroundColor; |
266 | bool mMonthViewUsesForegroundColor; | 266 | bool mMonthViewUsesForegroundColor; |
267 | 267 | ||
268 | bool mHightlightDateTimeEdit; | 268 | bool mHightlightDateTimeEdit; |
269 | bool mShortDateInViewer; | 269 | bool mShortDateInViewer; |
270 | 270 | ||
271 | QStringList mLocationDefaults; | 271 | QStringList mLocationDefaults; |
272 | QStringList mEventSummaryUser; | 272 | QStringList mEventSummaryUser; |
273 | QStringList mTodoSummaryUser; | 273 | QStringList mTodoSummaryUser; |
274 | 274 | ||
275 | bool mUseInternalAlarmNotification; | 275 | bool mUseInternalAlarmNotification; |
276 | int mAlarmPlayBeeps; | 276 | int mAlarmPlayBeeps; |
277 | int mAlarmSuspendTime; | 277 | int mAlarmSuspendTime; |
278 | int mAlarmSuspendCount; | 278 | int mAlarmSuspendCount; |
279 | int mAlarmBeepInterval; | 279 | int mAlarmBeepInterval; |
280 | 280 | ||
281 | QString mPassiveSyncPort; | 281 | QString mPassiveSyncPort; |
282 | QString mPassiveSyncPw; | ||
282 | QString mActiveSyncPort; | 283 | QString mActiveSyncPort; |
283 | QString mActiveSyncIP; | 284 | QString mActiveSyncIP; |
284 | 285 | ||
285 | 286 | ||
286 | //US I copied the following settings into KPimGlobalPrefs | 287 | //US I copied the following settings into KPimGlobalPrefs |
287 | // that allows us later to easily remove the settings from here. | 288 | // that allows us later to easily remove the settings from here. |
288 | int mPreferredDate; | 289 | int mPreferredDate; |
289 | QString mUserDateFormatLong; | 290 | QString mUserDateFormatLong; |
290 | QString mUserDateFormatShort; | 291 | QString mUserDateFormatShort; |
291 | int mPreferredLanguage; | 292 | int mPreferredLanguage; |
292 | int mPreferredTime; | 293 | int mPreferredTime; |
293 | bool mWeekStartsOnSunday; | 294 | bool mWeekStartsOnSunday; |
294 | QString mTimeZoneId; | 295 | QString mTimeZoneId; |
295 | bool mUseDaylightsaving; | 296 | bool mUseDaylightsaving; |
296 | int mDaylightsavingStart; | 297 | int mDaylightsavingStart; |
297 | int mDaylightsavingEnd; | 298 | int mDaylightsavingEnd; |
298 | 299 | ||
299 | 300 | ||
300 | private: | 301 | private: |
301 | QDict<QColor> mCategoryColors; | 302 | QDict<QColor> mCategoryColors; |
302 | QColor mDefaultCategoryColor; | 303 | QColor mDefaultCategoryColor; |
303 | 304 | ||
304 | QFont mDefaultTimeBarFont; | 305 | QFont mDefaultTimeBarFont; |
305 | QFont mDefaultViewFont; | 306 | QFont mDefaultViewFont; |
306 | QFont mDefaultMonthViewFont; | 307 | QFont mDefaultMonthViewFont; |
307 | 308 | ||
308 | QString mName; | 309 | QString mName; |
309 | QString mEmail; | 310 | QString mEmail; |
310 | }; | 311 | }; |
311 | 312 | ||
312 | #endif | 313 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7b666d1..de94b8c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1703,798 +1703,802 @@ void MainWindow::setCaptionToDates() | |||
1703 | // parameter item == 0: reinit | 1703 | // parameter item == 0: reinit |
1704 | void MainWindow::configureAgenda( int item ) | 1704 | void MainWindow::configureAgenda( int item ) |
1705 | { | 1705 | { |
1706 | 1706 | ||
1707 | KOPrefs *p = KOPrefs::instance(); | 1707 | KOPrefs *p = KOPrefs::instance(); |
1708 | 1708 | ||
1709 | int i; | 1709 | int i; |
1710 | if ( item == 1 ) { | 1710 | if ( item == 1 ) { |
1711 | mView->toggleAllDaySize(); | 1711 | mView->toggleAllDaySize(); |
1712 | return; | 1712 | return; |
1713 | } | 1713 | } |
1714 | // do not allow 4 for widgets higher than 480 | 1714 | // do not allow 4 for widgets higher than 480 |
1715 | // if ( QApplication::desktop()->height() > 480 ) { | 1715 | // if ( QApplication::desktop()->height() > 480 ) { |
1716 | // if ( item == 4 ) | 1716 | // if ( item == 4 ) |
1717 | // item = 6; | 1717 | // item = 6; |
1718 | // } | 1718 | // } |
1719 | for ( i = 4; i <= 18; i= i+2 ) | 1719 | for ( i = 4; i <= 18; i= i+2 ) |
1720 | configureAgendaMenu->setItemChecked( i, false ); | 1720 | configureAgendaMenu->setItemChecked( i, false ); |
1721 | configureAgendaMenu->setItemChecked( item, true ); | 1721 | configureAgendaMenu->setItemChecked( item, true ); |
1722 | if ( p->mHourSize == item ) | 1722 | if ( p->mHourSize == item ) |
1723 | return; | 1723 | return; |
1724 | p->mHourSize=item; | 1724 | p->mHourSize=item; |
1725 | mView->viewManager()->agendaView()->updateConfig(); | 1725 | mView->viewManager()->agendaView()->updateConfig(); |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | void MainWindow::saveCalendar() | 1728 | void MainWindow::saveCalendar() |
1729 | { | 1729 | { |
1730 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1730 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1731 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1731 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1732 | 1732 | ||
1733 | if ( fn == "" ) | 1733 | if ( fn == "" ) |
1734 | return; | 1734 | return; |
1735 | QFileInfo info; | 1735 | QFileInfo info; |
1736 | info.setFile( fn ); | 1736 | info.setFile( fn ); |
1737 | QString mes; | 1737 | QString mes; |
1738 | bool createbup = true; | 1738 | bool createbup = true; |
1739 | if ( info. exists() ) { | 1739 | if ( info. exists() ) { |
1740 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1740 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1741 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1741 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1742 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1742 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1743 | 0, 1 ); | 1743 | 0, 1 ); |
1744 | if ( result != 0 ) { | 1744 | if ( result != 0 ) { |
1745 | createbup = false; | 1745 | createbup = false; |
1746 | } | 1746 | } |
1747 | } | 1747 | } |
1748 | if ( createbup ) { | 1748 | if ( createbup ) { |
1749 | mView->saveCalendar( fn ); | 1749 | mView->saveCalendar( fn ); |
1750 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1750 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1751 | KOPrefs::instance()->mLastSaveFile = fn; | 1751 | KOPrefs::instance()->mLastSaveFile = fn; |
1752 | setCaption(mes); | 1752 | setCaption(mes); |
1753 | } | 1753 | } |
1754 | } | 1754 | } |
1755 | void MainWindow::loadCalendar() | 1755 | void MainWindow::loadCalendar() |
1756 | { | 1756 | { |
1757 | 1757 | ||
1758 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1758 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1759 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1759 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1760 | 1760 | ||
1761 | if ( fn == "" ) | 1761 | if ( fn == "" ) |
1762 | return; | 1762 | return; |
1763 | QFileInfo info; | 1763 | QFileInfo info; |
1764 | info.setFile( fn ); | 1764 | info.setFile( fn ); |
1765 | QString mess; | 1765 | QString mess; |
1766 | bool loadbup = true; | 1766 | bool loadbup = true; |
1767 | if ( info. exists() ) { | 1767 | if ( info. exists() ) { |
1768 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1768 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1769 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1769 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1770 | mess, | 1770 | mess, |
1771 | i18n("Load!"), i18n("Cancel"), 0, | 1771 | i18n("Load!"), i18n("Cancel"), 0, |
1772 | 0, 1 ); | 1772 | 0, 1 ); |
1773 | if ( result != 0 ) { | 1773 | if ( result != 0 ) { |
1774 | loadbup = false; | 1774 | loadbup = false; |
1775 | } | 1775 | } |
1776 | } else { | 1776 | } else { |
1777 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1777 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1778 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1778 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1779 | 0, 1 ); | 1779 | 0, 1 ); |
1780 | 1780 | ||
1781 | return; | 1781 | return; |
1782 | } | 1782 | } |
1783 | if ( loadbup ) { | 1783 | if ( loadbup ) { |
1784 | mView->openCalendar( fn ); | 1784 | mView->openCalendar( fn ); |
1785 | KOPrefs::instance()->mLastLoadFile = fn; | 1785 | KOPrefs::instance()->mLastLoadFile = fn; |
1786 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1786 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1787 | setCaption(mess); | 1787 | setCaption(mess); |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | } | 1790 | } |
1791 | void MainWindow::quickImportIcal() | 1791 | void MainWindow::quickImportIcal() |
1792 | { | 1792 | { |
1793 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1793 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1794 | } | 1794 | } |
1795 | void MainWindow::importFile( QString fn, bool quick ) | 1795 | void MainWindow::importFile( QString fn, bool quick ) |
1796 | { | 1796 | { |
1797 | QFileInfo info; | 1797 | QFileInfo info; |
1798 | info.setFile( fn ); | 1798 | info.setFile( fn ); |
1799 | QString mess; | 1799 | QString mess; |
1800 | bool loadbup = true; | 1800 | bool loadbup = true; |
1801 | if ( !info. exists() ) { | 1801 | if ( !info. exists() ) { |
1802 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1802 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1803 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1803 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1804 | mess ); | 1804 | mess ); |
1805 | return; | 1805 | return; |
1806 | } | 1806 | } |
1807 | int result = 0; | 1807 | int result = 0; |
1808 | if ( !quick ) { | 1808 | if ( !quick ) { |
1809 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1809 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1810 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1810 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1811 | mess, | 1811 | mess, |
1812 | "Import", "Cancel", 0, | 1812 | "Import", "Cancel", 0, |
1813 | 0, 1 ); | 1813 | 0, 1 ); |
1814 | } | 1814 | } |
1815 | if ( result == 0 ) { | 1815 | if ( result == 0 ) { |
1816 | if ( mView->openCalendar( fn, true )) { | 1816 | if ( mView->openCalendar( fn, true )) { |
1817 | KOPrefs::instance()->mLastImportFile = fn; | 1817 | KOPrefs::instance()->mLastImportFile = fn; |
1818 | setCaption(i18n("Imported file successfully")); | 1818 | setCaption(i18n("Imported file successfully")); |
1819 | } else { | 1819 | } else { |
1820 | setCaption(i18n("Error importing file")); | 1820 | setCaption(i18n("Error importing file")); |
1821 | } | 1821 | } |
1822 | } | 1822 | } |
1823 | } | 1823 | } |
1824 | 1824 | ||
1825 | void MainWindow::importIcal() | 1825 | void MainWindow::importIcal() |
1826 | { | 1826 | { |
1827 | 1827 | ||
1828 | QString fn =KOPrefs::instance()->mLastImportFile; | 1828 | QString fn =KOPrefs::instance()->mLastImportFile; |
1829 | 1829 | ||
1830 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1830 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1831 | if ( fn == "" ) | 1831 | if ( fn == "" ) |
1832 | return; | 1832 | return; |
1833 | importFile( fn, true ); | 1833 | importFile( fn, true ); |
1834 | 1834 | ||
1835 | } | 1835 | } |
1836 | 1836 | ||
1837 | void MainWindow::exportVCalendar() | 1837 | void MainWindow::exportVCalendar() |
1838 | { | 1838 | { |
1839 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1839 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1840 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1840 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1841 | if ( fn == "" ) | 1841 | if ( fn == "" ) |
1842 | return; | 1842 | return; |
1843 | QFileInfo info; | 1843 | QFileInfo info; |
1844 | info.setFile( fn ); | 1844 | info.setFile( fn ); |
1845 | QString mes; | 1845 | QString mes; |
1846 | bool createbup = true; | 1846 | bool createbup = true; |
1847 | if ( info. exists() ) { | 1847 | if ( info. exists() ) { |
1848 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1848 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1849 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1849 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1850 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1850 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1851 | 0, 1 ); | 1851 | 0, 1 ); |
1852 | if ( result != 0 ) { | 1852 | if ( result != 0 ) { |
1853 | createbup = false; | 1853 | createbup = false; |
1854 | } | 1854 | } |
1855 | } | 1855 | } |
1856 | if ( createbup ) { | 1856 | if ( createbup ) { |
1857 | if ( mView->exportVCalendar( fn ) ) { | 1857 | if ( mView->exportVCalendar( fn ) ) { |
1858 | KOPrefs::instance()->mLastVcalFile = fn; | 1858 | KOPrefs::instance()->mLastVcalFile = fn; |
1859 | if ( fn.length() > 20 ) | 1859 | if ( fn.length() > 20 ) |
1860 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1860 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1861 | else | 1861 | else |
1862 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1862 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1863 | setCaption(mes); | 1863 | setCaption(mes); |
1864 | } | 1864 | } |
1865 | } | 1865 | } |
1866 | 1866 | ||
1867 | } | 1867 | } |
1868 | QString MainWindow::getPassword( ) | 1868 | QString MainWindow::getPassword( ) |
1869 | { | 1869 | { |
1870 | QString retfile = ""; | 1870 | QString retfile = ""; |
1871 | QDialog dia ( this, "input-dialog", true ); | 1871 | QDialog dia ( this, "input-dialog", true ); |
1872 | QLineEdit lab ( &dia ); | 1872 | QLineEdit lab ( &dia ); |
1873 | lab.setEchoMode( QLineEdit::Password ); | 1873 | lab.setEchoMode( QLineEdit::Password ); |
1874 | QVBoxLayout lay( &dia ); | 1874 | QVBoxLayout lay( &dia ); |
1875 | lay.setMargin(7); | 1875 | lay.setMargin(7); |
1876 | lay.setSpacing(7); | 1876 | lay.setSpacing(7); |
1877 | lay.addWidget( &lab); | 1877 | lay.addWidget( &lab); |
1878 | dia.setFixedSize( 230,50 ); | 1878 | dia.setFixedSize( 230,50 ); |
1879 | dia.setCaption( i18n("Enter password") ); | 1879 | dia.setCaption( i18n("Enter password") ); |
1880 | QPushButton pb ( "OK", &dia); | 1880 | QPushButton pb ( "OK", &dia); |
1881 | lay.addWidget( &pb ); | 1881 | lay.addWidget( &pb ); |
1882 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1882 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1883 | dia.show(); | 1883 | dia.show(); |
1884 | int res = dia.exec(); | 1884 | int res = dia.exec(); |
1885 | if ( res ) | 1885 | if ( res ) |
1886 | retfile = lab.text(); | 1886 | retfile = lab.text(); |
1887 | dia.hide(); | 1887 | dia.hide(); |
1888 | qApp->processEvents(); | 1888 | qApp->processEvents(); |
1889 | return retfile; | 1889 | return retfile; |
1890 | 1890 | ||
1891 | } | 1891 | } |
1892 | 1892 | ||
1893 | void MainWindow::enableQuick() | 1893 | void MainWindow::enableQuick() |
1894 | { | 1894 | { |
1895 | QString passWordPiSync = "bhdrvmk"; | ||
1896 | QString retfile = ""; | ||
1897 | QDialog dia ( this, "input-dialog", true ); | 1895 | QDialog dia ( this, "input-dialog", true ); |
1898 | QLineEdit lab ( &dia ); | 1896 | QLineEdit lab ( &dia ); |
1899 | QVBoxLayout lay( &dia ); | 1897 | QVBoxLayout lay( &dia ); |
1900 | lab.setText( KOPrefs::instance()->mPassiveSyncPort ); | 1898 | lab.setText( KOPrefs::instance()->mPassiveSyncPort ); |
1901 | lay.setMargin(7); | 1899 | lay.setMargin(7); |
1902 | lay.setSpacing(7); | 1900 | lay.setSpacing(7); |
1903 | QLabel label ( i18n("Port number (Default: 9197)"), &dia ); | 1901 | QLabel label ( i18n("Port number (Default: 9197)"), &dia ); |
1904 | lay.addWidget( &label); | 1902 | lay.addWidget( &label); |
1905 | lay.addWidget( &lab); | 1903 | lay.addWidget( &lab); |
1906 | 1904 | ||
1907 | QLineEdit lepw ( &dia ); | 1905 | QLineEdit lepw ( &dia ); |
1908 | lepw.setText( "abc" ); | 1906 | lepw.setText( KOPrefs::instance()->mPassiveSyncPw ); |
1909 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 1907 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
1910 | lay.addWidget( &label2); | 1908 | lay.addWidget( &label2); |
1911 | lay.addWidget( &lepw); | 1909 | lay.addWidget( &lepw); |
1912 | dia.setFixedSize( 230,80 ); | 1910 | dia.setFixedSize( 230,80 ); |
1913 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 1911 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
1914 | QPushButton pb ( "OK", &dia); | 1912 | QPushButton pb ( "OK", &dia); |
1915 | lay.addWidget( &pb ); | 1913 | lay.addWidget( &pb ); |
1916 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1914 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1917 | dia.show(); | 1915 | dia.show(); |
1918 | int res = dia.exec(); | 1916 | if ( ! dia.exec() ) |
1919 | if ( res ) | ||
1920 | retfile = lab.text(); | ||
1921 | else | ||
1922 | return; | 1917 | return; |
1923 | dia.hide(); | 1918 | dia.hide(); |
1924 | passWordPiSync = lepw.text(); | ||
1925 | qApp->processEvents(); | 1919 | qApp->processEvents(); |
1926 | KOPrefs::instance()->mPassiveSyncPort = retfile; | 1920 | KOPrefs::instance()->mPassiveSyncPw = lepw.text(); |
1921 | KOPrefs::instance()->mPassiveSyncPort = lab.text(); | ||
1927 | bool ok; | 1922 | bool ok; |
1928 | Q_UINT16 port = retfile.toUInt(&ok); | 1923 | Q_UINT16 port = KOPrefs::instance()->mPassiveSyncPort.toUInt(&ok); |
1929 | if ( ! ok ) { | 1924 | if ( ! ok ) { |
1930 | KMessageBox::information( this, i18n("No valid port")); | 1925 | KMessageBox::information( this, i18n("No valid port")); |
1931 | return; | 1926 | return; |
1932 | } | 1927 | } |
1933 | //qDebug("port %d ", port); | 1928 | //qDebug("port %d ", port); |
1934 | mServerSocket = new KServerSocket ( passWordPiSync, port ,1 ); | 1929 | mServerSocket = new KServerSocket ( KOPrefs::instance()->mPassiveSyncPw, port ,1 ); |
1935 | mServerSocket->setFileName( defaultFileName() ); | 1930 | mServerSocket->setFileName( defaultFileName() ); |
1936 | //qDebug("connected "); | 1931 | //qDebug("connected "); |
1937 | if ( !mServerSocket->ok() ) { | 1932 | if ( !mServerSocket->ok() ) { |
1938 | qWarning("Failed to bind to port %d", port); | 1933 | KMessageBox::information( this, i18n("Failed to bind or\nlisten to the port!")); |
1939 | delete mServerSocket; | 1934 | delete mServerSocket; |
1940 | mServerSocket = 0; | 1935 | mServerSocket = 0; |
1941 | return; | 1936 | return; |
1942 | } | 1937 | } |
1943 | connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); | 1938 | connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); |
1944 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); | 1939 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); |
1945 | } | 1940 | } |
1946 | 1941 | ||
1947 | void MainWindow::getFile( bool success ) | 1942 | void MainWindow::getFile( bool success ) |
1948 | { | 1943 | { |
1949 | if ( ! success ) { | 1944 | if ( ! success ) { |
1950 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1945 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1951 | return; | 1946 | return; |
1952 | } | 1947 | } |
1953 | mView->watchSavedFile(); | 1948 | mView->watchSavedFile(); |
1954 | mView->openCalendar( defaultFileName() ); | 1949 | mView->openCalendar( defaultFileName() ); |
1955 | setCaption( i18n("Pi-Sync successful!") ); | 1950 | setCaption( i18n("Pi-Sync successful!") ); |
1956 | 1951 | ||
1957 | } | 1952 | } |
1958 | 1953 | ||
1959 | 1954 | ||
1960 | void MainWindow::syncPi() | 1955 | void MainWindow::syncPi() |
1961 | { | 1956 | { |
1962 | qApp->processEvents(); | 1957 | qApp->processEvents(); |
1963 | bool ok; | 1958 | bool ok; |
1964 | Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); | 1959 | Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); |
1965 | if ( ! ok ) { | 1960 | if ( ! ok ) { |
1966 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1961 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1967 | return; | 1962 | return; |
1968 | } | 1963 | } |
1969 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); | 1964 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); |
1970 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1965 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1971 | setCaption( i18n("Sending request for remote file ...") ); | 1966 | setCaption( i18n("Sending request for remote file ...") ); |
1972 | commandSocket->readFile( syncFileName() ); | 1967 | commandSocket->readFile( syncFileName() ); |
1973 | } | 1968 | } |
1974 | 1969 | ||
1975 | void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) | 1970 | void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) |
1976 | { | 1971 | { |
1977 | qDebug("MainWindow::deleteCommandSocket %d", state); | 1972 | qDebug("MainWindow::deleteCommandSocket %d", state); |
1978 | 1973 | ||
1979 | //enum { success, errorW, errorR, quiet }; | 1974 | //enum { success, errorW, errorR, quiet }; |
1980 | if ( state == KCommandSocket::errorR ) { | 1975 | if ( state == KCommandSocket::errorR ) { |
1981 | setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1976 | setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1982 | delete s; | 1977 | delete s; |
1983 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); | 1978 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); |
1984 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1979 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1985 | commandSocket->sendStop(); | 1980 | commandSocket->sendStop(); |
1986 | return; | 1981 | return; |
1987 | 1982 | ||
1988 | } else if ( state == KCommandSocket::errorW ) { | 1983 | } else if ( state == KCommandSocket::errorW ) { |
1989 | setCaption( i18n("ERROR:Writing back file failed.") ); | 1984 | setCaption( i18n("ERROR:Writing back file failed.") ); |
1990 | 1985 | ||
1991 | } else if ( state == KCommandSocket::successR ) { | 1986 | } else if ( state == KCommandSocket::successR ) { |
1992 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 1987 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
1993 | 1988 | ||
1994 | } else if ( state == KCommandSocket::successW ) { | 1989 | } else if ( state == KCommandSocket::successW ) { |
1995 | setCaption( i18n("Pi-Sync succesful!") ); | 1990 | setCaption( i18n("Pi-Sync succesful!") ); |
1996 | } | 1991 | } |
1997 | 1992 | ||
1998 | delete s; | 1993 | delete s; |
1999 | } | 1994 | } |
2000 | 1995 | ||
2001 | void MainWindow::readFileFromSocket() | 1996 | void MainWindow::readFileFromSocket() |
2002 | { | 1997 | { |
2003 | QString fileName = syncFileName(); | 1998 | QString fileName = syncFileName(); |
2004 | setCaption( i18n("Remote file saved to temp file.") ); | 1999 | setCaption( i18n("Remote file saved to temp file.") ); |
2005 | if ( ! syncWithFile( fileName , true ) ) { | 2000 | if ( ! syncWithFile( fileName , true ) ) { |
2006 | setCaption( i18n("Syncing failed.") ); | 2001 | setCaption( i18n("Syncing failed.") ); |
2007 | qDebug("Syncing failed "); | 2002 | qDebug("Syncing failed "); |
2008 | return; | 2003 | return; |
2009 | } | 2004 | } |
2010 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); | 2005 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); |
2011 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 2006 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
2012 | if ( KOPrefs::instance()->mWriteBackFile ) | 2007 | if ( KOPrefs::instance()->mWriteBackFile ) |
2013 | commandSocket->writeFile( fileName ); | 2008 | commandSocket->writeFile( fileName ); |
2014 | else { | 2009 | else { |
2015 | commandSocket->sendStop(); | 2010 | commandSocket->sendStop(); |
2016 | setCaption( i18n("Pi-Sync succesful!") ); | 2011 | setCaption( i18n("Pi-Sync succesful!") ); |
2017 | } | 2012 | } |
2018 | } | 2013 | } |
2019 | 2014 | ||
2020 | void MainWindow::syncLocalFile() | 2015 | void MainWindow::syncLocalFile() |
2021 | { | 2016 | { |
2022 | 2017 | ||
2023 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | 2018 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; |
2024 | 2019 | ||
2025 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 2020 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
2026 | if ( fn == "" ) | 2021 | if ( fn == "" ) |
2027 | return; | 2022 | return; |
2028 | //mView->setSyncDevice("local-file" ); | 2023 | //mView->setSyncDevice("local-file" ); |
2029 | if ( syncWithFile( fn, false ) ) { | 2024 | if ( syncWithFile( fn, false ) ) { |
2030 | // Event* e = mView->getLastSyncEvent(); | 2025 | // Event* e = mView->getLastSyncEvent(); |
2031 | // e->setReadOnly( false ); | 2026 | // e->setReadOnly( false ); |
2032 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 2027 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
2033 | // e->setReadOnly( true ); | 2028 | // e->setReadOnly( true ); |
2034 | } | 2029 | } |
2035 | 2030 | ||
2036 | } | 2031 | } |
2037 | 2032 | ||
2038 | bool MainWindow::syncWithFile( QString fn , bool quick ) | 2033 | bool MainWindow::syncWithFile( QString fn , bool quick ) |
2039 | { | 2034 | { |
2040 | bool ret = false; | 2035 | bool ret = false; |
2041 | QFileInfo info; | 2036 | QFileInfo info; |
2042 | info.setFile( fn ); | 2037 | info.setFile( fn ); |
2043 | QString mess; | 2038 | QString mess; |
2044 | bool loadbup = true; | 2039 | bool loadbup = true; |
2045 | if ( !info. exists() ) { | 2040 | if ( !info. exists() ) { |
2046 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 2041 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
2047 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2042 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2048 | mess ); | 2043 | mess ); |
2049 | return ret; | 2044 | return ret; |
2050 | } | 2045 | } |
2051 | int result = 0; | 2046 | int result = 0; |
2052 | if ( !quick ) { | 2047 | if ( !quick ) { |
2053 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2048 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2054 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2049 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2055 | mess, | 2050 | mess, |
2056 | i18n("Sync"), i18n("Cancel"), 0, | 2051 | i18n("Sync"), i18n("Cancel"), 0, |
2057 | 0, 1 ); | 2052 | 0, 1 ); |
2058 | if ( result ) | 2053 | if ( result ) |
2059 | return false; | 2054 | return false; |
2060 | } | 2055 | } |
2061 | if ( KOPrefs::instance()->mAskForPreferences ) | 2056 | if ( KOPrefs::instance()->mAskForPreferences ) |
2062 | mView->edit_sync_options(); | 2057 | mView->edit_sync_options(); |
2063 | if ( result == 0 ) { | 2058 | if ( result == 0 ) { |
2064 | //qDebug("Now sycing ... "); | 2059 | //qDebug("Now sycing ... "); |
2065 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) | 2060 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) |
2066 | setCaption( i18n("Synchronization successful") ); | 2061 | setCaption( i18n("Synchronization successful") ); |
2067 | else | 2062 | else |
2068 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 2063 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
2069 | if ( ! quick ) | 2064 | if ( ! quick ) |
2070 | KOPrefs::instance()->mLastSyncedLocalFile = fn; | 2065 | KOPrefs::instance()->mLastSyncedLocalFile = fn; |
2071 | slotModifiedChanged( true ); | 2066 | slotModifiedChanged( true ); |
2072 | } | 2067 | } |
2073 | return ret; | 2068 | return ret; |
2074 | } | 2069 | } |
2075 | void MainWindow::quickSyncLocalFile() | 2070 | void MainWindow::quickSyncLocalFile() |
2076 | { | 2071 | { |
2077 | //mView->setSyncDevice("local-file" ); | 2072 | //mView->setSyncDevice("local-file" ); |
2078 | //qDebug("quickSyncLocalFile() "); | 2073 | //qDebug("quickSyncLocalFile() "); |
2079 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { | 2074 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { |
2080 | // Event* e = mView->getLastSyncEvent(); | 2075 | // Event* e = mView->getLastSyncEvent(); |
2081 | // e->setReadOnly( false ); | 2076 | // e->setReadOnly( false ); |
2082 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 2077 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
2083 | // e->setReadOnly( true ); | 2078 | // e->setReadOnly( true ); |
2084 | 2079 | ||
2085 | } | 2080 | } |
2086 | } | 2081 | } |
2087 | 2082 | ||
2088 | void MainWindow::confSync() | 2083 | void MainWindow::confSync() |
2089 | { | 2084 | { |
2090 | mView->confSync(); | 2085 | mView->confSync(); |
2091 | fillSyncMenu(); | 2086 | fillSyncMenu(); |
2092 | } | 2087 | } |
2093 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | 2088 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) |
2094 | { | 2089 | { |
2095 | QString question; | 2090 | QString question; |
2096 | if ( ask ) { | 2091 | if ( ask ) { |
2097 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 2092 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
2098 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 2093 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
2099 | question, | 2094 | question, |
2100 | i18n("Yes"), i18n("No"), | 2095 | i18n("Yes"), i18n("No"), |
2101 | 0, 0 ) != 0 ) | 2096 | 0, 0 ) != 0 ) |
2102 | return; | 2097 | return; |
2103 | } | 2098 | } |
2104 | QString command = prof->getPreSyncCommand(); | 2099 | QString command = prof->getPreSyncCommand(); |
2105 | int fi; | 2100 | int fi; |
2106 | if ( (fi = command.find("$PWD$")) > 0 ) { | 2101 | if ( (fi = command.find("$PWD$")) > 0 ) { |
2107 | QString pwd = getPassword(); | 2102 | QString pwd = getPassword(); |
2108 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | 2103 | command = command.left( fi )+ pwd + command.mid( fi+5 ); |
2109 | 2104 | ||
2110 | } | 2105 | } |
2111 | int maxlen = 30; | 2106 | int maxlen = 30; |
2112 | if ( QApplication::desktop()->width() > 320 ) | 2107 | if ( QApplication::desktop()->width() > 320 ) |
2113 | maxlen += 25; | 2108 | maxlen += 25; |
2114 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 2109 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
2115 | int fileSize = 0; | 2110 | int fileSize = 0; |
2116 | int result = system ( command ); | 2111 | int result = system ( command ); |
2117 | // 0 : okay | 2112 | // 0 : okay |
2118 | // 256: no such file or dir | 2113 | // 256: no such file or dir |
2119 | // | 2114 | // |
2120 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 2115 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
2121 | if ( result != 0 ) { | 2116 | if ( result != 0 ) { |
2122 | int len = maxlen; | 2117 | int len = maxlen; |
2123 | while ( len < command.length() ) { | 2118 | while ( len < command.length() ) { |
2124 | command.insert( len , "\n" ); | 2119 | command.insert( len , "\n" ); |
2125 | len += maxlen +2; | 2120 | len += maxlen +2; |
2126 | } | 2121 | } |
2127 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 2122 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
2128 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 2123 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
2129 | question, | 2124 | question, |
2130 | i18n("Okay!")) ; | 2125 | i18n("Okay!")) ; |
2131 | setCaption ("KO/Pi"); | 2126 | setCaption ("KO/Pi"); |
2132 | return; | 2127 | return; |
2133 | } | 2128 | } |
2134 | setCaption ( i18n( "Copying succeed." ) ); | 2129 | setCaption ( i18n( "Copying succeed." ) ); |
2135 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 2130 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
2136 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { | 2131 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { |
2137 | // Event* e = mView->getLastSyncEvent(); | 2132 | // Event* e = mView->getLastSyncEvent(); |
2138 | // e->setReadOnly( false ); | 2133 | // e->setReadOnly( false ); |
2139 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 2134 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
2140 | // e->setReadOnly( true ); | 2135 | // e->setReadOnly( true ); |
2141 | if ( KOPrefs::instance()->mWriteBackFile ) { | 2136 | if ( KOPrefs::instance()->mWriteBackFile ) { |
2142 | command = prof->getPostSyncCommand(); | 2137 | command = prof->getPostSyncCommand(); |
2143 | int fi; | 2138 | int fi; |
2144 | if ( (fi = command.find("$PWD$")) > 0 ) { | 2139 | if ( (fi = command.find("$PWD$")) > 0 ) { |
2145 | QString pwd = getPassword(); | 2140 | QString pwd = getPassword(); |
2146 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | 2141 | command = command.left( fi )+ pwd + command.mid( fi+5 ); |
2147 | 2142 | ||
2148 | } | 2143 | } |
2149 | setCaption ( i18n( "Writing back file ..." ) ); | 2144 | setCaption ( i18n( "Writing back file ..." ) ); |
2150 | result = system ( command ); | 2145 | result = system ( command ); |
2151 | qDebug("KO: Writing back file result: %d ", result); | 2146 | qDebug("KO: Writing back file result: %d ", result); |
2152 | if ( result != 0 ) { | 2147 | if ( result != 0 ) { |
2153 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 2148 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
2154 | return; | 2149 | return; |
2155 | } else { | 2150 | } else { |
2156 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 2151 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
2157 | } | 2152 | } |
2158 | } | 2153 | } |
2159 | } | 2154 | } |
2160 | return; | 2155 | return; |
2161 | } | 2156 | } |
2162 | 2157 | ||
2163 | void MainWindow::syncSharp() | 2158 | void MainWindow::syncSharp() |
2164 | { | 2159 | { |
2165 | if ( mCalendarModifiedFlag ) | 2160 | if ( mCalendarModifiedFlag ) |
2166 | save(); | 2161 | save(); |
2167 | mView->syncSharp(); | 2162 | mView->syncSharp(); |
2168 | slotModifiedChanged( true ); | 2163 | slotModifiedChanged( true ); |
2169 | 2164 | ||
2170 | } | 2165 | } |
2171 | void MainWindow::syncPhone() | 2166 | void MainWindow::syncPhone() |
2172 | { | 2167 | { |
2173 | if ( mCalendarModifiedFlag ) | 2168 | if ( mCalendarModifiedFlag ) |
2174 | save(); | 2169 | save(); |
2175 | mView->syncPhone(); | 2170 | mView->syncPhone(); |
2176 | slotModifiedChanged( true ); | 2171 | slotModifiedChanged( true ); |
2177 | 2172 | ||
2178 | } | 2173 | } |
2179 | 2174 | ||
2180 | void MainWindow::printSel( ) | 2175 | void MainWindow::printSel( ) |
2181 | { | 2176 | { |
2182 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2177 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2183 | } | 2178 | } |
2184 | 2179 | ||
2185 | void MainWindow::printCal() | 2180 | void MainWindow::printCal() |
2186 | { | 2181 | { |
2187 | mView->print();//mCp->showDialog(); | 2182 | mView->print();//mCp->showDialog(); |
2188 | } | 2183 | } |
2189 | 2184 | ||
2190 | 2185 | ||
2191 | 2186 | ||
2192 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 2187 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
2193 | { | 2188 | { |
2194 | mPassWord = pw; | 2189 | mPassWord = pw; |
2195 | mSocket = 0; | 2190 | mSocket = 0; |
2196 | mSyncActionDialog = 0; | 2191 | mSyncActionDialog = 0; |
2192 | blockRC = false; | ||
2197 | }; | 2193 | }; |
2198 | 2194 | ||
2199 | void KServerSocket::newConnection ( int socket ) | 2195 | void KServerSocket::newConnection ( int socket ) |
2200 | { | 2196 | { |
2201 | // qDebug("KServerSocket:New connection %d ", socket); | 2197 | // qDebug("KServerSocket:New connection %d ", socket); |
2202 | if ( mSocket ) { | 2198 | if ( mSocket ) { |
2203 | qDebug("KServerSocket::newConnection Socket deleted! "); | 2199 | qDebug("KServerSocket::newConnection Socket deleted! "); |
2204 | delete mSocket; | 2200 | delete mSocket; |
2205 | mSocket = 0; | 2201 | mSocket = 0; |
2206 | } | 2202 | } |
2207 | mSocket = new QSocket( this ); | 2203 | mSocket = new QSocket( this ); |
2208 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 2204 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
2209 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 2205 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
2210 | mSocket->setSocket( socket ); | 2206 | mSocket->setSocket( socket ); |
2211 | } | 2207 | } |
2212 | 2208 | ||
2213 | void KServerSocket::discardClient() | 2209 | void KServerSocket::discardClient() |
2214 | { | 2210 | { |
2215 | //qDebug(" KServerSocket::discardClient()"); | 2211 | //qDebug(" KServerSocket::discardClient()"); |
2216 | if ( mSocket ) { | 2212 | if ( mSocket ) { |
2217 | delete mSocket; | 2213 | delete mSocket; |
2218 | mSocket = 0; | 2214 | mSocket = 0; |
2219 | } | 2215 | } |
2220 | //emit endConnect(); | 2216 | //emit endConnect(); |
2221 | } | 2217 | } |
2222 | void KServerSocket::readClient() | 2218 | void KServerSocket::readClient() |
2223 | { | 2219 | { |
2220 | if ( blockRC ) | ||
2221 | return; | ||
2224 | if ( mSocket == 0 ) { | 2222 | if ( mSocket == 0 ) { |
2225 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); | 2223 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); |
2226 | return; | 2224 | return; |
2227 | } | 2225 | } |
2228 | //qDebug("KServerSocket readClient()"); | 2226 | qDebug("KServerSocket readClient()"); |
2229 | if ( mSocket->canReadLine() ) { | 2227 | if ( mSocket->canReadLine() ) { |
2230 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() ); | 2228 | QString line = mSocket->readLine(); |
2229 | qDebug("KServerSocket readline: %s ", line.latin1()); | ||
2230 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | ||
2231 | if ( tokens[0] == "GET" ) { | 2231 | if ( tokens[0] == "GET" ) { |
2232 | if ( tokens[1] == mPassWord ) | 2232 | if ( tokens[1] == mPassWord ) |
2233 | //emit sendFile( mSocket ); | 2233 | //emit sendFile( mSocket ); |
2234 | send_file(); | 2234 | send_file(); |
2235 | else { | 2235 | else { |
2236 | KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); | 2236 | KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); |
2237 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 2237 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
2238 | } | 2238 | } |
2239 | } | 2239 | } |
2240 | if ( tokens[0] == "PUT" ) { | 2240 | if ( tokens[0] == "PUT" ) { |
2241 | if ( tokens[1] == mPassWord ) | 2241 | if ( tokens[1] == mPassWord ) { |
2242 | //emit getFile( mSocket ); | 2242 | //emit getFile( mSocket ); |
2243 | blockRC = true; | ||
2243 | get_file(); | 2244 | get_file(); |
2245 | } | ||
2244 | else { | 2246 | else { |
2245 | KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); | 2247 | KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); |
2246 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 2248 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
2247 | } | 2249 | } |
2248 | } | 2250 | } |
2249 | if ( tokens[0] == "STOP" ) { | 2251 | if ( tokens[0] == "STOP" ) { |
2250 | //emit endConnect(); | 2252 | //emit endConnect(); |
2251 | end_connect(); | 2253 | end_connect(); |
2252 | } | 2254 | } |
2253 | } | 2255 | } |
2254 | } | 2256 | } |
2255 | void KServerSocket::end_connect() | 2257 | void KServerSocket::end_connect() |
2256 | { | 2258 | { |
2257 | delete mSyncActionDialog; | 2259 | delete mSyncActionDialog; |
2258 | mSyncActionDialog = 0; | 2260 | mSyncActionDialog = 0; |
2259 | } | 2261 | } |
2260 | void KServerSocket::send_file() | 2262 | void KServerSocket::send_file() |
2261 | { | 2263 | { |
2262 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 2264 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
2263 | if ( mSyncActionDialog ) | 2265 | if ( mSyncActionDialog ) |
2264 | delete mSyncActionDialog; | 2266 | delete mSyncActionDialog; |
2265 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 2267 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
2266 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 2268 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
2267 | QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use this application!\n\nIf syncing fails you can close this dialog."), mSyncActionDialog ); | 2269 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
2268 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 2270 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
2269 | lay->addWidget( label); | 2271 | lay->addWidget( label); |
2270 | lay->setMargin(7); | 2272 | lay->setMargin(7); |
2271 | lay->setSpacing(7); | 2273 | lay->setSpacing(7); |
2272 | mSyncActionDialog->setFixedSize( 230, 120); | 2274 | mSyncActionDialog->setFixedSize( 230, 120); |
2273 | mSyncActionDialog->show(); | 2275 | mSyncActionDialog->show(); |
2274 | qDebug("KSS::saving ... "); | 2276 | qDebug("KSS::saving ... "); |
2275 | emit saveFile(); | 2277 | emit saveFile(); |
2276 | qApp->processEvents(); | 2278 | qApp->processEvents(); |
2277 | QString fileName = mFileName; | 2279 | QString fileName = mFileName; |
2278 | QFile file( fileName ); | 2280 | QFile file( fileName ); |
2279 | if (!file.open( IO_ReadOnly ) ) { | 2281 | if (!file.open( IO_ReadOnly ) ) { |
2280 | delete mSyncActionDialog; | 2282 | delete mSyncActionDialog; |
2281 | mSyncActionDialog = 0; | 2283 | mSyncActionDialog = 0; |
2282 | qDebug("KSS::error open file "); | 2284 | qDebug("KSS::error open file "); |
2283 | mSocket->close(); | 2285 | mSocket->close(); |
2284 | if ( mSocket->state() == QSocket::Idle ) | 2286 | if ( mSocket->state() == QSocket::Idle ) |
2285 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 2287 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
2286 | return ; | 2288 | return ; |
2287 | 2289 | ||
2288 | } | 2290 | } |
2289 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 2291 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
2290 | QTextStream ts( &file ); | 2292 | QTextStream ts( &file ); |
2291 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 2293 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
2292 | QTextStream os( mSocket ); | 2294 | QTextStream os( mSocket ); |
2293 | os.setCodec( QTextCodec::codecForName("utf8") ); | 2295 | os.setCodec( QTextCodec::codecForName("utf8") ); |
2294 | //os.setEncoding( QTextStream::UnicodeUTF8 ); | 2296 | //os.setEncoding( QTextStream::UnicodeUTF8 ); |
2295 | while ( ! ts.atEnd() ) { | 2297 | while ( ! ts.atEnd() ) { |
2296 | os << ts.readLine() << "\n"; | 2298 | os << ts.readLine() << "\n"; |
2297 | } | 2299 | } |
2298 | //os << ts.read(); | 2300 | //os << ts.read(); |
2299 | file.close(); | 2301 | file.close(); |
2300 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 2302 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
2301 | mSocket->close(); | 2303 | mSocket->close(); |
2302 | if ( mSocket->state() == QSocket::Idle ) | 2304 | if ( mSocket->state() == QSocket::Idle ) |
2303 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 2305 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
2304 | } | 2306 | } |
2305 | void KServerSocket::get_file() | 2307 | void KServerSocket::get_file() |
2306 | { | 2308 | { |
2307 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); | 2309 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); |
2308 | 2310 | ||
2309 | piTime.start(); | 2311 | piTime.start(); |
2310 | piFileString = ""; | 2312 | piFileString = ""; |
2311 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); | 2313 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); |
2312 | } | 2314 | } |
2313 | 2315 | ||
2314 | 2316 | ||
2315 | void KServerSocket::readBackFileFromSocket() | 2317 | void KServerSocket::readBackFileFromSocket() |
2316 | { | 2318 | { |
2317 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 2319 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
2318 | while ( mSocket->canReadLine () ) { | 2320 | while ( mSocket->canReadLine () ) { |
2319 | piTime.restart(); | 2321 | piTime.restart(); |
2320 | QString line = mSocket->readLine (); | 2322 | QString line = mSocket->readLine (); |
2321 | piFileString += line; | 2323 | piFileString += line; |
2322 | //qDebug("readline: %s ", line.latin1()); | 2324 | //qDebug("readline: %s ", line.latin1()); |
2323 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 2325 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
2324 | 2326 | ||
2325 | } | 2327 | } |
2326 | if ( piTime.elapsed () < 3000 ) { | 2328 | if ( piTime.elapsed () < 3000 ) { |
2327 | // wait for more | 2329 | // wait for more |
2328 | //qDebug("waitformore "); | 2330 | //qDebug("waitformore "); |
2329 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 2331 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
2330 | return; | 2332 | return; |
2331 | } | 2333 | } |
2332 | QString fileName = mFileName; | 2334 | QString fileName = mFileName; |
2333 | QFile file ( fileName ); | 2335 | QFile file ( fileName ); |
2334 | if (!file.open( IO_WriteOnly ) ) { | 2336 | if (!file.open( IO_WriteOnly ) ) { |
2335 | delete mSyncActionDialog; | 2337 | delete mSyncActionDialog; |
2336 | mSyncActionDialog = 0; | 2338 | mSyncActionDialog = 0; |
2337 | qDebug("error open cal file "); | 2339 | qDebug("error open cal file "); |
2338 | piFileString = ""; | 2340 | piFileString = ""; |
2339 | emit file_received( false ); | 2341 | emit file_received( false ); |
2342 | blockRC = false; | ||
2340 | return ; | 2343 | return ; |
2341 | 2344 | ||
2342 | } | 2345 | } |
2343 | 2346 | ||
2344 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 2347 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
2345 | QTextStream ts ( &file ); | 2348 | QTextStream ts ( &file ); |
2346 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 2349 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
2347 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 2350 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
2348 | ts << piFileString; | 2351 | ts << piFileString; |
2349 | mSocket->close(); | 2352 | mSocket->close(); |
2350 | if ( mSocket->state() == QSocket::Idle ) | 2353 | if ( mSocket->state() == QSocket::Idle ) |
2351 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 2354 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
2352 | file.close(); | 2355 | file.close(); |
2353 | delete mSyncActionDialog; | 2356 | delete mSyncActionDialog; |
2354 | mSyncActionDialog = 0; | 2357 | mSyncActionDialog = 0; |
2355 | piFileString = ""; | 2358 | piFileString = ""; |
2359 | blockRC = false; | ||
2356 | emit file_received( true ); | 2360 | emit file_received( true ); |
2357 | 2361 | ||
2358 | } | 2362 | } |
2359 | 2363 | ||
2360 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) | 2364 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) |
2361 | { | 2365 | { |
2362 | mPassWord = password; | 2366 | mPassWord = password; |
2363 | mSocket = 0; | 2367 | mSocket = 0; |
2364 | mPort = port; | 2368 | mPort = port; |
2365 | mHost = host; | 2369 | mHost = host; |
2366 | 2370 | ||
2367 | mRetVal = quiet; | 2371 | mRetVal = quiet; |
2368 | mTimerSocket = new QTimer ( this ); | 2372 | mTimerSocket = new QTimer ( this ); |
2369 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); | 2373 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); |
2370 | } | 2374 | } |
2371 | void KCommandSocket::readFile( QString fn ) | 2375 | void KCommandSocket::readFile( QString fn ) |
2372 | { | 2376 | { |
2373 | if ( !mSocket ) { | 2377 | if ( !mSocket ) { |
2374 | mSocket = new QSocket( this ); | 2378 | mSocket = new QSocket( this ); |
2375 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 2379 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
2376 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 2380 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
2377 | } | 2381 | } |
2378 | mFileString = ""; | 2382 | mFileString = ""; |
2379 | mFileName = fn; | 2383 | mFileName = fn; |
2380 | mFirst = true; | 2384 | mFirst = true; |
2381 | mSocket->connectToHost( mHost, mPort ); | 2385 | mSocket->connectToHost( mHost, mPort ); |
2382 | QTextStream os( mSocket ); | 2386 | QTextStream os( mSocket ); |
2383 | os.setEncoding( QTextStream::UnicodeUTF8 ); | 2387 | os.setEncoding( QTextStream::UnicodeUTF8 ); |
2384 | os << "GET " << mPassWord << "\r\n"; | 2388 | os << "GET " << mPassWord << "\r\n"; |
2385 | mTimerSocket->start( 10000 ); | 2389 | mTimerSocket->start( 10000 ); |
2386 | } | 2390 | } |
2387 | 2391 | ||
2388 | void KCommandSocket::writeFile( QString fileName ) | 2392 | void KCommandSocket::writeFile( QString fileName ) |
2389 | { | 2393 | { |
2390 | if ( !mSocket ) { | 2394 | if ( !mSocket ) { |
2391 | mSocket = new QSocket( this ); | 2395 | mSocket = new QSocket( this ); |
2392 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 2396 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
2393 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); | 2397 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); |
2394 | } | 2398 | } |
2395 | mFileName = fileName ; | 2399 | mFileName = fileName ; |
2396 | mSocket->connectToHost( mHost, mPort ); | 2400 | mSocket->connectToHost( mHost, mPort ); |
2397 | } | 2401 | } |
2398 | void KCommandSocket::writeFileToSocket() | 2402 | void KCommandSocket::writeFileToSocket() |
2399 | { | 2403 | { |
2400 | QFile file2( mFileName ); | 2404 | QFile file2( mFileName ); |
2401 | if (!file2.open( IO_ReadOnly ) ) { | 2405 | if (!file2.open( IO_ReadOnly ) ) { |
2402 | mRetVal= errorW; | 2406 | mRetVal= errorW; |
2403 | mSocket->close(); | 2407 | mSocket->close(); |
2404 | if ( mSocket->state() == QSocket::Idle ) | 2408 | if ( mSocket->state() == QSocket::Idle ) |
2405 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 2409 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
2406 | return ; | 2410 | return ; |
2407 | } | 2411 | } |
2408 | QTextStream ts2( &file2 ); | 2412 | QTextStream ts2( &file2 ); |
2409 | ts2.setCodec( QTextCodec::codecForName("utf8") ); | 2413 | ts2.setCodec( QTextCodec::codecForName("utf8") ); |
2410 | QTextStream os2( mSocket ); | 2414 | QTextStream os2( mSocket ); |
2411 | os2.setCodec( QTextCodec::codecForName("utf8") ); | 2415 | os2.setCodec( QTextCodec::codecForName("utf8") ); |
2412 | os2 << "PUT " << mPassWord << "\r\n";; | 2416 | os2 << "PUT " << mPassWord << "\r\n";; |
2413 | while ( ! ts2.atEnd() ) { | 2417 | while ( ! ts2.atEnd() ) { |
2414 | os2 << ts2.readLine() << "\n"; | 2418 | os2 << ts2.readLine() << "\n"; |
2415 | } | 2419 | } |
2416 | mRetVal= successW; | 2420 | mRetVal= successW; |
2417 | file2.close(); | 2421 | file2.close(); |
2418 | mSocket->close(); | 2422 | mSocket->close(); |
2419 | if ( mSocket->state() == QSocket::Idle ) | 2423 | if ( mSocket->state() == QSocket::Idle ) |
2420 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 2424 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
2421 | } | 2425 | } |
2422 | void KCommandSocket::sendStop() | 2426 | void KCommandSocket::sendStop() |
2423 | { | 2427 | { |
2424 | if ( !mSocket ) { | 2428 | if ( !mSocket ) { |
2425 | mSocket = new QSocket( this ); | 2429 | mSocket = new QSocket( this ); |
2426 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 2430 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
2427 | } | 2431 | } |
2428 | mSocket->connectToHost( mHost, mPort ); | 2432 | mSocket->connectToHost( mHost, mPort ); |
2429 | QTextStream os2( mSocket ); | 2433 | QTextStream os2( mSocket ); |
2430 | os2.setCodec( QTextCodec::codecForName("utf8") ); | 2434 | os2.setCodec( QTextCodec::codecForName("utf8") ); |
2431 | os2 << "STOP\r\n"; | 2435 | os2 << "STOP\r\n"; |
2432 | mSocket->close(); | 2436 | mSocket->close(); |
2433 | if ( mSocket->state() == QSocket::Idle ) | 2437 | if ( mSocket->state() == QSocket::Idle ) |
2434 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 2438 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
2435 | } | 2439 | } |
2436 | 2440 | ||
2437 | void KCommandSocket::startReadFileFromSocket() | 2441 | void KCommandSocket::startReadFileFromSocket() |
2438 | { | 2442 | { |
2439 | if ( ! mFirst ) | 2443 | if ( ! mFirst ) |
2440 | return; | 2444 | return; |
2441 | mFirst = false; | 2445 | mFirst = false; |
2442 | mTimerSocket->stop(); | 2446 | mTimerSocket->stop(); |
2443 | mFileString = ""; | 2447 | mFileString = ""; |
2444 | mTime.start(); | 2448 | mTime.start(); |
2445 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); | 2449 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); |
2446 | 2450 | ||
2447 | } | 2451 | } |
2448 | void KCommandSocket::readFileFromSocket() | 2452 | void KCommandSocket::readFileFromSocket() |
2449 | { | 2453 | { |
2450 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); | 2454 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); |
2451 | while ( mSocket->canReadLine () ) { | 2455 | while ( mSocket->canReadLine () ) { |
2452 | mTime.restart(); | 2456 | mTime.restart(); |
2453 | QString line = mSocket->readLine (); | 2457 | QString line = mSocket->readLine (); |
2454 | mFileString += line; | 2458 | mFileString += line; |
2455 | //qDebug("readline: %s ", line.latin1()); | 2459 | //qDebug("readline: %s ", line.latin1()); |
2456 | } | 2460 | } |
2457 | if ( mTime.elapsed () < 3000 ) { | 2461 | if ( mTime.elapsed () < 3000 ) { |
2458 | // wait for more | 2462 | // wait for more |
2459 | //qDebug("waitformore "); | 2463 | //qDebug("waitformore "); |
2460 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); | 2464 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); |
2461 | return; | 2465 | return; |
2462 | } | 2466 | } |
2463 | QString fileName = mFileName; | 2467 | QString fileName = mFileName; |
2464 | QFile file ( fileName ); | 2468 | QFile file ( fileName ); |
2465 | if (!file.open( IO_WriteOnly ) ) { | 2469 | if (!file.open( IO_WriteOnly ) ) { |
2466 | mFileString = ""; | 2470 | mFileString = ""; |
2467 | mRetVal = errorR; | 2471 | mRetVal = errorR; |
2468 | qDebug("Error open temp calender file for writing: %s",fileName.latin1() ); | 2472 | qDebug("Error open temp calender file for writing: %s",fileName.latin1() ); |
2469 | deleteSocket(); | 2473 | deleteSocket(); |
2470 | return ; | 2474 | return ; |
2471 | 2475 | ||
2472 | } | 2476 | } |
2473 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 2477 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
2474 | QTextStream ts ( &file ); | 2478 | QTextStream ts ( &file ); |
2475 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 2479 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
2476 | ts << mFileString; | 2480 | ts << mFileString; |
2477 | file.close(); | 2481 | file.close(); |
2478 | mFileString = ""; | 2482 | mFileString = ""; |
2479 | mRetVal = successR; | 2483 | mRetVal = successR; |
2480 | mSocket->close(); | 2484 | mSocket->close(); |
2481 | // if state is not idle, deleteSocket(); is called via | 2485 | // if state is not idle, deleteSocket(); is called via |
2482 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 2486 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
2483 | if ( mSocket->state() == QSocket::Idle ) | 2487 | if ( mSocket->state() == QSocket::Idle ) |
2484 | deleteSocket(); | 2488 | deleteSocket(); |
2485 | } | 2489 | } |
2486 | 2490 | ||
2487 | void KCommandSocket::deleteSocket() | 2491 | void KCommandSocket::deleteSocket() |
2488 | { | 2492 | { |
2489 | if ( mTimerSocket->isActive () ) { | 2493 | if ( mTimerSocket->isActive () ) { |
2490 | mTimerSocket->stop(); | 2494 | mTimerSocket->stop(); |
2491 | KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); | 2495 | KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); |
2492 | mRetVal = errorR; | 2496 | mRetVal = errorR; |
2493 | } | 2497 | } |
2494 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 2498 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
2495 | if ( mSocket) | 2499 | if ( mSocket) |
2496 | delete mSocket; | 2500 | delete mSocket; |
2497 | mSocket = 0; | 2501 | mSocket = 0; |
2498 | emit commandFinished( this, mRetVal ); | 2502 | emit commandFinished( this, mRetVal ); |
2499 | } | 2503 | } |
2500 | 2504 | ||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index ba627b9..7b24b88 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,208 +1,209 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qsocket.h> | 8 | #include <qsocket.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
14 | 14 | ||
15 | class QAction; | 15 | class QAction; |
16 | class CalendarView; | 16 | class CalendarView; |
17 | class KSyncProfile; | 17 | class KSyncProfile; |
18 | #ifdef DESKTOP_VERSION | 18 | #ifdef DESKTOP_VERSION |
19 | 19 | ||
20 | #define QPEToolBar QToolBar | 20 | #define QPEToolBar QToolBar |
21 | #define QPEMenuBar QMenuBar | 21 | #define QPEMenuBar QMenuBar |
22 | #endif | 22 | #endif |
23 | class QPEToolBar; | 23 | class QPEToolBar; |
24 | #include <qserversocket.h> | 24 | #include <qserversocket.h> |
25 | #include <qsocket.h> | 25 | #include <qsocket.h> |
26 | #include <qnetworkprotocol.h> | 26 | #include <qnetworkprotocol.h> |
27 | 27 | ||
28 | class KServerSocket : public QServerSocket | 28 | class KServerSocket : public QServerSocket |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | 33 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
34 | 34 | ||
35 | void newConnection ( int socket ) ; | 35 | void newConnection ( int socket ) ; |
36 | void setFileName( QString fn ) {mFileName = fn;}; | 36 | void setFileName( QString fn ) {mFileName = fn;}; |
37 | 37 | ||
38 | signals: | 38 | signals: |
39 | //void sendFile(QSocket*); | 39 | //void sendFile(QSocket*); |
40 | //void getFile(QSocket*); | 40 | //void getFile(QSocket*); |
41 | void file_received( bool ); | 41 | void file_received( bool ); |
42 | //void file_sent(); | 42 | //void file_sent(); |
43 | void saveFile(); | 43 | void saveFile(); |
44 | void endConnect(); | 44 | void endConnect(); |
45 | private slots: | 45 | private slots: |
46 | void discardClient(); | 46 | void discardClient(); |
47 | void readClient(); | 47 | void readClient(); |
48 | void readBackFileFromSocket(); | 48 | void readBackFileFromSocket(); |
49 | private : | 49 | private : |
50 | bool blockRC; | ||
50 | void send_file(); | 51 | void send_file(); |
51 | void get_file(); | 52 | void get_file(); |
52 | void end_connect(); | 53 | void end_connect(); |
53 | QDialog* mSyncActionDialog; | 54 | QDialog* mSyncActionDialog; |
54 | QSocket* mSocket; | 55 | QSocket* mSocket; |
55 | QString mPassWord; | 56 | QString mPassWord; |
56 | QString mFileName; | 57 | QString mFileName; |
57 | QTime piTime; | 58 | QTime piTime; |
58 | QString piFileString; | 59 | QString piFileString; |
59 | }; | 60 | }; |
60 | 61 | ||
61 | class KCommandSocket : public QObject | 62 | class KCommandSocket : public QObject |
62 | { | 63 | { |
63 | Q_OBJECT | 64 | Q_OBJECT |
64 | public: | 65 | public: |
65 | enum state { successR, errorR, successW, errorW, quiet }; | 66 | enum state { successR, errorR, successW, errorW, quiet }; |
66 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); | 67 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); |
67 | void readFile( QString ); | 68 | void readFile( QString ); |
68 | void writeFile( QString ); | 69 | void writeFile( QString ); |
69 | void sendStop(); | 70 | void sendStop(); |
70 | 71 | ||
71 | 72 | ||
72 | signals: | 73 | signals: |
73 | void commandFinished( KCommandSocket*, int ); | 74 | void commandFinished( KCommandSocket*, int ); |
74 | private slots: | 75 | private slots: |
75 | void startReadFileFromSocket(); | 76 | void startReadFileFromSocket(); |
76 | void readFileFromSocket(); | 77 | void readFileFromSocket(); |
77 | void deleteSocket(); | 78 | void deleteSocket(); |
78 | void writeFileToSocket(); | 79 | void writeFileToSocket(); |
79 | private : | 80 | private : |
80 | QSocket* mSocket; | 81 | QSocket* mSocket; |
81 | QString mPassWord; | 82 | QString mPassWord; |
82 | Q_UINT16 mPort; | 83 | Q_UINT16 mPort; |
83 | QString mHost; | 84 | QString mHost; |
84 | QString mFileName; | 85 | QString mFileName; |
85 | QTimer* mTimerSocket; | 86 | QTimer* mTimerSocket; |
86 | int mRetVal; | 87 | int mRetVal; |
87 | QTime mTime; | 88 | QTime mTime; |
88 | QString mFileString; | 89 | QString mFileString; |
89 | bool mFirst; | 90 | bool mFirst; |
90 | }; | 91 | }; |
91 | 92 | ||
92 | namespace KCal { | 93 | namespace KCal { |
93 | class CalendarLocal; | 94 | class CalendarLocal; |
94 | } | 95 | } |
95 | 96 | ||
96 | using namespace KCal; | 97 | using namespace KCal; |
97 | 98 | ||
98 | class MainWindow : public QMainWindow | 99 | class MainWindow : public QMainWindow |
99 | { | 100 | { |
100 | Q_OBJECT | 101 | Q_OBJECT |
101 | public: | 102 | public: |
102 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 103 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
103 | ~MainWindow(); | 104 | ~MainWindow(); |
104 | public slots: | 105 | public slots: |
105 | virtual void showMaximized (); | 106 | virtual void showMaximized (); |
106 | void configureAgenda( int ); | 107 | void configureAgenda( int ); |
107 | void recieve( const QCString& msg, const QByteArray& data ); | 108 | void recieve( const QCString& msg, const QByteArray& data ); |
108 | static QString defaultFileName(); | 109 | static QString defaultFileName(); |
109 | static QString syncFileName(); | 110 | static QString syncFileName(); |
110 | static QString resourcePath(); | 111 | static QString resourcePath(); |
111 | protected slots: | 112 | protected slots: |
112 | void setCaptionToDates(); | 113 | void setCaptionToDates(); |
113 | int ringSync(); | 114 | int ringSync(); |
114 | void multiSync( bool askforPrefs = false ); | 115 | void multiSync( bool askforPrefs = false ); |
115 | void about(); | 116 | void about(); |
116 | void licence(); | 117 | void licence(); |
117 | void faq(); | 118 | void faq(); |
118 | void usertrans(); | 119 | void usertrans(); |
119 | void features(); | 120 | void features(); |
120 | void synchowto(); | 121 | void synchowto(); |
121 | void whatsNew(); | 122 | void whatsNew(); |
122 | void keyBindings(); | 123 | void keyBindings(); |
123 | void aboutAutoSaving();; | 124 | void aboutAutoSaving();; |
124 | void aboutKnownBugs(); | 125 | void aboutKnownBugs(); |
125 | 126 | ||
126 | void processIncidenceSelection( Incidence * ); | 127 | void processIncidenceSelection( Incidence * ); |
127 | 128 | ||
128 | void importQtopia(); | 129 | void importQtopia(); |
129 | void importBday(); | 130 | void importBday(); |
130 | void importOL(); | 131 | void importOL(); |
131 | void importIcal(); | 132 | void importIcal(); |
132 | void importFile( QString, bool ); | 133 | void importFile( QString, bool ); |
133 | void quickImportIcal(); | 134 | void quickImportIcal(); |
134 | 135 | ||
135 | void slotModifiedChanged( bool ); | 136 | void slotModifiedChanged( bool ); |
136 | 137 | ||
137 | void save(); | 138 | void save(); |
138 | void configureToolBar( int ); | 139 | void configureToolBar( int ); |
139 | void printSel(); | 140 | void printSel(); |
140 | void printCal(); | 141 | void printCal(); |
141 | void saveCalendar(); | 142 | void saveCalendar(); |
142 | void loadCalendar(); | 143 | void loadCalendar(); |
143 | void exportVCalendar(); | 144 | void exportVCalendar(); |
144 | void fillFilterMenu(); | 145 | void fillFilterMenu(); |
145 | void selectFilter( int ); | 146 | void selectFilter( int ); |
146 | 147 | ||
147 | void slotSyncMenu( int ); | 148 | void slotSyncMenu( int ); |
148 | void confSync(); | 149 | void confSync(); |
149 | void syncSharp(); | 150 | void syncSharp(); |
150 | void syncPhone(); | 151 | void syncPhone(); |
151 | void syncPi(); | 152 | void syncPi(); |
152 | void syncLocalFile(); | 153 | void syncLocalFile(); |
153 | bool syncWithFile( QString, bool ); | 154 | bool syncWithFile( QString, bool ); |
154 | void quickSyncLocalFile(); | 155 | void quickSyncLocalFile(); |
155 | 156 | ||
156 | 157 | ||
157 | protected: | 158 | protected: |
158 | void displayText( QString, QString); | 159 | void displayText( QString, QString); |
159 | void displayFile( QString, QString); | 160 | void displayFile( QString, QString); |
160 | 161 | ||
161 | void enableIncidenceActions( bool ); | 162 | void enableIncidenceActions( bool ); |
162 | 163 | ||
163 | private slots: | 164 | private slots: |
164 | QSocket* piSocket; | 165 | QSocket* piSocket; |
165 | QString piFileString; | 166 | QString piFileString; |
166 | QTime piTime; | 167 | QTime piTime; |
167 | void deleteCommandSocket(KCommandSocket* s, int state ); | 168 | void deleteCommandSocket(KCommandSocket* s, int state ); |
168 | void fillSyncMenu(); | 169 | void fillSyncMenu(); |
169 | void getFile( bool ); | 170 | void getFile( bool ); |
170 | void readFileFromSocket(); | 171 | void readFileFromSocket(); |
171 | private: | 172 | private: |
172 | //QTimer* mTimerCommandSocket; | 173 | //QTimer* mTimerCommandSocket; |
173 | QString mPassWordPiSync; | 174 | QString mPassWordPiSync; |
174 | KServerSocket * mServerSocket; | 175 | KServerSocket * mServerSocket; |
175 | bool mClosed; | 176 | bool mClosed; |
176 | void saveOnClose(); | 177 | void saveOnClose(); |
177 | int mCurrentSyncProfile; | 178 | int mCurrentSyncProfile; |
178 | void enableQuick(); | 179 | void enableQuick(); |
179 | void syncRemote( KSyncProfile* , bool ask = true); | 180 | void syncRemote( KSyncProfile* , bool ask = true); |
180 | bool mFlagKeyPressed; | 181 | bool mFlagKeyPressed; |
181 | bool mBlockAtStartup; | 182 | bool mBlockAtStartup; |
182 | QPEToolBar *iconToolBar; | 183 | QPEToolBar *iconToolBar; |
183 | void initActions(); | 184 | void initActions(); |
184 | void setDefaultPreferences(); | 185 | void setDefaultPreferences(); |
185 | void keyPressEvent ( QKeyEvent * ) ; | 186 | void keyPressEvent ( QKeyEvent * ) ; |
186 | void keyReleaseEvent ( QKeyEvent * ) ; | 187 | void keyReleaseEvent ( QKeyEvent * ) ; |
187 | QPopupMenu *configureToolBarMenu; | 188 | QPopupMenu *configureToolBarMenu; |
188 | QPopupMenu *selectFilterMenu; | 189 | QPopupMenu *selectFilterMenu; |
189 | QPopupMenu *configureAgendaMenu, *syncMenu; | 190 | QPopupMenu *configureAgendaMenu, *syncMenu; |
190 | CalendarLocal *mCalendar; | 191 | CalendarLocal *mCalendar; |
191 | CalendarView *mView; | 192 | CalendarView *mView; |
192 | QString getPassword(); | 193 | QString getPassword(); |
193 | QAction *mNewSubTodoAction; | 194 | QAction *mNewSubTodoAction; |
194 | 195 | ||
195 | QAction *mShowAction; | 196 | QAction *mShowAction; |
196 | QAction *mEditAction; | 197 | QAction *mEditAction; |
197 | QAction *mDeleteAction; | 198 | QAction *mDeleteAction; |
198 | void closeEvent( QCloseEvent* ce ); | 199 | void closeEvent( QCloseEvent* ce ); |
199 | SimpleAlarmClient mAlarmClient; | 200 | SimpleAlarmClient mAlarmClient; |
200 | QTimer mSaveTimer; | 201 | QTimer mSaveTimer; |
201 | bool mBlockSaveFlag; | 202 | bool mBlockSaveFlag; |
202 | bool mCalendarModifiedFlag; | 203 | bool mCalendarModifiedFlag; |
203 | QPixmap loadPixmap( QString ); | 204 | QPixmap loadPixmap( QString ); |
204 | QDialog * mSyncActionDialog; | 205 | QDialog * mSyncActionDialog; |
205 | }; | 206 | }; |
206 | 207 | ||
207 | 208 | ||
208 | #endif | 209 | #endif |