summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile657
-rw-r--r--korganizer/koagenda.cpp2
-rw-r--r--korganizer/koagendaitem.cpp6
-rw-r--r--libkdepim/ksyncmanager.cpp2
4 files changed, 295 insertions, 372 deletions
diff --git a/Makefile b/Makefile
index 467710f..f80c6d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,368 +1,291 @@
1export KDEPIMDIR = $(shell pwd) 1#############################################################################
2 2# Makefile for building: kdepim-desktop
3export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version) 3# Generated by qmake (1.07a) (Qt 3.3.3) on: Sat Jan 8 00:36:06 2005
4 4# Project: kdepim-desktop.pro
5ifeq ($(PLATFORM) , zaurus) 5# Template: subdirs
6 BUILD_NO_LDAP_PLUGIN=1 6# Command: $(QMAKE) -o Makefile kdepim-desktop.pro
7endif 7#############################################################################
8 8
9ifneq ($(PLATFORM) , zaurus) 9 MAKEFILE =Makefile
10 BUILD_NO_SHARP_PLUGIN=1 10 QMAKE =qmake
11endif 11DEL_FILE = rm -f
12 12CHK_DIR_EXISTS= test -d
13#opie plugin is deprecated. The qtopia plugin handles the task from now on. 13MKDIR = mkdir -p
14BUILD_NO_OPIE_PLUGIN=1 14INSTALL_FILE=
15 15INSTALL_DIR =
16SUBDIRS_MICROKDE = \ 16 SUBTARGETS = \
17 libical/src/libical \ 17 sub-libical \
18 libical/src/libicalss \ 18 sub-libkcal \
19 qtcompat \ 19 sub-kabc \
20 microkde \ 20 sub-libkdepim \
21 libkcal \ 21 sub-microkde \
22 libkdepim \ 22 sub-korganizer \
23 kabc \ 23 sub-kaddressbook \
24 kabc/formats/binary \ 24 sub-kabc-plugins-file \
25 kabc/plugins/file \ 25 sub-kabc-plugins-dir \
26 kabc/plugins/dir \ 26 sub-kabc-plugins-file \
27 korganizer \ 27 sub-kabc-plugins-qtopia \
28 kalarmd \ 28 sub-gammu-emb-common \
29 kaddressbook 29 sub-gammu-emb-gammu \
30 30 sub-kmicromail-libetpan \
31SUBDIRS_QTOPIA_PLUGIN = \ 31 sub-kmicromail-libmailwrapper \
32 kabc/plugins/qtopia 32 sub-kmicromail \
33 33 sub-pwmanager-libcrypt-cipher \
34SUBDIRS_OPIE_PLUGIN = \ 34 sub-pwmanager-libcrypt-error \
35 kabc/plugins/opie 35 sub-pwmanager-libcrypt-mpi \
36 36 sub-pwmanager-libcrypt-zlib \
37SUBDIRS_SHARP_PLUGIN = \ 37 sub-pwmanager-pwmanager
38 kabc/plugins/sharpdtm 38
39 39first: all
40SUBDIRS_LDAP_PLUGIN = \ 40
41 kabc/plugins/ldap 41all: Makefile $(SUBTARGETS)
42 42
43SUBDIRS_MICROMAIL = \ 43libical/$(MAKEFILE):
44 kmicromail/libetpan \ 44 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
45 kmicromail/libmailwrapper \ 45 cd libical && $(QMAKE) libical.pro -o $(MAKEFILE)
46 kmicromail 46sub-libical: libical/$(MAKEFILE) FORCE
47 47 cd libical && $(MAKE) -f $(MAKEFILE)
48SUBDIRS_GAMMU = \ 48
49 gammu/emb/common \ 49libkcal/$(MAKEFILE):
50 gammu/emb/gammu 50 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
51 51 cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE)
52SUBDIRS_PWMANAGER = \ 52sub-libkcal: libkcal/$(MAKEFILE) FORCE
53 pwmanager/libcrypt/mpi \ 53 cd libkcal && $(MAKE) -f $(MAKEFILE)
54 pwmanager/libcrypt/error \ 54
55 pwmanager/libcrypt/cipher \ 55kabc/$(MAKEFILE):
56 pwmanager/libcrypt/zlib \ 56 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
57 pwmanager/pwmanager 57 cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE)
58 58sub-kabc: kabc/$(MAKEFILE) FORCE
59SUBDIRS = \ 59 cd kabc && $(MAKE) -f $(MAKEFILE)
60 $(SUBDIRS_MICROKDE) \ 60
61 $(SUBDIRS_QTOPIA_PLUGIN) \ 61libkdepim/$(MAKEFILE):
62 $(SUBDIRS_OPIE_PLUGIN) \ 62 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
63 $(SUBDIRS_SHARP_PLUGIN) \ 63 cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE)
64 $(SUBDIRS_LDAP_PLUGIN) \ 64sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
65 $(SUBDIRS_MICROMAIL) \ 65 cd libkdepim && $(MAKE) -f $(MAKEFILE)
66 $(SUBDIRS_GAMMU) \ 66
67 $(SUBDIRS_PWMANAGER) 67microkde/$(MAKEFILE):
68 68 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
69 69 cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE)
70all: build_microkde \ 70sub-microkde: microkde/$(MAKEFILE) FORCE
71 build_qtopia_plugin \ 71 cd microkde && $(MAKE) -f $(MAKEFILE)
72 build_opie_plugin \ 72
73 build_sharp_plugin \ 73korganizer/$(MAKEFILE):
74 build_ldap_plugin \ 74 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
75 build_micromail \ 75 cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE)
76 build_gammu \ 76sub-korganizer: korganizer/$(MAKEFILE) FORCE
77 build_pwmanager 77 cd korganizer && $(MAKE) -f $(MAKEFILE)
78 78
79 79kaddressbook/$(MAKEFILE):
80build_microkde: variable_test tmake 80 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
81 for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ 81 cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE)
82 make -f Makefile$(PLATFORM) || exit 1; popd; \ 82sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
83 done 83 cd kaddressbook && $(MAKE) -f $(MAKEFILE)
84 84
85build_qtopia_plugin: build_microkde 85kabc/plugins/file/$(MAKEFILE):
86 ifdef BUILD_NO_QTOPIA_PLUGIN 86 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
87 @echo == qtopia plugin not build. 87 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE)
88 else 88sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
89 for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ 89 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
90 make -f Makefile$(PLATFORM) || exit 1; popd; \ 90
91 done 91kabc/plugins/dir/$(MAKEFILE):
92 endif 92 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
93 93 cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE)
94build_opie_plugin: build_microkde 94sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
95 ifdef BUILD_NO_OPIE_PLUGIN 95 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
96 @echo == opie plugin not build. 96
97 else 97kabc/plugins/file/$(MAKEFILE):
98 for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ 98 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
99 make -f Makefile$(PLATFORM) || exit 1; popd; \ 99 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE)
100 done 100sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
101 endif 101 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
102 102
103build_sharp_plugin: build_microkde 103kabc/plugins/qtopia/$(MAKEFILE):
104 ifdef BUILD_NO_SHARP_PLUGIN 104 @$(CHK_DIR_EXISTS) "kabc/plugins/qtopia" || $(MKDIR) "kabc/plugins/qtopia"
105 @echo == ldap plugin not build. 105 cd kabc/plugins/qtopia && $(QMAKE) qtopia.pro -o $(MAKEFILE)
106 else 106sub-kabc-plugins-qtopia: kabc/plugins/qtopia/$(MAKEFILE) FORCE
107 for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \ 107 cd kabc/plugins/qtopia && $(MAKE) -f $(MAKEFILE)
108 make -f Makefile$(PLATFORM) || exit 1; popd; \ 108
109 done 109gammu/emb/common/$(MAKEFILE):
110 endif 110 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common"
111 111 cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE)
112build_ldap_plugin: build_microkde 112sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE
113 ifdef BUILD_NO_LDAP_PLUGIN 113 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE)
114 @echo == ldap plugin not build. 114
115 else 115gammu/emb/gammu/$(MAKEFILE):
116 for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \ 116 @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu"
117 make -f Makefile$(PLATFORM) || exit 1; popd; \ 117 cd gammu/emb/gammu && $(QMAKE) gammu.pro -o $(MAKEFILE)
118 done 118sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE
119 endif 119 cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE)
120 120
121 121kmicromail/libetpan/$(MAKEFILE):
122build_micromail: build_microkde 122 @$(CHK_DIR_EXISTS) "kmicromail/libetpan" || $(MKDIR) "kmicromail/libetpan"
123 ifdef BUILD_NO_MICROMAIL 123 cd kmicromail/libetpan && $(QMAKE) libetpan.pro -o $(MAKEFILE)
124 @echo == kmicromail not build. 124sub-kmicromail-libetpan: kmicromail/libetpan/$(MAKEFILE) FORCE
125 else 125 cd kmicromail/libetpan && $(MAKE) -f $(MAKEFILE)
126 for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ 126
127 make -f Makefile$(PLATFORM) || exit 1; popd; \ 127kmicromail/libmailwrapper/$(MAKEFILE):
128 done 128 @$(CHK_DIR_EXISTS) "kmicromail/libmailwrapper" || $(MKDIR) "kmicromail/libmailwrapper"
129 endif 129 cd kmicromail/libmailwrapper && $(QMAKE) libmailwrapper.pro -o $(MAKEFILE)
130 130sub-kmicromail-libmailwrapper: kmicromail/libmailwrapper/$(MAKEFILE) FORCE
131build_gammu: variable_test tmake 131 cd kmicromail/libmailwrapper && $(MAKE) -f $(MAKEFILE)
132 ifdef BUILD_NO_GAMMU 132
133 @echo == gammu not build. 133kmicromail/$(MAKEFILE):
134 else 134 @$(CHK_DIR_EXISTS) "kmicromail" || $(MKDIR) "kmicromail"
135 for i in $(SUBDIRS_GAMMU); do pushd $$i; \ 135 cd kmicromail && $(QMAKE) kmicromail.pro -o $(MAKEFILE)
136 make -f Makefile$(PLATFORM) || exit 1; popd; \ 136sub-kmicromail: kmicromail/$(MAKEFILE) FORCE
137 done 137 cd kmicromail && $(MAKE) -f $(MAKEFILE)
138 endif 138
139 139pwmanager/libcrypt/cipher/$(MAKEFILE):
140build_pwmanager: build_microkde 140 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/cipher" || $(MKDIR) "pwmanager/libcrypt/cipher"
141 ifdef BUILD_NO_PWMANAGER 141 cd pwmanager/libcrypt/cipher && $(QMAKE) cipher.pro -o $(MAKEFILE)
142 @echo == pwmanager not build. 142sub-pwmanager-libcrypt-cipher: pwmanager/libcrypt/cipher/$(MAKEFILE) FORCE
143 else 143 cd pwmanager/libcrypt/cipher && $(MAKE) -f $(MAKEFILE)
144 for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \ 144
145 make -f Makefile$(PLATFORM) || exit 1; popd; \ 145pwmanager/libcrypt/error/$(MAKEFILE):
146 done 146 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/error" || $(MKDIR) "pwmanager/libcrypt/error"
147 endif 147 cd pwmanager/libcrypt/error && $(QMAKE) error.pro -o $(MAKEFILE)
148 148sub-pwmanager-libcrypt-error: pwmanager/libcrypt/error/$(MAKEFILE) FORCE
149 149 cd pwmanager/libcrypt/error && $(MAKE) -f $(MAKEFILE)
150variable_info: 150
151 @echo -------------------------------------- 151pwmanager/libcrypt/mpi/$(MAKEFILE):
152 @echo KDEPIM buildsystem, variableinfo... 152 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/mpi" || $(MKDIR) "pwmanager/libcrypt/mpi"
153 @echo KDEPIMDIR=$(KDEPIMDIR) 153 cd pwmanager/libcrypt/mpi && $(QMAKE) mpi.pro -o $(MAKEFILE)
154 @echo QTDIR=$(QTDIR) 154sub-pwmanager-libcrypt-mpi: pwmanager/libcrypt/mpi/$(MAKEFILE) FORCE
155 @echo QPEDIR=$(QPEDIR) 155 cd pwmanager/libcrypt/mpi && $(MAKE) -f $(MAKEFILE)
156 @echo OPIEDIR=$(OPIEDIR) 156
157 @echo PLATFORM=$(PLATFORM) 157pwmanager/libcrypt/zlib/$(MAKEFILE):
158 @echo RELEASE_DEBUG=$(RELEASE_DEBUG) 158 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/zlib" || $(MKDIR) "pwmanager/libcrypt/zlib"
159 @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) 159 cd pwmanager/libcrypt/zlib && $(QMAKE) zlib.pro -o $(MAKEFILE)
160 @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) 160sub-pwmanager-libcrypt-zlib: pwmanager/libcrypt/zlib/$(MAKEFILE) FORCE
161 @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) 161 cd pwmanager/libcrypt/zlib && $(MAKE) -f $(MAKEFILE)
162 @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN) 162
163 @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) 163pwmanager/pwmanager/$(MAKEFILE):
164 ifndef BUILD_NO_SHARP_PLUGIN 164 @$(CHK_DIR_EXISTS) "pwmanager/pwmanager" || $(MKDIR) "pwmanager/pwmanager"
165 @echo SHARPDTMSDK=$(SHARPDTMSDK) 165 cd pwmanager/pwmanager && $(QMAKE) pwmanager.pro -o $(MAKEFILE)
166 endif 166sub-pwmanager-pwmanager: pwmanager/pwmanager/$(MAKEFILE) FORCE
167 @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU) 167 cd pwmanager/pwmanager && $(MAKE) -f $(MAKEFILE)
168 @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER) 168
169 @echo -------------------------------------- 169Makefile: kdepim-desktop.pro /usr/lib/qt3/mkspecs/default/qmake.conf
170 170 $(QMAKE) -o Makefile kdepim-desktop.pro
171variable_test: variable_info 171qmake: qmake_all
172 @echo KDEPIM buildsystem, variablecheck... 172 @$(QMAKE) -o Makefile kdepim-desktop.pro
173 ifndef KDEPIMDIR 173
174 @echo KDEPIMDIR is not defined. 174all: $(SUBTARGETS)
175 $(error KDEPIMDIR is not defined) 175qmake_all: libical/$(MAKEFILE) libkcal/$(MAKEFILE) kabc/$(MAKEFILE) libkdepim/$(MAKEFILE) microkde/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/qtopia/$(MAKEFILE) gammu/emb/common/$(MAKEFILE) gammu/emb/gammu/$(MAKEFILE) kmicromail/libetpan/$(MAKEFILE) kmicromail/libmailwrapper/$(MAKEFILE) kmicromail/$(MAKEFILE) pwmanager/libcrypt/cipher/$(MAKEFILE) pwmanager/libcrypt/error/$(MAKEFILE) pwmanager/libcrypt/mpi/$(MAKEFILE) pwmanager/libcrypt/zlib/$(MAKEFILE) pwmanager/pwmanager/$(MAKEFILE)
176 endif 176 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
177 ifndef PLATFORM 177 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
178 @echo PLATFORM is not defined. 178 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
179 $(error PLATFORM is not defined) 179 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
180 endif 180 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
181 ifdef BUILD_NO_LDAP_PLUGIN 181 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
182 @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) 182 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
183 endif 183 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
184 ifdef BUILD_NO_OPIE_PLUGIN 184 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
185 @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) 185 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
186 endif 186 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
187 ifdef BUILD_NO_QTOPIA_PLUGIN 187 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
188 @echo QTOPIA PLUGIN will not be build, because BUILD_NO__QTOPIA_PLUGIN is set to $(BUILD_NO__QTOPIA_PLUGIN) 188 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
189 endif 189 ( [ -d kmicromail/libetpan ] && cd kmicromail/libetpan ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
190 ifdef BUILD_NO_MICROMAIL 190 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
191 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) 191 ( [ -d kmicromail ] && cd kmicromail ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
192 endif 192 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
193 ifdef BUILD_NO_SHARP_PLUGIN 193 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
194 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) 194 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
195 else 195 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
196 ifndef SHARPDTMSDK 196 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
197 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) 197clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
198 $(error SHARPDTMSDK is not defined) 198 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
199 endif 199 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
200 endif 200 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
201 ifdef BUILD_NO_GAMMU 201 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
202 @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU) 202 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
203 endif 203 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
204 ifdef BUILD_NO_PWMANAGER 204 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
205 @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER) 205 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
206 endif 206 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
207 @echo -------------------------------------- 207 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
208 208 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; ) || true
209 209 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true
210objects: 210 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true
211 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done 211 ( [ -d kmicromail/libetpan ] && cd kmicromail/libetpan ; $(MAKE) -f $(MAKEFILE) $@; ) || true
212 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done 212 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) $@; ) || true
213 mkdir -p libical/lib/$(PLATFORM) 213 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) $@; ) || true
214 mkdir -p pwmanager/libcrypt/$(PLATFORM) 214 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; ) || true
215 215 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; ) || true
216clean: 216 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; ) || true
217 rm -rf libical/lib/$(PLATFORM)/*; 217 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; ) || true
218 rm -rf pwmanager/libcrypt/$(PLATFORM)/*; 218 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; ) || true
219 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ 219uninstall_subdirs: qmake_all FORCE
220 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ 220 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
221 done 221 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
222 222 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
223install: 223 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
224 224 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
225 cd bin/kdepim; make install 225 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
226 cp -r Pim $(QPEDIR)/apps 226 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
227 cp db2file/db2file $(QPEDIR)/bin/db2file 227 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
228 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop 228 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
229 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop 229 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
230 cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop 230 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
231 cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop 231 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
232 232 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
233dist: 233 ( [ -d kmicromail/libetpan ] && cd kmicromail/libetpan ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
234 @echo Dont forget to do "make install" before "make dist" 234 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
235 rm -f *arm.ipk 235 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
236 rm -f *~ 236 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
237 cd ..; tar czf kdepimpi-$(KDEPIM_VERSION).tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim 237 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
238 mkipks kmicrokdelibs.control 238 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
239 mkipks korganizer.control 239 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
240 mkipks kaddressbook.control 240 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
241 ifndef BUILD_NO_MICROMAIL 241install_subdirs: qmake_all FORCE
242 mkipks kopiemail.control 242 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
243 endif 243 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
244 ifndef BUILD_NO_SHARP_PLUGIN 244 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
245 mkipks ksharpPIM-DTMaccess.control 245 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
246 endif 246 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
247 mkipks korganizer-alarm.control 247 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
248 ifndef BUILD_NO_GAMMU 248 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
249 mkipks kmobilephoneaccess.control 249 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
250 endif 250 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
251 ifndef BUILD_NO_PWMANAGER 251 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
252 mkipks pwmanager.control 252 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) install; ) || true
253 endif 253 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true
254 mkipks pimTABicon.control 254 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true
255 255 ( [ -d kmicromail/libetpan ] && cd kmicromail/libetpan ; $(MAKE) -f $(MAKEFILE) install; ) || true
256tmake: objects \ 256 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) install; ) || true
257 qtcompat/Makefile$(PLATFORM) \ 257 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) install; ) || true
258 microkde/Makefile$(PLATFORM) \ 258 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) install; ) || true
259 libkcal/Makefile$(PLATFORM) \ 259 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) install; ) || true
260 libkdepim/Makefile$(PLATFORM) \ 260 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) install; ) || true
261 korganizer/Makefile$(PLATFORM) \ 261 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) install; ) || true
262 kalarmd/Makefile$(PLATFORM) \ 262 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) install; ) || true
263 libical/src/libical/Makefile$(PLATFORM) \ 263distclean: qmake_all FORCE
264 libical/src/libicalss/Makefile$(PLATFORM) \ 264 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
265 kabc/Makefile$(PLATFORM) \ 265 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
266 kabc/formats/binary/Makefile$(PLATFORM) \ 266 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
267 kabc/plugins/file/Makefile$(PLATFORM) \ 267 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
268 kabc/plugins/dir/Makefile$(PLATFORM) \ 268 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
269 kabc/plugins/ldap/Makefile$(PLATFORM) \ 269 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
270 kabc/plugins/opie/Makefile$(PLATFORM) \ 270 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
271 kabc/plugins/qtopia/Makefile$(PLATFORM) \ 271 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
272 kabc/plugins/sharpdtm/Makefile$(PLATFORM) \ 272 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
273 kaddressbook/Makefile$(PLATFORM) \ 273 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
274 kmicromail/Makefile$(PLATFORM) \ 274 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
275 kmicromail/libetpan/Makefile$(PLATFORM) \ 275 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
276 kmicromail/libmailwrapper/Makefile$(PLATFORM) \ 276 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
277 gammu/emb/common/Makefile$(PLATFORM) \ 277 ( [ -d kmicromail/libetpan ] && cd kmicromail/libetpan ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
278 gammu/emb/gammu/Makefile$(PLATFORM) \ 278 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
279 pwmanager/pwmanager/Makefile$(PLATFORM) \ 279 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
280 pwmanager/libcrypt/mpi/Makefile$(PLATFORM) \ 280 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
281 pwmanager/libcrypt/error/Makefile$(PLATFORM) \ 281 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
282 pwmanager/libcrypt/cipher/Makefile$(PLATFORM) \ 282 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
283 pwmanager/libcrypt/zlib/Makefile$(PLATFORM) 283 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
284 284 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
285qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro 285
286 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtcompat.pro -o Makefile$(PLATFORM) 286install: install_subdirs
287 287
288microkde/Makefile$(PLATFORM): microkde/microkdeE.pro 288uninstall: uninstall_subdirs
289 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" microkdeE.pro -o Makefile$(PLATFORM) 289
290 290FORCE:
291libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
292 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkcalE.pro -o Makefile$(PLATFORM)
293
294
295libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
296 cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkdepimE.pro -o Makefile$(PLATFORM)
297
298kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
299 cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kalarmdE.pro -o Makefile$(PLATFORM)
300
301korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
302 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" korganizerE.pro -o Makefile$(PLATFORM)
303
304libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
305 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalE.pro -o Makefile$(PLATFORM)
306
307libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
308 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalssE.pro -o Makefile$(PLATFORM)
309
310kabc/Makefile$(PLATFORM): kabc/kabcE.pro
311 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcE.pro -o Makefile$(PLATFORM)
312
313kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
314 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
315
316kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
317 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" fileE.pro -o Makefile$(PLATFORM)
318
319kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
320 cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" dirE.pro -o Makefile$(PLATFORM)
321
322kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
323 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" ldapE.pro -o Makefile$(PLATFORM)
324
325kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
326 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" opieE.pro -o Makefile$(PLATFORM)
327
328kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
329 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtopiaE.pro -o Makefile$(PLATFORM)
330
331kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro
332 cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" sharpdtmE.pro -o Makefile$(PLATFORM)
333
334kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
335 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kaddressbookE.pro -o Makefile$(PLATFORM)
336
337kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
338 cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kmicromailE.pro -o Makefile$(PLATFORM)
339
340kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro
341 cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libetpanE.pro -o Makefile$(PLATFORM)
342
343kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
344 cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libmailwrapperE.pro -o Makefile$(PLATFORM)
345
346gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro
347 cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" commonE.pro -o Makefile$(PLATFORM)
348
349gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro
350 cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" gammuE.pro -o Makefile$(PLATFORM)
351
352pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro
353 cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" pwmanagerE.pro -o Makefile$(PLATFORM)
354
355
356pwmanager/libcrypt/mpi/Makefile$(PLATFORM): pwmanager/libcrypt/mpi/mpi.pro
357 cd pwmanager/libcrypt/mpi;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" mpi.pro -o Makefile$(PLATFORM)
358
359pwmanager/libcrypt/error/Makefile$(PLATFORM): pwmanager/libcrypt/error/error.pro
360 cd pwmanager/libcrypt/error;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" error.pro -o Makefile$(PLATFORM)
361
362pwmanager/libcrypt/cipher/Makefile$(PLATFORM): pwmanager/libcrypt/cipher/cipher.pro
363 cd pwmanager/libcrypt/cipher;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" cipher.pro -o Makefile$(PLATFORM)
364
365pwmanager/libcrypt/zlib/Makefile$(PLATFORM): pwmanager/libcrypt/zlib/zlib.pro
366 cd pwmanager/libcrypt/zlib;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" zlib.pro -o Makefile$(PLATFORM)
367
368 291
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index eb3791e..7e0b216 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1251,686 +1251,686 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
1251 mPixPainter.end() ; 1251 mPixPainter.end() ;
1252} 1252}
1253 1253
1254/* 1254/*
1255 Convert srcollview contents coordinates to agenda grid coordinates. 1255 Convert srcollview contents coordinates to agenda grid coordinates.
1256*/ 1256*/
1257void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1257void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1258{ 1258{
1259 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1259 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1260 x/mGridSpacingX; 1260 x/mGridSpacingX;
1261 gy = y/mGridSpacingY; 1261 gy = y/mGridSpacingY;
1262} 1262}
1263 1263
1264/* 1264/*
1265 Convert agenda grid coordinates to scrollview contents coordinates. 1265 Convert agenda grid coordinates to scrollview contents coordinates.
1266*/ 1266*/
1267void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) 1267void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
1268{ 1268{
1269 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: 1269 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
1270 gx*mGridSpacingX; 1270 gx*mGridSpacingX;
1271 y = gy*mGridSpacingY; 1271 y = gy*mGridSpacingY;
1272} 1272}
1273 1273
1274 1274
1275/* 1275/*
1276 Return Y coordinate corresponding to time. Coordinates are rounded to fit into 1276 Return Y coordinate corresponding to time. Coordinates are rounded to fit into
1277 the grid. 1277 the grid.
1278*/ 1278*/
1279int KOAgenda::timeToY(const QTime &time) 1279int KOAgenda::timeToY(const QTime &time)
1280{ 1280{
1281 int minutesPerCell = 24 * 60 / mRows; 1281 int minutesPerCell = 24 * 60 / mRows;
1282 int timeMinutes = time.hour() * 60 + time.minute(); 1282 int timeMinutes = time.hour() * 60 + time.minute();
1283 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; 1283 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell;
1284 return Y; 1284 return Y;
1285} 1285}
1286 1286
1287 1287
1288/* 1288/*
1289 Return time corresponding to cell y coordinate. Coordinates are rounded to 1289 Return time corresponding to cell y coordinate. Coordinates are rounded to
1290 fit into the grid. 1290 fit into the grid.
1291*/ 1291*/
1292QTime KOAgenda::gyToTime(int gy) 1292QTime KOAgenda::gyToTime(int gy)
1293{ 1293{
1294 1294
1295 int secondsPerCell = 24 * 60 * 60/ mRows; 1295 int secondsPerCell = 24 * 60 * 60/ mRows;
1296 1296
1297 int timeSeconds = secondsPerCell * gy; 1297 int timeSeconds = secondsPerCell * gy;
1298 1298
1299 QTime time( 0, 0, 0 ); 1299 QTime time( 0, 0, 0 );
1300 if ( timeSeconds < 24 * 60 * 60 ) { 1300 if ( timeSeconds < 24 * 60 * 60 ) {
1301 time = time.addSecs(timeSeconds); 1301 time = time.addSecs(timeSeconds);
1302 } else { 1302 } else {
1303 time.setHMS( 23, 59, 59 ); 1303 time.setHMS( 23, 59, 59 );
1304 } 1304 }
1305 1305
1306 return time; 1306 return time;
1307} 1307}
1308 1308
1309void KOAgenda::setStartHour(int startHour) 1309void KOAgenda::setStartHour(int startHour)
1310{ 1310{
1311 int startCell = startHour * mRows / 24; 1311 int startCell = startHour * mRows / 24;
1312 setContentsPos(0,startCell * gridSpacingY()); 1312 setContentsPos(0,startCell * gridSpacingY());
1313} 1313}
1314void KOAgenda::hideUnused() 1314void KOAgenda::hideUnused()
1315{ 1315{
1316 // experimental only 1316 // experimental only
1317 // return; 1317 // return;
1318 KOAgendaItem *item; 1318 KOAgendaItem *item;
1319 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { 1319 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) {
1320 item->hide(); 1320 item->hide();
1321 } 1321 }
1322} 1322}
1323 1323
1324 1324
1325KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) 1325KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
1326{ 1326{
1327 1327
1328 KOAgendaItem *fi; 1328 KOAgendaItem *fi;
1329 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { 1329 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) {
1330 if ( fi->incidence() == event ) { 1330 if ( fi->incidence() == event ) {
1331 mUnusedItems.remove(); 1331 mUnusedItems.remove();
1332 fi->init( event, qd ); 1332 fi->init( event, qd );
1333 return fi; 1333 return fi;
1334 } 1334 }
1335 } 1335 }
1336 fi=mUnusedItems.first(); 1336 fi=mUnusedItems.first();
1337 if ( fi ) { 1337 if ( fi ) {
1338 mUnusedItems.remove(); 1338 mUnusedItems.remove();
1339 fi->init( event, qd ); 1339 fi->init( event, qd );
1340 return fi; 1340 return fi;
1341 } 1341 }
1342 // qDebug("new KOAgendaItem "); 1342 // qDebug("new KOAgendaItem ");
1343 1343
1344 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); 1344 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode );
1345 agendaItem->installEventFilter(this); 1345 agendaItem->installEventFilter(this);
1346 addChild(agendaItem,0,0); 1346 addChild(agendaItem,0,0);
1347 return agendaItem; 1347 return agendaItem;
1348} 1348}
1349KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) 1349KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1350{ 1350{
1351 KOAgendaItem *item; 1351 KOAgendaItem *item;
1352 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1352 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1353 if ( item->incidence() == todo ) { 1353 if ( item->incidence() == todo ) {
1354 mItems.remove(); 1354 mItems.remove();
1355 return item; 1355 return item;
1356 } 1356 }
1357 } 1357 }
1358 return 0; 1358 return 0;
1359} 1359}
1360 1360
1361 1361
1362void KOAgenda::updateTodo( Todo * todo, int days, bool remove) 1362void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1363{ 1363{
1364 1364
1365 KOAgendaItem *item; 1365 KOAgendaItem *item;
1366 item = getItemForTodo ( todo ); 1366 item = getItemForTodo ( todo );
1367 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); 1367 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
1368 if ( item ) { 1368 if ( item ) {
1369 blockSignals( true ); 1369 blockSignals( true );
1370 //qDebug("item found "); 1370 //qDebug("item found ");
1371 item->hide(); 1371 item->hide();
1372 item->setCellX(-2, -1 ); 1372 item->setCellX(-2, -1 );
1373 item->select(false); 1373 item->select(false);
1374 mUnusedItems.append( item ); 1374 mUnusedItems.append( item );
1375 mItems.remove( item ); 1375 mItems.remove( item );
1376 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1376 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1377 KOAgendaItem *itemit; 1377 KOAgendaItem *itemit;
1378 //globalFlagBlockAgendaItemPaint = 1; 1378 //globalFlagBlockAgendaItemPaint = 1;
1379 for ( itemit=oldconflictItems.first(); itemit != 0; 1379 for ( itemit=oldconflictItems.first(); itemit != 0;
1380 itemit=oldconflictItems.next() ) { 1380 itemit=oldconflictItems.next() ) {
1381 if ( itemit != item ) 1381 if ( itemit != item )
1382 placeSubCells(itemit); 1382 placeSubCells(itemit);
1383 } 1383 }
1384 qApp->processEvents(); 1384 qApp->processEvents();
1385 //globalFlagBlockAgendaItemPaint = 0; 1385 //globalFlagBlockAgendaItemPaint = 0;
1386 for ( itemit=oldconflictItems.first(); itemit != 0; 1386 for ( itemit=oldconflictItems.first(); itemit != 0;
1387 itemit=oldconflictItems.next() ) { 1387 itemit=oldconflictItems.next() ) {
1388 globalFlagBlockAgendaItemUpdate = 0; 1388 globalFlagBlockAgendaItemUpdate = 0;
1389 if ( itemit != item ) 1389 if ( itemit != item )
1390 itemit->repaintMe(); 1390 itemit->repaintMe();
1391 globalFlagBlockAgendaItemUpdate = 1; 1391 globalFlagBlockAgendaItemUpdate = 1;
1392 itemit->repaint(); 1392 itemit->repaint();
1393 } 1393 }
1394 blockSignals( false ); 1394 blockSignals( false );
1395 } 1395 }
1396 if ( remove ) { 1396 if ( remove ) {
1397 //qDebug("remove****************************************** "); 1397 //qDebug("remove****************************************** ");
1398 return; 1398 return;
1399 } 1399 }
1400 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1400 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1401 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1401 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda );
1402 QDate currentDate; 1402 QDate currentDate;
1403 if ( overdue ) { 1403 if ( overdue ) {
1404 currentDate = QDate::currentDate(); 1404 currentDate = QDate::currentDate();
1405 days += todo->dtDue().date().daysTo( currentDate ); 1405 days += todo->dtDue().date().daysTo( currentDate );
1406 } 1406 }
1407 else 1407 else
1408 currentDate = todo->dtDue().date(); 1408 currentDate = todo->dtDue().date();
1409 1409
1410 if ( todo->doesFloat() || overdue ) { 1410 if ( todo->doesFloat() || overdue ) {
1411 if ( ! mAllDayMode ) return; 1411 if ( ! mAllDayMode ) return;
1412 // aldayagenda 1412 // aldayagenda
1413 globalFlagBlockAgendaItemPaint = 1; 1413 globalFlagBlockAgendaItemPaint = 1;
1414 item = insertAllDayItem(todo, currentDate,days, days); 1414 item = insertAllDayItem(todo, currentDate,days, days);
1415 item->show(); 1415 item->show();
1416 1416
1417 } 1417 }
1418 else { 1418 else {
1419 if ( mAllDayMode ) return; 1419 if ( mAllDayMode ) return;
1420 // mAgenda 1420 // mAgenda
1421 globalFlagBlockAgendaItemPaint = 1; 1421 globalFlagBlockAgendaItemPaint = 1;
1422 int endY = timeToY(todo->dtDue().time()) - 1; 1422 int endY = timeToY(todo->dtDue().time()) - 1;
1423 int hi = 12/KOPrefs::instance()->mHourSize; 1423 int hi = 12/KOPrefs::instance()->mHourSize;
1424 int startY = endY - 1-hi; 1424 int startY = endY - 1-hi;
1425 item = insertItem(todo,currentDate,days,startY,endY); 1425 item = insertItem(todo,currentDate,days,startY,endY);
1426 item->show(); 1426 item->show();
1427 } 1427 }
1428 qApp->processEvents(); 1428 qApp->processEvents();
1429 globalFlagBlockAgendaItemPaint = 0; 1429 globalFlagBlockAgendaItemPaint = 0;
1430 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1430 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1431 KOAgendaItem *itemit; 1431 KOAgendaItem *itemit;
1432 for ( itemit=oldconflictItems.first(); itemit != 0; 1432 for ( itemit=oldconflictItems.first(); itemit != 0;
1433 itemit=oldconflictItems.next() ) { 1433 itemit=oldconflictItems.next() ) {
1434 globalFlagBlockAgendaItemUpdate = 0; 1434 globalFlagBlockAgendaItemUpdate = 0;
1435 itemit->repaintMe(); 1435 itemit->repaintMe();
1436 globalFlagBlockAgendaItemUpdate = 1; 1436 globalFlagBlockAgendaItemUpdate = 1;
1437 itemit->repaint(); 1437 itemit->repaint();
1438 } 1438 }
1439 globalFlagBlockAgendaItemUpdate = 0; 1439 globalFlagBlockAgendaItemUpdate = 0;
1440 item->repaintMe(); 1440 item->repaintMe();
1441 globalFlagBlockAgendaItemUpdate = 1; 1441 globalFlagBlockAgendaItemUpdate = 1;
1442 item->repaint(); 1442 item->repaint();
1443} 1443}
1444/* 1444/*
1445 Insert KOAgendaItem into agenda. 1445 Insert KOAgendaItem into agenda.
1446*/ 1446*/
1447KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) 1447KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom)
1448{ 1448{
1449 //kdDebug() << "KOAgenda::insertItem:" << event->summary() << "-" << qd.toString() << " ;top, bottom:" << YTop << "," << YBottom << endl; 1449 //kdDebug() << "KOAgenda::insertItem:" << event->summary() << "-" << qd.toString() << " ;top, bottom:" << YTop << "," << YBottom << endl;
1450 1450
1451 if (mAllDayMode) { 1451 if (mAllDayMode) {
1452 kdDebug() << "KOAgenda: calling insertItem in all-day mode is illegal." << endl; 1452 kdDebug() << "KOAgenda: calling insertItem in all-day mode is illegal." << endl;
1453 return 0; 1453 return 0;
1454 } 1454 }
1455 1455
1456 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1456 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1457 //agendaItem->setFrameStyle(WinPanel|Raised); 1457 //agendaItem->setFrameStyle(WinPanel|Raised);
1458 1458
1459 int YSize = YBottom - YTop + 1; 1459 int YSize = YBottom - YTop + 1;
1460 if (YSize < 0) { 1460 if (YSize < 0) {
1461 kdDebug() << "KOAgenda::insertItem(): Text: " << agendaItem->text() << " YSize<0" << endl; 1461 kdDebug() << "KOAgenda::insertItem(): Text: " << agendaItem->text() << " YSize<0" << endl;
1462 YSize = 1; 1462 YSize = 1;
1463 } 1463 }
1464 int iheight = mGridSpacingY * YSize; 1464 int iheight = mGridSpacingY * YSize;
1465 1465
1466 agendaItem->resize(mGridSpacingX,iheight ); 1466 agendaItem->resize(mGridSpacingX,iheight );
1467 agendaItem->setCellXY(X,YTop,YBottom); 1467 agendaItem->setCellXY(X,YTop,YBottom);
1468 agendaItem->setCellXWidth(X); 1468 agendaItem->setCellXWidth(X);
1469 1469
1470 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); 1470 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY);
1471 mItems.append(agendaItem); 1471 mItems.append(agendaItem);
1472 1472
1473 placeSubCells(agendaItem); 1473 placeSubCells(agendaItem);
1474 1474
1475 //agendaItem->show(); 1475 //agendaItem->show();
1476 1476
1477 marcus_bains(); 1477 marcus_bains();
1478 1478
1479 return agendaItem; 1479 return agendaItem;
1480} 1480}
1481 1481
1482 1482
1483/* 1483/*
1484 Insert all-day KOAgendaItem into agenda. 1484 Insert all-day KOAgendaItem into agenda.
1485*/ 1485*/
1486KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) 1486KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd)
1487{ 1487{
1488 if (!mAllDayMode) { 1488 if (!mAllDayMode) {
1489 return 0; 1489 return 0;
1490 } 1490 }
1491 1491
1492 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1492 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1493 1493
1494 agendaItem->setCellXY(XBegin,0,0); 1494 agendaItem->setCellXY(XBegin,0,0);
1495 agendaItem->setCellXWidth(XEnd); 1495 agendaItem->setCellXWidth(XEnd);
1496 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); 1496 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY);
1497 1497
1498 //addChild(agendaItem,XBegin*mGridSpacingX,0); 1498 //addChild(agendaItem,XBegin*mGridSpacingX,0);
1499 mItems.append(agendaItem); 1499 mItems.append(agendaItem);
1500 1500
1501 placeSubCells(agendaItem); 1501 placeSubCells(agendaItem);
1502 1502
1503 //agendaItem->show(); 1503 //agendaItem->show();
1504 1504
1505 return agendaItem; 1505 return agendaItem;
1506} 1506}
1507 1507
1508 1508
1509void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 1509void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1510 int YTop,int YBottom) 1510 int YTop,int YBottom)
1511{ 1511{
1512 if (mAllDayMode) { 1512 if (mAllDayMode) {
1513 ; 1513 ;
1514 return; 1514 return;
1515 } 1515 }
1516 1516
1517 int cellX,cellYTop,cellYBottom; 1517 int cellX,cellYTop,cellYBottom;
1518 QString newtext; 1518 QString newtext;
1519 int width = XEnd - XBegin + 1; 1519 int width = XEnd - XBegin + 1;
1520 int count = 0; 1520 int count = 0;
1521 KOAgendaItem *current = 0; 1521 KOAgendaItem *current = 0;
1522 QPtrList<KOAgendaItem> multiItems; 1522 QPtrList<KOAgendaItem> multiItems;
1523 for (cellX = XBegin;cellX <= XEnd;++cellX) { 1523 for (cellX = XBegin;cellX <= XEnd;++cellX) {
1524 if (cellX == XBegin) cellYTop = YTop; 1524 if (cellX == XBegin) cellYTop = YTop;
1525 else cellYTop = 0; 1525 else cellYTop = 0;
1526 if (cellX == XEnd) cellYBottom = YBottom; 1526 if (cellX == XEnd) cellYBottom = YBottom;
1527 else cellYBottom = rows() - 1; 1527 else cellYBottom = rows() - 1;
1528 newtext = QString("(%1/%2): ").arg(++count).arg(width); 1528 newtext = QString("(%1/%2): ").arg(++count).arg(width);
1529 newtext.append(event->summary()); 1529 newtext.append(event->summary());
1530 current = insertItem(event,qd,cellX,cellYTop,cellYBottom); 1530 current = insertItem(event,qd,cellX,cellYTop,cellYBottom);
1531 current->setText(newtext); 1531 current->setText(newtext);
1532 multiItems.append(current); 1532 multiItems.append(current);
1533 } 1533 }
1534 1534
1535 KOAgendaItem *next = 0; 1535 KOAgendaItem *next = 0;
1536 KOAgendaItem *last = multiItems.last(); 1536 KOAgendaItem *last = multiItems.last();
1537 KOAgendaItem *first = multiItems.first(); 1537 KOAgendaItem *first = multiItems.first();
1538 KOAgendaItem *setFirst,*setLast; 1538 KOAgendaItem *setFirst,*setLast;
1539 current = first; 1539 current = first;
1540 while (current) { 1540 while (current) {
1541 next = multiItems.next(); 1541 next = multiItems.next();
1542 if (current == first) setFirst = 0; 1542 if (current == first) setFirst = 0;
1543 else setFirst = first; 1543 else setFirst = first;
1544 if (current == last) setLast = 0; 1544 if (current == last) setLast = 0;
1545 else setLast = last; 1545 else setLast = last;
1546 1546
1547 current->setMultiItem(setFirst,next,setLast); 1547 current->setMultiItem(setFirst,next,setLast);
1548 current = next; 1548 current = next;
1549 } 1549 }
1550 1550
1551 marcus_bains(); 1551 marcus_bains();
1552} 1552}
1553 1553
1554 1554
1555//QSizePolicy KOAgenda::sizePolicy() const 1555//QSizePolicy KOAgenda::sizePolicy() const
1556//{ 1556//{
1557 // Thought this would make the all-day event agenda minimum size and the 1557 // Thought this would make the all-day event agenda minimum size and the
1558 // normal agenda take the remaining space. But it doesn´t work. The QSplitter 1558 // normal agenda take the remaining space. But it doesn´t work. The QSplitter
1559 // don´t seem to think that an Expanding widget needs more space than a 1559 // don´t seem to think that an Expanding widget needs more space than a
1560 // Preferred one. 1560 // Preferred one.
1561 // But it doesn´t hurt, so it stays. 1561 // But it doesn´t hurt, so it stays.
1562// if (mAllDayMode) { 1562// if (mAllDayMode) {
1563// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); 1563// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
1564// } else { 1564// } else {
1565// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); 1565// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
1566// } 1566// }
1567//} 1567//}
1568void KOAgenda::finishResize ( ) 1568void KOAgenda::finishResize ( )
1569{ 1569{
1570 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); 1570 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) ");
1571 if ( globalFlagBlockAgenda == 0 ) { 1571 if ( globalFlagBlockAgenda == 0 ) {
1572 finishUpdate(); 1572 finishUpdate();
1573 //qDebug("finishUpdate() called "); 1573 //qDebug("finishUpdate() called ");
1574 } 1574 }
1575} 1575}
1576/* 1576/*
1577 Overridden from QScrollView to provide proper resizing of KOAgendaItems. 1577 Overridden from QScrollView to provide proper resizing of KOAgendaItems.
1578*/ 1578*/
1579void KOAgenda::resizeEvent ( QResizeEvent *ev ) 1579void KOAgenda::resizeEvent ( QResizeEvent *ev )
1580{ 1580{
1581 1581
1582 mResizeTimer.start( 150 , true ); 1582 mResizeTimer.start( 150 , true );
1583 computeSizes(); 1583 computeSizes();
1584 return; 1584 return;
1585 1585
1586} 1586}
1587void KOAgenda::computeSizes() 1587void KOAgenda::computeSizes()
1588{ 1588{
1589 if ( globalFlagBlockStartup ) 1589 if ( globalFlagBlockStartup )
1590 return; 1590 return;
1591 1591
1592 if (mAllDayMode) { 1592 if (mAllDayMode) {
1593 mGridSpacingX = (width()-3) / mColumns; 1593 mGridSpacingX = (width()-3) / mColumns;
1594 mGridSpacingY = height() - 2 * frameWidth() - 1; 1594 mGridSpacingY = height() - 2 * frameWidth() - 1;
1595 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); 1595 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
1596// mGridSpacingY = height(); 1596// mGridSpacingY = height();
1597// resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1597// resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1598 1598
1599 KOAgendaItem *item; 1599 KOAgendaItem *item;
1600 int subCellWidth; 1600 int subCellWidth;
1601 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1601 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1602 subCellWidth = mGridSpacingY / item->subCells(); 1602 subCellWidth = mGridSpacingY / item->subCells();
1603 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); 1603 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
1604 moveChild(item,KOGlobals::self()->reverseLayout() ? 1604 moveChild(item,KOGlobals::self()->reverseLayout() ?
1605 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1605 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1606 item->cellX() * mGridSpacingX, 1606 item->cellX() * mGridSpacingX,
1607 item->subCell() * subCellWidth); 1607 item->subCell() * subCellWidth);
1608 } 1608 }
1609 KOPrefs::instance()->mAllDaySize = mGridSpacingY; 1609 KOPrefs::instance()->mAllDaySize = mGridSpacingY;
1610 } else { 1610 } else {
1611 mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns; 1611 mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns;
1612 if (height() > mGridSpacingY * mRows + 1 ) { 1612 if (height() > mGridSpacingY * mRows + 1 ) {
1613 KOPrefs::instance()->mHourSize = ((height())/mRows)+1; 1613 KOPrefs::instance()->mHourSize = ((height())/mRows)+1;
1614 mGridSpacingY = KOPrefs::instance()->mHourSize ; 1614 mGridSpacingY = KOPrefs::instance()->mHourSize ;
1615 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1615 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1616 emit resizedSignal(); 1616 emit resizedSignal();
1617 } else 1617 } else
1618 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1618 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1619 KOAgendaItem *item; 1619 KOAgendaItem *item;
1620 int subCellWidth; 1620 int subCellWidth;
1621 1621
1622 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1622 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1623 subCellWidth = mGridSpacingX / item->subCells(); 1623 subCellWidth = mGridSpacingX / item->subCells();
1624 item->resize(subCellWidth,item->height()); 1624 item->resize(subCellWidth,item->height());
1625 moveChild(item,(KOGlobals::self()->reverseLayout() ? 1625 moveChild(item,(KOGlobals::self()->reverseLayout() ?
1626 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1626 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1627 item->cellX() * mGridSpacingX) + 1627 item->cellX() * mGridSpacingX) +
1628 item->subCell() * subCellWidth,childY(item)); 1628 item->subCell() * subCellWidth,childY(item));
1629 } 1629 }
1630 } 1630 }
1631 int cw = contentsWidth(); 1631 int cw = contentsWidth();
1632 int ch = contentsHeight(); 1632 int ch = contentsHeight();
1633 if ( mAllDayMode ) { 1633 if ( mAllDayMode ) {
1634 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); 1634 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
1635 if ( paintPixAll->width() < cw || paintPixAll->height() < ch ) 1635 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 )
1636 paintPixAll->resize( cw, ch ); 1636 paintPixAll->resize( cw, ch );
1637 } else { 1637 } else {
1638 QPixmap* paintPix = KOAgendaItem::paintPix(); 1638 QPixmap* paintPix = KOAgendaItem::paintPix();
1639 if ( paintPix->width() < cw || paintPix->height() < ch ) 1639 if ( paintPix->width() < cw || paintPix->height() < ch )
1640 KOAgendaItem::resizePixmap( cw , ch ); 1640 KOAgendaItem::resizePixmap( cw , ch );
1641 } 1641 }
1642 1642
1643 checkScrollBoundaries(); 1643 checkScrollBoundaries();
1644 marcus_bains(); 1644 marcus_bains();
1645 drawContentsToPainter(); 1645 drawContentsToPainter();
1646 viewport()->repaint(false); 1646 viewport()->repaint(false);
1647} 1647}
1648 1648
1649void KOAgenda::scrollUp() 1649void KOAgenda::scrollUp()
1650{ 1650{
1651 scrollBy(0,-mScrollOffset); 1651 scrollBy(0,-mScrollOffset);
1652} 1652}
1653 1653
1654 1654
1655void KOAgenda::scrollDown() 1655void KOAgenda::scrollDown()
1656{ 1656{
1657 scrollBy(0,mScrollOffset); 1657 scrollBy(0,mScrollOffset);
1658} 1658}
1659 1659
1660void KOAgenda::popupAlarm() 1660void KOAgenda::popupAlarm()
1661{ 1661{
1662 if (!mClickedItem) { 1662 if (!mClickedItem) {
1663 kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl; 1663 kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl;
1664 return; 1664 return;
1665 } 1665 }
1666// TODO: deal correctly with multiple alarms 1666// TODO: deal correctly with multiple alarms
1667 Alarm* alarm; 1667 Alarm* alarm;
1668 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 1668 QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
1669 for(alarm=list.first();alarm;alarm=list.next()) { 1669 for(alarm=list.first();alarm;alarm=list.next()) {
1670 alarm->toggleAlarm(); 1670 alarm->toggleAlarm();
1671 } 1671 }
1672 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); 1672 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED );
1673 mClickedItem->paintMe( true ); 1673 mClickedItem->paintMe( true );
1674 mClickedItem->repaint( false ); 1674 mClickedItem->repaint( false );
1675} 1675}
1676 1676
1677/* 1677/*
1678 Calculates the minimum width 1678 Calculates the minimum width
1679*/ 1679*/
1680int KOAgenda::minimumWidth() const 1680int KOAgenda::minimumWidth() const
1681{ 1681{
1682 // TODO:: develop a way to dynamically determine the minimum width 1682 // TODO:: develop a way to dynamically determine the minimum width
1683 int min = 100; 1683 int min = 100;
1684 1684
1685 return min; 1685 return min;
1686} 1686}
1687 1687
1688void KOAgenda::updateConfig() 1688void KOAgenda::updateConfig()
1689{ 1689{
1690 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) 1690 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor)
1691 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); 1691 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
1692 if ( mAllDayMode ) { 1692 if ( mAllDayMode ) {
1693 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; 1693 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize;
1694 //mGridSpacingY = KOPrefs::instance()->mAllDaySize; 1694 //mGridSpacingY = KOPrefs::instance()->mAllDaySize;
1695 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); 1695 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 );
1696 // setMaximumHeight( mGridSpacingY+1 ); 1696 // setMaximumHeight( mGridSpacingY+1 );
1697 viewport()->repaint( false ); 1697 viewport()->repaint( false );
1698 //setFixedHeight( mGridSpacingY+1 ); 1698 //setFixedHeight( mGridSpacingY+1 );
1699 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); 1699 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize);
1700 } 1700 }
1701 else { 1701 else {
1702 mGridSpacingY = KOPrefs::instance()->mHourSize; 1702 mGridSpacingY = KOPrefs::instance()->mHourSize;
1703 calculateWorkingHours(); 1703 calculateWorkingHours();
1704 marcus_bains(); 1704 marcus_bains();
1705 } 1705 }
1706} 1706}
1707 1707
1708void KOAgenda::checkScrollBoundaries() 1708void KOAgenda::checkScrollBoundaries()
1709{ 1709{
1710 // Invalidate old values to force update 1710 // Invalidate old values to force update
1711 mOldLowerScrollValue = -1; 1711 mOldLowerScrollValue = -1;
1712 mOldUpperScrollValue = -1; 1712 mOldUpperScrollValue = -1;
1713 1713
1714 checkScrollBoundaries(verticalScrollBar()->value()); 1714 checkScrollBoundaries(verticalScrollBar()->value());
1715} 1715}
1716 1716
1717void KOAgenda::checkScrollBoundaries(int v) 1717void KOAgenda::checkScrollBoundaries(int v)
1718{ 1718{
1719 if ( mGridSpacingY == 0 ) 1719 if ( mGridSpacingY == 0 )
1720 return; 1720 return;
1721 int yMin = v/mGridSpacingY; 1721 int yMin = v/mGridSpacingY;
1722 int yMax = (v+visibleHeight())/mGridSpacingY; 1722 int yMax = (v+visibleHeight())/mGridSpacingY;
1723 1723
1724// kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; 1724// kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl;
1725 1725
1726 if (yMin != mOldLowerScrollValue) { 1726 if (yMin != mOldLowerScrollValue) {
1727 mOldLowerScrollValue = yMin; 1727 mOldLowerScrollValue = yMin;
1728 emit lowerYChanged(yMin); 1728 emit lowerYChanged(yMin);
1729 } 1729 }
1730 if (yMax != mOldUpperScrollValue) { 1730 if (yMax != mOldUpperScrollValue) {
1731 mOldUpperScrollValue = yMax; 1731 mOldUpperScrollValue = yMax;
1732 emit upperYChanged(yMax); 1732 emit upperYChanged(yMax);
1733 } 1733 }
1734} 1734}
1735 1735
1736void KOAgenda::deselectItem() 1736void KOAgenda::deselectItem()
1737{ 1737{
1738 if (mSelectedItem.isNull()) return; 1738 if (mSelectedItem.isNull()) return;
1739 mSelectedItem->select(false); 1739 mSelectedItem->select(false);
1740 mSelectedItem = 0; 1740 mSelectedItem = 0;
1741} 1741}
1742 1742
1743void KOAgenda::selectItem(KOAgendaItem *item) 1743void KOAgenda::selectItem(KOAgendaItem *item)
1744{ 1744{
1745 if ((KOAgendaItem *)mSelectedItem == item) return; 1745 if ((KOAgendaItem *)mSelectedItem == item) return;
1746 deselectItem(); 1746 deselectItem();
1747 if (item == 0) { 1747 if (item == 0) {
1748 emit incidenceSelected( 0 ); 1748 emit incidenceSelected( 0 );
1749 return; 1749 return;
1750 } 1750 }
1751 mSelectedItem = item; 1751 mSelectedItem = item;
1752 mSelectedItem->select(); 1752 mSelectedItem->select();
1753 emit incidenceSelected( mSelectedItem->incidence() ); 1753 emit incidenceSelected( mSelectedItem->incidence() );
1754} 1754}
1755 1755
1756// This function seems never be called. 1756// This function seems never be called.
1757void KOAgenda::keyPressEvent( QKeyEvent *kev ) 1757void KOAgenda::keyPressEvent( QKeyEvent *kev )
1758{ 1758{
1759 switch(kev->key()) { 1759 switch(kev->key()) {
1760 case Key_PageDown: 1760 case Key_PageDown:
1761 verticalScrollBar()->addPage(); 1761 verticalScrollBar()->addPage();
1762 break; 1762 break;
1763 case Key_PageUp: 1763 case Key_PageUp:
1764 verticalScrollBar()->subtractPage(); 1764 verticalScrollBar()->subtractPage();
1765 break; 1765 break;
1766 case Key_Down: 1766 case Key_Down:
1767 verticalScrollBar()->addLine(); 1767 verticalScrollBar()->addLine();
1768 break; 1768 break;
1769 case Key_Up: 1769 case Key_Up:
1770 verticalScrollBar()->subtractLine(); 1770 verticalScrollBar()->subtractLine();
1771 break; 1771 break;
1772 default: 1772 default:
1773 ; 1773 ;
1774 } 1774 }
1775} 1775}
1776 1776
1777void KOAgenda::calculateWorkingHours() 1777void KOAgenda::calculateWorkingHours()
1778{ 1778{
1779// mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; 1779// mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours;
1780 mWorkingHoursEnable = !mAllDayMode; 1780 mWorkingHoursEnable = !mAllDayMode;
1781 1781
1782 mWorkingHoursYTop = mGridSpacingY * 1782 mWorkingHoursYTop = mGridSpacingY *
1783 KOPrefs::instance()->mWorkingHoursStart * 4; 1783 KOPrefs::instance()->mWorkingHoursStart * 4;
1784 mWorkingHoursYBottom = mGridSpacingY * 1784 mWorkingHoursYBottom = mGridSpacingY *
1785 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; 1785 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1;
1786} 1786}
1787 1787
1788 1788
1789DateList KOAgenda::dateList() const 1789DateList KOAgenda::dateList() const
1790{ 1790{
1791 return mSelectedDates; 1791 return mSelectedDates;
1792} 1792}
1793 1793
1794void KOAgenda::setDateList(const DateList &selectedDates) 1794void KOAgenda::setDateList(const DateList &selectedDates)
1795{ 1795{
1796 mSelectedDates = selectedDates; 1796 mSelectedDates = selectedDates;
1797 marcus_bains(); 1797 marcus_bains();
1798} 1798}
1799 1799
1800void KOAgenda::setHolidayMask(QMemArray<bool> *mask) 1800void KOAgenda::setHolidayMask(QMemArray<bool> *mask)
1801{ 1801{
1802 mHolidayMask = mask; 1802 mHolidayMask = mask;
1803 1803
1804/* 1804/*
1805 kdDebug() << "HolidayMask: "; 1805 kdDebug() << "HolidayMask: ";
1806 for(uint i=0;i<mask->count();++i) { 1806 for(uint i=0;i<mask->count();++i) {
1807 kdDebug() << (mask->at(i) ? "*" : "o"); 1807 kdDebug() << (mask->at(i) ? "*" : "o");
1808 } 1808 }
1809 kdDebug() << endl; 1809 kdDebug() << endl;
1810*/ 1810*/
1811} 1811}
1812 1812
1813void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) 1813void KOAgenda::contentsMousePressEvent ( QMouseEvent *event )
1814{ 1814{
1815 1815
1816 QScrollView::contentsMousePressEvent(event); 1816 QScrollView::contentsMousePressEvent(event);
1817} 1817}
1818 1818
1819void KOAgenda::storePosition() 1819void KOAgenda::storePosition()
1820{ 1820{
1821 //mContentPosition 1821 //mContentPosition
1822 int max = mGridSpacingY*4*24; 1822 int max = mGridSpacingY*4*24;
1823 if ( contentsY() < 5 && max > viewport()->height()*3/2 ) 1823 if ( contentsY() < 5 && max > viewport()->height()*3/2 )
1824 mContentPosition = 0; 1824 mContentPosition = 0;
1825 else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) 1825 else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2)
1826 mContentPosition = -1.0; 1826 mContentPosition = -1.0;
1827 else 1827 else
1828 mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); 1828 mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2)));
1829 //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); 1829 //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height());
1830 1830
1831} 1831}
1832void KOAgenda::restorePosition() 1832void KOAgenda::restorePosition()
1833{ 1833{
1834 int posY; 1834 int posY;
1835 int max = mGridSpacingY*4*24; 1835 int max = mGridSpacingY*4*24;
1836 if ( mContentPosition < 0 ) 1836 if ( mContentPosition < 0 )
1837 posY = max-viewport()->height(); 1837 posY = max-viewport()->height();
1838 else 1838 else
1839 if ( mContentPosition == 0 ) 1839 if ( mContentPosition == 0 )
1840 posY = 0; 1840 posY = 0;
1841 else 1841 else
1842 posY = (max/mContentPosition)-(viewport()->height()/2); 1842 posY = (max/mContentPosition)-(viewport()->height()/2);
1843 setContentsPos (0, posY ); 1843 setContentsPos (0, posY );
1844 //qDebug("posY %d hei %d", posY, max); 1844 //qDebug("posY %d hei %d", posY, max);
1845 1845
1846} 1846}
1847void KOAgenda::moveChild( QWidget *w, int x , int y ) 1847void KOAgenda::moveChild( QWidget *w, int x , int y )
1848{ 1848{
1849 ++x; 1849 ++x;
1850 QScrollView::moveChild( w, x , y ); 1850 QScrollView::moveChild( w, x , y );
1851} 1851}
1852#include <qmessagebox.h> 1852#include <qmessagebox.h>
1853#ifdef DESKTOP_VERSION 1853#ifdef DESKTOP_VERSION
1854#include <qprinter.h> 1854#include <qprinter.h>
1855#include <qpainter.h> 1855#include <qpainter.h>
1856#include <qpaintdevicemetrics.h> 1856#include <qpaintdevicemetrics.h>
1857 1857
1858#endif 1858#endif
1859void KOAgenda::printSelection() 1859void KOAgenda::printSelection()
1860{ 1860{
1861#ifdef DESKTOP_VERSION 1861#ifdef DESKTOP_VERSION
1862 if ( mStartCellY == mCurrentCellY ) { 1862 if ( mStartCellY == mCurrentCellY ) {
1863 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1863 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1864 i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), 1864 i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "),
1865 i18n("OK"), 0, 0, 1865 i18n("OK"), 0, 0,
1866 0, 1 ); 1866 0, 1 );
1867 return; 1867 return;
1868 } 1868 }
1869 1869
1870 float dx, dy; 1870 float dx, dy;
1871 int x,y,w,h; 1871 int x,y,w,h;
1872 x= 0; 1872 x= 0;
1873 w= contentsWidth()+2; 1873 w= contentsWidth()+2;
1874 // h= contentsHeight(); 1874 // h= contentsHeight();
1875 y = mGridSpacingY*mStartCellY; 1875 y = mGridSpacingY*mStartCellY;
1876 h = mGridSpacingY*(mCurrentCellY+1)-y+2; 1876 h = mGridSpacingY*(mCurrentCellY+1)-y+2;
1877 1877
1878 //return; 1878 //return;
1879 QPrinter* printer = new QPrinter(); 1879 QPrinter* printer = new QPrinter();
1880 if ( !printer->setup()) { 1880 if ( !printer->setup()) {
1881 delete printer; 1881 delete printer;
1882 return; 1882 return;
1883 } 1883 }
1884 QPainter p( printer ); 1884 QPainter p( printer );
1885 QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); 1885 QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer );
1886 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); 1886 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() );
1887 date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); 1887 date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true );
1888 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); 1888 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height();
1889 // p.drawText( 0, 0, date ); 1889 // p.drawText( 0, 0, date );
1890 int offset = m.width()/8; 1890 int offset = m.width()/8;
1891 // compute the scale 1891 // compute the scale
1892 dx = ((float) m.width()-offset) / (float)w; 1892 dx = ((float) m.width()-offset) / (float)w;
1893 dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; 1893 dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h;
1894 float scale; 1894 float scale;
1895 // scale to fit the width or height of the paper 1895 // scale to fit the width or height of the paper
1896 if ( dx < dy ) 1896 if ( dx < dy )
1897 scale = dx; 1897 scale = dx;
1898 else 1898 else
1899 scale = dy; 1899 scale = dy;
1900 // set the scale 1900 // set the scale
1901 p.drawText( offset* scale, offset* scale*3/4, date ); 1901 p.drawText( offset* scale, offset* scale*3/4, date );
1902 1902
1903 int selDay; 1903 int selDay;
1904 float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); 1904 float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count()));
1905 float startX = 1; 1905 float startX = 1;
1906 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) 1906 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
1907 { 1907 {
1908 QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); 1908 QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true );
1909 p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); 1909 p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) );
1910 p.drawText( offset* scale+startX, (offset+hei)* scale, text ); 1910 p.drawText( offset* scale+startX, (offset+hei)* scale, text );
1911 startX += widOffset; 1911 startX += widOffset;
1912 1912
1913 } 1913 }
1914 p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); 1914 p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale));
1915 p.scale( scale, scale ); 1915 p.scale( scale, scale );
1916 p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); 1916 p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale );
1917 // now printing with y offset: 2 hei 1917 // now printing with y offset: 2 hei
1918 // p.translate( 0, -y*scale); 1918 // p.translate( 0, -y*scale);
1919 1919
1920 drawContentsToPainter(&p, true ); 1920 drawContentsToPainter(&p, true );
1921 globalFlagBlockAgendaItemUpdate = false; 1921 globalFlagBlockAgendaItemUpdate = false;
1922 KOAgendaItem *item; 1922 KOAgendaItem *item;
1923 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1923 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1924 item->select(false); 1924 item->select(false);
1925 item->paintMe( false, &p ); 1925 item->paintMe( false, &p );
1926 } 1926 }
1927 globalFlagBlockAgendaItemUpdate = true; 1927 globalFlagBlockAgendaItemUpdate = true;
1928 p.end(); 1928 p.end();
1929 delete printer; 1929 delete printer;
1930#else 1930#else
1931 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1931 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1932 i18n("Not supported \non PDA!\n"), 1932 i18n("Not supported \non PDA!\n"),
1933 i18n("OK"), 0, 0, 1933 i18n("OK"), 0, 0,
1934 0, 1 ); 1934 0, 1 );
1935#endif 1935#endif
1936} 1936}
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 6965ba7..62281d4 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -46,677 +46,677 @@ extern int globalFlagBlockAgendaItemUpdate;
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koagendaitem.h" 49#include "koagendaitem.h"
50//#include "koagendaitem.moc" 50//#include "koagendaitem.moc"
51 51
52 52
53//-------------------------------------------------------------------------- 53//--------------------------------------------------------------------------
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
60 const char *name,WFlags) : 60 const char *name,WFlags) :
61 QWidget(parent, name), mIncidence(incidence), mDate(qd) 61 QWidget(parent, name), mIncidence(incidence), mDate(qd)
62{ 62{
63#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
65#endif 65#endif
66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
67 setWFlags ( wflags); 67 setWFlags ( wflags);
68 mAllDay = allday; 68 mAllDay = allday;
69 init ( incidence, qd ); 69 init ( incidence, qd );
70 setMouseTracking(true); 70 setMouseTracking(true);
71 //setAcceptDrops(true); 71 //setAcceptDrops(true);
72 xPaintCoord = -1; 72 xPaintCoord = -1;
73 yPaintCoord = -1; 73 yPaintCoord = -1;
74} 74}
75 75
76void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 76void KOAgendaItem::init ( Incidence *incidence, QDate qd )
77{ 77{
78 mIncidence = incidence; 78 mIncidence = incidence;
79 mDate = qd; 79 mDate = qd;
80 mFirstMultiItem = 0; 80 mFirstMultiItem = 0;
81 mNextMultiItem = 0; 81 mNextMultiItem = 0;
82 mLastMultiItem = 0; 82 mLastMultiItem = 0;
83 computeText(); 83 computeText();
84 84
85 if ( (incidence->type() == "Todo") && 85 if ( (incidence->type() == "Todo") &&
86 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 86 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
90 else 90 else
91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
92 } 92 }
93 else { 93 else {
94 QStringList categories = mIncidence->categories(); 94 QStringList categories = mIncidence->categories();
95 QString cat = categories.first(); 95 QString cat = categories.first();
96 if (cat.isEmpty()) { 96 if (cat.isEmpty()) {
97 mBackgroundColor =KOPrefs::instance()->mEventColor; 97 mBackgroundColor =KOPrefs::instance()->mEventColor;
98 } else { 98 } else {
99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
100 } 100 }
101 } 101 }
102 mColorGroup = QColorGroup( mBackgroundColor.light(), 102 mColorGroup = QColorGroup( mBackgroundColor.light(),
103 mBackgroundColor.dark(),mBackgroundColor.light(), 103 mBackgroundColor.dark(),mBackgroundColor.light(),
104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
105 setBackgroundColor( mBackgroundColor ); 105 setBackgroundColor( mBackgroundColor );
106 106
107 setCellXY(0,0,1); 107 setCellXY(0,0,1);
108 setCellXWidth(0); 108 setCellXWidth(0);
109 setSubCell(0); 109 setSubCell(0);
110 setSubCells(1); 110 setSubCells(1);
111 setMultiItem(0,0,0); 111 setMultiItem(0,0,0);
112 startMove(); 112 startMove();
113 mSelected = true; 113 mSelected = true;
114 select(false); 114 select(false);
115 QString tipText = mIncidence->summary(); 115 QString tipText = mIncidence->summary();
116 // QToolTip::add(this,tipText); 116 // QToolTip::add(this,tipText);
117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); 117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
118 if ( !mIncidence->doesFloat() ) 118 if ( !mIncidence->doesFloat() )
119 if ( mIncidence->type() == "Event" ) { 119 if ( mIncidence->type() == "Event" ) {
120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
123 } 123 }
124 else { 124 else {
125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
127 } 127 }
128 } 128 }
129 else if ( mIncidence->type() == "Todo" ) { 129 else if ( mIncidence->type() == "Todo" ) {
130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); 130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr();
131 } 131 }
132 132
133 if (!mIncidence->location().isEmpty()) { 133 if (!mIncidence->location().isEmpty()) {
134 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 134 tipText += "\n"+i18n("Location: ")+mIncidence->location();
135 } 135 }
136 QToolTip::add(this,tipText,toolTipGroup(),""); 136 QToolTip::add(this,tipText,toolTipGroup(),"");
137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
138 mFontPixelSize = fontinf.height();; 138 mFontPixelSize = fontinf.height();;
139 hide(); 139 hide();
140 xPaintCoord = -1; 140 xPaintCoord = -1;
141 yPaintCoord = -1; 141 yPaintCoord = -1;
142} 142}
143 143
144 144
145KOAgendaItem::~KOAgendaItem() 145KOAgendaItem::~KOAgendaItem()
146{ 146{
147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
148 148
149} 149}
150 150
151void KOAgendaItem::recreateIncidence() 151void KOAgendaItem::recreateIncidence()
152{ 152{
153#if 0 153#if 0
154 Incidence* newInc = mIncidence->clone(); 154 Incidence* newInc = mIncidence->clone();
155 newInc->recreate(); 155 newInc->recreate();
156 if ( mIncidence->doesRecur() ) { 156 if ( mIncidence->doesRecur() ) {
157 mIncidence->addExDate( mDate ); 157 mIncidence->addExDate( mDate );
158 newInc->recurrence()->unsetRecurs(); 158 newInc->recurrence()->unsetRecurs();
159 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 159 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
160 QTime tim = mIncidence->dtStart().time(); 160 QTime tim = mIncidence->dtStart().time();
161 newInc->setDtStart( QDateTime(mDate, tim) ); 161 newInc->setDtStart( QDateTime(mDate, tim) );
162 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 162 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
163 } 163 }
164#endif 164#endif
165 mIncidence = mIncidence->recreateCloneException( mDate ); 165 mIncidence = mIncidence->recreateCloneException( mDate );
166} 166}
167bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 167bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
168{ 168{
169 int size = AGENDA_ICON_SIZE; 169 int size = AGENDA_ICON_SIZE;
170 170
171 int yOff = 0; 171 int yOff = 0;
172 int xOff = 0; 172 int xOff = 0;
173 int x = pos().x() +3; 173 int x = pos().x() +3;
174 int y; 174 int y;
175 if ( mAllDay ) 175 if ( mAllDay )
176 y = pos().y()+3; 176 y = pos().y()+3;
177 else 177 else
178 y = mCellYTop * ( height() / cellHeight() ) +3; 178 y = mCellYTop * ( height() / cellHeight() ) +3;
179 if (mIncidence->cancelled()) { 179 if (mIncidence->cancelled()) {
180 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 180 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
181 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 181 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
182 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 182 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
183 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 183 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
184 if ( horLayout ) 184 if ( horLayout )
185 ++xOff; 185 ++xOff;
186 else 186 else
187 ++yOff; 187 ++yOff;
188 } 188 }
189 if (mIncidence->isAlarmEnabled()) { 189 if (mIncidence->isAlarmEnabled()) {
190 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 190 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
191 if ( horLayout ) 191 if ( horLayout )
192 ++xOff; 192 ++xOff;
193 else 193 else
194 ++yOff; 194 ++yOff;
195 } 195 }
196 if (mIncidence->recurrence()->doesRecur()) { 196 if (mIncidence->recurrence()->doesRecur()) {
197 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 197 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
198 if ( horLayout ) 198 if ( horLayout )
199 ++xOff; 199 ++xOff;
200 else 200 else
201 ++yOff; 201 ++yOff;
202 } 202 }
203 if (mIncidence->description().length() > 0) { 203 if (mIncidence->description().length() > 0) {
204 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 204 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
205 if ( horLayout ) 205 if ( horLayout )
206 ++xOff; 206 ++xOff;
207 else 207 else
208 ++yOff; 208 ++yOff;
209 } 209 }
210 if (mIncidence->isReadOnly()) { 210 if (mIncidence->isReadOnly()) {
211 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 211 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
212 if ( horLayout ) 212 if ( horLayout )
213 ++xOff; 213 ++xOff;
214 else 214 else
215 ++yOff; 215 ++yOff;
216 } 216 }
217 217
218 if (mIncidence->attendeeCount()>0) { 218 if (mIncidence->attendeeCount()>0) {
219 219
220 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 220 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
222 if ( horLayout ) 222 if ( horLayout )
223 ++xOff; 223 ++xOff;
224 else 224 else
225 ++yOff; 225 ++yOff;
226 } else { 226 } else {
227 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 227 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
228 if (me!=0) { 228 if (me!=0) {
229 229
230 230
231 } else { 231 } else {
232 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 232 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
233 if ( horLayout ) 233 if ( horLayout )
234 ++xOff; 234 ++xOff;
235 else 235 else
236 ++yOff; 236 ++yOff;
237 237
238 } 238 }
239 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 239 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
240 if ( horLayout ) 240 if ( horLayout )
241 ++xOff; 241 ++xOff;
242 else 242 else
243 ++yOff; 243 ++yOff;
244 244
245 } 245 }
246 246
247 } 247 }
248 return ( yOff || xOff ); 248 return ( yOff || xOff );
249} 249}
250 250
251 251
252void KOAgendaItem::select(bool selected) 252void KOAgendaItem::select(bool selected)
253{ 253{
254 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 254 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
255 if (mSelected == selected) return; 255 if (mSelected == selected) return;
256 mSelected = selected; 256 mSelected = selected;
257 if ( ! isVisible() ) 257 if ( ! isVisible() )
258 return; 258 return;
259 if ( firstMultiItem() ) 259 if ( firstMultiItem() )
260 firstMultiItem()->select( selected ); 260 firstMultiItem()->select( selected );
261 if ( !firstMultiItem() && nextMultiItem() ) { 261 if ( !firstMultiItem() && nextMultiItem() ) {
262 KOAgendaItem * placeItem = nextMultiItem(); 262 KOAgendaItem * placeItem = nextMultiItem();
263 while ( placeItem ) { 263 while ( placeItem ) {
264 placeItem->select( selected ); 264 placeItem->select( selected );
265 placeItem = placeItem->nextMultiItem(); 265 placeItem = placeItem->nextMultiItem();
266 } 266 }
267 } 267 }
268 globalFlagBlockAgendaItemUpdate = 0; 268 globalFlagBlockAgendaItemUpdate = 0;
269 paintMe( selected ); 269 paintMe( selected );
270 globalFlagBlockAgendaItemUpdate = 1; 270 globalFlagBlockAgendaItemUpdate = 1;
271 repaint( false ); 271 repaint( false );
272} 272}
273 273
274 274
275/* 275/*
276 The eventFilter has to filter the mouse events of the agenda item childs. The 276 The eventFilter has to filter the mouse events of the agenda item childs. The
277 events are fed into the event handling method of KOAgendaItem. This allows the 277 events are fed into the event handling method of KOAgendaItem. This allows the
278 KOAgenda to handle the KOAgendaItems by using an eventFilter. 278 KOAgenda to handle the KOAgendaItems by using an eventFilter.
279*/ 279*/
280bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 280bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
281{ 281{
282 if (e->type() == QEvent::MouseButtonPress || 282 if (e->type() == QEvent::MouseButtonPress ||
283 e->type() == QEvent::MouseButtonDblClick || 283 e->type() == QEvent::MouseButtonDblClick ||
284 e->type() == QEvent::MouseButtonRelease || 284 e->type() == QEvent::MouseButtonRelease ||
285 e->type() == QEvent::MouseMove) { 285 e->type() == QEvent::MouseMove) {
286 QMouseEvent *me = (QMouseEvent *)e; 286 QMouseEvent *me = (QMouseEvent *)e;
287 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 287 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
288 mapToGlobal(me->pos())); 288 mapToGlobal(me->pos()));
289 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 289 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
290 return event(&returnEvent); 290 return event(&returnEvent);
291 } else { 291 } else {
292 return false; 292 return false;
293 } 293 }
294} 294}
295void KOAgendaItem::repaintMe( ) 295void KOAgendaItem::repaintMe( )
296{ 296{
297 paintMe ( mSelected ); 297 paintMe ( mSelected );
298} 298}
299void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 299void KOAgendaItem::paintMe( bool selected, QPainter* paint )
300{ 300{
301 if ( globalFlagBlockAgendaItemUpdate && ! selected) 301 if ( globalFlagBlockAgendaItemUpdate && ! selected)
302 return; 302 return;
303 QPainter pa; 303 QPainter pa;
304 304
305 if ( mSelected ) { 305 if ( mSelected ) {
306 pa.begin( paintPixSel() ); 306 pa.begin( paintPixSel() );
307 } else { 307 } else {
308 if ( mAllDay ) 308 if ( mAllDay )
309 pa.begin( paintPixAllday() ); 309 pa.begin( paintPixAllday() );
310 else 310 else
311 pa.begin( paintPix() ); 311 pa.begin( paintPix() );
312 } 312 }
313 int x, yy, w, h; 313 int x, yy, w, h;
314 float nfh; 314 float nfh;
315 x = pos().x(); w = width(); h = height (); 315 x = pos().x(); w = width(); h = height ();
316 if ( mAllDay ) 316 if ( mAllDay )
317 yy = y(); 317 yy = y();
318 else 318 else
319 yy = mCellYTop * ( height() / cellHeight() ); 319 yy = mCellYTop * ( height() / cellHeight() );
320 xPaintCoord= x; 320 xPaintCoord= x;
321 yPaintCoord = yy; 321 yPaintCoord = yy;
322 wPaintCoord = width(); 322 wPaintCoord = width();
323 hPaintCoord = height(); 323 hPaintCoord = height();
324 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 324 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
325 if ( paint == 0 ) 325 if ( paint == 0 )
326 paint = &pa; 326 paint = &pa;
327 bool horLayout = ( w < h ); 327 bool horLayout = ( w < h );
328 int maxhei = mFontPixelSize+4; 328 int maxhei = mFontPixelSize+4;
329 if ( horLayout ) 329 if ( horLayout )
330 maxhei += AGENDA_ICON_SIZE -4; 330 maxhei += AGENDA_ICON_SIZE -4;
331 bool small = ( h < maxhei ); 331 bool small = ( h < maxhei );
332 if ( ! small ) 332 if ( ! small )
333 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 333 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
334 else { 334 else {
335 QFont f = KOPrefs::instance()->mAgendaViewFont; 335 QFont f = KOPrefs::instance()->mAgendaViewFont;
336 f.setBold( false ); 336 f.setBold( false );
337 int fh = f.pointSize(); 337 int fh = f.pointSize();
338 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 338 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
339 if ( nfh < 6 ) 339 if ( nfh < 6 )
340 nfh = 6; 340 nfh = 6;
341 f.setPointSize( nfh ); 341 f.setPointSize( nfh );
342 paint->setFont(f); 342 paint->setFont(f);
343 } 343 }
344 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 344 paint->fillRect ( x, yy, w, h, mBackgroundColor );
345 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 345 static const QPixmap completedPxmp = SmallIcon("greenhook16");
346 static const QPixmap overduePxmp = SmallIcon("redcross16"); 346 static const QPixmap overduePxmp = SmallIcon("redcross16");
347 if ( mIncidence->type() == "Todo" ) { 347 if ( mIncidence->type() == "Todo" ) {
348 Todo* tempTodo = static_cast<Todo*>(mIncidence); 348 Todo* tempTodo = static_cast<Todo*>(mIncidence);
349 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 349 int xx = pos().x()+(width()-completedPxmp.width()-3 );
350 int yyy = yy+3; 350 int yyy = yy+3;
351 if ( tempTodo->isCompleted() ) 351 if ( tempTodo->isCompleted() )
352 paint->drawPixmap ( xx, yyy, completedPxmp ); 352 paint->drawPixmap ( xx, yyy, completedPxmp );
353 else { 353 else {
354 paint->drawPixmap ( xx, yyy, overduePxmp ); 354 paint->drawPixmap ( xx, yyy, overduePxmp );
355 355
356 } 356 }
357 } 357 }
358 bool addIcon = false; 358 bool addIcon = false;
359 if ( ! small || w > 3 * h || h > 3* w ) 359 if ( ! small || w > 3 * h || h > 3* w )
360 addIcon = updateIcons( paint, horLayout ); 360 addIcon = updateIcons( paint, horLayout );
361 361
362 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 362 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
363 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 363 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
364 if ( ! small ) { 364 if ( ! small ) {
365 x += 3; yy += 3;w -= 6; h-= 5; 365 x += 3; yy += 3;w -= 6; h-= 5;
366 } else { 366 } else {
367 x += 2; yy += 1;w -= 4; h-= 4; 367 x += 2; yy += 1;w -= 4; h-= 4;
368 if ( nfh < 6.01 ) { 368 if ( nfh < 6.01 ) {
369 yy -= 2; 369 yy -= 2;
370 h += 4; 370 h += 4;
371 } 371 }
372 else 372 else
373 if ( nfh < h -2 ) 373 if ( nfh < h -2 )
374 ++yy; 374 ++yy;
375 } 375 }
376 int align; 376 int align;
377#ifndef DESKTOP_VERSION 377#ifndef DESKTOP_VERSION
378 align = ( AlignLeft|WordBreak|AlignTop); 378 align = ( AlignLeft|WordBreak|AlignTop);
379#else 379#else
380 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 380 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
381#endif 381#endif
382 if ( addIcon ) { 382 if ( addIcon ) {
383 if ( ! horLayout ) { 383 if ( ! horLayout ) {
384 x += AGENDA_ICON_SIZE+3; 384 x += AGENDA_ICON_SIZE+3;
385 w -= (AGENDA_ICON_SIZE+3); 385 w -= (AGENDA_ICON_SIZE+3);
386 } 386 }
387 else { 387 else {
388 yy+= AGENDA_ICON_SIZE+2; 388 yy+= AGENDA_ICON_SIZE+2;
389 h -=(AGENDA_ICON_SIZE+3); 389 h -=(AGENDA_ICON_SIZE+3);
390 } 390 }
391 } 391 }
392 int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); 392 int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue();
393 if ( colsum < 250 ) 393 if ( colsum < 250 )
394 paint->setPen ( white); 394 paint->setPen ( white);
395 if ( x < 0 ) { 395 if ( x < 0 ) {
396 w = w+x-3; 396 w = w+x-3;
397 x = 3; 397 x = 3;
398 if ( w > parentWidget()->width() ){ 398 if ( w > parentWidget()->width() ){
399 w = parentWidget()->width() - 6; 399 w = parentWidget()->width() - 6;
400#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
401 align = ( AlignCenter|WordBreak); 401 align = ( AlignCenter|WordBreak);
402#else 402#else
403 align = ( AlignCenter|BreakAnywhere|WordBreak); 403 align = ( AlignCenter|BreakAnywhere|WordBreak);
404#endif 404#endif
405 405
406 } 406 }
407 } 407 }
408 QRect dr; 408 QRect dr;
409 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 409 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
410 if ( mIncidence->cancelled() ){ 410 if ( mIncidence->cancelled() ){
411 if ( ! small ) { 411 if ( ! small ) {
412 QFontMetrics fm ( paint->font() ); 412 QFontMetrics fm ( paint->font() );
413 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 413 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
414 } 414 }
415 415
416 } 416 }
417 pa.end(); 417 pa.end();
418 418
419} 419}
420void KOAgendaItem::resizePixmap( int w , int h ) 420void KOAgendaItem::resizePixmap( int w , int h )
421{ 421{
422 paintPix()->resize( w, h ); 422 paintPix()->resize( w, h );
423 paintPixSel()->resize( w, h ); 423 paintPixSel()->resize( w, h );
424 424
425} 425}
426QPixmap * KOAgendaItem::paintPix() 426QPixmap * KOAgendaItem::paintPix()
427{ 427{
428 static QPixmap* mPaintPix = 0; 428 static QPixmap* mPaintPix = 0;
429 if ( ! mPaintPix ) 429 if ( ! mPaintPix )
430 mPaintPix = new QPixmap(); 430 mPaintPix = new QPixmap(1,1);
431 return mPaintPix ; 431 return mPaintPix ;
432} 432}
433QPixmap * KOAgendaItem::paintPixAllday() 433QPixmap * KOAgendaItem::paintPixAllday()
434{ 434{
435 static QPixmap* mPaintPixA = 0; 435 static QPixmap* mPaintPixA = 0;
436 if ( ! mPaintPixA ) 436 if ( ! mPaintPixA )
437 mPaintPixA = new QPixmap(); 437 mPaintPixA = new QPixmap(1,1);
438 return mPaintPixA ; 438 return mPaintPixA ;
439} 439}
440QPixmap * KOAgendaItem::paintPixSel() 440QPixmap * KOAgendaItem::paintPixSel()
441{ 441{
442 static QPixmap* mPaintPixSel = 0; 442 static QPixmap* mPaintPixSel = 0;
443 if ( ! mPaintPixSel ) 443 if ( ! mPaintPixSel )
444 mPaintPixSel = new QPixmap(); 444 mPaintPixSel = new QPixmap(1,1);
445 return mPaintPixSel ; 445 return mPaintPixSel ;
446} 446}
447void KOAgendaItem::paintEvent ( QPaintEvent *e ) 447void KOAgendaItem::paintEvent ( QPaintEvent *e )
448{ 448{
449 449
450 if ( globalFlagBlockAgendaItemPaint ) 450 if ( globalFlagBlockAgendaItemPaint )
451 return; 451 return;
452 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 452 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
453 return; 453 return;
454 int yy; 454 int yy;
455 if ( mAllDay ) 455 if ( mAllDay )
456 yy = y(); 456 yy = y();
457 else 457 else
458 yy = mCellYTop * ( height() / cellHeight() ); 458 yy = mCellYTop * ( height() / cellHeight() );
459 int xx = x(); 459 int xx = x();
460 if ( xPaintCoord != xx || yPaintCoord != yy || 460 if ( xPaintCoord != xx || yPaintCoord != yy ||
461 wPaintCoord != width() || hPaintCoord != height()) { 461 wPaintCoord != width() || hPaintCoord != height()) {
462 xPaintCoord= xx; 462 xPaintCoord= xx;
463 yPaintCoord = yy; 463 yPaintCoord = yy;
464 wPaintCoord = width(); 464 wPaintCoord = width();
465 hPaintCoord = height(); 465 hPaintCoord = height();
466 globalFlagBlockAgendaItemUpdate = 0; 466 globalFlagBlockAgendaItemUpdate = 0;
467 paintMe( mSelected ); 467 paintMe( mSelected );
468 //qDebug("calling paintMe "); 468 //qDebug("calling paintMe ");
469 globalFlagBlockAgendaItemUpdate = 1; 469 globalFlagBlockAgendaItemUpdate = 1;
470 } 470 }
471 int rx, ry, rw, rh; 471 int rx, ry, rw, rh;
472 rx = e->rect().x(); 472 rx = e->rect().x();
473 ry = e->rect().y(); 473 ry = e->rect().y();
474 rw = e->rect().width(); 474 rw = e->rect().width();
475 rh = e->rect().height(); 475 rh = e->rect().height();
476 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 476 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
477 477
478 QPixmap* paintFrom ; 478 QPixmap* paintFrom ;
479 if ( mSelected ) { 479 if ( mSelected ) {
480 paintFrom = paintPixSel(); 480 paintFrom = paintPixSel();
481 } else { 481 } else {
482 if ( mAllDay ) 482 if ( mAllDay )
483 paintFrom = paintPixAllday(); 483 paintFrom = paintPixAllday();
484 else 484 else
485 paintFrom = paintPix(); 485 paintFrom = paintPix();
486 } 486 }
487 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); 487 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP);
488} 488}
489void KOAgendaItem::computeText() 489void KOAgendaItem::computeText()
490{ 490{
491 mDisplayedText = mIncidence->summary(); 491 mDisplayedText = mIncidence->summary();
492 if ( (mIncidence->type() == "Todo") ) { 492 if ( (mIncidence->type() == "Todo") ) {
493 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 493 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
494 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 494 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
495 else if ( !(mIncidence->doesFloat())) 495 else if ( !(mIncidence->doesFloat()))
496 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 496 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
497 497
498 498
499 499
500 } else { 500 } else {
501 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 501 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
502 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 502 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
503 503
504 if ( mAllDay ) { 504 if ( mAllDay ) {
505 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 505 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
506 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 506 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
507 } 507 }
508 } 508 }
509 509
510 } 510 }
511 511
512 if ( !mIncidence->location().isEmpty() ) { 512 if ( !mIncidence->location().isEmpty() ) {
513 if ( mAllDay ) 513 if ( mAllDay )
514 mDisplayedText += " ("; 514 mDisplayedText += " (";
515 else 515 else
516 mDisplayedText += "\n("; 516 mDisplayedText += "\n(";
517 mDisplayedText += mIncidence->location() +")"; 517 mDisplayedText += mIncidence->location() +")";
518 } 518 }
519} 519}
520void KOAgendaItem::updateItem() 520void KOAgendaItem::updateItem()
521{ 521{
522 computeText(); 522 computeText();
523 523
524 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 524 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
525 paintMe( mSelected ); 525 paintMe( mSelected );
526 repaint( false); 526 repaint( false);
527} 527}
528 528
529void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 529void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
530{ 530{
531 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 531 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
532 paintMe( mSelected ); 532 paintMe( mSelected );
533 repaint( false ); 533 repaint( false );
534} 534}
535 535
536/* 536/*
537 Return height of item in units of agenda cells 537 Return height of item in units of agenda cells
538*/ 538*/
539int KOAgendaItem::cellHeight() 539int KOAgendaItem::cellHeight()
540{ 540{
541 int ret = mCellYBottom - mCellYTop + 1; 541 int ret = mCellYBottom - mCellYTop + 1;
542 if ( ret <= 0 ) { 542 if ( ret <= 0 ) {
543 ret = 1; 543 ret = 1;
544 mCellYBottom = 0; 544 mCellYBottom = 0;
545 mCellYTop = 0; 545 mCellYTop = 0;
546 } 546 }
547 return ret; 547 return ret;
548} 548}
549 549
550/* 550/*
551 Return height of item in units of agenda cells 551 Return height of item in units of agenda cells
552*/ 552*/
553int KOAgendaItem::cellWidth() 553int KOAgendaItem::cellWidth()
554{ 554{
555 return mCellXWidth - mCellX + 1; 555 return mCellXWidth - mCellX + 1;
556} 556}
557 557
558void KOAgendaItem::setItemDate(QDate qd) 558void KOAgendaItem::setItemDate(QDate qd)
559{ 559{
560 mDate = qd; 560 mDate = qd;
561} 561}
562 562
563void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) 563void KOAgendaItem::setCellXY(int X, int YTop, int YBottom)
564{ 564{
565 mCellX = X; 565 mCellX = X;
566 mCellYTop = YTop; 566 mCellYTop = YTop;
567 mCellYBottom = YBottom; 567 mCellYBottom = YBottom;
568} 568}
569 569
570void KOAgendaItem::setCellXWidth(int xwidth) 570void KOAgendaItem::setCellXWidth(int xwidth)
571{ 571{
572 mCellXWidth = xwidth; 572 mCellXWidth = xwidth;
573} 573}
574 574
575void KOAgendaItem::setCellX(int XLeft, int XRight) 575void KOAgendaItem::setCellX(int XLeft, int XRight)
576{ 576{
577 mCellX = XLeft; 577 mCellX = XLeft;
578 mCellXWidth = XRight; 578 mCellXWidth = XRight;
579} 579}
580 580
581void KOAgendaItem::setCellY(int YTop, int YBottom) 581void KOAgendaItem::setCellY(int YTop, int YBottom)
582{ 582{
583 mCellYTop = YTop; 583 mCellYTop = YTop;
584 mCellYBottom = YBottom; 584 mCellYBottom = YBottom;
585} 585}
586 586
587void KOAgendaItem::setSubCell(int subCell) 587void KOAgendaItem::setSubCell(int subCell)
588{ 588{
589 mSubCell = subCell; 589 mSubCell = subCell;
590} 590}
591 591
592void KOAgendaItem::setSubCells(int subCells) 592void KOAgendaItem::setSubCells(int subCells)
593{ 593{
594 mSubCells = subCells; 594 mSubCells = subCells;
595} 595}
596 596
597void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, 597void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
598 KOAgendaItem *last) 598 KOAgendaItem *last)
599{ 599{
600 mFirstMultiItem = first; 600 mFirstMultiItem = first;
601 mNextMultiItem = next; 601 mNextMultiItem = next;
602 mLastMultiItem = last; 602 mLastMultiItem = last;
603} 603}
604 604
605void KOAgendaItem::startMove() 605void KOAgendaItem::startMove()
606{ 606{
607 mStartCellX = mCellX; 607 mStartCellX = mCellX;
608 mStartCellXWidth = mCellXWidth; 608 mStartCellXWidth = mCellXWidth;
609 mStartCellYTop = mCellYTop; 609 mStartCellYTop = mCellYTop;
610 mStartCellYBottom = mCellYBottom; 610 mStartCellYBottom = mCellYBottom;
611} 611}
612 612
613void KOAgendaItem::resetMove() 613void KOAgendaItem::resetMove()
614{ 614{
615 mCellX = mStartCellX; 615 mCellX = mStartCellX;
616 mCellXWidth = mStartCellXWidth; 616 mCellXWidth = mStartCellXWidth;
617 mCellYTop = mStartCellYTop; 617 mCellYTop = mStartCellYTop;
618 mCellYBottom = mStartCellYBottom; 618 mCellYBottom = mStartCellYBottom;
619} 619}
620 620
621void KOAgendaItem::moveRelative(int dx, int dy) 621void KOAgendaItem::moveRelative(int dx, int dy)
622{ 622{
623 int newX = cellX() + dx; 623 int newX = cellX() + dx;
624 int newXWidth = cellXWidth() + dx; 624 int newXWidth = cellXWidth() + dx;
625 int newYTop = cellYTop() + dy; 625 int newYTop = cellYTop() + dy;
626 int newYBottom = cellYBottom() + dy; 626 int newYBottom = cellYBottom() + dy;
627 setCellXY(newX,newYTop,newYBottom); 627 setCellXY(newX,newYTop,newYBottom);
628 setCellXWidth(newXWidth); 628 setCellXWidth(newXWidth);
629} 629}
630 630
631void KOAgendaItem::expandTop(int dy) 631void KOAgendaItem::expandTop(int dy)
632{ 632{
633 int newYTop = cellYTop() + dy; 633 int newYTop = cellYTop() + dy;
634 int newYBottom = cellYBottom(); 634 int newYBottom = cellYBottom();
635 if (newYTop > newYBottom) newYTop = newYBottom; 635 if (newYTop > newYBottom) newYTop = newYBottom;
636 setCellY(newYTop, newYBottom); 636 setCellY(newYTop, newYBottom);
637} 637}
638 638
639void KOAgendaItem::expandBottom(int dy) 639void KOAgendaItem::expandBottom(int dy)
640{ 640{
641 int newYTop = cellYTop(); 641 int newYTop = cellYTop();
642 int newYBottom = cellYBottom() + dy; 642 int newYBottom = cellYBottom() + dy;
643 if (newYBottom < newYTop) newYBottom = newYTop; 643 if (newYBottom < newYTop) newYBottom = newYTop;
644 setCellY(newYTop, newYBottom); 644 setCellY(newYTop, newYBottom);
645} 645}
646 646
647void KOAgendaItem::expandLeft(int dx) 647void KOAgendaItem::expandLeft(int dx)
648{ 648{
649 int newX = cellX() + dx; 649 int newX = cellX() + dx;
650 int newXWidth = cellXWidth(); 650 int newXWidth = cellXWidth();
651 if (newX > newXWidth) newX = newXWidth; 651 if (newX > newXWidth) newX = newXWidth;
652 setCellX(newX,newXWidth); 652 setCellX(newX,newXWidth);
653} 653}
654 654
655void KOAgendaItem::expandRight(int dx) 655void KOAgendaItem::expandRight(int dx)
656{ 656{
657 int newX = cellX(); 657 int newX = cellX();
658 int newXWidth = cellXWidth() + dx; 658 int newXWidth = cellXWidth() + dx;
659 if (newXWidth < newX) newXWidth = newX; 659 if (newXWidth < newX) newXWidth = newX;
660 setCellX(newX,newXWidth); 660 setCellX(newX,newXWidth);
661} 661}
662 662
663QToolTipGroup *KOAgendaItem::toolTipGroup() 663QToolTipGroup *KOAgendaItem::toolTipGroup()
664{ 664{
665 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 665 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
666 return mToolTipGroup; 666 return mToolTipGroup;
667} 667}
668 668
669void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) 669void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e )
670{ 670{
671#ifndef KORG_NODND 671#ifndef KORG_NODND
672 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || 672 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ||
673 !QTextDrag::canDecode( e ) ) { 673 !QTextDrag::canDecode( e ) ) {
674 e->ignore(); 674 e->ignore();
675 return; 675 return;
676 } 676 }
677 e->accept(); 677 e->accept();
678#endif 678#endif
679} 679}
680 680
681void KOAgendaItem::dropEvent( QDropEvent *e ) 681void KOAgendaItem::dropEvent( QDropEvent *e )
682{ 682{
683#ifndef KORG_NODND 683#ifndef KORG_NODND
684 QString text; 684 QString text;
685 if(QTextDrag::decode(e,text)) 685 if(QTextDrag::decode(e,text))
686 { 686 {
687 kdDebug() << "Dropped : " << text << endl; 687 kdDebug() << "Dropped : " << text << endl;
688 QStringList emails = QStringList::split(",",text); 688 QStringList emails = QStringList::split(",",text);
689 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 689 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
690 kdDebug() << " Email: " << (*it) << endl; 690 kdDebug() << " Email: " << (*it) << endl;
691 int pos = (*it).find("<"); 691 int pos = (*it).find("<");
692 QString name = (*it).left(pos); 692 QString name = (*it).left(pos);
693 QString email = (*it).mid(pos); 693 QString email = (*it).mid(pos);
694 if (!email.isEmpty()) { 694 if (!email.isEmpty()) {
695 mIncidence->addAttendee(new Attendee(name,email)); 695 mIncidence->addAttendee(new Attendee(name,email));
696 } 696 }
697 } 697 }
698 } 698 }
699#endif 699#endif
700} 700}
701 701
702 702
703QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() 703QPtrList<KOAgendaItem> KOAgendaItem::conflictItems()
704{ 704{
705 return mConflictItems; 705 return mConflictItems;
706} 706}
707 707
708void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) 708void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci)
709{ 709{
710 mConflictItems = ci; 710 mConflictItems = ci;
711 KOAgendaItem *item; 711 KOAgendaItem *item;
712 for ( item=mConflictItems.first(); item != 0; 712 for ( item=mConflictItems.first(); item != 0;
713 item=mConflictItems.next() ) { 713 item=mConflictItems.next() ) {
714 item->addConflictItem(this); 714 item->addConflictItem(this);
715 } 715 }
716} 716}
717 717
718void KOAgendaItem::addConflictItem(KOAgendaItem *ci) 718void KOAgendaItem::addConflictItem(KOAgendaItem *ci)
719{ 719{
720 if (mConflictItems.find(ci)<0) 720 if (mConflictItems.find(ci)<0)
721 mConflictItems.append(ci); 721 mConflictItems.append(ci);
722} 722}
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 7c53948..6f68d84 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -963,510 +963,510 @@ bool KSyncManager::syncExternalApplication(QString resource)
963 963
964 qDebug("Sync extern %s", resource.latin1()); 964 qDebug("Sync extern %s", resource.latin1());
965 965
966 bool syncOK = mImplementation->syncExternal(this, resource); 966 bool syncOK = mImplementation->syncExternal(this, resource);
967 967
968 return syncOK; 968 return syncOK;
969 969
970} 970}
971 971
972void KSyncManager::syncPhone() 972void KSyncManager::syncPhone()
973{ 973{
974 974
975 syncExternalApplication("phone"); 975 syncExternalApplication("phone");
976 976
977} 977}
978 978
979void KSyncManager::showProgressBar(int percentage, QString caption, int total) 979void KSyncManager::showProgressBar(int percentage, QString caption, int total)
980{ 980{
981 if (!bar->isVisible()) 981 if (!bar->isVisible())
982 { 982 {
983 bar->setCaption (caption); 983 bar->setCaption (caption);
984 bar->setTotalSteps ( total ) ; 984 bar->setTotalSteps ( total ) ;
985 985
986 bar->show(); 986 bar->show();
987 } 987 }
988 988
989 bar->setProgress( percentage ); 989 bar->setProgress( percentage );
990} 990}
991 991
992void KSyncManager::hideProgressBar() 992void KSyncManager::hideProgressBar()
993{ 993{
994 bar->hide(); 994 bar->hide();
995} 995}
996 996
997bool KSyncManager::isProgressBarCanceled() 997bool KSyncManager::isProgressBarCanceled()
998{ 998{
999 return !bar->isVisible(); 999 return !bar->isVisible();
1000} 1000}
1001 1001
1002QString KSyncManager::syncFileName() 1002QString KSyncManager::syncFileName()
1003{ 1003{
1004 1004
1005 QString fn = "tempfile"; 1005 QString fn = "tempfile";
1006 switch(mTargetApp) 1006 switch(mTargetApp)
1007 { 1007 {
1008 case (KAPI): 1008 case (KAPI):
1009 fn = "tempsyncab.vcf"; 1009 fn = "tempsyncab.vcf";
1010 break; 1010 break;
1011 case (KOPI): 1011 case (KOPI):
1012 fn = "tempsynccal.ics"; 1012 fn = "tempsynccal.ics";
1013 break; 1013 break;
1014 case (PWMPI): 1014 case (PWMPI):
1015 fn = "tempsyncpw.pwm"; 1015 fn = "tempsyncpw.pwm";
1016 break; 1016 break;
1017 default: 1017 default:
1018 break; 1018 break;
1019 } 1019 }
1020#ifdef _WIN32_ 1020#ifdef _WIN32_
1021 return locateLocal( "tmp", fn ); 1021 return locateLocal( "tmp", fn );
1022#else 1022#else
1023 return (QString( "/tmp/" )+ fn ); 1023 return (QString( "/tmp/" )+ fn );
1024#endif 1024#endif
1025} 1025}
1026 1026
1027void KSyncManager::syncPi() 1027void KSyncManager::syncPi()
1028{ 1028{
1029 mIsKapiFile = true; 1029 mIsKapiFile = true;
1030 mPisyncFinished = false; 1030 mPisyncFinished = false;
1031 qApp->processEvents(); 1031 qApp->processEvents();
1032 if ( mAskForPreferences ) 1032 if ( mAskForPreferences )
1033 if ( !edit_pisync_options()) { 1033 if ( !edit_pisync_options()) {
1034 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 1034 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
1035 return; 1035 return;
1036 } 1036 }
1037 bool ok; 1037 bool ok;
1038 Q_UINT16 port = mActiveSyncPort.toUInt(&ok); 1038 Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
1039 if ( ! ok ) { 1039 if ( ! ok ) {
1040 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 1040 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
1041 return; 1041 return;
1042 } 1042 }
1043 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); 1043 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this );
1044 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 1044 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
1045 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); 1045 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") );
1046 commandSocket->readFile( syncFileName() ); 1046 commandSocket->readFile( syncFileName() );
1047} 1047}
1048 1048
1049void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) 1049void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
1050{ 1050{
1051 //enum { success, errorW, errorR, quiet }; 1051 //enum { success, errorW, errorR, quiet };
1052 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { 1052 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) {
1053 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); 1053 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
1054 delete s; 1054 delete s;
1055 if ( state == KCommandSocket::errorR ) { 1055 if ( state == KCommandSocket::errorR ) {
1056 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); 1056 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
1057 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1057 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1058 commandSocket->sendStop(); 1058 commandSocket->sendStop();
1059 } 1059 }
1060 mPisyncFinished = true; 1060 mPisyncFinished = true;
1061 return; 1061 return;
1062 1062
1063 } else if ( state == KCommandSocket::errorW ) { 1063 } else if ( state == KCommandSocket::errorW ) {
1064 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); 1064 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
1065 mPisyncFinished = true; 1065 mPisyncFinished = true;
1066 1066
1067 } else if ( state == KCommandSocket::successR ) { 1067 } else if ( state == KCommandSocket::successR ) {
1068 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); 1068 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
1069 1069
1070 } else if ( state == KCommandSocket::successW ) { 1070 } else if ( state == KCommandSocket::successW ) {
1071 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1071 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1072 mPisyncFinished = true; 1072 mPisyncFinished = true;
1073 } 1073 }
1074 1074
1075 delete s; 1075 delete s;
1076} 1076}
1077 1077
1078void KSyncManager::readFileFromSocket() 1078void KSyncManager::readFileFromSocket()
1079{ 1079{
1080 QString fileName = syncFileName(); 1080 QString fileName = syncFileName();
1081 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); 1081 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
1082 if ( ! syncWithFile( fileName , true ) ) { 1082 if ( ! syncWithFile( fileName , true ) ) {
1083 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); 1083 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
1084 mPisyncFinished = true; 1084 mPisyncFinished = true;
1085 return; 1085 return;
1086 } 1086 }
1087 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); 1087 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
1088 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1088 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1089 if ( mWriteBackFile ) 1089 if ( mWriteBackFile )
1090 commandSocket->writeFile( fileName ); 1090 commandSocket->writeFile( fileName );
1091 else { 1091 else {
1092 commandSocket->sendStop(); 1092 commandSocket->sendStop();
1093 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1093 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1094 mPisyncFinished = true; 1094 mPisyncFinished = true;
1095 } 1095 }
1096} 1096}
1097 1097
1098KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 1098KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
1099{ 1099{
1100 mPassWord = pw; 1100 mPassWord = pw;
1101 mSocket = 0; 1101 mSocket = 0;
1102 mSyncActionDialog = 0; 1102 mSyncActionDialog = 0;
1103 blockRC = false; 1103 blockRC = false;
1104}; 1104};
1105 1105
1106void KServerSocket::newConnection ( int socket ) 1106void KServerSocket::newConnection ( int socket )
1107{ 1107{
1108 // qDebug("KServerSocket:New connection %d ", socket); 1108 // qDebug("KServerSocket:New connection %d ", socket);
1109 if ( mSocket ) { 1109 if ( mSocket ) {
1110 qDebug("KServerSocket::newConnection Socket deleted! "); 1110 qDebug("KServerSocket::newConnection Socket deleted! ");
1111 delete mSocket; 1111 delete mSocket;
1112 mSocket = 0; 1112 mSocket = 0;
1113 } 1113 }
1114 mSocket = new QSocket( this ); 1114 mSocket = new QSocket( this );
1115 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 1115 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
1116 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 1116 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
1117 mSocket->setSocket( socket ); 1117 mSocket->setSocket( socket );
1118} 1118}
1119 1119
1120void KServerSocket::discardClient() 1120void KServerSocket::discardClient()
1121{ 1121{
1122 //qDebug(" KServerSocket::discardClient()"); 1122 //qDebug(" KServerSocket::discardClient()");
1123 if ( mSocket ) { 1123 if ( mSocket ) {
1124 delete mSocket; 1124 delete mSocket;
1125 mSocket = 0; 1125 mSocket = 0;
1126 } 1126 }
1127 //emit endConnect(); 1127 //emit endConnect();
1128} 1128}
1129void KServerSocket::readClient() 1129void KServerSocket::readClient()
1130{ 1130{
1131 if ( blockRC ) 1131 if ( blockRC )
1132 return; 1132 return;
1133 if ( mSocket == 0 ) { 1133 if ( mSocket == 0 ) {
1134 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); 1134 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
1135 return; 1135 return;
1136 } 1136 }
1137 //qDebug("KServerSocket::readClient()"); 1137 //qDebug("KServerSocket::readClient()");
1138 if ( mSocket->canReadLine() ) { 1138 if ( mSocket->canReadLine() ) {
1139 QString line = mSocket->readLine(); 1139 QString line = mSocket->readLine();
1140 //qDebug("KServerSocket readline: %s ", line.latin1()); 1140 //qDebug("KServerSocket readline: %s ", line.latin1());
1141 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 1141 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
1142 if ( tokens[0] == "GET" ) { 1142 if ( tokens[0] == "GET" ) {
1143 if ( tokens[1] == mPassWord ) { 1143 if ( tokens[1] == mPassWord ) {
1144 //emit sendFile( mSocket ); 1144 //emit sendFile( mSocket );
1145 bool ok = false; 1145 bool ok = false;
1146 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); 1146 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
1147 if ( ok ) { 1147 if ( ok ) {
1148 KSyncManager::mRequestedSyncEvent = dt; 1148 KSyncManager::mRequestedSyncEvent = dt;
1149 } 1149 }
1150 else 1150 else
1151 KSyncManager::mRequestedSyncEvent = QDateTime(); 1151 KSyncManager::mRequestedSyncEvent = QDateTime();
1152 send_file(); 1152 send_file();
1153 } 1153 }
1154 else { 1154 else {
1155 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); 1155 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"));
1156 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1156 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1157 } 1157 }
1158 } 1158 }
1159 if ( tokens[0] == "PUT" ) { 1159 if ( tokens[0] == "PUT" ) {
1160 if ( tokens[1] == mPassWord ) { 1160 if ( tokens[1] == mPassWord ) {
1161 //emit getFile( mSocket ); 1161 //emit getFile( mSocket );
1162 blockRC = true; 1162 blockRC = true;
1163 get_file(); 1163 get_file();
1164 } 1164 }
1165 else { 1165 else {
1166 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); 1166 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"));
1167 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1167 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1168 } 1168 }
1169 } 1169 }
1170 if ( tokens[0] == "STOP" ) { 1170 if ( tokens[0] == "STOP" ) {
1171 //emit endConnect(); 1171 //emit endConnect();
1172 end_connect(); 1172 end_connect();
1173 } 1173 }
1174 } 1174 }
1175} 1175}
1176void KServerSocket::end_connect() 1176void KServerSocket::end_connect()
1177{ 1177{
1178 delete mSyncActionDialog; 1178 delete mSyncActionDialog;
1179 mSyncActionDialog = 0; 1179 mSyncActionDialog = 0;
1180} 1180}
1181void KServerSocket::send_file() 1181void KServerSocket::send_file()
1182{ 1182{
1183 //qDebug("MainWindow::sendFile(QSocket* s) "); 1183 //qDebug("MainWindow::sendFile(QSocket* s) ");
1184 if ( mSyncActionDialog ) 1184 if ( mSyncActionDialog )
1185 delete mSyncActionDialog; 1185 delete mSyncActionDialog;
1186 mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); 1186 mSyncActionDialog = new QDialog ( 0, "input-dialog", true );
1187 mSyncActionDialog->setCaption(i18n("Received sync request")); 1187 mSyncActionDialog->setCaption(i18n("Received sync request"));
1188 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); 1188 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
1189 label->setAlignment ( Qt::AlignHCenter ); 1189 label->setAlignment ( Qt::AlignHCenter );
1190 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 1190 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
1191 lay->addWidget( label); 1191 lay->addWidget( label);
1192 lay->setMargin(7); 1192 lay->setMargin(7);
1193 lay->setSpacing(7); 1193 lay->setSpacing(7);
1194 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1194 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1195 int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); 1195 int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent );
1196 if ( secs < 0 ) 1196 if ( secs < 0 )
1197 secs = secs * (-1); 1197 secs = secs * (-1);
1198 if ( secs > 30 ) 1198 if ( secs > 30 )
1199 //if ( true ) 1199 //if ( true )
1200 { 1200 {
1201 QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); 1201 QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs );
1202 QLabel* label = new QLabel( warning, mSyncActionDialog ); 1202 QLabel* label = new QLabel( warning, mSyncActionDialog );
1203 label->setAlignment ( Qt::AlignHCenter ); 1203 label->setAlignment ( Qt::AlignHCenter );
1204 lay->addWidget( label); 1204 lay->addWidget( label);
1205 if ( secs > 180 ) 1205 if ( secs > 180 )
1206 { 1206 {
1207 if ( secs > 300 ) { 1207 if ( secs > 300 ) {
1208 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { 1208 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) {
1209 qDebug("cancelled "); 1209 qDebug("cancelled ");
1210 return ; 1210 return ;
1211 } 1211 }
1212 } 1212 }
1213 QFont f = label->font(); 1213 QFont f = label->font();
1214 f.setPointSize ( f.pointSize() *2 ); 1214 f.setPointSize ( f.pointSize() *2 );
1215 f. setBold (true ); 1215 f. setBold (true );
1216 QLabel* label = new QLabel( warning, mSyncActionDialog ); 1216 QLabel* label = new QLabel( warning, mSyncActionDialog );
1217 label->setFont( f ); 1217 label->setFont( f );
1218 warning = i18n("ADJUST\nYOUR\nCLOCKS!"); 1218 warning = i18n("ADJUST\nYOUR\nCLOCKS!");
1219 label->setText( warning ); 1219 label->setText( warning );
1220 label->setAlignment ( Qt::AlignHCenter ); 1220 label->setAlignment ( Qt::AlignHCenter );
1221 lay->addWidget( label); 1221 lay->addWidget( label);
1222 mSyncActionDialog->setFixedSize( 230, 300); 1222 mSyncActionDialog->setFixedSize( 230, 300);
1223 } else { 1223 } else {
1224 mSyncActionDialog->setFixedSize( 230, 200); 1224 mSyncActionDialog->setFixedSize( 230, 200);
1225 } 1225 }
1226 } else { 1226 } else {
1227 mSyncActionDialog->setFixedSize( 230, 120); 1227 mSyncActionDialog->setFixedSize( 230, 120);
1228 } 1228 }
1229 } else 1229 } else
1230 mSyncActionDialog->setFixedSize( 230, 120); 1230 mSyncActionDialog->setFixedSize( 230, 120);
1231 mSyncActionDialog->show(); 1231 mSyncActionDialog->show();
1232 mSyncActionDialog->raise(); 1232 mSyncActionDialog->raise();
1233 emit request_file(); 1233 emit request_file();
1234 qApp->processEvents(); 1234 qApp->processEvents();
1235 QString fileName = mFileName; 1235 QString fileName = mFileName;
1236 QFile file( fileName ); 1236 QFile file( fileName );
1237 if (!file.open( IO_ReadOnly ) ) { 1237 if (!file.open( IO_ReadOnly ) ) {
1238 delete mSyncActionDialog; 1238 delete mSyncActionDialog;
1239 mSyncActionDialog = 0; 1239 mSyncActionDialog = 0;
1240 qDebug("KSS::error open sync file: %s ", fileName.latin1()); 1240 qDebug("KSS::error open sync file: %s ", fileName.latin1());
1241 mSocket->close(); 1241 mSocket->close();
1242 if ( mSocket->state() == QSocket::Idle ) 1242 if ( mSocket->state() == QSocket::Idle )
1243 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1243 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1244 return ; 1244 return ;
1245 1245
1246 } 1246 }
1247 mSyncActionDialog->setCaption( i18n("Sending file...") ); 1247 mSyncActionDialog->setCaption( i18n("Sending file...") );
1248 QTextStream ts( &file ); 1248 QTextStream ts( &file );
1249 ts.setEncoding( QTextStream::Latin1 ); 1249 ts.setEncoding( QTextStream::Latin1 );
1250 1250
1251 QTextStream os( mSocket ); 1251 QTextStream os( mSocket );
1252 os.setEncoding( QTextStream::Latin1 ); 1252 os.setEncoding( QTextStream::Latin1 );
1253 while ( ! ts.atEnd() ) { 1253 while ( ! ts.atEnd() ) {
1254 os << ts.readLine() << "\r\n"; 1254 os << ts.readLine() << "\r\n";
1255 } 1255 }
1256 //os << ts.read(); 1256 //os << ts.read();
1257 file.close(); 1257 file.close();
1258 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); 1258 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
1259 mSocket->close(); 1259 mSocket->close();
1260 if ( mSocket->state() == QSocket::Idle ) 1260 if ( mSocket->state() == QSocket::Idle )
1261 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1261 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1262} 1262}
1263void KServerSocket::get_file() 1263void KServerSocket::get_file()
1264{ 1264{
1265 mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); 1265 mSyncActionDialog->setCaption( i18n("Receiving synced file...") );
1266 1266
1267 piTime.start(); 1267 piTime.start();
1268 piFileString = ""; 1268 piFileString = "";
1269 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); 1269 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) ));
1270} 1270}
1271 1271
1272 1272
1273void KServerSocket::readBackFileFromSocket() 1273void KServerSocket::readBackFileFromSocket()
1274{ 1274{
1275 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); 1275 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
1276 while ( mSocket->canReadLine () ) { 1276 while ( mSocket->canReadLine () ) {
1277 piTime.restart(); 1277 piTime.restart();
1278 QString line = mSocket->readLine (); 1278 QString line = mSocket->readLine ();
1279 piFileString += line; 1279 piFileString += line;
1280 //qDebug("readline: %s ", line.latin1()); 1280 //qDebug("readline: %s ", line.latin1());
1281 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); 1281 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
1282 1282
1283 } 1283 }
1284 if ( piTime.elapsed () < 3000 ) { 1284 if ( piTime.elapsed () < 3000 ) {
1285 // wait for more 1285 // wait for more
1286 //qDebug("waitformore "); 1286 //qDebug("waitformore ");
1287 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); 1287 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
1288 return; 1288 return;
1289 } 1289 }
1290 QString fileName = mFileName; 1290 QString fileName = mFileName;
1291 QFile file ( fileName ); 1291 QFile file ( fileName );
1292 if (!file.open( IO_WriteOnly ) ) { 1292 if (!file.open( IO_WriteOnly ) ) {
1293 delete mSyncActionDialog; 1293 delete mSyncActionDialog;
1294 mSyncActionDialog = 0; 1294 mSyncActionDialog = 0;
1295 qDebug("KSS:Error open read back file "); 1295 qDebug("KSS:Error open read back file ");
1296 piFileString = ""; 1296 piFileString = "";
1297 emit file_received( false ); 1297 emit file_received( false );
1298 blockRC = false; 1298 blockRC = false;
1299 return ; 1299 return ;
1300 1300
1301 } 1301 }
1302 1302
1303 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1303 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1304 QTextStream ts ( &file ); 1304 QTextStream ts ( &file );
1305 ts.setEncoding( QTextStream::Latin1 ); 1305 ts.setEncoding( QTextStream::Latin1 );
1306 mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); 1306 mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
1307 ts << piFileString; 1307 ts << piFileString;
1308 mSocket->close(); 1308 mSocket->close();
1309 if ( mSocket->state() == QSocket::Idle ) 1309 if ( mSocket->state() == QSocket::Idle )
1310 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1310 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1311 file.close(); 1311 file.close();
1312 piFileString = ""; 1312 piFileString = "";
1313 emit file_received( true ); 1313 emit file_received( true );
1314 delete mSyncActionDialog; 1314 delete mSyncActionDialog;
1315 mSyncActionDialog = 0; 1315 mSyncActionDialog = 0;
1316 blockRC = false; 1316 blockRC = false;
1317 1317
1318} 1318}
1319 1319
1320KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) 1320KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name )
1321{ 1321{
1322 mPassWord = password; 1322 mPassWord = password;
1323 mSocket = 0; 1323 mSocket = 0;
1324 mPort = port; 1324 mPort = port;
1325 mHost = host; 1325 mHost = host;
1326 1326
1327 mRetVal = quiet; 1327 mRetVal = quiet;
1328 mTimerSocket = new QTimer ( this ); 1328 mTimerSocket = new QTimer ( this );
1329 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); 1329 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) );
1330} 1330}
1331void KCommandSocket::readFile( QString fn ) 1331void KCommandSocket::readFile( QString fn )
1332{ 1332{
1333 if ( !mSocket ) { 1333 if ( !mSocket ) {
1334 mSocket = new QSocket( this ); 1334 mSocket = new QSocket( this );
1335 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); 1335 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
1336 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1336 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1337 } 1337 }
1338 mFileString = ""; 1338 mFileString = "";
1339 mFileName = fn; 1339 mFileName = fn;
1340 mFirst = true; 1340 mFirst = true;
1341 mSocket->connectToHost( mHost, mPort ); 1341 mSocket->connectToHost( mHost, mPort );
1342 QTextStream os( mSocket ); 1342 QTextStream os( mSocket );
1343 os.setEncoding( QTextStream::Latin1 ); 1343 os.setEncoding( QTextStream::Latin1 );
1344 1344
1345 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); 1345 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
1346 os << "GET " << mPassWord << curDt <<"\r\n"; 1346 os << "GET " << mPassWord << curDt <<"\r\n";
1347 mTimerSocket->start( 20000 ); 1347 mTimerSocket->start( 300000 );
1348} 1348}
1349 1349
1350void KCommandSocket::writeFile( QString fileName ) 1350void KCommandSocket::writeFile( QString fileName )
1351{ 1351{
1352 if ( !mSocket ) { 1352 if ( !mSocket ) {
1353 mSocket = new QSocket( this ); 1353 mSocket = new QSocket( this );
1354 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1354 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1355 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); 1355 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
1356 } 1356 }
1357 mFileName = fileName ; 1357 mFileName = fileName ;
1358 mSocket->connectToHost( mHost, mPort ); 1358 mSocket->connectToHost( mHost, mPort );
1359} 1359}
1360void KCommandSocket::writeFileToSocket() 1360void KCommandSocket::writeFileToSocket()
1361{ 1361{
1362 QFile file2( mFileName ); 1362 QFile file2( mFileName );
1363 if (!file2.open( IO_ReadOnly ) ) { 1363 if (!file2.open( IO_ReadOnly ) ) {
1364 mRetVal= errorW; 1364 mRetVal= errorW;
1365 mSocket->close(); 1365 mSocket->close();
1366 if ( mSocket->state() == QSocket::Idle ) 1366 if ( mSocket->state() == QSocket::Idle )
1367 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1367 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1368 return ; 1368 return ;
1369 } 1369 }
1370 QTextStream ts2( &file2 ); 1370 QTextStream ts2( &file2 );
1371 ts2.setEncoding( QTextStream::Latin1 ); 1371 ts2.setEncoding( QTextStream::Latin1 );
1372 QTextStream os2( mSocket ); 1372 QTextStream os2( mSocket );
1373 os2.setEncoding( QTextStream::Latin1 ); 1373 os2.setEncoding( QTextStream::Latin1 );
1374 os2 << "PUT " << mPassWord << "\r\n";; 1374 os2 << "PUT " << mPassWord << "\r\n";;
1375 while ( ! ts2.atEnd() ) { 1375 while ( ! ts2.atEnd() ) {
1376 os2 << ts2.readLine() << "\r\n"; 1376 os2 << ts2.readLine() << "\r\n";
1377 } 1377 }
1378 mRetVal= successW; 1378 mRetVal= successW;
1379 file2.close(); 1379 file2.close();
1380 mSocket->close(); 1380 mSocket->close();
1381 if ( mSocket->state() == QSocket::Idle ) 1381 if ( mSocket->state() == QSocket::Idle )
1382 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1382 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1383} 1383}
1384void KCommandSocket::sendStop() 1384void KCommandSocket::sendStop()
1385{ 1385{
1386 if ( !mSocket ) { 1386 if ( !mSocket ) {
1387 mSocket = new QSocket( this ); 1387 mSocket = new QSocket( this );
1388 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1388 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1389 } 1389 }
1390 mSocket->connectToHost( mHost, mPort ); 1390 mSocket->connectToHost( mHost, mPort );
1391 QTextStream os2( mSocket ); 1391 QTextStream os2( mSocket );
1392 os2.setEncoding( QTextStream::Latin1 ); 1392 os2.setEncoding( QTextStream::Latin1 );
1393 os2 << "STOP\r\n"; 1393 os2 << "STOP\r\n";
1394 mSocket->close(); 1394 mSocket->close();
1395 if ( mSocket->state() == QSocket::Idle ) 1395 if ( mSocket->state() == QSocket::Idle )
1396 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1396 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1397} 1397}
1398 1398
1399void KCommandSocket::startReadFileFromSocket() 1399void KCommandSocket::startReadFileFromSocket()
1400{ 1400{
1401 if ( ! mFirst ) 1401 if ( ! mFirst )
1402 return; 1402 return;
1403 mFirst = false; 1403 mFirst = false;
1404 mTimerSocket->stop(); 1404 mTimerSocket->stop();
1405 mFileString = ""; 1405 mFileString = "";
1406 mTime.start(); 1406 mTime.start();
1407 QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); 1407 QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) ));
1408 1408
1409} 1409}
1410void KCommandSocket::readFileFromSocket() 1410void KCommandSocket::readFileFromSocket()
1411{ 1411{
1412 //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); 1412 //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
1413 while ( mSocket->canReadLine () ) { 1413 while ( mSocket->canReadLine () ) {
1414 mTime.restart(); 1414 mTime.restart();
1415 QString line = mSocket->readLine (); 1415 QString line = mSocket->readLine ();
1416 mFileString += line; 1416 mFileString += line;
1417 //qDebug("readline: %s ", line.latin1()); 1417 //qDebug("readline: %s ", line.latin1());
1418 } 1418 }
1419 if ( mTime.elapsed () < 3000 ) { 1419 if ( mTime.elapsed () < 3000 ) {
1420 // wait for more 1420 // wait for more
1421 //qDebug("waitformore "); 1421 //qDebug("waitformore ");
1422 QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); 1422 QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) ));
1423 return; 1423 return;
1424 } 1424 }
1425 QString fileName = mFileName; 1425 QString fileName = mFileName;
1426 QFile file ( fileName ); 1426 QFile file ( fileName );
1427 if (!file.open( IO_WriteOnly ) ) { 1427 if (!file.open( IO_WriteOnly ) ) {
1428 mFileString = ""; 1428 mFileString = "";
1429 mRetVal = errorR; 1429 mRetVal = errorR;
1430 qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() ); 1430 qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() );
1431 deleteSocket(); 1431 deleteSocket();
1432 return ; 1432 return ;
1433 1433
1434 } 1434 }
1435 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1435 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1436 QTextStream ts ( &file ); 1436 QTextStream ts ( &file );
1437 ts.setEncoding( QTextStream::Latin1 ); 1437 ts.setEncoding( QTextStream::Latin1 );
1438 ts << mFileString; 1438 ts << mFileString;
1439 file.close(); 1439 file.close();
1440 mFileString = ""; 1440 mFileString = "";
1441 mRetVal = successR; 1441 mRetVal = successR;
1442 mSocket->close(); 1442 mSocket->close();
1443 // if state is not idle, deleteSocket(); is called via 1443 // if state is not idle, deleteSocket(); is called via
1444 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1444 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1445 if ( mSocket->state() == QSocket::Idle ) 1445 if ( mSocket->state() == QSocket::Idle )
1446 deleteSocket(); 1446 deleteSocket();
1447} 1447}
1448 1448
1449void KCommandSocket::deleteSocket() 1449void KCommandSocket::deleteSocket()
1450{ 1450{
1451 //qDebug("KCommandSocket::deleteSocket() "); 1451 //qDebug("KCommandSocket::deleteSocket() ");
1452 if ( mTimerSocket->isActive () ) { 1452 if ( mTimerSocket->isActive () ) {
1453 mTimerSocket->stop(); 1453 mTimerSocket->stop();
1454 mRetVal = errorTO; 1454 mRetVal = errorTO;
1455 qDebug("Connection to remote host timed out"); 1455 qDebug("Connection to remote host timed out");
1456 if ( mSocket ) { 1456 if ( mSocket ) {
1457 mSocket->close(); 1457 mSocket->close();
1458 //if ( mSocket->state() == QSocket::Idle ) 1458 //if ( mSocket->state() == QSocket::Idle )
1459 // deleteSocket(); 1459 // deleteSocket();
1460 delete mSocket; 1460 delete mSocket;
1461 mSocket = 0; 1461 mSocket = 0;
1462 } 1462 }
1463 KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); 1463 KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? "));
1464 emit commandFinished( this, mRetVal ); 1464 emit commandFinished( this, mRetVal );
1465 return; 1465 return;
1466 } 1466 }
1467 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); 1467 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
1468 if ( mSocket) 1468 if ( mSocket)
1469 delete mSocket; 1469 delete mSocket;
1470 mSocket = 0; 1470 mSocket = 0;
1471 emit commandFinished( this, mRetVal ); 1471 emit commandFinished( this, mRetVal );
1472} 1472}