summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-29 09:03:54 (UTC)
committer zautrix <zautrix>2004-10-29 09:03:54 (UTC)
commit6500d6ebb080f1de58fe676aa0a730d47fcf64f5 (patch) (unidiff)
tree41841e05bf1e6b88e6e55f42011dce5f6bed85b4
parent41e3625b8c38ff45e70b59416a519d59a5f4d937 (diff)
downloadkdepimpi-6500d6ebb080f1de58fe676aa0a730d47fcf64f5.zip
kdepimpi-6500d6ebb080f1de58fe676aa0a730d47fcf64f5.tar.gz
kdepimpi-6500d6ebb080f1de58fe676aa0a730d47fcf64f5.tar.bz2
sync fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile619
-rw-r--r--kabc/addressbook.cpp26
-rw-r--r--kabc/addressee.cpp25
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp4
-rw-r--r--kaddressbook/kabcore.cpp25
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--libkdepim/ksyncmanager.cpp4
7 files changed, 301 insertions, 403 deletions
diff --git a/Makefile b/Makefile
index 467710f..e6f955c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,368 +1,253 @@
1export KDEPIMDIR = $(shell pwd) 1#############################################################################
2 2# Makefile for building: kdepim-desktop
3export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version) 3# Generated by qmake (1.07a) (Qt 3.3.1) on: Thu Oct 28 23:52:22 2004
4 4# Project: kdepim-desktop.pro
5ifeq ($(PLATFORM) , zaurus) 5# Template: subdirs
6 BUILD_NO_LDAP_PLUGIN=1 6# Command: $(QMAKE) -o Makefile kdepim-desktop.pro
7endif 7#############################################################################
8 8
9ifneq ($(PLATFORM) , zaurus) 9 MAKEFILE =Makefile
10 BUILD_NO_SHARP_PLUGIN=1 10 QMAKE =qmake
11endif 11DEL_FILE = rm -f
12 12CHK_DIR_EXISTS= test -d
13#opie plugin is deprecated. The qtopia plugin handles the task from now on. 13MKDIR = mkdir -p
14BUILD_NO_OPIE_PLUGIN=1 14 SUBTARGETS = \
15 15 sub-gammu-emb-common \
16SUBDIRS_MICROKDE = \ 16 sub-gammu-emb-gammu \
17 libical/src/libical \ 17 sub-libical \
18 libical/src/libicalss \ 18 sub-libkcal \
19 qtcompat \ 19 sub-microkde \
20 microkde \ 20 sub-libkdepim \
21 libkcal \ 21 sub-kabc \
22 libkdepim \ 22 sub-korganizer \
23 kabc \ 23 sub-kaddressbook \
24 kabc/formats/binary \ 24 sub-kabc-plugins-file \
25 kabc/plugins/file \ 25 sub-kabc-plugins-dir \
26 kabc/plugins/dir \ 26 sub-kabc-plugins-file \
27 korganizer \ 27 sub-kabc-plugins-qtopia \
28 kalarmd \ 28 sub-pwmanager-libcrypt-cipher \
29 kaddressbook 29 sub-pwmanager-libcrypt-error \
30 30 sub-pwmanager-libcrypt-mpi \
31SUBDIRS_QTOPIA_PLUGIN = \ 31 sub-pwmanager-libcrypt-zlib \
32 kabc/plugins/qtopia 32 sub-pwmanager-pwmanager
33 33
34SUBDIRS_OPIE_PLUGIN = \ 34first: all
35 kabc/plugins/opie 35
36 36all: Makefile $(SUBTARGETS)
37SUBDIRS_SHARP_PLUGIN = \ 37
38 kabc/plugins/sharpdtm 38gammu/emb/common/$(MAKEFILE):
39 39 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common"
40SUBDIRS_LDAP_PLUGIN = \ 40 cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE)
41 kabc/plugins/ldap 41sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE
42 42 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE)
43SUBDIRS_MICROMAIL = \ 43
44 kmicromail/libetpan \ 44gammu/emb/gammu/$(MAKEFILE):
45 kmicromail/libmailwrapper \ 45 @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu"
46 kmicromail 46 cd gammu/emb/gammu && $(QMAKE) gammu.pro -o $(MAKEFILE)
47 47sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE
48SUBDIRS_GAMMU = \ 48 cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE)
49 gammu/emb/common \ 49
50 gammu/emb/gammu 50libical/$(MAKEFILE):
51 51 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
52SUBDIRS_PWMANAGER = \ 52 cd libical && $(QMAKE) libical.pro -o $(MAKEFILE)
53 pwmanager/libcrypt/mpi \ 53sub-libical: libical/$(MAKEFILE) FORCE
54 pwmanager/libcrypt/error \ 54 cd libical && $(MAKE) -f $(MAKEFILE)
55 pwmanager/libcrypt/cipher \ 55
56 pwmanager/libcrypt/zlib \ 56libkcal/$(MAKEFILE):
57 pwmanager/pwmanager 57 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
58 58 cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE)
59SUBDIRS = \ 59sub-libkcal: libkcal/$(MAKEFILE) FORCE
60 $(SUBDIRS_MICROKDE) \ 60 cd libkcal && $(MAKE) -f $(MAKEFILE)
61 $(SUBDIRS_QTOPIA_PLUGIN) \ 61
62 $(SUBDIRS_OPIE_PLUGIN) \ 62microkde/$(MAKEFILE):
63 $(SUBDIRS_SHARP_PLUGIN) \ 63 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
64 $(SUBDIRS_LDAP_PLUGIN) \ 64 cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE)
65 $(SUBDIRS_MICROMAIL) \ 65sub-microkde: microkde/$(MAKEFILE) FORCE
66 $(SUBDIRS_GAMMU) \ 66 cd microkde && $(MAKE) -f $(MAKEFILE)
67 $(SUBDIRS_PWMANAGER) 67
68 68libkdepim/$(MAKEFILE):
69 69 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
70all: build_microkde \ 70 cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE)
71 build_qtopia_plugin \ 71sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
72 build_opie_plugin \ 72 cd libkdepim && $(MAKE) -f $(MAKEFILE)
73 build_sharp_plugin \ 73
74 build_ldap_plugin \ 74kabc/$(MAKEFILE):
75 build_micromail \ 75 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
76 build_gammu \ 76 cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE)
77 build_pwmanager 77sub-kabc: kabc/$(MAKEFILE) FORCE
78 78 cd kabc && $(MAKE) -f $(MAKEFILE)
79 79
80build_microkde: variable_test tmake 80korganizer/$(MAKEFILE):
81 for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ 81 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
82 make -f Makefile$(PLATFORM) || exit 1; popd; \ 82 cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE)
83 done 83sub-korganizer: korganizer/$(MAKEFILE) FORCE
84 84 cd korganizer && $(MAKE) -f $(MAKEFILE)
85build_qtopia_plugin: build_microkde 85
86 ifdef BUILD_NO_QTOPIA_PLUGIN 86kaddressbook/$(MAKEFILE):
87 @echo == qtopia plugin not build. 87 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
88 else 88 cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE)
89 for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ 89sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
90 make -f Makefile$(PLATFORM) || exit 1; popd; \ 90 cd kaddressbook && $(MAKE) -f $(MAKEFILE)
91 done 91
92 endif 92kabc/plugins/file/$(MAKEFILE):
93 93 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
94build_opie_plugin: build_microkde 94 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE)
95 ifdef BUILD_NO_OPIE_PLUGIN 95sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
96 @echo == opie plugin not build. 96 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
97 else 97
98 for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ 98kabc/plugins/dir/$(MAKEFILE):
99 make -f Makefile$(PLATFORM) || exit 1; popd; \ 99 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
100 done 100 cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE)
101 endif 101sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
102 102 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
103build_sharp_plugin: build_microkde 103
104 ifdef BUILD_NO_SHARP_PLUGIN 104kabc/plugins/file/$(MAKEFILE):
105 @echo == ldap plugin not build. 105 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
106 else 106 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE)
107 for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \ 107sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
108 make -f Makefile$(PLATFORM) || exit 1; popd; \ 108 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
109 done 109
110 endif 110kabc/plugins/qtopia/$(MAKEFILE):
111 111 @$(CHK_DIR_EXISTS) "kabc/plugins/qtopia" || $(MKDIR) "kabc/plugins/qtopia"
112build_ldap_plugin: build_microkde 112 cd kabc/plugins/qtopia && $(QMAKE) qtopia.pro -o $(MAKEFILE)
113 ifdef BUILD_NO_LDAP_PLUGIN 113sub-kabc-plugins-qtopia: kabc/plugins/qtopia/$(MAKEFILE) FORCE
114 @echo == ldap plugin not build. 114 cd kabc/plugins/qtopia && $(MAKE) -f $(MAKEFILE)
115 else 115
116 for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \ 116pwmanager/libcrypt/cipher/$(MAKEFILE):
117 make -f Makefile$(PLATFORM) || exit 1; popd; \ 117 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/cipher" || $(MKDIR) "pwmanager/libcrypt/cipher"
118 done 118 cd pwmanager/libcrypt/cipher && $(QMAKE) cipher.pro -o $(MAKEFILE)
119 endif 119sub-pwmanager-libcrypt-cipher: pwmanager/libcrypt/cipher/$(MAKEFILE) FORCE
120 120 cd pwmanager/libcrypt/cipher && $(MAKE) -f $(MAKEFILE)
121 121
122build_micromail: build_microkde 122pwmanager/libcrypt/error/$(MAKEFILE):
123 ifdef BUILD_NO_MICROMAIL 123 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/error" || $(MKDIR) "pwmanager/libcrypt/error"
124 @echo == kmicromail not build. 124 cd pwmanager/libcrypt/error && $(QMAKE) error.pro -o $(MAKEFILE)
125 else 125sub-pwmanager-libcrypt-error: pwmanager/libcrypt/error/$(MAKEFILE) FORCE
126 for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ 126 cd pwmanager/libcrypt/error && $(MAKE) -f $(MAKEFILE)
127 make -f Makefile$(PLATFORM) || exit 1; popd; \ 127
128 done 128pwmanager/libcrypt/mpi/$(MAKEFILE):
129 endif 129 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/mpi" || $(MKDIR) "pwmanager/libcrypt/mpi"
130 130 cd pwmanager/libcrypt/mpi && $(QMAKE) mpi.pro -o $(MAKEFILE)
131build_gammu: variable_test tmake 131sub-pwmanager-libcrypt-mpi: pwmanager/libcrypt/mpi/$(MAKEFILE) FORCE
132 ifdef BUILD_NO_GAMMU 132 cd pwmanager/libcrypt/mpi && $(MAKE) -f $(MAKEFILE)
133 @echo == gammu not build. 133
134 else 134pwmanager/libcrypt/zlib/$(MAKEFILE):
135 for i in $(SUBDIRS_GAMMU); do pushd $$i; \ 135 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/zlib" || $(MKDIR) "pwmanager/libcrypt/zlib"
136 make -f Makefile$(PLATFORM) || exit 1; popd; \ 136 cd pwmanager/libcrypt/zlib && $(QMAKE) zlib.pro -o $(MAKEFILE)
137 done 137sub-pwmanager-libcrypt-zlib: pwmanager/libcrypt/zlib/$(MAKEFILE) FORCE
138 endif 138 cd pwmanager/libcrypt/zlib && $(MAKE) -f $(MAKEFILE)
139 139
140build_pwmanager: build_microkde 140pwmanager/pwmanager/$(MAKEFILE):
141 ifdef BUILD_NO_PWMANAGER 141 @$(CHK_DIR_EXISTS) "pwmanager/pwmanager" || $(MKDIR) "pwmanager/pwmanager"
142 @echo == pwmanager not build. 142 cd pwmanager/pwmanager && $(QMAKE) pwmanager.pro -o $(MAKEFILE)
143 else 143sub-pwmanager-pwmanager: pwmanager/pwmanager/$(MAKEFILE) FORCE
144 for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \ 144 cd pwmanager/pwmanager && $(MAKE) -f $(MAKEFILE)
145 make -f Makefile$(PLATFORM) || exit 1; popd; \ 145
146 done 146Makefile: kdepim-desktop.pro /usr/lib/qt3/mkspecs/default/qmake.conf
147 endif 147 $(QMAKE) -o Makefile kdepim-desktop.pro
148 148qmake: qmake_all
149 149 @$(QMAKE) -o Makefile kdepim-desktop.pro
150variable_info: 150
151 @echo -------------------------------------- 151all: $(SUBTARGETS)
152 @echo KDEPIM buildsystem, variableinfo... 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)
153 @echo KDEPIMDIR=$(KDEPIMDIR) 153 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
154 @echo QTDIR=$(QTDIR) 154 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
155 @echo QPEDIR=$(QPEDIR) 155 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
156 @echo OPIEDIR=$(OPIEDIR) 156 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
157 @echo PLATFORM=$(PLATFORM) 157 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
158 @echo RELEASE_DEBUG=$(RELEASE_DEBUG) 158 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
159 @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) 159 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
160 @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) 160 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
161 @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) 161 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
162 @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN) 162 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
163 @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) 163 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
164 ifndef BUILD_NO_SHARP_PLUGIN 164 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
165 @echo SHARPDTMSDK=$(SHARPDTMSDK) 165 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
166 endif 166 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
167 @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU) 167 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
168 @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER) 168 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
169 @echo -------------------------------------- 169 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
170 170 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
171variable_test: variable_info 171clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
172 @echo KDEPIM buildsystem, variablecheck... 172 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true
173 ifndef KDEPIMDIR 173 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true
174 @echo KDEPIMDIR is not defined. 174 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
175 $(error KDEPIMDIR is not defined) 175 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
176 endif 176 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
177 ifndef PLATFORM 177 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
178 @echo PLATFORM is not defined. 178 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
179 $(error PLATFORM is not defined) 179 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
180 endif 180 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
181 ifdef BUILD_NO_LDAP_PLUGIN 181 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
182 @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) 182 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
183 endif 183 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
184 ifdef BUILD_NO_OPIE_PLUGIN 184 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; ) || true
185 @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) 185 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; ) || true
186 endif 186 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; ) || true
187 ifdef BUILD_NO_QTOPIA_PLUGIN 187 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; ) || true
188 @echo QTOPIA PLUGIN will not be build, because BUILD_NO__QTOPIA_PLUGIN is set to $(BUILD_NO__QTOPIA_PLUGIN) 188 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; ) || true
189 endif 189 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; ) || true
190 ifdef BUILD_NO_MICROMAIL 190uninstall_subdirs: qmake_all FORCE
191 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) 191 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
192 endif 192 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
193 ifdef BUILD_NO_SHARP_PLUGIN 193 ( [ -d libical ] && cd libical ; $(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) 194 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
195 else 195 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
196 ifndef SHARPDTMSDK 196 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
197 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) 197 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
198 $(error SHARPDTMSDK is not defined) 198 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
199 endif 199 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
200 endif 200 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
201 ifdef BUILD_NO_GAMMU 201 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
202 @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU) 202 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
203 endif 203 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
204 ifdef BUILD_NO_PWMANAGER 204 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
205 @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER) 205 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
206 endif 206 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
207 @echo -------------------------------------- 207 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
208 208 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
209 209install_subdirs: qmake_all FORCE
210objects: 210 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true
211 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done 211 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true
212 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done 212 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
213 mkdir -p libical/lib/$(PLATFORM) 213 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
214 mkdir -p pwmanager/libcrypt/$(PLATFORM) 214 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
215 215 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
216clean: 216 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
217 rm -rf libical/lib/$(PLATFORM)/*; 217 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
218 rm -rf pwmanager/libcrypt/$(PLATFORM)/*; 218 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
219 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ 219 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
220 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ 220 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
221 done 221 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
222 222 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) install; ) || true
223install: 223 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) install; ) || true
224 224 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) install; ) || true
225 cd bin/kdepim; make install 225 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) install; ) || true
226 cp -r Pim $(QPEDIR)/apps 226 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) install; ) || true
227 cp db2file/db2file $(QPEDIR)/bin/db2file 227 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) install; ) || true
228 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop 228distclean: qmake_all FORCE
229 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop 229 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
230 cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop 230 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
231 cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop 231 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
232 232 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
233dist: 233 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
234 @echo Dont forget to do "make install" before "make dist" 234 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
235 rm -f *arm.ipk 235 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
236 rm -f *~ 236 ( [ -d korganizer ] && cd korganizer ; $(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 237 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
238 mkipks kmicrokdelibs.control 238 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
239 mkipks korganizer.control 239 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
240 mkipks kaddressbook.control 240 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
241 ifndef BUILD_NO_MICROMAIL 241 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
242 mkipks kopiemail.control 242 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
243 endif 243 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
244 ifndef BUILD_NO_SHARP_PLUGIN 244 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
245 mkipks ksharpPIM-DTMaccess.control 245 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
246 endif 246 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
247 mkipks korganizer-alarm.control 247
248 ifndef BUILD_NO_GAMMU 248install: install_subdirs
249 mkipks kmobilephoneaccess.control 249
250 endif 250uninstall: uninstall_subdirs
251 ifndef BUILD_NO_PWMANAGER 251
252 mkipks pwmanager.control 252FORCE:
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
368 253
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 6194d6d..4c4ae09 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -501,129 +501,128 @@ int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool remo
501 QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); 501 QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
502 if ( !id.isEmpty() ) 502 if ( !id.isEmpty() )
503 (*it).setIDStr(id ); 503 (*it).setIDStr(id );
504 (*it).setResource( 0 ); 504 (*it).setResource( 0 );
505 if ( replaceLabel ) 505 if ( replaceLabel )
506 (*it).removeVoice(); 506 (*it).removeVoice();
507 if ( removeOld ) 507 if ( removeOld )
508 (*it).setTagged( true ); 508 (*it).setTagged( true );
509 insertAddressee( (*it), false, true ); 509 insertAddressee( (*it), false, true );
510 } 510 }
511 if ( removeOld ) 511 if ( removeOld )
512 removeUntagged(); 512 removeUntagged();
513 return list.count(); 513 return list.count();
514} 514}
515void AddressBook::setUntagged(bool setNonSyncTagged) // = false) 515void AddressBook::setUntagged(bool setNonSyncTagged) // = false)
516{ 516{
517 Iterator ait; 517 Iterator ait;
518 for ( ait = begin(); ait != end(); ++ait ) { 518 for ( ait = begin(); ait != end(); ++ait ) {
519 if ( setNonSyncTagged ) { 519 if ( setNonSyncTagged ) {
520 if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { 520 if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) {
521 (*ait).setTagged( true ); 521 (*ait).setTagged( true );
522 } else 522 } else
523 (*ait).setTagged( false ); 523 (*ait).setTagged( false );
524 } else 524 } else
525 (*ait).setTagged( false ); 525 (*ait).setTagged( false );
526 } 526 }
527} 527}
528void AddressBook::removeUntagged() 528void AddressBook::removeUntagged()
529{ 529{
530 Iterator ait; 530 Iterator ait;
531 bool todelete = false; 531 bool todelete = false;
532 Iterator todel; 532 Iterator todel;
533 for ( ait = begin(); ait != end(); ++ait ) { 533 for ( ait = begin(); ait != end(); ++ait ) {
534 if ( todelete ) 534 if ( todelete )
535 removeAddressee( todel ); 535 removeAddressee( todel );
536 if (!(*ait).tagged()) { 536 if (!(*ait).tagged()) {
537 todelete = true; 537 todelete = true;
538 todel = ait; 538 todel = ait;
539 } else 539 } else
540 todelete = false; 540 todelete = false;
541 } 541 }
542 if ( todelete ) 542 if ( todelete )
543 removeAddressee( todel ); 543 removeAddressee( todel );
544 deleteRemovedAddressees(); 544 deleteRemovedAddressees();
545} 545}
546void AddressBook::smplifyAddressees() 546void AddressBook::smplifyAddressees()
547{ 547{
548 Iterator ait; 548 Iterator ait;
549 for ( ait = begin(); ait != end(); ++ait ) { 549 for ( ait = begin(); ait != end(); ++ait ) {
550 (*ait).simplifyEmails(); 550 (*ait).simplifyEmails();
551 (*ait).simplifyPhoneNumbers(); 551 (*ait).simplifyPhoneNumbers();
552 (*ait).simplifyPhoneNumberTypes(); 552 (*ait).simplifyPhoneNumberTypes();
553 (*ait).simplifyAddresses(); 553 (*ait).simplifyAddresses();
554 } 554 }
555} 555}
556void AddressBook::removeSyncInfo( QString syncProfile) 556void AddressBook::removeSyncInfo( QString syncProfile)
557{ 557{
558 Iterator ait; 558 Iterator ait;
559 for ( ait = begin(); ait != end(); ++ait ) { 559 for ( ait = begin(); ait != end(); ++ait ) {
560 (*ait).removeID( syncProfile ); 560 (*ait).removeID( syncProfile );
561 } 561 }
562 if ( syncProfile.isEmpty() ) { 562 if ( syncProfile.isEmpty() ) {
563 Iterator it = begin(); 563 Iterator it = begin();
564 Iterator it2 ; 564 Iterator it2 ;
565 QDateTime dt ( QDate( 2004,1,1) );
566 while ( it != end() ) { 565 while ( it != end() ) {
567 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { 566 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
568 it2 = it; 567 it2 = it;
569 //qDebug("removing %s ",(*it).uid().latin1() ); 568 //qDebug("removing %s ",(*it).uid().latin1() );
570 ++it; 569 ++it;
571 removeAddressee( it2 ); 570 removeAddressee( it2 );
572 } else { 571 } else {
573 //qDebug("skipping %s ",(*it).uid().latin1() ); 572 //qDebug("skipping %s ",(*it).uid().latin1() );
574 ++it; 573 ++it;
575 } 574 }
576 } 575 }
577 } else { 576 } else {
578 Addressee lse; 577 Addressee lse;
579 lse = findByUid( "last-syncAddressee-"+ syncProfile ); 578 lse = findByUid( "last-syncAddressee-"+ syncProfile );
580 if ( ! lse.isEmpty() ) 579 if ( ! lse.isEmpty() )
581 removeAddressee( lse ); 580 removeAddressee( lse );
582 } 581 }
583 582
584} 583}
585void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) 584void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync )
586{ 585{
587 Iterator ait; 586 Iterator ait;
588 for ( ait = begin(); ait != end(); ++ait ) { 587 for ( ait = begin(); ait != end(); ++ait ) {
589 QString id = (*ait).IDStr(); 588 QString id = (*ait).IDStr();
590 (*ait).setIDStr( ":"); 589 (*ait).setIDStr( ":");
591 (*ait).setExternalUID( id ); 590 (*ait).setExternalUID( id );
592 (*ait).setOriginalExternalUID( id ); 591 (*ait).setOriginalExternalUID( id );
593 if ( isPreSync ) 592 if ( isPreSync )
594 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 593 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
595 else { 594 else {
596 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 595 (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
597 (*ait).setID( currentSyncDevice,id ); 596 (*ait).setID( currentSyncDevice,id );
598 597
599 } 598 }
600 } 599 }
601} 600}
602void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) 601void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice )
603{ 602{
604 603
605 setUntagged(); 604 setUntagged();
606 KABC::Addressee::List list; 605 KABC::Addressee::List list;
607 QFile file( fileName ); 606 QFile file( fileName );
608 file.open( IO_ReadOnly ); 607 file.open( IO_ReadOnly );
609 QByteArray rawData = file.readAll(); 608 QByteArray rawData = file.readAll();
610 file.close(); 609 file.close();
611 QString data; 610 QString data;
612 611
613 data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); 612 data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
614 KABC::VCardTool tool; 613 KABC::VCardTool tool;
615 list = tool.parseVCards( data ); 614 list = tool.parseVCards( data );
616 KABC::Addressee::List::Iterator it; 615 KABC::Addressee::List::Iterator it;
617 for ( it = list.begin(); it != list.end(); ++it ) { 616 for ( it = list.begin(); it != list.end(); ++it ) {
618 Iterator ait; 617 Iterator ait;
619 for ( ait = begin(); ait != end(); ++ait ) { 618 for ( ait = begin(); ait != end(); ++ait ) {
620 if ( !(*ait).tagged() ) { 619 if ( !(*ait).tagged() ) {
621 if ( (*ait).containsAdr(*it)) { 620 if ( (*ait).containsAdr(*it)) {
622 (*ait).setTagged(true); 621 (*ait).setTagged(true);
623 QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); 622 QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
624 (*it).setIDStr( ":"); 623 (*it).setIDStr( ":");
625 (*it).setID( currentSyncDevice,id ); 624 (*it).setID( currentSyncDevice,id );
626 (*it).setExternalUID( id ); 625 (*it).setExternalUID( id );
627 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 626 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
628 (*it).setUid( ( (*ait).uid() )); 627 (*it).setUid( ( (*ait).uid() ));
629 break; 628 break;
@@ -725,287 +724,282 @@ AddressBook::Iterator AddressBook::end()
725 724
726AddressBook::ConstIterator AddressBook::end() const 725AddressBook::ConstIterator AddressBook::end() const
727{ 726{
728 ConstIterator it = ConstIterator(); 727 ConstIterator it = ConstIterator();
729 it.d->mIt = d->mAddressees.end(); 728 it.d->mIt = d->mAddressees.end();
730 return it; 729 return it;
731} 730}
732 731
733void AddressBook::clear() 732void AddressBook::clear()
734{ 733{
735 d->mAddressees.clear(); 734 d->mAddressees.clear();
736} 735}
737 736
738Ticket *AddressBook::requestSaveTicket( Resource *resource ) 737Ticket *AddressBook::requestSaveTicket( Resource *resource )
739{ 738{
740 kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; 739 kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl;
741 740
742 if ( !resource ) 741 if ( !resource )
743 { 742 {
744 qDebug("AddressBook::requestSaveTicket no resource" ); 743 qDebug("AddressBook::requestSaveTicket no resource" );
745 resource = standardResource(); 744 resource = standardResource();
746 } 745 }
747 746
748 KRES::Manager<Resource>::ActiveIterator it; 747 KRES::Manager<Resource>::ActiveIterator it;
749 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { 748 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) {
750 if ( (*it) == resource ) { 749 if ( (*it) == resource ) {
751 if ( (*it)->readOnly() || !(*it)->isOpen() ) 750 if ( (*it)->readOnly() || !(*it)->isOpen() )
752 return 0; 751 return 0;
753 else 752 else
754 return (*it)->requestSaveTicket(); 753 return (*it)->requestSaveTicket();
755 } 754 }
756 } 755 }
757 756
758 return 0; 757 return 0;
759} 758}
760//void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); 759//void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false);
761void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) 760void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource )
762{ 761{
763 if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { 762 if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) {
764 //qDebug("block insert "); 763 //qDebug("block insert ");
765 return; 764 return;
766 } 765 }
767 //qDebug("inserting.... %s ",a.uid().latin1() ); 766 //qDebug("inserting.... %s ",a.uid().latin1() );
768 bool found = false; 767 bool found = false;
769 Addressee::List::Iterator it; 768 Addressee::List::Iterator it;
770 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { 769 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) {
771 if ( a.uid() == (*it).uid() ) { 770 if ( a.uid() == (*it).uid() ) {
772 771
773 bool changed = false; 772 bool changed = false;
774 Addressee addr = a; 773 Addressee addr = a;
775 if ( addr != (*it) ) 774 if ( addr != (*it) )
776 changed = true; 775 changed = true;
777 776
778 if ( takeResource ) { 777 if ( takeResource ) {
779 Resource * res = (*it).resource(); 778 Resource * res = (*it).resource();
780 (*it) = a; 779 (*it) = a;
781 (*it).setResource( res ); 780 (*it).setResource( res );
782 } else { 781 } else {
783 (*it) = a; 782 (*it) = a;
784 if ( (*it).resource() == 0 ) 783 if ( (*it).resource() == 0 )
785 (*it).setResource( standardResource() ); 784 (*it).setResource( standardResource() );
786 } 785 }
787 if ( changed ) { 786 if ( changed ) {
788 if ( setRev ) { 787 if ( setRev ) {
789 788 (*it).setRevision( QDateTime::currentDateTime() );
790 // get rid of micro seconds
791 QDateTime dt = QDateTime::currentDateTime();
792 QTime t = dt.time();
793 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
794 (*it).setRevision( dt );
795 } 789 }
796 (*it).setChanged( true ); 790 (*it).setChanged( true );
797 } 791 }
798 792
799 found = true; 793 found = true;
800 } else { 794 } else {
801 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { 795 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
802 QString name = (*it).uid().mid( 19 ); 796 QString name = (*it).uid().mid( 19 );
803 Addressee b = a; 797 Addressee b = a;
804 QString id = b.getID( name ); 798 QString id = b.getID( name );
805 if ( ! id.isEmpty() ) { 799 if ( ! id.isEmpty() ) {
806 QString des = (*it).note(); 800 QString des = (*it).note();
807 int startN; 801 int startN;
808 if( (startN = des.find( id ) ) >= 0 ) { 802 if( (startN = des.find( id ) ) >= 0 ) {
809 int endN = des.find( ",", startN+1 ); 803 int endN = des.find( ",", startN+1 );
810 des = des.left( startN ) + des.mid( endN+1 ); 804 des = des.left( startN ) + des.mid( endN+1 );
811 (*it).setNote( des ); 805 (*it).setNote( des );
812 } 806 }
813 } 807 }
814 } 808 }
815 } 809 }
816 } 810 }
817 if ( found ) 811 if ( found )
818 return; 812 return;
813
819 d->mAddressees.append( a ); 814 d->mAddressees.append( a );
820 Addressee& addr = d->mAddressees.last(); 815 Addressee& addr = d->mAddressees.last();
821 if ( addr.resource() == 0 ) 816 if ( addr.resource() == 0 )
822 addr.setResource( standardResource() ); 817 addr.setResource( standardResource() );
823
824 addr.setChanged( true ); 818 addr.setChanged( true );
825} 819}
826 820
827void AddressBook::removeAddressee( const Addressee &a ) 821void AddressBook::removeAddressee( const Addressee &a )
828{ 822{
829 Iterator it; 823 Iterator it;
830 Iterator it2; 824 Iterator it2;
831 bool found = false; 825 bool found = false;
832 for ( it = begin(); it != end(); ++it ) { 826 for ( it = begin(); it != end(); ++it ) {
833 if ( a.uid() == (*it).uid() ) { 827 if ( a.uid() == (*it).uid() ) {
834 found = true; 828 found = true;
835 it2 = it; 829 it2 = it;
836 } else { 830 } else {
837 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { 831 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
838 QString name = (*it).uid().mid( 19 ); 832 QString name = (*it).uid().mid( 19 );
839 Addressee b = a; 833 Addressee b = a;
840 QString id = b.getID( name ); 834 QString id = b.getID( name );
841 if ( ! id.isEmpty() ) { 835 if ( ! id.isEmpty() ) {
842 QString des = (*it).note(); 836 QString des = (*it).note();
843 if( des.find( id ) < 0 ) { 837 if( des.find( id ) < 0 ) {
844 des += id + ","; 838 des += id + ",";
845 (*it).setNote( des ); 839 (*it).setNote( des );
846 } 840 }
847 } 841 }
848 } 842 }
849 843
850 } 844 }
851 } 845 }
852 846
853 if ( found ) 847 if ( found )
854 removeAddressee( it2 ); 848 removeAddressee( it2 );
855 849
856} 850}
857 851
858void AddressBook::removeSyncAddressees( bool removeDeleted ) 852void AddressBook::removeSyncAddressees( bool removeDeleted )
859{ 853{
860 Iterator it = begin(); 854 Iterator it = begin();
861 Iterator it2 ; 855 Iterator it2 ;
862 QDateTime dt ( QDate( 2004,1,1) ); 856 QDateTime dt ( QDate( 2003,1,1) );
863 while ( it != end() ) { 857 while ( it != end() ) {
864 (*it).setRevision( dt ); 858 (*it).setRevision( dt );
865 if (( *it).IDStr() != "changed" ) { 859 if (( *it).IDStr() != "changed" ) {
866 // "changed" is used for tagging changed addressees when syncing with KDE or OL 860 // "changed" is used for tagging changed addressees when syncing with KDE or OL
867 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); 861 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
868 (*it).setIDStr(""); 862 (*it).setIDStr(":");
869 } 863 }
870 if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { 864 if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
871 it2 = it; 865 it2 = it;
872 //qDebug("removing %s ",(*it).uid().latin1() ); 866 //qDebug("removing %s ",(*it).uid().latin1() );
873 ++it; 867 ++it;
874 removeAddressee( it2 ); 868 removeAddressee( it2 );
875 } else { 869 } else {
876 //qDebug("skipping %s ",(*it).uid().latin1() ); 870 //qDebug("skipping %s ",(*it).uid().latin1() );
877 if ( removeDeleted ) { 871 if ( removeDeleted ) {
878 // we have no postprocessing in the resource, we have to do it here 872 // we have no postprocessing in the resource, we have to do it here
879 // we have to compute csum for all, because it could be the first sync 873 // we have to compute csum for all, because it could be the first sync
880 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 874 (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
881
882
883 } 875 }
884 ++it; 876 ++it;
885 } 877 }
886 } 878 }
887 deleteRemovedAddressees(); 879 deleteRemovedAddressees();
888} 880}
889 881
890void AddressBook::removeAddressee( const Iterator &it ) 882void AddressBook::removeAddressee( const Iterator &it )
891{ 883{
892 d->mRemovedAddressees.append( (*it) ); 884 d->mRemovedAddressees.append( (*it) );
893 d->mAddressees.remove( it.d->mIt ); 885 d->mAddressees.remove( it.d->mIt );
894} 886}
895 887
896AddressBook::Iterator AddressBook::find( const Addressee &a ) 888AddressBook::Iterator AddressBook::find( const Addressee &a )
897{ 889{
898 Iterator it; 890 Iterator it;
899 for ( it = begin(); it != end(); ++it ) { 891 for ( it = begin(); it != end(); ++it ) {
900 if ( a.uid() == (*it).uid() ) { 892 if ( a.uid() == (*it).uid() ) {
901 return it; 893 return it;
902 } 894 }
903 } 895 }
904 return end(); 896 return end();
905} 897}
906 898
907Addressee AddressBook::findByUid( const QString &uid ) 899Addressee AddressBook::findByUid( const QString &uid )
908{ 900{
909 Iterator it; 901 Iterator it;
910 for ( it = begin(); it != end(); ++it ) { 902 for ( it = begin(); it != end(); ++it ) {
911 if ( uid == (*it).uid() ) { 903 if ( uid == (*it).uid() ) {
912 return *it; 904 return *it;
913 } 905 }
914 } 906 }
915 return Addressee(); 907 return Addressee();
916} 908}
917void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) 909void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset )
918{ 910{
919 //qDebug("AddressBook::preExternSync "); 911 //qDebug("AddressBook::preExternSync ");
920 AddressBook::Iterator it; 912 AddressBook::Iterator it;
921 for ( it = begin(); it != end(); ++it ) { 913 for ( it = begin(); it != end(); ++it ) {
922 (*it).setID( csd, (*it).externalUID() ); 914 (*it).setID( csd, (*it).externalUID() );
923 (*it).computeCsum( csd ); 915 (*it).computeCsum( csd );
924 } 916 }
925 mergeAB( aBook ,csd, isSubset ); 917 mergeAB( aBook ,csd, isSubset );
926} 918}
927void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) 919void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID)
928{ 920{
929 //qDebug("AddressBook::postExternSync "); 921 //qDebug("AddressBook::postExternSync ");
930 AddressBook::Iterator it; 922 AddressBook::Iterator it;
931 for ( it = begin(); it != end(); ++it ) { 923 for ( it = begin(); it != end(); ++it ) {
932 //qDebug("check uid %s ", (*it).uid().latin1() ); 924 //qDebug("check uid %s ", (*it).uid().latin1() );
933 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || 925 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
934 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { 926 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ||
927 (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) {
935 Addressee ad = aBook->findByUid( ( (*it).uid() )); 928 Addressee ad = aBook->findByUid( ( (*it).uid() ));
936 if ( ad.isEmpty() ) { 929 if ( ad.isEmpty() ) {
937 qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); 930 qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
938 } else { 931 } else {
939 (*it).setIDStr(":"); 932 (*it).setIDStr(":");
940 (*it).computeCsum( csd );
941 if ( setID ) { 933 if ( setID ) {
942 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) 934 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
943 ad.setID( csd, (*it).externalUID() ); 935 ad.setID( csd, (*it).externalUID() );
944 } else 936 } else
945 ad.setID( csd, (*it).uid() ); 937 ad.setID( csd, (*it).uid() );
938 (*it).computeCsum( csd );
946 ad.setCsum( csd, (*it).getCsum( csd ) ); 939 ad.setCsum( csd, (*it).getCsum( csd ) );
947 aBook->insertAddressee( ad ); 940 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() );
941 aBook->insertAddressee( ad , false);
948 } 942 }
949 } 943 }
950 } 944 }
951} 945}
952 946
953bool AddressBook::containsExternalUid( const QString& uid ) 947bool AddressBook::containsExternalUid( const QString& uid )
954{ 948{
955 Iterator it; 949 Iterator it;
956 for ( it = begin(); it != end(); ++it ) { 950 for ( it = begin(); it != end(); ++it ) {
957 if ( uid == (*it).externalUID( ) ) 951 if ( uid == (*it).externalUID( ) )
958 return true; 952 return true;
959 } 953 }
960 return false; 954 return false;
961} 955}
962Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) 956Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile )
963{ 957{
964 Iterator it; 958 Iterator it;
965 for ( it = begin(); it != end(); ++it ) { 959 for ( it = begin(); it != end(); ++it ) {
966 if ( uid == (*it).getID( profile ) ) 960 if ( uid == (*it).getID( profile ) )
967 return (*it); 961 return (*it);
968 } 962 }
969 return Addressee(); 963 return Addressee();
970} 964}
971void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) 965void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset )
972{ 966{
973 Iterator it; 967 Iterator it;
974 Addressee ad; 968 Addressee ad;
975 for ( it = begin(); it != end(); ++it ) { 969 for ( it = begin(); it != end(); ++it ) {
976 ad = aBook->findByExternUid( (*it).externalUID(), profile ); 970 ad = aBook->findByExternUid( (*it).externalUID(), profile );
977 if ( !ad.isEmpty() ) { 971 if ( !ad.isEmpty() ) {
978 (*it).mergeContact( ad ,isSubset); 972 (*it).mergeContact( ad ,isSubset);
979 } 973 }
980 } 974 }
981#if 0 975#if 0
982 // test only 976 // test only
983 for ( it = begin(); it != end(); ++it ) { 977 for ( it = begin(); it != end(); ++it ) {
984 978
985 qDebug("uid %s ", (*it).uid().latin1()); 979 qDebug("uid %s ", (*it).uid().latin1());
986 } 980 }
987#endif 981#endif
988} 982}
989 983
990#if 0 984#if 0
991Addressee::List AddressBook::getExternLastSyncAddressees() 985Addressee::List AddressBook::getExternLastSyncAddressees()
992{ 986{
993 Addressee::List results; 987 Addressee::List results;
994 988
995 Iterator it; 989 Iterator it;
996 for ( it = begin(); it != end(); ++it ) { 990 for ( it = begin(); it != end(); ++it ) {
997 if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { 991 if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) {
998 if ( (*it).familyName().left(4) == "!E: " ) 992 if ( (*it).familyName().left(4) == "!E: " )
999 results.append( *it ); 993 results.append( *it );
1000 } 994 }
1001 } 995 }
1002 996
1003 return results; 997 return results;
1004} 998}
1005#endif 999#endif
1006void AddressBook::resetTempSyncStat() 1000void AddressBook::resetTempSyncStat()
1007{ 1001{
1008 Iterator it; 1002 Iterator it;
1009 for ( it = begin(); it != end(); ++it ) { 1003 for ( it = begin(); it != end(); ++it ) {
1010 (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); 1004 (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL );
1011 } 1005 }
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index d5a110a..3d4992c 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -148,186 +148,196 @@ bool Addressee::operator==( const Addressee &a ) const
148 if ( mData->title != a.mData->title ) return false; 148 if ( mData->title != a.mData->title ) return false;
149 if ( mData->role != a.mData->role ) return false; 149 if ( mData->role != a.mData->role ) return false;
150 if ( mData->organization != a.mData->organization ) return false; 150 if ( mData->organization != a.mData->organization ) return false;
151 if ( mData->note != a.mData->note ) return false; 151 if ( mData->note != a.mData->note ) return false;
152 if ( mData->productId != a.mData->productId ) return false; 152 if ( mData->productId != a.mData->productId ) return false;
153 //if ( mData->revision != a.mData->revision ) return false; 153 //if ( mData->revision != a.mData->revision ) return false;
154 if ( mData->sortString != a.mData->sortString ) return false; 154 if ( mData->sortString != a.mData->sortString ) return false;
155 if ( mData->secrecy != a.mData->secrecy ) return false; 155 if ( mData->secrecy != a.mData->secrecy ) return false;
156 if ( mData->logo != a.mData->logo ) return false; 156 if ( mData->logo != a.mData->logo ) return false;
157 if ( mData->photo != a.mData->photo ) return false; 157 if ( mData->photo != a.mData->photo ) return false;
158 if ( mData->sound != a.mData->sound ) return false; 158 if ( mData->sound != a.mData->sound ) return false;
159 if ( mData->agent != a.mData->agent ) return false; 159 if ( mData->agent != a.mData->agent ) return false;
160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
161 ( mData->url != a.mData->url ) ) return false; 161 ( mData->url != a.mData->url ) ) return false;
162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
163 if ( mData->addresses != a.mData->addresses ) return false; 163 if ( mData->addresses != a.mData->addresses ) return false;
164 if ( mData->keys != a.mData->keys ) return false; 164 if ( mData->keys != a.mData->keys ) return false;
165 if ( mData->emails != a.mData->emails ) return false; 165 if ( mData->emails != a.mData->emails ) return false;
166 if ( mData->categories != a.mData->categories ) return false; 166 if ( mData->categories != a.mData->categories ) return false;
167 if ( mData->custom != a.mData->custom ) return false; 167 if ( mData->custom != a.mData->custom ) return false;
168 168
169 return true; 169 return true;
170} 170}
171 171
172bool Addressee::operator!=( const Addressee &a ) const 172bool Addressee::operator!=( const Addressee &a ) const
173{ 173{
174 return !( a == *this ); 174 return !( a == *this );
175} 175}
176 176
177bool Addressee::isEmpty() const 177bool Addressee::isEmpty() const
178{ 178{
179 return mData->empty; 179 return mData->empty;
180} 180}
181ulong Addressee::getCsum4List( const QStringList & attList) 181ulong Addressee::getCsum4List( const QStringList & attList)
182{ 182{
183 int max = attList.count(); 183 int max = attList.count();
184 ulong cSum = 0; 184 ulong cSum = 0;
185 int j,k,i; 185 int j,k,i;
186 int add; 186 int add;
187 for ( i = 0; i < max ; ++i ) { 187 for ( i = 0; i < max ; ++i ) {
188 QString s = attList[i]; 188 QString s = attList[i];
189 if ( ! s.isEmpty() ){ 189 if ( ! s.isEmpty() ){
190 j = s.length(); 190 j = s.length();
191 for ( k = 0; k < j; ++k ) { 191 for ( k = 0; k < j; ++k ) {
192 int mul = k +1; 192 int mul = k +1;
193 add = s[k].unicode (); 193 add = s[k].unicode ();
194 if ( k < 16 ) 194 if ( k < 16 )
195 mul = mul * mul; 195 mul = mul * mul;
196 int ii = i+1; 196 int ii = i+1;
197 add = add * mul *ii*ii*ii; 197 add = add * mul *ii*ii*ii;
198 cSum += add; 198 cSum += add;
199 } 199 }
200 } 200 }
201 201
202 } 202 }
203 //QString dump = attList.join(","); 203 //QString dump = attList.join(",");
204 //qDebug("csum: %d %s", cSum,dump.latin1()); 204 //qDebug("csum: %d %s", cSum,dump.latin1());
205 205
206 return cSum; 206 return cSum;
207 207
208} 208}
209void Addressee::computeCsum(const QString &dev) 209void Addressee::computeCsum(const QString &dev)
210{ 210{
211 QStringList l; 211 QStringList l;
212 if ( !mData->name.isEmpty() ) l.append(mData->name); 212 //if ( !mData->name.isEmpty() ) l.append(mData->name);
213 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 213 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
216 if ( !mData->additionalName ) l.append( mData->additionalName ); 216 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
224 if ( !mData->title .isEmpty() ) l.append( mData->title ); 224 if ( !mData->title .isEmpty() ) l.append( mData->title );
225 if ( !mData->role.isEmpty() ) l.append( mData->role ); 225 if ( !mData->role.isEmpty() ) l.append( mData->role );
226 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 226 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
227 if ( !mData->note.isEmpty() ) l.append( mData->note ); 227 if ( !mData->note.isEmpty() ) l.append( mData->note );
228 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 228 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
231 // if ( !mData->logo.isEmpty() ) l.append( ); 231 // if ( !mData->logo.isEmpty() ) l.append( );
232 //if ( !mData->photo.isEmpty() ) l.append( ); 232 //if ( !mData->photo.isEmpty() ) l.append( );
233 //if ( !mData->sound.isEmpty() ) l.append( ); 233 //if ( !mData->sound.isEmpty() ) l.append( );
234 //if ( !mData->agent.isEmpty() ) l.append( ); 234 //if ( !mData->agent.isEmpty() ) l.append( );
235 if ( mData->url.isValid() ) 235 if ( mData->url.isValid() )
236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
237 KABC::PhoneNumber::List phoneNumbers; 237 KABC::PhoneNumber::List phoneNumbers;
238 KABC::PhoneNumber::List::Iterator phoneIter; 238 KABC::PhoneNumber::List::Iterator phoneIter;
239 239
240 QStringList t; 240 QStringList t;
241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
242 ++phoneIter ) 242 ++phoneIter )
243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
244 t.sort(); 244 t.sort();
245 uint iii; 245 uint iii;
246 for ( iii = 0; iii < t.count(); ++iii) 246 for ( iii = 0; iii < t.count(); ++iii)
247 l.append( t[iii] ); 247 l.append( t[iii] );
248 t = mData->emails; 248 t = mData->emails;
249 t.sort(); 249 t.sort();
250 for ( iii = 0; iii < t.count(); ++iii) 250 for ( iii = 0; iii < t.count(); ++iii)
251 l.append( t[iii] ); 251 l.append( t[iii] );
252 t = mData->categories; 252 t = mData->categories;
253 t.sort(); 253 t.sort();
254 for ( iii = 0; iii < t.count(); ++iii) 254 for ( iii = 0; iii < t.count(); ++iii)
255 l.append( t[iii] ); 255 l.append( t[iii] );
256 t = mData->custom; 256 t = mData->custom;
257 t.sort(); 257 t.sort();
258 for ( iii = 0; iii < t.count(); ++iii) 258 for ( iii = 0; iii < t.count(); ++iii)
259 l.append( t[iii] ); 259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
260 int find = t[iii].find (':')+1;
261 //qDebug("lennnn %d %d ", find, t[iii].length());
262 if ( find < t[iii].length())
263 l.append( t[iii] );
264
265 }
260 KABC::Address::List::Iterator addressIter; 266 KABC::Address::List::Iterator addressIter;
261 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
262 ++addressIter ) { 268 ++addressIter ) {
263 t = (*addressIter).asList(); 269 t = (*addressIter).asList();
264 t.sort(); 270 t.sort();
265 for ( iii = 0; iii < t.count(); ++iii) 271 for ( iii = 0; iii < t.count(); ++iii)
266 l.append( t[iii] ); 272 l.append( t[iii] );
267 } 273 }
268 uint cs = getCsum4List(l); 274 uint cs = getCsum4List(l);
269 //qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 275#if 1
276 for ( iii = 0; iii < l.count(); ++iii)
277 qDebug("%d***%s***",iii,l[iii].latin1());
278 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
279#endif
270 setCsum( dev, QString::number (cs )); 280 setCsum( dev, QString::number (cs ));
271} 281}
272 282
273void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 283void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
274{ 284{
275 285
276 detach(); 286 detach();
277 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 287 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
278 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 288 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
279 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 289 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
280 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 290 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
281 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 291 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
282 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 292 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
283 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 293 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
284 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 294 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
285 if ( !mData->birthday.isValid() ) 295 if ( !mData->birthday.isValid() )
286 if ( ad.mData->birthday.isValid()) 296 if ( ad.mData->birthday.isValid())
287 mData->birthday = ad.mData->birthday; 297 mData->birthday = ad.mData->birthday;
288 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 298 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
289 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 299 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
290 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 300 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
291 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 301 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
292 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 302 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
293 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 303 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
294 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 304 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
295 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 305 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
296 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 306 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
297 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 307 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
298 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 308 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
299 QStringList t; 309 QStringList t;
300 QStringList tAD; 310 QStringList tAD;
301 uint iii; 311 uint iii;
302 312
303 // ********** phone numbers 313 // ********** phone numbers
304 PhoneNumber::List phoneAD = ad.phoneNumbers(); 314 PhoneNumber::List phoneAD = ad.phoneNumbers();
305 PhoneNumber::List::Iterator phoneItAD; 315 PhoneNumber::List::Iterator phoneItAD;
306 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 316 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
307 bool found = false; 317 bool found = false;
308 PhoneNumber::List::Iterator it; 318 PhoneNumber::List::Iterator it;
309 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 319 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
310 if ( ( *phoneItAD ).contains( (*it) ) ) { 320 if ( ( *phoneItAD ).contains( (*it) ) ) {
311 found = true; 321 found = true;
312 (*it).setType( ( *phoneItAD ).type() ); 322 (*it).setType( ( *phoneItAD ).type() );
313 (*it).setNumber( ( *phoneItAD ).number() ); 323 (*it).setNumber( ( *phoneItAD ).number() );
314 break; 324 break;
315 } 325 }
316 } 326 }
317 if ( isSubSet && ! found ) 327 if ( isSubSet && ! found )
318 mData->phoneNumbers.append( *phoneItAD ); 328 mData->phoneNumbers.append( *phoneItAD );
319 } 329 }
320 if ( isSubSet ) { 330 if ( isSubSet ) {
321 // ************* emails; 331 // ************* emails;
322 t = mData->emails; 332 t = mData->emails;
323 tAD = ad.mData->emails; 333 tAD = ad.mData->emails;
324 for ( iii = 0; iii < tAD.count(); ++iii) 334 for ( iii = 0; iii < tAD.count(); ++iii)
325 if ( !t.contains(tAD[iii] ) ) 335 if ( !t.contains(tAD[iii] ) )
326 mData->emails.append( tAD[iii] ); 336 mData->emails.append( tAD[iii] );
327 } 337 }
328 338
329 // ************* categories; 339 // ************* categories;
330 t = mData->categories; 340 t = mData->categories;
331 tAD = ad.mData->categories; 341 tAD = ad.mData->categories;
332 for ( iii = 0; iii < tAD.count(); ++iii) 342 for ( iii = 0; iii < tAD.count(); ++iii)
333 if ( !t.contains(tAD[iii] ) ) 343 if ( !t.contains(tAD[iii] ) )
@@ -1050,129 +1060,132 @@ QString Addressee::roleLabel()
1050 1060
1051 1061
1052void Addressee::setOrganization( const QString &organization ) 1062void Addressee::setOrganization( const QString &organization )
1053{ 1063{
1054 if ( organization == mData->organization ) return; 1064 if ( organization == mData->organization ) return;
1055 detach(); 1065 detach();
1056 mData->empty = false; 1066 mData->empty = false;
1057 mData->organization = organization; 1067 mData->organization = organization;
1058} 1068}
1059 1069
1060QString Addressee::organization() const 1070QString Addressee::organization() const
1061{ 1071{
1062 return mData->organization; 1072 return mData->organization;
1063} 1073}
1064 1074
1065QString Addressee::organizationLabel() 1075QString Addressee::organizationLabel()
1066{ 1076{
1067 return i18n("Organization"); 1077 return i18n("Organization");
1068} 1078}
1069 1079
1070 1080
1071void Addressee::setNote( const QString &note ) 1081void Addressee::setNote( const QString &note )
1072{ 1082{
1073 if ( note == mData->note ) return; 1083 if ( note == mData->note ) return;
1074 detach(); 1084 detach();
1075 mData->empty = false; 1085 mData->empty = false;
1076 mData->note = note; 1086 mData->note = note;
1077} 1087}
1078 1088
1079QString Addressee::note() const 1089QString Addressee::note() const
1080{ 1090{
1081 return mData->note; 1091 return mData->note;
1082} 1092}
1083 1093
1084QString Addressee::noteLabel() 1094QString Addressee::noteLabel()
1085{ 1095{
1086 return i18n("Note"); 1096 return i18n("Note");
1087} 1097}
1088 1098
1089 1099
1090void Addressee::setProductId( const QString &productId ) 1100void Addressee::setProductId( const QString &productId )
1091{ 1101{
1092 if ( productId == mData->productId ) return; 1102 if ( productId == mData->productId ) return;
1093 detach(); 1103 detach();
1094 mData->empty = false; 1104 mData->empty = false;
1095 mData->productId = productId; 1105 mData->productId = productId;
1096} 1106}
1097 1107
1098QString Addressee::productId() const 1108QString Addressee::productId() const
1099{ 1109{
1100 return mData->productId; 1110 return mData->productId;
1101} 1111}
1102 1112
1103QString Addressee::productIdLabel() 1113QString Addressee::productIdLabel()
1104{ 1114{
1105 return i18n("Product Identifier"); 1115 return i18n("Product Identifier");
1106} 1116}
1107 1117
1108 1118
1109void Addressee::setRevision( const QDateTime &revision ) 1119void Addressee::setRevision( const QDateTime &revision )
1110{ 1120{
1111 if ( revision == mData->revision ) return; 1121 if ( revision == mData->revision ) return;
1112 detach(); 1122 detach();
1113 mData->empty = false; 1123 mData->empty = false;
1114 mData->revision = revision; 1124 mData->revision = QDateTime( revision.date(),
1125 QTime (revision.time().hour(),
1126 revision.time().minute(),
1127 revision.time().second()));
1115} 1128}
1116 1129
1117QDateTime Addressee::revision() const 1130QDateTime Addressee::revision() const
1118{ 1131{
1119 return mData->revision; 1132 return mData->revision;
1120} 1133}
1121 1134
1122QString Addressee::revisionLabel() 1135QString Addressee::revisionLabel()
1123{ 1136{
1124 return i18n("Revision Date"); 1137 return i18n("Revision Date");
1125} 1138}
1126 1139
1127 1140
1128void Addressee::setSortString( const QString &sortString ) 1141void Addressee::setSortString( const QString &sortString )
1129{ 1142{
1130 if ( sortString == mData->sortString ) return; 1143 if ( sortString == mData->sortString ) return;
1131 detach(); 1144 detach();
1132 mData->empty = false; 1145 mData->empty = false;
1133 mData->sortString = sortString; 1146 mData->sortString = sortString;
1134} 1147}
1135 1148
1136QString Addressee::sortString() const 1149QString Addressee::sortString() const
1137{ 1150{
1138 return mData->sortString; 1151 return mData->sortString;
1139} 1152}
1140 1153
1141QString Addressee::sortStringLabel() 1154QString Addressee::sortStringLabel()
1142{ 1155{
1143 return i18n("Sort String"); 1156 return i18n("Sort String");
1144} 1157}
1145 1158
1146 1159
1147void Addressee::setUrl( const KURL &url ) 1160void Addressee::setUrl( const KURL &url )
1148{ 1161{
1149 if ( url == mData->url ) return; 1162 if ( url == mData->url ) return;
1150 detach(); 1163 detach();
1151 mData->empty = false; 1164 mData->empty = false;
1152 mData->url = url; 1165 mData->url = url;
1153} 1166}
1154 1167
1155KURL Addressee::url() const 1168KURL Addressee::url() const
1156{ 1169{
1157 return mData->url; 1170 return mData->url;
1158} 1171}
1159 1172
1160QString Addressee::urlLabel() 1173QString Addressee::urlLabel()
1161{ 1174{
1162 return i18n("URL"); 1175 return i18n("URL");
1163} 1176}
1164 1177
1165 1178
1166void Addressee::setSecrecy( const Secrecy &secrecy ) 1179void Addressee::setSecrecy( const Secrecy &secrecy )
1167{ 1180{
1168 if ( secrecy == mData->secrecy ) return; 1181 if ( secrecy == mData->secrecy ) return;
1169 detach(); 1182 detach();
1170 mData->empty = false; 1183 mData->empty = false;
1171 mData->secrecy = secrecy; 1184 mData->secrecy = secrecy;
1172} 1185}
1173 1186
1174Secrecy Addressee::secrecy() const 1187Secrecy Addressee::secrecy() const
1175{ 1188{
1176 return mData->secrecy; 1189 return mData->secrecy;
1177} 1190}
1178 1191
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 012780b..3397e06 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -999,129 +999,131 @@ void AddresseeEditorWidget::load()
999 mFormattedNameLabel->setText( mAddressee.formattedName() ); 999 mFormattedNameLabel->setText( mAddressee.formattedName() );
1000 1000
1001 mRoleEdit->setText( mAddressee.role() ); 1001 mRoleEdit->setText( mAddressee.role() );
1002 mOrgEdit->setText( mAddressee.organization() ); 1002 mOrgEdit->setText( mAddressee.organization() );
1003 1003
1004//US mURLEdit->setURL( mAddressee.url().url() ); 1004//US mURLEdit->setURL( mAddressee.url().url() );
1005 mURLEdit->setText( mAddressee.url().prettyURL() ); 1005 mURLEdit->setText( mAddressee.url().prettyURL() );
1006//US?? mURLEdit->home( false ); 1006//US?? mURLEdit->home( false );
1007 1007
1008 // mNoteEdit->setText( mAddressee.note() ); 1008 // mNoteEdit->setText( mAddressee.note() );
1009 mNoteEdit->setText( mAddressee.note() ); 1009 mNoteEdit->setText( mAddressee.note() );
1010 mEmailWidget->setEmails( mAddressee.emails() ); 1010 mEmailWidget->setEmails( mAddressee.emails() );
1011 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 1011 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
1012 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 1012 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
1013 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 1013 mBirthdayPicker->setDate( mAddressee.birthday().date() );
1014 1014
1015//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 1015//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
1016//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 1016//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
1017 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1017 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1018 "%Y-%m-%d"); // = Qt::ISODate 1018 "%Y-%m-%d"); // = Qt::ISODate
1019 mAnniversaryPicker->setDate( dt ); 1019 mAnniversaryPicker->setDate( dt );
1020 1020
1021 1021
1022 mNicknameEdit->setText( mAddressee.nickName() ); 1022 mNicknameEdit->setText( mAddressee.nickName() );
1023 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1023 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1024 1024
1025 mGeoWidget->setGeo( mAddressee.geo() ); 1025 mGeoWidget->setGeo( mAddressee.geo() );
1026 mImageWidget->setPhoto( mAddressee.photo() ); 1026 mImageWidget->setPhoto( mAddressee.photo() );
1027 mImageWidget->setLogo( mAddressee.logo() ); 1027 mImageWidget->setLogo( mAddressee.logo() );
1028 mKeyWidget->setKeys( mAddressee.keys() ); 1028 mKeyWidget->setKeys( mAddressee.keys() );
1029 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1029 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1030#ifndef KAB_EMBEDDED 1030#ifndef KAB_EMBEDDED
1031 mSoundWidget->setSound( mAddressee.sound() ); 1031 mSoundWidget->setSound( mAddressee.sound() );
1032#else //KAB_EMBEDDED 1032#else //KAB_EMBEDDED
1033//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1033//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1034#endif //KAB_EMBEDDED 1034#endif //KAB_EMBEDDED
1035 1035
1036 // Load customs 1036 // Load customs
1037 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1037 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1038 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1038 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1039 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); 1039 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
1040 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1040 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1041 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1041 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1042 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1042 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1043 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1043 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1044 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1044 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1045 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 1045 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
1046 if ( gen == "female" ) 1046 if ( gen == "female" )
1047 mGenderBox->setCurrentItem ( 1 ); 1047 mGenderBox->setCurrentItem ( 1 );
1048 else if ( gen == "male" ) 1048 else if ( gen == "male" )
1049 mGenderBox->setCurrentItem ( 2 ); 1049 mGenderBox->setCurrentItem ( 2 );
1050 else 1050 else
1051 mGenderBox->setCurrentItem ( 0 ); 1051 mGenderBox->setCurrentItem ( 0 );
1052 blockSignals( block ); 1052 blockSignals( block );
1053 mBlockSignals = false; 1053 mBlockSignals = false;
1054 1054
1055 mDirty = false; 1055 mDirty = false;
1056} 1056}
1057 1057
1058void AddresseeEditorWidget::save() 1058void AddresseeEditorWidget::save()
1059{ 1059{
1060 if ( !dirty() ) { 1060 if ( !dirty() ) {
1061 return; 1061 return;
1062 } 1062 }
1063 1063
1064 mAddressee.setRevision( QDateTime::currentDateTime() );
1065
1064 mAddressee.setRole( mRoleEdit->text() ); 1066 mAddressee.setRole( mRoleEdit->text() );
1065 mAddressee.setOrganization( mOrgEdit->text() ); 1067 mAddressee.setOrganization( mOrgEdit->text() );
1066 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1068 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1067 mAddressee.setNote( mNoteEdit->text() ); 1069 mAddressee.setNote( mNoteEdit->text() );
1068 if ( mBirthdayPicker->inputIsValid() ) { 1070 if ( mBirthdayPicker->inputIsValid() ) {
1069 QDate da = mBirthdayPicker->date(); 1071 QDate da = mBirthdayPicker->date();
1070 if ( da > QDate::currentDate() ) 1072 if ( da > QDate::currentDate() )
1071 da.setYMD(da.year()-100, da.month(), da.day() ); 1073 da.setYMD(da.year()-100, da.month(), da.day() );
1072 mAddressee.setBirthday( QDateTime( da ) ); 1074 mAddressee.setBirthday( QDateTime( da ) );
1073 //qDebug("bday %s ",da.toString().latin1()); 1075 //qDebug("bday %s ",da.toString().latin1());
1074 } 1076 }
1075 else { 1077 else {
1076 mAddressee.setBirthday( QDateTime() ); 1078 mAddressee.setBirthday( QDateTime() );
1077 mBirthdayPicker->clear(); 1079 mBirthdayPicker->clear();
1078 } 1080 }
1079 mAddressee.setNickName( mNicknameEdit->text() ); 1081 mAddressee.setNickName( mNicknameEdit->text() );
1080 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1082 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1081 1083
1082 mAddressee.setGeo( mGeoWidget->geo() ); 1084 mAddressee.setGeo( mGeoWidget->geo() );
1083 mAddressee.setPhoto( mImageWidget->photo() ); 1085 mAddressee.setPhoto( mImageWidget->photo() );
1084 mAddressee.setLogo( mImageWidget->logo() ); 1086 mAddressee.setLogo( mImageWidget->logo() );
1085 mAddressee.setKeys( mKeyWidget->keys() ); 1087 mAddressee.setKeys( mKeyWidget->keys() );
1086#ifndef KAB_EMBEDDED 1088#ifndef KAB_EMBEDDED
1087 mAddressee.setSound( mSoundWidget->sound() ); 1089 mAddressee.setSound( mSoundWidget->sound() );
1088#else //KAB_EMBEDDED 1090#else //KAB_EMBEDDED
1089//US qDebug("AddresseeEditorWidget::save sound not supported"); 1091//US qDebug("AddresseeEditorWidget::save sound not supported");
1090#endif //KAB_EMBEDDED 1092#endif //KAB_EMBEDDED
1091 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1093 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1092 1094
1093 // save custom fields 1095 // save custom fields
1094 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1096 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1095 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1097 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1096 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); 1098 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() );
1097 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1099 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1098 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1100 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1099 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1101 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1100 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1102 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1101 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1103 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1102 if ( mAnniversaryPicker->inputIsValid() ) { 1104 if ( mAnniversaryPicker->inputIsValid() ) {
1103 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1105 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1104 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1106 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1105 } 1107 }
1106 else { 1108 else {
1107 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1109 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1108 mAnniversaryPicker->clear(); 1110 mAnniversaryPicker->clear();
1109 } 1111 }
1110 int gen = mGenderBox->currentItem (); 1112 int gen = mGenderBox->currentItem ();
1111 if ( gen == 1 ) 1113 if ( gen == 1 )
1112 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 1114 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
1113 else if ( gen == 2 ) 1115 else if ( gen == 2 )
1114 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 1116 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
1115 else 1117 else
1116 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); 1118 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
1117 1119
1118 // Save the email addresses 1120 // Save the email addresses
1119 QStringList emails = mAddressee.emails(); 1121 QStringList emails = mAddressee.emails();
1120 QStringList::Iterator iter; 1122 QStringList::Iterator iter;
1121 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1123 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1122 mAddressee.removeEmail( *iter ); 1124 mAddressee.removeEmail( *iter );
1123 1125
1124 emails = mEmailWidget->emails(); 1126 emails = mEmailWidget->emails();
1125 bool first = true; 1127 bool first = true;
1126 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1128 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1127 mAddressee.insertEmail( *iter, first ); 1129 mAddressee.insertEmail( *iter, first );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 273d435..6e482b5 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2345,167 +2345,166 @@ void KABCore::whatsnew()
2345{ 2345{
2346 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2346 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2347} 2347}
2348void KABCore::synchowto() 2348void KABCore::synchowto()
2349{ 2349{
2350 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2350 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2351} 2351}
2352void KABCore::kdesynchowto() 2352void KABCore::kdesynchowto()
2353{ 2353{
2354 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2354 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2355} 2355}
2356void KABCore::multisynchowto() 2356void KABCore::multisynchowto()
2357{ 2357{
2358 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2358 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2359} 2359}
2360void KABCore::faq() 2360void KABCore::faq()
2361{ 2361{
2362 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2362 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2363} 2363}
2364 2364
2365#include <libkcal/syncdefines.h> 2365#include <libkcal/syncdefines.h>
2366 2366
2367KABC::Addressee KABCore::getLastSyncAddressee() 2367KABC::Addressee KABCore::getLastSyncAddressee()
2368{ 2368{
2369 Addressee lse; 2369 Addressee lse;
2370 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2370 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2371 2371
2372 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2372 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2373 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2373 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2374 if (lse.isEmpty()) { 2374 if (lse.isEmpty()) {
2375 qDebug("Creating new last-syncAddressee "); 2375 qDebug("Creating new last-syncAddressee ");
2376 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2376 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2377 QString sum = ""; 2377 QString sum = "";
2378 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2378 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2379 sum = "E: "; 2379 sum = "E: ";
2380 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2380 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2381 lse.setRevision( mLastAddressbookSync ); 2381 lse.setRevision( mLastAddressbookSync );
2382 lse.setCategories( i18n("SyncEvent") ); 2382 lse.setCategories( i18n("SyncEvent") );
2383 mAddressBook->insertAddressee( lse ); 2383 mAddressBook->insertAddressee( lse );
2384 } 2384 }
2385 return lse; 2385 return lse;
2386} 2386}
2387int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2387int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2388{ 2388{
2389 2389
2390 //void setZaurusId(int id); 2390 //void setZaurusId(int id);
2391 // int zaurusId() const; 2391 // int zaurusId() const;
2392 // void setZaurusUid(int id); 2392 // void setZaurusUid(int id);
2393 // int zaurusUid() const; 2393 // int zaurusUid() const;
2394 // void setZaurusStat(int id); 2394 // void setZaurusStat(int id);
2395 // int zaurusStat() const; 2395 // int zaurusStat() const;
2396 // 0 equal 2396 // 0 equal
2397 // 1 take local 2397 // 1 take local
2398 // 2 take remote 2398 // 2 take remote
2399 // 3 cancel 2399 // 3 cancel
2400 QDateTime lastSync = mLastAddressbookSync; 2400 QDateTime lastSync = mLastAddressbookSync;
2401 QDateTime localMod = local->revision(); 2401 QDateTime localMod = local->revision();
2402 QDateTime remoteMod = remote->revision(); 2402 QDateTime remoteMod = remote->revision();
2403 2403
2404 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2404 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2405 2405
2406 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2406 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2407 bool remCh, locCh; 2407 bool remCh, locCh;
2408 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2408 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2409 2409 qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2410 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2411 locCh = ( localMod > mLastAddressbookSync ); 2410 locCh = ( localMod > mLastAddressbookSync );
2412 if ( !remCh && ! locCh ) { 2411 if ( !remCh && ! locCh ) {
2413 //qDebug("both not changed "); 2412 qDebug("both not changed ");
2414 lastSync = localMod.addDays(1); 2413 lastSync = localMod.addDays(1);
2415 if ( mode <= SYNC_PREF_ASK ) 2414 if ( mode <= SYNC_PREF_ASK )
2416 return 0; 2415 return 0;
2417 } else { 2416 } else {
2418 if ( locCh ) { 2417 if ( locCh ) {
2419 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2418 qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2420 lastSync = localMod.addDays( -1 ); 2419 lastSync = localMod.addDays( -1 );
2421 if ( !remCh ) 2420 if ( !remCh )
2422 remoteMod =( lastSync.addDays( -1 ) ); 2421 remoteMod =( lastSync.addDays( -1 ) );
2423 } else { 2422 } else {
2424 //qDebug(" not loc changed "); 2423 qDebug(" not loc changed ");
2425 lastSync = localMod.addDays( 1 ); 2424 lastSync = localMod.addDays( 1 );
2426 if ( remCh ) 2425 if ( remCh ) {
2426 qDebug("rem changed ");
2427 remoteMod =( lastSync.addDays( 1 ) ); 2427 remoteMod =( lastSync.addDays( 1 ) );
2428 }
2428 2429
2429 } 2430 }
2430 } 2431 }
2431 full = true; 2432 full = true;
2432 if ( mode < SYNC_PREF_ASK ) 2433 if ( mode < SYNC_PREF_ASK )
2433 mode = SYNC_PREF_ASK; 2434 mode = SYNC_PREF_ASK;
2434 } else { 2435 } else {
2435 if ( localMod == remoteMod ) 2436 if ( localMod == remoteMod )
2436 return 0; 2437 return 0;
2437 2438
2438 } 2439 }
2439 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 2440 qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec());
2440 2441 qDebug("lastsync %s ", lastSync.toString().latin1() );
2441 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
2442 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
2443 //full = true; //debug only 2442 //full = true; //debug only
2444 if ( full ) { 2443 if ( full ) {
2445 bool equ = ( (*local) == (*remote) ); 2444 bool equ = ( (*local) == (*remote) );
2446 if ( equ ) { 2445 if ( equ ) {
2447 //qDebug("equal "); 2446 qDebug("equal ");
2448 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2447 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2449 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2448 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2450 } 2449 }
2451 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2450 if ( mode < SYNC_PREF_FORCE_LOCAL )
2452 return 0; 2451 return 0;
2453 2452
2454 }//else //debug only 2453 }//else //debug only
2455 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2454 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2456 } 2455 }
2457 int result; 2456 int result;
2458 bool localIsNew; 2457 bool localIsNew;
2459 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2458 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
2460 2459
2461 if ( full && mode < SYNC_PREF_NEWEST ) 2460 if ( full && mode < SYNC_PREF_NEWEST )
2462 mode = SYNC_PREF_ASK; 2461 mode = SYNC_PREF_ASK;
2463 2462
2464 switch( mode ) { 2463 switch( mode ) {
2465 case SYNC_PREF_LOCAL: 2464 case SYNC_PREF_LOCAL:
2466 if ( lastSync > remoteMod ) 2465 if ( lastSync > remoteMod )
2467 return 1; 2466 return 1;
2468 if ( lastSync > localMod ) 2467 if ( lastSync > localMod )
2469 return 2; 2468 return 2;
2470 return 1; 2469 return 1;
2471 break; 2470 break;
2472 case SYNC_PREF_REMOTE: 2471 case SYNC_PREF_REMOTE:
2473 if ( lastSync > remoteMod ) 2472 if ( lastSync > remoteMod )
2474 return 1; 2473 return 1;
2475 if ( lastSync > localMod ) 2474 if ( lastSync > localMod )
2476 return 2; 2475 return 2;
2477 return 2; 2476 return 2;
2478 break; 2477 break;
2479 case SYNC_PREF_NEWEST: 2478 case SYNC_PREF_NEWEST:
2480 if ( localMod > remoteMod ) 2479 if ( localMod > remoteMod )
2481 return 1; 2480 return 1;
2482 else 2481 else
2483 return 2; 2482 return 2;
2484 break; 2483 break;
2485 case SYNC_PREF_ASK: 2484 case SYNC_PREF_ASK:
2486 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2485 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2487 if ( lastSync > remoteMod ) 2486 if ( lastSync > remoteMod )
2488 return 1; 2487 return 1;
2489 if ( lastSync > localMod ) 2488 if ( lastSync > localMod )
2490 return 2; 2489 return 2;
2491 localIsNew = localMod >= remoteMod; 2490 localIsNew = localMod >= remoteMod;
2492 //qDebug("conflict! ************************************** "); 2491 //qDebug("conflict! ************************************** ");
2493 { 2492 {
2494 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2493 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2495 result = acd.executeD(localIsNew); 2494 result = acd.executeD(localIsNew);
2496 return result; 2495 return result;
2497 } 2496 }
2498 break; 2497 break;
2499 case SYNC_PREF_FORCE_LOCAL: 2498 case SYNC_PREF_FORCE_LOCAL:
2500 return 1; 2499 return 1;
2501 break; 2500 break;
2502 case SYNC_PREF_FORCE_REMOTE: 2501 case SYNC_PREF_FORCE_REMOTE:
2503 return 2; 2502 return 2;
2504 break; 2503 break;
2505 2504
2506 default: 2505 default:
2507 // SYNC_PREF_TAKE_BOTH not implemented 2506 // SYNC_PREF_TAKE_BOTH not implemented
2508 break; 2507 break;
2509 } 2508 }
2510 return 0; 2509 return 0;
2511} 2510}
@@ -2582,231 +2581,233 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2582 } 2581 }
2583 // fullDateRange = true; // debug only! 2582 // fullDateRange = true; // debug only!
2584 if ( fullDateRange ) 2583 if ( fullDateRange )
2585 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2584 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2586 else 2585 else
2587 mLastAddressbookSync = addresseeLSync.revision(); 2586 mLastAddressbookSync = addresseeLSync.revision();
2588 // for resyncing if own file has changed 2587 // for resyncing if own file has changed
2589 // PENDING fixme later when implemented 2588 // PENDING fixme later when implemented
2590#if 0 2589#if 0
2591 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2590 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2592 mLastAddressbookSync = loadedFileVersion; 2591 mLastAddressbookSync = loadedFileVersion;
2593 qDebug("setting mLastAddressbookSync "); 2592 qDebug("setting mLastAddressbookSync ");
2594 } 2593 }
2595#endif 2594#endif
2596 2595
2597 //qDebug("*************************** "); 2596 //qDebug("*************************** ");
2598 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2597 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2599 QStringList er = remote->uidList(); 2598 QStringList er = remote->uidList();
2600 Addressee inR ;//= er.first(); 2599 Addressee inR ;//= er.first();
2601 Addressee inL; 2600 Addressee inL;
2602 2601
2603 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2602 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2604 2603
2605 int modulo = (er.count()/10)+1; 2604 int modulo = (er.count()/10)+1;
2606 int incCounter = 0; 2605 int incCounter = 0;
2607 while ( incCounter < er.count()) { 2606 while ( incCounter < er.count()) {
2608 if (syncManager->isProgressBarCanceled()) 2607 if (syncManager->isProgressBarCanceled())
2609 return false; 2608 return false;
2610 if ( incCounter % modulo == 0 ) 2609 if ( incCounter % modulo == 0 )
2611 syncManager->showProgressBar(incCounter); 2610 syncManager->showProgressBar(incCounter);
2612 2611
2613 uid = er[ incCounter ]; 2612 uid = er[ incCounter ];
2614 bool skipIncidence = false; 2613 bool skipIncidence = false;
2615 if ( uid.left(19) == QString("last-syncAddressee-") ) 2614 if ( uid.left(19) == QString("last-syncAddressee-") )
2616 skipIncidence = true; 2615 skipIncidence = true;
2617 QString idS,OidS; 2616 QString idS,OidS;
2618 qApp->processEvents(); 2617 qApp->processEvents();
2619 if ( !skipIncidence ) { 2618 if ( !skipIncidence ) {
2620 inL = local->findByUid( uid ); 2619 inL = local->findByUid( uid );
2621 inR = remote->findByUid( uid ); 2620 inR = remote->findByUid( uid );
2622 //inL.setResource( 0 ); 2621 //inL.setResource( 0 );
2623 //inR.setResource( 0 ); 2622 //inR.setResource( 0 );
2624 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2623 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2625 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2624 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2626 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { 2625 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
2627 //qDebug("take %d %s ", take, inL.summary().latin1()); 2626 //qDebug("take %d %s ", take, inL.summary().latin1());
2628 if ( take == 3 ) 2627 if ( take == 3 )
2629 return false; 2628 return false;
2630 if ( take == 1 ) {// take local ********************** 2629 if ( take == 1 ) {// take local **********************
2631 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2630 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2632 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2631 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2633 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2632 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2634 local->insertAddressee( inL, false ); 2633 local->insertAddressee( inL, false );
2635 idS = inR.externalUID(); 2634 idS = inR.externalUID();
2636 OidS = inR.originalExternalUID(); 2635 OidS = inR.originalExternalUID();
2637 } 2636 }
2638 else 2637 else
2639 idS = inR.IDStr(); 2638 idS = inR.IDStr();
2640 remote->removeAddressee( inR ); 2639 remote->removeAddressee( inR );
2641 inR = inL; 2640 inR = inL;
2642 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2641 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2643 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2642 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2644 inR.setOriginalExternalUID( OidS ); 2643 inR.setOriginalExternalUID( OidS );
2645 inR.setExternalUID( idS ); 2644 inR.setExternalUID( idS );
2646 if ( syncManager->syncWithDesktop() ) 2645 if ( syncManager->syncWithDesktop() ) {
2647 inR.setIDStr("changed" ); 2646 inR.setIDStr("changed" );
2647 }
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 //qDebug("data %s ", inL.revision().toString().latin1());
2749 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2750 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2750 local->removeAddressee( inL ); 2751 local->removeAddressee( inL );
2751 ++deletedAddresseeL; 2752 ++deletedAddresseeL;
2752 } else { 2753 } else {
2753 if ( ! syncManager->mWriteBackExistingOnly ) { 2754 if ( ! syncManager->mWriteBackExistingOnly ) {
2754 ++addedAddresseeR; 2755 ++addedAddresseeR;
2755 inL.setRevision( modifiedCalendar ); 2756 inL.setRevision( modifiedCalendar );
2756 local->insertAddressee( inL, false ); 2757 local->insertAddressee( inL, false );
2757 inR = inL; 2758 inR = inL;
2758 inR.setIDStr( ":" ); 2759 inR.setIDStr( ":" );
2759 inR.setResource( 0 ); 2760 inR.setResource( 0 );
2760 remote->insertAddressee( inR, false ); 2761 remote->insertAddressee( inR, false );
2761 } 2762 }
2762 } 2763 }
2763 } 2764 }
2764 } 2765 }
2765 } 2766 }
2766 } 2767 }
2767 ++incCounter; 2768 ++incCounter;
2768 } 2769 }
2769 el.clear(); 2770 el.clear();
2770 syncManager->hideProgressBar(); 2771 syncManager->hideProgressBar();
2771 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2772 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2772 // get rid of micro seconds 2773 // get rid of micro seconds
2773 QTime t = mLastAddressbookSync.time(); 2774 QTime t = mLastAddressbookSync.time();
2774 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2775 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2775 addresseeLSync.setRevision( mLastAddressbookSync ); 2776 addresseeLSync.setRevision( mLastAddressbookSync );
2776 addresseeRSync.setRevision( mLastAddressbookSync ); 2777 addresseeRSync.setRevision( mLastAddressbookSync );
2777 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2778 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2778 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2779 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2779 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2780 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2780 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2781 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2781 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2782 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2782 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2783 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2783 addresseeRSync.setNote( "" ) ; 2784 addresseeRSync.setNote( "" ) ;
2784 addresseeLSync.setNote( "" ); 2785 addresseeLSync.setNote( "" );
2785 2786
2786 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2787 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2787 remote->insertAddressee( addresseeRSync, false ); 2788 remote->insertAddressee( addresseeRSync, false );
2788 local->insertAddressee( addresseeLSync, false ); 2789 local->insertAddressee( addresseeLSync, false );
2789 QString mes; 2790 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 ); 2791 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 ); 2792 qDebug( mes );
2792 mes = i18n("Local addressbook changed!\n") +mes; 2793 mes = i18n("Local addressbook changed!\n") +mes;
2793 if ( syncManager->mShowSyncSummary ) { 2794 if ( syncManager->mShowSyncSummary ) {
2794 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 2795 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
2795 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 2796 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
2796 qDebug("cancelled "); 2797 qDebug("cancelled ");
2797 return false; 2798 return false;
2798 } 2799 }
2799 } 2800 }
2800 return syncOK; 2801 return syncOK;
2801} 2802}
2802 2803
2803 2804
2804//this is a overwritten callbackmethods from the syncinterface 2805//this is a overwritten callbackmethods from the syncinterface
2805bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2806bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2806{ 2807{
2807 2808
2808 //pending prepare addresseeview for output 2809 //pending prepare addresseeview for output
2809 //pending detect, if remote file has REV field. if not switch to external sync 2810 //pending detect, if remote file has REV field. if not switch to external sync
2810 mGlobalSyncMode = SYNC_MODE_NORMAL; 2811 mGlobalSyncMode = SYNC_MODE_NORMAL;
2811 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2812 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2812 2813
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 59f3b40..f8d752a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1124,128 +1124,129 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() );
1188 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1189 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1189 remote->addEvent( eventRSync ); 1190 remote->addEvent( eventRSync );
1190 else 1191 else
1191 delete eventRSync; 1192 delete eventRSync;
1192 QString mes; 1193 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 ); 1194 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; 1195 QString delmess;
1195 if ( delFut ) { 1196 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); 1197 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; 1198 mes += delmess;
1198 } 1199 }
1199 mes = i18n("Local calendar changed!\n") +mes; 1200 mes = i18n("Local calendar changed!\n") +mes;
1200 mCalendar->checkAlarmForIncidence( 0, true ); 1201 mCalendar->checkAlarmForIncidence( 0, true );
1201 qDebug( mes ); 1202 qDebug( mes );
1202 if ( mSyncManager->mShowSyncSummary ) { 1203 if ( mSyncManager->mShowSyncSummary ) {
1203 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1204 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1204 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1205 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1205 qDebug("cancelled "); 1206 qDebug("cancelled ");
1206 return false; 1207 return false;
1207 } 1208 }
1208 } 1209 }
1209 return syncOK; 1210 return syncOK;
1210} 1211}
1211 1212
1212void CalendarView::setSyncDevice( QString s ) 1213void CalendarView::setSyncDevice( QString s )
1213{ 1214{
1214 mCurrentSyncDevice= s; 1215 mCurrentSyncDevice= s;
1215} 1216}
1216void CalendarView::setSyncName( QString s ) 1217void CalendarView::setSyncName( QString s )
1217{ 1218{
1218 mCurrentSyncName= s; 1219 mCurrentSyncName= s;
1219} 1220}
1220bool CalendarView::syncCalendar(QString filename, int mode) 1221bool CalendarView::syncCalendar(QString filename, int mode)
1221{ 1222{
1222 //qDebug("syncCalendar %s ", filename.latin1()); 1223 //qDebug("syncCalendar %s ", filename.latin1());
1223 mGlobalSyncMode = SYNC_MODE_NORMAL; 1224 mGlobalSyncMode = SYNC_MODE_NORMAL;
1224 CalendarLocal* calendar = new CalendarLocal(); 1225 CalendarLocal* calendar = new CalendarLocal();
1225 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1226 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1226 FileStorage* storage = new FileStorage( calendar ); 1227 FileStorage* storage = new FileStorage( calendar );
1227 bool syncOK = false; 1228 bool syncOK = false;
1228 storage->setFileName( filename ); 1229 storage->setFileName( filename );
1229 // qDebug("loading ... "); 1230 // qDebug("loading ... ");
1230 if ( storage->load() ) { 1231 if ( storage->load() ) {
1231 getEventViewerDialog()->setSyncMode( true ); 1232 getEventViewerDialog()->setSyncMode( true );
1232 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1233 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1233 getEventViewerDialog()->setSyncMode( false ); 1234 getEventViewerDialog()->setSyncMode( false );
1234 if ( syncOK ) { 1235 if ( syncOK ) {
1235 if ( mSyncManager->mWriteBackFile ) 1236 if ( mSyncManager->mWriteBackFile )
1236 { 1237 {
1237 storage->setSaveFormat( new ICalFormat() ); 1238 storage->setSaveFormat( new ICalFormat() );
1238 storage->save(); 1239 storage->save();
1239 } 1240 }
1240 } 1241 }
1241 setModified( true ); 1242 setModified( true );
1242 } 1243 }
1243 delete storage; 1244 delete storage;
1244 delete calendar; 1245 delete calendar;
1245 if ( syncOK ) 1246 if ( syncOK )
1246 updateView(); 1247 updateView();
1247 return syncOK; 1248 return syncOK;
1248} 1249}
1249 1250
1250void CalendarView::syncExternal( int mode ) 1251void CalendarView::syncExternal( int mode )
1251{ 1252{
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 21af295..c12ba1c 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -476,162 +476,164 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
476 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 476 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
477 return false; 477 return false;
478 } 478 }
479 if ( result == 0 ) { 479 if ( result == 0 ) {
480 //qDebug("Now sycing ... "); 480 //qDebug("Now sycing ... ");
481 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 481 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
482 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 482 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
483 else 483 else
484 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 484 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
485 if ( ! quick ) 485 if ( ! quick )
486 mPrefs->mLastSyncedLocalFile = fn; 486 mPrefs->mLastSyncedLocalFile = fn;
487 } 487 }
488 return ret; 488 return ret;
489} 489}
490 490
491void KSyncManager::quickSyncLocalFile() 491void KSyncManager::quickSyncLocalFile()
492{ 492{
493 493
494 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { 494 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
495 qDebug("quick syncLocalFile() successful "); 495 qDebug("quick syncLocalFile() successful ");
496 496
497 } 497 }
498} 498}
499 499
500void KSyncManager::multiSync( bool askforPrefs ) 500void KSyncManager::multiSync( bool askforPrefs )
501{ 501{
502 if (blockSave()) 502 if (blockSave())
503 return; 503 return;
504 setBlockSave(true); 504 setBlockSave(true);
505 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 505 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
506 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), 506 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
507 question, 507 question,
508 i18n("Yes"), i18n("No"), 508 i18n("Yes"), i18n("No"),
509 0, 0 ) != 0 ) { 509 0, 0 ) != 0 ) {
510 setBlockSave(false); 510 setBlockSave(false);
511 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); 511 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
512 return; 512 return;
513 } 513 }
514 mCurrentSyncDevice = i18n("Multiple profiles") ; 514 mCurrentSyncDevice = i18n("Multiple profiles") ;
515 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; 515 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
516 if ( askforPrefs ) { 516 if ( askforPrefs ) {
517 if ( !edit_sync_options()) { 517 if ( !edit_sync_options()) {
518 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); 518 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") );
519 return; 519 return;
520 } 520 }
521 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; 521 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
522 } 522 }
523 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); 523 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
524 qApp->processEvents(); 524 qApp->processEvents();
525 int num = ringSync() ; 525 int num = ringSync() ;
526 if ( num > 1 ) 526 if ( num > 1 )
527 ringSync(); 527 ringSync();
528 setBlockSave(false); 528 setBlockSave(false);
529 if ( num ) 529 if ( num )
530 emit save(); 530 emit save();
531 if ( num ) 531 if ( num )
532 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); 532 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
533 else 533 else
534 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 534 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
535 return; 535 return;
536} 536}
537 537
538int KSyncManager::ringSync() 538int KSyncManager::ringSync()
539{ 539{
540
540 int syncedProfiles = 0; 541 int syncedProfiles = 0;
541 unsigned int i; 542 unsigned int i;
542 QTime timer; 543 QTime timer;
543 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 544 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
544 QStringList syncProfileNames = mSyncProfileNames; 545 QStringList syncProfileNames = mSyncProfileNames;
545 KSyncProfile* temp = new KSyncProfile (); 546 KSyncProfile* temp = new KSyncProfile ();
546 mAskForPreferences = false; 547 mAskForPreferences = false;
547 for ( i = 0; i < syncProfileNames.count(); ++i ) { 548 for ( i = 0; i < syncProfileNames.count(); ++i ) {
548 mCurrentSyncProfile = i; 549 mCurrentSyncProfile = i;
549 temp->setName(syncProfileNames[mCurrentSyncProfile]); 550 temp->setName(syncProfileNames[mCurrentSyncProfile]);
550 temp->readConfig(&config); 551 temp->readConfig(&config);
551 552
552 bool includeInRingSync; 553 bool includeInRingSync;
553 switch(mTargetApp) 554 switch(mTargetApp)
554 { 555 {
555 case (KAPI): 556 case (KAPI):
556 includeInRingSync = temp->getIncludeInRingSyncAB(); 557 includeInRingSync = temp->getIncludeInRingSyncAB();
557 break; 558 break;
558 case (KOPI): 559 case (KOPI):
559 includeInRingSync = temp->getIncludeInRingSync(); 560 includeInRingSync = temp->getIncludeInRingSync();
560 break; 561 break;
561 case (PWMPI): 562 case (PWMPI):
562 includeInRingSync = temp->getIncludeInRingSyncPWM(); 563 includeInRingSync = temp->getIncludeInRingSyncPWM();
563 break; 564 break;
564 default: 565 default:
565 qDebug("KSyncManager::ringSync: invalid apptype selected"); 566 qDebug("KSyncManager::ringSync: invalid apptype selected");
566 break; 567 break;
567 568
568 } 569 }
569 570
570 571
571 if ( includeInRingSync && ( i < 1 || i > 2 )) { 572 if ( includeInRingSync && ( i < 1 || i > 2 )) {
572 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 573 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
573 ++syncedProfiles; 574 ++syncedProfiles;
575 mSyncWithDesktop = false;
574 // mAskForPreferences = temp->getAskForPreferences(); 576 // mAskForPreferences = temp->getAskForPreferences();
575 mWriteBackFile = temp->getWriteBackFile(); 577 mWriteBackFile = temp->getWriteBackFile();
576 mWriteBackExistingOnly = temp->getWriteBackExisting(); 578 mWriteBackExistingOnly = temp->getWriteBackExisting();
577 mIsKapiFile = temp->getIsKapiFile(); 579 mIsKapiFile = temp->getIsKapiFile();
578 mWriteBackInFuture = 0; 580 mWriteBackInFuture = 0;
579 if ( temp->getWriteBackFuture() ) 581 if ( temp->getWriteBackFuture() )
580 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 582 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
581 mShowSyncSummary = false; 583 mShowSyncSummary = false;
582 mCurrentSyncDevice = syncProfileNames[i] ; 584 mCurrentSyncDevice = syncProfileNames[i] ;
583 mCurrentSyncName = mLocalMachineName; 585 mCurrentSyncName = mLocalMachineName;
584 if ( i == 0 ) { 586 if ( i == 0 ) {
585 mIsKapiFile = false; 587 mIsKapiFile = false;
586#ifdef DESKTOP_VERSION 588#ifdef DESKTOP_VERSION
587 syncKDE(); 589 syncKDE();
588#else 590#else
589 syncSharp(); 591 syncSharp();
590#endif 592#endif
591 } else { 593 } else {
592 if ( temp->getIsLocalFileSync() ) { 594 if ( temp->getIsLocalFileSync() ) {
593 switch(mTargetApp) 595 switch(mTargetApp)
594 { 596 {
595 case (KAPI): 597 case (KAPI):
596 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 598 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
597 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 599 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
598 break; 600 break;
599 case (KOPI): 601 case (KOPI):
600 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 602 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
601 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 603 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
602 break; 604 break;
603 case (PWMPI): 605 case (PWMPI):
604 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 606 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
605 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 607 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
606 break; 608 break;
607 default: 609 default:
608 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 610 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
609 break; 611 break;
610 } 612 }
611 } else { 613 } else {
612 if ( temp->getIsPhoneSync() ) { 614 if ( temp->getIsPhoneSync() ) {
613 mPhoneDevice = temp->getPhoneDevice( ) ; 615 mPhoneDevice = temp->getPhoneDevice( ) ;
614 mPhoneConnection = temp->getPhoneConnection( ); 616 mPhoneConnection = temp->getPhoneConnection( );
615 mPhoneModel = temp->getPhoneModel( ); 617 mPhoneModel = temp->getPhoneModel( );
616 syncPhone(); 618 syncPhone();
617 } else if ( temp->getIsPiSync() ) { 619 } else if ( temp->getIsPiSync() ) {
618 if ( mTargetApp == KAPI ) { 620 if ( mTargetApp == KAPI ) {
619 mPassWordPiSync = temp->getRemotePwAB(); 621 mPassWordPiSync = temp->getRemotePwAB();
620 mActiveSyncPort = temp->getRemotePortAB(); 622 mActiveSyncPort = temp->getRemotePortAB();
621 mActiveSyncIP = temp->getRemoteIPAB(); 623 mActiveSyncIP = temp->getRemoteIPAB();
622 } else if ( mTargetApp == KOPI ) { 624 } else if ( mTargetApp == KOPI ) {
623 mPassWordPiSync = temp->getRemotePw(); 625 mPassWordPiSync = temp->getRemotePw();
624 mActiveSyncPort = temp->getRemotePort(); 626 mActiveSyncPort = temp->getRemotePort();
625 mActiveSyncIP = temp->getRemoteIP(); 627 mActiveSyncIP = temp->getRemoteIP();
626 } else { 628 } else {
627 mPassWordPiSync = temp->getRemotePwPWM(); 629 mPassWordPiSync = temp->getRemotePwPWM();
628 mActiveSyncPort = temp->getRemotePortPWM(); 630 mActiveSyncPort = temp->getRemotePortPWM();
629 mActiveSyncIP = temp->getRemoteIPPWM(); 631 mActiveSyncIP = temp->getRemoteIPPWM();
630 } 632 }
631 syncPi(); 633 syncPi();
632 while ( !mPisyncFinished ) { 634 while ( !mPisyncFinished ) {
633 //qDebug("waiting "); 635 //qDebug("waiting ");
634 qApp->processEvents(); 636 qApp->processEvents();
635 } 637 }
636 timer.start(); 638 timer.start();
637 while ( timer.elapsed () < 2000 ) { 639 while ( timer.elapsed () < 2000 ) {