summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-28 18:28:07 (UTC)
committer zautrix <zautrix>2004-10-28 18:28:07 (UTC)
commit43f40fe1bbc57d3b57d2a715accb51a7c8e473e1 (patch) (unidiff)
treea85c2f1229f4c4d9391719c414add5fe9d4f4480
parenta9ca33a6c78026396ff081572e96f0d1e3eb63fa (diff)
downloadkdepimpi-43f40fe1bbc57d3b57d2a715accb51a7c8e473e1.zip
kdepimpi-43f40fe1bbc57d3b57d2a715accb51a7c8e473e1.tar.gz
kdepimpi-43f40fe1bbc57d3b57d2a715accb51a7c8e473e1.tar.bz2
makefile back
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile619
-rw-r--r--kaddressbook/kabcore.cpp1
-rw-r--r--korganizer/calendarview.cpp1
3 files changed, 369 insertions, 252 deletions
diff --git a/Makefile b/Makefile
index dbc91ad..467710f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,253 +1,368 @@
1############################################################################# 1export KDEPIMDIR = $(shell pwd)
2# Makefile for building: kdepim-desktop 2
3# Generated by qmake (1.07a) (Qt 3.3.1) on: Thu Oct 28 15:32:28 2004 3export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version)
4# Project: kdepim-desktop.pro 4
5# Template: subdirs 5ifeq ($(PLATFORM) , zaurus)
6# Command: $(QMAKE) -o Makefile kdepim-desktop.pro 6 BUILD_NO_LDAP_PLUGIN=1
7############################################################################# 7endif
8 8
9 MAKEFILE =Makefile 9ifneq ($(PLATFORM) , zaurus)
10 QMAKE =qmake 10 BUILD_NO_SHARP_PLUGIN=1
11DEL_FILE = rm -f 11endif
12CHK_DIR_EXISTS= test -d 12
13MKDIR = mkdir -p 13#opie plugin is deprecated. The qtopia plugin handles the task from now on.
14 SUBTARGETS = \ 14BUILD_NO_OPIE_PLUGIN=1
15 sub-gammu-emb-common \ 15
16 sub-gammu-emb-gammu \ 16SUBDIRS_MICROKDE = \
17 sub-libical \ 17 libical/src/libical \
18 sub-libkcal \ 18 libical/src/libicalss \
19 sub-microkde \ 19 qtcompat \
20 sub-libkdepim \ 20 microkde \
21 sub-kabc \ 21 libkcal \
22 sub-korganizer \ 22 libkdepim \
23 sub-kaddressbook \ 23 kabc \
24 sub-kabc-plugins-file \ 24 kabc/formats/binary \
25 sub-kabc-plugins-dir \ 25 kabc/plugins/file \
26 sub-kabc-plugins-file \ 26 kabc/plugins/dir \
27 sub-kabc-plugins-qtopia \ 27 korganizer \
28 sub-pwmanager-libcrypt-cipher \ 28 kalarmd \
29 sub-pwmanager-libcrypt-error \ 29 kaddressbook
30 sub-pwmanager-libcrypt-mpi \ 30
31 sub-pwmanager-libcrypt-zlib \ 31SUBDIRS_QTOPIA_PLUGIN = \
32 sub-pwmanager-pwmanager 32 kabc/plugins/qtopia
33 33
34first: all 34SUBDIRS_OPIE_PLUGIN = \
35 35 kabc/plugins/opie
36all: Makefile $(SUBTARGETS) 36
37 37SUBDIRS_SHARP_PLUGIN = \
38gammu/emb/common/$(MAKEFILE): 38 kabc/plugins/sharpdtm
39 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" 39
40 cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE) 40SUBDIRS_LDAP_PLUGIN = \
41sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE 41 kabc/plugins/ldap
42 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) 42
43 43SUBDIRS_MICROMAIL = \
44gammu/emb/gammu/$(MAKEFILE): 44 kmicromail/libetpan \
45 @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu" 45 kmicromail/libmailwrapper \
46 cd gammu/emb/gammu && $(QMAKE) gammu.pro -o $(MAKEFILE) 46 kmicromail
47sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE 47
48 cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE) 48SUBDIRS_GAMMU = \
49 49 gammu/emb/common \
50libical/$(MAKEFILE): 50 gammu/emb/gammu
51 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" 51
52 cd libical && $(QMAKE) libical.pro -o $(MAKEFILE) 52SUBDIRS_PWMANAGER = \
53sub-libical: libical/$(MAKEFILE) FORCE 53 pwmanager/libcrypt/mpi \
54 cd libical && $(MAKE) -f $(MAKEFILE) 54 pwmanager/libcrypt/error \
55 55 pwmanager/libcrypt/cipher \
56libkcal/$(MAKEFILE): 56 pwmanager/libcrypt/zlib \
57 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" 57 pwmanager/pwmanager
58 cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE) 58
59sub-libkcal: libkcal/$(MAKEFILE) FORCE 59SUBDIRS = \
60 cd libkcal && $(MAKE) -f $(MAKEFILE) 60 $(SUBDIRS_MICROKDE) \
61 61 $(SUBDIRS_QTOPIA_PLUGIN) \
62microkde/$(MAKEFILE): 62 $(SUBDIRS_OPIE_PLUGIN) \
63 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" 63 $(SUBDIRS_SHARP_PLUGIN) \
64 cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE) 64 $(SUBDIRS_LDAP_PLUGIN) \
65sub-microkde: microkde/$(MAKEFILE) FORCE 65 $(SUBDIRS_MICROMAIL) \
66 cd microkde && $(MAKE) -f $(MAKEFILE) 66 $(SUBDIRS_GAMMU) \
67 67 $(SUBDIRS_PWMANAGER)
68libkdepim/$(MAKEFILE): 68
69 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" 69
70 cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE) 70all: build_microkde \
71sub-libkdepim: libkdepim/$(MAKEFILE) FORCE 71 build_qtopia_plugin \
72 cd libkdepim && $(MAKE) -f $(MAKEFILE) 72 build_opie_plugin \
73 73 build_sharp_plugin \
74kabc/$(MAKEFILE): 74 build_ldap_plugin \
75 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" 75 build_micromail \
76 cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE) 76 build_gammu \
77sub-kabc: kabc/$(MAKEFILE) FORCE 77 build_pwmanager
78 cd kabc && $(MAKE) -f $(MAKEFILE) 78
79 79
80korganizer/$(MAKEFILE): 80build_microkde: variable_test tmake
81 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" 81 for i in $(SUBDIRS_MICROKDE); do pushd $$i; \
82 cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE) 82 make -f Makefile$(PLATFORM) || exit 1; popd; \
83sub-korganizer: korganizer/$(MAKEFILE) FORCE 83 done
84 cd korganizer && $(MAKE) -f $(MAKEFILE) 84
85 85build_qtopia_plugin: build_microkde
86kaddressbook/$(MAKEFILE): 86 ifdef BUILD_NO_QTOPIA_PLUGIN
87 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook" 87 @echo == qtopia plugin not build.
88 cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE) 88 else
89sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE 89 for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \
90 cd kaddressbook && $(MAKE) -f $(MAKEFILE) 90 make -f Makefile$(PLATFORM) || exit 1; popd; \
91 91 done
92kabc/plugins/file/$(MAKEFILE): 92 endif
93 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" 93
94 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE) 94build_opie_plugin: build_microkde
95sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE 95 ifdef BUILD_NO_OPIE_PLUGIN
96 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) 96 @echo == opie plugin not build.
97 97 else
98kabc/plugins/dir/$(MAKEFILE): 98 for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \
99 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir" 99 make -f Makefile$(PLATFORM) || exit 1; popd; \
100 cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE) 100 done
101sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE 101 endif
102 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE) 102
103 103build_sharp_plugin: build_microkde
104kabc/plugins/file/$(MAKEFILE): 104 ifdef BUILD_NO_SHARP_PLUGIN
105 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" 105 @echo == ldap plugin not build.
106 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE) 106 else
107sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE 107 for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \
108 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) 108 make -f Makefile$(PLATFORM) || exit 1; popd; \
109 109 done
110kabc/plugins/qtopia/$(MAKEFILE): 110 endif
111 @$(CHK_DIR_EXISTS) "kabc/plugins/qtopia" || $(MKDIR) "kabc/plugins/qtopia" 111
112 cd kabc/plugins/qtopia && $(QMAKE) qtopia.pro -o $(MAKEFILE) 112build_ldap_plugin: build_microkde
113sub-kabc-plugins-qtopia: kabc/plugins/qtopia/$(MAKEFILE) FORCE 113 ifdef BUILD_NO_LDAP_PLUGIN
114 cd kabc/plugins/qtopia && $(MAKE) -f $(MAKEFILE) 114 @echo == ldap plugin not build.
115 115 else
116pwmanager/libcrypt/cipher/$(MAKEFILE): 116 for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \
117 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/cipher" || $(MKDIR) "pwmanager/libcrypt/cipher" 117 make -f Makefile$(PLATFORM) || exit 1; popd; \
118 cd pwmanager/libcrypt/cipher && $(QMAKE) cipher.pro -o $(MAKEFILE) 118 done
119sub-pwmanager-libcrypt-cipher: pwmanager/libcrypt/cipher/$(MAKEFILE) FORCE 119 endif
120 cd pwmanager/libcrypt/cipher && $(MAKE) -f $(MAKEFILE) 120
121 121
122pwmanager/libcrypt/error/$(MAKEFILE): 122build_micromail: build_microkde
123 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/error" || $(MKDIR) "pwmanager/libcrypt/error" 123 ifdef BUILD_NO_MICROMAIL
124 cd pwmanager/libcrypt/error && $(QMAKE) error.pro -o $(MAKEFILE) 124 @echo == kmicromail not build.
125sub-pwmanager-libcrypt-error: pwmanager/libcrypt/error/$(MAKEFILE) FORCE 125 else
126 cd pwmanager/libcrypt/error && $(MAKE) -f $(MAKEFILE) 126 for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \
127 127 make -f Makefile$(PLATFORM) || exit 1; popd; \
128pwmanager/libcrypt/mpi/$(MAKEFILE): 128 done
129 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/mpi" || $(MKDIR) "pwmanager/libcrypt/mpi" 129 endif
130 cd pwmanager/libcrypt/mpi && $(QMAKE) mpi.pro -o $(MAKEFILE) 130
131sub-pwmanager-libcrypt-mpi: pwmanager/libcrypt/mpi/$(MAKEFILE) FORCE 131build_gammu: variable_test tmake
132 cd pwmanager/libcrypt/mpi && $(MAKE) -f $(MAKEFILE) 132 ifdef BUILD_NO_GAMMU
133 133 @echo == gammu not build.
134pwmanager/libcrypt/zlib/$(MAKEFILE): 134 else
135 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/zlib" || $(MKDIR) "pwmanager/libcrypt/zlib" 135 for i in $(SUBDIRS_GAMMU); do pushd $$i; \
136 cd pwmanager/libcrypt/zlib && $(QMAKE) zlib.pro -o $(MAKEFILE) 136 make -f Makefile$(PLATFORM) || exit 1; popd; \
137sub-pwmanager-libcrypt-zlib: pwmanager/libcrypt/zlib/$(MAKEFILE) FORCE 137 done
138 cd pwmanager/libcrypt/zlib && $(MAKE) -f $(MAKEFILE) 138 endif
139 139
140pwmanager/pwmanager/$(MAKEFILE): 140build_pwmanager: build_microkde
141 @$(CHK_DIR_EXISTS) "pwmanager/pwmanager" || $(MKDIR) "pwmanager/pwmanager" 141 ifdef BUILD_NO_PWMANAGER
142 cd pwmanager/pwmanager && $(QMAKE) pwmanager.pro -o $(MAKEFILE) 142 @echo == pwmanager not build.
143sub-pwmanager-pwmanager: pwmanager/pwmanager/$(MAKEFILE) FORCE 143 else
144 cd pwmanager/pwmanager && $(MAKE) -f $(MAKEFILE) 144 for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \
145 145 make -f Makefile$(PLATFORM) || exit 1; popd; \
146Makefile: kdepim-desktop.pro /usr/lib/qt3/mkspecs/default/qmake.conf 146 done
147 $(QMAKE) -o Makefile kdepim-desktop.pro 147 endif
148qmake: qmake_all 148
149 @$(QMAKE) -o Makefile kdepim-desktop.pro 149
150 150variable_info:
151all: $(SUBTARGETS) 151 @echo --------------------------------------
152qmake_all: gammu/emb/common/$(MAKEFILE) gammu/emb/gammu/$(MAKEFILE) libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/qtopia/$(MAKEFILE) pwmanager/libcrypt/cipher/$(MAKEFILE) pwmanager/libcrypt/error/$(MAKEFILE) pwmanager/libcrypt/mpi/$(MAKEFILE) pwmanager/libcrypt/zlib/$(MAKEFILE) pwmanager/pwmanager/$(MAKEFILE) 152 @echo KDEPIM buildsystem, variableinfo...
153 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 153 @echo KDEPIMDIR=$(KDEPIMDIR)
154 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 154 @echo QTDIR=$(QTDIR)
155 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 155 @echo QPEDIR=$(QPEDIR)
156 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 156 @echo OPIEDIR=$(OPIEDIR)
157 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 157 @echo PLATFORM=$(PLATFORM)
158 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 158 @echo RELEASE_DEBUG=$(RELEASE_DEBUG)
159 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 159 @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL)
160 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 160 @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN)
161 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 161 @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN)
162 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 162 @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN)
163 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 163 @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN)
164 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 164 ifndef BUILD_NO_SHARP_PLUGIN
165 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 165 @echo SHARPDTMSDK=$(SHARPDTMSDK)
166 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 166 endif
167 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 167 @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU)
168 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 168 @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER)
169 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 169 @echo --------------------------------------
170 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 170
171clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE 171variable_test: variable_info
172 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true 172 @echo KDEPIM buildsystem, variablecheck...
173 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true 173 ifndef KDEPIMDIR
174 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true 174 @echo KDEPIMDIR is not defined.
175 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true 175 $(error KDEPIMDIR is not defined)
176 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true 176 endif
177 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true 177 ifndef PLATFORM
178 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true 178 @echo PLATFORM is not defined.
179 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true 179 $(error PLATFORM is not defined)
180 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true 180 endif
181 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true 181 ifdef BUILD_NO_LDAP_PLUGIN
182 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true 182 @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN)
183 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true 183 endif
184 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; ) || true 184 ifdef BUILD_NO_OPIE_PLUGIN
185 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; ) || true 185 @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN)
186 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; ) || true 186 endif
187 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; ) || true 187 ifdef BUILD_NO_QTOPIA_PLUGIN
188 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; ) || true 188 @echo QTOPIA PLUGIN will not be build, because BUILD_NO__QTOPIA_PLUGIN is set to $(BUILD_NO__QTOPIA_PLUGIN)
189 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; ) || true 189 endif
190uninstall_subdirs: qmake_all FORCE 190 ifdef BUILD_NO_MICROMAIL
191 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 191 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL)
192 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 192 endif
193 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 193 ifdef BUILD_NO_SHARP_PLUGIN
194 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 194 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN)
195 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 195 else
196 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 196 ifndef SHARPDTMSDK
197 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 197 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK)
198 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 198 $(error SHARPDTMSDK is not defined)
199 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 199 endif
200 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 200 endif
201 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 201 ifdef BUILD_NO_GAMMU
202 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 202 @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU)
203 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 203 endif
204 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 204 ifdef BUILD_NO_PWMANAGER
205 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 205 @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER)
206 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 206 endif
207 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 207 @echo --------------------------------------
208 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 208
209install_subdirs: qmake_all FORCE 209
210 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true 210objects:
211 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true 211 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
212 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true 212 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
213 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true 213 mkdir -p libical/lib/$(PLATFORM)
214 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true 214 mkdir -p pwmanager/libcrypt/$(PLATFORM)
215 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true 215
216 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true 216clean:
217 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true 217 rm -rf libical/lib/$(PLATFORM)/*;
218 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true 218 rm -rf pwmanager/libcrypt/$(PLATFORM)/*;
219 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true 219 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
220 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true 220 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
221 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true 221 done
222 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) install; ) || true 222
223 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) install; ) || true 223install:
224 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) install; ) || true 224
225 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) install; ) || true 225 cd bin/kdepim; make install
226 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) install; ) || true 226 cp -r Pim $(QPEDIR)/apps
227 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) install; ) || true 227 cp db2file/db2file $(QPEDIR)/bin/db2file
228distclean: qmake_all FORCE 228 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
229 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 229 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
230 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 230 cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop
231 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 231 cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop
232 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 232
233 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 233dist:
234 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 234 @echo Dont forget to do "make install" before "make dist"
235 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 235 rm -f *arm.ipk
236 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 236 rm -f *~
237 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 237 cd ..; tar czf kdepimpi-$(KDEPIM_VERSION).tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim
238 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 238 mkipks kmicrokdelibs.control
239 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 239 mkipks korganizer.control
240 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 240 mkipks kaddressbook.control
241 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 241 ifndef BUILD_NO_MICROMAIL
242 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 242 mkipks kopiemail.control
243 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 243 endif
244 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 244 ifndef BUILD_NO_SHARP_PLUGIN
245 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 245 mkipks ksharpPIM-DTMaccess.control
246 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 246 endif
247 247 mkipks korganizer-alarm.control
248install: install_subdirs 248 ifndef BUILD_NO_GAMMU
249 249 mkipks kmobilephoneaccess.control
250uninstall: uninstall_subdirs 250 endif
251 251 ifndef BUILD_NO_PWMANAGER
252FORCE: 252 mkipks pwmanager.control
253 endif
254 mkipks pimTABicon.control
255
256tmake: objects \
257 qtcompat/Makefile$(PLATFORM) \
258 microkde/Makefile$(PLATFORM) \
259 libkcal/Makefile$(PLATFORM) \
260 libkdepim/Makefile$(PLATFORM) \
261 korganizer/Makefile$(PLATFORM) \
262 kalarmd/Makefile$(PLATFORM) \
263 libical/src/libical/Makefile$(PLATFORM) \
264 libical/src/libicalss/Makefile$(PLATFORM) \
265 kabc/Makefile$(PLATFORM) \
266 kabc/formats/binary/Makefile$(PLATFORM) \
267 kabc/plugins/file/Makefile$(PLATFORM) \
268 kabc/plugins/dir/Makefile$(PLATFORM) \
269 kabc/plugins/ldap/Makefile$(PLATFORM) \
270 kabc/plugins/opie/Makefile$(PLATFORM) \
271 kabc/plugins/qtopia/Makefile$(PLATFORM) \
272 kabc/plugins/sharpdtm/Makefile$(PLATFORM) \
273 kaddressbook/Makefile$(PLATFORM) \
274 kmicromail/Makefile$(PLATFORM) \
275 kmicromail/libetpan/Makefile$(PLATFORM) \
276 kmicromail/libmailwrapper/Makefile$(PLATFORM) \
277 gammu/emb/common/Makefile$(PLATFORM) \
278 gammu/emb/gammu/Makefile$(PLATFORM) \
279 pwmanager/pwmanager/Makefile$(PLATFORM) \
280 pwmanager/libcrypt/mpi/Makefile$(PLATFORM) \
281 pwmanager/libcrypt/error/Makefile$(PLATFORM) \
282 pwmanager/libcrypt/cipher/Makefile$(PLATFORM) \
283 pwmanager/libcrypt/zlib/Makefile$(PLATFORM)
284
285qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
286 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtcompat.pro -o Makefile$(PLATFORM)
287
288microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
289 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" microkdeE.pro -o Makefile$(PLATFORM)
290
291libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
292 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkcalE.pro -o Makefile$(PLATFORM)
293
294
295libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
296 cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkdepimE.pro -o Makefile$(PLATFORM)
297
298kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
299 cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kalarmdE.pro -o Makefile$(PLATFORM)
300
301korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
302 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" korganizerE.pro -o Makefile$(PLATFORM)
303
304libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
305 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalE.pro -o Makefile$(PLATFORM)
306
307libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
308 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalssE.pro -o Makefile$(PLATFORM)
309
310kabc/Makefile$(PLATFORM): kabc/kabcE.pro
311 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcE.pro -o Makefile$(PLATFORM)
312
313kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
314 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
315
316kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
317 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" fileE.pro -o Makefile$(PLATFORM)
318
319kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
320 cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" dirE.pro -o Makefile$(PLATFORM)
321
322kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
323 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" ldapE.pro -o Makefile$(PLATFORM)
324
325kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
326 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" opieE.pro -o Makefile$(PLATFORM)
327
328kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
329 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtopiaE.pro -o Makefile$(PLATFORM)
330
331kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro
332 cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" sharpdtmE.pro -o Makefile$(PLATFORM)
333
334kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
335 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kaddressbookE.pro -o Makefile$(PLATFORM)
336
337kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
338 cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kmicromailE.pro -o Makefile$(PLATFORM)
339
340kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro
341 cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libetpanE.pro -o Makefile$(PLATFORM)
342
343kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
344 cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libmailwrapperE.pro -o Makefile$(PLATFORM)
345
346gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro
347 cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" commonE.pro -o Makefile$(PLATFORM)
348
349gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro
350 cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" gammuE.pro -o Makefile$(PLATFORM)
351
352pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro
353 cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" pwmanagerE.pro -o Makefile$(PLATFORM)
354
355
356pwmanager/libcrypt/mpi/Makefile$(PLATFORM): pwmanager/libcrypt/mpi/mpi.pro
357 cd pwmanager/libcrypt/mpi;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" mpi.pro -o Makefile$(PLATFORM)
358
359pwmanager/libcrypt/error/Makefile$(PLATFORM): pwmanager/libcrypt/error/error.pro
360 cd pwmanager/libcrypt/error;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" error.pro -o Makefile$(PLATFORM)
361
362pwmanager/libcrypt/cipher/Makefile$(PLATFORM): pwmanager/libcrypt/cipher/cipher.pro
363 cd pwmanager/libcrypt/cipher;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" cipher.pro -o Makefile$(PLATFORM)
364
365pwmanager/libcrypt/zlib/Makefile$(PLATFORM): pwmanager/libcrypt/zlib/zlib.pro
366 cd pwmanager/libcrypt/zlib;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" zlib.pro -o Makefile$(PLATFORM)
367
253 368
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index ea103a9..273d435 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2600,371 +2600,372 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2600 Addressee inR ;//= er.first(); 2600 Addressee inR ;//= er.first();
2601 Addressee inL; 2601 Addressee inL;
2602 2602
2603 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2603 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2604 2604
2605 int modulo = (er.count()/10)+1; 2605 int modulo = (er.count()/10)+1;
2606 int incCounter = 0; 2606 int incCounter = 0;
2607 while ( incCounter < er.count()) { 2607 while ( incCounter < er.count()) {
2608 if (syncManager->isProgressBarCanceled()) 2608 if (syncManager->isProgressBarCanceled())
2609 return false; 2609 return false;
2610 if ( incCounter % modulo == 0 ) 2610 if ( incCounter % modulo == 0 )
2611 syncManager->showProgressBar(incCounter); 2611 syncManager->showProgressBar(incCounter);
2612 2612
2613 uid = er[ incCounter ]; 2613 uid = er[ incCounter ];
2614 bool skipIncidence = false; 2614 bool skipIncidence = false;
2615 if ( uid.left(19) == QString("last-syncAddressee-") ) 2615 if ( uid.left(19) == QString("last-syncAddressee-") )
2616 skipIncidence = true; 2616 skipIncidence = true;
2617 QString idS,OidS; 2617 QString idS,OidS;
2618 qApp->processEvents(); 2618 qApp->processEvents();
2619 if ( !skipIncidence ) { 2619 if ( !skipIncidence ) {
2620 inL = local->findByUid( uid ); 2620 inL = local->findByUid( uid );
2621 inR = remote->findByUid( uid ); 2621 inR = remote->findByUid( uid );
2622 //inL.setResource( 0 ); 2622 //inL.setResource( 0 );
2623 //inR.setResource( 0 ); 2623 //inR.setResource( 0 );
2624 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2624 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2625 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2625 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2626 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { 2626 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
2627 //qDebug("take %d %s ", take, inL.summary().latin1()); 2627 //qDebug("take %d %s ", take, inL.summary().latin1());
2628 if ( take == 3 ) 2628 if ( take == 3 )
2629 return false; 2629 return false;
2630 if ( take == 1 ) {// take local ********************** 2630 if ( take == 1 ) {// take local **********************
2631 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2631 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2632 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2632 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2633 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2633 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2634 local->insertAddressee( inL, false ); 2634 local->insertAddressee( inL, false );
2635 idS = inR.externalUID(); 2635 idS = inR.externalUID();
2636 OidS = inR.originalExternalUID(); 2636 OidS = inR.originalExternalUID();
2637 } 2637 }
2638 else 2638 else
2639 idS = inR.IDStr(); 2639 idS = inR.IDStr();
2640 remote->removeAddressee( inR ); 2640 remote->removeAddressee( inR );
2641 inR = inL; 2641 inR = inL;
2642 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2642 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2643 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2643 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2644 inR.setOriginalExternalUID( OidS ); 2644 inR.setOriginalExternalUID( OidS );
2645 inR.setExternalUID( idS ); 2645 inR.setExternalUID( idS );
2646 if ( syncManager->syncWithDesktop() ) 2646 if ( syncManager->syncWithDesktop() )
2647 inR.setIDStr("changed" ); 2647 inR.setIDStr("changed" );
2648 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); 2648 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" );
2649 } else { 2649 } else {
2650 inR.setIDStr( idS ); 2650 inR.setIDStr( idS );
2651 } 2651 }
2652 inR.setResource( 0 ); 2652 inR.setResource( 0 );
2653 remote->insertAddressee( inR , false); 2653 remote->insertAddressee( inR , false);
2654 ++changedRemote; 2654 ++changedRemote;
2655 } else { // take == 2 take remote ********************** 2655 } else { // take == 2 take remote **********************
2656 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2656 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2657 if ( inR.revision().date().year() < 2004 ) 2657 if ( inR.revision().date().year() < 2004 )
2658 inR.setRevision( modifiedCalendar ); 2658 inR.setRevision( modifiedCalendar );
2659 } 2659 }
2660 idS = inL.IDStr(); 2660 idS = inL.IDStr();
2661 local->removeAddressee( inL ); 2661 local->removeAddressee( inL );
2662 inL = inR; 2662 inL = inR;
2663 inL.setIDStr( idS ); 2663 inL.setIDStr( idS );
2664 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2664 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2665 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2665 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2666 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2666 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2667 } 2667 }
2668 inL.setResource( 0 ); 2668 inL.setResource( 0 );
2669 local->insertAddressee( inL , false ); 2669 local->insertAddressee( inL , false );
2670 ++changedLocal; 2670 ++changedLocal;
2671 } 2671 }
2672 } 2672 }
2673 } 2673 }
2674 } else { // no conflict ********** add or delete remote 2674 } else { // no conflict ********** add or delete remote
2675 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2675 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2676 QString des = addresseeLSync.note(); 2676 QString des = addresseeLSync.note();
2677 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 2677 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2678 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2678 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2679 remote->insertAddressee( inR, false ); 2679 remote->insertAddressee( inR, false );
2680 ++deletedAddresseeR; 2680 ++deletedAddresseeR;
2681 } else { 2681 } else {
2682 inR.setRevision( modifiedCalendar ); 2682 inR.setRevision( modifiedCalendar );
2683 remote->insertAddressee( inR, false ); 2683 remote->insertAddressee( inR, false );
2684 inL = inR; 2684 inL = inR;
2685 inL.setIDStr( ":" ); 2685 inL.setIDStr( ":" );
2686 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2686 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2687 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2687 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2688 inL.setResource( 0 ); 2688 inL.setResource( 0 );
2689 local->insertAddressee( inL , false); 2689 local->insertAddressee( inL , false);
2690 ++addedAddressee; 2690 ++addedAddressee;
2691 } 2691 }
2692 } else { 2692 } else {
2693 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 2693 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
2694 inR.setRevision( modifiedCalendar ); 2694 inR.setRevision( modifiedCalendar );
2695 remote->insertAddressee( inR, false ); 2695 remote->insertAddressee( inR, false );
2696 inR.setResource( 0 ); 2696 inR.setResource( 0 );
2697 local->insertAddressee( inR, false ); 2697 local->insertAddressee( inR, false );
2698 ++addedAddressee; 2698 ++addedAddressee;
2699 } else { 2699 } else {
2700 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 2700 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
2701 remote->removeAddressee( inR ); 2701 remote->removeAddressee( inR );
2702 ++deletedAddresseeR; 2702 ++deletedAddresseeR;
2703 } 2703 }
2704 } 2704 }
2705 } 2705 }
2706 } 2706 }
2707 ++incCounter; 2707 ++incCounter;
2708 } 2708 }
2709 er.clear(); 2709 er.clear();
2710 QStringList el = local->uidList(); 2710 QStringList el = local->uidList();
2711 modulo = (el.count()/10)+1; 2711 modulo = (el.count()/10)+1;
2712 2712
2713 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 2713 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2714 incCounter = 0; 2714 incCounter = 0;
2715 while ( incCounter < el.count()) { 2715 while ( incCounter < el.count()) {
2716 qApp->processEvents(); 2716 qApp->processEvents();
2717 if (syncManager->isProgressBarCanceled()) 2717 if (syncManager->isProgressBarCanceled())
2718 return false; 2718 return false;
2719 if ( incCounter % modulo == 0 ) 2719 if ( incCounter % modulo == 0 )
2720 syncManager->showProgressBar(incCounter); 2720 syncManager->showProgressBar(incCounter);
2721 uid = el[ incCounter ]; 2721 uid = el[ incCounter ];
2722 bool skipIncidence = false; 2722 bool skipIncidence = false;
2723 if ( uid.left(19) == QString("last-syncAddressee-") ) 2723 if ( uid.left(19) == QString("last-syncAddressee-") )
2724 skipIncidence = true; 2724 skipIncidence = true;
2725 if ( !skipIncidence ) { 2725 if ( !skipIncidence ) {
2726 inL = local->findByUid( uid ); 2726 inL = local->findByUid( uid );
2727 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2727 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2728 inR = remote->findByUid( uid ); 2728 inR = remote->findByUid( uid );
2729 if ( inR.isEmpty() ) { // no conflict ********** add or delete local 2729 if ( inR.isEmpty() ) { // no conflict ********** add or delete local
2730 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2730 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2731 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2731 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2732 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2732 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2733 local->removeAddressee( inL ); 2733 local->removeAddressee( inL );
2734 ++deletedAddresseeL; 2734 ++deletedAddresseeL;
2735 } else { 2735 } else {
2736 if ( ! syncManager->mWriteBackExistingOnly ) { 2736 if ( ! syncManager->mWriteBackExistingOnly ) {
2737 inL.removeID(mCurrentSyncDevice ); 2737 inL.removeID(mCurrentSyncDevice );
2738 ++addedAddresseeR; 2738 ++addedAddresseeR;
2739 inL.setRevision( modifiedCalendar ); 2739 inL.setRevision( modifiedCalendar );
2740 local->insertAddressee( inL, false ); 2740 local->insertAddressee( inL, false );
2741 inR = inL; 2741 inR = inL;
2742 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2742 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2743 inR.setResource( 0 ); 2743 inR.setResource( 0 );
2744 remote->insertAddressee( inR, false ); 2744 remote->insertAddressee( inR, false );
2745 } 2745 }
2746 } 2746 }
2747 } else { 2747 } else {
2748 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2748 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2749 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2749 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2750 local->removeAddressee( inL ); 2750 local->removeAddressee( inL );
2751 ++deletedAddresseeL; 2751 ++deletedAddresseeL;
2752 } else { 2752 } else {
2753 if ( ! syncManager->mWriteBackExistingOnly ) { 2753 if ( ! syncManager->mWriteBackExistingOnly ) {
2754 ++addedAddresseeR; 2754 ++addedAddresseeR;
2755 inL.setRevision( modifiedCalendar ); 2755 inL.setRevision( modifiedCalendar );
2756 local->insertAddressee( inL, false ); 2756 local->insertAddressee( inL, false );
2757 inR = inL; 2757 inR = inL;
2758 inR.setIDStr( ":" ); 2758 inR.setIDStr( ":" );
2759 inR.setResource( 0 ); 2759 inR.setResource( 0 );
2760 remote->insertAddressee( inR, false ); 2760 remote->insertAddressee( inR, false );
2761 } 2761 }
2762 } 2762 }
2763 } 2763 }
2764 } 2764 }
2765 } 2765 }
2766 } 2766 }
2767 ++incCounter; 2767 ++incCounter;
2768 } 2768 }
2769 el.clear(); 2769 el.clear();
2770 syncManager->hideProgressBar(); 2770 syncManager->hideProgressBar();
2771 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2771 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2772 // get rid of micro seconds 2772 // get rid of micro seconds
2773 QTime t = mLastAddressbookSync.time(); 2773 QTime t = mLastAddressbookSync.time();
2774 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2774 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2775 addresseeLSync.setRevision( mLastAddressbookSync ); 2775 addresseeLSync.setRevision( mLastAddressbookSync );
2776 addresseeRSync.setRevision( mLastAddressbookSync ); 2776 addresseeRSync.setRevision( mLastAddressbookSync );
2777 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2777 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2778 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2778 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2779 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2779 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2780 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2780 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2781 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2781 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2782 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2782 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2783 addresseeRSync.setNote( "" ) ; 2783 addresseeRSync.setNote( "" ) ;
2784 addresseeLSync.setNote( "" ); 2784 addresseeLSync.setNote( "" );
2785 2785
2786 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2786 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2787 remote->insertAddressee( addresseeRSync, false ); 2787 remote->insertAddressee( addresseeRSync, false );
2788 local->insertAddressee( addresseeLSync, false ); 2788 local->insertAddressee( addresseeLSync, false );
2789 QString mes; 2789 QString mes;
2790 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"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2790 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"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2791 qDebug( mes ); 2791 qDebug( mes );
2792 mes = i18n("Local addressbook changed!\n") +mes;
2792 if ( syncManager->mShowSyncSummary ) { 2793 if ( syncManager->mShowSyncSummary ) {
2793 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 2794 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
2794 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 2795 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
2795 qDebug("cancelled "); 2796 qDebug("cancelled ");
2796 return false; 2797 return false;
2797 } 2798 }
2798 } 2799 }
2799 return syncOK; 2800 return syncOK;
2800} 2801}
2801 2802
2802 2803
2803//this is a overwritten callbackmethods from the syncinterface 2804//this is a overwritten callbackmethods from the syncinterface
2804bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2805bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2805{ 2806{
2806 2807
2807 //pending prepare addresseeview for output 2808 //pending prepare addresseeview for output
2808 //pending detect, if remote file has REV field. if not switch to external sync 2809 //pending detect, if remote file has REV field. if not switch to external sync
2809 mGlobalSyncMode = SYNC_MODE_NORMAL; 2810 mGlobalSyncMode = SYNC_MODE_NORMAL;
2810 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2811 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2811 2812
2812 AddressBook abLocal(filename,"syncContact"); 2813 AddressBook abLocal(filename,"syncContact");
2813 bool syncOK = false; 2814 bool syncOK = false;
2814 if ( abLocal.load() ) { 2815 if ( abLocal.load() ) {
2815 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2816 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2816 bool external = false; 2817 bool external = false;
2817 bool isXML = false; 2818 bool isXML = false;
2818 if ( filename.right(4) == ".xml") { 2819 if ( filename.right(4) == ".xml") {
2819 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2820 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2820 isXML = true; 2821 isXML = true;
2821 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2822 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2822 } else { 2823 } else {
2823 external = !manager->mIsKapiFile; 2824 external = !manager->mIsKapiFile;
2824 if ( external ) { 2825 if ( external ) {
2825 qDebug("Setting vcf mode to external "); 2826 qDebug("Setting vcf mode to external ");
2826 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2827 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2827 AddressBook::Iterator it; 2828 AddressBook::Iterator it;
2828 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2829 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2829 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2830 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2830 (*it).computeCsum( mCurrentSyncDevice ); 2831 (*it).computeCsum( mCurrentSyncDevice );
2831 } 2832 }
2832 } 2833 }
2833 } 2834 }
2834 //AddressBook::Iterator it; 2835 //AddressBook::Iterator it;
2835 //QStringList vcards; 2836 //QStringList vcards;
2836 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2837 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2837 // qDebug("Name %s ", (*it).familyName().latin1()); 2838 // qDebug("Name %s ", (*it).familyName().latin1());
2838 //} 2839 //}
2839 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2840 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2840 if ( syncOK ) { 2841 if ( syncOK ) {
2841 if ( syncManager->mWriteBackFile ) 2842 if ( syncManager->mWriteBackFile )
2842 { 2843 {
2843 if ( external ) 2844 if ( external )
2844 abLocal.removeSyncAddressees( !isXML); 2845 abLocal.removeSyncAddressees( !isXML);
2845 qDebug("Saving remote AB "); 2846 qDebug("Saving remote AB ");
2846 if ( ! abLocal.saveAB()) 2847 if ( ! abLocal.saveAB())
2847 qDebug("Error writing back AB to file "); 2848 qDebug("Error writing back AB to file ");
2848 if ( external ) { 2849 if ( external ) {
2849 // afterwrite processing 2850 // afterwrite processing
2850 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 2851 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
2851 } 2852 }
2852 } 2853 }
2853 } 2854 }
2854 setModified(); 2855 setModified();
2855 2856
2856 } 2857 }
2857 if ( syncOK ) 2858 if ( syncOK )
2858 mViewManager->refreshView(); 2859 mViewManager->refreshView();
2859 return syncOK; 2860 return syncOK;
2860 2861
2861} 2862}
2862void KABCore::removeSyncInfo( QString syncProfile) 2863void KABCore::removeSyncInfo( QString syncProfile)
2863{ 2864{
2864 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 2865 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
2865 mAddressBook->removeSyncInfo( syncProfile ); 2866 mAddressBook->removeSyncInfo( syncProfile );
2866 setModified(); 2867 setModified();
2867} 2868}
2868 2869
2869 2870
2870//this is a overwritten callbackmethods from the syncinterface 2871//this is a overwritten callbackmethods from the syncinterface
2871bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2872bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2872{ 2873{
2873 if ( resource == "phone" ) 2874 if ( resource == "phone" )
2874 return syncPhone(); 2875 return syncPhone();
2875 disableBR( true ); 2876 disableBR( true );
2876 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2877 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2877 2878
2878 AddressBook abLocal( resource,"syncContact"); 2879 AddressBook abLocal( resource,"syncContact");
2879 bool syncOK = false; 2880 bool syncOK = false;
2880 if ( abLocal.load() ) { 2881 if ( abLocal.load() ) {
2881 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2882 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2882 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2883 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2883 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 2884 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
2884 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2885 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2885 if ( syncOK ) { 2886 if ( syncOK ) {
2886 if ( syncManager->mWriteBackFile ) { 2887 if ( syncManager->mWriteBackFile ) {
2887 abLocal.removeSyncAddressees( false ); 2888 abLocal.removeSyncAddressees( false );
2888 abLocal.saveAB(); 2889 abLocal.saveAB();
2889 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 2890 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
2890 } 2891 }
2891 } else 2892 } else
2892 message( i18n("Sync cancelled or failed.") ); 2893 message( i18n("Sync cancelled or failed.") );
2893 setModified(); 2894 setModified();
2894 } 2895 }
2895 if ( syncOK ) 2896 if ( syncOK )
2896 mViewManager->refreshView(); 2897 mViewManager->refreshView();
2897 disableBR( false ); 2898 disableBR( false );
2898 return syncOK; 2899 return syncOK;
2899 2900
2900} 2901}
2901void KABCore::message( QString m ) 2902void KABCore::message( QString m )
2902{ 2903{
2903 topLevelWidget()->setCaption( m ); 2904 topLevelWidget()->setCaption( m );
2904 mMessageTimer->start( 15000, true ); 2905 mMessageTimer->start( 15000, true );
2905} 2906}
2906bool KABCore::syncPhone() 2907bool KABCore::syncPhone()
2907{ 2908{
2908 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2909 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2909 QString fileName = getPhoneFile(); 2910 QString fileName = getPhoneFile();
2910 if ( !PhoneAccess::readFromPhone( fileName) ) { 2911 if ( !PhoneAccess::readFromPhone( fileName) ) {
2911 message(i18n("Phone access failed!")); 2912 message(i18n("Phone access failed!"));
2912 return false; 2913 return false;
2913 } 2914 }
2914 AddressBook abLocal( fileName,"syncContact"); 2915 AddressBook abLocal( fileName,"syncContact");
2915 bool syncOK = false; 2916 bool syncOK = false;
2916 { 2917 {
2917 abLocal.importFromFile( fileName ); 2918 abLocal.importFromFile( fileName );
2918 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2919 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2919 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2920 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2920 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2921 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2921 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2922 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2922 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2923 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2923 if ( syncOK ) { 2924 if ( syncOK ) {
2924 if ( syncManager->mWriteBackFile ) { 2925 if ( syncManager->mWriteBackFile ) {
2925 abLocal.removeSyncAddressees( true ); 2926 abLocal.removeSyncAddressees( true );
2926 abLocal.saveABphone( fileName ); 2927 abLocal.saveABphone( fileName );
2927 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 2928 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
2928 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 2929 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2929 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 2930 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
2930 } 2931 }
2931 } 2932 }
2932 setModified(); 2933 setModified();
2933 } 2934 }
2934 if ( syncOK ) 2935 if ( syncOK )
2935 mViewManager->refreshView(); 2936 mViewManager->refreshView();
2936 return syncOK; 2937 return syncOK;
2937} 2938}
2938void KABCore::getFile( bool success ) 2939void KABCore::getFile( bool success )
2939{ 2940{
2940 if ( ! success ) { 2941 if ( ! success ) {
2941 message( i18n("Error receiving file. Nothing changed!") ); 2942 message( i18n("Error receiving file. Nothing changed!") );
2942 return; 2943 return;
2943 } 2944 }
2944 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 2945 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
2945 if ( count ) 2946 if ( count )
2946 setModified( true ); 2947 setModified( true );
2947 message( i18n("Pi-Sync successful!") ); 2948 message( i18n("Pi-Sync successful!") );
2948 mViewManager->refreshView(); 2949 mViewManager->refreshView();
2949} 2950}
2950void KABCore::syncFileRequest() 2951void KABCore::syncFileRequest()
2951{ 2952{
2952 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 2953 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
2953 syncManager->slotSyncMenu( 999 ); 2954 syncManager->slotSyncMenu( 999 );
2954 } 2955 }
2955 mAddressBook->export2File( sentSyncFile() ); 2956 mAddressBook->export2File( sentSyncFile() );
2956} 2957}
2957QString KABCore::sentSyncFile() 2958QString KABCore::sentSyncFile()
2958{ 2959{
2959#ifdef DESKTOP_VERSION 2960#ifdef DESKTOP_VERSION
2960 return locateLocal( "tmp", "copysyncab.vcf" ); 2961 return locateLocal( "tmp", "copysyncab.vcf" );
2961#else 2962#else
2962 return QString( "/tmp/copysyncab.vcf" ); 2963 return QString( "/tmp/copysyncab.vcf" );
2963#endif 2964#endif
2964} 2965}
2965 2966
2966void KABCore::setCaptionBack() 2967void KABCore::setCaptionBack()
2967{ 2968{
2968 mMessageTimer->stop(); 2969 mMessageTimer->stop();
2969 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2970 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2970} 2971}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 4e29d6f..59bf615 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1007,384 +1007,385 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1007 bool skipIncidence = false; 1007 bool skipIncidence = false;
1008 if ( uid.left(15) == QString("last-syncEvent-") ) 1008 if ( uid.left(15) == QString("last-syncEvent-") )
1009 skipIncidence = true; 1009 skipIncidence = true;
1010 QString idS; 1010 QString idS;
1011 qApp->processEvents(); 1011 qApp->processEvents();
1012 if ( !skipIncidence ) { 1012 if ( !skipIncidence ) {
1013 inL = local->incidence( uid ); 1013 inL = local->incidence( uid );
1014 if ( inL ) { // maybe conflict - same uid in both calendars 1014 if ( inL ) { // maybe conflict - same uid in both calendars
1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1016 //qDebug("take %d %s ", take, inL->summary().latin1()); 1016 //qDebug("take %d %s ", take, inL->summary().latin1());
1017 if ( take == 3 ) 1017 if ( take == 3 )
1018 return false; 1018 return false;
1019 if ( take == 1 ) {// take local ********************** 1019 if ( take == 1 ) {// take local **********************
1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1022 else 1022 else
1023 idS = inR->IDStr(); 1023 idS = inR->IDStr();
1024 remote->deleteIncidence( inR ); 1024 remote->deleteIncidence( inR );
1025 inR = inL->clone(); 1025 inR = inL->clone();
1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1028 inR->setIDStr( idS ); 1028 inR->setIDStr( idS );
1029 remote->addIncidence( inR ); 1029 remote->addIncidence( inR );
1030 if ( mSyncManager->syncWithDesktop() ) 1030 if ( mSyncManager->syncWithDesktop() )
1031 inR->setPilotId( 2 ); 1031 inR->setPilotId( 2 );
1032 ++changedRemote; 1032 ++changedRemote;
1033 } else {// take remote ********************** 1033 } else {// take remote **********************
1034 idS = inL->IDStr(); 1034 idS = inL->IDStr();
1035 int pid = inL->pilotId(); 1035 int pid = inL->pilotId();
1036 local->deleteIncidence( inL ); 1036 local->deleteIncidence( inL );
1037 inL = inR->clone(); 1037 inL = inR->clone();
1038 if ( mSyncManager->syncWithDesktop() ) 1038 if ( mSyncManager->syncWithDesktop() )
1039 inL->setPilotId( pid ); 1039 inL->setPilotId( pid );
1040 inL->setIDStr( idS ); 1040 inL->setIDStr( idS );
1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1044 } 1044 }
1045 local->addIncidence( inL ); 1045 local->addIncidence( inL );
1046 ++changedLocal; 1046 ++changedLocal;
1047 } 1047 }
1048 } 1048 }
1049 } else { // no conflict ********** add or delete remote 1049 } else { // no conflict ********** add or delete remote
1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1051 QString des = eventLSync->description(); 1051 QString des = eventLSync->description();
1052 QString pref = "e"; 1052 QString pref = "e";
1053 if ( inR->type() == "Todo" ) 1053 if ( inR->type() == "Todo" )
1054 pref = "t"; 1054 pref = "t";
1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1057 //remote->deleteIncidence( inR ); 1057 //remote->deleteIncidence( inR );
1058 ++deletedEventR; 1058 ++deletedEventR;
1059 } else { 1059 } else {
1060 inR->setLastModified( modifiedCalendar ); 1060 inR->setLastModified( modifiedCalendar );
1061 inL = inR->clone(); 1061 inL = inR->clone();
1062 inL->setIDStr( ":" ); 1062 inL->setIDStr( ":" );
1063 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1063 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1064 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1064 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1065 local->addIncidence( inL ); 1065 local->addIncidence( inL );
1066 ++addedEvent; 1066 ++addedEvent;
1067 } 1067 }
1068 } else { 1068 } else {
1069 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1069 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1070 inR->setLastModified( modifiedCalendar ); 1070 inR->setLastModified( modifiedCalendar );
1071 inL = inR->clone(); 1071 inL = inR->clone();
1072 inL->setIDStr( ":" ); 1072 inL->setIDStr( ":" );
1073 local->addIncidence( inL ); 1073 local->addIncidence( inL );
1074 ++addedEvent; 1074 ++addedEvent;
1075 } else { 1075 } else {
1076 checkExternSyncEvent(eventRSyncSharp, inR); 1076 checkExternSyncEvent(eventRSyncSharp, inR);
1077 remote->deleteIncidence( inR ); 1077 remote->deleteIncidence( inR );
1078 ++deletedEventR; 1078 ++deletedEventR;
1079 } 1079 }
1080 } 1080 }
1081 } 1081 }
1082 } 1082 }
1083 inR = er.next(); 1083 inR = er.next();
1084 } 1084 }
1085 QPtrList<Incidence> el = local->rawIncidences(); 1085 QPtrList<Incidence> el = local->rawIncidences();
1086 inL = el.first(); 1086 inL = el.first();
1087 modulo = (el.count()/10)+1; 1087 modulo = (el.count()/10)+1;
1088 bar.setCaption (i18n("Add / remove events") ); 1088 bar.setCaption (i18n("Add / remove events") );
1089 bar.setTotalSteps ( el.count() ) ; 1089 bar.setTotalSteps ( el.count() ) ;
1090 bar.show(); 1090 bar.show();
1091 incCounter = 0; 1091 incCounter = 0;
1092 1092
1093 while ( inL ) { 1093 while ( inL ) {
1094 1094
1095 qApp->processEvents(); 1095 qApp->processEvents();
1096 if ( ! bar.isVisible() ) 1096 if ( ! bar.isVisible() )
1097 return false; 1097 return false;
1098 if ( incCounter % modulo == 0 ) 1098 if ( incCounter % modulo == 0 )
1099 bar.setProgress( incCounter ); 1099 bar.setProgress( incCounter );
1100 ++incCounter; 1100 ++incCounter;
1101 uid = inL->uid(); 1101 uid = inL->uid();
1102 bool skipIncidence = false; 1102 bool skipIncidence = false;
1103 if ( uid.left(15) == QString("last-syncEvent-") ) 1103 if ( uid.left(15) == QString("last-syncEvent-") )
1104 skipIncidence = true; 1104 skipIncidence = true;
1105 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1105 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1106 skipIncidence = true; 1106 skipIncidence = true;
1107 if ( !skipIncidence ) { 1107 if ( !skipIncidence ) {
1108 inR = remote->incidence( uid ); 1108 inR = remote->incidence( uid );
1109 if ( ! inR ) { // no conflict ********** add or delete local 1109 if ( ! inR ) { // no conflict ********** add or delete local
1110 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1110 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1111 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1111 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1112 checkExternSyncEvent(eventLSyncSharp, inL); 1112 checkExternSyncEvent(eventLSyncSharp, inL);
1113 local->deleteIncidence( inL ); 1113 local->deleteIncidence( inL );
1114 ++deletedEventL; 1114 ++deletedEventL;
1115 } else { 1115 } else {
1116 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1116 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1117 inL->removeID(mCurrentSyncDevice ); 1117 inL->removeID(mCurrentSyncDevice );
1118 ++addedEventR; 1118 ++addedEventR;
1119 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1119 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1120 inL->setLastModified( modifiedCalendar ); 1120 inL->setLastModified( modifiedCalendar );
1121 inR = inL->clone(); 1121 inR = inL->clone();
1122 inR->setIDStr( ":" ); 1122 inR->setIDStr( ":" );
1123 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1123 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1124 remote->addIncidence( inR ); 1124 remote->addIncidence( inR );
1125 } 1125 }
1126 } 1126 }
1127 } else { 1127 } else {
1128 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1128 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1129 checkExternSyncEvent(eventLSyncSharp, inL); 1129 checkExternSyncEvent(eventLSyncSharp, inL);
1130 local->deleteIncidence( inL ); 1130 local->deleteIncidence( inL );
1131 ++deletedEventL; 1131 ++deletedEventL;
1132 } else { 1132 } else {
1133 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1133 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1134 ++addedEventR; 1134 ++addedEventR;
1135 inL->setLastModified( modifiedCalendar ); 1135 inL->setLastModified( modifiedCalendar );
1136 inR = inL->clone(); 1136 inR = inL->clone();
1137 inR->setIDStr( ":" ); 1137 inR->setIDStr( ":" );
1138 remote->addIncidence( inR ); 1138 remote->addIncidence( inR );
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
1142 } 1142 }
1143 } 1143 }
1144 inL = el.next(); 1144 inL = el.next();
1145 } 1145 }
1146 int delFut = 0; 1146 int delFut = 0;
1147 int remRem = 0; 1147 int remRem = 0;
1148 if ( mSyncManager->mWriteBackInFuture ) { 1148 if ( mSyncManager->mWriteBackInFuture ) {
1149 er = remote->rawIncidences(); 1149 er = remote->rawIncidences();
1150 remRem = er.count(); 1150 remRem = er.count();
1151 inR = er.first(); 1151 inR = er.first();
1152 QDateTime dt; 1152 QDateTime dt;
1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1154 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1154 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1155 while ( inR ) { 1155 while ( inR ) {
1156 if ( inR->type() == "Todo" ) { 1156 if ( inR->type() == "Todo" ) {
1157 Todo * t = (Todo*)inR; 1157 Todo * t = (Todo*)inR;
1158 if ( t->hasDueDate() ) 1158 if ( t->hasDueDate() )
1159 dt = t->dtDue(); 1159 dt = t->dtDue();
1160 else 1160 else
1161 dt = cur.addSecs( 62 ); 1161 dt = cur.addSecs( 62 );
1162 } 1162 }
1163 else if (inR->type() == "Event" ) { 1163 else if (inR->type() == "Event" ) {
1164 bool ok; 1164 bool ok;
1165 dt = inR->getNextOccurence( cur, &ok ); 1165 dt = inR->getNextOccurence( cur, &ok );
1166 if ( !ok ) 1166 if ( !ok )
1167 dt = cur.addSecs( -62 ); 1167 dt = cur.addSecs( -62 );
1168 } 1168 }
1169 else 1169 else
1170 dt = inR->dtStart(); 1170 dt = inR->dtStart();
1171 if ( dt < cur || dt > end ) { 1171 if ( dt < cur || dt > end ) {
1172 remote->deleteIncidence( inR ); 1172 remote->deleteIncidence( inR );
1173 ++delFut; 1173 ++delFut;
1174 } 1174 }
1175 inR = er.next(); 1175 inR = er.next();
1176 } 1176 }
1177 } 1177 }
1178 bar.hide(); 1178 bar.hide();
1179 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1179 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1180 eventLSync->setReadOnly( false ); 1180 eventLSync->setReadOnly( false );
1181 eventLSync->setDtStart( mLastCalendarSync ); 1181 eventLSync->setDtStart( mLastCalendarSync );
1182 eventRSync->setDtStart( mLastCalendarSync ); 1182 eventRSync->setDtStart( mLastCalendarSync );
1183 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1183 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1184 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1184 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1185 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1185 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1186 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1186 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1187 eventLSync->setReadOnly( true ); 1187 eventLSync->setReadOnly( true );
1188 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1188 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1189 remote->addEvent( eventRSync ); 1189 remote->addEvent( eventRSync );
1190 else 1190 else
1191 delete eventRSync; 1191 delete eventRSync;
1192 QString mes; 1192 QString mes;
1193 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 ); 1193 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 );
1194 QString delmess; 1194 QString delmess;
1195 if ( delFut ) { 1195 if ( delFut ) {
1196 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1196 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1197 mes += delmess; 1197 mes += delmess;
1198 } 1198 }
1199 mes = i18n("Local calendar changed!\n") +mes;
1199 mCalendar->checkAlarmForIncidence( 0, true ); 1200 mCalendar->checkAlarmForIncidence( 0, true );
1200 qDebug( mes ); 1201 qDebug( mes );
1201 if ( mSyncManager->mShowSyncSummary ) { 1202 if ( mSyncManager->mShowSyncSummary ) {
1202 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1203 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1203 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1204 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1204 qDebug("cancelled "); 1205 qDebug("cancelled ");
1205 return false; 1206 return false;
1206 } 1207 }
1207 } 1208 }
1208 return syncOK; 1209 return syncOK;
1209} 1210}
1210 1211
1211void CalendarView::setSyncDevice( QString s ) 1212void CalendarView::setSyncDevice( QString s )
1212{ 1213{
1213 mCurrentSyncDevice= s; 1214 mCurrentSyncDevice= s;
1214} 1215}
1215void CalendarView::setSyncName( QString s ) 1216void CalendarView::setSyncName( QString s )
1216{ 1217{
1217 mCurrentSyncName= s; 1218 mCurrentSyncName= s;
1218} 1219}
1219bool CalendarView::syncCalendar(QString filename, int mode) 1220bool CalendarView::syncCalendar(QString filename, int mode)
1220{ 1221{
1221 //qDebug("syncCalendar %s ", filename.latin1()); 1222 //qDebug("syncCalendar %s ", filename.latin1());
1222 mGlobalSyncMode = SYNC_MODE_NORMAL; 1223 mGlobalSyncMode = SYNC_MODE_NORMAL;
1223 CalendarLocal* calendar = new CalendarLocal(); 1224 CalendarLocal* calendar = new CalendarLocal();
1224 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1225 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1225 FileStorage* storage = new FileStorage( calendar ); 1226 FileStorage* storage = new FileStorage( calendar );
1226 bool syncOK = false; 1227 bool syncOK = false;
1227 storage->setFileName( filename ); 1228 storage->setFileName( filename );
1228 // qDebug("loading ... "); 1229 // qDebug("loading ... ");
1229 if ( storage->load() ) { 1230 if ( storage->load() ) {
1230 getEventViewerDialog()->setSyncMode( true ); 1231 getEventViewerDialog()->setSyncMode( true );
1231 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1232 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1232 getEventViewerDialog()->setSyncMode( false ); 1233 getEventViewerDialog()->setSyncMode( false );
1233 if ( syncOK ) { 1234 if ( syncOK ) {
1234 if ( mSyncManager->mWriteBackFile ) 1235 if ( mSyncManager->mWriteBackFile )
1235 { 1236 {
1236 storage->setSaveFormat( new ICalFormat() ); 1237 storage->setSaveFormat( new ICalFormat() );
1237 storage->save(); 1238 storage->save();
1238 } 1239 }
1239 } 1240 }
1240 setModified( true ); 1241 setModified( true );
1241 } 1242 }
1242 delete storage; 1243 delete storage;
1243 delete calendar; 1244 delete calendar;
1244 if ( syncOK ) 1245 if ( syncOK )
1245 updateView(); 1246 updateView();
1246 return syncOK; 1247 return syncOK;
1247} 1248}
1248 1249
1249void CalendarView::syncExternal( int mode ) 1250void CalendarView::syncExternal( int mode )
1250{ 1251{
1251 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1252 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1252 1253
1253 qApp->processEvents(); 1254 qApp->processEvents();
1254 CalendarLocal* calendar = new CalendarLocal(); 1255 CalendarLocal* calendar = new CalendarLocal();
1255 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1256 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1256 bool syncOK = false; 1257 bool syncOK = false;
1257 bool loadSuccess = false; 1258 bool loadSuccess = false;
1258 PhoneFormat* phoneFormat = 0; 1259 PhoneFormat* phoneFormat = 0;
1259 emit tempDisableBR(true); 1260 emit tempDisableBR(true);
1260#ifndef DESKTOP_VERSION 1261#ifndef DESKTOP_VERSION
1261 SharpFormat* sharpFormat = 0; 1262 SharpFormat* sharpFormat = 0;
1262 if ( mode == 0 ) { // sharp 1263 if ( mode == 0 ) { // sharp
1263 sharpFormat = new SharpFormat () ; 1264 sharpFormat = new SharpFormat () ;
1264 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1265 loadSuccess = sharpFormat->load( calendar, mCalendar );
1265 1266
1266 } else 1267 } else
1267#endif 1268#endif
1268 if ( mode == 1 ) { // phone 1269 if ( mode == 1 ) { // phone
1269 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1270 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1270 mSyncManager->mPhoneDevice, 1271 mSyncManager->mPhoneDevice,
1271 mSyncManager->mPhoneConnection, 1272 mSyncManager->mPhoneConnection,
1272 mSyncManager->mPhoneModel); 1273 mSyncManager->mPhoneModel);
1273 loadSuccess = phoneFormat->load( calendar,mCalendar); 1274 loadSuccess = phoneFormat->load( calendar,mCalendar);
1274 1275
1275 } else { 1276 } else {
1276 emit tempDisableBR(false); 1277 emit tempDisableBR(false);
1277 return; 1278 return;
1278 } 1279 }
1279 if ( loadSuccess ) { 1280 if ( loadSuccess ) {
1280 getEventViewerDialog()->setSyncMode( true ); 1281 getEventViewerDialog()->setSyncMode( true );
1281 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1282 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1282 getEventViewerDialog()->setSyncMode( false ); 1283 getEventViewerDialog()->setSyncMode( false );
1283 qApp->processEvents(); 1284 qApp->processEvents();
1284 if ( syncOK ) { 1285 if ( syncOK ) {
1285 if ( mSyncManager->mWriteBackFile ) 1286 if ( mSyncManager->mWriteBackFile )
1286 { 1287 {
1287 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1288 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1288 Incidence* inc = iL.first(); 1289 Incidence* inc = iL.first();
1289 if ( phoneFormat ) { 1290 if ( phoneFormat ) {
1290 while ( inc ) { 1291 while ( inc ) {
1291 inc->removeID(mCurrentSyncDevice); 1292 inc->removeID(mCurrentSyncDevice);
1292 inc = iL.next(); 1293 inc = iL.next();
1293 } 1294 }
1294 } 1295 }
1295#ifndef DESKTOP_VERSION 1296#ifndef DESKTOP_VERSION
1296 if ( sharpFormat ) 1297 if ( sharpFormat )
1297 sharpFormat->save(calendar); 1298 sharpFormat->save(calendar);
1298#endif 1299#endif
1299 if ( phoneFormat ) 1300 if ( phoneFormat )
1300 phoneFormat->save(calendar); 1301 phoneFormat->save(calendar);
1301 iL = calendar->rawIncidences(); 1302 iL = calendar->rawIncidences();
1302 inc = iL.first(); 1303 inc = iL.first();
1303 Incidence* loc; 1304 Incidence* loc;
1304 while ( inc ) { 1305 while ( inc ) {
1305 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1306 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1306 loc = mCalendar->incidence(inc->uid() ); 1307 loc = mCalendar->incidence(inc->uid() );
1307 if ( loc ) { 1308 if ( loc ) {
1308 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1309 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1309 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1310 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1310 } 1311 }
1311 } 1312 }
1312 inc = iL.next(); 1313 inc = iL.next();
1313 } 1314 }
1314 Incidence* lse = getLastSyncEvent(); 1315 Incidence* lse = getLastSyncEvent();
1315 if ( lse ) { 1316 if ( lse ) {
1316 lse->setReadOnly( false ); 1317 lse->setReadOnly( false );
1317 lse->setDescription( "" ); 1318 lse->setDescription( "" );
1318 lse->setReadOnly( true ); 1319 lse->setReadOnly( true );
1319 } 1320 }
1320 } 1321 }
1321 } else { 1322 } else {
1322 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1323 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1323 } 1324 }
1324 setModified( true ); 1325 setModified( true );
1325 } else { 1326 } else {
1326 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1327 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1327 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1328 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1328 question, i18n("Ok")) ; 1329 question, i18n("Ok")) ;
1329 1330
1330 } 1331 }
1331 delete calendar; 1332 delete calendar;
1332 updateView(); 1333 updateView();
1333 emit tempDisableBR(false); 1334 emit tempDisableBR(false);
1334 return ;//syncOK; 1335 return ;//syncOK;
1335 1336
1336} 1337}
1337 1338
1338bool CalendarView::importBday() 1339bool CalendarView::importBday()
1339{ 1340{
1340#ifndef KORG_NOKABC 1341#ifndef KORG_NOKABC
1341 1342
1342#ifdef DESKTOP_VERSION 1343#ifdef DESKTOP_VERSION
1343 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1344 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1344 KABC::AddressBook::Iterator it; 1345 KABC::AddressBook::Iterator it;
1345 int count = 0; 1346 int count = 0;
1346 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1347 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1347 ++count; 1348 ++count;
1348 } 1349 }
1349 QProgressBar bar(count,0 ); 1350 QProgressBar bar(count,0 );
1350 int w = 300; 1351 int w = 300;
1351 if ( QApplication::desktop()->width() < 320 ) 1352 if ( QApplication::desktop()->width() < 320 )
1352 w = 220; 1353 w = 220;
1353 int h = bar.sizeHint().height() ; 1354 int h = bar.sizeHint().height() ;
1354 int dw = QApplication::desktop()->width(); 1355 int dw = QApplication::desktop()->width();
1355 int dh = QApplication::desktop()->height(); 1356 int dh = QApplication::desktop()->height();
1356 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1357 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1357 bar.show(); 1358 bar.show();
1358 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1359 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1359 qApp->processEvents(); 1360 qApp->processEvents();
1360 count = 0; 1361 count = 0;
1361 int addCount = 0; 1362 int addCount = 0;
1362 KCal::Attendee* a = 0; 1363 KCal::Attendee* a = 0;
1363 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1364 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1364 if ( ! bar.isVisible() ) 1365 if ( ! bar.isVisible() )
1365 return false; 1366 return false;
1366 bar.setProgress( count++ ); 1367 bar.setProgress( count++ );
1367 qApp->processEvents(); 1368 qApp->processEvents();
1368 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1369 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1369 if ( (*it).birthday().date().isValid() ){ 1370 if ( (*it).birthday().date().isValid() ){
1370 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1371 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1371 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1372 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1372 ++addCount; 1373 ++addCount;
1373 } 1374 }
1374 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1375 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1375 if ( anni.isValid() ){ 1376 if ( anni.isValid() ){
1376 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1377 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1377 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1378 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1378 ++addCount; 1379 ++addCount;
1379 } 1380 }
1380 } 1381 }
1381 updateView(); 1382 updateView();
1382 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1383 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1383#else //DESKTOP_VERSION 1384#else //DESKTOP_VERSION
1384 1385
1385 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1386 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1386 // the result should now arrive through method insertBirthdays 1387 // the result should now arrive through method insertBirthdays
1387 1388
1388#endif //DESKTOP_VERSION 1389#endif //DESKTOP_VERSION
1389 1390
1390#endif //KORG_NOKABC 1391#endif //KORG_NOKABC