summaryrefslogtreecommitdiff
authorzecke <zecke>2004-08-06 12:10:04 (UTC)
committer zecke <zecke>2004-08-06 12:10:04 (UTC)
commitcf4207c5c299812e46f40aaee307100f58317a97 (patch) (unidiff)
tree5ddff7987fb9010c2940c3e8b4f68852774c93d6
parent20e6c238513eb91f47c3030c2db7ada7cf4b7f25 (diff)
downloadopie-cf4207c5c299812e46f40aaee307100f58317a97.zip
opie-cf4207c5c299812e46f40aaee307100f58317a97.tar.gz
opie-cf4207c5c299812e46f40aaee307100f58317a97.tar.bz2
Update to the on-server move.
We now have core/ with DataTypes, PUBLIC API backend/ for concrete implementation of backends and the 'Interface description' ui/ For UI related classes private/ For private implementation details
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Rules.make4
-rw-r--r--libopie2/opiepim/backend/backends.pro53
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp2
-rw-r--r--libopie2/opiepim/backend/otodoaccessvcal.cpp2
-rw-r--r--libopie2/opiepim/core/core.pro61
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp4
-rw-r--r--libopie2/opiepim/opiepim.pro6
-rw-r--r--libopie2/opiepim/ui/ui.pro4
8 files changed, 77 insertions, 59 deletions
diff --git a/Rules.make b/Rules.make
index 0dce8d5..e89b129 100644
--- a/Rules.make
+++ b/Rules.make
@@ -1,311 +1,313 @@
1.phony: force 1.phony: force
2force: 2force:
3 3
4$(configs) : 4$(configs) :
5 $(call makecfg,$@) 5 $(call makecfg,$@)
6 6
7$(TOPDIR)/gen.pro : $(TOPDIR)/.config 7$(TOPDIR)/gen.pro : $(TOPDIR)/.config
8 echo > $@ 8 echo > $@
9# added for threaded version 9# added for threaded version
10ifneq ($(CONFIG_THREADED),) 10ifneq ($(CONFIG_THREADED),)
11 echo CONFIG += thread >> $@ 11 echo CONFIG += thread >> $@
12else 12else
13 echo CONFIG -= thread >> $@ 13 echo CONFIG -= thread >> $@
14endif 14endif
15ifneq ($(CONFIG_DEBUG),) 15ifneq ($(CONFIG_DEBUG),)
16 echo CONFIG += debug >> $@ 16 echo CONFIG += debug >> $@
17 echo CONFIG -= release >> $@ 17 echo CONFIG -= release >> $@
18 echo DEFINES += "QT_COMPONENT_DEBUG=2" >> $@ 18 echo DEFINES += "QT_COMPONENT_DEBUG=2" >> $@
19 echo DEFINES += QT_DEBUG >> $@ 19 echo DEFINES += QT_DEBUG >> $@
20else 20else
21 echo CONFIG -= debug >> $@ 21 echo CONFIG -= debug >> $@
22 echo CONFIG += release >> $@ 22 echo CONFIG += release >> $@
23 echo DEFINES += "OPIE_NO_DEBUG" >> $@ 23 echo DEFINES += "OPIE_NO_DEBUG" >> $@
24endif 24endif
25ifeq ($(CONFIG_STATIC),y) 25ifeq ($(CONFIG_STATIC),y)
26 echo !contains\( TARGET,qpe \) \{ >> $@ 26 echo !contains\( TARGET,qpe \) \{ >> $@
27 echo CONFIG += staticlib >> $@ 27 echo CONFIG += staticlib >> $@
28 echo \} >> $@ 28 echo \} >> $@
29endif 29endif
30ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3 30ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3
31 echo CONFIG -= qt3 >> $@ 31 echo CONFIG -= qt3 >> $@
32else 32else
33 echo CONFIG += qt3 >> $@ 33 echo CONFIG += qt3 >> $@
34endif 34endif
35ifneq ($(CONFIG_QUICK_LAUNCH),) 35ifneq ($(CONFIG_QUICK_LAUNCH),)
36 echo contains\( CONFIG, quick-app \) \{ >> $@ 36 echo contains\( CONFIG, quick-app \) \{ >> $@
37 echo CONFIG -= staticlib >> $@ 37 echo CONFIG -= staticlib >> $@
38 echo CONFIG -= quick-app >> $@ 38 echo CONFIG -= quick-app >> $@
39 echo CONFIG += quick-app-lib >> $@ 39 echo CONFIG += quick-app-lib >> $@
40 echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@ 40 echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@
41 echo \} >> $@ 41 echo \} >> $@
42else 42else
43 echo contains\( CONFIG, quick-app \) \{ >> $@ 43 echo contains\( CONFIG, quick-app \) \{ >> $@
44 echo CONFIG -= quick-app >> $@ 44 echo CONFIG -= quick-app >> $@
45 echo CONFIG += quick-app-bin >> $@ 45 echo CONFIG += quick-app-bin >> $@
46 echo \} >> $@ 46 echo \} >> $@
47endif 47endif
48ifeq ($(CONFIG_SQL_PIM_BACKEND),y) 48ifeq ($(CONFIG_SQL_PIM_BACKEND),y)
49 echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@ 49 echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@
50else 50else
51 echo ENABLE_SQL_PIM_BACKEND=n >> $@ 51 echo ENABLE_SQL_PIM_BACKEND=n >> $@
52endif 52endif
53ifeq ($(CONFIG_OPIE_NO_OVERRIDE_QT),y) 53ifeq ($(CONFIG_OPIE_NO_OVERRIDE_QT),y)
54 echo CONFIG += no-override >> $@ 54 echo CONFIG += no-override >> $@
55endif 55endif
56ifeq ($(CONFIG_OPIE_NO_ERASERECT_FIX),y) 56ifeq ($(CONFIG_OPIE_NO_ERASERECT_FIX),y)
57 echo DEFINES += OPIE_NO_ERASE_RECT_HACKFIX >> $@ 57 echo DEFINES += OPIE_NO_ERASE_RECT_HACKFIX >> $@
58endif 58endif
59ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y) 59ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y)
60 echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@ 60 echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@
61endif 61endif
62ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y) 62ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y)
63 echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@ 63 echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@
64endif 64endif
65ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y) 65ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y)
66 echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@ 66 echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@
67endif 67endif
68ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y) 68ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y)
69 echo DEFINES += USE_FILE_NOTIFICATION >> $@ 69 echo DEFINES += USE_FILE_NOTIFICATION >> $@
70endif 70endif
71ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y) 71ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y)
72 echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@ 72 echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@
73endif 73endif
74ifeq ($(CONFIG_OPIE_NEW_ALLOC),y) 74ifeq ($(CONFIG_OPIE_NEW_ALLOC),y)
75 echo DEFINES += OPIE_NEW_MALLOC >> $@ 75 echo DEFINES += OPIE_NEW_MALLOC >> $@
76endif 76endif
77ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y) 77ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y)
78 echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@ 78 echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@
79endif 79endif
80 echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@ 80 echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@
81ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y) 81ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y)
82 echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@ 82 echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@
83endif 83endif
84ifeq ($(CONFIG_OPIE_TASKBAR_LOCK_KEY_STATE),y) 84ifeq ($(CONFIG_OPIE_TASKBAR_LOCK_KEY_STATE),y)
85 echo DEFINES += OPIE_TASKBAR_LOCK_KEY_STATE >> $@ 85 echo DEFINES += OPIE_TASKBAR_LOCK_KEY_STATE >> $@
86 endif 86 endif
87# Write LIB dirs and INC dirs... 87# Write LIB dirs and INC dirs...
88ifeq ($(CONFIG_LIBETPAN_DEP),y) 88ifeq ($(CONFIG_LIBETPAN_DEP),y)
89 echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@ 89 echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@
90 echo LIBETPAN_INC_DIR = $(CONFIG_LIBETPAN_INC_DIR) >> $@ 90 echo LIBETPAN_INC_DIR = $(CONFIG_LIBETPAN_INC_DIR) >> $@
91endif 91endif
92ifeq ($(CONFIG_LIBPCAP_DEP),y) 92ifeq ($(CONFIG_LIBPCAP_DEP),y)
93 echo LIBPCAP_LIB_DIR = $(CONFIG_LIBPCAP_LIB_DIR) >> $@ 93 echo LIBPCAP_LIB_DIR = $(CONFIG_LIBPCAP_LIB_DIR) >> $@
94 echo LIBPCAP_INC_DIR = $(CONFIG_LIBPCAP_INC_DIR) >> $@ 94 echo LIBPCAP_INC_DIR = $(CONFIG_LIBPCAP_INC_DIR) >> $@
95endif 95endif
96ifeq ($(CONFIG_LIBSQLITE_DEP),y) 96ifeq ($(CONFIG_LIBSQLITE_DEP),y)
97 echo LIBSQLITE_LIB_DIR = $(CONFIG_LIBSQLITE_LIB_DIR) >> $@ 97 echo LIBSQLITE_LIB_DIR = $(CONFIG_LIBSQLITE_LIB_DIR) >> $@
98 echo LIBSQLITE_INC_DIR = $(CONFIG_LIBSQLITE_INC_DIR) >> $@ 98 echo LIBSQLITE_INC_DIR = $(CONFIG_LIBSQLITE_INC_DIR) >> $@
99endif 99endif
100ifeq ($(CONFIG_LIBXINE_DEP),y) 100ifeq ($(CONFIG_LIBXINE_DEP),y)
101 echo LIBXINE_LIB_DIR = $(CONFIG_LIBXINE_LIB_DIR) >> $@ 101 echo LIBXINE_LIB_DIR = $(CONFIG_LIBXINE_LIB_DIR) >> $@
102 echo LIBXINE_INC_DIR = $(CONFIG_LIBXINE_INC_DIR) >> $@ 102 echo LIBXINE_INC_DIR = $(CONFIG_LIBXINE_INC_DIR) >> $@
103endif 103endif
104ifeq ($(CONFIG_LIBIPK_DEP),y) 104ifeq ($(CONFIG_LIBIPK_DEP),y)
105 echo LIBIPK_LIB_DIR = $(CONFIG_LIBIPK_LIB_DIR) >> $@ 105 echo LIBIPK_LIB_DIR = $(CONFIG_LIBIPK_LIB_DIR) >> $@
106 echo LIBIPK_INC_DIR = $(CONFIG_LIBIPK_INC_DIR) >> $@ 106 echo LIBIPK_INC_DIR = $(CONFIG_LIBIPK_INC_DIR) >> $@
107endif 107endif
108ifeq ($(CONFIG_LIBSDK_DEP),y) 108ifeq ($(CONFIG_LIBSDK_DEP),y)
109 echo LIBSDL_LIB_DIR = $(CONFIG_LIBSDL_LIB_DIR) >> $@ 109 echo LIBSDL_LIB_DIR = $(CONFIG_LIBSDL_LIB_DIR) >> $@
110 echo LIBSDL_INC_DIR = $(CONFIG_LIBSDL_INC_DIR) >> $@ 110 echo LIBSDL_INC_DIR = $(CONFIG_LIBSDL_INC_DIR) >> $@
111endif 111endif
112ifeq ($(CONFIG_LIBSWORD_DEP),y) 112ifeq ($(CONFIG_LIBSWORD_DEP),y)
113 echo LIBSWORD_LIB_DIR = $(CONFIG_LIBSWORD_LIB_DIR) >> $@ 113 echo LIBSWORD_LIB_DIR = $(CONFIG_LIBSWORD_LIB_DIR) >> $@
114 echo LIBSWORD_INC_DIR = $(CONFIG_LIBSWORD_INC_DIR) >> $@ 114 echo LIBSWORD_INC_DIR = $(CONFIG_LIBSWORD_INC_DIR) >> $@
115endif 115endif
116$(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages 116$(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages
117 @echo Generating dependency information... 117 @echo Generating dependency information...
118# add to subdir-y, and add descend rules 118# add to subdir-y, and add descend rules
119 @cat $(TOPDIR)/packages | grep -v '^#' | \ 119 @cat $(TOPDIR)/packages | grep -v '^#' | \
120 awk '{print \ 120 awk '{print \
121 ".PHONY : " $$2 "\n" \ 121 ".PHONY : " $$2 "\n" \
122 "subdir-$$(" $$1 ") += " $$2 "\n\n"; \ 122 "subdir-$$(" $$1 ") += " $$2 "\n\n"; \
123 print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends 123 print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends
124 cat $(TOPDIR)/packages | grep -v '^#' | \ 124 cat $(TOPDIR)/packages | grep -v '^#' | \
125 perl -ne '($$cfg, $$dir, $$pro) = $$_ =~ /^(\S+)\s+(\S+)\s+(\S+)/; if ( -e "$$dir/$$pro" ) { print "$$dir/Makefile : $$dir/$$pro \$$(QMAKE) \$$(OPIEDIR)/gen.pro \$$(OPIEDIR)/.config\n\t\$$(call makefilegen,\$$@)\n\n"; }' \ 125 perl -ne '($$cfg, $$dir, $$pro) = $$_ =~ /^(\S+)\s+(\S+)\s+(\S+)/; if ( -e "$$dir/$$pro" ) { print "$$dir/Makefile : $$dir/$$pro \$$(QMAKE) \$$(OPIEDIR)/gen.pro \$$(OPIEDIR)/.config\n\t\$$(call makefilegen,\$$@)\n\n"; }' \
126 >> $(TOPDIR)/.depends 126 >> $(TOPDIR)/.depends
127# interpackage dependency generation 127# interpackage dependency generation
128 @cat $(TOPDIR)/packages | \ 128 @cat $(TOPDIR)/packages | \
129 $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends 129 $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends
130 130
131$(TOPDIR)/.depends.cfgs: 131$(TOPDIR)/.depends.cfgs:
132# config.in interdependencies 132# config.in interdependencies
133 @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs 133 @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs
134 @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $@ 134 @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $@
135 @-rm -f dirs 135 @-rm -f dirs
136 136
137$(QTDIR)/stamp-headers : 137$(QTDIR)/stamp-headers :
138 @-rm -f $(QTDIR)/stamp-headers* 138 @-rm -f $(QTDIR)/stamp-headers*
139 ( cd $(QTDIR)/include; \ 139 ( cd $(QTDIR)/include; \
140 $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \ 140 $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \
141 qcopchannel_qws.h qwindowsystem_qws.h \ 141 qcopchannel_qws.h qwindowsystem_qws.h \
142 qfontmanager_qws.h qwsdefaultdecoration_qws.h)) 142 qfontmanager_qws.h qwsdefaultdecoration_qws.h))
143 touch $@ 143 touch $@
144 144
145$(QTDIR)/stamp-headers-x11 : 145$(QTDIR)/stamp-headers-x11 :
146 @-rm -f $(QTDIR)/stamp-headers* 146 @-rm -f $(QTDIR)/stamp-headers*
147 cd $(QTDIR)/include; $(patsubst %,ln -sf $(OPIEDIR)/x11/libqpe-x11/qt/%;,qgfx_qws.h qwsmouse_qws.h qcopchannel_qws.h qwindowsystem_qws.h qfontmanager_qws.h qwsdefaultdecoration_qws.h) 147 cd $(QTDIR)/include; $(patsubst %,ln -sf $(OPIEDIR)/x11/libqpe-x11/qt/%;,qgfx_qws.h qwsmouse_qws.h qcopchannel_qws.h qwindowsystem_qws.h qfontmanager_qws.h qwsdefaultdecoration_qws.h)
148 touch $@ 148 touch $@
149 149
150$(OPIEDIR)/stamp-headers : 150$(OPIEDIR)/stamp-headers :
151 @-rm -f $(OPIEDIR)/stamp-headers* 151 @-rm -f $(OPIEDIR)/stamp-headers*
152 mkdir -p $(TOPDIR)/include/qpe \ 152 mkdir -p $(TOPDIR)/include/qpe \
153 $(TOPDIR)/include/qtopia \ 153 $(TOPDIR)/include/qtopia \
154 $(TOPDIR)/include/opie \ 154 $(TOPDIR)/include/opie \
155 $(TOPDIR)/include/opie2 \ 155 $(TOPDIR)/include/opie2 \
156 $(TOPDIR)/include/opie2/private \
156 $(TOPDIR)/include/qtopia/private \ 157 $(TOPDIR)/include/qtopia/private \
157 $(TOPDIR)/include/sl 158 $(TOPDIR)/include/sl
158 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) 159 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; )
159 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) 160 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; )
160 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) 161 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; )
161ifeq ($(CONFIG_LIBOPIE),y) 162ifeq ($(CONFIG_LIBOPIE),y)
162 # libopie1 163 # libopie1
163 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) 164 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; )
164 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) 165 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; )
165 ( cd include/opie && ln -sf ../../libopie/big-screen/*.h .; ) 166 ( cd include/opie && ln -sf ../../libopie/big-screen/*.h .; )
166endif 167endif
167 # libopie2 168 # libopie2
168 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; ) 169 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; )
169 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/device/*.h .; ) 170 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/device/*.h .; )
170 ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; ) 171 ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; )
171 ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) 172 ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; )
172 ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) 173 ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; )
173 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) 174 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; )
174 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/*.h .; ) 175 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/*.h .; )
175 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/backends/*.h .; ) 176 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/backend/*.h .; )
177 ( cd include/opie2/private && ln -sf ../../../libopie2/opiepim/private/*.h .; )
176 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/ui/*.h .; ) 178 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/ui/*.h .; )
177 ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) 179 ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; )
178 ( cd include/opie2 && ln -sf ../../libopie2/opieui/fileselector/*.h .; ) 180 ( cd include/opie2 && ln -sf ../../libopie2/opieui/fileselector/*.h .; )
179 ( cd include/opie2 && ln -sf ../../libopie2/opieui/big-screen/*.h .; ) 181 ( cd include/opie2 && ln -sf ../../libopie2/opieui/big-screen/*.h .; )
180 ( cd include/opie2 && ln -sf ../../libopie2/opiesecurity/*.h .; ) 182 ( cd include/opie2 && ln -sf ../../libopie2/opiesecurity/*.h .; )
181 # auxilliary libraries 183 # auxilliary libraries
182 ( cd include/opie2 && ln -sf ../../libqtaux/*.h .; ) 184 ( cd include/opie2 && ln -sf ../../libqtaux/*.h .; )
183 ( cd include/sl && ln -sf ../../libslcompat/*.h .; ) 185 ( cd include/sl && ln -sf ../../libslcompat/*.h .; )
184 ( cd include/ && ln -sf ../noncore/net/ftplib/*.h .; ) 186 ( cd include/ && ln -sf ../noncore/net/ftplib/*.h .; )
185 ( cd include/ && ln -sf ../inputmethods/pickboard/pickboardcfg.h .; ) 187 ( cd include/ && ln -sf ../inputmethods/pickboard/pickboardcfg.h .; )
186 ( cd include/ && ln -sf ../inputmethods/pickboard/pickboardpicks.h .; ) 188 ( cd include/ && ln -sf ../inputmethods/pickboard/pickboardpicks.h .; )
187 # all 189 # all
188ifeq ($(CONFIG_LIBOPIE),y) 190ifeq ($(CONFIG_LIBOPIE),y)
189 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 191 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
190 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) 192 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done )
191endif 193endif
192 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opieui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 194 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opieui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
193 ln -sf ../../libopie2/opieui/$$generatedHeader $$generatedHeader; done ) 195 ln -sf ../../libopie2/opieui/$$generatedHeader $$generatedHeader; done )
194 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opiepim/ui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 196 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opiepim/ui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
195 ln -sf ../../libopie2/opiepim/ui/$$generatedHeader $$generatedHeader; done ) 197 ln -sf ../../libopie2/opiepim/ui/$$generatedHeader $$generatedHeader; done )
196 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h 198 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h
197 touch $@ 199 touch $@
198 200
199$(OPIEDIR)/stamp-headers-x11 : 201$(OPIEDIR)/stamp-headers-x11 :
200 @-rm -f $(OPIEDIR)/stamp-headers* 202 @-rm -f $(OPIEDIR)/stamp-headers*
201 mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \ 203 mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \
202 $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private 204 $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private
203 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) 205 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; )
204 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) 206 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; )
205 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) 207 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; )
206 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) 208 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; )
207 ( cd include/opie && ln -sf ../../libsql/*.h .; ) 209 ( cd include/opie && ln -sf ../../libsql/*.h .; )
208 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) 210 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; )
209 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 211 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
210 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) 212 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done )
211 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h 213 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h
212 ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) 214 ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; )
213 touch $@ 215 touch $@
214 216
215$(TOPDIR)/library/custom.h : $(TOPDIR)/.config 217$(TOPDIR)/library/custom.h : $(TOPDIR)/.config
216 @-rm -f $@ 218 @-rm -f $@
217 @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ 219 @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\
218 ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) 220 ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@)
219 @touch $@ 221 @touch $@
220 222
221$(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake: 223$(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake:
222 @$(call descend,$(shell dirname $@),$(shell basename $@)) 224 @$(call descend,$(shell dirname $@),$(shell basename $@))
223 225
224menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in 226menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in
225 $(TOPDIR)/scripts/kconfig/mconf ./config.in 227 $(TOPDIR)/scripts/kconfig/mconf ./config.in
226 @touch ./.config.stamp 228 @touch ./.config.stamp
227 229
228xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in 230xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in
229 $(TOPDIR)/scripts/kconfig/qconf ./config.in 231 $(TOPDIR)/scripts/kconfig/qconf ./config.in
230 @touch .config.stamp 232 @touch .config.stamp
231 233
232gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in 234gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in
233 $(TOPDIR)/scripts/kconfig/gconf ./config.in 235 $(TOPDIR)/scripts/kconfig/gconf ./config.in
234 @touch .config.stamp 236 @touch .config.stamp
235 237
236config: $(TOPDIR)/scripts/kconfig/conf ./config.in 238config: $(TOPDIR)/scripts/kconfig/conf ./config.in
237 $(TOPDIR)/scripts/kconfig/conf ./config.in 239 $(TOPDIR)/scripts/kconfig/conf ./config.in
238 @touch .config.stamp 240 @touch .config.stamp
239 241
240oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 242oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
241 $(TOPDIR)/scripts/kconfig/conf -o ./config.in 243 $(TOPDIR)/scripts/kconfig/conf -o ./config.in
242 @touch .config.stamp 244 @touch .config.stamp
243 245
244randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 246randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
245 $(TOPDIR)/scripts/kconfig/conf -r ./config.in 247 $(TOPDIR)/scripts/kconfig/conf -r ./config.in
246 @touch .config.stamp 248 @touch .config.stamp
247 249
248allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 250allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
249 $(TOPDIR)/scripts/kconfig/conf -y ./config.in 251 $(TOPDIR)/scripts/kconfig/conf -y ./config.in
250 @touch .config.stamp 252 @touch .config.stamp
251 253
252allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 254allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
253 $(TOPDIR)/scripts/kconfig/conf -n ./config.in 255 $(TOPDIR)/scripts/kconfig/conf -n ./config.in
254 @touch .config.stamp 256 @touch .config.stamp
255 257
256defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 258defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
257 $(TOPDIR)/scripts/kconfig/conf -d ./config.in 259 $(TOPDIR)/scripts/kconfig/conf -d ./config.in
258 @touch .config.stamp 260 @touch .config.stamp
259 261
260$(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default 262$(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default
261 263
262$(TOPDIR)/mkspecs/default : 264$(TOPDIR)/mkspecs/default :
263 ln -sf linux-g++ $@ 265 ln -sf linux-g++ $@
264 266
265$(TOPDIR)/scripts/subst : force 267$(TOPDIR)/scripts/subst : force
266 @( \ 268 @( \
267 echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ 269 echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \
268 echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ 270 echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \
269 echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ 271 echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \
270 echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ 272 echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \
271 echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ 273 echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \
272 echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ 274 echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \
273 echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ 275 echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \
274 ) > $@ || ( rm -f $@; exit 1 ) 276 ) > $@ || ( rm -f $@; exit 1 )
275 277
276$(TOPDIR)/scripts/filesubst : force 278$(TOPDIR)/scripts/filesubst : force
277 @( \ 279 @( \
278 echo 's,\$$OPIEDIR/root/,/,g'; \ 280 echo 's,\$$OPIEDIR/root/,/,g'; \
279 echo 's,$(OPIEDIR)/root/,/,g'; \ 281 echo 's,$(OPIEDIR)/root/,/,g'; \
280 echo 's,\$$OPIEDIR,$(prefix),g'; \ 282 echo 's,\$$OPIEDIR,$(prefix),g'; \
281 echo 's,$(OPIEDIR),$(prefix),g'; \ 283 echo 's,$(OPIEDIR),$(prefix),g'; \
282 echo 's,\$$QTDIR,$(prefix),g'; \ 284 echo 's,\$$QTDIR,$(prefix),g'; \
283 echo 's,$(QTDIR),$(prefix),g'; \ 285 echo 's,$(QTDIR),$(prefix),g'; \
284 echo 's,^\(\./\)*root/,/,g'; \ 286 echo 's,^\(\./\)*root/,/,g'; \
285 echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ 287 echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \
286 echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ 288 echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \
287 echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ 289 echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \
288 echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ 290 echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \
289 echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ 291 echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \
290 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ 292 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \
291 echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ 293 echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \
292 echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ 294 echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \
293 echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ 295 echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \
294 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ 296 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \
295 echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ 297 echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \
296 ) > $@ || ( rm -f $@; exit 1 ) 298 ) > $@ || ( rm -f $@; exit 1 )
297 299
298## general rules ## 300## general rules ##
299 301
300define descend 302define descend
301 $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) 303 $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2)
302endef 304endef
303 305
304define makefilegen 306define makefilegen
305 cd $(if $(1),$(shell dirname $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(shell basename $(1))) `cat $(OPIEDIR)/packages | grep " \`echo $(1)|sed -e 's,/Makefile$$,,'\`" | \ 307 cd $(if $(1),$(shell dirname $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(shell basename $(1))) `cat $(OPIEDIR)/packages | grep " \`echo $(1)|sed -e 's,/Makefile$$,,'\`" | \
306 head -1 | awk '{print $$3}'` 308 head -1 | awk '{print $$3}'`
307endef 309endef
308 310
309define makecfg 311define makecfg
310 $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) 312 $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR)
311endef 313endef
diff --git a/libopie2/opiepim/backend/backends.pro b/libopie2/opiepim/backend/backends.pro
index f91e98a..42d807c 100644
--- a/libopie2/opiepim/backend/backends.pro
+++ b/libopie2/opiepim/backend/backends.pro
@@ -1,44 +1,37 @@
1SOURCES += \ 1SOURCES += \
2 core/backends/ocontactaccessbackend_vcard.cpp \ 2 backend/ocontactaccessbackend_vcard.cpp \
3 core/backends/ocontactaccessbackend_xml.cpp \ 3 backend/ocontactaccessbackend_xml.cpp \
4 core/backends/ocontactaccess.cpp \ 4 backend/odatebookaccessbackend.cpp \
5 core/backends/odatebookaccessbackend.cpp \ 5 backend/odatebookaccessbackend_xml.cpp \
6 core/backends/odatebookaccessbackend_xml.cpp \ 6 backend/otodoaccessbackend.cpp \
7 core/backends/otodoaccessbackend.cpp \ 7 backend/otodoaccessvcal.cpp \
8 core/backends/otodoaccess.cpp \ 8 backend/otodoaccessxml.cpp
9 core/backends/otodoaccessvcal.cpp \
10 core/backends/otodoaccessxml.cpp \
11 core/backends/odatebookaccess.cpp
12 9
13HEADERS += \ 10HEADERS += \
14 core/backends/obackendfactory.h \ 11 backend/obackendfactory.h \
15 core/backends/ocontactaccessbackend.h \ 12 backend/ocontactaccessbackend.h \
16 core/backends/ocontactaccessbackend_vcard.h \ 13 backend/ocontactaccessbackend_vcard.h \
17 core/backends/ocontactaccessbackend_xml.h \ 14 backend/ocontactaccessbackend_xml.h \
18 core/backends/ocontactaccess.h \ 15 backend/odatebookaccessbackend.h \
19 core/backends/odatebookaccessbackend.h \ 16 backend/odatebookaccessbackend_xml.h \
20 core/backends/odatebookaccessbackend_xml.h \ 17 backend/opimaccessbackend.h \
21 core/backends/opimaccessbackend.h \ 18 backend/otodoaccessbackend.h \
22 core/backends/opimaccesstemplate.h \ 19 backend/otodoaccessvcal.h \
23 core/backends/otodoaccessbackend.h \ 20 backend/otodoaccessxml.h
24 core/backends/otodoaccess.h \
25 core/backends/otodoaccessvcal.h \
26 core/backends/otodoaccessxml.h \
27 core/backends/odatebookaccess.h
28 21
29contains( ENABLE_SQL_PIM_BACKEND, y ) { 22contains( ENABLE_SQL_PIM_BACKEND, y ) {
30 message ( Enabling the SQL Backend for libopiepim2 ) 23 message ( Enabling the SQL Backend for libopiepim2 )
31 DEFINES += __USE_SQL 24 DEFINES += __USE_SQL
32 LIBS += -lopiedb2 25 LIBS += -lopiedb2
33 HEADERS += core/backends/otodoaccesssql.h \ 26 HEADERS += backend/otodoaccesssql.h \
34 core/backends/ocontactaccessbackend_sql.h \ 27 backend/ocontactaccessbackend_sql.h \
35 core/backends/odatebookaccessbackend_sql.h 28 backend/odatebookaccessbackend_sql.h
36 SOURCES += core/backends/otodoaccesssql.cpp \ 29 SOURCES += backend/otodoaccesssql.cpp \
37 core/backends/ocontactaccessbackend_sql.cpp \ 30 backend/ocontactaccessbackend_sql.cpp \
38 core/backends/odatebookaccessbackend_sql.cpp 31 backend/odatebookaccessbackend_sql.cpp
39} 32}
40 33
41!contains( ENABLE_SQL_PIM_BACKEND, y ) { 34!contains( ENABLE_SQL_PIM_BACKEND, y ) {
42 message ( No SQL Backend in libopiepim2 ) 35 message ( No SQL Backend in libopiepim2 )
43} 36}
44 37
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index 6b66814..af77a05 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -1,611 +1,611 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org> 3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29/* 29/*
30 * VCard Backend for the OPIE-Contact Database. 30 * VCard Backend for the OPIE-Contact Database.
31 */ 31 */
32 32
33 33
34#include "vobject_p.h" 34#include <opie2/private/vobject_p.h>
35 35
36/* OPIE */ 36/* OPIE */
37#include <opie2/ocontactaccessbackend_vcard.h> 37#include <opie2/ocontactaccessbackend_vcard.h>
38#include <opie2/odebug.h> 38#include <opie2/odebug.h>
39 39
40#include <qpe/timeconversion.h> 40#include <qpe/timeconversion.h>
41 41
42//FIXME: Hack to allow direct access to FILE* fh. Rewrite this! 42//FIXME: Hack to allow direct access to FILE* fh. Rewrite this!
43#define protected public 43#define protected public
44#include <qfile.h> 44#include <qfile.h>
45#undef protected 45#undef protected
46 46
47namespace Opie { 47namespace Opie {
48 48
49OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ): 49OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ):
50 m_dirty( false ), 50 m_dirty( false ),
51 m_file( filename ) 51 m_file( filename )
52{ 52{
53 load(); 53 load();
54} 54}
55 55
56 56
57bool OPimContactAccessBackend_VCard::load () 57bool OPimContactAccessBackend_VCard::load ()
58{ 58{
59 m_map.clear(); 59 m_map.clear();
60 m_dirty = false; 60 m_dirty = false;
61 61
62 VObject* obj = 0l; 62 VObject* obj = 0l;
63 63
64 if ( QFile::exists(m_file) ){ 64 if ( QFile::exists(m_file) ){
65 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 65 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
66 if ( !obj ) 66 if ( !obj )
67 return false; 67 return false;
68 }else{ 68 }else{
69 odebug << "File \"" << m_file << "\" not found !" << oendl; 69 odebug << "File \"" << m_file << "\" not found !" << oendl;
70 return false; 70 return false;
71 } 71 }
72 72
73 while ( obj ) { 73 while ( obj ) {
74 OPimContact con = parseVObject( obj ); 74 OPimContact con = parseVObject( obj );
75 /* 75 /*
76 * if uid is 0 assign a new one 76 * if uid is 0 assign a new one
77 * this at least happens on 77 * this at least happens on
78 * Nokia6210 78 * Nokia6210
79 */ 79 */
80 if ( con.uid() == 0 ){ 80 if ( con.uid() == 0 ){
81 con.setUid( 1 ); 81 con.setUid( 1 );
82 owarn << "assigned new uid " << con.uid() << "" << oendl; 82 owarn << "assigned new uid " << con.uid() << "" << oendl;
83 } 83 }
84 84
85 m_map.insert( con.uid(), con ); 85 m_map.insert( con.uid(), con );
86 86
87 VObject *t = obj; 87 VObject *t = obj;
88 obj = nextVObjectInList(obj); 88 obj = nextVObjectInList(obj);
89 cleanVObject( t ); 89 cleanVObject( t );
90 } 90 }
91 91
92 return true; 92 return true;
93 93
94} 94}
95bool OPimContactAccessBackend_VCard::reload() 95bool OPimContactAccessBackend_VCard::reload()
96{ 96{
97 return load(); 97 return load();
98} 98}
99bool OPimContactAccessBackend_VCard::save() 99bool OPimContactAccessBackend_VCard::save()
100{ 100{
101 if (!m_dirty ) 101 if (!m_dirty )
102 return true; 102 return true;
103 103
104 QFile file( m_file ); 104 QFile file( m_file );
105 if (!file.open(IO_WriteOnly ) ) 105 if (!file.open(IO_WriteOnly ) )
106 return false; 106 return false;
107 107
108 VObject *obj; 108 VObject *obj;
109 obj = newVObject( VCCalProp ); 109 obj = newVObject( VCCalProp );
110 addPropValue( obj, VCVersionProp, "1.0" ); 110 addPropValue( obj, VCVersionProp, "1.0" );
111 111
112 VObject *vo; 112 VObject *vo;
113 for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ 113 for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){
114 vo = createVObject( *it ); 114 vo = createVObject( *it );
115 writeVObject( file.fh, vo ); //FIXME: HACK!!! 115 writeVObject( file.fh, vo ); //FIXME: HACK!!!
116 cleanVObject( vo ); 116 cleanVObject( vo );
117 } 117 }
118 cleanStrTbl(); 118 cleanStrTbl();
119 deleteVObject( obj ); 119 deleteVObject( obj );
120 120
121 m_dirty = false; 121 m_dirty = false;
122 return true; 122 return true;
123 123
124 124
125} 125}
126void OPimContactAccessBackend_VCard::clear () 126void OPimContactAccessBackend_VCard::clear ()
127{ 127{
128 m_map.clear(); 128 m_map.clear();
129 m_dirty = true; // ??? sure ? (se) 129 m_dirty = true; // ??? sure ? (se)
130} 130}
131 131
132bool OPimContactAccessBackend_VCard::add ( const OPimContact& newcontact ) 132bool OPimContactAccessBackend_VCard::add ( const OPimContact& newcontact )
133{ 133{
134 m_map.insert( newcontact.uid(), newcontact ); 134 m_map.insert( newcontact.uid(), newcontact );
135 m_dirty = true; 135 m_dirty = true;
136 return true; 136 return true;
137} 137}
138 138
139bool OPimContactAccessBackend_VCard::remove ( int uid ) 139bool OPimContactAccessBackend_VCard::remove ( int uid )
140{ 140{
141 m_map.remove( uid ); 141 m_map.remove( uid );
142 m_dirty = true; 142 m_dirty = true;
143 return true; 143 return true;
144} 144}
145 145
146bool OPimContactAccessBackend_VCard::replace ( const OPimContact &contact ) 146bool OPimContactAccessBackend_VCard::replace ( const OPimContact &contact )
147{ 147{
148 m_map.replace( contact.uid(), contact ); 148 m_map.replace( contact.uid(), contact );
149 m_dirty = true; 149 m_dirty = true;
150 return true; 150 return true;
151} 151}
152 152
153OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const 153OPimContact OPimContactAccessBackend_VCard::find ( int uid ) const
154{ 154{
155 return m_map[uid]; 155 return m_map[uid];
156} 156}
157 157
158QArray<int> OPimContactAccessBackend_VCard::allRecords() const 158QArray<int> OPimContactAccessBackend_VCard::allRecords() const
159{ 159{
160 QArray<int> ar( m_map.count() ); 160 QArray<int> ar( m_map.count() );
161 QMap<int, OPimContact>::ConstIterator it; 161 QMap<int, OPimContact>::ConstIterator it;
162 int i = 0; 162 int i = 0;
163 for ( it = m_map.begin(); it != m_map.end(); ++it ) { 163 for ( it = m_map.begin(); it != m_map.end(); ++it ) {
164 ar[i] = it.key(); 164 ar[i] = it.key();
165 i++; 165 i++;
166 } 166 }
167 return ar; 167 return ar;
168} 168}
169 169
170// Not implemented 170// Not implemented
171QArray<int> OPimContactAccessBackend_VCard::queryByExample ( const OPimContact&, int, const QDateTime& ) 171QArray<int> OPimContactAccessBackend_VCard::queryByExample ( const OPimContact&, int, const QDateTime& )
172{ 172{
173 QArray<int> ar(0); 173 QArray<int> ar(0);
174 return ar; 174 return ar;
175} 175}
176 176
177// Not implemented 177// Not implemented
178QArray<int> OPimContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const 178QArray<int> OPimContactAccessBackend_VCard::matchRegexp( const QRegExp& ) const
179{ 179{
180 QArray<int> ar(0); 180 QArray<int> ar(0);
181 return ar; 181 return ar;
182} 182}
183 183
184const uint OPimContactAccessBackend_VCard::querySettings() 184const uint OPimContactAccessBackend_VCard::querySettings()
185{ 185{
186 return 0; // No search possible 186 return 0; // No search possible
187} 187}
188 188
189bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const 189bool OPimContactAccessBackend_VCard::hasQuerySettings (uint ) const
190{ 190{
191 return false; // No search possible, therefore all settings invalid ;) 191 return false; // No search possible, therefore all settings invalid ;)
192} 192}
193 193
194bool OPimContactAccessBackend_VCard::wasChangedExternally() 194bool OPimContactAccessBackend_VCard::wasChangedExternally()
195{ 195{
196 return false; // Don't expect concurrent access 196 return false; // Don't expect concurrent access
197} 197}
198 198
199// Not implemented 199// Not implemented
200QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int ) 200QArray<int> OPimContactAccessBackend_VCard::sorted( bool , int, int, int )
201{ 201{
202 QArray<int> ar(0); 202 QArray<int> ar(0);
203 return ar; 203 return ar;
204} 204}
205 205
206// *** Private stuff *** 206// *** Private stuff ***
207 207
208 208
209OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) 209OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj )
210{ 210{
211 OPimContact c; 211 OPimContact c;
212 212
213 VObjectIterator it; 213 VObjectIterator it;
214 initPropIterator( &it, obj ); 214 initPropIterator( &it, obj );
215 while( moreIteration( &it ) ) { 215 while( moreIteration( &it ) ) {
216 VObject *o = nextVObject( &it ); 216 VObject *o = nextVObject( &it );
217 QCString name = vObjectName( o ); 217 QCString name = vObjectName( o );
218 QString value = QString::fromUtf8( vObjectStringZValue( o ) ); 218 QString value = QString::fromUtf8( vObjectStringZValue( o ) );
219 odebug << "(1)Read: %s" << QString( value ).latin1() << oendl; 219 odebug << "(1)Read: %s" << QString( value ).latin1() << oendl;
220 if ( name == VCNameProp ) { 220 if ( name == VCNameProp ) {
221 VObjectIterator nit; 221 VObjectIterator nit;
222 initPropIterator( &nit, o ); 222 initPropIterator( &nit, o );
223 while( moreIteration( &nit ) ) { 223 while( moreIteration( &nit ) ) {
224 VObject *o = nextVObject( &nit ); 224 VObject *o = nextVObject( &nit );
225 QCString name = vObjectTypeInfo( o ); 225 QCString name = vObjectTypeInfo( o );
226 QString value = QString::fromUtf8( vObjectStringZValue( o ) ); 226 QString value = QString::fromUtf8( vObjectStringZValue( o ) );
227 odebug << "(2)Read: %s" << value.latin1() << oendl; 227 odebug << "(2)Read: %s" << value.latin1() << oendl;
228 if ( name == VCNamePrefixesProp ) 228 if ( name == VCNamePrefixesProp )
229 c.setTitle( value ); 229 c.setTitle( value );
230 else if ( name == VCNameSuffixesProp ) 230 else if ( name == VCNameSuffixesProp )
231 c.setSuffix( value ); 231 c.setSuffix( value );
232 else if ( name == VCFamilyNameProp ) 232 else if ( name == VCFamilyNameProp )
233 c.setLastName( value ); 233 c.setLastName( value );
234 else if ( name == VCGivenNameProp ) 234 else if ( name == VCGivenNameProp )
235 c.setFirstName( value ); 235 c.setFirstName( value );
236 else if ( name == VCAdditionalNamesProp ) 236 else if ( name == VCAdditionalNamesProp )
237 c.setMiddleName( value ); 237 c.setMiddleName( value );
238 } 238 }
239 } 239 }
240 else if ( name == VCAdrProp ) { 240 else if ( name == VCAdrProp ) {
241 bool work = TRUE; // default address is work address 241 bool work = TRUE; // default address is work address
242 QString street; 242 QString street;
243 QString city; 243 QString city;
244 QString region; 244 QString region;
245 QString postal; 245 QString postal;
246 QString country; 246 QString country;
247 247
248 VObjectIterator nit; 248 VObjectIterator nit;
249 initPropIterator( &nit, o ); 249 initPropIterator( &nit, o );
250 while( moreIteration( &nit ) ) { 250 while( moreIteration( &nit ) ) {
251 VObject *o = nextVObject( &nit ); 251 VObject *o = nextVObject( &nit );
252 QCString name = vObjectName( o ); 252 QCString name = vObjectName( o );
253 QString value = QString::fromUtf8( vObjectStringZValue( o ) ); 253 QString value = QString::fromUtf8( vObjectStringZValue( o ) );
254 if ( name == VCHomeProp ) 254 if ( name == VCHomeProp )
255 work = FALSE; 255 work = FALSE;
256 else if ( name == VCWorkProp ) 256 else if ( name == VCWorkProp )
257 work = TRUE; 257 work = TRUE;
258 else if ( name == VCStreetAddressProp ) 258 else if ( name == VCStreetAddressProp )
259 street = value; 259 street = value;
260 else if ( name == VCCityProp ) 260 else if ( name == VCCityProp )
261 city = value; 261 city = value;
262 else if ( name == VCRegionProp ) 262 else if ( name == VCRegionProp )
263 region = value; 263 region = value;
264 else if ( name == VCPostalCodeProp ) 264 else if ( name == VCPostalCodeProp )
265 postal = value; 265 postal = value;
266 else if ( name == VCCountryNameProp ) 266 else if ( name == VCCountryNameProp )
267 country = value; 267 country = value;
268 } 268 }
269 if ( work ) { 269 if ( work ) {
270 c.setBusinessStreet( street ); 270 c.setBusinessStreet( street );
271 c.setBusinessCity( city ); 271 c.setBusinessCity( city );
272 c.setBusinessCountry( country ); 272 c.setBusinessCountry( country );
273 c.setBusinessZip( postal ); 273 c.setBusinessZip( postal );
274 c.setBusinessState( region ); 274 c.setBusinessState( region );
275 } else { 275 } else {
276 c.setHomeStreet( street ); 276 c.setHomeStreet( street );
277 c.setHomeCity( city ); 277 c.setHomeCity( city );
278 c.setHomeCountry( country ); 278 c.setHomeCountry( country );
279 c.setHomeZip( postal ); 279 c.setHomeZip( postal );
280 c.setHomeState( region ); 280 c.setHomeState( region );
281 } 281 }
282 } 282 }
283 else if ( name == VCTelephoneProp ) { 283 else if ( name == VCTelephoneProp ) {
284 enum { 284 enum {
285 HOME = 0x01, 285 HOME = 0x01,
286 WORK = 0x02, 286 WORK = 0x02,
287 VOICE = 0x04, 287 VOICE = 0x04,
288 CELL = 0x08, 288 CELL = 0x08,
289 FAX = 0x10, 289 FAX = 0x10,
290 PAGER = 0x20, 290 PAGER = 0x20,
291 UNKNOWN = 0x80 291 UNKNOWN = 0x80
292 }; 292 };
293 int type = 0; 293 int type = 0;
294 294
295 VObjectIterator nit; 295 VObjectIterator nit;
296 initPropIterator( &nit, o ); 296 initPropIterator( &nit, o );
297 while( moreIteration( &nit ) ) { 297 while( moreIteration( &nit ) ) {
298 VObject *o = nextVObject( &nit ); 298 VObject *o = nextVObject( &nit );
299 QCString name = vObjectTypeInfo( o ); 299 QCString name = vObjectTypeInfo( o );
300 if ( name == VCHomeProp ) 300 if ( name == VCHomeProp )
301 type |= HOME; 301 type |= HOME;
302 else if ( name == VCWorkProp ) 302 else if ( name == VCWorkProp )
303 type |= WORK; 303 type |= WORK;
304 else if ( name == VCVoiceProp ) 304 else if ( name == VCVoiceProp )
305 type |= VOICE; 305 type |= VOICE;
306 else if ( name == VCCellularProp ) 306 else if ( name == VCCellularProp )
307 type |= CELL; 307 type |= CELL;
308 else if ( name == VCFaxProp ) 308 else if ( name == VCFaxProp )
309 type |= FAX; 309 type |= FAX;
310 else if ( name == VCPagerProp ) 310 else if ( name == VCPagerProp )
311 type |= PAGER; 311 type |= PAGER;
312 else if ( name == VCPreferredProp ) 312 else if ( name == VCPreferredProp )
313 ; 313 ;
314 else 314 else
315 type |= UNKNOWN; 315 type |= UNKNOWN;
316 } 316 }
317 if ( (type & UNKNOWN) != UNKNOWN ) { 317 if ( (type & UNKNOWN) != UNKNOWN ) {
318 if ( ( type & (HOME|WORK) ) == 0 ) // default 318 if ( ( type & (HOME|WORK) ) == 0 ) // default
319 type |= HOME; 319 type |= HOME;
320 if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default 320 if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default
321 type |= VOICE; 321 type |= VOICE;
322 322
323 owarn << "value %s %d" << value.data() << type << oendl; 323 owarn << "value %s %d" << value.data() << type << oendl;
324 if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) 324 if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) )
325 c.setHomePhone( value ); 325 c.setHomePhone( value );
326 if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) 326 if ( ( type & (FAX|HOME) ) == (FAX|HOME) )
327 c.setHomeFax( value ); 327 c.setHomeFax( value );
328 if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) 328 if ( ( type & (CELL|HOME) ) == (CELL|HOME) )
329 c.setHomeMobile( value ); 329 c.setHomeMobile( value );
330 if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) ) 330 if ( ( type & (VOICE|WORK) ) == (VOICE|WORK) && (type & (CELL|WORK) ) != (CELL|WORK) )
331 c.setBusinessPhone( value ); 331 c.setBusinessPhone( value );
332 if ( ( type & (FAX|WORK) ) == (FAX|WORK) ) 332 if ( ( type & (FAX|WORK) ) == (FAX|WORK) )
333 c.setBusinessFax( value ); 333 c.setBusinessFax( value );
334 if ( ( type & (CELL|WORK) ) == (CELL|WORK) ) 334 if ( ( type & (CELL|WORK) ) == (CELL|WORK) )
335 c.setBusinessMobile( value ); 335 c.setBusinessMobile( value );
336 if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) ) 336 if ( ( type & (PAGER|WORK) ) == (PAGER|WORK) )
337 c.setBusinessPager( value ); 337 c.setBusinessPager( value );
338 } 338 }
339 } 339 }
340 else if ( name == VCEmailAddressProp ) { 340 else if ( name == VCEmailAddressProp ) {
341 QString email = QString::fromUtf8( vObjectStringZValue( o ) ); 341 QString email = QString::fromUtf8( vObjectStringZValue( o ) );
342 bool valid = TRUE; 342 bool valid = TRUE;
343 VObjectIterator nit; 343 VObjectIterator nit;
344 initPropIterator( &nit, o ); 344 initPropIterator( &nit, o );
345 while( moreIteration( &nit ) ) { 345 while( moreIteration( &nit ) ) {
346 VObject *o = nextVObject( &nit ); 346 VObject *o = nextVObject( &nit );
347 QCString name = vObjectTypeInfo( o ); 347 QCString name = vObjectTypeInfo( o );
348 if ( name != VCInternetProp && name != VCHomeProp && 348 if ( name != VCInternetProp && name != VCHomeProp &&
349 name != VCWorkProp && 349 name != VCWorkProp &&
350 name != VCPreferredProp ) 350 name != VCPreferredProp )
351 // ### preffered should map to default email 351 // ### preffered should map to default email
352 valid = FALSE; 352 valid = FALSE;
353 } 353 }
354 if ( valid ) { 354 if ( valid ) {
355 c.insertEmail( email ); 355 c.insertEmail( email );
356 } 356 }
357 } 357 }
358 else if ( name == VCURLProp ) { 358 else if ( name == VCURLProp ) {
359 VObjectIterator nit; 359 VObjectIterator nit;
360 initPropIterator( &nit, o ); 360 initPropIterator( &nit, o );
361 while( moreIteration( &nit ) ) { 361 while( moreIteration( &nit ) ) {
362 VObject *o = nextVObject( &nit ); 362 VObject *o = nextVObject( &nit );
363 QCString name = vObjectTypeInfo( o ); 363 QCString name = vObjectTypeInfo( o );
364 if ( name == VCHomeProp ) 364 if ( name == VCHomeProp )
365 c.setHomeWebpage( value ); 365 c.setHomeWebpage( value );
366 else if ( name == VCWorkProp ) 366 else if ( name == VCWorkProp )
367 c.setBusinessWebpage( value ); 367 c.setBusinessWebpage( value );
368 } 368 }
369 } 369 }
370 else if ( name == VCOrgProp ) { 370 else if ( name == VCOrgProp ) {
371 VObjectIterator nit; 371 VObjectIterator nit;
372 initPropIterator( &nit, o ); 372 initPropIterator( &nit, o );
373 while( moreIteration( &nit ) ) { 373 while( moreIteration( &nit ) ) {
374 VObject *o = nextVObject( &nit ); 374 VObject *o = nextVObject( &nit );
375 QCString name = vObjectName( o ); 375 QCString name = vObjectName( o );
376 QString value = QString::fromUtf8( vObjectStringZValue( o ) ); 376 QString value = QString::fromUtf8( vObjectStringZValue( o ) );
377 if ( name == VCOrgNameProp ) 377 if ( name == VCOrgNameProp )
378 c.setCompany( value ); 378 c.setCompany( value );
379 else if ( name == VCOrgUnitProp ) 379 else if ( name == VCOrgUnitProp )
380 c.setDepartment( value ); 380 c.setDepartment( value );
381 else if ( name == VCOrgUnit2Prop ) 381 else if ( name == VCOrgUnit2Prop )
382 c.setOffice( value ); 382 c.setOffice( value );
383 } 383 }
384 } 384 }
385 else if ( name == VCTitleProp ) { 385 else if ( name == VCTitleProp ) {
386 c.setJobTitle( value ); 386 c.setJobTitle( value );
387 } 387 }
388 else if ( name == "X-Qtopia-Profession" ) { 388 else if ( name == "X-Qtopia-Profession" ) {
389 c.setProfession( value ); 389 c.setProfession( value );
390 } 390 }
391 else if ( name == "X-Qtopia-Manager" ) { 391 else if ( name == "X-Qtopia-Manager" ) {
392 c.setManager( value ); 392 c.setManager( value );
393 } 393 }
394 else if ( name == "X-Qtopia-Assistant" ) { 394 else if ( name == "X-Qtopia-Assistant" ) {
395 c.setAssistant( value ); 395 c.setAssistant( value );
396 } 396 }
397 else if ( name == "X-Qtopia-Spouse" ) { 397 else if ( name == "X-Qtopia-Spouse" ) {
398 c.setSpouse( value ); 398 c.setSpouse( value );
399 } 399 }
400 else if ( name == "X-Qtopia-Gender" ) { 400 else if ( name == "X-Qtopia-Gender" ) {
401 c.setGender( value ); 401 c.setGender( value );
402 } 402 }
403 else if ( name == "X-Qtopia-Anniversary" ) { 403 else if ( name == "X-Qtopia-Anniversary" ) {
404 c.setAnniversary( convVCardDateToDate( value ) ); 404 c.setAnniversary( convVCardDateToDate( value ) );
405 } 405 }
406 else if ( name == "X-Qtopia-Nickname" ) { 406 else if ( name == "X-Qtopia-Nickname" ) {
407 c.setNickname( value ); 407 c.setNickname( value );
408 } 408 }
409 else if ( name == "X-Qtopia-Children" ) { 409 else if ( name == "X-Qtopia-Children" ) {
410 c.setChildren( value ); 410 c.setChildren( value );
411 } 411 }
412 else if ( name == VCBirthDateProp ) { 412 else if ( name == VCBirthDateProp ) {
413 // Reading Birthdate regarding RFC 2425 (5.8.4) 413 // Reading Birthdate regarding RFC 2425 (5.8.4)
414 c.setBirthday( convVCardDateToDate( value ) ); 414 c.setBirthday( convVCardDateToDate( value ) );
415 415
416 } 416 }
417 else if ( name == VCCommentProp ) { 417 else if ( name == VCCommentProp ) {
418 c.setNotes( value ); 418 c.setNotes( value );
419 } 419 }
420#if 0 420#if 0
421 else { 421 else {
422 printf("Name: %s, value=%s\n", name.data(), QString::fromUtf8( vObjectStringZValue( o ) ) ); 422 printf("Name: %s, value=%s\n", name.data(), QString::fromUtf8( vObjectStringZValue( o ) ) );
423 VObjectIterator nit; 423 VObjectIterator nit;
424 initPropIterator( &nit, o ); 424 initPropIterator( &nit, o );
425 while( moreIteration( &nit ) ) { 425 while( moreIteration( &nit ) ) {
426 VObject *o = nextVObject( &nit ); 426 VObject *o = nextVObject( &nit );
427 QCString name = vObjectName( o ); 427 QCString name = vObjectName( o );
428 QString value = QString::fromUtf8( vObjectStringZValue( o ) ); 428 QString value = QString::fromUtf8( vObjectStringZValue( o ) );
429 printf(" subprop: %s = %s\n", name.data(), value.latin1() ); 429 printf(" subprop: %s = %s\n", name.data(), value.latin1() );
430 } 430 }
431 } 431 }
432 else { 432 else {
433 printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) ); 433 printf("Name: %s, value=%s\n", name.data(), vObjectStringZValue( o ) );
434 VObjectIterator nit; 434 VObjectIterator nit;
435 initPropIterator( &nit, o ); 435 initPropIterator( &nit, o );
436 while( moreIteration( &nit ) ) { 436 while( moreIteration( &nit ) ) {
437 VObject *o = nextVObject( &nit ); 437 VObject *o = nextVObject( &nit );
438 QCString name = vObjectName( o ); 438 QCString name = vObjectName( o );
439 QString value = vObjectStringZValue( o ); 439 QString value = vObjectStringZValue( o );
440 printf(" subprop: %s = %s\n", name.data(), value.latin1() ); 440 printf(" subprop: %s = %s\n", name.data(), value.latin1() );
441 } 441 }
442 } 442 }
443#endif 443#endif
444 } 444 }
445 c.setFileAs(); 445 c.setFileAs();
446 return c; 446 return c;
447} 447}
448 448
449 449
450VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c ) 450VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c )
451{ 451{
452 VObject *vcard = newVObject( VCCardProp ); 452 VObject *vcard = newVObject( VCCardProp );
453 safeAddPropValue( vcard, VCVersionProp, "2.1" ); 453 safeAddPropValue( vcard, VCVersionProp, "2.1" );
454 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); 454 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) );
455 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); 455 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) );
456 456
457 // full name 457 // full name
458 safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); 458 safeAddPropValue( vcard, VCFullNameProp, c.fullName() );
459 459
460 // name properties 460 // name properties
461 VObject *name = safeAddProp( vcard, VCNameProp ); 461 VObject *name = safeAddProp( vcard, VCNameProp );
462 safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); 462 safeAddPropValue( name, VCFamilyNameProp, c.lastName() );
463 safeAddPropValue( name, VCGivenNameProp, c.firstName() ); 463 safeAddPropValue( name, VCGivenNameProp, c.firstName() );
464 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); 464 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() );
465 safeAddPropValue( name, VCNamePrefixesProp, c.title() ); 465 safeAddPropValue( name, VCNamePrefixesProp, c.title() );
466 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); 466 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() );
467 467
468 // home properties 468 // home properties
469 VObject *home_adr= safeAddProp( vcard, VCAdrProp ); 469 VObject *home_adr= safeAddProp( vcard, VCAdrProp );
470 safeAddProp( home_adr, VCHomeProp ); 470 safeAddProp( home_adr, VCHomeProp );
471 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); 471 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() );
472 safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); 472 safeAddPropValue( home_adr, VCCityProp, c.homeCity() );
473 safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); 473 safeAddPropValue( home_adr, VCRegionProp, c.homeState() );
474 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); 474 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() );
475 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); 475 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() );
476 476
477 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); 477 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() );
478 safeAddProp( home_phone, VCHomeProp ); 478 safeAddProp( home_phone, VCHomeProp );
479 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); 479 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() );
480 safeAddProp( home_phone, VCHomeProp ); 480 safeAddProp( home_phone, VCHomeProp );
481 safeAddProp( home_phone, VCCellularProp ); 481 safeAddProp( home_phone, VCCellularProp );
482 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); 482 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() );
483 safeAddProp( home_phone, VCHomeProp ); 483 safeAddProp( home_phone, VCHomeProp );
484 safeAddProp( home_phone, VCFaxProp ); 484 safeAddProp( home_phone, VCFaxProp );
485 485
486 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); 486 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() );
487 safeAddProp( url, VCHomeProp ); 487 safeAddProp( url, VCHomeProp );
488 488
489 // work properties 489 // work properties
490 VObject *work_adr= safeAddProp( vcard, VCAdrProp ); 490 VObject *work_adr= safeAddProp( vcard, VCAdrProp );
491 safeAddProp( work_adr, VCWorkProp ); 491 safeAddProp( work_adr, VCWorkProp );
492 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); 492 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() );
493 safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); 493 safeAddPropValue( work_adr, VCCityProp, c.businessCity() );
494 safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); 494 safeAddPropValue( work_adr, VCRegionProp, c.businessState() );
495 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); 495 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() );
496 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); 496 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() );
497 497
498 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); 498 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() );
499 safeAddProp( work_phone, VCWorkProp ); 499 safeAddProp( work_phone, VCWorkProp );
500 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); 500 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() );
501 safeAddProp( work_phone, VCWorkProp ); 501 safeAddProp( work_phone, VCWorkProp );
502 safeAddProp( work_phone, VCCellularProp ); 502 safeAddProp( work_phone, VCCellularProp );
503 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); 503 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() );
504 safeAddProp( work_phone, VCWorkProp ); 504 safeAddProp( work_phone, VCWorkProp );
505 safeAddProp( work_phone, VCFaxProp ); 505 safeAddProp( work_phone, VCFaxProp );
506 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); 506 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
507 safeAddProp( work_phone, VCWorkProp ); 507 safeAddProp( work_phone, VCWorkProp );
508 safeAddProp( work_phone, VCPagerProp ); 508 safeAddProp( work_phone, VCPagerProp );
509 509
510 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); 510 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() );
511 safeAddProp( url, VCWorkProp ); 511 safeAddProp( url, VCWorkProp );
512 512
513 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); 513 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() );
514 safeAddProp( title, VCWorkProp ); 514 safeAddProp( title, VCWorkProp );
515 515
516 516
517 QStringList emails = c.emailList(); 517 QStringList emails = c.emailList();
518 // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045 518 // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045
519 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 519 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
520 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); 520 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it );
521 safeAddProp( email, VCInternetProp ); 521 safeAddProp( email, VCInternetProp );
522 } 522 }
523 523
524 safeAddPropValue( vcard, VCNoteProp, c.notes() ); 524 safeAddPropValue( vcard, VCNoteProp, c.notes() );
525 525
526 // Exporting Birthday regarding RFC 2425 (5.8.4) 526 // Exporting Birthday regarding RFC 2425 (5.8.4)
527 if ( c.birthday().isValid() ){ 527 if ( c.birthday().isValid() ){
528 owarn << "Exporting birthday as: " << convDateToVCardDate( c.birthday() ) << "" << oendl; 528 owarn << "Exporting birthday as: " << convDateToVCardDate( c.birthday() ) << "" << oendl;
529 safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); 529 safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) );
530 } 530 }
531 531
532 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { 532 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) {
533 VObject *org = safeAddProp( vcard, VCOrgProp ); 533 VObject *org = safeAddProp( vcard, VCOrgProp );
534 safeAddPropValue( org, VCOrgNameProp, c.company() ); 534 safeAddPropValue( org, VCOrgNameProp, c.company() );
535 safeAddPropValue( org, VCOrgUnitProp, c.department() ); 535 safeAddPropValue( org, VCOrgUnitProp, c.department() );
536 safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); 536 safeAddPropValue( org, VCOrgUnit2Prop, c.office() );
537 } 537 }
538 538
539 // some values we have to export as custom fields 539 // some values we have to export as custom fields
540 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); 540 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() );
541 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); 541 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() );
542 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); 542 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() );
543 543
544 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); 544 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() );
545 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); 545 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() );
546 if ( c.anniversary().isValid() ){ 546 if ( c.anniversary().isValid() ){
547 owarn << "Exporting anniversary as: " << convDateToVCardDate( c.anniversary() ) << "" << oendl; 547 owarn << "Exporting anniversary as: " << convDateToVCardDate( c.anniversary() ) << "" << oendl;
548 safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); 548 safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) );
549 } 549 }
550 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); 550 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() );
551 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); 551 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() );
552 552
553 return vcard; 553 return vcard;
554} 554}
555 555
556QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const 556QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const
557{ 557{
558 QString str_rfc2425 = QString("%1-%2-%3") 558 QString str_rfc2425 = QString("%1-%2-%3")
559 .arg( d.year() ) 559 .arg( d.year() )
560 .arg( d.month(), 2 ) 560 .arg( d.month(), 2 )
561 .arg( d.day(), 2 ); 561 .arg( d.day(), 2 );
562 // Now replace spaces with "0"... 562 // Now replace spaces with "0"...
563 int pos = 0; 563 int pos = 0;
564 while ( ( pos = str_rfc2425.find (' ') ) > 0 ) 564 while ( ( pos = str_rfc2425.find (' ') ) > 0 )
565 str_rfc2425.replace( pos, 1, "0" ); 565 str_rfc2425.replace( pos, 1, "0" );
566 566
567 return str_rfc2425; 567 return str_rfc2425;
568} 568}
569 569
570QDate OPimContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr ) 570QDate OPimContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr )
571{ 571{
572 int monthPos = datestr.find('-'); 572 int monthPos = datestr.find('-');
573 int dayPos = datestr.find('-', monthPos+1 ); 573 int dayPos = datestr.find('-', monthPos+1 );
574 int sep_ignore = 1; 574 int sep_ignore = 1;
575 if ( monthPos == -1 || dayPos == -1 ) { 575 if ( monthPos == -1 || dayPos == -1 ) {
576 odebug << "fromString didn't find - in str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; 576 odebug << "fromString didn't find - in str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl;
577 // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD ) 577 // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD )
578 if ( datestr.length() == 8 ){ 578 if ( datestr.length() == 8 ){
579 monthPos = 4; 579 monthPos = 4;
580 dayPos = 6; 580 dayPos = 6;
581 sep_ignore = 0; 581 sep_ignore = 0;
582 odebug << "Try with follwing positions str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; 582 odebug << "Try with follwing positions str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl;
583 } else { 583 } else {
584 return QDate(); 584 return QDate();
585 } 585 }
586 } 586 }
587 int y = datestr.left( monthPos ).toInt(); 587 int y = datestr.left( monthPos ).toInt();
588 int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); 588 int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt();
589 int d = datestr.mid( dayPos + sep_ignore ).toInt(); 589 int d = datestr.mid( dayPos + sep_ignore ).toInt();
590 odebug << "TimeConversion::fromString ymd = " << datestr << " => " << y << " " << m << " " << d << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; 590 odebug << "TimeConversion::fromString ymd = " << datestr << " => " << y << " " << m << " " << d << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl;
591 QDate date ( y,m,d ); 591 QDate date ( y,m,d );
592 return date; 592 return date;
593} 593}
594 594
595VObject* OPimContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value ) 595VObject* OPimContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value )
596{ 596{
597 VObject *ret = 0; 597 VObject *ret = 0;
598 if ( o && !value.isEmpty() ) 598 if ( o && !value.isEmpty() )
599 ret = addPropValue( o, prop, value.utf8() ); 599 ret = addPropValue( o, prop, value.utf8() );
600 return ret; 600 return ret;
601} 601}
602 602
603VObject* OPimContactAccessBackend_VCard::safeAddProp( VObject *o, const char *prop) 603VObject* OPimContactAccessBackend_VCard::safeAddProp( VObject *o, const char *prop)
604{ 604{
605 VObject *ret = 0; 605 VObject *ret = 0;
606 if ( o ) 606 if ( o )
607 ret = addProp( o, prop ); 607 ret = addProp( o, prop );
608 return ret; 608 return ret;
609} 609}
610 610
611} 611}
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp
index 14a325e..7d58a40 100644
--- a/libopie2/opiepim/backend/otodoaccessvcal.cpp
+++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp
@@ -1,289 +1,289 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) 3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "vobject_p.h" 30#include <opie2/private/vobject_p.h>
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/otodoaccessvcal.h> 33#include <opie2/otodoaccessvcal.h>
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35 35
36#include <qpe/timeconversion.h> 36#include <qpe/timeconversion.h>
37 37
38/* QT */ 38/* QT */
39//FIXME: Hack to allow direct access to FILE* fh. Rewrite this! 39//FIXME: Hack to allow direct access to FILE* fh. Rewrite this!
40#define protected public 40#define protected public
41#include <qfile.h> 41#include <qfile.h>
42#undef protected 42#undef protected
43 43
44using namespace Opie; 44using namespace Opie;
45 45
46namespace { 46namespace {
47 static OPimTodo eventByVObj( VObject *obj ){ 47 static OPimTodo eventByVObj( VObject *obj ){
48 OPimTodo event; 48 OPimTodo event;
49 VObject *ob; 49 VObject *ob;
50 QCString name; 50 QCString name;
51 // no uid, attendees, ... and no fun 51 // no uid, attendees, ... and no fun
52 // description 52 // description
53 if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ 53 if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){
54 name = vObjectStringZValue( ob ); 54 name = vObjectStringZValue( ob );
55#if 0 55#if 0
56 event.setDescription( name ); 56 event.setDescription( name );
57#else 57#else
58 event.setSummary( name ); 58 event.setSummary( name );
59#endif 59#endif
60 } 60 }
61 // summary 61 // summary
62 if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { 62 if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) {
63 name = vObjectStringZValue( ob ); 63 name = vObjectStringZValue( ob );
64#if 0 64#if 0
65 event.setSummary( name ); 65 event.setSummary( name );
66#else 66#else
67 event.setDescription( name ); 67 event.setDescription( name );
68#endif 68#endif
69 } 69 }
70 // completed 70 // completed
71 if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ 71 if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){
72 name = vObjectStringZValue( ob ); 72 name = vObjectStringZValue( ob );
73 if( name == "COMPLETED" ){ 73 if( name == "COMPLETED" ){
74 event.setCompleted( true ); 74 event.setCompleted( true );
75 }else{ 75 }else{
76 event.setCompleted( false ); 76 event.setCompleted( false );
77 } 77 }
78 }else 78 }else
79 event.setCompleted( false ); 79 event.setCompleted( false );
80 // priority 80 // priority
81 if ((ob = isAPropertyOf(obj, VCPriorityProp))) { 81 if ((ob = isAPropertyOf(obj, VCPriorityProp))) {
82 name = vObjectStringZValue( ob ); 82 name = vObjectStringZValue( ob );
83 bool ok; 83 bool ok;
84 event.setPriority(name.toInt(&ok) ); 84 event.setPriority(name.toInt(&ok) );
85 } 85 }
86 //due date 86 //due date
87 if((ob = isAPropertyOf(obj, VCDueProp)) ){ 87 if((ob = isAPropertyOf(obj, VCDueProp)) ){
88 event.setHasDueDate( true ); 88 event.setHasDueDate( true );
89 name = vObjectStringZValue( ob ); 89 name = vObjectStringZValue( ob );
90 event.setDueDate( TimeConversion::fromISO8601( name).date() ); 90 event.setDueDate( TimeConversion::fromISO8601( name).date() );
91 } 91 }
92 // categories 92 // categories
93 if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ 93 if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){
94 name = vObjectStringZValue( ob ); 94 name = vObjectStringZValue( ob );
95 owarn << "Categories:" << name.data() << "" << oendl; 95 owarn << "Categories:" << name.data() << "" << oendl;
96 } 96 }
97 97
98 event.setUid( 1 ); 98 event.setUid( 1 );
99 return event; 99 return event;
100 }; 100 };
101 static VObject *vobjByEvent( const OPimTodo &event ) { 101 static VObject *vobjByEvent( const OPimTodo &event ) {
102 VObject *task = newVObject( VCTodoProp ); 102 VObject *task = newVObject( VCTodoProp );
103 if( task == 0 ) 103 if( task == 0 )
104 return 0l; 104 return 0l;
105 105
106 if( event.hasDueDate() ) { 106 if( event.hasDueDate() ) {
107 QTime time(0, 0, 0); 107 QTime time(0, 0, 0);
108 QDateTime date(event.dueDate(), time ); 108 QDateTime date(event.dueDate(), time );
109 addPropValue( task, VCDueProp, 109 addPropValue( task, VCDueProp,
110 TimeConversion::toISO8601( date ) ); 110 TimeConversion::toISO8601( date ) );
111 } 111 }
112 112
113 if( event.isCompleted() ) 113 if( event.isCompleted() )
114 addPropValue( task, VCStatusProp, "COMPLETED"); 114 addPropValue( task, VCStatusProp, "COMPLETED");
115 115
116 QString string = QString::number(event.priority() ); 116 QString string = QString::number(event.priority() );
117 addPropValue( task, VCPriorityProp, string.local8Bit() ); 117 addPropValue( task, VCPriorityProp, string.local8Bit() );
118 118
119 addPropValue( task, VCCategoriesProp, 119 addPropValue( task, VCCategoriesProp,
120 event.idsToString( event.categories() ).local8Bit() ); 120 event.idsToString( event.categories() ).local8Bit() );
121 121
122#if 0 122#if 0
123 123
124 // There seems a misrepresentation between summary in otodoevent 124 // There seems a misrepresentation between summary in otodoevent
125 // and summary in vcard. 125 // and summary in vcard.
126 // The same with description.. 126 // The same with description..
127 // Description is summary and vice versa.. Argh.. (eilers) 127 // Description is summary and vice versa.. Argh.. (eilers)
128 128
129 129
130 addPropValue( task, VCDescriptionProp, 130 addPropValue( task, VCDescriptionProp,
131 event.description().local8Bit() ); 131 event.description().local8Bit() );
132 132
133 addPropValue( task, VCSummaryProp, 133 addPropValue( task, VCSummaryProp,
134 event.summary().local8Bit() ); 134 event.summary().local8Bit() );
135 135
136#else 136#else
137 addPropValue( task, VCDescriptionProp, 137 addPropValue( task, VCDescriptionProp,
138 event.summary().local8Bit() ); 138 event.summary().local8Bit() );
139 139
140 addPropValue( task, VCSummaryProp, 140 addPropValue( task, VCSummaryProp,
141 event.description().local8Bit() ); 141 event.description().local8Bit() );
142#endif 142#endif
143 return task; 143 return task;
144}; 144};
145} 145}
146 146
147namespace Opie { 147namespace Opie {
148OPimTodoAccessVCal::OPimTodoAccessVCal( const QString& path ) 148OPimTodoAccessVCal::OPimTodoAccessVCal( const QString& path )
149 : m_dirty(false), m_file( path ) 149 : m_dirty(false), m_file( path )
150{ 150{
151} 151}
152OPimTodoAccessVCal::~OPimTodoAccessVCal() { 152OPimTodoAccessVCal::~OPimTodoAccessVCal() {
153} 153}
154bool OPimTodoAccessVCal::load() { 154bool OPimTodoAccessVCal::load() {
155 m_map.clear(); 155 m_map.clear();
156 m_dirty = false; 156 m_dirty = false;
157 157
158 VObject* vcal = 0l; 158 VObject* vcal = 0l;
159 vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 159 vcal = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
160 if (!vcal ) 160 if (!vcal )
161 return false; 161 return false;
162 162
163 // Iterate over the list 163 // Iterate over the list
164 VObjectIterator it; 164 VObjectIterator it;
165 VObject* vobj; 165 VObject* vobj;
166 166
167 initPropIterator(&it, vcal); 167 initPropIterator(&it, vcal);
168 168
169 while( moreIteration( &it ) ) { 169 while( moreIteration( &it ) ) {
170 vobj = ::nextVObject( &it ); 170 vobj = ::nextVObject( &it );
171 QCString name = ::vObjectName( vobj ); 171 QCString name = ::vObjectName( vobj );
172 if( name == VCTodoProp ){ 172 if( name == VCTodoProp ){
173 OPimTodo to = eventByVObj( vobj ); 173 OPimTodo to = eventByVObj( vobj );
174 m_map.insert( to.uid(), to ); 174 m_map.insert( to.uid(), to );
175 } 175 }
176 } 176 }
177 177
178 // Should I do a delete vcal? 178 // Should I do a delete vcal?
179 179
180 return true; 180 return true;
181} 181}
182bool OPimTodoAccessVCal::reload() { 182bool OPimTodoAccessVCal::reload() {
183 return load(); 183 return load();
184} 184}
185bool OPimTodoAccessVCal::save() { 185bool OPimTodoAccessVCal::save() {
186 if (!m_dirty ) 186 if (!m_dirty )
187 return true; 187 return true;
188 188
189 QFile file( m_file ); 189 QFile file( m_file );
190 if (!file.open(IO_WriteOnly ) ) 190 if (!file.open(IO_WriteOnly ) )
191 return false; 191 return false;
192 192
193 VObject *obj; 193 VObject *obj;
194 obj = newVObject( VCCalProp ); 194 obj = newVObject( VCCalProp );
195 addPropValue( obj, VCVersionProp, "1.0" ); 195 addPropValue( obj, VCVersionProp, "1.0" );
196 VObject *vo; 196 VObject *vo;
197 for(QMap<int, OPimTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ 197 for(QMap<int, OPimTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){
198 vo = vobjByEvent( it.data() ); 198 vo = vobjByEvent( it.data() );
199 addVObjectProp(obj, vo ); 199 addVObjectProp(obj, vo );
200 } 200 }
201 writeVObject( file.fh, obj ); //FIXME: HACK!!! 201 writeVObject( file.fh, obj ); //FIXME: HACK!!!
202 cleanVObject( obj ); 202 cleanVObject( obj );
203 cleanStrTbl(); 203 cleanStrTbl();
204 204
205 m_dirty = false; 205 m_dirty = false;
206 return true; 206 return true;
207} 207}
208void OPimTodoAccessVCal::clear() { 208void OPimTodoAccessVCal::clear() {
209 m_map.clear(); 209 m_map.clear();
210 m_dirty = true; 210 m_dirty = true;
211} 211}
212bool OPimTodoAccessVCal::add( const OPimTodo& to ) { 212bool OPimTodoAccessVCal::add( const OPimTodo& to ) {
213 m_map.insert( to.uid(), to ); 213 m_map.insert( to.uid(), to );
214 m_dirty = true; 214 m_dirty = true;
215 return true; 215 return true;
216} 216}
217bool OPimTodoAccessVCal::remove( int uid ) { 217bool OPimTodoAccessVCal::remove( int uid ) {
218 m_map.remove( uid ); 218 m_map.remove( uid );
219 m_dirty = true; 219 m_dirty = true;
220 return true; 220 return true;
221} 221}
222void OPimTodoAccessVCal::removeAllCompleted() { 222void OPimTodoAccessVCal::removeAllCompleted() {
223 for ( QMap<int, OPimTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) { 223 for ( QMap<int, OPimTodo>::Iterator it = m_map.begin(); it != m_map.end(); ++it ) {
224 if ( (*it).isCompleted() ) 224 if ( (*it).isCompleted() )
225 m_map.remove( it ); 225 m_map.remove( it );
226 } 226 }
227} 227}
228bool OPimTodoAccessVCal::replace( const OPimTodo& to ) { 228bool OPimTodoAccessVCal::replace( const OPimTodo& to ) {
229 m_map.replace( to.uid(), to ); 229 m_map.replace( to.uid(), to );
230 m_dirty = true; 230 m_dirty = true;
231 return true; 231 return true;
232} 232}
233OPimTodo OPimTodoAccessVCal::find(int uid )const { 233OPimTodo OPimTodoAccessVCal::find(int uid )const {
234 return m_map[uid]; 234 return m_map[uid];
235} 235}
236QArray<int> OPimTodoAccessVCal::sorted( bool, int, int, int ) { 236QArray<int> OPimTodoAccessVCal::sorted( bool, int, int, int ) {
237 QArray<int> ar(0); 237 QArray<int> ar(0);
238 return ar; 238 return ar;
239} 239}
240QArray<int> OPimTodoAccessVCal::allRecords()const { 240QArray<int> OPimTodoAccessVCal::allRecords()const {
241 QArray<int> ar( m_map.count() ); 241 QArray<int> ar( m_map.count() );
242 QMap<int, OPimTodo>::ConstIterator it; 242 QMap<int, OPimTodo>::ConstIterator it;
243 int i = 0; 243 int i = 0;
244 for ( it = m_map.begin(); it != m_map.end(); ++it ) { 244 for ( it = m_map.begin(); it != m_map.end(); ++it ) {
245 ar[i] = it.key(); 245 ar[i] = it.key();
246 i++; 246 i++;
247 } 247 }
248 return ar; 248 return ar;
249} 249}
250QArray<int> OPimTodoAccessVCal::matchRegexp(const QRegExp& /* r */)const { 250QArray<int> OPimTodoAccessVCal::matchRegexp(const QRegExp& /* r */)const {
251 QArray<int> ar(0); 251 QArray<int> ar(0);
252 return ar; 252 return ar;
253} 253}
254QArray<int> OPimTodoAccessVCal::queryByExample( const OPimTodo&, int, const QDateTime& ) { 254QArray<int> OPimTodoAccessVCal::queryByExample( const OPimTodo&, int, const QDateTime& ) {
255 QArray<int> ar(0); 255 QArray<int> ar(0);
256 return ar; 256 return ar;
257} 257}
258QArray<int> OPimTodoAccessVCal::effectiveToDos( const QDate& , 258QArray<int> OPimTodoAccessVCal::effectiveToDos( const QDate& ,
259 const QDate& , 259 const QDate& ,
260 bool ) { 260 bool ) {
261 QArray<int> ar(0); 261 QArray<int> ar(0);
262 return ar; 262 return ar;
263} 263}
264QArray<int> OPimTodoAccessVCal::overDue() { 264QArray<int> OPimTodoAccessVCal::overDue() {
265 QArray<int> ar(0); 265 QArray<int> ar(0);
266 return ar; 266 return ar;
267} 267}
268QBitArray OPimTodoAccessVCal::supports()const { 268QBitArray OPimTodoAccessVCal::supports()const {
269 static QBitArray ar = sup(); 269 static QBitArray ar = sup();
270 270
271 return ar; 271 return ar;
272} 272}
273QBitArray OPimTodoAccessVCal::sup() { 273QBitArray OPimTodoAccessVCal::sup() {
274 QBitArray ar ( OPimTodo::CompletedDate +1 ); 274 QBitArray ar ( OPimTodo::CompletedDate +1 );
275 ar.fill( true ); 275 ar.fill( true );
276 276
277 ar[OPimTodo::CrossReference] = false; 277 ar[OPimTodo::CrossReference] = false;
278 ar[OPimTodo::State ] = false; 278 ar[OPimTodo::State ] = false;
279 ar[OPimTodo::Reminders] = false; 279 ar[OPimTodo::Reminders] = false;
280 ar[OPimTodo::Notifiers] = false; 280 ar[OPimTodo::Notifiers] = false;
281 ar[OPimTodo::Maintainer] = false; 281 ar[OPimTodo::Maintainer] = false;
282 ar[OPimTodo::Progress] = false; 282 ar[OPimTodo::Progress] = false;
283 ar[OPimTodo::Alarms ] = false; 283 ar[OPimTodo::Alarms ] = false;
284 ar[OPimTodo::Recurrence] = false; 284 ar[OPimTodo::Recurrence] = false;
285 285
286 return ar; 286 return ar;
287} 287}
288 288
289} 289}
diff --git a/libopie2/opiepim/core/core.pro b/libopie2/opiepim/core/core.pro
index 597b1e8..b1b5655 100644
--- a/libopie2/opiepim/core/core.pro
+++ b/libopie2/opiepim/core/core.pro
@@ -1,23 +1,48 @@
1HEADERS += \ 1HEADERS += \
2 core/ocontactaccess.h \
3 core/odatebookaccess.h \
4 core/opimaccessfactory.h \
5 core/opimaccesstemplate.h \
6 core/opimcache.h \
7 core/opimcontactfields.h \
8 core/opimcontact.h \
2 core/opimdateconversion.h \ 9 core/opimdateconversion.h \
3 core/opimcache.h \ 10 core/opimevent.h \
4 core/opimmaintainer.h \ 11 core/opimglobal.h \
5 core/opimresolver.h \ 12 core/opimmaintainer.h \
6 core/opimstate.h \ 13 core/opimnotify.h \
7 core/opimxref.h \ 14 core/opimnotifymanager.h \
8 core/opimxrefmanager.h \ 15 core/opimrecord.h \
9 core/opimxrefpartner.h \ 16 core/opimrecordlist.h \
10 core/opimrecurrence.h \ 17 core/opimrecurrence.h \
11 core/opimtemplatebase.h \ 18 core/opimresolver.h \
12 core/opimtimezone.h 19 core/opimstate.h \
20 core/opimtemplatebase.h \
21 core/opimtimezone.h \
22 core/opimtodo.h \
23 core/opimxref.h \
24 core/opimxrefmanager.h \
25 core/opimxrefpartner.h \
26 core/otodoaccess.h
13 27
14SOURCES += \ 28SOURCES += \
29 core/ocontactaccess.cpp \
30 core/odatebookaccess.cpp \
31 core/opimcontactfields.cpp \
32 core/opimcontact.cpp \
15 core/opimdateconversion.cpp \ 33 core/opimdateconversion.cpp \
16 core/opimmaintainer.cpp \ 34 core/opimevent.cpp \
17 core/opimresolver.cpp \ 35 core/opimmaintainer.cpp \
18 core/opimstate.cpp \ 36 core/opimnotify.cpp \
19 core/opimxref.cpp \ 37 core/opimnotifymanager.cpp \
20 core/opimxrefmanager.cpp \ 38 core/opimrecord.cpp \
21 core/opimxrefpartner.cpp \ 39 core/opimrecurrence.cpp \
22 core/opimrecurrence.cpp \ 40 core/opimresolver.cpp \
23 core/opimtimezone.cpp 41 core/opimstate.cpp \
42 core/opimtimezone.cpp \
43 core/opimtodo.cpp \
44 core/opimxref.cpp \
45 core/opimxrefmanager.cpp \
46 core/opimxrefpartner.cpp \
47 core/otodoaccess.cpp
48
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 2602493..771d855 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -1,164 +1,164 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org> 3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29/* 29/*
30 * ===================================================================== 30 * =====================================================================
31 * ToDo: XML-Backend: Automatic reload if something was changed... 31 * ToDo: XML-Backend: Automatic reload if something was changed...
32 * 32 *
33 * 33 *
34 */ 34 */
35 35
36#include "ocontactaccess.h" 36#include <opie2/ocontactaccess.h>
37#include "obackendfactory.h" 37#include <opie2/obackendfactory.h>
38 38
39/* OPIE */ 39/* OPIE */
40#include <opie2/ocontactaccessbackend_xml.h> 40#include <opie2/ocontactaccessbackend_xml.h>
41#include <opie2/opimresolver.h> 41#include <opie2/opimresolver.h>
42#include <opie2/opimglobal.h> 42#include <opie2/opimglobal.h>
43#include <opie2/odebug.h> 43#include <opie2/odebug.h>
44 44
45//#include <qpe/qcopenvelope_qws.h> 45//#include <qpe/qcopenvelope_qws.h>
46#include <qpe/global.h> 46#include <qpe/global.h>
47 47
48/* QT */ 48/* QT */
49#include <qasciidict.h> 49#include <qasciidict.h>
50#include <qdatetime.h> 50#include <qdatetime.h>
51#include <qfile.h> 51#include <qfile.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qlist.h> 53#include <qlist.h>
54#include <qcopchannel_qws.h> 54#include <qcopchannel_qws.h>
55 55
56/* STD */ 56/* STD */
57#include <errno.h> 57#include <errno.h>
58#include <fcntl.h> 58#include <fcntl.h>
59#include <unistd.h> 59#include <unistd.h>
60#include <stdlib.h> 60#include <stdlib.h>
61 61
62 62
63namespace Opie { 63namespace Opie {
64 64
65OPimContactAccess::OPimContactAccess ( const QString appname, const QString , 65OPimContactAccess::OPimContactAccess ( const QString appname, const QString ,
66 OPimContactAccessBackend* end, bool autosync ): 66 OPimContactAccessBackend* end, bool autosync ):
67 OPimAccessTemplate<OPimContact>( end ) 67 OPimAccessTemplate<OPimContact>( end )
68{ 68{
69 /* take care of the backend. If there is no one defined, we 69 /* take care of the backend. If there is no one defined, we
70 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 70 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
71 */ 71 */
72 if( end == 0 ) { 72 if( end == 0 ) {
73 owarn << "Using BackendFactory !" << oendl; 73 owarn << "Using BackendFactory !" << oendl;
74 end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( OPimGlobal::CONTACTLIST, appname ); 74 end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( OPimGlobal::CONTACTLIST, appname );
75 } 75 }
76 // Set backend locally and in template 76 // Set backend locally and in template
77 m_backEnd = end; 77 m_backEnd = end;
78 OPimAccessTemplate<OPimContact>::setBackEnd (end); 78 OPimAccessTemplate<OPimContact>::setBackEnd (end);
79 79
80 80
81 /* Connect signal of external db change to function */ 81 /* Connect signal of external db change to function */
82 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 82 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
83 connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), 83 connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)),
84 this, SLOT(copMessage(const QCString&,const QByteArray&)) ); 84 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
85 if ( autosync ){ 85 if ( autosync ){
86 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); 86 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
87 connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), 87 connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)),
88 this, SLOT(copMessage(const QCString&,const QByteArray&)) ); 88 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
89 } 89 }
90 90
91 91
92} 92}
93OPimContactAccess::~OPimContactAccess () 93OPimContactAccess::~OPimContactAccess ()
94{ 94{
95 /* The user may forget to save the changed database, therefore try to 95 /* The user may forget to save the changed database, therefore try to
96 * do it for him.. 96 * do it for him..
97 */ 97 */
98 save(); 98 save();
99 // delete m_backEnd; is done by template.. 99 // delete m_backEnd; is done by template..
100} 100}
101 101
102 102
103bool OPimContactAccess::save () 103bool OPimContactAccess::save ()
104{ 104{
105 /* If the database was changed externally, we could not save the 105 /* If the database was changed externally, we could not save the
106 * Data. This will remove added items which is unacceptable ! 106 * Data. This will remove added items which is unacceptable !
107 * Therefore: Reload database and merge the data... 107 * Therefore: Reload database and merge the data...
108 */ 108 */
109 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() ) 109 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() )
110 reload(); 110 reload();
111 111
112 bool status = OPimAccessTemplate<OPimContact>::save(); 112 bool status = OPimAccessTemplate<OPimContact>::save();
113 if ( !status ) return false; 113 if ( !status ) return false;
114 114
115 /* Now tell everyone that new data is available. 115 /* Now tell everyone that new data is available.
116 */ 116 */
117 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 117 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
118 118
119 return true; 119 return true;
120} 120}
121 121
122const uint OPimContactAccess::querySettings() 122const uint OPimContactAccess::querySettings()
123{ 123{
124 return ( m_backEnd->querySettings() ); 124 return ( m_backEnd->querySettings() );
125} 125}
126 126
127bool OPimContactAccess::hasQuerySettings ( int querySettings ) const 127bool OPimContactAccess::hasQuerySettings ( int querySettings ) const
128{ 128{
129 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 129 return ( m_backEnd->hasQuerySettings ( querySettings ) );
130} 130}
131OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const 131OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
132{ 132{
133 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); 133 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
134 return ( OPimRecordList<OPimContact>(matchingContacts, this) ); 134 return ( OPimRecordList<OPimContact>(matchingContacts, this) );
135} 135}
136 136
137 137
138bool OPimContactAccess::wasChangedExternally()const 138bool OPimContactAccess::wasChangedExternally()const
139{ 139{
140 return ( m_backEnd->wasChangedExternally() ); 140 return ( m_backEnd->wasChangedExternally() );
141} 141}
142 142
143 143
144void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) 144void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & )
145{ 145{
146 if ( msg == "addressbookUpdated()" ){ 146 if ( msg == "addressbookUpdated()" ){
147 owarn << "OPimContactAccess: Received addressbokUpdated()" << oendl; 147 owarn << "OPimContactAccess: Received addressbokUpdated()" << oendl;
148 emit signalChanged ( this ); 148 emit signalChanged ( this );
149 } else if ( msg == "flush()" ) { 149 } else if ( msg == "flush()" ) {
150 owarn << "OPimContactAccess: Received flush()" << oendl; 150 owarn << "OPimContactAccess: Received flush()" << oendl;
151 save (); 151 save ();
152 } else if ( msg == "reload()" ) { 152 } else if ( msg == "reload()" ) {
153 owarn << "OPimContactAccess: Received reload()" << oendl; 153 owarn << "OPimContactAccess: Received reload()" << oendl;
154 reload (); 154 reload ();
155 emit signalChanged ( this ); 155 emit signalChanged ( this );
156 } 156 }
157} 157}
158 158
159int OPimContactAccess::rtti() const 159int OPimContactAccess::rtti() const
160{ 160{
161 return OPimResolver::AddressBook; 161 return OPimResolver::AddressBook;
162} 162}
163 163
164} 164}
diff --git a/libopie2/opiepim/opiepim.pro b/libopie2/opiepim/opiepim.pro
index 318aecf..af8e63d 100644
--- a/libopie2/opiepim/opiepim.pro
+++ b/libopie2/opiepim/opiepim.pro
@@ -1,27 +1,23 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = opimcontact.h opimcontactfields.h opimrecord.h opimtodo.h opimnotify.h \
5 opimnotifymanager.h opimevent.h
6 4
7SOURCES = opimcontact.cpp opimcontactfields.cpp opimrecord.cpp opimtodo.cpp opimnotify.cpp \
8 opimnotifymanager.cpp opimevent.cpp
9INTERFACES = 5INTERFACES =
10TARGET = opiepim2 6TARGET = opiepim2
11VERSION = 1.8.6 7VERSION = 1.8.6
12INCLUDEPATH += $(OPIEDIR)/include 8INCLUDEPATH += $(OPIEDIR)/include
13DEPENDPATH += $(OPIEDIR)/include 9DEPENDPATH += $(OPIEDIR)/include
14LIBS += -lopiecore2 10LIBS += -lopiecore2
15 11
16include ( $(OPIEDIR)/gen.pro ) 12include ( $(OPIEDIR)/gen.pro )
17include ( core/core.pro ) 13include ( core/core.pro )
18include ( core/backends/backends.pro ) 14include ( backend/backends.pro )
19include ( ui/ui.pro ) 15include ( ui/ui.pro )
20 16
21!contains( platform, x11 ) { 17!contains( platform, x11 ) {
22 include ( $(OPIEDIR)/include.pro ) 18 include ( $(OPIEDIR)/include.pro )
23} 19}
24 20
25contains( platform, x11 ) { 21contains( platform, x11 ) {
26 LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 22 LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
27} 23}
diff --git a/libopie2/opiepim/ui/ui.pro b/libopie2/opiepim/ui/ui.pro
index 530bd9f..6aa01a7 100644
--- a/libopie2/opiepim/ui/ui.pro
+++ b/libopie2/opiepim/ui/ui.pro
@@ -1,7 +1,9 @@
1HEADERS += ui/opimmainwindow.h \ 1HEADERS += ui/opimmainwindow.h \
2 ui/opimrecurrencewidget.h 2 ui/opimrecurrencewidget.h \
3 ui/todayconfigwidget.h \
4 ui/todayplugininterface.h
3 5
4SOURCES += ui/opimmainwindow.cpp \ 6SOURCES += ui/opimmainwindow.cpp \
5 ui/opimrecurrencewidget.cpp 7 ui/opimrecurrencewidget.cpp
6 8
7INTERFACES += ui/opimrecurrencebase.ui \ No newline at end of file 9INTERFACES += ui/opimrecurrencebase.ui \ No newline at end of file