author | zautrix <zautrix> | 2004-08-01 11:37:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-01 11:37:35 (UTC) |
commit | e954cc1e29b129982e4d07c4f490d7e881597374 (patch) (unidiff) | |
tree | 29e7bdcf20952b813637083596102f7e7b080567 | |
parent | 8a394f316feb828954d69480553f85c9c0f4b353 (diff) | |
download | kdepimpi-e954cc1e29b129982e4d07c4f490d7e881597374.zip kdepimpi-e954cc1e29b129982e4d07c4f490d7e881597374.tar.gz kdepimpi-e954cc1e29b129982e4d07c4f490d7e881597374.tar.bz2 |
Made sync code more readable by using defines
-rw-r--r-- | Makefile | 30 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 47 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 15 | ||||
-rw-r--r-- | libkcal/syncdefines.h | 22 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 10 |
5 files changed, 62 insertions, 62 deletions
@@ -1,89 +1,83 @@ | |||
1 | DISTPATH = $(shell pwd) | 1 | DISTPATH = $(shell pwd) |
2 | DISTDIR = $(shell basename $(DISTPATH)) | 2 | DISTDIR = $(shell basename $(DISTPATH)) |
3 | 3 | ||
4 | 4 | ||
5 | ifeq ($(PLATFORM) , zaurus) | 5 | ifeq ($(PLATFORM) , zaurus) |
6 | BUILD_NO_LDAP_PLUGIN=1 | 6 | BUILD_NO_LDAP_PLUGIN=1 |
7 | endif | 7 | endif |
8 | 8 | ||
9 | ifneq ($(PLATFORM) , zaurus) | 9 | ifneq ($(PLATFORM) , zaurus) |
10 | BUILD_NO_SHARP_PLUGIN=1 | 10 | BUILD_NO_SHARP_PLUGIN=1 |
11 | endif | 11 | endif |
12 | 12 | ||
13 | SUBDIRS_MICROKDE = \ | 13 | SUBDIRS_MICROKDE = \ |
14 | libical/src/libical \ | 14 | libical/src/libical \ |
15 | libical/src/libicalss \ | 15 | libical/src/libicalss \ |
16 | qtcompat \ | 16 | qtcompat \ |
17 | microkde \ | 17 | microkde \ |
18 | libkcal \ | 18 | libkcal \ |
19 | libkdepim \ | 19 | libkdepim \ |
20 | kabc \ | 20 | kabc \ |
21 | kabc/formats/binary \ | 21 | kabc/formats/binary \ |
22 | kabc/plugins/file \ | 22 | kabc/plugins/file \ |
23 | kabc/plugins/dir \ | 23 | kabc/plugins/dir \ |
24 | korganizer \ | 24 | korganizer \ |
25 | kalarmd \ | 25 | kalarmd \ |
26 | kaddressbook | 26 | kaddressbook |
27 | 27 | ||
28 | SUBDIRS_QTOPIA_PLUGIN = \ | 28 | SUBDIRS_QTOPIA_PLUGIN = \ |
29 | kabc/converter/qtopia \ | 29 | kabc/plugins/qtopia |
30 | kabc/plugins/qtopia \ | ||
31 | kaddressbook/xxport/qtopia | ||
32 | 30 | ||
33 | SUBDIRS_OPIE_PLUGIN = \ | 31 | SUBDIRS_OPIE_PLUGIN = \ |
34 | kabc/converter/opie \ | 32 | kabc/plugins/opie |
35 | kabc/plugins/opie \ | ||
36 | kaddressbook/xxport/opie | ||
37 | 33 | ||
38 | SUBDIRS_SHARP_PLUGIN = \ | 34 | SUBDIRS_SHARP_PLUGIN = \ |
39 | kabc/converter/sharpdtm \ | 35 | kabc/plugins/sharpdtm |
40 | kabc/plugins/sharpdtm \ | ||
41 | kaddressbook/xxport/sharpdtm | ||
42 | 36 | ||
43 | SUBDIRS_LDAP_PLUGIN = \ | 37 | SUBDIRS_LDAP_PLUGIN = \ |
44 | kabc/plugins/ldap | 38 | kabc/plugins/ldap |
45 | 39 | ||
46 | SUBDIRS_MICROMAIL = \ | 40 | SUBDIRS_MICROMAIL = \ |
47 | kmicromail/libetpan \ | 41 | kmicromail/libetpan \ |
48 | kmicromail/libmailwrapper \ | 42 | kmicromail/libmailwrapper \ |
49 | kmicromail | 43 | kmicromail |
50 | 44 | ||
51 | SUBDIRS = \ | 45 | SUBDIRS = \ |
52 | $(SUBDIRS_MICROKDE) \ | 46 | $(SUBDIRS_MICROKDE) \ |
53 | $(SUBDIRS_QTOPIA_PLUGIN) \ | 47 | $(SUBDIRS_QTOPIA_PLUGIN) \ |
54 | $(SUBDIRS_OPIE_PLUGIN) \ | 48 | $(SUBDIRS_OPIE_PLUGIN) \ |
55 | $(SUBDIRS_SHARP_PLUGIN) \ | 49 | $(SUBDIRS_SHARP_PLUGIN) \ |
56 | $(SUBDIRS_LDAP_PLUGIN) \ | 50 | $(SUBDIRS_LDAP_PLUGIN) \ |
57 | $(SUBDIRS_MICROMAIL) | 51 | $(SUBDIRS_MICROMAIL) |
58 | 52 | ||
59 | 53 | ||
60 | all: build_microkde \ | 54 | all: build_microkde \ |
61 | build_qtopia_plugin \ | 55 | build_qtopia_plugin \ |
62 | build_opie_plugin \ | 56 | build_opie_plugin \ |
63 | build_sharp_plugin \ | 57 | build_sharp_plugin \ |
64 | build_ldap_plugin \ | 58 | build_ldap_plugin \ |
65 | build_micromail | 59 | build_micromail |
66 | 60 | ||
67 | 61 | ||
68 | build_microkde: variable_test tmake | 62 | build_microkde: variable_test tmake |
69 | for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ | 63 | for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ |
70 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 64 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
71 | done | 65 | done |
72 | 66 | ||
73 | build_qtopia_plugin: build_microkde | 67 | build_qtopia_plugin: build_microkde |
74 | for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ | 68 | for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ |
75 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 69 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
76 | done | 70 | done |
77 | 71 | ||
78 | build_opie_plugin: build_microkde | 72 | build_opie_plugin: build_microkde |
79 | ifdef BUILD_NO_OPIE_PLUGIN | 73 | ifdef BUILD_NO_OPIE_PLUGIN |
80 | @echo ---> opie plugin not build. | 74 | @echo ---> opie plugin not build. |
81 | else | 75 | else |
82 | for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ | 76 | for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ |
83 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 77 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
84 | done | 78 | done |
85 | endif | 79 | endif |
86 | 80 | ||
87 | build_sharp_plugin: build_microkde | 81 | build_sharp_plugin: build_microkde |
88 | ifdef BUILD_NO_SHARP_PLUGIN | 82 | ifdef BUILD_NO_SHARP_PLUGIN |
89 | @echo ---> ldap plugin not build. | 83 | @echo ---> ldap plugin not build. |
@@ -103,197 +97,183 @@ build_ldap_plugin: build_microkde | |||
103 | endif | 97 | endif |
104 | 98 | ||
105 | 99 | ||
106 | build_micromail: build_microkde | 100 | build_micromail: build_microkde |
107 | ifdef BUILD_NO_MICROMAIL | 101 | ifdef BUILD_NO_MICROMAIL |
108 | @echo ---> micromail not build. | 102 | @echo ---> micromail not build. |
109 | else | 103 | else |
110 | for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ | 104 | for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ |
111 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 105 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
112 | done | 106 | done |
113 | endif | 107 | endif |
114 | 108 | ||
115 | 109 | ||
116 | variable_info: | 110 | variable_info: |
117 | @echo -------------------------------------- | 111 | @echo -------------------------------------- |
118 | @echo KDEPIM buildsystem, variableinfo... | 112 | @echo KDEPIM buildsystem, variableinfo... |
119 | @echo QTDIR=$(QTDIR) | 113 | @echo QTDIR=$(QTDIR) |
120 | @echo QPEDIR=$(QPEDIR) | 114 | @echo QPEDIR=$(QPEDIR) |
121 | @echo OPIEDIR=$(OPIEDIR) | 115 | @echo OPIEDIR=$(OPIEDIR) |
122 | @echo PLATFORM=$(PLATFORM) | 116 | @echo PLATFORM=$(PLATFORM) |
123 | @echo RELEASE_DEBUG=$(RELEASE_DEBUG) | 117 | @echo RELEASE_DEBUG=$(RELEASE_DEBUG) |
124 | @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) | 118 | @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) |
125 | @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) | 119 | @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) |
126 | @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) | 120 | @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) |
127 | @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) | 121 | @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) |
128 | ifndef BUILD_NO_SHARP_PLUGIN | 122 | ifndef BUILD_NO_SHARP_PLUGIN |
129 | @echo SHARPDTMSDK=$(SHARPDTMSDK) | 123 | @echo SHARPDTMSDK=$(SHARPDTMSDK) |
130 | endif | 124 | endif |
131 | @echo -------------------------------------- | 125 | @echo -------------------------------------- |
132 | 126 | ||
133 | variable_test: variable_info | 127 | variable_test: variable_info |
134 | @echo KDEPIM buildsystem, variablecheck... | 128 | @echo KDEPIM buildsystem, variablecheck... |
135 | ifndef PLATFORM | 129 | ifndef PLATFORM |
136 | @echo PLATFORM is not defined. | 130 | @echo PLATFORM is not defined. |
137 | $(error PLATFORM is not defined) | 131 | $(error PLATFORM is not defined) |
138 | endif | 132 | endif |
139 | ifdef BUILD_NO_LDAP_PLUGIN | 133 | ifdef BUILD_NO_LDAP_PLUGIN |
140 | @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) | 134 | @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) |
141 | endif | 135 | endif |
142 | ifdef BUILD_NO_OPIE_PLUGIN | 136 | ifdef BUILD_NO_OPIE_PLUGIN |
143 | @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) | 137 | @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) |
144 | endif | 138 | endif |
145 | ifdef BUILD_NO_MICROMAIL | 139 | ifdef BUILD_NO_MICROMAIL |
146 | @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) | 140 | @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) |
147 | endif | 141 | endif |
148 | ifdef BUILD_NO_SHARP_PLUGIN | 142 | ifdef BUILD_NO_SHARP_PLUGIN |
149 | @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) | 143 | @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) |
150 | else | 144 | else |
151 | ifndef SHARPDTMSDK | 145 | ifndef SHARPDTMSDK |
152 | @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) | 146 | @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) |
153 | $(error SHARPDTMSDK is not defined) | 147 | $(error SHARPDTMSDK is not defined) |
154 | endif | 148 | endif |
155 | endif | 149 | endif |
156 | @echo -------------------------------------- | 150 | @echo -------------------------------------- |
157 | 151 | ||
158 | 152 | ||
159 | objects: | 153 | objects: |
160 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done | 154 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done |
161 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done | 155 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done |
162 | mkdir -p libical/lib/$(PLATFORM) | 156 | mkdir -p libical/lib/$(PLATFORM) |
163 | 157 | ||
164 | clean: | 158 | clean: |
165 | rm -f libical/lib/$(PLATFORM)/*; | 159 | rm -f libical/lib/$(PLATFORM)/*; |
166 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ | 160 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ |
167 | rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ | 161 | rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ |
168 | done | 162 | done |
169 | install: | 163 | install: |
170 | cd bin/kdepim; make install | 164 | cd bin/kdepim; make install |
171 | cp db2file/db2file $(QPEDIR)/bin/db2file | 165 | cp db2file/db2file $(QPEDIR)/bin/db2file |
172 | cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop | 166 | cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop |
173 | cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop | 167 | cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop |
174 | cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kmicromail.desktop | 168 | cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kmicromail.desktop |
175 | 169 | ||
176 | dist: | 170 | dist: |
177 | @echo Dont forget to do "make install" before "make dist" | 171 | @echo Dont forget to do "make install" before "make dist" |
178 | rm -f *arm.ipk | 172 | rm -f *arm.ipk |
179 | rm -f *~ | 173 | rm -f *~ |
180 | cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim | 174 | cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim |
181 | ./mkipks kmicrokdelibs.control | 175 | ./mkipks kmicrokdelibs.control |
182 | ./mkipks korganizer.control | 176 | ./mkipks korganizer.control |
183 | ./mkipks kaddressbook.control | 177 | ./mkipks kaddressbook.control |
184 | ifndef BUILD_NO_MICROMAIL | 178 | ifndef BUILD_NO_MICROMAIL |
185 | ./mkipks kopiemail.control | 179 | ./mkipks kopiemail.control |
186 | endif | 180 | endif |
187 | ./mkipks korganizer-alarm.control | 181 | ./mkipks korganizer-alarm.control |
188 | 182 | ||
189 | tmake: objects \ | 183 | tmake: objects \ |
190 | qtcompat/Makefile$(PLATFORM) \ | 184 | qtcompat/Makefile$(PLATFORM) \ |
191 | microkde/Makefile$(PLATFORM) \ | 185 | microkde/Makefile$(PLATFORM) \ |
192 | libkcal/Makefile$(PLATFORM) \ | 186 | libkcal/Makefile$(PLATFORM) \ |
193 | libkdepim/Makefile$(PLATFORM) \ | 187 | libkdepim/Makefile$(PLATFORM) \ |
194 | korganizer/Makefile$(PLATFORM) \ | 188 | korganizer/Makefile$(PLATFORM) \ |
195 | kalarmd/Makefile$(PLATFORM) \ | 189 | kalarmd/Makefile$(PLATFORM) \ |
196 | libical/src/libical/Makefile$(PLATFORM) \ | 190 | libical/src/libical/Makefile$(PLATFORM) \ |
197 | libical/src/libicalss/Makefile$(PLATFORM) \ | 191 | libical/src/libicalss/Makefile$(PLATFORM) \ |
198 | kabc/Makefile$(PLATFORM) \ | 192 | kabc/Makefile$(PLATFORM) \ |
199 | kabc/converter/opie/Makefile$(PLATFORM) \ | ||
200 | kabc/converter/qtopia/Makefile$(PLATFORM) \ | ||
201 | kabc/converter/sharpdtm/Makefile$(PLATFORM) \ | ||
202 | kabc/formats/binary/Makefile$(PLATFORM) \ | 193 | kabc/formats/binary/Makefile$(PLATFORM) \ |
203 | kabc/plugins/file/Makefile$(PLATFORM) \ | 194 | kabc/plugins/file/Makefile$(PLATFORM) \ |
204 | kabc/plugins/dir/Makefile$(PLATFORM) \ | 195 | kabc/plugins/dir/Makefile$(PLATFORM) \ |
205 | kabc/plugins/ldap/Makefile$(PLATFORM) \ | 196 | kabc/plugins/ldap/Makefile$(PLATFORM) \ |
206 | kabc/plugins/opie/Makefile$(PLATFORM) \ | 197 | kabc/plugins/opie/Makefile$(PLATFORM) \ |
207 | kabc/plugins/qtopia/Makefile$(PLATFORM) \ | 198 | kabc/plugins/qtopia/Makefile$(PLATFORM) \ |
208 | kabc/plugins/sharpdtm/Makefile$(PLATFORM) \ | 199 | kabc/plugins/sharpdtm/Makefile$(PLATFORM) \ |
209 | kaddressbook/xxport/opie/Makefile$(PLATFORM) \ | 200 | kaddressbook/xxport/opie/Makefile$(PLATFORM) \ |
210 | kaddressbook/xxport/qtopia/Makefile$(PLATFORM) \ | 201 | kaddressbook/xxport/qtopia/Makefile$(PLATFORM) \ |
211 | kaddressbook/xxport/sharpdtm/Makefile$(PLATFORM) \ | 202 | kaddressbook/xxport/sharpdtm/Makefile$(PLATFORM) \ |
212 | kaddressbook/Makefile$(PLATFORM) \ | 203 | kaddressbook/Makefile$(PLATFORM) \ |
213 | kmicromail/Makefile$(PLATFORM) \ | 204 | kmicromail/Makefile$(PLATFORM) \ |
214 | kmicromail/libetpan/Makefile$(PLATFORM) \ | 205 | kmicromail/libetpan/Makefile$(PLATFORM) \ |
215 | kmicromail/libmailwrapper/Makefile$(PLATFORM) | 206 | kmicromail/libmailwrapper/Makefile$(PLATFORM) |
216 | |||
217 | 207 | ||
218 | 208 | ||
219 | 209 | ||
220 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro | 210 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro |
221 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) | 211 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) |
222 | 212 | ||
223 | microkde/Makefile$(PLATFORM): microkde/microkdeE.pro | 213 | microkde/Makefile$(PLATFORM): microkde/microkdeE.pro |
224 | cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) | 214 | cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) |
225 | 215 | ||
226 | libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro | 216 | libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro |
227 | cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) | 217 | cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) |
228 | 218 | ||
229 | 219 | ||
230 | libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro | 220 | libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro |
231 | cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM) | 221 | cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM) |
232 | 222 | ||
233 | kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro | 223 | kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro |
234 | cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM) | 224 | cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM) |
235 | 225 | ||
236 | korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro | 226 | korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro |
237 | cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) | 227 | cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) |
238 | 228 | ||
239 | libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro | 229 | libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro |
240 | cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) | 230 | cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) |
241 | 231 | ||
242 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro | 232 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro |
243 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) | 233 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) |
244 | 234 | ||
245 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro | 235 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro |
246 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) | 236 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) |
247 | 237 | ||
248 | kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieE.pro | ||
249 | cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) | ||
250 | |||
251 | kabc/converter/qtopia/Makefile$(PLATFORM): kabc/converter/qtopia/qtopiaE.pro | ||
252 | cd kabc/converter/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) | ||
253 | |||
254 | kabc/converter/sharpdtm/Makefile$(PLATFORM): kabc/converter/sharpdtm/sharpdtmE.pro | ||
255 | cd kabc/converter/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM) | ||
256 | |||
257 | |||
258 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro | 238 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro |
259 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) | 239 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) |
260 | 240 | ||
261 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro | 241 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro |
262 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) | 242 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) |
263 | 243 | ||
264 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro | 244 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro |
265 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM) | 245 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM) |
266 | 246 | ||
267 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro | 247 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro |
268 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) | 248 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) |
269 | 249 | ||
270 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro | 250 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro |
271 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) | 251 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) |
272 | 252 | ||
273 | kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro | 253 | kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro |
274 | cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) | 254 | cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) |
275 | 255 | ||
276 | kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro | 256 | kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro |
277 | cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM) | 257 | cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM) |
278 | 258 | ||
279 | kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro | 259 | kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro |
280 | cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) | 260 | cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) |
281 | 261 | ||
282 | kaddressbook/xxport/qtopia/Makefile$(PLATFORM): kaddressbook/xxport/qtopia/qtopiaE.pro | 262 | kaddressbook/xxport/qtopia/Makefile$(PLATFORM): kaddressbook/xxport/qtopia/qtopiaE.pro |
283 | cd kaddressbook/xxport/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) | 263 | cd kaddressbook/xxport/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) |
284 | 264 | ||
285 | kaddressbook/xxport/sharpdtm/Makefile$(PLATFORM): kaddressbook/xxport/sharpdtm/sharpdtmE.pro | 265 | kaddressbook/xxport/sharpdtm/Makefile$(PLATFORM): kaddressbook/xxport/sharpdtm/sharpdtmE.pro |
286 | cd kaddressbook/xxport/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM) | 266 | cd kaddressbook/xxport/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM) |
287 | 267 | ||
288 | 268 | ||
289 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro | 269 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro |
290 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) | 270 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) |
291 | 271 | ||
292 | kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro | 272 | kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro |
293 | cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" kmicromailE.pro -o Makefile$(PLATFORM) | 273 | cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" kmicromailE.pro -o Makefile$(PLATFORM) |
294 | 274 | ||
295 | kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro | 275 | kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro |
296 | cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" libetpanE.pro -o Makefile$(PLATFORM) | 276 | cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" libetpanE.pro -o Makefile$(PLATFORM) |
297 | 277 | ||
298 | kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro | 278 | kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro |
299 | cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" libmailwrapperE.pro -o Makefile$(PLATFORM) | 279 | cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" libmailwrapperE.pro -o Makefile$(PLATFORM) |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 58b3d70..fd68dc4 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -84,99 +84,97 @@ | |||
84 | #include <libkcal/sharpformat.h> | 84 | #include <libkcal/sharpformat.h> |
85 | #endif | 85 | #endif |
86 | #ifndef KORG_NOMAIL | 86 | #ifndef KORG_NOMAIL |
87 | #include "komailclient.h" | 87 | #include "komailclient.h" |
88 | #endif | 88 | #endif |
89 | #ifndef KORG_NOPRINTER | 89 | #ifndef KORG_NOPRINTER |
90 | #include "calprinter.h" | 90 | #include "calprinter.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPLUGINS | 92 | #ifndef KORG_NOPLUGINS |
93 | #include "kocore.h" | 93 | #include "kocore.h" |
94 | #endif | 94 | #endif |
95 | #include "koeventeditor.h" | 95 | #include "koeventeditor.h" |
96 | #include "kotodoeditor.h" | 96 | #include "kotodoeditor.h" |
97 | #include "koprefs.h" | 97 | #include "koprefs.h" |
98 | #include "koeventviewerdialog.h" | 98 | #include "koeventviewerdialog.h" |
99 | #include "publishdialog.h" | 99 | #include "publishdialog.h" |
100 | #include "kofilterview.h" | 100 | #include "kofilterview.h" |
101 | #include "koglobals.h" | 101 | #include "koglobals.h" |
102 | #include "koviewmanager.h" | 102 | #include "koviewmanager.h" |
103 | #include "koagendaview.h" | 103 | #include "koagendaview.h" |
104 | #include "kodialogmanager.h" | 104 | #include "kodialogmanager.h" |
105 | #include "outgoingdialog.h" | 105 | #include "outgoingdialog.h" |
106 | #include "incomingdialog.h" | 106 | #include "incomingdialog.h" |
107 | #include "statusdialog.h" | 107 | #include "statusdialog.h" |
108 | #include "kdatenavigator.h" | 108 | #include "kdatenavigator.h" |
109 | #include "kotodoview.h" | 109 | #include "kotodoview.h" |
110 | #include "datenavigator.h" | 110 | #include "datenavigator.h" |
111 | #include "resourceview.h" | 111 | #include "resourceview.h" |
112 | #include "navigatorbar.h" | 112 | #include "navigatorbar.h" |
113 | #include "searchdialog.h" | 113 | #include "searchdialog.h" |
114 | #include "mainwindow.h" | 114 | #include "mainwindow.h" |
115 | 115 | ||
116 | #include "calendarview.h" | 116 | #include "calendarview.h" |
117 | #ifndef DESKTOP_VERSION | 117 | #ifndef DESKTOP_VERSION |
118 | #include <qtopia/alarmserver.h> | 118 | #include <qtopia/alarmserver.h> |
119 | #endif | 119 | #endif |
120 | #ifndef _WIN32_ | 120 | #ifndef _WIN32_ |
121 | #include <stdlib.h> | 121 | #include <stdlib.h> |
122 | #include <stdio.h> | 122 | #include <stdio.h> |
123 | #include <unistd.h> | 123 | #include <unistd.h> |
124 | #else | 124 | #else |
125 | #include <qprocess.h> | 125 | #include <qprocess.h> |
126 | #endif | 126 | #endif |
127 | using namespace KOrg; | 127 | using namespace KOrg; |
128 | using namespace KCal; | 128 | using namespace KCal; |
129 | extern int globalFlagBlockAgenda; | 129 | extern int globalFlagBlockAgenda; |
130 | extern int globalFlagBlockStartup; | 130 | extern int globalFlagBlockStartup; |
131 | 131 | ||
132 | #define SYNC_MODE_NORMAL 0 | 132 | |
133 | #define SYNC_MODE_SHARP 1 | ||
134 | #define SYNC_MODE_QTOPIA 2 | ||
135 | 133 | ||
136 | class KOBeamPrefs : public QDialog | 134 | class KOBeamPrefs : public QDialog |
137 | { | 135 | { |
138 | public: | 136 | public: |
139 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 137 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
140 | QDialog( parent, name, true ) | 138 | QDialog( parent, name, true ) |
141 | { | 139 | { |
142 | setCaption( i18n("Beam Options") ); | 140 | setCaption( i18n("Beam Options") ); |
143 | QVBoxLayout* lay = new QVBoxLayout( this ); | 141 | QVBoxLayout* lay = new QVBoxLayout( this ); |
144 | lay->setSpacing( 3 ); | 142 | lay->setSpacing( 3 ); |
145 | lay->setMargin( 3 ); | 143 | lay->setMargin( 3 ); |
146 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 144 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
147 | lay->addWidget( format ); | 145 | lay->addWidget( format ); |
148 | format->setExclusive ( true ) ; | 146 | format->setExclusive ( true ) ; |
149 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 147 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
150 | lay->addWidget( time ); time->setExclusive ( true ) ; | 148 | lay->addWidget( time ); time->setExclusive ( true ) ; |
151 | vcal = new QRadioButton(" vCalendar ", format ); | 149 | vcal = new QRadioButton(" vCalendar ", format ); |
152 | ical = new QRadioButton(" iCalendar ", format ); | 150 | ical = new QRadioButton(" iCalendar ", format ); |
153 | vcal->setChecked( true ); | 151 | vcal->setChecked( true ); |
154 | tz = new QRadioButton(i18n(" With timezone "), time ); | 152 | tz = new QRadioButton(i18n(" With timezone "), time ); |
155 | local = new QRadioButton(i18n(" Local time "), time ); | 153 | local = new QRadioButton(i18n(" Local time "), time ); |
156 | tz->setChecked( true ); | 154 | tz->setChecked( true ); |
157 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 155 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
158 | lay->addWidget( ok ); | 156 | lay->addWidget( ok ); |
159 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 157 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
160 | lay->addWidget( cancel ); | 158 | lay->addWidget( cancel ); |
161 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 159 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
162 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 160 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
163 | resize( 200, 200 ); | 161 | resize( 200, 200 ); |
164 | } | 162 | } |
165 | 163 | ||
166 | bool beamVcal() { return vcal->isChecked(); } | 164 | bool beamVcal() { return vcal->isChecked(); } |
167 | bool beamLocal() { return local->isChecked(); } | 165 | bool beamLocal() { return local->isChecked(); } |
168 | private: | 166 | private: |
169 | QRadioButton* vcal, *ical, *local, *tz; | 167 | QRadioButton* vcal, *ical, *local, *tz; |
170 | }; | 168 | }; |
171 | class KOCatPrefs : public QDialog | 169 | class KOCatPrefs : public QDialog |
172 | { | 170 | { |
173 | public: | 171 | public: |
174 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 172 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
175 | QDialog( parent, name, true ) | 173 | QDialog( parent, name, true ) |
176 | { | 174 | { |
177 | setCaption( i18n("Manage new Categories") ); | 175 | setCaption( i18n("Manage new Categories") ); |
178 | QVBoxLayout* lay = new QVBoxLayout( this ); | 176 | QVBoxLayout* lay = new QVBoxLayout( this ); |
179 | lay->setSpacing( 3 ); | 177 | lay->setSpacing( 3 ); |
180 | lay->setMargin( 3 ); | 178 | lay->setMargin( 3 ); |
181 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
182 | lay->addWidget( lab ); | 180 | lay->addWidget( lab ); |
@@ -682,212 +680,213 @@ void CalendarView::createPrinter() | |||
682 | if (!mCalPrinter) { | 680 | if (!mCalPrinter) { |
683 | mCalPrinter = new CalPrinter(this, mCalendar); | 681 | mCalPrinter = new CalPrinter(this, mCalendar); |
684 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 682 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
685 | } | 683 | } |
686 | #endif | 684 | #endif |
687 | } | 685 | } |
688 | 686 | ||
689 | void CalendarView::confSync() | 687 | void CalendarView::confSync() |
690 | { | 688 | { |
691 | static KOSyncPrefsDialog* sp = 0; | 689 | static KOSyncPrefsDialog* sp = 0; |
692 | if ( ! sp ) { | 690 | if ( ! sp ) { |
693 | sp = new KOSyncPrefsDialog( this, "syncprefs", true ); | 691 | sp = new KOSyncPrefsDialog( this, "syncprefs", true ); |
694 | } | 692 | } |
695 | sp->usrReadConfig(); | 693 | sp->usrReadConfig(); |
696 | #ifndef DESKTOP_VERSION | 694 | #ifndef DESKTOP_VERSION |
697 | sp->showMaximized(); | 695 | sp->showMaximized(); |
698 | #else | 696 | #else |
699 | sp->show(); | 697 | sp->show(); |
700 | #endif | 698 | #endif |
701 | sp->exec(); | 699 | sp->exec(); |
702 | 700 | ||
703 | } | 701 | } |
704 | 702 | ||
705 | 703 | ||
706 | //KOPrefs::instance()->mWriteBackFile | 704 | //KOPrefs::instance()->mWriteBackFile |
707 | //KOPrefs::instance()->mWriteBackExistingOnly | 705 | //KOPrefs::instance()->mWriteBackExistingOnly |
708 | 706 | ||
709 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 707 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
710 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 708 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
711 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 709 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
712 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 710 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
713 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 711 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
714 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 712 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
715 | 713 | ||
716 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 714 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
717 | { | 715 | { |
718 | 716 | ||
719 | //void setZaurusId(int id); | 717 | //void setZaurusId(int id); |
720 | // int zaurusId() const; | 718 | // int zaurusId() const; |
721 | // void setZaurusUid(int id); | 719 | // void setZaurusUid(int id); |
722 | // int zaurusUid() const; | 720 | // int zaurusUid() const; |
723 | // void setZaurusStat(int id); | 721 | // void setZaurusStat(int id); |
724 | // int zaurusStat() const; | 722 | // int zaurusStat() const; |
725 | // 0 equal | 723 | // 0 equal |
726 | // 1 take local | 724 | // 1 take local |
727 | // 2 take remote | 725 | // 2 take remote |
728 | // 3 cancel | 726 | // 3 cancel |
729 | QDateTime lastSync = mLastCalendarSync; | 727 | QDateTime lastSync = mLastCalendarSync; |
730 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 728 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
731 | bool remCh, locCh; | 729 | bool remCh, locCh; |
732 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); | 730 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); |
733 | locCh = ( local->zaurusStat() != local->revision() ); | 731 | locCh = ( local->lastModified() > mLastCalendarSync ); |
734 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); | 732 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); |
735 | if ( !remCh && ! locCh ) { | 733 | if ( !remCh && ! locCh ) { |
736 | //qDebug("both not changed "); | 734 | //qDebug("both not changed "); |
737 | lastSync = local->lastModified().addDays(1); | 735 | lastSync = local->lastModified().addDays(1); |
738 | } else { | 736 | } else { |
739 | if ( locCh ) { | 737 | if ( locCh ) { |
740 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); | 738 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); |
741 | lastSync = local->lastModified().addDays( -1 ); | 739 | lastSync = local->lastModified().addDays( -1 ); |
742 | if ( !remCh ) | 740 | if ( !remCh ) |
743 | remote->setLastModified( lastSync.addDays( -1 ) ); | 741 | remote->setLastModified( lastSync.addDays( -1 ) ); |
744 | } else { | 742 | } else { |
745 | //qDebug(" not loc changed "); | 743 | //qDebug(" not loc changed "); |
746 | lastSync = local->lastModified().addDays( 1 ); | 744 | lastSync = local->lastModified().addDays( 1 ); |
747 | if ( remCh ) | 745 | if ( remCh ) |
748 | remote->setLastModified( lastSync.addDays( 1 ) ); | 746 | remote->setLastModified( lastSync.addDays( 1 ) ); |
749 | 747 | ||
750 | } | 748 | } |
751 | } | 749 | } |
752 | full = true; | 750 | full = true; |
753 | if ( mode < 3 ) | 751 | if ( mode < SYNC_PREF_ASK ) |
754 | mode = 3; | 752 | mode = SYNC_PREF_ASK; |
755 | } else { | 753 | } else { |
756 | if ( local->lastModified() == remote->lastModified() ) | 754 | if ( local->lastModified() == remote->lastModified() ) |
757 | if ( local->revision() == remote->revision() ) | 755 | if ( local->revision() == remote->revision() ) |
758 | return 0; | 756 | return 0; |
759 | 757 | ||
760 | } | 758 | } |
761 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 759 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
762 | 760 | ||
763 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); | 761 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); |
764 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 762 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
765 | //full = true; //debug only | 763 | //full = true; //debug only |
766 | if ( full ) { | 764 | if ( full ) { |
767 | bool equ = false; | 765 | bool equ = false; |
768 | if ( local->type() == "Event" ) { | 766 | if ( local->type() == "Event" ) { |
769 | equ = (*((Event*) local) == *((Event*) remote)); | 767 | equ = (*((Event*) local) == *((Event*) remote)); |
770 | } | 768 | } |
771 | else if ( local->type() =="Todo" ) | 769 | else if ( local->type() =="Todo" ) |
772 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 770 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
773 | else if ( local->type() =="Journal" ) | 771 | else if ( local->type() =="Journal" ) |
774 | equ = (*((Journal*) local) == *((Journal*) remote)); | 772 | equ = (*((Journal*) local) == *((Journal*) remote)); |
775 | if ( equ ) { | 773 | if ( equ ) { |
776 | //qDebug("equal "); | 774 | //qDebug("equal "); |
777 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 775 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
778 | local->setZaurusUid( remote->zaurusUid() ); | 776 | local->setZaurusUid( remote->zaurusUid() ); |
779 | } | 777 | } |
780 | if ( mode < 4 ) | 778 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
781 | return 0; | 779 | return 0; |
782 | 780 | ||
783 | }//else //debug only | 781 | }//else //debug only |
784 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 782 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
785 | } | 783 | } |
786 | int result; | 784 | int result; |
787 | bool localIsNew; | 785 | bool localIsNew; |
788 | if ( full && mode < 2 ) | 786 | if ( full && mode < SYNC_PREF_NEWEST ) |
789 | mode = 3; | 787 | mode = SYNC_PREF_ASK; |
790 | 788 | ||
791 | switch( mode ) { | 789 | switch( mode ) { |
792 | case 0: | 790 | case SYNC_PREF_LOCAL: |
793 | if ( lastSync > remote->lastModified() ) | 791 | if ( lastSync > remote->lastModified() ) |
794 | return 1; | 792 | return 1; |
795 | if ( lastSync > local->lastModified() ) | 793 | if ( lastSync > local->lastModified() ) |
796 | return 2; | 794 | return 2; |
797 | return 1; | 795 | return 1; |
798 | break; | 796 | break; |
799 | case 1: | 797 | case SYNC_PREF_REMOTE: |
800 | if ( lastSync > remote->lastModified() ) | 798 | if ( lastSync > remote->lastModified() ) |
801 | return 1; | 799 | return 1; |
802 | if ( lastSync > local->lastModified() ) | 800 | if ( lastSync > local->lastModified() ) |
803 | return 2; | 801 | return 2; |
804 | return 2; | 802 | return 2; |
805 | break; | 803 | break; |
806 | case 2: | 804 | case SYNC_PREF_NEWEST: |
807 | if ( local->lastModified() > remote->lastModified() ) | 805 | if ( local->lastModified() > remote->lastModified() ) |
808 | return 1; | 806 | return 1; |
809 | else | 807 | else |
810 | return 2; | 808 | return 2; |
811 | break; | 809 | break; |
812 | case 3: | 810 | case SYNC_PREF_ASK: |
813 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 811 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
814 | if ( lastSync > remote->lastModified() ) | 812 | if ( lastSync > remote->lastModified() ) |
815 | return 1; | 813 | return 1; |
816 | if ( lastSync > local->lastModified() ) | 814 | if ( lastSync > local->lastModified() ) |
817 | return 2; | 815 | return 2; |
818 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 816 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
819 | localIsNew = local->lastModified() > remote->lastModified(); | 817 | localIsNew = local->lastModified() > remote->lastModified(); |
820 | if ( localIsNew ) | 818 | if ( localIsNew ) |
821 | getEventViewerDialog()->setColorMode( 1 ); | 819 | getEventViewerDialog()->setColorMode( 1 ); |
822 | else | 820 | else |
823 | getEventViewerDialog()->setColorMode( 2 ); | 821 | getEventViewerDialog()->setColorMode( 2 ); |
824 | getEventViewerDialog()->setIncidence(local); | 822 | getEventViewerDialog()->setIncidence(local); |
825 | if ( localIsNew ) | 823 | if ( localIsNew ) |
826 | getEventViewerDialog()->setColorMode( 2 ); | 824 | getEventViewerDialog()->setColorMode( 2 ); |
827 | else | 825 | else |
828 | getEventViewerDialog()->setColorMode( 1 ); | 826 | getEventViewerDialog()->setColorMode( 1 ); |
829 | getEventViewerDialog()->addIncidence(remote); | 827 | getEventViewerDialog()->addIncidence(remote); |
830 | getEventViewerDialog()->setColorMode( 0 ); | 828 | getEventViewerDialog()->setColorMode( 0 ); |
831 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 829 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
832 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 830 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
833 | getEventViewerDialog()->showMe(); | 831 | getEventViewerDialog()->showMe(); |
834 | result = getEventViewerDialog()->executeS( localIsNew ); | 832 | result = getEventViewerDialog()->executeS( localIsNew ); |
835 | return result; | 833 | return result; |
836 | 834 | ||
837 | break; | 835 | break; |
838 | case 4: | 836 | case SYNC_PREF_FORCE_LOCAL: |
839 | return 1; | 837 | return 1; |
840 | break; | 838 | break; |
841 | case 5: | 839 | case SYNC_PREF_FORCE_REMOTE: |
842 | return 2; | 840 | return 2; |
843 | break; | 841 | break; |
844 | 842 | ||
845 | default: | 843 | default: |
844 | // SYNC_PREF_TAKE_BOTH not implemented | ||
846 | break; | 845 | break; |
847 | } | 846 | } |
848 | return 0; | 847 | return 0; |
849 | } | 848 | } |
850 | Event* CalendarView::getLastSyncEvent() | 849 | Event* CalendarView::getLastSyncEvent() |
851 | { | 850 | { |
852 | Event* lse; | 851 | Event* lse; |
853 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 852 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
854 | lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); | 853 | lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); |
855 | if (!lse) { | 854 | if (!lse) { |
856 | lse = new Event(); | 855 | lse = new Event(); |
857 | lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); | 856 | lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); |
858 | lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); | 857 | lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); |
859 | lse->setDtStart( mLastCalendarSync ); | 858 | lse->setDtStart( mLastCalendarSync ); |
860 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 859 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
861 | lse->setCategories( i18n("SyncEvent") ); | 860 | lse->setCategories( i18n("SyncEvent") ); |
862 | lse->setReadOnly( true ); | 861 | lse->setReadOnly( true ); |
863 | mCalendar->addEvent( lse ); | 862 | mCalendar->addEvent( lse ); |
864 | } | 863 | } |
865 | 864 | ||
866 | return lse; | 865 | return lse; |
867 | 866 | ||
868 | } | 867 | } |
869 | void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) | 868 | void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) |
870 | { | 869 | { |
871 | if ( ! lastSync ) | 870 | if ( ! lastSync ) |
872 | return; | 871 | return; |
873 | if ( toDelete->zaurusId() < 0 ) | 872 | if ( toDelete->zaurusId() < 0 ) |
874 | return; | 873 | return; |
875 | if ( toDelete->type() == "Journal" ) | 874 | if ( toDelete->type() == "Journal" ) |
876 | return; | 875 | return; |
877 | QString des = lastSync->description(); | 876 | QString des = lastSync->description(); |
878 | QString pref = "e"; | 877 | QString pref = "e"; |
879 | if ( toDelete->type() == "Todo" ) | 878 | if ( toDelete->type() == "Todo" ) |
880 | pref = "t"; | 879 | pref = "t"; |
881 | des += pref+ QString::number ( toDelete->zaurusId() ) + ","; | 880 | des += pref+ QString::number ( toDelete->zaurusId() ) + ","; |
882 | lastSync->setReadOnly( false ); | 881 | lastSync->setReadOnly( false ); |
883 | lastSync->setDescription( des ); | 882 | lastSync->setDescription( des ); |
884 | lastSync->setReadOnly( true ); | 883 | lastSync->setReadOnly( true ); |
885 | 884 | ||
886 | } | 885 | } |
887 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 886 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
888 | { | 887 | { |
889 | bool syncOK = true; | 888 | bool syncOK = true; |
890 | int addedEvent = 0; | 889 | int addedEvent = 0; |
891 | int addedEventR = 0; | 890 | int addedEventR = 0; |
892 | int deletedEventR = 0; | 891 | int deletedEventR = 0; |
893 | int deletedEventL = 0; | 892 | int deletedEventL = 0; |
@@ -951,271 +950,273 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
951 | int w = 300; | 950 | int w = 300; |
952 | if ( QApplication::desktop()->width() < 320 ) | 951 | if ( QApplication::desktop()->width() < 320 ) |
953 | w = 220; | 952 | w = 220; |
954 | int h = bar.sizeHint().height() ; | 953 | int h = bar.sizeHint().height() ; |
955 | int dw = QApplication::desktop()->width(); | 954 | int dw = QApplication::desktop()->width(); |
956 | int dh = QApplication::desktop()->height(); | 955 | int dh = QApplication::desktop()->height(); |
957 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 956 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
958 | bar.show(); | 957 | bar.show(); |
959 | int modulo = (er.count()/10)+1; | 958 | int modulo = (er.count()/10)+1; |
960 | int incCounter = 0; | 959 | int incCounter = 0; |
961 | while ( inR ) { | 960 | while ( inR ) { |
962 | if ( ! bar.isVisible() ) | 961 | if ( ! bar.isVisible() ) |
963 | return false; | 962 | return false; |
964 | if ( incCounter % modulo == 0 ) | 963 | if ( incCounter % modulo == 0 ) |
965 | bar.setProgress( incCounter ); | 964 | bar.setProgress( incCounter ); |
966 | ++incCounter; | 965 | ++incCounter; |
967 | uid = inR->uid(); | 966 | uid = inR->uid(); |
968 | bool skipIncidence = false; | 967 | bool skipIncidence = false; |
969 | if ( uid.left(21) == QString("last-syncEvent-device") ) | 968 | if ( uid.left(21) == QString("last-syncEvent-device") ) |
970 | skipIncidence = true; | 969 | skipIncidence = true; |
971 | 970 | ||
972 | qApp->processEvents(); | 971 | qApp->processEvents(); |
973 | if ( !skipIncidence ) { | 972 | if ( !skipIncidence ) { |
974 | inL = local->incidence( uid ); | 973 | inL = local->incidence( uid ); |
975 | if ( inL ) { // maybe conflict - same uid in both calendars | 974 | if ( inL ) { // maybe conflict - same uid in both calendars |
976 | int maxrev = inL->revision(); | 975 | int maxrev = inL->revision(); |
977 | if ( maxrev < inR->revision() ) | 976 | if ( maxrev < inR->revision() ) |
978 | maxrev = inR->revision(); | 977 | maxrev = inR->revision(); |
979 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 978 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
980 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 979 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
981 | if ( take == 3 ) | 980 | if ( take == 3 ) |
982 | return false; | 981 | return false; |
983 | if ( take == 1 ) {// take local | 982 | if ( take == 1 ) {// take local |
984 | inL->setZaurusUid( inR->zaurusUid() ); | 983 | inL->setZaurusUid( inR->zaurusUid() ); |
985 | remote->deleteIncidence( inR ); | 984 | remote->deleteIncidence( inR ); |
986 | if ( inL->revision() < maxrev ) | 985 | if ( inL->revision() < maxrev ) |
987 | inL->setRevision( maxrev ); | 986 | inL->setRevision( maxrev ); |
988 | remote->addIncidence( inL->clone() ); | 987 | remote->addIncidence( inL->clone() ); |
989 | ++changedRemote; | 988 | ++changedRemote; |
990 | } else { | 989 | } else { |
991 | if ( inR->revision() < maxrev ) | 990 | if ( inR->revision() < maxrev ) |
992 | inR->setRevision( maxrev ); | 991 | inR->setRevision( maxrev ); |
993 | local->deleteIncidence( inL ); | 992 | local->deleteIncidence( inL ); |
994 | local->addIncidence( inR->clone() ); | 993 | local->addIncidence( inR->clone() ); |
995 | ++changedLocal; | 994 | ++changedLocal; |
996 | } | 995 | } |
997 | } | 996 | } |
998 | } else { // no conflict | 997 | } else { // no conflict |
999 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 998 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1000 | QString des = eventLSync->description(); | 999 | QString des = eventLSync->description(); |
1001 | QString pref = "e"; | 1000 | QString pref = "e"; |
1002 | if ( inR->type() == "Todo" ) | 1001 | if ( inR->type() == "Todo" ) |
1003 | pref = "t"; | 1002 | pref = "t"; |
1004 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it | 1003 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it |
1005 | inR->setZaurusStat( -3 ); | 1004 | inR->setZaurusStat( SYNC_TEMPSTATE_DELETE ); |
1006 | //remote->deleteIncidence( inR ); | 1005 | //remote->deleteIncidence( inR ); |
1007 | ++deletedEventR; | 1006 | ++deletedEventR; |
1008 | } else { | 1007 | } else { |
1009 | inR->setLastModified( modifiedCalendar ); | 1008 | inR->setLastModified( modifiedCalendar ); |
1010 | local->addIncidence( inR->clone() ); | 1009 | local->addIncidence( inR->clone() ); |
1011 | ++addedEvent; | 1010 | ++addedEvent; |
1012 | } | 1011 | } |
1013 | } else { | 1012 | } else { |
1014 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1013 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1015 | inR->setLastModified( modifiedCalendar ); | 1014 | inR->setLastModified( modifiedCalendar ); |
1016 | local->addIncidence( inR->clone() ); | 1015 | local->addIncidence( inR->clone() ); |
1017 | ++addedEvent; | 1016 | ++addedEvent; |
1018 | } else { | 1017 | } else { |
1019 | checkSharpEvent(eventRSyncSharp, inR); | 1018 | checkSharpEvent(eventRSyncSharp, inR); |
1020 | remote->deleteIncidence( inR ); | 1019 | remote->deleteIncidence( inR ); |
1021 | ++deletedEventR; | 1020 | ++deletedEventR; |
1022 | } | 1021 | } |
1023 | } | 1022 | } |
1024 | } | 1023 | } |
1025 | } | 1024 | } |
1026 | inR = er.next(); | 1025 | inR = er.next(); |
1027 | } | 1026 | } |
1028 | QPtrList<Incidence> el = local->rawIncidences(); | 1027 | QPtrList<Incidence> el = local->rawIncidences(); |
1029 | inL = el.first(); | 1028 | inL = el.first(); |
1030 | modulo = (el.count()/10)+1; | 1029 | modulo = (el.count()/10)+1; |
1031 | bar.setCaption (i18n("Add / remove events") ); | 1030 | bar.setCaption (i18n("Add / remove events") ); |
1032 | bar.setTotalSteps ( el.count() ) ; | 1031 | bar.setTotalSteps ( el.count() ) ; |
1033 | bar.show(); | 1032 | bar.show(); |
1034 | incCounter = 0; | 1033 | incCounter = 0; |
1035 | 1034 | ||
1036 | while ( inL ) { | 1035 | while ( inL ) { |
1037 | 1036 | ||
1038 | qApp->processEvents(); | 1037 | qApp->processEvents(); |
1039 | if ( ! bar.isVisible() ) | 1038 | if ( ! bar.isVisible() ) |
1040 | return false; | 1039 | return false; |
1041 | if ( incCounter % modulo == 0 ) | 1040 | if ( incCounter % modulo == 0 ) |
1042 | bar.setProgress( incCounter ); | 1041 | bar.setProgress( incCounter ); |
1043 | ++incCounter; | 1042 | ++incCounter; |
1044 | uid = inL->uid(); | 1043 | uid = inL->uid(); |
1045 | bool skipIncidence = false; | 1044 | bool skipIncidence = false; |
1046 | if ( uid.left(21) == QString("last-syncEvent-device") ) | 1045 | if ( uid.left(21) == QString("last-syncEvent-device") ) |
1047 | skipIncidence = true; | 1046 | skipIncidence = true; |
1048 | if ( mGlobalSyncMode == SYNC_MODE_SHARP && inL->type() == "Journal" ) | 1047 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1049 | skipIncidence = true; | 1048 | skipIncidence = true; |
1050 | if ( !skipIncidence ) { | 1049 | if ( !skipIncidence ) { |
1051 | inR = remote->incidence( uid ); | 1050 | inR = remote->incidence( uid ); |
1052 | if ( ! inR ) { | 1051 | if ( ! inR ) { |
1053 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 1052 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1054 | if ( inL->zaurusId() >= 0 && mode != 4 ) { | 1053 | if ( inL->zaurusId() >= 0 && mode != 4 ) { |
1055 | local->deleteIncidence( inL ); | 1054 | local->deleteIncidence( inL ); |
1056 | ++deletedEventL; | 1055 | ++deletedEventL; |
1057 | } else { | 1056 | } else { |
1058 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1057 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1059 | inL->setZaurusId( -1 ); | 1058 | inL->setZaurusId( -1 ); |
1060 | ++addedEventR; | 1059 | ++addedEventR; |
1061 | inL->setLastModified( modifiedCalendar ); | 1060 | inL->setLastModified( modifiedCalendar ); |
1062 | remote->addIncidence( inL->clone() ); | 1061 | remote->addIncidence( inL->clone() ); |
1063 | } | 1062 | } |
1064 | } | 1063 | } |
1065 | } else { | 1064 | } else { |
1066 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1065 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1067 | checkSharpEvent(eventLSyncSharp, inL); | 1066 | checkSharpEvent(eventLSyncSharp, inL); |
1068 | local->deleteIncidence( inL ); | 1067 | local->deleteIncidence( inL ); |
1069 | ++deletedEventL; | 1068 | ++deletedEventL; |
1070 | } else { | 1069 | } else { |
1071 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1070 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1072 | ++addedEventR; | 1071 | ++addedEventR; |
1073 | inL->setLastModified( modifiedCalendar ); | 1072 | inL->setLastModified( modifiedCalendar ); |
1074 | remote->addIncidence( inL->clone() ); | 1073 | remote->addIncidence( inL->clone() ); |
1075 | } | 1074 | } |
1076 | } | 1075 | } |
1077 | } | 1076 | } |
1078 | } | 1077 | } |
1079 | } | 1078 | } |
1080 | inL = el.next(); | 1079 | inL = el.next(); |
1081 | } | 1080 | } |
1082 | 1081 | ||
1083 | bar.hide(); | 1082 | bar.hide(); |
1084 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1083 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1085 | eventLSync->setReadOnly( false ); | 1084 | eventLSync->setReadOnly( false ); |
1086 | eventLSync->setDtStart( mLastCalendarSync ); | 1085 | eventLSync->setDtStart( mLastCalendarSync ); |
1087 | eventRSync->setDtStart( mLastCalendarSync ); | 1086 | eventRSync->setDtStart( mLastCalendarSync ); |
1088 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1087 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1089 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1088 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1090 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1089 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1091 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1090 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1092 | eventLSync->setReadOnly( true ); | 1091 | eventLSync->setReadOnly( true ); |
1093 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1092 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1094 | remote->addEvent( eventRSync ); | 1093 | remote->addEvent( eventRSync ); |
1095 | QString mes; | 1094 | QString mes; |
1096 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1095 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1097 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1096 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1098 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1097 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1099 | } | 1098 | } |
1100 | qDebug( mes ); | 1099 | qDebug( mes ); |
1101 | mCalendar->checkAlarmForIncidence( 0, true ); | 1100 | mCalendar->checkAlarmForIncidence( 0, true ); |
1102 | return syncOK; | 1101 | return syncOK; |
1103 | } | 1102 | } |
1104 | 1103 | ||
1105 | void CalendarView::setSyncDevice( QString s ) | 1104 | void CalendarView::setSyncDevice( QString s ) |
1106 | { | 1105 | { |
1107 | mCurrentSyncDevice= s; | 1106 | mCurrentSyncDevice= s; |
1108 | } | 1107 | } |
1109 | void CalendarView::setSyncName( QString s ) | 1108 | void CalendarView::setSyncName( QString s ) |
1110 | { | 1109 | { |
1111 | mCurrentSyncName= s; | 1110 | mCurrentSyncName= s; |
1112 | } | 1111 | } |
1113 | bool CalendarView::syncCalendar(QString filename, int mode) | 1112 | bool CalendarView::syncCalendar(QString filename, int mode) |
1114 | { | 1113 | { |
1115 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1114 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1116 | CalendarLocal* calendar = new CalendarLocal(); | 1115 | CalendarLocal* calendar = new CalendarLocal(); |
1117 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1116 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1118 | FileStorage* storage = new FileStorage( calendar ); | 1117 | FileStorage* storage = new FileStorage( calendar ); |
1119 | bool syncOK = false; | 1118 | bool syncOK = false; |
1120 | storage->setFileName( filename ); | 1119 | storage->setFileName( filename ); |
1121 | // qDebug("loading ... "); | 1120 | // qDebug("loading ... "); |
1122 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1121 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1123 | getEventViewerDialog()->setSyncMode( true ); | 1122 | getEventViewerDialog()->setSyncMode( true ); |
1124 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1123 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1125 | getEventViewerDialog()->setSyncMode( false ); | 1124 | getEventViewerDialog()->setSyncMode( false ); |
1126 | if ( syncOK ) { | 1125 | if ( syncOK ) { |
1127 | if ( KOPrefs::instance()->mWriteBackFile ) | 1126 | if ( KOPrefs::instance()->mWriteBackFile ) |
1128 | { | 1127 | { |
1129 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1128 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1130 | storage->save(); | 1129 | storage->save(); |
1131 | } | 1130 | } |
1132 | } | 1131 | } |
1133 | setModified( true ); | 1132 | setModified( true ); |
1134 | } | 1133 | } |
1135 | delete storage; | 1134 | delete storage; |
1136 | delete calendar; | 1135 | delete calendar; |
1137 | if ( syncOK ) | 1136 | if ( syncOK ) |
1138 | updateView(); | 1137 | updateView(); |
1139 | return syncOK; | 1138 | return syncOK; |
1140 | } | 1139 | } |
1141 | void CalendarView::syncSharp() | 1140 | void CalendarView::syncSharp() |
1142 | { | 1141 | { |
1143 | #ifndef DESKTOP_VERSION | 1142 | #ifndef DESKTOP_VERSION |
1144 | mGlobalSyncMode = SYNC_MODE_SHARP; | 1143 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1145 | //mCurrentSyncDevice = "sharp-DTM"; | 1144 | //mCurrentSyncDevice = "sharp-DTM"; |
1146 | if ( KOPrefs::instance()->mAskForPreferences ) | 1145 | if ( KOPrefs::instance()->mAskForPreferences ) |
1147 | edit_sync_options(); | 1146 | edit_sync_options(); |
1148 | qApp->processEvents(); | 1147 | qApp->processEvents(); |
1149 | CalendarLocal* calendar = new CalendarLocal(); | 1148 | CalendarLocal* calendar = new CalendarLocal(); |
1150 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1149 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1151 | bool syncOK = false; | 1150 | bool syncOK = false; |
1152 | SharpFormat sharpFormat; | 1151 | SharpFormat sharpFormat; |
1153 | if ( sharpFormat.load( calendar, mCalendar ) ) { | 1152 | if ( sharpFormat.load( calendar, mCalendar ) ) { |
1154 | getEventViewerDialog()->setSyncMode( true ); | 1153 | getEventViewerDialog()->setSyncMode( true ); |
1155 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1154 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1156 | getEventViewerDialog()->setSyncMode( false ); | 1155 | getEventViewerDialog()->setSyncMode( false ); |
1157 | qApp->processEvents(); | 1156 | qApp->processEvents(); |
1158 | if ( syncOK ) { | 1157 | if ( syncOK ) { |
1159 | if ( KOPrefs::instance()->mWriteBackFile ) | 1158 | if ( KOPrefs::instance()->mWriteBackFile ) |
1160 | { | 1159 | { |
1161 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1160 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1162 | Incidence* inc = iL.first(); | 1161 | Incidence* inc = iL.first(); |
1162 | /* obsolete | ||
1163 | while ( inc ) { | 1163 | while ( inc ) { |
1164 | inc->setZaurusStat( inc->revision () ); | 1164 | inc->setZaurusStat( inc->revision () ); |
1165 | inc = iL.next(); | 1165 | inc = iL.next(); |
1166 | } | 1166 | } |
1167 | */ | ||
1167 | // pending: clean last sync event description | 1168 | // pending: clean last sync event description |
1168 | sharpFormat.save(calendar); | 1169 | sharpFormat.save(calendar); |
1169 | iL = calendar->rawIncidences(); | 1170 | iL = calendar->rawIncidences(); |
1170 | inc = iL.first(); | 1171 | inc = iL.first(); |
1171 | Incidence* loc; | 1172 | Incidence* loc; |
1172 | while ( inc ) { | 1173 | while ( inc ) { |
1173 | if ( inc->zaurusStat() == -4 ) { | 1174 | if ( inc->zaurusStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1174 | loc = mCalendar->incidence(inc->uid() ); | 1175 | loc = mCalendar->incidence(inc->uid() ); |
1175 | if ( loc ) { | 1176 | if ( loc ) { |
1176 | loc->setZaurusId( inc->zaurusId() ); | 1177 | loc->setZaurusId( inc->zaurusId() ); |
1177 | loc->setZaurusUid( inc->zaurusUid() ); | 1178 | loc->setZaurusUid( inc->zaurusUid() ); |
1178 | } | 1179 | } |
1179 | } | 1180 | } |
1180 | inc = iL.next(); | 1181 | inc = iL.next(); |
1181 | } | 1182 | } |
1182 | Incidence* lse = getLastSyncEvent(); | 1183 | Incidence* lse = getLastSyncEvent(); |
1183 | if ( lse ) { | 1184 | if ( lse ) { |
1184 | lse->setReadOnly( false ); | 1185 | lse->setReadOnly( false ); |
1185 | lse->setDescription( "" ); | 1186 | lse->setDescription( "" ); |
1186 | lse->setReadOnly( true ); | 1187 | lse->setReadOnly( true ); |
1187 | } | 1188 | } |
1188 | } | 1189 | } |
1189 | } | 1190 | } |
1190 | setModified( true ); | 1191 | setModified( true ); |
1191 | } else { | 1192 | } else { |
1192 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1193 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1193 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1194 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1194 | question, i18n("Ok")) ; | 1195 | question, i18n("Ok")) ; |
1195 | 1196 | ||
1196 | } | 1197 | } |
1197 | delete calendar; | 1198 | delete calendar; |
1198 | updateView(); | 1199 | updateView(); |
1199 | return ;//syncOK; | 1200 | return ;//syncOK; |
1200 | #endif | 1201 | #endif |
1201 | } | 1202 | } |
1202 | 1203 | ||
1203 | 1204 | ||
1204 | #include <kabc/stdaddressbook.h> | 1205 | #include <kabc/stdaddressbook.h> |
1205 | bool CalendarView::importBday() | 1206 | bool CalendarView::importBday() |
1206 | { | 1207 | { |
1207 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1208 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1208 | KABC::AddressBook::Iterator it; | 1209 | KABC::AddressBook::Iterator it; |
1209 | int count = 0; | 1210 | int count = 0; |
1210 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1211 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1211 | ++count; | 1212 | ++count; |
1212 | } | 1213 | } |
1213 | QProgressBar bar(count,0 ); | 1214 | QProgressBar bar(count,0 ); |
1214 | int w = 300; | 1215 | int w = 300; |
1215 | if ( QApplication::desktop()->width() < 320 ) | 1216 | if ( QApplication::desktop()->width() < 320 ) |
1216 | w = 220; | 1217 | w = 220; |
1217 | int h = bar.sizeHint().height() ; | 1218 | int h = bar.sizeHint().height() ; |
1218 | int dw = QApplication::desktop()->width(); | 1219 | int dw = QApplication::desktop()->width(); |
1219 | int dh = QApplication::desktop()->height(); | 1220 | int dh = QApplication::desktop()->height(); |
1220 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1221 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1221 | bar.show(); | 1222 | bar.show(); |
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index f83f72e..973f19d 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -1,142 +1,143 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qptrlist.h> | 25 | #include <qptrlist.h> |
26 | #include <qregexp.h> | 26 | #include <qregexp.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qclipboard.h> | 28 | #include <qclipboard.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
32 | #include <qxml.h> | 32 | #include <qxml.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | 34 | ||
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | 38 | ||
39 | #include "calendar.h" | 39 | #include "calendar.h" |
40 | #include "alarm.h" | 40 | #include "alarm.h" |
41 | #include "recurrence.h" | 41 | #include "recurrence.h" |
42 | #include "calendarlocal.h" | 42 | #include "calendarlocal.h" |
43 | 43 | ||
44 | #include "sharpformat.h" | 44 | #include "sharpformat.h" |
45 | #include "syncdefines.h" | ||
45 | 46 | ||
46 | using namespace KCal; | 47 | using namespace KCal; |
47 | 48 | ||
48 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY | 49 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY |
49 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 50 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
50 | 51 | ||
51 | //ARSD silentalarm = 0 | 52 | //ARSD silentalarm = 0 |
52 | // 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly | 53 | // 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly |
53 | // 12 RFRQ | 54 | // 12 RFRQ |
54 | // 13 RPOS pos = 4. monday in month | 55 | // 13 RPOS pos = 4. monday in month |
55 | // 14 RDYS days: 1 mon/ 2 tue .. 64 sun | 56 | // 14 RDYS days: 1 mon/ 2 tue .. 64 sun |
56 | // 15 REND 0 = no end/ 1 = end | 57 | // 15 REND 0 = no end/ 1 = end |
57 | // 16 REDT rec end dt | 58 | // 16 REDT rec end dt |
58 | //ALSD | 59 | //ALSD |
59 | //ALED | 60 | //ALED |
60 | //MDAY | 61 | //MDAY |
61 | 62 | ||
62 | class SharpParser : public QObject | 63 | class SharpParser : public QObject |
63 | { | 64 | { |
64 | public: | 65 | public: |
65 | SharpParser( Calendar *calendar ) : mCalendar( calendar ) { | 66 | SharpParser( Calendar *calendar ) : mCalendar( calendar ) { |
66 | oldCategories = 0; | 67 | oldCategories = 0; |
67 | } | 68 | } |
68 | 69 | ||
69 | bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName ) | 70 | bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName ) |
70 | { | 71 | { |
71 | int i = 1; | 72 | int i = 1; |
72 | bool skip = true; | 73 | bool skip = true; |
73 | int max = attList.count() -2; | 74 | int max = attList.count() -2; |
74 | while ( i < max ) { | 75 | while ( i < max ) { |
75 | if ( !attList[i].isEmpty() ) { | 76 | if ( !attList[i].isEmpty() ) { |
76 | skip = false; | 77 | skip = false; |
77 | break; | 78 | break; |
78 | } | 79 | } |
79 | ++i ; | 80 | ++i ; |
80 | } | 81 | } |
81 | if ( skip ) | 82 | if ( skip ) |
82 | return false; | 83 | return false; |
83 | ulong cSum = SharpFormat::getCsum(attList ); | 84 | ulong cSum = SharpFormat::getCsum(attList ); |
84 | 85 | ||
85 | if ( qName == "Event" ) { | 86 | if ( qName == "Event" ) { |
86 | Event *event; | 87 | Event *event; |
87 | event = existingCalendar->event( attList[0].toInt() ); | 88 | event = existingCalendar->event( attList[0].toInt() ); |
88 | if ( event ) | 89 | if ( event ) |
89 | event = (Event*)event->clone(); | 90 | event = (Event*)event->clone(); |
90 | else | 91 | else |
91 | event = new Event; | 92 | event = new Event; |
92 | event->setZaurusId( attList[0].toInt() ); | 93 | event->setZaurusId( attList[0].toInt() ); |
93 | event->setZaurusUid( cSum ); | 94 | event->setZaurusUid( cSum ); |
94 | event->setZaurusStat( -2 ); | 95 | event->setZaurusStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); |
95 | 96 | ||
96 | event->setSummary( attList[2] ); | 97 | event->setSummary( attList[2] ); |
97 | event->setLocation( attList[3] ); | 98 | event->setLocation( attList[3] ); |
98 | event->setDescription( attList[4] ); | 99 | event->setDescription( attList[4] ); |
99 | if ( attList[7] == "1" ) { | 100 | if ( attList[7] == "1" ) { |
100 | event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) )); | 101 | event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) )); |
101 | event->setDtEnd( QDateTime(fromString( attList[18]+"000000", false ).date(),QTime(0,0,0 ))); | 102 | event->setDtEnd( QDateTime(fromString( attList[18]+"000000", false ).date(),QTime(0,0,0 ))); |
102 | event->setFloats( true ); | 103 | event->setFloats( true ); |
103 | } else { | 104 | } else { |
104 | event->setFloats( false ); | 105 | event->setFloats( false ); |
105 | event->setDtStart( fromString( attList[5] ) ); | 106 | event->setDtStart( fromString( attList[5] ) ); |
106 | event->setDtEnd( fromString( attList[6] )); | 107 | event->setDtEnd( fromString( attList[6] )); |
107 | } | 108 | } |
108 | 109 | ||
109 | QString rtype = attList[11]; | 110 | QString rtype = attList[11]; |
110 | if ( rtype != "255" ) { | 111 | if ( rtype != "255" ) { |
111 | // qDebug("recurs "); | 112 | // qDebug("recurs "); |
112 | QDate startDate = event->dtStart().date(); | 113 | QDate startDate = event->dtStart().date(); |
113 | 114 | ||
114 | QString freqStr = attList[12]; | 115 | QString freqStr = attList[12]; |
115 | int freq = freqStr.toInt(); | 116 | int freq = freqStr.toInt(); |
116 | 117 | ||
117 | QString hasEndDateStr = attList[15] ; | 118 | QString hasEndDateStr = attList[15] ; |
118 | bool hasEndDate = hasEndDateStr == "1"; | 119 | bool hasEndDate = hasEndDateStr == "1"; |
119 | 120 | ||
120 | QString endDateStr = attList[16]; | 121 | QString endDateStr = attList[16]; |
121 | QDate endDate = fromString( endDateStr ).date(); | 122 | QDate endDate = fromString( endDateStr ).date(); |
122 | 123 | ||
123 | QString weekDaysStr = attList[14]; | 124 | QString weekDaysStr = attList[14]; |
124 | uint weekDaysNum = weekDaysStr.toInt(); | 125 | uint weekDaysNum = weekDaysStr.toInt(); |
125 | 126 | ||
126 | QBitArray weekDays( 7 ); | 127 | QBitArray weekDays( 7 ); |
127 | int i; | 128 | int i; |
128 | int bb = 1; | 129 | int bb = 1; |
129 | for( i = 1; i <= 7; ++i ) { | 130 | for( i = 1; i <= 7; ++i ) { |
130 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); | 131 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); |
131 | bb = 2 << (i-1); | 132 | bb = 2 << (i-1); |
132 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); | 133 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); |
133 | } | 134 | } |
134 | // qDebug("next "); | 135 | // qDebug("next "); |
135 | QString posStr = attList[13]; | 136 | QString posStr = attList[13]; |
136 | int pos = posStr.toInt(); | 137 | int pos = posStr.toInt(); |
137 | Recurrence *r = event->recurrence(); | 138 | Recurrence *r = event->recurrence(); |
138 | 139 | ||
139 | if ( rtype == "0" ) { | 140 | if ( rtype == "0" ) { |
140 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 141 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
141 | else r->setDaily( freq, -1 ); | 142 | else r->setDaily( freq, -1 ); |
142 | } else if ( rtype == "1" ) { | 143 | } else if ( rtype == "1" ) { |
@@ -157,97 +158,97 @@ class SharpParser : public QObject | |||
157 | days.fill( false ); | 158 | days.fill( false ); |
158 | days.setBit( startDate.dayOfWeek() - 1 ); | 159 | days.setBit( startDate.dayOfWeek() - 1 ); |
159 | r->addMonthlyPos( pos, days ); | 160 | r->addMonthlyPos( pos, days ); |
160 | } else if ( rtype == "4" ) { | 161 | } else if ( rtype == "4" ) { |
161 | if ( hasEndDate ) | 162 | if ( hasEndDate ) |
162 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 163 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
163 | else | 164 | else |
164 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 165 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
165 | r->addYearlyNum( startDate.month() ); | 166 | r->addYearlyNum( startDate.month() ); |
166 | } | 167 | } |
167 | } | 168 | } |
168 | 169 | ||
169 | QString categoryList = attList[1] ; | 170 | QString categoryList = attList[1] ; |
170 | event->setCategories( lookupCategories( categoryList ) ); | 171 | event->setCategories( lookupCategories( categoryList ) ); |
171 | 172 | ||
172 | // strange 0 semms to mean: alarm enabled | 173 | // strange 0 semms to mean: alarm enabled |
173 | if ( attList[8] == "0" ) { | 174 | if ( attList[8] == "0" ) { |
174 | Alarm *alarm; | 175 | Alarm *alarm; |
175 | if ( event->alarms().count() > 0 ) | 176 | if ( event->alarms().count() > 0 ) |
176 | alarm = event->alarms().first(); | 177 | alarm = event->alarms().first(); |
177 | else { | 178 | else { |
178 | alarm = new Alarm( event ); | 179 | alarm = new Alarm( event ); |
179 | event->addAlarm( alarm ); | 180 | event->addAlarm( alarm ); |
180 | } | 181 | } |
181 | alarm->setType( Alarm::Audio ); | 182 | alarm->setType( Alarm::Audio ); |
182 | alarm->setEnabled( true ); | 183 | alarm->setEnabled( true ); |
183 | int alarmOffset = attList[9].toInt(); | 184 | int alarmOffset = attList[9].toInt(); |
184 | alarm->setStartOffset( alarmOffset * -60 ); | 185 | alarm->setStartOffset( alarmOffset * -60 ); |
185 | } | 186 | } |
186 | 187 | ||
187 | mCalendar->addEvent( event); | 188 | mCalendar->addEvent( event); |
188 | } else if ( qName == "Todo" ) { | 189 | } else if ( qName == "Todo" ) { |
189 | Todo *todo; | 190 | Todo *todo; |
190 | 191 | ||
191 | todo = existingCalendar->todo( attList[0].toInt() ); | 192 | todo = existingCalendar->todo( attList[0].toInt() ); |
192 | if (todo ) | 193 | if (todo ) |
193 | todo = (Todo*)todo->clone(); | 194 | todo = (Todo*)todo->clone(); |
194 | else | 195 | else |
195 | todo = new Todo; | 196 | todo = new Todo; |
196 | 197 | ||
197 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 | 198 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 |
198 | // 0 1 2 3 4 5 6 7 8 | 199 | // 0 1 2 3 4 5 6 7 8 |
199 | //1,,,,,1,4,Loch zumachen,"" | 200 | //1,,,,,1,4,Loch zumachen,"" |
200 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " | 201 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " |
201 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes | 202 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes |
202 | 203 | ||
203 | todo->setZaurusId( attList[0].toInt() ); | 204 | todo->setZaurusId( attList[0].toInt() ); |
204 | todo->setZaurusUid( cSum ); | 205 | todo->setZaurusUid( cSum ); |
205 | todo->setZaurusStat( -2 ); | 206 | todo->setZaurusStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
206 | 207 | ||
207 | todo->setSummary( attList[7] ); | 208 | todo->setSummary( attList[7] ); |
208 | todo->setDescription( attList[8]); | 209 | todo->setDescription( attList[8]); |
209 | 210 | ||
210 | int priority = attList[6].toInt(); | 211 | int priority = attList[6].toInt(); |
211 | if ( priority == 0 ) priority = 3; | 212 | if ( priority == 0 ) priority = 3; |
212 | todo->setPriority( priority ); | 213 | todo->setPriority( priority ); |
213 | 214 | ||
214 | QString categoryList = attList[1]; | 215 | QString categoryList = attList[1]; |
215 | todo->setCategories( lookupCategories( categoryList ) ); | 216 | todo->setCategories( lookupCategories( categoryList ) ); |
216 | 217 | ||
217 | 218 | ||
218 | 219 | ||
219 | QString hasDateStr = attList[3]; // due | 220 | QString hasDateStr = attList[3]; // due |
220 | if ( !hasDateStr.isEmpty() ) { | 221 | if ( !hasDateStr.isEmpty() ) { |
221 | if ( hasDateStr.right(6) == "000000" ) { | 222 | if ( hasDateStr.right(6) == "000000" ) { |
222 | todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); | 223 | todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); |
223 | todo->setFloats( true ); | 224 | todo->setFloats( true ); |
224 | } | 225 | } |
225 | else { | 226 | else { |
226 | todo->setDtDue( fromString( hasDateStr ) ); | 227 | todo->setDtDue( fromString( hasDateStr ) ); |
227 | todo->setFloats( false ); | 228 | todo->setFloats( false ); |
228 | } | 229 | } |
229 | 230 | ||
230 | todo->setHasDueDate( true ); | 231 | todo->setHasDueDate( true ); |
231 | } | 232 | } |
232 | hasDateStr = attList[2];//start | 233 | hasDateStr = attList[2];//start |
233 | if ( !hasDateStr.isEmpty() ) { | 234 | if ( !hasDateStr.isEmpty() ) { |
234 | 235 | ||
235 | todo->setDtStart( fromString( hasDateStr ) ); | 236 | todo->setDtStart( fromString( hasDateStr ) ); |
236 | todo->setHasStartDate( true); | 237 | todo->setHasStartDate( true); |
237 | } else | 238 | } else |
238 | todo->setHasStartDate( false ); | 239 | todo->setHasStartDate( false ); |
239 | hasDateStr = attList[4];//completed | 240 | hasDateStr = attList[4];//completed |
240 | if ( !hasDateStr.isEmpty() ) { | 241 | if ( !hasDateStr.isEmpty() ) { |
241 | todo->setCompleted(fromString( hasDateStr ) ); | 242 | todo->setCompleted(fromString( hasDateStr ) ); |
242 | } | 243 | } |
243 | QString completedStr = attList[5]; | 244 | QString completedStr = attList[5]; |
244 | if ( completedStr == "0" ) | 245 | if ( completedStr == "0" ) |
245 | todo->setCompleted( true ); | 246 | todo->setCompleted( true ); |
246 | else | 247 | else |
247 | todo->setCompleted( false ); | 248 | todo->setCompleted( false ); |
248 | mCalendar->addTodo( todo ); | 249 | mCalendar->addTodo( todo ); |
249 | 250 | ||
250 | } else if ( qName == "Category" ) { | 251 | } else if ( qName == "Category" ) { |
251 | /* | 252 | /* |
252 | QString id = attributes.value( "id" ); | 253 | QString id = attributes.value( "id" ); |
253 | QString name = attributes.value( "name" ); | 254 | QString name = attributes.value( "name" ); |
@@ -422,226 +423,226 @@ bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) | |||
422 | status.raise(); | 423 | status.raise(); |
423 | qApp->processEvents(); | 424 | qApp->processEvents(); |
424 | fromString2Cal( calendar, existngCal, text, "Todo" ); | 425 | fromString2Cal( calendar, existngCal, text, "Todo" ); |
425 | return true; | 426 | return true; |
426 | } | 427 | } |
427 | int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | 428 | int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) |
428 | { | 429 | { |
429 | int retval = -1; | 430 | int retval = -1; |
430 | QStringList templist; | 431 | QStringList templist; |
431 | QString tempString; | 432 | QString tempString; |
432 | int start = 0; | 433 | int start = 0; |
433 | int len = answer.length(); | 434 | int len = answer.length(); |
434 | int end = answer.find ("\n",start)+1; | 435 | int end = answer.find ("\n",start)+1; |
435 | bool ok = true; | 436 | bool ok = true; |
436 | start = end; | 437 | start = end; |
437 | int ccc = 0; | 438 | int ccc = 0; |
438 | while ( start > 0 ) { | 439 | while ( start > 0 ) { |
439 | templist.clear(); | 440 | templist.clear(); |
440 | ok = true; | 441 | ok = true; |
441 | int loopCount = 0; | 442 | int loopCount = 0; |
442 | while ( ok ) { | 443 | while ( ok ) { |
443 | ++loopCount; | 444 | ++loopCount; |
444 | if ( loopCount > 25 ) { | 445 | if ( loopCount > 25 ) { |
445 | qDebug("KO: Error in while loop"); | 446 | qDebug("KO: Error in while loop"); |
446 | ok = false; | 447 | ok = false; |
447 | start = 0; | 448 | start = 0; |
448 | break; | 449 | break; |
449 | } | 450 | } |
450 | if ( ok ) | 451 | if ( ok ) |
451 | tempString = getPart( answer, ok, start ); | 452 | tempString = getPart( answer, ok, start ); |
452 | if ( start >= len || start == 0 ) { | 453 | if ( start >= len || start == 0 ) { |
453 | start = 0; | 454 | start = 0; |
454 | ok = false; | 455 | ok = false; |
455 | } | 456 | } |
456 | if ( tempString.right(1) =="\n" ) | 457 | if ( tempString.right(1) =="\n" ) |
457 | tempString = tempString.left( tempString.length()-1); | 458 | tempString = tempString.left( tempString.length()-1); |
458 | 459 | ||
459 | templist.append( tempString ); | 460 | templist.append( tempString ); |
460 | } | 461 | } |
461 | ++ccc; | 462 | ++ccc; |
462 | if ( ccc == 2 && loopCount < 25 ) { | 463 | if ( ccc == 2 && loopCount < 25 ) { |
463 | start = 0; | 464 | start = 0; |
464 | bool ok; | 465 | bool ok; |
465 | int newnum = templist[0].toInt( &ok ); | 466 | int newnum = templist[0].toInt( &ok ); |
466 | if ( ok && newnum > 0) { | 467 | if ( ok && newnum > 0) { |
467 | retval = newnum; | 468 | retval = newnum; |
468 | inc->setZaurusId( newnum ); | 469 | inc->setZaurusId( newnum ); |
469 | inc->setZaurusUid( getCsum( templist ) ); | 470 | inc->setZaurusUid( getCsum( templist ) ); |
470 | inc->setZaurusStat( -4 ); | 471 | inc->setZaurusStat( SYNC_TEMPSTATE_NEW_ID ); |
471 | } | 472 | } |
472 | } | 473 | } |
473 | } | 474 | } |
474 | //qDebug("getNumFromRecord returning : %d ", retval); | 475 | //qDebug("getNumFromRecord returning : %d ", retval); |
475 | return retval; | 476 | return retval; |
476 | } | 477 | } |
477 | bool SharpFormat::save( Calendar *calendar) | 478 | bool SharpFormat::save( Calendar *calendar) |
478 | { | 479 | { |
479 | 480 | ||
480 | QLabel status ( i18n("Processing/adding events ..."), 0 ); | 481 | QLabel status ( i18n("Processing/adding events ..."), 0 ); |
481 | int w = status.sizeHint().width()+20 ; | 482 | int w = status.sizeHint().width()+20 ; |
482 | if ( w < 200 ) w = 200; | 483 | if ( w < 200 ) w = 200; |
483 | int h = status.sizeHint().height()+20 ; | 484 | int h = status.sizeHint().height()+20 ; |
484 | int dw = QApplication::desktop()->width(); | 485 | int dw = QApplication::desktop()->width(); |
485 | int dh = QApplication::desktop()->height(); | 486 | int dh = QApplication::desktop()->height(); |
486 | status.setCaption(i18n("Writing DTM Data") ); | 487 | status.setCaption(i18n("Writing DTM Data") ); |
487 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 488 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
488 | status.show(); | 489 | status.show(); |
489 | status.raise(); | 490 | status.raise(); |
490 | qApp->processEvents(); | 491 | qApp->processEvents(); |
491 | bool debug = DEBUGMODE; | 492 | bool debug = DEBUGMODE; |
492 | QString codec = "utf8"; | 493 | QString codec = "utf8"; |
493 | QString answer; | 494 | QString answer; |
494 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; | 495 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; |
495 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; | 496 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; |
496 | QString command; | 497 | QString command; |
497 | QPtrList<Event> er = calendar->rawEvents(); | 498 | QPtrList<Event> er = calendar->rawEvents(); |
498 | Event* ev = er.first(); | 499 | Event* ev = er.first(); |
499 | QString fileName = "/tmp/kopitempout"; | 500 | QString fileName = "/tmp/kopitempout"; |
500 | int i = 0; | 501 | int i = 0; |
501 | QString changeString = ePrefix; | 502 | QString changeString = ePrefix; |
502 | QString deleteString = ePrefix; | 503 | QString deleteString = ePrefix; |
503 | bool deleteEnt = false; | 504 | bool deleteEnt = false; |
504 | bool changeEnt = false; | 505 | bool changeEnt = false; |
505 | QString message = i18n("Processing event # "); | 506 | QString message = i18n("Processing event # "); |
506 | int procCount = 0; | 507 | int procCount = 0; |
507 | while ( ev ) { | 508 | while ( ev ) { |
508 | //qDebug("i %d ", ++i); | 509 | //qDebug("i %d ", ++i); |
509 | if ( ev->zaurusStat() != -2 ) { | 510 | if ( ev->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
510 | status.setText ( message + QString::number ( ++procCount ) ); | 511 | status.setText ( message + QString::number ( ++procCount ) ); |
511 | qApp->processEvents(); | 512 | qApp->processEvents(); |
512 | QString eString = getEventString( ev ); | 513 | QString eString = getEventString( ev ); |
513 | if ( ev->zaurusStat() == -3 ) { // delete | 514 | if ( ev->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete |
514 | // deleting empty strings does not work. | 515 | // deleting empty strings does not work. |
515 | // we write first and x and then delete the record with the x | 516 | // we write first and x and then delete the record with the x |
516 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 517 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
517 | changeString += eString + "\n"; | 518 | changeString += eString + "\n"; |
518 | deleteString += eString + "\n"; | 519 | deleteString += eString + "\n"; |
519 | deleteEnt = true; | 520 | deleteEnt = true; |
520 | changeEnt = true; | 521 | changeEnt = true; |
521 | } | 522 | } |
522 | else if ( ev->zaurusId() == -1 ) { // add new | 523 | else if ( ev->zaurusId() == -1 ) { // add new |
523 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 524 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
524 | system ( command.utf8() ); | 525 | system ( command.utf8() ); |
525 | QFile file( fileName ); | 526 | QFile file( fileName ); |
526 | if (!file.open( IO_ReadOnly ) ) { | 527 | if (!file.open( IO_ReadOnly ) ) { |
527 | return false; | 528 | return false; |
528 | 529 | ||
529 | } | 530 | } |
530 | QTextStream ts( &file ); | 531 | QTextStream ts( &file ); |
531 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 532 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
532 | answer = ts.read(); | 533 | answer = ts.read(); |
533 | file.close(); | 534 | file.close(); |
534 | //qDebug("answer \n%s ", answer.latin1()); | 535 | //qDebug("answer \n%s ", answer.latin1()); |
535 | getNumFromRecord( answer, ev ) ; | 536 | getNumFromRecord( answer, ev ) ; |
536 | 537 | ||
537 | } | 538 | } |
538 | else { // change existing | 539 | else { // change existing |
539 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); | 540 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); |
540 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 541 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
541 | changeString += eString + "\n"; | 542 | changeString += eString + "\n"; |
542 | changeEnt = true; | 543 | changeEnt = true; |
543 | 544 | ||
544 | } | 545 | } |
545 | } | 546 | } |
546 | ev = er.next(); | 547 | ev = er.next(); |
547 | } | 548 | } |
548 | status.setText ( i18n("Changing events ...") ); | 549 | status.setText ( i18n("Changing events ...") ); |
549 | qApp->processEvents(); | 550 | qApp->processEvents(); |
550 | //qDebug("changing... "); | 551 | //qDebug("changing... "); |
551 | if ( changeEnt ) { | 552 | if ( changeEnt ) { |
552 | QFile file( fileName ); | 553 | QFile file( fileName ); |
553 | if (!file.open( IO_WriteOnly ) ) { | 554 | if (!file.open( IO_WriteOnly ) ) { |
554 | return false; | 555 | return false; |
555 | 556 | ||
556 | } | 557 | } |
557 | QTextStream ts( &file ); | 558 | QTextStream ts( &file ); |
558 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 559 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
559 | ts << changeString ; | 560 | ts << changeString ; |
560 | file.close(); | 561 | file.close(); |
561 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; | 562 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; |
562 | system ( command.latin1() ); | 563 | system ( command.latin1() ); |
563 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 564 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
564 | 565 | ||
565 | } | 566 | } |
566 | status.setText ( i18n("Deleting events ...") ); | 567 | status.setText ( i18n("Deleting events ...") ); |
567 | qApp->processEvents(); | 568 | qApp->processEvents(); |
568 | //qDebug("deleting... "); | 569 | //qDebug("deleting... "); |
569 | if ( deleteEnt ) { | 570 | if ( deleteEnt ) { |
570 | QFile file( fileName ); | 571 | QFile file( fileName ); |
571 | if (!file.open( IO_WriteOnly ) ) { | 572 | if (!file.open( IO_WriteOnly ) ) { |
572 | return false; | 573 | return false; |
573 | 574 | ||
574 | } | 575 | } |
575 | QTextStream ts( &file ); | 576 | QTextStream ts( &file ); |
576 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 577 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
577 | ts << deleteString; | 578 | ts << deleteString; |
578 | file.close(); | 579 | file.close(); |
579 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; | 580 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; |
580 | system ( command.latin1() ); | 581 | system ( command.latin1() ); |
581 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 582 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
582 | } | 583 | } |
583 | 584 | ||
584 | 585 | ||
585 | changeString = tPrefix; | 586 | changeString = tPrefix; |
586 | deleteString = tPrefix; | 587 | deleteString = tPrefix; |
587 | status.setText ( i18n("Processing todos ...") ); | 588 | status.setText ( i18n("Processing todos ...") ); |
588 | qApp->processEvents(); | 589 | qApp->processEvents(); |
589 | QPtrList<Todo> tl = calendar->rawTodos(); | 590 | QPtrList<Todo> tl = calendar->rawTodos(); |
590 | Todo* to = tl.first(); | 591 | Todo* to = tl.first(); |
591 | i = 0; | 592 | i = 0; |
592 | message = i18n("Processing todo # "); | 593 | message = i18n("Processing todo # "); |
593 | procCount = 0; | 594 | procCount = 0; |
594 | while ( to ) { | 595 | while ( to ) { |
595 | if ( to->zaurusStat() != -2 ) { | 596 | if ( to->zaurusStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
596 | status.setText ( message + QString::number ( ++procCount ) ); | 597 | status.setText ( message + QString::number ( ++procCount ) ); |
597 | qApp->processEvents(); | 598 | qApp->processEvents(); |
598 | QString eString = getTodoString( to ); | 599 | QString eString = getTodoString( to ); |
599 | if ( to->zaurusStat() == -3 ) { // delete | 600 | if ( to->zaurusStat() == SYNC_TEMPSTATE_DELETE ) { // delete |
600 | // deleting empty strings does not work. | 601 | // deleting empty strings does not work. |
601 | // we write first and x and then delete the record with the x | 602 | // we write first and x and then delete the record with the x |
602 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 603 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
603 | changeString += eString + "\n"; | 604 | changeString += eString + "\n"; |
604 | deleteString += eString + "\n"; | 605 | deleteString += eString + "\n"; |
605 | deleteEnt = true; | 606 | deleteEnt = true; |
606 | changeEnt = true; | 607 | changeEnt = true; |
607 | } | 608 | } |
608 | else if ( to->zaurusId() == -1 ) { // add new | 609 | else if ( to->zaurusId() == -1 ) { // add new |
609 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; | 610 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; |
610 | system ( command.utf8() ); | 611 | system ( command.utf8() ); |
611 | QFile file( fileName ); | 612 | QFile file( fileName ); |
612 | if (!file.open( IO_ReadOnly ) ) { | 613 | if (!file.open( IO_ReadOnly ) ) { |
613 | return false; | 614 | return false; |
614 | 615 | ||
615 | } | 616 | } |
616 | QTextStream ts( &file ); | 617 | QTextStream ts( &file ); |
617 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 618 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
618 | answer = ts.read(); | 619 | answer = ts.read(); |
619 | file.close(); | 620 | file.close(); |
620 | //qDebug("answer \n%s ", answer.latin1()); | 621 | //qDebug("answer \n%s ", answer.latin1()); |
621 | getNumFromRecord( answer, to ) ; | 622 | getNumFromRecord( answer, to ) ; |
622 | 623 | ||
623 | } | 624 | } |
624 | else { // change existing | 625 | else { // change existing |
625 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); | 626 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); |
626 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 627 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
627 | changeString += eString + "\n"; | 628 | changeString += eString + "\n"; |
628 | changeEnt = true; | 629 | changeEnt = true; |
629 | 630 | ||
630 | } | 631 | } |
631 | } | 632 | } |
632 | 633 | ||
633 | to = tl.next(); | 634 | to = tl.next(); |
634 | } | 635 | } |
635 | status.setText ( i18n("Changing todos ...") ); | 636 | status.setText ( i18n("Changing todos ...") ); |
636 | qApp->processEvents(); | 637 | qApp->processEvents(); |
637 | //qDebug("changing... "); | 638 | //qDebug("changing... "); |
638 | if ( changeEnt ) { | 639 | if ( changeEnt ) { |
639 | QFile file( fileName ); | 640 | QFile file( fileName ); |
640 | if (!file.open( IO_WriteOnly ) ) { | 641 | if (!file.open( IO_WriteOnly ) ) { |
641 | return false; | 642 | return false; |
642 | 643 | ||
643 | } | 644 | } |
644 | QTextStream ts( &file ); | 645 | QTextStream ts( &file ); |
645 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 646 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
646 | ts << changeString ; | 647 | ts << changeString ; |
647 | file.close(); | 648 | file.close(); |
diff --git a/libkcal/syncdefines.h b/libkcal/syncdefines.h new file mode 100644 index 0000000..57642ec --- a/dev/null +++ b/libkcal/syncdefines.h | |||
@@ -0,0 +1,22 @@ | |||
1 | |||
2 | #ifndef _KSYNC_DEFINES_H_ | ||
3 | #define _KSYNC_DEFINES_H_ | ||
4 | |||
5 | #define SYNC_PREF_LOCAL 0 | ||
6 | #define SYNC_PREF_REMOTE 1 | ||
7 | #define SYNC_PREF_NEWEST 2 | ||
8 | #define SYNC_PREF_ASK 3 | ||
9 | #define SYNC_PREF_FORCE_LOCAL 4 | ||
10 | #define SYNC_PREF_FORCE_REMOTE 5 | ||
11 | #define SYNC_PREF_TAKE_BOTH 6 | ||
12 | |||
13 | #define SYNC_MODE_NORMAL 0 | ||
14 | #define SYNC_MODE_EXTERNAL 1 | ||
15 | |||
16 | #define SYNC_TEMPSTATE_INITIAL 0 | ||
17 | #define SYNC_TEMPSTATE_NEW_EXTERNAL -2 | ||
18 | #define SYNC_TEMPSTATE_DELETE -3 | ||
19 | #define SYNC_TEMPSTATE_NEW_ID -4 | ||
20 | |||
21 | |||
22 | #endif | ||
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 238ffad..3f7f1ac 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h | |||
@@ -1,84 +1,80 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef _KSYNCPROFILE_H | 20 | #ifndef _KSYNCPROFILE_H |
21 | #define _KSYNCPROFILE_H | 21 | #define _KSYNCPROFILE_H |
22 | 22 | ||
23 | #include <qptrlist.h> | 23 | #include <qptrlist.h> |
24 | #include <qcolor.h> | 24 | #include <qcolor.h> |
25 | #include <qfont.h> | 25 | #include <qfont.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | 29 | ||
30 | #define SYNC_PREF_LOCAL 0 | 30 | #include <libkcal/syncdefines.h> |
31 | #define SYNC_PREF_REMOTE 1 | 31 | |
32 | #define SYNC_PREF_NEWEST 2 | 32 | |
33 | #define SYNC_PREF_ASK 3 | ||
34 | #define SYNC_PREF_FORCE_LOCAL 4 | ||
35 | #define SYNC_PREF_FORCE_REMOTE 5 | ||
36 | #define SYNC_PREF_TAKE_BOTH 6 | ||
37 | 33 | ||
38 | class KConfig; | 34 | class KConfig; |
39 | 35 | ||
40 | /** | 36 | /** |
41 | @short Class for storing a preferences setting | 37 | @short Class for storing a preferences setting |
42 | @author Cornelius Schumacher | 38 | @author Cornelius Schumacher |
43 | @see KPref | 39 | @see KPref |
44 | 40 | ||
45 | This class represents one preferences setting as used by @ref KPrefs. | 41 | This class represents one preferences setting as used by @ref KPrefs. |
46 | Subclasses of KPrefsItem implement storage functions for a certain type of | 42 | Subclasses of KPrefsItem implement storage functions for a certain type of |
47 | setting. Normally you don't have to use this class directly. Use the special | 43 | setting. Normally you don't have to use this class directly. Use the special |
48 | addItem() functions of KPrefs instead. If you subclass this class you will | 44 | addItem() functions of KPrefs instead. If you subclass this class you will |
49 | have to register instances with the function KPrefs::addItem(). | 45 | have to register instances with the function KPrefs::addItem(). |
50 | */ | 46 | */ |
51 | class KSyncProfile : public QObject { | 47 | class KSyncProfile : public QObject { |
52 | public: | 48 | public: |
53 | KSyncProfile( const char * name = 0); | 49 | KSyncProfile( const char * name = 0); |
54 | ~KSyncProfile() ; | 50 | ~KSyncProfile() ; |
55 | 51 | ||
56 | KSyncProfile* clone(); | 52 | KSyncProfile* clone(); |
57 | void setDefault(); | 53 | void setDefault(); |
58 | void readConfig(KConfig *); | 54 | void readConfig(KConfig *); |
59 | void writeConfig(KConfig *); | 55 | void writeConfig(KConfig *); |
60 | void setName( const QString& n ) {mName = n;} | 56 | void setName( const QString& n ) {mName = n;} |
61 | QString getName( ) { return mName;} | 57 | QString getName( ) { return mName;} |
62 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} | 58 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} |
63 | QString getPreSyncCommand( ) { return mPreSyncCommand; } | 59 | QString getPreSyncCommand( ) { return mPreSyncCommand; } |
64 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} | 60 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} |
65 | QString getPostSyncCommand( ) { return mPostSyncCommand;} | 61 | QString getPostSyncCommand( ) { return mPostSyncCommand;} |
66 | 62 | ||
67 | void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} | 63 | void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} |
68 | QString getLocalTempFile( ) { return mLocalTempFile;} | 64 | QString getLocalTempFile( ) { return mLocalTempFile;} |
69 | void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} | 65 | void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} |
70 | QString getRemoteFileName( ) { return mRemoteFileName;} | 66 | QString getRemoteFileName( ) { return mRemoteFileName;} |
71 | /* | 67 | /* |
72 | void set( const QString& n ) { = n;} | 68 | void set( const QString& n ) { = n;} |
73 | QString get( ) { return ;} | 69 | QString get( ) { return ;} |
74 | */ | 70 | */ |
75 | 71 | ||
76 | void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} | 72 | void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} |
77 | bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} | 73 | bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} |
78 | void setAskForPreferences( bool b ) { mAskForPreferences= b;} | 74 | void setAskForPreferences( bool b ) { mAskForPreferences= b;} |
79 | bool getAskForPreferences( ) { return mAskForPreferences;} | 75 | bool getAskForPreferences( ) { return mAskForPreferences;} |
80 | void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} | 76 | void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} |
81 | bool getWriteBackExisting( ) { return mWriteBackExisting;} | 77 | bool getWriteBackExisting( ) { return mWriteBackExisting;} |
82 | void setWriteBackFile( bool b ) { mWriteBackFile= b;} | 78 | void setWriteBackFile( bool b ) { mWriteBackFile= b;} |
83 | bool getWriteBackFile( ) { return mWriteBackFile;} | 79 | bool getWriteBackFile( ) { return mWriteBackFile;} |
84 | void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} | 80 | void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} |