summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile662
-rw-r--r--korganizer/koeventviewer.cpp94
-rw-r--r--korganizer/komonthview.cpp5
-rw-r--r--libkcal/kincidenceformatter.cpp65
4 files changed, 379 insertions, 447 deletions
diff --git a/Makefile b/Makefile
index 594d47d..aa6e562 100644
--- a/Makefile
+++ b/Makefile
@@ -1,385 +1,279 @@
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.4) on: Fri Apr 15 10:15:45 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-kabc-plugins-file \
18 libical/src/libicalss \ 18 sub-kabc-plugins-dir \
19 qtcompat \ 19 sub-kabc-plugins-qtopia \
20 microkde \ 20 sub-libical \
21 libkcal \ 21 sub-libkcal \
22 libkdepim \ 22 sub-kabc \
23 kabc \ 23 sub-libkdepim \
24 kabc/formats/binary \ 24 sub-microkde \
25 kabc/plugins/file \ 25 sub-korganizer \
26 kabc/plugins/dir \ 26 sub-kaddressbook \
27 korganizer \ 27 sub-gammu-emb-common \
28 kalarmd \ 28 sub-gammu-emb-gammu \
29 kaddressbook 29 sub-libetpan \
30 30 sub-kmicromail-libmailwrapper \
31SUBDIRS_QTOPIA_PLUGIN = \ 31 sub-kmicromail \
32 kabc/plugins/qtopia 32 sub-pwmanager-libcrypt-cipher \
33 33 sub-pwmanager-libcrypt-error \
34SUBDIRS_OPIE_PLUGIN = \ 34 sub-pwmanager-libcrypt-mpi \
35 kabc/plugins/opie 35 sub-pwmanager-libcrypt-zlib \
36 36 sub-pwmanager-pwmanager
37SUBDIRS_SHARP_PLUGIN = \ 37
38 kabc/plugins/sharpdtm 38first: all
39 39
40SUBDIRS_LDAP_PLUGIN = \ 40all: Makefile $(SUBTARGETS)
41 kabc/plugins/ldap 41
42 42kabc/plugins/file/$(MAKEFILE):
43SUBDIRS_MICROMAIL = \ 43 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
44 libetpan \ 44 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE)
45 kmicromail/libmailwrapper \ 45sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
46 kmicromail 46 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
47 47
48SUBDIRS_GAMMU = \ 48kabc/plugins/dir/$(MAKEFILE):
49 gammu/emb/common \ 49 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
50 gammu/emb/gammu 50 cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE)
51 51sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
52SUBDIRS_PWMANAGER = \ 52 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
53 pwmanager/libcrypt/mpi \ 53
54 pwmanager/libcrypt/error \ 54kabc/plugins/qtopia/$(MAKEFILE):
55 pwmanager/libcrypt/cipher \ 55 @$(CHK_DIR_EXISTS) "kabc/plugins/qtopia" || $(MKDIR) "kabc/plugins/qtopia"
56 pwmanager/libcrypt/zlib \ 56 cd kabc/plugins/qtopia && $(QMAKE) qtopia.pro -o $(MAKEFILE)
57 pwmanager/pwmanager 57sub-kabc-plugins-qtopia: kabc/plugins/qtopia/$(MAKEFILE) FORCE
58 58 cd kabc/plugins/qtopia && $(MAKE) -f $(MAKEFILE)
59SUBDIRS = \ 59
60 $(SUBDIRS_MICROKDE) \ 60libical/$(MAKEFILE):
61 $(SUBDIRS_QTOPIA_PLUGIN) \ 61 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
62 $(SUBDIRS_OPIE_PLUGIN) \ 62 cd libical && $(QMAKE) libical.pro -o $(MAKEFILE)
63 $(SUBDIRS_SHARP_PLUGIN) \ 63sub-libical: libical/$(MAKEFILE) FORCE
64 $(SUBDIRS_LDAP_PLUGIN) \ 64 cd libical && $(MAKE) -f $(MAKEFILE)
65 $(SUBDIRS_MICROMAIL) \ 65
66 $(SUBDIRS_GAMMU) \ 66libkcal/$(MAKEFILE):
67 $(SUBDIRS_PWMANAGER) 67 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
68 68 cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE)
69 69sub-libkcal: libkcal/$(MAKEFILE) FORCE
70all: build_microkde \ 70 cd libkcal && $(MAKE) -f $(MAKEFILE)
71 build_qtopia_plugin \ 71
72 build_opie_plugin \ 72kabc/$(MAKEFILE):
73 build_sharp_plugin \ 73 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
74 build_ldap_plugin \ 74 cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE)
75 build_micromail \ 75sub-kabc: kabc/$(MAKEFILE) FORCE
76 build_gammu \ 76 cd kabc && $(MAKE) -f $(MAKEFILE)
77 build_pwmanager 77
78 78libkdepim/$(MAKEFILE):
79 79 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
80build_microkde: variable_test tmake 80 cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE)
81 for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ 81sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
82 make -f Makefile$(PLATFORM) || exit 1; popd; \ 82 cd libkdepim && $(MAKE) -f $(MAKEFILE)
83 done 83
84 84microkde/$(MAKEFILE):
85build_qtopia_plugin: build_microkde 85 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
86 ifdef BUILD_NO_QTOPIA_PLUGIN 86 cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE)
87 @echo == qtopia plugin not build. 87sub-microkde: microkde/$(MAKEFILE) FORCE
88 else 88 cd microkde && $(MAKE) -f $(MAKEFILE)
89 for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ 89
90 make -f Makefile$(PLATFORM) || exit 1; popd; \ 90korganizer/$(MAKEFILE):
91 done 91 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
92 endif 92 cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE)
93 93sub-korganizer: korganizer/$(MAKEFILE) FORCE
94build_opie_plugin: build_microkde 94 cd korganizer && $(MAKE) -f $(MAKEFILE)
95 ifdef BUILD_NO_OPIE_PLUGIN 95
96 @echo == opie plugin not build. 96kaddressbook/$(MAKEFILE):
97 else 97 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
98 for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ 98 cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE)
99 make -f Makefile$(PLATFORM) || exit 1; popd; \ 99sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
100 done 100 cd kaddressbook && $(MAKE) -f $(MAKEFILE)
101 endif 101
102 102gammu/emb/common/$(MAKEFILE):
103build_sharp_plugin: build_microkde 103 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common"
104 ifdef BUILD_NO_SHARP_PLUGIN 104 cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE)
105 @echo == ldap plugin not build. 105sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE
106 else 106 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE)
107 for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \ 107
108 make -f Makefile$(PLATFORM) || exit 1; popd; \ 108gammu/emb/gammu/$(MAKEFILE):
109 done 109 @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu"
110 endif 110 cd gammu/emb/gammu && $(QMAKE) gammu.pro -o $(MAKEFILE)
111 111sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE
112build_ldap_plugin: build_microkde 112 cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE)
113 ifdef BUILD_NO_LDAP_PLUGIN 113
114 @echo == ldap plugin not build. 114libetpan/$(MAKEFILE):
115 else 115 @$(CHK_DIR_EXISTS) "libetpan" || $(MKDIR) "libetpan"
116 for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \ 116 cd libetpan && $(QMAKE) libetpan.pro -o $(MAKEFILE)
117 make -f Makefile$(PLATFORM) || exit 1; popd; \ 117sub-libetpan: libetpan/$(MAKEFILE) FORCE
118 done 118 cd libetpan && $(MAKE) -f $(MAKEFILE)
119 endif 119
120 120kmicromail/libmailwrapper/$(MAKEFILE):
121 121 @$(CHK_DIR_EXISTS) "kmicromail/libmailwrapper" || $(MKDIR) "kmicromail/libmailwrapper"
122build_micromail: build_microkde 122 cd kmicromail/libmailwrapper && $(QMAKE) libmailwrapper.pro -o $(MAKEFILE)
123 ifdef BUILD_NO_MICROMAIL 123sub-kmicromail-libmailwrapper: kmicromail/libmailwrapper/$(MAKEFILE) FORCE
124 @echo == kmicromail not build. 124 cd kmicromail/libmailwrapper && $(MAKE) -f $(MAKEFILE)
125 else 125
126 for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ 126kmicromail/$(MAKEFILE):
127 make -f Makefile$(PLATFORM) || exit 1; popd; \ 127 @$(CHK_DIR_EXISTS) "kmicromail" || $(MKDIR) "kmicromail"
128 done 128 cd kmicromail && $(QMAKE) kmicromail.pro -o $(MAKEFILE)
129 endif 129sub-kmicromail: kmicromail/$(MAKEFILE) FORCE
130 130 cd kmicromail && $(MAKE) -f $(MAKEFILE)
131build_gammu: variable_test tmake 131
132 ifdef BUILD_NO_GAMMU 132pwmanager/libcrypt/cipher/$(MAKEFILE):
133 @echo == gammu not build. 133 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/cipher" || $(MKDIR) "pwmanager/libcrypt/cipher"
134 else 134 cd pwmanager/libcrypt/cipher && $(QMAKE) cipher.pro -o $(MAKEFILE)
135 for i in $(SUBDIRS_GAMMU); do pushd $$i; \ 135sub-pwmanager-libcrypt-cipher: pwmanager/libcrypt/cipher/$(MAKEFILE) FORCE
136 make -f Makefile$(PLATFORM) || exit 1; popd; \ 136 cd pwmanager/libcrypt/cipher && $(MAKE) -f $(MAKEFILE)
137 done 137
138 endif 138pwmanager/libcrypt/error/$(MAKEFILE):
139 139 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/error" || $(MKDIR) "pwmanager/libcrypt/error"
140build_pwmanager: build_microkde 140 cd pwmanager/libcrypt/error && $(QMAKE) error.pro -o $(MAKEFILE)
141 ifdef BUILD_NO_PWMANAGER 141sub-pwmanager-libcrypt-error: pwmanager/libcrypt/error/$(MAKEFILE) FORCE
142 @echo == pwmanager not build. 142 cd pwmanager/libcrypt/error && $(MAKE) -f $(MAKEFILE)
143 else 143
144 for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \ 144pwmanager/libcrypt/mpi/$(MAKEFILE):
145 make -f Makefile$(PLATFORM) || exit 1; popd; \ 145 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/mpi" || $(MKDIR) "pwmanager/libcrypt/mpi"
146 done 146 cd pwmanager/libcrypt/mpi && $(QMAKE) mpi.pro -o $(MAKEFILE)
147 endif 147sub-pwmanager-libcrypt-mpi: pwmanager/libcrypt/mpi/$(MAKEFILE) FORCE
148 148 cd pwmanager/libcrypt/mpi && $(MAKE) -f $(MAKEFILE)
149 149
150variable_info: 150pwmanager/libcrypt/zlib/$(MAKEFILE):
151 @echo -------------------------------------- 151 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/zlib" || $(MKDIR) "pwmanager/libcrypt/zlib"
152 @echo KDEPIM buildsystem, variableinfo... 152 cd pwmanager/libcrypt/zlib && $(QMAKE) zlib.pro -o $(MAKEFILE)
153 @echo KDEPIMDIR=$(KDEPIMDIR) 153sub-pwmanager-libcrypt-zlib: pwmanager/libcrypt/zlib/$(MAKEFILE) FORCE
154 @echo QTDIR=$(QTDIR) 154 cd pwmanager/libcrypt/zlib && $(MAKE) -f $(MAKEFILE)
155 @echo QPEDIR=$(QPEDIR) 155
156 @echo OPIEDIR=$(OPIEDIR) 156pwmanager/pwmanager/$(MAKEFILE):
157 @echo PLATFORM=$(PLATFORM) 157 @$(CHK_DIR_EXISTS) "pwmanager/pwmanager" || $(MKDIR) "pwmanager/pwmanager"
158 @echo RELEASE_DEBUG=$(RELEASE_DEBUG) 158 cd pwmanager/pwmanager && $(QMAKE) pwmanager.pro -o $(MAKEFILE)
159 @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) 159sub-pwmanager-pwmanager: pwmanager/pwmanager/$(MAKEFILE) FORCE
160 @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) 160 cd pwmanager/pwmanager && $(MAKE) -f $(MAKEFILE)
161 @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) 161
162 @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN) 162Makefile: kdepim-desktop.pro /usr/lib/qt3/mkspecs/default/qmake.conf variables.pri
163 @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) 163 $(QMAKE) -o Makefile kdepim-desktop.pro
164 ifndef BUILD_NO_SHARP_PLUGIN 164qmake: qmake_all
165 @echo SHARPDTMSDK=$(SHARPDTMSDK) 165 @$(QMAKE) -o Makefile kdepim-desktop.pro
166 endif 166
167 @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU) 167all: $(SUBTARGETS)
168 @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER) 168qmake_all: kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE) kabc/plugins/qtopia/$(MAKEFILE) libical/$(MAKEFILE) libkcal/$(MAKEFILE) kabc/$(MAKEFILE) libkdepim/$(MAKEFILE) microkde/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) gammu/emb/common/$(MAKEFILE) gammu/emb/gammu/$(MAKEFILE) 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)
169 @echo -------------------------------------- 169 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
170 170 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
171variable_test: variable_info 171 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
172 @echo KDEPIM buildsystem, variablecheck... 172 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
173 ifndef KDEPIMDIR 173 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
174 @echo KDEPIMDIR is not defined. 174 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
175 $(error KDEPIMDIR is not defined) 175 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
176 endif 176 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
177 ifndef PLATFORM 177 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
178 @echo PLATFORM is not defined. 178 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
179 $(error PLATFORM is not defined) 179 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
180 endif 180 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
181 ifdef BUILD_NO_LDAP_PLUGIN 181 ( [ -d libetpan ] && cd libetpan ; 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 kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
183 endif 183 ( [ -d kmicromail ] && cd kmicromail ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
184 ifdef BUILD_NO_OPIE_PLUGIN 184 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; 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 pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
186 endif 186 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
187 ifdef BUILD_NO_QTOPIA_PLUGIN 187 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; 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 pwmanager/pwmanager ] && cd pwmanager/pwmanager ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
189 endif 189clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
190 ifdef BUILD_NO_MICROMAIL 190 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
191 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) 191 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
192 endif 192 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; ) || true
193 ifdef BUILD_NO_SHARP_PLUGIN 193 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
194 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) 194 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
195 else 195 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
196 ifndef SHARPDTMSDK 196 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
197 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) 197 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
198 $(error SHARPDTMSDK is not defined) 198 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
199 endif 199 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
200 endif 200 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true
201 ifdef BUILD_NO_GAMMU 201 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true
202 @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU) 202 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) $@; ) || true
203 endif 203 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) $@; ) || true
204 ifdef BUILD_NO_PWMANAGER 204 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) $@; ) || true
205 @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER) 205 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; ) || true
206 endif 206 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; ) || true
207 @echo -------------------------------------- 207 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; ) || true
208 208 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; ) || true
209 209 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; ) || true
210objects: 210uninstall_subdirs: qmake_all FORCE
211 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done 211 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
212 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done 212 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
213 mkdir -p libical/lib/$(PLATFORM) 213 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
214 mkdir -p dest 214 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
215 mkdir -p dest$(LIBICAL_PATH) 215 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
216 mkdir -p pwmanager/libcrypt/$(PLATFORM) 216 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
217 217 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
218clean: 218 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
219 rm -rf libical/lib/$(PLATFORM)/*; 219 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
220 rm -rf pwmanager/libcrypt/$(PLATFORM)/*; 220 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
221 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ 221 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
222 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ 222 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
223 done 223 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
224 224 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
225pac: 225 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
226 rm -f $(QPEDIR)/lib/libmicro* 226 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
227 rm -f $(QPEDIR)/plugins/applets/libkopi* 227 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
228 make 228 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
229 make install 229 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
230 make dist 230 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
231install: 231install_subdirs: qmake_all FORCE
232 232 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
233 cd bin/kdepim; make install 233 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
234 cp -r Pim $(QPEDIR)/apps 234 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) install; ) || true
235 cp db2file/db2file $(QPEDIR)/bin/db2file 235 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
236 chmod ugo+x $(QPEDIR)/bin/db2file 236 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
237 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop 237 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
238 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop 238 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
239 cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop 239 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
240 cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop 240 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
241 241 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
242dist: 242 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true
243 @echo Dont forget to do "make install" before "make dist" 243 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true
244 rm -f *arm.ipk 244 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) install; ) || true
245 rm -f *ipk.zip 245 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) install; ) || true
246 rm -rf ../kdepimpi_$(KDEPIM_VERSION)/* 246 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) install; ) || true
247 rm -f *~ 247 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) install; ) || true
248 cd ..;mkdir -p kdepimpi_$(KDEPIM_VERSION) 248 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) install; ) || true
249 cd ../kdepimpi_$(KDEPIM_VERSION);mkdir -p ipk 249 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) install; ) || true
250 cd ..; tar czf kdepimpi-$(KDEPIM_VERSION).tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim 250 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) install; ) || true
251 mkipks kmicrokdelibs.control 251 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) install; ) || true
252 mkipks korganizer.control 252distclean: qmake_all FORCE
253 mkipks kaddressbook.control 253 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
254 ifndef BUILD_NO_MICROMAIL 254 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
255 mkipks kopiemail.control 255 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
256 endif 256 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
257 ifndef BUILD_NO_SHARP_PLUGIN 257 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
258 mkipks ksharpPIM-DTMaccess.control 258 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
259 endif 259 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
260 mkipks korganizer-alarm.control 260 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
261 ifndef BUILD_NO_GAMMU 261 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
262 mkipks kmobilephoneaccess.control 262 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
263 endif 263 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
264 ifndef BUILD_NO_PWMANAGER 264 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
265 mkipks pwmanager.control 265 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
266 endif 266 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
267 mkipks pimTABicon.control 267 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
268 zip kdepim_$(KDEPIM_VERSION)_for_SharpRom.ipk.zip *.ipk ReleaseNotes.txt 268 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
269 mv *.ipk ../kdepimpi_$(KDEPIM_VERSION)/ipk/ 269 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
270 mv *for_SharpRom.ipk.zip ../kdepimpi_$(KDEPIM_VERSION)/ 270 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
271 mv ../kdepimpi-$(KDEPIM_VERSION).tar.gz ../kdepimpi_$(KDEPIM_VERSION)/ 271 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
272 272 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
273tmake: objects \ 273
274 qtcompat/Makefile$(PLATFORM) \ 274install: install_subdirs
275 microkde/Makefile$(PLATFORM) \ 275
276 libkcal/Makefile$(PLATFORM) \ 276uninstall: uninstall_subdirs
277 libkdepim/Makefile$(PLATFORM) \ 277
278 korganizer/Makefile$(PLATFORM) \ 278FORCE:
279 kalarmd/Makefile$(PLATFORM) \
280 libical/src/libical/Makefile$(PLATFORM) \
281 libical/src/libicalss/Makefile$(PLATFORM) \
282 kabc/Makefile$(PLATFORM) \
283 kabc/formats/binary/Makefile$(PLATFORM) \
284 kabc/plugins/file/Makefile$(PLATFORM) \
285 kabc/plugins/dir/Makefile$(PLATFORM) \
286 kabc/plugins/ldap/Makefile$(PLATFORM) \
287 kabc/plugins/opie/Makefile$(PLATFORM) \
288 kabc/plugins/qtopia/Makefile$(PLATFORM) \
289 kabc/plugins/sharpdtm/Makefile$(PLATFORM) \
290 kaddressbook/Makefile$(PLATFORM) \
291 kmicromail/Makefile$(PLATFORM) \
292 libetpan/Makefile$(PLATFORM) \
293 kmicromail/libmailwrapper/Makefile$(PLATFORM) \
294 gammu/emb/common/Makefile$(PLATFORM) \
295 gammu/emb/gammu/Makefile$(PLATFORM) \
296 pwmanager/pwmanager/Makefile$(PLATFORM) \
297 pwmanager/libcrypt/mpi/Makefile$(PLATFORM) \
298 pwmanager/libcrypt/error/Makefile$(PLATFORM) \
299 pwmanager/libcrypt/cipher/Makefile$(PLATFORM) \
300 pwmanager/libcrypt/zlib/Makefile$(PLATFORM)
301
302qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
303 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtcompat.pro -o Makefile$(PLATFORM)
304
305microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
306 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" microkdeE.pro -o Makefile$(PLATFORM)
307
308libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
309 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkcalE.pro -o Makefile$(PLATFORM)
310
311
312libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
313 cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkdepimE.pro -o Makefile$(PLATFORM)
314
315kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
316 cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kalarmdE.pro -o Makefile$(PLATFORM)
317
318korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
319 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" korganizerE.pro -o Makefile$(PLATFORM)
320
321libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
322 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalE.pro -o Makefile$(PLATFORM)
323
324libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
325 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalssE.pro -o Makefile$(PLATFORM)
326
327kabc/Makefile$(PLATFORM): kabc/kabcE.pro
328 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcE.pro -o Makefile$(PLATFORM)
329
330kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
331 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
332
333kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
334 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" fileE.pro -o Makefile$(PLATFORM)
335
336kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
337 cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" dirE.pro -o Makefile$(PLATFORM)
338
339kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
340 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" ldapE.pro -o Makefile$(PLATFORM)
341
342kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
343 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" opieE.pro -o Makefile$(PLATFORM)
344
345kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
346 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtopiaE.pro -o Makefile$(PLATFORM)
347
348kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro
349 cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" sharpdtmE.pro -o Makefile$(PLATFORM)
350
351kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
352 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kaddressbookE.pro -o Makefile$(PLATFORM)
353
354kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
355 cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kmicromailE.pro -o Makefile$(PLATFORM)
356
357libetpan/Makefile$(PLATFORM): libetpan/libetpanE.pro
358 cd libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libetpanE.pro -o Makefile$(PLATFORM)
359
360kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
361 cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libmailwrapperE.pro -o Makefile$(PLATFORM)
362
363gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro
364 cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" commonE.pro -o Makefile$(PLATFORM)
365
366gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro
367 cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" gammuE.pro -o Makefile$(PLATFORM)
368
369pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro
370 cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" pwmanagerE.pro -o Makefile$(PLATFORM)
371
372
373pwmanager/libcrypt/mpi/Makefile$(PLATFORM): pwmanager/libcrypt/mpi/mpi.pro
374 cd pwmanager/libcrypt/mpi;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" mpi.pro -o Makefile$(PLATFORM)
375
376pwmanager/libcrypt/error/Makefile$(PLATFORM): pwmanager/libcrypt/error/error.pro
377 cd pwmanager/libcrypt/error;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" error.pro -o Makefile$(PLATFORM)
378
379pwmanager/libcrypt/cipher/Makefile$(PLATFORM): pwmanager/libcrypt/cipher/cipher.pro
380 cd pwmanager/libcrypt/cipher;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" cipher.pro -o Makefile$(PLATFORM)
381
382pwmanager/libcrypt/zlib/Makefile$(PLATFORM): pwmanager/libcrypt/zlib/zlib.pro
383 cd pwmanager/libcrypt/zlib;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" zlib.pro -o Makefile$(PLATFORM)
384
385 279
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index bdad248..fefc778 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,771 +1,789 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qcstring.h> 20#include <qcstring.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kapplication.h> 28#include <kapplication.h>
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30#include <libkcal/todo.h> 30#include <libkcal/todo.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include <kprocess.h> 35#include <kprocess.h>
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38#include <kabc/stdaddressbook.h> 38#include <kabc/stdaddressbook.h>
39 39
40#ifndef KORG_NODCOP 40#ifndef KORG_NODCOP
41#include <dcopclient.h> 41#include <dcopclient.h>
42#include "korganizer.h" 42#include "korganizer.h"
43#include "koprefs.h" 43#include "koprefs.h"
44#include "actionmanager.h" 44#include "actionmanager.h"
45#endif 45#endif
46 46
47#include "koeventviewer.h" 47#include "koeventviewer.h"
48//#ifndef KORG_NOKABC 48//#ifndef KORG_NOKABC
49//#include <kabc/stdaddressbook.h> 49//#include <kabc/stdaddressbook.h>
50//#define size count 50//#define size count
51//#endif 51//#endif
52 52
53#ifdef DESKTOP_VERSION 53#ifdef DESKTOP_VERSION
54#include <kabc/addresseedialog.h> 54#include <kabc/addresseedialog.h>
55#include <kabc/addresseeview.h> 55#include <kabc/addresseeview.h>
56#include <qprinter.h> 56#include <qprinter.h>
57#include <qpainter.h> 57#include <qpainter.h>
58#include <qpaintdevicemetrics.h> 58#include <qpaintdevicemetrics.h>
59#else //DESKTOP_VERSION 59#else //DESKTOP_VERSION
60#include <externalapphandler.h> 60#include <externalapphandler.h>
61#include <qtopia/qcopenvelope_qws.h> 61#include <qtopia/qcopenvelope_qws.h>
62#endif //DESKTOP_VERSION 62#endif //DESKTOP_VERSION
63 63
64KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 64KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
65 : QTextBrowser(parent,name) 65 : QTextBrowser(parent,name)
66{ 66{
67 mSyncMode = false; 67 mSyncMode = false;
68 mColorMode = 0; 68 mColorMode = 0;
69} 69}
70 70
71KOEventViewer::~KOEventViewer() 71KOEventViewer::~KOEventViewer()
72{ 72{
73} 73}
74 74
75void KOEventViewer::printMe() 75void KOEventViewer::printMe()
76{ 76{
77#ifdef DESKTOP_VERSION 77#ifdef DESKTOP_VERSION
78 78
79 KOPrintPrefs pp ( this ); 79 KOPrintPrefs pp ( this );
80 if (!pp.exec() ) 80 if (!pp.exec() )
81 return; 81 return;
82 int scaleval = pp.printMode() ; 82 int scaleval = pp.printMode() ;
83 83
84 QPrinter printer; 84 QPrinter printer;
85 if (!printer.setup() ) 85 if (!printer.setup() )
86 return; 86 return;
87 QPainter p; 87 QPainter p;
88 p.begin ( &printer ); 88 p.begin ( &printer );
89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
90 float dx, dy; 90 float dx, dy;
91 int wid = (m.width() * 9)/10; 91 int wid = (m.width() * 9)/10;
92 dx = (float) wid/(float)contentsWidth (); 92 dx = (float) wid/(float)contentsWidth ();
93 dy = (float)(m.height()) / (float)contentsHeight (); 93 dy = (float)(m.height()) / (float)contentsHeight ();
94 float scale; 94 float scale;
95 // scale to fit the width or height of the paper 95 // scale to fit the width or height of the paper
96 if ( dx < dy ) 96 if ( dx < dy )
97 scale = dx; 97 scale = dx;
98 else 98 else
99 scale = dy; 99 scale = dy;
100 100
101 p.translate( m.width()/10,0 ); 101 p.translate( m.width()/10,0 );
102 qDebug("Scale: %f ", scale ); 102 qDebug("Scale: %f ", scale );
103 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 103 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
104 qDebug("SCALE "); 104 qDebug("SCALE ");
105 p.scale( scale, scale ); 105 p.scale( scale, scale );
106 } 106 }
107 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 107 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
108 p.end(); 108 p.end();
109#endif 109#endif
110 110
111} 111}
112void KOEventViewer::setSource(const QString& n) 112void KOEventViewer::setSource(const QString& n)
113{ 113{
114 114
115 if ( n.left(3) == "uid" ) 115 if ( n.left(3) == "uid" )
116#ifdef DESKTOP_VERSION 116#ifdef DESKTOP_VERSION
117 { 117 {
118 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 118 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
119 KABC::AddressBook::Iterator it; 119 KABC::AddressBook::Iterator it;
120 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 120 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
121 // LR I do not understand, why the uid string is different on zaurus and desktop 121 // LR I do not understand, why the uid string is different on zaurus and desktop
122 QString uid = "uid://"+(*it).uid(); 122 QString uid = "uid://"+(*it).uid();
123 123
124 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 124 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
125 if (n == uid ) { 125 if (n == uid ) {
126 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 126 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
127 QDialog dia( this,"dia123", true ); 127 QDialog dia( this,"dia123", true );
128 dia.setCaption( i18n("Details of attendee") ); 128 dia.setCaption( i18n("Details of attendee") );
129 QVBoxLayout lay ( &dia ); 129 QVBoxLayout lay ( &dia );
130 KABC::AddresseeView av ( &dia ); 130 KABC::AddresseeView av ( &dia );
131 av.setAddressee( (*it) ); 131 av.setAddressee( (*it) );
132 lay.addWidget( &av ); 132 lay.addWidget( &av );
133 if ( QApplication::desktop()->width() < 480 ) 133 if ( QApplication::desktop()->width() < 480 )
134 dia.resize( 220, 240); 134 dia.resize( 220, 240);
135 else { 135 else {
136 dia.resize( 400,400); 136 dia.resize( 400,400);
137 } 137 }
138 dia.exec(); 138 dia.exec();
139 break; 139 break;
140 } 140 }
141 } 141 }
142 return; 142 return;
143 } 143 }
144#else 144#else
145 { 145 {
146 if ( "uid:organizer" == n ) { 146 if ( "uid:organizer" == n ) {
147 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 147 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
148 return; 148 return;
149 } 149 }
150 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 150 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
151 if (attendees.count()) { 151 if (attendees.count()) {
152 Attendee *a; 152 Attendee *a;
153 for(a=attendees.first();a;a=attendees.next()) { 153 for(a=attendees.first();a;a=attendees.next()) {
154 if ( "uid:"+a->uid() == n ) { 154 if ( "uid:"+a->uid() == n ) {
155 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 155 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
156 return; 156 return;
157 } 157 }
158 } 158 }
159 } 159 }
160 return; 160 return;
161 } 161 }
162 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 162 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
163 // the result should now arrive through method insertAttendees 163 // the result should now arrive through method insertAttendees
164 //QString uid = "uid:"+(*it).uid(); 164 //QString uid = "uid:"+(*it).uid();
165#endif 165#endif
166 if ( n.left(6) == "mailto" ) { 166 if ( n.left(6) == "mailto" ) {
167 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 167 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
168#ifndef DESKTOP_VERSION 168#ifndef DESKTOP_VERSION
169 if ( n.mid(7,3) == "ALL" ) { 169 if ( n.mid(7,3) == "ALL" ) {
170 qDebug("all "); 170 qDebug("all ");
171 mailToAttendees( true ); 171 mailToAttendees( true );
172 } else if ( n.mid(7,4) == "RSVP" ) { 172 } else if ( n.mid(7,4) == "RSVP" ) {
173 mailToAttendees( false ); 173 mailToAttendees( false );
174 qDebug("rsvp "); 174 qDebug("rsvp ");
175 } else { 175 } else {
176 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 176 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
177 e << n.mid(7); 177 e << n.mid(7);
178 } 178 }
179#endif 179#endif
180 180
181 } 181 }
182 182
183 183
184#ifndef KORG_NODCOP 184#ifndef KORG_NODCOP
185 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 185 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
186 QString tmpStr; 186 QString tmpStr;
187 if (n.startsWith("mailto:")) { 187 if (n.startsWith("mailto:")) {
188 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 188 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
189 //emit showIncidence(n); 189 //emit showIncidence(n);
190 return; 190 return;
191 } else if (n.startsWith("uid:")) { 191 } else if (n.startsWith("uid:")) {
192 DCOPClient *client = KApplication::kApplication()->dcopClient(); 192 DCOPClient *client = KApplication::kApplication()->dcopClient();
193 const QByteArray noParamData; 193 const QByteArray noParamData;
194 const QByteArray paramData; 194 const QByteArray paramData;
195 QByteArray replyData; 195 QByteArray replyData;
196 QCString replyTypeStr; 196 QCString replyTypeStr;
197#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 197#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
198 bool foundAbbrowser = PING_ABBROWSER; 198 bool foundAbbrowser = PING_ABBROWSER;
199 199
200 if (foundAbbrowser) { 200 if (foundAbbrowser) {
201 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 201 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
202 //client->send("kaddressbook","KAddressBookIface", 202 //client->send("kaddressbook","KAddressBookIface",
203 QDataStream arg(paramData, IO_WriteOnly); 203 QDataStream arg(paramData, IO_WriteOnly);
204 arg << n.mid(6); 204 arg << n.mid(6);
205 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 205 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
206 return; 206 return;
207 } else { 207 } else {
208 /* 208 /*
209 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 209 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
210 We start it without its main interface 210 We start it without its main interface
211 */ 211 */
212 KIconLoader* iconLoader = new KIconLoader(); 212 KIconLoader* iconLoader = new KIconLoader();
213 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 213 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
214 ActionManager::setStartedKAddressBook(true); 214 ActionManager::setStartedKAddressBook(true);
215 tmpStr = "kaddressbook --editor-only --uid "; 215 tmpStr = "kaddressbook --editor-only --uid ";
216 tmpStr += KProcess::quote(n.mid(6)); 216 tmpStr += KProcess::quote(n.mid(6));
217 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 217 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
218 return; 218 return;
219 } 219 }
220 } else { 220 } else {
221 //QTextBrowser::setSource(n); 221 //QTextBrowser::setSource(n);
222 } 222 }
223#endif 223#endif
224} 224}
225void KOEventViewer::mailToAttendees( bool all ) 225void KOEventViewer::mailToAttendees( bool all )
226{ 226{
227 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 227 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
228 if (attendees.count() == 0) return; 228 if (attendees.count() == 0) return;
229 QStringList nameList; 229 QStringList nameList;
230 QStringList emailList; 230 QStringList emailList;
231 QStringList uidList; 231 QStringList uidList;
232 Attendee* a; 232 Attendee* a;
233 for(a=attendees.first();a;a=attendees.next()) { 233 for(a=attendees.first();a;a=attendees.next()) {
234 if ( !all && !a->RSVP() ) continue; 234 if ( !all && !a->RSVP() ) continue;
235 if (!a->email().isEmpty()) { 235 if (!a->email().isEmpty()) {
236 nameList.append (a->name() ); 236 nameList.append (a->name() );
237 emailList.append (a->email() ); 237 emailList.append (a->email() );
238 uidList.append (a->uid() ); 238 uidList.append (a->uid() );
239 } 239 }
240 } 240 }
241 QString uid = "ComposeMailUIpick2"+mMailSubject; 241 QString uid = "ComposeMailUIpick2"+mMailSubject;
242#ifndef DESKTOP_VERSION 242#ifndef DESKTOP_VERSION
243 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 243 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
244#endif 244#endif
245 245
246} 246}
247void KOEventViewer::addTag(const QString & tag,const QString & text) 247void KOEventViewer::addTag(const QString & tag,const QString & text)
248{ 248{
249 int number=text.contains("\n"); 249 int number=text.contains("\n");
250 QString str = "<" + tag + ">"; 250 QString str = "<" + tag + ">";
251 QString tmpText=text; 251 QString tmpText=text;
252 QString tmpStr=str; 252 QString tmpStr=str;
253 if(number !=-1) 253 if(number !=-1)
254 { 254 {
255 if (number > 0) { 255 if (number > 0) {
256 int pos=0; 256 int pos=0;
257 QString tmp; 257 QString tmp;
258 for(int i=0;i<=number;i++) { 258 for(int i=0;i<=number;i++) {
259 pos=tmpText.find("\n"); 259 pos=tmpText.find("\n");
260 tmp=tmpText.left(pos); 260 tmp=tmpText.left(pos);
261 tmpText=tmpText.right(tmpText.length()-pos-1); 261 tmpText=tmpText.right(tmpText.length()-pos-1);
262 tmpStr+=tmp+"<br>"; 262 tmpStr+=tmp+"<br>";
263 } 263 }
264 } 264 }
265 else tmpStr += tmpText; 265 else tmpStr += tmpText;
266 tmpStr+="</" + tag + ">"; 266 tmpStr+="</" + tag + ">";
267 mText.append(tmpStr); 267 mText.append(tmpStr);
268 } 268 }
269 else 269 else
270 { 270 {
271 str += text + "</" + tag + ">"; 271 str += text + "</" + tag + ">";
272 mText.append(str); 272 mText.append(str);
273 } 273 }
274} 274}
275 275
276void KOEventViewer::setColorMode( int m ) 276void KOEventViewer::setColorMode( int m )
277{ 277{
278 mColorMode = m; 278 mColorMode = m;
279} 279}
280void KOEventViewer::appendEvent(Event *event, int mode ) 280void KOEventViewer::appendEvent(Event *event, int mode )
281{ 281{
282 mMailSubject = ""; 282 mMailSubject = "";
283 mCurrentIncidence = event; 283 mCurrentIncidence = event;
284 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 284 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
285 topLevelWidget()->setCaption(i18n("Event Viewer")); 285 topLevelWidget()->setCaption(i18n("Event Viewer"));
286 if ( mode == 0 ) { 286 if ( mode == 0 ) {
287 addTag("h2",deTag(event->summary())); 287 addTag("h2",deTag(event->summary()));
288 } 288 }
289 else { 289 else {
290 if ( mColorMode == 1 ) { 290 if ( mColorMode == 1 ) {
291 mText +="<font color=\"#00A000\">"; 291 mText +="<font color=\"#00A000\">";
292 } 292 }
293 if ( mColorMode == 2 ) { 293 if ( mColorMode == 2 ) {
294 mText +="<font color=\"#C00000\">"; 294 mText +="<font color=\"#C00000\">";
295 } 295 }
296 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 296 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
297 if ( mode == 1 ) { 297 if ( mode == 1 ) {
298 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 298 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
299 } else { 299 } else {
300 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 300 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
301 } 301 }
302 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 302 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
303 if ( mColorMode ) 303 if ( mColorMode )
304 mText += "</font>"; 304 mText += "</font>";
305 } 305 }
306 mMailSubject += i18n( "Meeting " )+ event->summary(); 306 mMailSubject += i18n( "Meeting " )+ event->summary();
307 if (event->cancelled ()) { 307 if (event->cancelled ()) {
308 mText +="<font color=\"#B00000\">"; 308 mText +="<font color=\"#B00000\">";
309 addTag("i",i18n("This event has been cancelled!")); 309 addTag("i",i18n("This event has been cancelled!"));
310 mText.append("<br>"); 310 mText.append("<br>");
311 mText += "</font>"; 311 mText += "</font>";
312 mMailSubject += i18n("(cancelled)"); 312 mMailSubject += i18n("(cancelled)");
313 } 313 }
314 if (!event->location().isEmpty()) { 314
315 addTag("b",i18n("Location: "));
316 mText.append(deTag(event->location())+"<br>");
317 mMailSubject += i18n(" at ") + event->location();
318 }
319 if (event->doesFloat()) { 315 if (event->doesFloat()) {
320 if (event->isMultiDay()) { 316 if (event->isMultiDay()) {
321 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 317 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
322 .arg(event->dtStartDateStr(shortDate)) 318 .arg(event->dtStartDateStr(shortDate))
323 .arg(event->dtEndDateStr(shortDate))); 319 .arg(event->dtEndDateStr(shortDate)));
324 } else { 320 } else {
325 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 321 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
326 } 322 }
327 } else { 323 } else {
328 if (event->isMultiDay()) { 324 if (event->isMultiDay()) {
329 mText.append(i18n("<p><b>From:</b> %1</p> ") 325 mText.append(i18n("<p><b>From:</b> %1</p> ")
330 .arg(event->dtStartStr( shortDate))); 326 .arg(event->dtStartStr( shortDate)));
331 mText.append(i18n("<p><b>To:</b> %1</p>") 327 mText.append(i18n("<p><b>To:</b> %1</p>")
332 .arg(event->dtEndStr(shortDate))); 328 .arg(event->dtEndStr(shortDate)));
333 } else { 329 } else {
334 mText.append(i18n("<p><b>On:</b> %1</p> ")
335 .arg(event->dtStartDateStr( shortDate )));
336 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 330 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
337 .arg(event->dtStartTimeStr()) 331 .arg(event->dtStartTimeStr())
338 .arg(event->dtEndTimeStr())); 332 .arg(event->dtEndTimeStr()));
333 mText.append(i18n("<p><b>On:</b> %1</p> ")
334 .arg(event->dtStartDateStr( shortDate )));
339 } 335 }
340 } 336 }
341 337 if (!event->location().isEmpty()) {
338 addTag("b",i18n("Location: "));
339 mText.append(deTag(event->location())+"<br>");
340 mMailSubject += i18n(" at ") + event->location();
341 }
342 if (event->recurrence()->doesRecur()) { 342 if (event->recurrence()->doesRecur()) {
343 343
344 QString recurText = event->recurrence()->recurrenceText(); 344 QString recurText = event->recurrence()->recurrenceText();
345 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 345 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
346 bool ok; 346 bool ok;
347 QDate start = QDate::currentDate(); 347 QDate start = QDate::currentDate();
348 QDateTime next; 348 QDateTime next;
349 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 349 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
350 if ( ok ) { 350 if ( ok ) {
351 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 351 addTag("p",i18n("<b>Next recurrence is on:</b>") );
352 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 352 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
353 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 353 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
354 354
355 } else { 355 } else {
356 bool last; 356 bool last;
357 QDate nextd; 357 QDate nextd;
358 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 358 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
359 if ( last ) { 359 if ( last ) {
360 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 360 addTag("p",i18n("<b>Last recurrence was on:</b>") );
361 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 361 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
362 } 362 }
363 } 363 }
364 } else { 364 } else {
365 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 365 mMailSubject += i18n(" - " )+event->dtStartStr( true );
366 366
367 } 367 }
368 368
369 369
370 if (event->isAlarmEnabled()) { 370 if (event->isAlarmEnabled()) {
371 Alarm *alarm =event->alarms().first() ; 371 Alarm *alarm =event->alarms().first() ;
372 QDateTime t = alarm->time(); 372 QDateTime t = alarm->time();
373 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 373 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
374 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 374 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
375 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 375 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
376 //addTag("p",s); 376 //addTag("p",s);
377 } 377 }
378 378
379 addTag("b",i18n("Access: ")); 379 addTag("b",i18n("Access: "));
380 mText.append(event->secrecyStr()+"<br>"); 380 mText.append(event->secrecyStr()+"<br>");
381 381
382 382
383 if ( KOPrefs::instance()->mEVshowDetails ) { 383
384 if (!event->description().isEmpty()) {
385 addTag("p",i18n("<b>Details: </b>"));
386 addTag("p",deTag(event->description()));
387 }
388 }
389 formatCategories(event); 384 formatCategories(event);
390 385
391 formatReadOnly(event); 386 formatReadOnly(event);
392 formatAttendees(event); 387 formatAttendees(event);
393 388
394 if ( KOPrefs::instance()->mEVshowCreated ) { 389 if ( KOPrefs::instance()->mEVshowCreated ) {
390#ifdef DESKTOP_VERSION
391 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
392#else
395 addTag("p",i18n("<b>Created: ") +" </b>"); 393 addTag("p",i18n("<b>Created: ") +" </b>");
396 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 394 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
395#endif
397 396
398 } 397 }
399 if ( KOPrefs::instance()->mEVshowChanged ) { 398 if ( KOPrefs::instance()->mEVshowChanged ) {
399#ifdef DESKTOP_VERSION
400 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
401#else
400 addTag("p",i18n("<b>Last modified: ") +" </b>"); 402 addTag("p",i18n("<b>Last modified: ") +" </b>");
401 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 403 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
404#endif
402 405
406 }
407 if ( KOPrefs::instance()->mEVshowDetails ) {
408 if (!event->description().isEmpty()) {
409 addTag("p",i18n("<b>Details: </b>"));
410 addTag("p",deTag(event->description()));
411 }
403 } 412 }
404 setText(mText); 413 setText(mText);
405 //QWhatsThis::add(this,mText); 414 //QWhatsThis::add(this,mText);
406 415
407} 416}
408 417
409void KOEventViewer::appendTodo(Todo *event, int mode ) 418void KOEventViewer::appendTodo(Todo *event, int mode )
410{ 419{
411 mMailSubject = ""; 420 mMailSubject = "";
412 mCurrentIncidence = event; 421 mCurrentIncidence = event;
413 topLevelWidget()->setCaption(i18n("Todo Viewer")); 422 topLevelWidget()->setCaption(i18n("Todo Viewer"));
414 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 423 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
415 if (mode == 0 ) 424 if (mode == 0 )
416 addTag("h2",deTag(event->summary())); 425 addTag("h2",deTag(event->summary()));
417 else { 426 else {
418 if ( mColorMode == 1 ) { 427 if ( mColorMode == 1 ) {
419 mText +="<font color=\"#00A000\">"; 428 mText +="<font color=\"#00A000\">";
420 } 429 }
421 if ( mColorMode == 2 ) { 430 if ( mColorMode == 2 ) {
422 mText +="<font color=\"#B00000\">"; 431 mText +="<font color=\"#B00000\">";
423 } 432 }
424 if ( mode == 1 ) { 433 if ( mode == 1 ) {
425 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 434 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
426 } else { 435 } else {
427 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 436 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
428 } 437 }
429 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 438 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
430 if ( mColorMode ) 439 if ( mColorMode )
431 mText += "</font>"; 440 mText += "</font>";
432 } 441 }
433 mMailSubject += i18n( "Todo " )+ event->summary(); 442 mMailSubject += i18n( "Todo " )+ event->summary();
434 443
435 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 444 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
436 mText +="<font color=\"#B00000\">"; 445 mText +="<font color=\"#B00000\">";
437 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 446 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
438 mText += "</font>"; 447 mText += "</font>";
439 } else { 448 } else {
440 mText.append(i18n("<p><i>%1 % completed</i></p>") 449 mText.append(i18n("<p><i>%1 % completed</i></p>")
441 .arg(event->percentComplete())); 450 .arg(event->percentComplete()));
442 } 451 }
443 452
444 if (event->cancelled ()) { 453 if (event->cancelled ()) {
445 mText +="<font color=\"#B00000\">"; 454 mText +="<font color=\"#B00000\">";
446 addTag("i",i18n("This todo has been cancelled!")); 455 addTag("i",i18n("This todo has been cancelled!"));
447 mText.append("<br>"); 456 mText.append("<br>");
448 mText += "</font>"; 457 mText += "</font>";
449 mMailSubject += i18n("(cancelled)"); 458 mMailSubject += i18n("(cancelled)");
450 } 459 }
451 460
452 if (!event->location().isEmpty()) { 461
453 addTag("b",i18n("Location: "));
454 mText.append(deTag(event->location())+"<br>");
455 mMailSubject += i18n(" at ") + event->location();
456 }
457 462
458 if (event->recurrence()->doesRecur()) { 463 if (event->recurrence()->doesRecur()) {
459 464
460 QString recurText = event->recurrence()->recurrenceText(); 465 QString recurText = event->recurrence()->recurrenceText();
461 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 466 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
462 467
463 } 468 }
464 if (event->hasStartDate()) { 469 if (event->hasStartDate()) {
465 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 470 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
466 } 471 }
467 if (event->hasDueDate()) { 472 if (event->hasDueDate()) {
468 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 473 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
469 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 474 mMailSubject += i18n(" - " )+event->dtDueStr( true );
470 } 475 }
471 476 if (!event->location().isEmpty()) {
477 addTag("b",i18n("Location: "));
478 mText.append(deTag(event->location())+"<br>");
479 mMailSubject += i18n(" at ") + event->location();
480 }
481 mText.append(i18n("<p><b>Priority:</b> %2</p>")
482 .arg(QString::number(event->priority())));
472 483
473 if (event->isAlarmEnabled()) { 484 if (event->isAlarmEnabled()) {
474 Alarm *alarm =event->alarms().first() ; 485 Alarm *alarm =event->alarms().first() ;
475 QDateTime t = alarm->time(); 486 QDateTime t = alarm->time();
476 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 487 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
477 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 488 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
478 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 489 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
479 //addTag("p",s); 490 //addTag("p",s);
480 } 491 }
481 492
482 addTag("b",i18n("Access: ")); 493 addTag("b",i18n("Access: "));
483 mText.append(event->secrecyStr()+"<br>"); 494 mText.append(event->secrecyStr()+"<br>");
484 if ( KOPrefs::instance()->mEVshowDetails ) {
485 if (!event->description().isEmpty()) {
486 addTag("p",i18n("<b>Details: </b>"));
487 addTag("p",deTag(event->description()));
488 }
489 }
490 495
491 formatCategories(event); 496 formatCategories(event);
492 497
493 mText.append(i18n("<p><b>Priority:</b> %2</p>")
494 .arg(QString::number(event->priority())));
495
496 formatReadOnly(event); 498 formatReadOnly(event);
497 formatAttendees(event); 499 formatAttendees(event);
500
501 if ( KOPrefs::instance()->mEVshowCreated ) {
502#ifdef DESKTOP_VERSION
503 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
504#else
505 addTag("p",i18n("<b>Created: ") +" </b>");
506 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
507#endif
508
509 }
510 if ( KOPrefs::instance()->mEVshowChanged ) {
511#ifdef DESKTOP_VERSION
512 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
513#else
514 addTag("p",i18n("<b>Last modified: ") +" </b>");
515 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
516#endif
517
518 }
498 if ( event->relatedTo() ) { 519 if ( event->relatedTo() ) {
499 addTag("b",i18n("Parent todo:<br>")); 520 addTag("b",i18n("Parent todo:<br>"));
500 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 521 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
501 } 522 }
502 QPtrList<Incidence> Relations = event->relations(); 523 QPtrList<Incidence> Relations = event->relations();
503 Incidence *to; 524 Incidence *to;
504 if ( Relations.first() ) 525 if ( Relations.first() )
505 addTag("b",i18n("Sub todos:<br>")); 526 addTag("b",i18n("Sub todos:<br>"));
506 for (to=Relations.first();to;to=Relations.next()) { 527 for (to=Relations.first();to;to=Relations.next()) {
507 mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 528 mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
508 529
509 } 530 }
510 if ( KOPrefs::instance()->mEVshowCreated ) { 531
511 addTag("p",i18n("<b>Created: ") +" </b>"); 532 if ( KOPrefs::instance()->mEVshowDetails ) {
512 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 533 if (!event->description().isEmpty()) {
513 534 addTag("p",i18n("<b>Details: </b>"));
514 } 535 addTag("p",deTag(event->description()));
515 if ( KOPrefs::instance()->mEVshowChanged ) { 536 }
516 addTag("p",i18n("<b>Last modified: ") +" </b>");
517 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
518
519 } 537 }
520 setText(mText); 538 setText(mText);
521} 539}
522 540
523void KOEventViewer::formatCategories(Incidence *event) 541void KOEventViewer::formatCategories(Incidence *event)
524{ 542{
525 if (!event->categoriesStr().isEmpty()) { 543 if (!event->categoriesStr().isEmpty()) {
526 if (event->categories().count() == 1) { 544 if (event->categories().count() == 1) {
527 addTag("h3",i18n("Category")); 545 addTag("h3",i18n("Category"));
528 } else { 546 } else {
529 addTag("h3",i18n("Categories")); 547 addTag("h3",i18n("Categories"));
530 } 548 }
531 addTag("p",event->categoriesStr()); 549 addTag("p",event->categoriesStr());
532 } 550 }
533} 551}
534void KOEventViewer::formatAttendees(Incidence *event) 552void KOEventViewer::formatAttendees(Incidence *event)
535{ 553{
536 QPtrList<Attendee> attendees = event->attendees(); 554 QPtrList<Attendee> attendees = event->attendees();
537 if (attendees.count()) { 555 if (attendees.count()) {
538 556
539 557
540 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 558 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
541 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 559 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
542 addTag("h3",i18n("Organizer")); 560 addTag("h3",i18n("Organizer"));
543 mText.append("<ul><li>"); 561 mText.append("<ul><li>");
544#ifndef KORG_NOKABC 562#ifndef KORG_NOKABC
545 563
546#ifdef DESKTOP_VERSION 564#ifdef DESKTOP_VERSION
547 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 565 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
548 KABC::Addressee::List addressList; 566 KABC::Addressee::List addressList;
549 addressList = add_book->findByEmail(event->organizer()); 567 addressList = add_book->findByEmail(event->organizer());
550 KABC::Addressee o = addressList.first(); 568 KABC::Addressee o = addressList.first();
551 if (!o.isEmpty() && addressList.size()<2) { 569 if (!o.isEmpty() && addressList.size()<2) {
552 mText += "<a href=\"uid:" + o.uid() + "\">"; 570 mText += "<a href=\"uid:" + o.uid() + "\">";
553 mText += o.formattedName(); 571 mText += o.formattedName();
554 mText += "</a>\n"; 572 mText += "</a>\n";
555 } else { 573 } else {
556 mText.append(event->organizer()); 574 mText.append(event->organizer());
557 } 575 }
558#else //DESKTOP_VERSION 576#else //DESKTOP_VERSION
559 mText += "<a href=\"uid:organizer\">"; 577 mText += "<a href=\"uid:organizer\">";
560 mText += event->organizer(); 578 mText += event->organizer();
561 mText += "</a>\n"; 579 mText += "</a>\n";
562#endif //DESKTOP_VERSION 580#endif //DESKTOP_VERSION
563 581
564 582
565#else 583#else
566 mText.append(event->organizer()); 584 mText.append(event->organizer());
567#endif 585#endif
568 586
569 if (iconPath) { 587 if (iconPath) {
570 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 588 mText += " <a href=\"mailto:" + event->organizer() + "\">";
571 mText += "<IMG src=\"" + iconPath + "\">"; 589 mText += "<IMG src=\"" + iconPath + "\">";
572 mText += "</a>\n"; 590 mText += "</a>\n";
573 } 591 }
574 mText.append("</li></ul>"); 592 mText.append("</li></ul>");
575 593
576 addTag("h3",i18n("Attendees")); 594 addTag("h3",i18n("Attendees"));
577 Attendee *a; 595 Attendee *a;
578 mText.append("<ul>"); 596 mText.append("<ul>");
579 int a_count = 0; 597 int a_count = 0;
580 int a_count_nr = 0; 598 int a_count_nr = 0;
581 599
582 for(a=attendees.first();a;a=attendees.next()) { 600 for(a=attendees.first();a;a=attendees.next()) {
583#ifndef KORG_NOKABC 601#ifndef KORG_NOKABC
584#ifdef DESKTOP_VERSION 602#ifdef DESKTOP_VERSION
585 if (a->name().isEmpty()) { 603 if (a->name().isEmpty()) {
586 addressList = add_book->findByEmail(a->email()); 604 addressList = add_book->findByEmail(a->email());
587 KABC::Addressee o = addressList.first(); 605 KABC::Addressee o = addressList.first();
588 if (!o.isEmpty() && addressList.size()<2) { 606 if (!o.isEmpty() && addressList.size()<2) {
589 mText += "<a href=\"uid:" + o.uid() + "\">"; 607 mText += "<a href=\"uid:" + o.uid() + "\">";
590 mText += o.formattedName(); 608 mText += o.formattedName();
591 mText += "</a>\n"; 609 mText += "</a>\n";
592 } else { 610 } else {
593 mText += "<li>"; 611 mText += "<li>";
594 mText.append(a->email()); 612 mText.append(a->email());
595 mText += "\n"; 613 mText += "\n";
596 } 614 }
597 } else { 615 } else {
598 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 616 mText += "<li><a href=\"uid:" + a->uid() + "\">";
599 if (!a->name().isEmpty()) mText += a->name(); 617 if (!a->name().isEmpty()) mText += a->name();
600 else mText += a->email(); 618 else mText += a->email();
601 mText += "</a>\n"; 619 mText += "</a>\n";
602 } 620 }
603#else //DESKTOP_VERSION 621#else //DESKTOP_VERSION
604 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 622 mText += "<li><a href=\"uid:" + a->uid() + "\">";
605 if (!a->name().isEmpty()) mText += a->name(); 623 if (!a->name().isEmpty()) mText += a->name();
606 else mText += a->email(); 624 else mText += a->email();
607 mText += "</a>\n"; 625 mText += "</a>\n";
608#endif //DESKTOP_VERSION 626#endif //DESKTOP_VERSION
609#else 627#else
610 //qDebug("nokabc "); 628 //qDebug("nokabc ");
611 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 629 mText += "<li><a href=\"uid:" + a->uid() + "\">";
612 if (!a->name().isEmpty()) mText += a->name(); 630 if (!a->name().isEmpty()) mText += a->name();
613 else mText += a->email(); 631 else mText += a->email();
614 mText += "</a>\n"; 632 mText += "</a>\n";
615#endif 633#endif
616 634
617 635
618 if (!a->email().isEmpty()) { 636 if (!a->email().isEmpty()) {
619 if (iconPath) { 637 if (iconPath) {
620 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 638 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
621 if ( a->RSVP() ) { 639 if ( a->RSVP() ) {
622 ++a_count_nr; 640 ++a_count_nr;
623 mText += "<IMG src=\"" + iconPath + "\">"; 641 mText += "<IMG src=\"" + iconPath + "\">";
624 } 642 }
625 else { 643 else {
626 ++a_count; 644 ++a_count;
627 mText += "<IMG src=\"" + NOiconPath + "\">"; 645 mText += "<IMG src=\"" + NOiconPath + "\">";
628 } 646 }
629 mText += "</a>\n"; 647 mText += "</a>\n";
630 } 648 }
631 } 649 }
632 if (a->status() != Attendee::NeedsAction ) 650 if (a->status() != Attendee::NeedsAction )
633 mText +="[" + a->statusStr() + "] "; 651 mText +="[" + a->statusStr() + "] ";
634 if (a->role() == Attendee::Chair ) 652 if (a->role() == Attendee::Chair )
635 mText +="(" + a->roleStr().left(1) + ".)"; 653 mText +="(" + a->roleStr().left(1) + ".)";
636 } 654 }
637 mText.append("</li></ul>"); 655 mText.append("</li></ul>");
638 if ( (a_count+a_count_nr) > 1 ) { 656 if ( (a_count+a_count_nr) > 1 ) {
639 mText += "<a href=\"mailto:ALL\">"; 657 mText += "<a href=\"mailto:ALL\">";
640 mText += i18n( "Mail to all" ); 658 mText += i18n( "Mail to all" );
641 mText += "</a> ( "; 659 mText += "</a> ( ";
642 mText += "<IMG src=\"" + iconPath + "\">"; 660 mText += "<IMG src=\"" + iconPath + "\">";
643 mText += i18n( " and " ); 661 mText += i18n( " and " );
644 mText += "<IMG src=\"" + NOiconPath + "\"> )"; 662 mText += "<IMG src=\"" + NOiconPath + "\"> )";
645 mText += "<br>\n"; 663 mText += "<br>\n";
646 664
647 665
648 } 666 }
649 if ( a_count_nr > 1 ) { 667 if ( a_count_nr > 1 ) {
650 mText += "<a href=\"mailto:RSVP\">"; 668 mText += "<a href=\"mailto:RSVP\">";
651 mText += i18n( "Mail to selected" ); 669 mText += i18n( "Mail to selected" );
652 mText += "</a> ( "; 670 mText += "</a> ( ";
653 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); 671 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
654 mText += "<br>\n"; 672 mText += "<br>\n";
655 } 673 }
656 } 674 }
657 675
658} 676}
659void KOEventViewer::appendJournal(Journal *jour, int mode ) 677void KOEventViewer::appendJournal(Journal *jour, int mode )
660{ 678{
661 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 679 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
662 if (mode == 0 ) { 680 if (mode == 0 ) {
663 addTag("h2",i18n("Journal from: ")); 681 addTag("h2",i18n("Journal from: "));
664 } 682 }
665 else { 683 else {
666 if ( mode == 1 ) { 684 if ( mode == 1 ) {
667 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 685 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
668 } else { 686 } else {
669 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 687 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
670 } 688 }
671 } 689 }
672 topLevelWidget()->setCaption("Journal Viewer"); 690 topLevelWidget()->setCaption("Journal Viewer");
673 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 691 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
674 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 692 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
675 if (!jour->description().isEmpty()) { 693 if (!jour->description().isEmpty()) {
676 addTag("p",deTag(jour->description())); 694 addTag("p",deTag(jour->description()));
677 } 695 }
678 setText(mText); 696 setText(mText);
679} 697}
680 698
681void KOEventViewer::formatReadOnly(Incidence *event) 699void KOEventViewer::formatReadOnly(Incidence *event)
682{ 700{
683 if (event->isReadOnly()) { 701 if (event->isReadOnly()) {
684 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 702 addTag("p","<em>(" + i18n("read-only") + ")</em>");
685 } 703 }
686} 704}
687void KOEventViewer::setSyncMode( bool b ) 705void KOEventViewer::setSyncMode( bool b )
688{ 706{
689 mSyncMode = b; 707 mSyncMode = b;
690} 708}
691 709
692void KOEventViewer::setTodo(Todo *event, bool clearV ) 710void KOEventViewer::setTodo(Todo *event, bool clearV )
693{ 711{
694 if ( clearV ) 712 if ( clearV )
695 clearEvents(); 713 clearEvents();
696 if ( mSyncMode ) { 714 if ( mSyncMode ) {
697 if ( clearV ) 715 if ( clearV )
698 appendTodo(event,1 ); 716 appendTodo(event,1 );
699 else 717 else
700 appendTodo(event,2); 718 appendTodo(event,2);
701 } else 719 } else
702 appendTodo(event); 720 appendTodo(event);
703} 721}
704void KOEventViewer::setJournal(Journal *event, bool clearV ) 722void KOEventViewer::setJournal(Journal *event, bool clearV )
705{ 723{
706 if ( clearV ) 724 if ( clearV )
707 clearEvents(); 725 clearEvents();
708 if ( mSyncMode ) { 726 if ( mSyncMode ) {
709 if ( clearV ) 727 if ( clearV )
710 appendJournal(event, 1); 728 appendJournal(event, 1);
711 else 729 else
712 appendJournal(event, 2); 730 appendJournal(event, 2);
713 } else 731 } else
714 appendJournal(event); 732 appendJournal(event);
715} 733}
716 734
717void KOEventViewer::setEvent(Event *event) 735void KOEventViewer::setEvent(Event *event)
718{ 736{
719 clearEvents(); 737 clearEvents();
720 if ( mSyncMode ) 738 if ( mSyncMode )
721 appendEvent(event, 1); 739 appendEvent(event, 1);
722 else 740 else
723 appendEvent(event); 741 appendEvent(event);
724} 742}
725 743
726void KOEventViewer::addEvent(Event *event) 744void KOEventViewer::addEvent(Event *event)
727{ 745{
728 if ( mSyncMode ) 746 if ( mSyncMode )
729 appendEvent(event, 2); 747 appendEvent(event, 2);
730 else 748 else
731 appendEvent(event); 749 appendEvent(event);
732} 750}
733 751
734void KOEventViewer::clearEvents(bool now) 752void KOEventViewer::clearEvents(bool now)
735{ 753{
736 mText = ""; 754 mText = "";
737 if (now) setText(mText); 755 if (now) setText(mText);
738} 756}
739 757
740void KOEventViewer::addText(QString text) 758void KOEventViewer::addText(QString text)
741{ 759{
742 mText.append(text); 760 mText.append(text);
743 setText(mText); 761 setText(mText);
744} 762}
745QString KOEventViewer::deTag(QString text) 763QString KOEventViewer::deTag(QString text)
746{ 764{
747#if QT_VERSION >= 0x030000 765#if QT_VERSION >= 0x030000
748 text.replace( '<' , "&lt;" ); 766 text.replace( '<' , "&lt;" );
749 text.replace( '>' , "&gt;" ); 767 text.replace( '>' , "&gt;" );
750#else 768#else
751 if ( text.find ('<') >= 0 ) { 769 if ( text.find ('<') >= 0 ) {
752 text.replace( QRegExp("<") , "&lt;" ); 770 text.replace( QRegExp("<") , "&lt;" );
753 } 771 }
754 if ( text.find ('>') >= 0 ) { 772 if ( text.find ('>') >= 0 ) {
755 text.replace( QRegExp(">") , "&gt;" ); 773 text.replace( QRegExp(">") , "&gt;" );
756 } 774 }
757#endif 775#endif
758 return text; 776 return text;
759} 777}
760void KOEventViewer::keyPressEvent ( QKeyEvent * e ) 778void KOEventViewer::keyPressEvent ( QKeyEvent * e )
761{ 779{
762 switch ( e->key() ) { 780 switch ( e->key() ) {
763 case Qt::Key_Return: 781 case Qt::Key_Return:
764 case Qt::Key_Enter : 782 case Qt::Key_Enter :
765 e->ignore(); 783 e->ignore();
766 break; 784 break;
767 default: 785 default:
768 QTextBrowser::keyPressEvent ( e ); 786 QTextBrowser::keyPressEvent ( e );
769 break; 787 break;
770 } 788 }
771} 789}
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 65d6acf..b175f9a 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,1546 +1,1547 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#else 34#else
35#include <qapplication.h> 35#include <qapplication.h>
36#endif 36#endif
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kglobal.h> 40#include <kglobal.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <kiconloader.h> 42#include <kiconloader.h>
43 43
44#include <kcalendarsystem.h> 44#include <kcalendarsystem.h>
45 45
46#ifndef KORG_NOPRINTER 46#ifndef KORG_NOPRINTER
47#include "calprinter.h" 47#include "calprinter.h"
48#endif 48#endif
49#include "koprefs.h" 49#include "koprefs.h"
50#ifndef KORG_NOPLUGINS 50#ifndef KORG_NOPLUGINS
51#include "kocore.h" 51#include "kocore.h"
52#endif 52#endif
53#include "koglobals.h" 53#include "koglobals.h"
54#include <libkcal/kincidenceformatter.h> 54#include <libkcal/kincidenceformatter.h>
55 55
56#include "komonthview.h" 56#include "komonthview.h"
57 57
58#define PIXMAP_SIZE 5 58#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 59#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 60QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 61#endif
62class KNOWhatsThis :public QWhatsThis 62class KNOWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; 66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p) 69 virtual QString text( const QPoint& p)
70 { 70 {
71 return _wid->getWhatsThisText(p) ; 71 return _wid->getWhatsThisText(p) ;
72 }; 72 };
73private: 73private:
74 KNoScrollListBox* _wid; 74 KNoScrollListBox* _wid;
75 75
76}; 76};
77 77
78 78
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 80 : QListBox(parent, name, WRepaintNoErase)
81{ 81{
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mWT = new KNOWhatsThis(this); 85 mWT = new KNOWhatsThis(this);
86 resetOnFocusIn = true; 86 resetOnFocusIn = true;
87 setVScrollBarMode(QScrollView::AlwaysOff); 87 setVScrollBarMode(QScrollView::AlwaysOff);
88 setHScrollBarMode(QScrollView::AlwaysOff); 88 setHScrollBarMode(QScrollView::AlwaysOff);
89} 89}
90KNoScrollListBox::~KNoScrollListBox() 90KNoScrollListBox::~KNoScrollListBox()
91{ 91{
92 92
93} 93}
94 94
95 95
96void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 96void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
97{ 97{
98 QListBox::focusInEvent ( e ); 98 QListBox::focusInEvent ( e );
99 if ( count() ){ 99 if ( count() ){
100 int ci = currentItem(); 100 int ci = currentItem();
101 if ( ci < 0 ) ci = 0; 101 if ( ci < 0 ) ci = 0;
102 102
103 setCurrentItem( ci ); 103 setCurrentItem( ci );
104 setSelected ( ci, true ); 104 setSelected ( ci, true );
105 emit highlighted( item ( ci ) ); 105 emit highlighted( item ( ci ) );
106 106
107 resetOnFocusIn = true; 107 resetOnFocusIn = true;
108 108
109 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 109 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
110 QListBoxItem *fi = firstItem (); 110 QListBoxItem *fi = firstItem ();
111 if (fi ) { 111 if (fi ) {
112 int ihei = fi->height( this ); 112 int ihei = fi->height( this );
113 int hei = numRows () * ihei; 113 int hei = numRows () * ihei;
114 if ( hei < height() - horizontalScrollBar()->height () ) { 114 if ( hei < height() - horizontalScrollBar()->height () ) {
115 setVScrollBarMode(QScrollView::AlwaysOff); 115 setVScrollBarMode(QScrollView::AlwaysOff);
116 } 116 }
117 else 117 else
118 setVScrollBarMode(QScrollView::Auto); 118 setVScrollBarMode(QScrollView::Auto);
119 if ( ihei *3 > height() ) { 119 if ( ihei *3 > height() ) {
120 setHScrollBarMode(QScrollView::AlwaysOff); 120 setHScrollBarMode(QScrollView::AlwaysOff);
121 } 121 }
122 else { 122 else {
123 setHScrollBarMode(QScrollView::Auto); 123 setHScrollBarMode(QScrollView::Auto);
124 } 124 }
125 } else { 125 } else {
126 setVScrollBarMode(QScrollView::Auto); 126 setVScrollBarMode(QScrollView::Auto);
127 setHScrollBarMode(QScrollView::Auto); 127 setHScrollBarMode(QScrollView::Auto);
128 } 128 }
129 } 129 }
130 } 130 }
131} 131}
132void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 132void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
133{ 133{
134 int i = currentItem (); 134 int i = currentItem ();
135 if ( i >= 0 ) { 135 if ( i >= 0 ) {
136 setSelected ( i, false ); 136 setSelected ( i, false );
137 } 137 }
138 QListBox::focusOutEvent ( e ); 138 QListBox::focusOutEvent ( e );
139 setVScrollBarMode(QScrollView::AlwaysOff); 139 setVScrollBarMode(QScrollView::AlwaysOff);
140 setHScrollBarMode(QScrollView::AlwaysOff); 140 setHScrollBarMode(QScrollView::AlwaysOff);
141} 141}
142 142
143QString KNoScrollListBox::getWhatsThisText(QPoint p) 143QString KNoScrollListBox::getWhatsThisText(QPoint p)
144{ 144{
145 QListBoxItem* item = itemAt ( p ); 145 QListBoxItem* item = itemAt ( p );
146 if ( ! item ) { 146 if ( ! item ) {
147 return i18n("Click in the cell\nto add an event!"); 147 return i18n("Click in the cell\nto add an event!");
148 } 148 }
149 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 149 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
150 KOPrefs::instance()->mWTshowDetails, 150 KOPrefs::instance()->mWTshowDetails,
151 KOPrefs::instance()->mWTshowCreated, 151 KOPrefs::instance()->mWTshowCreated,
152 KOPrefs::instance()->mWTshowChanged); 152 KOPrefs::instance()->mWTshowChanged);
153} 153}
154void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 154void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
155{ 155{
156 //qDebug("KNoScrollListBox::keyPressEvent "); 156 //qDebug("KNoScrollListBox::keyPressEvent ");
157 switch(e->key()) { 157 switch(e->key()) {
158 case Key_Right: 158 case Key_Right:
159 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 159 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
160 { 160 {
161 e->ignore(); 161 e->ignore();
162 return; 162 return;
163 } 163 }
164 scrollBy(10,0); 164 scrollBy(10,0);
165 break; 165 break;
166 case Key_Left: 166 case Key_Left:
167 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 167 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
168 { 168 {
169 e->ignore(); 169 e->ignore();
170 return; 170 return;
171 } 171 }
172 scrollBy(-10,0); 172 scrollBy(-10,0);
173 break; 173 break;
174 case Key_Up: 174 case Key_Up:
175 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 175 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
176 e->ignore(); 176 e->ignore();
177 break; 177 break;
178 } 178 }
179 if ( count() ) { 179 if ( count() ) {
180 if ( currentItem() == 0 ) { 180 if ( currentItem() == 0 ) {
181 emit prevCell(); 181 emit prevCell();
182 } else { 182 } else {
183 setCurrentItem((currentItem()+count()-1)%count()); 183 setCurrentItem((currentItem()+count()-1)%count());
184 if(!itemVisible(currentItem())) { 184 if(!itemVisible(currentItem())) {
185 if((unsigned int) currentItem() == (count()-1)) { 185 if((unsigned int) currentItem() == (count()-1)) {
186 setTopItem(currentItem()-numItemsVisible()+1); 186 setTopItem(currentItem()-numItemsVisible()+1);
187 } else { 187 } else {
188 setTopItem(topItem()-1); 188 setTopItem(topItem()-1);
189 } 189 }
190 } 190 }
191 } 191 }
192 } 192 }
193 break; 193 break;
194 case Key_Down: 194 case Key_Down:
195 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 195 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
196 e->ignore(); 196 e->ignore();
197 break; 197 break;
198 } 198 }
199 if ( count () ) { 199 if ( count () ) {
200 if ( currentItem()+1 == count () ) { 200 if ( currentItem()+1 == count () ) {
201 emit nextCell(); 201 emit nextCell();
202 } else { 202 } else {
203 setCurrentItem((currentItem()+1)%count()); 203 setCurrentItem((currentItem()+1)%count());
204 if(!itemVisible(currentItem())) { 204 if(!itemVisible(currentItem())) {
205 if(currentItem() == 0) { 205 if(currentItem() == 0) {
206 setTopItem(0); 206 setTopItem(0);
207 } else { 207 } else {
208 setTopItem(topItem()+1); 208 setTopItem(topItem()+1);
209 } 209 }
210 } 210 }
211 } 211 }
212 } 212 }
213 break; 213 break;
214 case Key_I: 214 case Key_I:
215 QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); 215 QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
216 e->ignore(); 216 e->ignore();
217 break; 217 break;
218 case Key_Return: 218 case Key_Return:
219 case Key_Enter: 219 case Key_Enter:
220 { 220 {
221 if ( currentItem() >= 0 ) { 221 if ( currentItem() >= 0 ) {
222 emit doubleClicked( item( currentItem() ) ); 222 emit doubleClicked( item( currentItem() ) );
223 e->accept(); 223 e->accept();
224 } else { 224 } else {
225 e->ignore(); 225 e->ignore();
226 } 226 }
227 } 227 }
228 break; 228 break;
229 case Key_Shift: 229 case Key_Shift:
230 emit shiftDown(); 230 emit shiftDown();
231 break; 231 break;
232 default: 232 default:
233 e->ignore(); 233 e->ignore();
234 break; 234 break;
235 } 235 }
236} 236}
237 237
238void KNoScrollListBox::oneDown() 238void KNoScrollListBox::oneDown()
239{ 239{
240 if ( count () ) { 240 if ( count () ) {
241 if ( currentItem()+1 == count () ) { 241 if ( currentItem()+1 == count () ) {
242 emit nextCell(); 242 emit nextCell();
243 } else { 243 } else {
244 resetOnFocusIn = false; 244 resetOnFocusIn = false;
245 setCurrentItem((currentItem()+1)%count()); 245 setCurrentItem((currentItem()+1)%count());
246 if(!itemVisible(currentItem())) { 246 if(!itemVisible(currentItem())) {
247 if(currentItem() == 0) { 247 if(currentItem() == 0) {
248 setTopItem(0); 248 setTopItem(0);
249 } else { 249 } else {
250 setTopItem(topItem()+1); 250 setTopItem(topItem()+1);
251 } 251 }
252 } 252 }
253 } 253 }
254 } 254 }
255} 255}
256void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 256void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
257{ 257{
258 switch(e->key()) { 258 switch(e->key()) {
259 case Key_Shift: 259 case Key_Shift:
260 emit shiftUp(); 260 emit shiftUp();
261 break; 261 break;
262 default: 262 default:
263 break; 263 break;
264 } 264 }
265} 265}
266 266
267void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 267void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
268{ 268{
269 QListBox::mousePressEvent(e); 269 QListBox::mousePressEvent(e);
270 270
271 if(e->button() == RightButton) { 271 if(e->button() == RightButton) {
272 emit rightClick(); 272 emit rightClick();
273 } 273 }
274} 274}
275 275
276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
277 : QListBoxItem() 277 : QListBoxItem()
278{ 278{
279 mblockRepaint = true; 279 mblockRepaint = true;
280 setText( s ); 280 setText( s );
281 mMultiday = 0; 281 mMultiday = 0;
282 mIncidence = incidence; 282 mIncidence = incidence;
283 mDate = qd; 283 mDate = qd;
284 mRecur = false; 284 mRecur = false;
285 mAlarm = false; 285 mAlarm = false;
286 mReply = false; 286 mReply = false;
287 mInfo = false; 287 mInfo = false;
288 mdayPos = 0; 288 mdayPos = 0;
289 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 289 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
290 //qDebug("NEWWWWWWWWWWWWW "); 290 //qDebug("NEWWWWWWWWWWWWW ");
291} 291}
292void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 292void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
293{ 293{
294 setText( s ); 294 setText( s );
295 mMultiday = 0; 295 mMultiday = 0;
296 mIncidence = incidence; 296 mIncidence = incidence;
297 mDate = qd; 297 mDate = qd;
298 mRecur = false; 298 mRecur = false;
299 mAlarm = false; 299 mAlarm = false;
300 mReply = false; 300 mReply = false;
301 mInfo = false; 301 mInfo = false;
302 mdayPos = 0; 302 mdayPos = 0;
303 //qDebug("recucleeeeeeeeeeeeeeeee "); 303 //qDebug("recucleeeeeeeeeeeeeeeee ");
304} 304}
305 305
306void MonthViewItem::paint(QPainter *p) 306void MonthViewItem::paint(QPainter *p)
307{ 307{
308 if ( mblockRepaint ) { 308 if ( mblockRepaint ) {
309 //qDebug("block "); 309 //qDebug("block ");
310 return; 310 return;
311 } 311 }
312 //qDebug("NON block "); 312 //qDebug("NON block ");
313#if QT_VERSION >= 0x030000 313#if QT_VERSION >= 0x030000
314 bool sel = isSelected(); 314 bool sel = isSelected();
315#else 315#else
316 bool sel = selected(); 316 bool sel = selected();
317#endif 317#endif
318 318
319 319
320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
321 { 321 {
322 p->setBackgroundColor( palette().color( QPalette::Normal, \ 322 p->setBackgroundColor( palette().color( QPalette::Normal, \
323 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 323 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
325 } 325 }
326 int x = 1; 326 int x = 1;
327 //int y = 3;//(height() - mRecurPixmap.height()) /2; 327 //int y = 3;//(height() - mRecurPixmap.height()) /2;
328 int size = PIXMAP_SIZE; 328 int size = PIXMAP_SIZE;
329 if ( QApplication::desktop()->width() < 300 ) 329 if ( QApplication::desktop()->width() < 300 )
330 size = 3; 330 size = 3;
331 int heihei = height( listBox () ); 331 int heihei = height( listBox () );
332 int y = (heihei - size -1 ) /2; 332 int y = (heihei - size -1 ) /2;
333 333
334 if ( KOPrefs::instance()->mMonthShowIcons ) { 334 if ( KOPrefs::instance()->mMonthShowIcons ) {
335 if ( mInfo ) { 335 if ( mInfo ) {
336 p->fillRect ( x, y,size,size, Qt::darkGreen ); 336 p->fillRect ( x, y,size,size, Qt::darkGreen );
337 x += size + 1; 337 x += size + 1;
338 } 338 }
339 if ( mRecur ) { 339 if ( mRecur ) {
340 p->fillRect ( x, y,size,size, Qt::blue ); 340 p->fillRect ( x, y,size,size, Qt::blue );
341 x += size + 1; 341 x += size + 1;
342 } 342 }
343 if ( mAlarm ) { 343 if ( mAlarm ) {
344 p->fillRect ( x, y,size,size, Qt::red ); 344 p->fillRect ( x, y,size,size, Qt::red );
345 x += size + 1; 345 x += size + 1;
346 } 346 }
347 if ( mReply ) { 347 if ( mReply ) {
348 p->fillRect ( x, y,size,size, Qt::yellow ); 348 p->fillRect ( x, y,size,size, Qt::yellow );
349 x += size + 1; 349 x += size + 1;
350 } 350 }
351 } 351 }
352 if ( mMultiday ) { 352 if ( mMultiday ) {
353 int yyy = y+(size/2); 353 int yyy = y+(size/2);
354 int sizeM = size+2; 354 int sizeM = size+2;
355 p->setBrush( QBrush::SolidPattern ); 355 p->setBrush( QBrush::SolidPattern );
356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
357 if ( mMultiday == 2 || mMultiday == 3 ) { 357 if ( mMultiday == 2 || mMultiday == 3 ) {
358 QPointArray pa ( 3 ); 358 QPointArray pa ( 3 );
359 pa.setPoint (0, x, yyy ); 359 pa.setPoint (0, x, yyy );
360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
362 p->drawPolygon( pa ); 362 p->drawPolygon( pa );
363 } 363 }
364 if ( mMultiday == 2 || mMultiday == 1 ) { 364 if ( mMultiday == 2 || mMultiday == 1 ) {
365 QPointArray pa ( 3 ); 365 QPointArray pa ( 3 );
366 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 366 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
369 p->drawPolygon( pa ); 369 p->drawPolygon( pa );
370 } 370 }
371 if ( mMultiday == 1 ) { 371 if ( mMultiday == 1 ) {
372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
373 373
374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
375 } 375 }
376 if ( mMultiday == 3 ) { 376 if ( mMultiday == 3 ) {
377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
379 379
380 } 380 }
381 x += sizeM/2 + 1; 381 x += sizeM/2 + 1;
382 x += sizeM + 1; 382 x += sizeM + 1;
383 } 383 }
384 384
385 if ( mIncidence->type() == "Todo" ){ 385 if ( mIncidence->type() == "Todo" ){
386 Todo* td = ( Todo* ) mIncidence; 386 Todo* td = ( Todo* ) mIncidence;
387 if ( td->isCompleted() ) { 387 if ( td->isCompleted() ) {
388 int half = size/2; 388 int half = size/2;
389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
391 x += half+half + 4; 391 x += half+half + 4;
392 392
393 } else { 393 } else {
394 int val = td->percentComplete()/20; 394 int val = td->percentComplete()/20;
395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
396 p->drawRect ( x, y-2,7,size+4); 396 p->drawRect ( x, y-2,7,size+4);
397 x += size + 3; 397 x += size + 3;
398 } 398 }
399 } 399 }
400 QFontMetrics fm = p->fontMetrics(); 400 QFontMetrics fm = p->fontMetrics();
401 int yPos; 401 int yPos;
402 int pmheight = size; 402 int pmheight = size;
403 if( pmheight < fm.height() ) 403 if( pmheight < fm.height() )
404 yPos = fm.ascent() + fm.leading()/2; 404 yPos = fm.ascent() + fm.leading()/2;
405 else 405 else
406 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 406 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
407 p->setPen( palette().color( QPalette::Normal, sel ? \ 407 p->setPen( palette().color( QPalette::Normal, sel ? \
408 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 408 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
409 p->drawText( x, yPos, text() ); 409 p->drawText( x, yPos, text() );
410 if ( mIncidence->cancelled() ) { 410 if ( mIncidence->cancelled() ) {
411 int wid = fm.width( text() ); 411 int wid = fm.width( text() );
412 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 412 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
413 } 413 }
414 414
415} 415}
416 416
417int MonthViewItem::height(const QListBox *lb) const 417int MonthViewItem::height(const QListBox *lb) const
418{ 418{
419 int ret = 10; 419 int ret = 10;
420 if ( lb ) 420 if ( lb )
421 ret = lb->fontMetrics().lineSpacing()+1; 421 ret = lb->fontMetrics().lineSpacing()+1;
422 return ret; 422 return ret;
423} 423}
424 424
425int MonthViewItem::width(const QListBox *lb) const 425int MonthViewItem::width(const QListBox *lb) const
426{ 426{
427 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 427 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
428 int size = PIXMAP_SIZE; 428 int size = PIXMAP_SIZE;
429 if ( QApplication::desktop()->width() < 300 ) 429 if ( QApplication::desktop()->width() < 300 )
430 size = 3; 430 size = 3;
431 int x = 1; 431 int x = 1;
432 if ( KOPrefs::instance()->mMonthShowIcons ) { 432 if ( KOPrefs::instance()->mMonthShowIcons ) {
433 if ( mInfo ) { 433 if ( mInfo ) {
434 x += size + 1; 434 x += size + 1;
435 } 435 }
436 if( mRecur ) { 436 if( mRecur ) {
437 x += size+1; 437 x += size+1;
438 } 438 }
439 if( mAlarm ) { 439 if( mAlarm ) {
440 x += size+1; 440 x += size+1;
441 } 441 }
442 if( mReply ) { 442 if( mReply ) {
443 x += size+1; 443 x += size+1;
444 } 444 }
445 } 445 }
446 if( mMultiday ) { 446 if( mMultiday ) {
447 x += size+1+2+size/2; 447 x += size+1+2+size/2;
448 } 448 }
449 return( x + lb->fontMetrics().width( text() ) + 1 ); 449 return( x + lb->fontMetrics().width( text() ) + 1 );
450 } 450 }
451 if ( ! lb ) 451 if ( ! lb )
452 return 10; 452 return 10;
453 //qDebug("ret wid %d ", lb->width()); 453 //qDebug("ret wid %d ", lb->width());
454 return lb->width(); 454 return lb->width();
455} 455}
456 456
457 457
458MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 458MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
459 : KNoScrollListBox( par ), 459 : KNoScrollListBox( par ),
460 mMonthView( parent ) 460 mMonthView( parent )
461{ 461{
462 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 462 //QVBoxLayout *topLayout = new QVBoxLayout( this );
463 currentPalette = 0; 463 currentPalette = 0;
464 // mLabel = new QLabel( this );QPushButton 464 // mLabel = new QLabel( this );QPushButton
465 mLabel = new QPushButton( this ); 465 mLabel = new QPushButton( this );
466 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 466 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
467 //mLabel->setLineWidth( 1 ); 467 //mLabel->setLineWidth( 1 );
468 //mLabel->setAlignment( AlignCenter ); 468 //mLabel->setAlignment( AlignCenter );
469 mLabel->setFlat( true ); 469 mLabel->setFlat( true );
470 mLabel->setFocusPolicy(NoFocus); 470 mLabel->setFocusPolicy(NoFocus);
471 //mItemList = new KNoScrollListBox( this ); 471 //mItemList = new KNoScrollListBox( this );
472 setMinimumSize( 10, 10 ); 472 setMinimumSize( 10, 10 );
473 setFrameStyle( QFrame::Panel | QFrame::Plain ); 473 setFrameStyle( QFrame::Panel | QFrame::Plain );
474 setLineWidth( 1 ); 474 setLineWidth( 1 );
475 //topLayout->addWidget( mItemList ); 475 //topLayout->addWidget( mItemList );
476 mLabel->raise(); 476 mLabel->raise();
477 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 477 // QColor( 0,0,255 ) QColor( 160,1600,255 )
478 mStandardPalette = palette(); 478 mStandardPalette = palette();
479 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 479 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
480 480
481 enableScrollBars( false ); 481 enableScrollBars( false );
482 updateConfig(); 482 updateConfig();
483 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 483 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
484 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 484 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
485 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 485 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
486 SLOT( defaultAction( QListBoxItem * ) ) ); 486 SLOT( defaultAction( QListBoxItem * ) ) );
487 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 487 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
488 const QPoint &) ), 488 const QPoint &) ),
489 SLOT( contextMenu( QListBoxItem * ) ) ); 489 SLOT( contextMenu( QListBoxItem * ) ) );
490 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 490 connect( this, SIGNAL( highlighted( QListBoxItem *) ),
491 SLOT( selection( QListBoxItem * ) ) ); 491 SLOT( selection( QListBoxItem * ) ) );
492 492
493 /* 493 /*
494 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 494 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
495 SLOT( selection( QListBoxItem * ) ) ); 495 SLOT( selection( QListBoxItem * ) ) );
496 */ 496 */
497} 497}
498#ifdef DESKTOP_VERSION 498#ifdef DESKTOP_VERSION
499QToolTipGroup *MonthViewCell::toolTipGroup() 499QToolTipGroup *MonthViewCell::toolTipGroup()
500{ 500{
501 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 501 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
502 return mToolTipGroup; 502 return mToolTipGroup;
503} 503}
504#endif 504#endif
505 505
506void MonthViewCell::setDate( const QDate &date ) 506void MonthViewCell::setDate( const QDate &date )
507{ 507{
508 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 508 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
509 mDate = date; 509 mDate = date;
510 510
511 511
512 512
513 //resizeEvent( 0 ); 513 //resizeEvent( 0 );
514} 514}
515 515
516QDate MonthViewCell::date() const 516QDate MonthViewCell::date() const
517{ 517{
518 return mDate; 518 return mDate;
519} 519}
520 520
521void MonthViewCell::setPrimary( bool primary ) 521void MonthViewCell::setPrimary( bool primary )
522{ 522{
523 mPrimary = primary; 523 mPrimary = primary;
524 //setMyPalette(); 524 //setMyPalette();
525} 525}
526void MonthViewCell::setMyPalette() 526void MonthViewCell::setMyPalette()
527{ 527{
528 528
529 if ( mHoliday) { 529 if ( mHoliday) {
530 if ( currentPalette == 1 ) return; 530 if ( currentPalette == 1 ) return;
531 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); 531 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) ));
532 setPalette( mHolidayPalette ); 532 setPalette( mHolidayPalette );
533 //mLabel->setPalette( mHolidayPalette ); 533 //mLabel->setPalette( mHolidayPalette );
534 currentPalette = 1; 534 currentPalette = 1;
535 535
536 } else { 536 } else {
537 if ( mPrimary ) { 537 if ( mPrimary ) {
538 if ( currentPalette == 2 ) return; 538 if ( currentPalette == 2 ) return;
539 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 539 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
540 //mLabel->setPalette( mPrimaryPalette ); 540 //mLabel->setPalette( mPrimaryPalette );
541 setPalette( mPrimaryPalette ); 541 setPalette( mPrimaryPalette );
542 currentPalette = 2; 542 currentPalette = 2;
543 543
544 } else { 544 } else {
545 if ( currentPalette == 3 ) return; 545 if ( currentPalette == 3 ) return;
546 setPalette( mNonPrimaryPalette ); 546 setPalette( mNonPrimaryPalette );
547 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 547 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
548 //mLabel->setPalette( mNonPrimaryPalette );; 548 //mLabel->setPalette( mNonPrimaryPalette );;
549 currentPalette = 3; 549 currentPalette = 3;
550 } 550 }
551 } 551 }
552 //QPalette pal = palette(); 552 //QPalette pal = palette();
553 553
554 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 554 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
555} 555}
556QPalette MonthViewCell::getPalette () 556QPalette MonthViewCell::getPalette ()
557{ 557{
558 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 558 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
559 return mStandardPalette; 559 return mStandardPalette;
560 if ( mHoliday) { 560 if ( mHoliday) {
561 return mHolidayPalette ; 561 return mHolidayPalette ;
562 } else { 562 } else {
563 if ( mPrimary ) { 563 if ( mPrimary ) {
564 return mPrimaryPalette ; 564 return mPrimaryPalette ;
565 } 565 }
566 } 566 }
567 return mNonPrimaryPalette; 567 return mNonPrimaryPalette;
568} 568}
569bool MonthViewCell::isPrimary() const 569bool MonthViewCell::isPrimary() const
570{ 570{
571 return mPrimary; 571 return mPrimary;
572} 572}
573 573
574void MonthViewCell::setHoliday( bool holiday ) 574void MonthViewCell::setHoliday( bool holiday )
575{ 575{
576 mHoliday = holiday; 576 mHoliday = holiday;
577 //setMyPalette(); 577 //setMyPalette();
578} 578}
579 579
580void MonthViewCell::setHoliday( const QString &holiday ) 580void MonthViewCell::setHoliday( const QString &holiday )
581{ 581{
582 mHolidayString = holiday; 582 mHolidayString = holiday;
583 583
584 if ( !holiday.isEmpty() ) { 584 if ( !holiday.isEmpty() ) {
585 setHoliday( true ); 585 setHoliday( true );
586 } 586 }
587} 587}
588 588
589void MonthViewCell::startUpdateCell() 589void MonthViewCell::startUpdateCell()
590{ 590{
591 mdayCount = 0; 591 mdayCount = 0;
592 setFocusPolicy(NoFocus); 592 setFocusPolicy(NoFocus);
593 if ( !mMonthView->isUpdatePossible() ) 593 if ( !mMonthView->isUpdatePossible() )
594 return; 594 return;
595 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 595 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
596 while ( mitem ) { 596 while ( mitem ) {
597 mitem->setBlockRepaint( true ); 597 mitem->setBlockRepaint( true );
598 mitem = (MonthViewItem *)mitem->next(); 598 mitem = (MonthViewItem *)mitem->next();
599 } 599 }
600 if ( mAvailItemList.count() > 20 ) { 600 if ( mAvailItemList.count() > 20 ) {
601 mAvailItemList.setAutoDelete( true ); 601 mAvailItemList.setAutoDelete( true );
602 mAvailItemList.clear(); 602 mAvailItemList.clear();
603 mAvailItemList.setAutoDelete( false ); 603 mAvailItemList.setAutoDelete( false );
604 } 604 }
605 /* 605 /*
606 if ( !isVisible() ){ 606 if ( !isVisible() ){
607 return; 607 return;
608 } 608 }
609 */ 609 */
610 // qDebug("MonthViewCell::updateCell() "); 610 // qDebug("MonthViewCell::updateCell() ");
611 setPrimary( mDate.month()%2 ); 611 setPrimary( mDate.month()%2 );
612 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 612 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
613 if ( mDate == QDate::currentDate() ) { 613 if ( mDate == QDate::currentDate() ) {
614 setLineWidth( 3 ); 614 setLineWidth( 3 );
615 } else { 615 } else {
616 setLineWidth( 1 ); 616 setLineWidth( 1 );
617 } 617 }
618 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); 618 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
619 //clear(); 619 //clear();
620 while ( CurrentAvailItem ) { 620 while ( CurrentAvailItem ) {
621 MonthViewItem *item = CurrentAvailItem; 621 MonthViewItem *item = CurrentAvailItem;
622 CurrentAvailItem = (MonthViewItem *)item->next(); 622 CurrentAvailItem = (MonthViewItem *)item->next();
623 mAvailItemList.append( item ); 623 mAvailItemList.append( item );
624 takeItem ( item ); 624 takeItem ( item );
625 } 625 }
626 626
627#ifdef DESKTOP_VERSION 627#ifdef DESKTOP_VERSION
628 QToolTip::remove(this); 628 QToolTip::remove(this);
629#endif 629#endif
630 mToolTip.clear(); 630 mToolTip.clear();
631 //qApp->processEvents(); 631 //qApp->processEvents();
632#if 0 632#if 0
633 if ( !mHolidayString.isEmpty() ) { 633 if ( !mHolidayString.isEmpty() ) {
634 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 634 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
635 item->setPalette( mHolidayPalette ); 635 item->setPalette( mHolidayPalette );
636 insertItem( item ); 636 insertItem( item );
637 mToolTip.append ( mHolidayString ); 637 mToolTip.append ( mHolidayString );
638 } 638 }
639#endif 639#endif
640} 640}
641 641
642int MonthViewCell::insertEvent(Event *event) 642int MonthViewCell::insertEvent(Event *event)
643{ 643{
644 bool useToolTips = true; 644 bool useToolTips = true;
645#ifndef DEKSTOP_VERSION 645#ifndef DESKTOP_VERSION
646 useToolTips = false; 646 useToolTips = false;
647#endif 647#endif
648 QString mToolTipText; 648 QString mToolTipText;
649 setFocusPolicy(WheelFocus); 649 setFocusPolicy(WheelFocus);
650 if ( !(event->doesRecur() == Recurrence::rNone) ) { 650 if ( !(event->doesRecur() == Recurrence::rNone) ) {
651 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 651 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
652 return mdayCount; 652 return mdayCount;
653 else 653 else
654 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 654 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
655 return mdayCount; 655 return mdayCount;
656 } 656 }
657 657
658 if ( event->isHoliday()) { 658 if ( event->isHoliday()) {
659 setHoliday( true ); 659 setHoliday( true );
660 if ( mDate.dayOfWeek() == 7 ) 660 if ( mDate.dayOfWeek() == 7 )
661 setLineWidth( 3 ); 661 setLineWidth( 3 );
662 } 662 }
663 QString text; 663 QString text;
664 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 664 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
665 if (event->isMultiDay()) { 665 if (event->isMultiDay()) {
666 QString prefix = "<->";multiday = 2; 666 QString prefix = "<->";multiday = 2;
667 QString time; 667 QString time;
668 if ( event->doesRecur() ) { 668 if ( event->doesRecur() ) {
669 if ( event->recursOn( mDate) ) { 669 if ( event->recursOn( mDate) ) {
670 prefix ="->" ;multiday = 1; 670 prefix ="->" ;multiday = 1;
671 } 671 }
672 else { 672 else {
673 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 673 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
674 if ( event->recursOn( mDate.addDays( -days)) ) { 674 if ( event->recursOn( mDate.addDays( -days)) ) {
675 prefix ="<-" ;multiday = 3; 675 prefix ="<-" ;multiday = 3;
676 } 676 }
677 } 677 }
678 678
679 } else { 679 } else {
680 if (mDate == event->dtStart().date()) { 680 if (mDate == event->dtStart().date()) {
681 prefix ="->" ;multiday = 1; 681 prefix ="->" ;multiday = 1;
682 } else if (mDate == event->dtEnd().date()) { 682 } else if (mDate == event->dtEnd().date()) {
683 prefix ="<-" ;multiday = 3; 683 prefix ="<-" ;multiday = 3;
684 } 684 }
685 } 685 }
686 if ( !event->doesFloat() ) { 686 if ( !event->doesFloat() ) {
687 if ( mDate == event->dtStart().date () ) 687 if ( mDate == event->dtStart().date () )
688 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 688 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
689 else if ( mDate == event->dtEnd().date () ) 689 else if ( mDate == event->dtEnd().date () )
690 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 690 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
691 691
692 } 692 }
693 text = time + event->summary(); 693 text = time + event->summary();
694 if ( useToolTips ) 694 if ( useToolTips )
695 mToolTipText += prefix + text; 695 mToolTipText += prefix + text;
696 } else { 696 } else {
697 if (event->doesFloat()) { 697 if (event->doesFloat()) {
698 text = event->summary(); 698 text = event->summary();
699 if ( useToolTips ) 699 if ( useToolTips )
700 mToolTipText += text; 700 mToolTipText += text;
701 } 701 }
702 else { 702 else {
703 text = KGlobal::locale()->formatTime(event->dtStart().time()); 703 text = KGlobal::locale()->formatTime(event->dtStart().time());
704 text += " " + event->summary(); 704 text += " " + event->summary();
705 if ( useToolTips ) 705 if ( useToolTips )
706 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 706 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
707 } 707 }
708 } 708 }
709 if ( useToolTips && ! event->location().isEmpty() ) { 709 if ( useToolTips && ! event->location().isEmpty() ) {
710 mToolTipText += " (" + event->location() +")"; 710 mToolTipText += " (" + event->location() +")";
711 } 711 }
712 MonthViewItem *item ; 712 MonthViewItem *item ;
713 713
714 if ( mAvailItemList.count() ) { 714 if ( mAvailItemList.count() ) {
715 item = mAvailItemList.first(); 715 item = mAvailItemList.first();
716 mAvailItemList.remove( item ); 716 mAvailItemList.remove( item );
717 item->recycle( event, mDate, text ); 717 item->recycle( event, mDate, text );
718 } else { 718 } else {
719 item = new MonthViewItem( event, mDate, text ); 719 item = new MonthViewItem( event, mDate, text );
720 } 720 }
721 721
722 QPalette pal; 722 QPalette pal;
723 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 723 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
724 QStringList categories = event->categories(); 724 QStringList categories = event->categories();
725 QString cat = categories.first(); 725 QString cat = categories.first();
726 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 726 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
727 pal = getPalette(); 727 pal = getPalette();
728 if (cat.isEmpty()) { 728 if (cat.isEmpty()) {
729 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 729 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
730 } else { 730 } else {
731 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 731 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
732 } 732 }
733 733
734 } else { 734 } else {
735 if (cat.isEmpty()) { 735 if (cat.isEmpty()) {
736 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 736 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
737 } else { 737 } else {
738 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 738 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
739 } 739 }
740 } 740 }
741 741
742 } else { 742 } else {
743 pal = mStandardPalette ; 743 pal = mStandardPalette ;
744 } 744 }
745 item->setPalette( pal ); 745 item->setPalette( pal );
746 item->setRecur( event->recurrence()->doesRecur() ); 746 item->setRecur( event->recurrence()->doesRecur() );
747 item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); 747 item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
748 item->setMoreInfo( event->description().length() > 0 ); 748 item->setMoreInfo( event->description().length() > 0 );
749#ifdef DESKTOP_VERSION 749#ifdef DESKTOP_VERSION
750 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 750 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
751 KOPrefs::instance()->email()); 751 KOPrefs::instance()->email());
752 if ( me != 0 ) { 752 if ( me != 0 ) {
753 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 753 if ( me->status() == Attendee::NeedsAction && me->RSVP())
754 item->setReply(true && multiday < 2); 754 item->setReply(true && multiday < 2);
755 else 755 else
756 item->setReply(false); 756 item->setReply(false);
757 } else 757 } else
758 item->setReply(false); 758 item->setReply(false);
759#endif 759#endif
760 item->setMultiDay( multiday ); 760 item->setMultiDay( multiday );
761 if ( multiday ) { 761 if ( multiday ) {
762 insertItem( item ,mdayCount); 762 insertItem( item ,mdayCount);
763 ++mdayCount; 763 ++mdayCount;
764 } else { 764 } else {
765 uint i; 765 uint i;
766 int pos = mdayCount; 766 int pos = mdayCount;
767 for ( i = mdayCount; i < count();++i ) { 767 for ( i = mdayCount; i < count();++i ) {
768 QListBoxItem* it = this->item ( i ); 768 QListBoxItem* it = this->item ( i );
769 if ( text < it->text() ) { 769 if ( text < it->text() ) {
770 pos = i; 770 pos = i;
771 break; 771 break;
772 } 772 }
773 ++pos; 773 ++pos;
774 } 774 }
775 insertItem( item ,pos); 775 insertItem( item ,pos);
776 } 776 }
777 if ( useToolTips ) 777 if ( useToolTips ) {
778 mToolTip.append( mToolTipText ); 778 mToolTip.append( mToolTipText );
779 }
779 return mdayCount; 780 return mdayCount;
780} 781}
781void MonthViewCell::insertTodo(Todo *todo) 782void MonthViewCell::insertTodo(Todo *todo)
782{ 783{
783 setFocusPolicy(WheelFocus); 784 setFocusPolicy(WheelFocus);
784 QString text; 785 QString text;
785 if (todo->hasDueDate()) { 786 if (todo->hasDueDate()) {
786 if (!todo->doesFloat()) { 787 if (!todo->doesFloat()) {
787 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 788 text += KGlobal::locale()->formatTime(todo->dtDue().time());
788 text += " "; 789 text += " ";
789 } 790 }
790 } 791 }
791 text += todo->summary(); 792 text += todo->summary();
792 MonthViewItem *item ; 793 MonthViewItem *item ;
793 if ( mAvailItemList.count() ) { 794 if ( mAvailItemList.count() ) {
794 item = mAvailItemList.first(); 795 item = mAvailItemList.first();
795 mAvailItemList.remove( item ); 796 mAvailItemList.remove( item );
796 item->recycle( todo, mDate, text ); 797 item->recycle( todo, mDate, text );
797 } else { 798 } else {
798 item = new MonthViewItem( todo, mDate, text ); 799 item = new MonthViewItem( todo, mDate, text );
799 } 800 }
800 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 801 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
801 //item->setPalette( mStandardPalette ); 802 //item->setPalette( mStandardPalette );
802 QPalette pal; 803 QPalette pal;
803 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 804 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
804 QStringList categories = todo->categories(); 805 QStringList categories = todo->categories();
805 QString cat = categories.first(); 806 QString cat = categories.first();
806 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 807 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
807 pal = getPalette(); 808 pal = getPalette();
808 if (cat.isEmpty()) { 809 if (cat.isEmpty()) {
809 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 810 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
810 } else { 811 } else {
811 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 812 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
812 } 813 }
813 814
814 } else { 815 } else {
815 if (cat.isEmpty()) { 816 if (cat.isEmpty()) {
816 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 817 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
817 } else { 818 } else {
818 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 819 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
819 } 820 }
820 } 821 }
821 822
822 } else { 823 } else {
823 pal = mStandardPalette ; 824 pal = mStandardPalette ;
824 } 825 }
825 item->setPalette( pal ); 826 item->setPalette( pal );
826 item->setRecur( todo->recurrence()->doesRecur() ); 827 item->setRecur( todo->recurrence()->doesRecur() );
827 item->setAlarm( todo->isAlarmEnabled() ); 828 item->setAlarm( todo->isAlarmEnabled() );
828 item->setMoreInfo( todo->description().length() > 0 ); 829 item->setMoreInfo( todo->description().length() > 0 );
829 insertItem( item , count()); 830 insertItem( item , count());
830#ifdef DESKTOP_VERSION 831#ifdef DESKTOP_VERSION
831 mToolTip.append( text ); 832 mToolTip.append( text );
832#endif 833#endif
833} 834}
834void MonthViewCell::repaintfinishUpdateCell() 835void MonthViewCell::repaintfinishUpdateCell()
835{ 836{
836 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 837 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
837 while ( mitem ) { 838 while ( mitem ) {
838 mitem->setBlockRepaint( false ); 839 mitem->setBlockRepaint( false );
839 updateItem ( mitem ); 840 updateItem ( mitem );
840 mitem = (MonthViewItem *)mitem->next(); 841 mitem = (MonthViewItem *)mitem->next();
841 } 842 }
842} 843}
843void MonthViewCell::finishUpdateCell() 844void MonthViewCell::finishUpdateCell()
844{ 845{
845 846
846 847
847 848
848#ifdef DESKTOP_VERSION 849#ifdef DESKTOP_VERSION
849 if (mToolTip.count() > 0 ) { 850 if (mToolTip.count() > 0 ) {
850 mToolTip.sort(); 851 mToolTip.sort();
851 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 852 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
852 } 853 }
853#endif 854#endif
854 //sort(); 855 //sort();
855 //setMyPalette(); 856 //setMyPalette();
856 setMyPalette(); 857 setMyPalette();
857 858
858 resizeEvent( 0 ); 859 resizeEvent( 0 );
859 860
860} 861}
861void MonthViewCell::updateCell() 862void MonthViewCell::updateCell()
862{ 863{
863 //qDebug("MonthViewCell::updateCell() "); 864 //qDebug("MonthViewCell::updateCell() ");
864 if ( !mMonthView->isUpdatePossible() ) 865 if ( !mMonthView->isUpdatePossible() )
865 return; 866 return;
866 startUpdateCell(); 867 startUpdateCell();
867 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 868 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
868 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 869 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
869 Event *event; 870 Event *event;
870 for( event = events.first(); event; event = events.next() ) { // for event 871 for( event = events.first(); event; event = events.next() ) { // for event
871 insertEvent(event); 872 insertEvent(event);
872 } 873 }
873 // insert due todos 874 // insert due todos
874 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 875 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
875 Todo *todo; 876 Todo *todo;
876 for(todo = todos.first(); todo; todo = todos.next()) { 877 for(todo = todos.first(); todo; todo = todos.next()) {
877 insertTodo( todo ); 878 insertTodo( todo );
878 } 879 }
879 finishUpdateCell(); 880 finishUpdateCell();
880 // if ( isVisible()) 881 // if ( isVisible())
881 //qApp->processEvents(); 882 //qApp->processEvents();
882} 883}
883 884
884void MonthViewCell::updateConfig( bool bigFont ) // = false 885void MonthViewCell::updateConfig( bool bigFont ) // = false
885{ 886{
886 887
887 if ( bigFont ) { 888 if ( bigFont ) {
888 QFont fo = KOPrefs::instance()->mMonthViewFont; 889 QFont fo = KOPrefs::instance()->mMonthViewFont;
889 int ps = fo.pointSize() + 2; 890 int ps = fo.pointSize() + 2;
890 if ( ps < 18 ) 891 if ( ps < 18 )
891 ps += 2; 892 ps += 2;
892 fo.setPointSize( ps ); 893 fo.setPointSize( ps );
893 setFont( fo ); 894 setFont( fo );
894 } else 895 } else
895 setFont( KOPrefs::instance()->mMonthViewFont ); 896 setFont( KOPrefs::instance()->mMonthViewFont );
896 897
897 QFontMetrics fm( font() ); 898 QFontMetrics fm( font() );
898 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 899 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
899 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 900 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
900 mHolidayPalette = mStandardPalette; 901 mHolidayPalette = mStandardPalette;
901 mPrimaryPalette = mStandardPalette; 902 mPrimaryPalette = mStandardPalette;
902 mNonPrimaryPalette = mStandardPalette; 903 mNonPrimaryPalette = mStandardPalette;
903 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 904 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
904 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 905 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
905 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 906 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
906 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 907 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
907 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 908 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
908 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 909 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
909 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 910 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
910 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 911 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
911 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 912 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
912 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 913 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
913 } 914 }
914 //updateCell(); 915 //updateCell();
915} 916}
916 917
917void MonthViewCell::enableScrollBars( bool enabled ) 918void MonthViewCell::enableScrollBars( bool enabled )
918{ 919{
919 920
920 return; 921 return;
921 if ( enabled ) { 922 if ( enabled ) {
922 QListBoxItem *fi = firstItem (); 923 QListBoxItem *fi = firstItem ();
923 if (fi ) { 924 if (fi ) {
924 int ihei = fi->height( this ); 925 int ihei = fi->height( this );
925 int hei = numRows () * ihei; 926 int hei = numRows () * ihei;
926 if ( hei < height() - horizontalScrollBar()->height () ) { 927 if ( hei < height() - horizontalScrollBar()->height () ) {
927 setVScrollBarMode(QScrollView::AlwaysOff); 928 setVScrollBarMode(QScrollView::AlwaysOff);
928 } 929 }
929 else 930 else
930 setVScrollBarMode(QScrollView::Auto); 931 setVScrollBarMode(QScrollView::Auto);
931 if ( ihei *3 > height() ) { 932 if ( ihei *3 > height() ) {
932 setHScrollBarMode(QScrollView::AlwaysOff); 933 setHScrollBarMode(QScrollView::AlwaysOff);
933 } 934 }
934 else { 935 else {
935 setHScrollBarMode(QScrollView::Auto); 936 setHScrollBarMode(QScrollView::Auto);
936 } 937 }
937 } else { 938 } else {
938 setVScrollBarMode(QScrollView::Auto); 939 setVScrollBarMode(QScrollView::Auto);
939 setHScrollBarMode(QScrollView::Auto); 940 setHScrollBarMode(QScrollView::Auto);
940 } 941 }
941 } else { 942 } else {
942 setVScrollBarMode(QScrollView::AlwaysOff); 943 setVScrollBarMode(QScrollView::AlwaysOff);
943 setHScrollBarMode(QScrollView::AlwaysOff); 944 setHScrollBarMode(QScrollView::AlwaysOff);
944 } 945 }
945} 946}
946 947
947Incidence *MonthViewCell::selectedIncidence() 948Incidence *MonthViewCell::selectedIncidence()
948{ 949{
949 int index = currentItem(); 950 int index = currentItem();
950 if ( index < 0 ) return 0; 951 if ( index < 0 ) return 0;
951 952
952 MonthViewItem *mitem = 953 MonthViewItem *mitem =
953 static_cast<MonthViewItem *>( item( index ) ); 954 static_cast<MonthViewItem *>( item( index ) );
954 955
955 if ( !mitem ) return 0; 956 if ( !mitem ) return 0;
956 957
957 return mitem->incidence(); 958 return mitem->incidence();
958} 959}
959 960
960QDate MonthViewCell::selectedIncidenceDate() 961QDate MonthViewCell::selectedIncidenceDate()
961{ 962{
962 QDate qd; 963 QDate qd;
963 int index = currentItem(); 964 int index = currentItem();
964 if ( index < 0 ) return qd; 965 if ( index < 0 ) return qd;
965 966
966 MonthViewItem *mitem = 967 MonthViewItem *mitem =
967 static_cast<MonthViewItem *>( item( index ) ); 968 static_cast<MonthViewItem *>( item( index ) );
968 969
969 if ( !mitem ) return qd; 970 if ( !mitem ) return qd;
970 971
971 return mitem->incidenceDate(); 972 return mitem->incidenceDate();
972} 973}
973 974
974void MonthViewCell::deselect() 975void MonthViewCell::deselect()
975{ 976{
976 clearSelection(); 977 clearSelection();
977 enableScrollBars( false ); 978 enableScrollBars( false );
978 // updateCell(); 979 // updateCell();
979} 980}
980void MonthViewCell::select() 981void MonthViewCell::select()
981{ 982{
982 ;// updateCell(); 983 ;// updateCell();
983} 984}
984 985
985void MonthViewCell::resizeEvent ( QResizeEvent * e ) 986void MonthViewCell::resizeEvent ( QResizeEvent * e )
986{ 987{
987 if ( !mMonthView->isUpdatePossible() ) 988 if ( !mMonthView->isUpdatePossible() )
988 return; 989 return;
989 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 990 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
990 deselect(); 991 deselect();
991 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 992 mLabel->setMaximumHeight( height() - lineWidth()*2 );
992 993
993 QString text; 994 QString text;
994 mLabel->setText( text ); 995 mLabel->setText( text );
995 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 996 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
996 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 997 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
997 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 998 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
998 mLabel->resize( mLabelBigSize ); 999 mLabel->resize( mLabelBigSize );
999 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1000 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1000 } else { 1001 } else {
1001 mLabel->resize( mLabelSize ); 1002 mLabel->resize( mLabelSize );
1002 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1003 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1003 } 1004 }
1004 mLabel->setText( text ); 1005 mLabel->setText( text );
1005 1006
1006 int size = height() - mLabel->height() - lineWidth()-1; 1007 int size = height() - mLabel->height() - lineWidth()-1;
1007 //qDebug("LW %d ", lineWidth()); 1008 //qDebug("LW %d ", lineWidth());
1008 if ( size > 0 ) 1009 if ( size > 0 )
1009 verticalScrollBar()->setMaximumHeight( size ); 1010 verticalScrollBar()->setMaximumHeight( size );
1010 size = width() - mLabel->width() -lineWidth()-1; 1011 size = width() - mLabel->width() -lineWidth()-1;
1011 if ( size > 0 ) 1012 if ( size > 0 )
1012 horizontalScrollBar()->setMaximumWidth( size ); 1013 horizontalScrollBar()->setMaximumWidth( size );
1013 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1014 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1014 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1015 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1015 // mItemList->resize ( width(), height () ); 1016 // mItemList->resize ( width(), height () );
1016 if ( e ) 1017 if ( e )
1017 KNoScrollListBox::resizeEvent ( e ); 1018 KNoScrollListBox::resizeEvent ( e );
1018} 1019}
1019 1020
1020void MonthViewCell::defaultAction( QListBoxItem *item ) 1021void MonthViewCell::defaultAction( QListBoxItem *item )
1021{ 1022{
1022 1023
1023 if ( !item ) { 1024 if ( !item ) {
1024 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1025 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1025 emit newEventSignal( dt ); 1026 emit newEventSignal( dt );
1026 return; 1027 return;
1027 } 1028 }
1028 1029
1029 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1030 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1030 Incidence *incidence = eventItem->incidence(); 1031 Incidence *incidence = eventItem->incidence();
1031 if ( incidence ) mMonthView->defaultAction( incidence ); 1032 if ( incidence ) mMonthView->defaultAction( incidence );
1032} 1033}
1033void MonthViewCell::showDay() 1034void MonthViewCell::showDay()
1034{ 1035{
1035 emit showDaySignal( date() ); 1036 emit showDaySignal( date() );
1036} 1037}
1037void MonthViewCell::newEvent() 1038void MonthViewCell::newEvent()
1038{ 1039{
1039 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1040 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1040 emit newEventSignal( dt ); 1041 emit newEventSignal( dt );
1041} 1042}
1042void MonthViewCell::cellClicked( QListBoxItem *item ) 1043void MonthViewCell::cellClicked( QListBoxItem *item )
1043{ 1044{
1044 qDebug("CELL "); 1045 qDebug("CELL ");
1045 if ( item == 0 ) { 1046 if ( item == 0 ) {
1046 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1047 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1047 emit newEventSignal( dt ); 1048 emit newEventSignal( dt );
1048 return; 1049 return;
1049 } 1050 }
1050 1051
1051} 1052}
1052 1053
1053void MonthViewCell::contextMenu( QListBoxItem *item ) 1054void MonthViewCell::contextMenu( QListBoxItem *item )
1054{ 1055{
1055 if ( !item ) return; 1056 if ( !item ) return;
1056 1057
1057 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1058 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1058 Incidence *incidence = eventItem->incidence(); 1059 Incidence *incidence = eventItem->incidence();
1059 if ( incidence ) mMonthView->showContextMenu( incidence ); 1060 if ( incidence ) mMonthView->showContextMenu( incidence );
1060} 1061}
1061 1062
1062void MonthViewCell::selection( QListBoxItem *item ) 1063void MonthViewCell::selection( QListBoxItem *item )
1063{ 1064{
1064 if ( !item ) return; 1065 if ( !item ) return;
1065 1066
1066 mMonthView->setSelectedCell( this ); 1067 mMonthView->setSelectedCell( this );
1067} 1068}
1068 1069
1069 1070
1070// ******************************************************************************* 1071// *******************************************************************************
1071// ******************************************************************************* 1072// *******************************************************************************
1072// ******************************************************************************* 1073// *******************************************************************************
1073 1074
1074 1075
1075KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1076KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1076 : KOEventView( calendar, parent, name ), 1077 : KOEventView( calendar, parent, name ),
1077 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1078 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1078 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1079 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1079{ 1080{
1080 mFlagKeyPressed = false; 1081 mFlagKeyPressed = false;
1081 mShortDayLabelsM = false; 1082 mShortDayLabelsM = false;
1082 mShortDayLabelsW = false; 1083 mShortDayLabelsW = false;
1083 skipResize = false; 1084 skipResize = false;
1084 clPending = true; 1085 clPending = true;
1085 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1086 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1086 mWidStack = new QWidgetStack( this ); 1087 mWidStack = new QWidgetStack( this );
1087 QVBoxLayout* hb = new QVBoxLayout( this ); 1088 QVBoxLayout* hb = new QVBoxLayout( this );
1088 mMonthView = new QWidget( mWidStack ); 1089 mMonthView = new QWidget( mWidStack );
1089 mWeekView = new QWidget( mWidStack ); 1090 mWeekView = new QWidget( mWidStack );
1090#if QT_VERSION >= 0x030000 1091#if QT_VERSION >= 0x030000
1091 mWidStack->addWidget(mMonthView ); 1092 mWidStack->addWidget(mMonthView );
1092 mWidStack->addWidget(mWeekView ); 1093 mWidStack->addWidget(mWeekView );
1093#else 1094#else
1094 mWidStack->addWidget( mMonthView, 1 ); 1095 mWidStack->addWidget( mMonthView, 1 );
1095 mWidStack->addWidget( mWeekView , 1 ); 1096 mWidStack->addWidget( mWeekView , 1 );
1096#endif 1097#endif
1097 hb->addWidget( mNavigatorBar ); 1098 hb->addWidget( mNavigatorBar );
1098 hb->addWidget( mWidStack ); 1099 hb->addWidget( mWidStack );
1099 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1100 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1100 updatePossible = false; 1101 updatePossible = false;
1101 //updatePossible = true; 1102 //updatePossible = true;
1102 mCells.setAutoDelete( true ); 1103 mCells.setAutoDelete( true );
1103 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1104 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1104 mDayLabels.resize( mDaysPerWeek ); 1105 mDayLabels.resize( mDaysPerWeek );
1105 mDayLabelsW.resize( mDaysPerWeek ); 1106 mDayLabelsW.resize( mDaysPerWeek );
1106 QFont bfont = font(); 1107 QFont bfont = font();
1107 if ( QApplication::desktop()->width() < 650 ) { 1108 if ( QApplication::desktop()->width() < 650 ) {
1108 bfont.setPointSize( bfont.pointSize() - 2 ); 1109 bfont.setPointSize( bfont.pointSize() - 2 );
1109 } 1110 }
1110 bfont.setBold( true ); 1111 bfont.setBold( true );
1111 int i; 1112 int i;
1112 1113
1113 for( i = 0; i < mDaysPerWeek; i++ ) { 1114 for( i = 0; i < mDaysPerWeek; i++ ) {
1114 QLabel *label = new QLabel( mMonthView ); 1115 QLabel *label = new QLabel( mMonthView );
1115 label->setFont(bfont); 1116 label->setFont(bfont);
1116 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1117 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1117 label->setLineWidth(1); 1118 label->setLineWidth(1);
1118 label->setAlignment(AlignCenter); 1119 label->setAlignment(AlignCenter);
1119 mDayLabels.insert( i, label ); 1120 mDayLabels.insert( i, label );
1120 label = new QLabel( mWeekView ); 1121 label = new QLabel( mWeekView );
1121 label->setFont(bfont); 1122 label->setFont(bfont);
1122 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1123 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1123 label->setLineWidth(1); 1124 label->setLineWidth(1);
1124 label->setAlignment(AlignCenter); 1125 label->setAlignment(AlignCenter);
1125 mDayLabelsW.insert( i, label ); 1126 mDayLabelsW.insert( i, label );
1126 } 1127 }
1127 1128
1128 bfont.setBold( false ); 1129 bfont.setBold( false );
1129 mWeekLabels.resize( mNumWeeks+1 ); 1130 mWeekLabels.resize( mNumWeeks+1 );
1130 mWeekLabelsW.resize( 2 ); 1131 mWeekLabelsW.resize( 2 );
1131 for( i = 0; i < mNumWeeks+1; i++ ) { 1132 for( i = 0; i < mNumWeeks+1; i++ ) {
1132 KOWeekButton *label = new KOWeekButton( mMonthView ); 1133 KOWeekButton *label = new KOWeekButton( mMonthView );
1133 label->setFocusPolicy(NoFocus); 1134 label->setFocusPolicy(NoFocus);
1134 label->setFont(bfont); 1135 label->setFont(bfont);
1135 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1136 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1136 label->setFlat(true); 1137 label->setFlat(true);
1137 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1138 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1138 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1139 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1139 //label->setLineWidth(1); 1140 //label->setLineWidth(1);
1140 //label->setAlignment(AlignCenter); 1141 //label->setAlignment(AlignCenter);
1141 mWeekLabels.insert( i, label ); 1142 mWeekLabels.insert( i, label );
1142 } 1143 }
1143 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1144 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1144 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1145 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
1145 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1146 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1146 1147
1147 for( i = 0; i < 1+1; i++ ) { 1148 for( i = 0; i < 1+1; i++ ) {
1148 KOWeekButton *label = new KOWeekButton( mWeekView ); 1149 KOWeekButton *label = new KOWeekButton( mWeekView );
1149 label->setFocusPolicy(NoFocus); 1150 label->setFocusPolicy(NoFocus);
1150 label->setFont(bfont); 1151 label->setFont(bfont);
1151 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1152 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1152 label->setFlat(true); 1153 label->setFlat(true);
1153 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1154 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1154 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1155 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1155 //label->setLineWidth(1); 1156 //label->setLineWidth(1);
1156 //label->setAlignment(AlignCenter); 1157 //label->setAlignment(AlignCenter);
1157 mWeekLabelsW.insert( i, label ); 1158 mWeekLabelsW.insert( i, label );
1158 } 1159 }
1159 mWeekLabelsW[1]->setText( i18n("W")); 1160 mWeekLabelsW[1]->setText( i18n("W"));
1160 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1161 mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
1161 1162
1162 1163
1163 int row, col; 1164 int row, col;
1164 mCells.resize( mNumCells ); 1165 mCells.resize( mNumCells );
1165 for( row = 0; row < mNumWeeks; ++row ) { 1166 for( row = 0; row < mNumWeeks; ++row ) {
1166 for( col = 0; col < mDaysPerWeek; ++col ) { 1167 for( col = 0; col < mDaysPerWeek; ++col ) {
1167 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1168 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1168 mCells.insert( row * mDaysPerWeek + col, cell ); 1169 mCells.insert( row * mDaysPerWeek + col, cell );
1169 1170
1170 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1171 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1171 SLOT( defaultAction( Incidence * ) ) ); 1172 SLOT( defaultAction( Incidence * ) ) );
1172 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1173 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1173 SIGNAL( newEventSignal( QDateTime ) ) ); 1174 SIGNAL( newEventSignal( QDateTime ) ) );
1174 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1175 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1175 SIGNAL( showDaySignal( QDate ) ) ); 1176 SIGNAL( showDaySignal( QDate ) ) );
1176 connect( cell, SIGNAL( nextCell() ), 1177 connect( cell, SIGNAL( nextCell() ),
1177 SLOT( nextCell() ) ); 1178 SLOT( nextCell() ) );
1178 connect( cell, SIGNAL( prevCell() ), 1179 connect( cell, SIGNAL( prevCell() ),
1179 SLOT( prevCell() ) ); 1180 SLOT( prevCell() ) );
1180 } 1181 }
1181 } 1182 }
1182 mCellsW.resize( mDaysPerWeek ); 1183 mCellsW.resize( mDaysPerWeek );
1183 for( col = 0; col < mDaysPerWeek; ++col ) { 1184 for( col = 0; col < mDaysPerWeek; ++col ) {
1184 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1185 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1185 mCellsW.insert( col, cell ); 1186 mCellsW.insert( col, cell );
1186 1187
1187 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1188 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1188 SLOT( defaultAction( Incidence * ) ) ); 1189 SLOT( defaultAction( Incidence * ) ) );
1189 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1190 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1190 SIGNAL( newEventSignal( QDateTime ) ) ); 1191 SIGNAL( newEventSignal( QDateTime ) ) );
1191 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1192 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1192 SIGNAL( showDaySignal( QDate ) ) ); 1193 SIGNAL( showDaySignal( QDate ) ) );
1193 connect( cell, SIGNAL( nextCell() ), 1194 connect( cell, SIGNAL( nextCell() ),
1194 SLOT( nextCell() ) ); 1195 SLOT( nextCell() ) );
1195 connect( cell, SIGNAL( prevCell() ), 1196 connect( cell, SIGNAL( prevCell() ),
1196 SLOT( prevCell() ) ); 1197 SLOT( prevCell() ) );
1197 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1198 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1198 } 1199 }
1199 1200
1200 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1201 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1201 mContextMenu = eventPopup(); 1202 mContextMenu = eventPopup();
1202 // updateConfig(); //useless here... 1203 // updateConfig(); //useless here...
1203 // ... but we need mWidthLongDayLabel computed 1204 // ... but we need mWidthLongDayLabel computed
1204 QFontMetrics fontmetric(mDayLabels[0]->font()); 1205 QFontMetrics fontmetric(mDayLabels[0]->font());
1205 mWidthLongDayLabel = 0; 1206 mWidthLongDayLabel = 0;
1206 for (int i = 0; i < 7; i++) { 1207 for (int i = 0; i < 7; i++) {
1207 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1208 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1208 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1209 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1209 } 1210 }
1210 1211
1211 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1212 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1212 1213
1213#if 0 1214#if 0
1214 if ( mShowWeekView ) 1215 if ( mShowWeekView )
1215 mWidStack->raiseWidget( mWeekView ); 1216 mWidStack->raiseWidget( mWeekView );
1216 else 1217 else
1217 mWidStack->raiseWidget( mMonthView ); 1218 mWidStack->raiseWidget( mMonthView );
1218#endif 1219#endif
1219 1220
1220 emit incidenceSelected( 0 ); 1221 emit incidenceSelected( 0 );
1221 1222
1222 mComputeLayoutTimer = new QTimer( this ); 1223 mComputeLayoutTimer = new QTimer( this );
1223 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); 1224 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1224 1225
1225 1226
1226#ifndef DESKTOP_VERSION 1227#ifndef DESKTOP_VERSION
1227 resize( QApplication::desktop()->size() ); 1228 resize( QApplication::desktop()->size() );
1228#else 1229#else
1229 resize(640, 480 ); 1230 resize(640, 480 );
1230 updatePossible = true; 1231 updatePossible = true;
1231#endif 1232#endif
1232 computeLayout(); 1233 computeLayout();
1233 1234
1234 if ( mShowWeekView ) 1235 if ( mShowWeekView )
1235 mWidStack->raiseWidget( mWeekView ); 1236 mWidStack->raiseWidget( mWeekView );
1236 else 1237 else
1237 mWidStack->raiseWidget( mMonthView ); 1238 mWidStack->raiseWidget( mMonthView );
1238} 1239}
1239 1240
1240KOMonthView::~KOMonthView() 1241KOMonthView::~KOMonthView()
1241{ 1242{
1242 delete mContextMenu; 1243 delete mContextMenu;
1243} 1244}
1244 1245
1245void KOMonthView::selectInternalWeekNum ( int n ) 1246void KOMonthView::selectInternalWeekNum ( int n )
1246{ 1247{
1247 switchView(); 1248 switchView();
1248 if ( !KOPrefs::instance()->mMonthViewWeek ) 1249 if ( !KOPrefs::instance()->mMonthViewWeek )
1249 emit selectMonth (); 1250 emit selectMonth ();
1250 else 1251 else
1251 emit selectWeekNum ( n ); 1252 emit selectWeekNum ( n );
1252} 1253}
1253 1254
1254int KOMonthView::currentWeek() 1255int KOMonthView::currentWeek()
1255{ 1256{
1256 if ( mShowWeekView ) 1257 if ( mShowWeekView )
1257 return mWeekLabelsW[0]->getWeekNum(); 1258 return mWeekLabelsW[0]->getWeekNum();
1258 return mWeekLabels[0]->getWeekNum(); 1259 return mWeekLabels[0]->getWeekNum();
1259} 1260}
1260void KOMonthView::switchView() 1261void KOMonthView::switchView()
1261{ 1262{
1262 if ( selectedCell( ) ) 1263 if ( selectedCell( ) )
1263 selectedCell()->deselect(); 1264 selectedCell()->deselect();
1264 mShowWeekView = !mShowWeekView; 1265 mShowWeekView = !mShowWeekView;
1265 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 1266 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
1266 if ( clPending ) { 1267 if ( clPending ) {
1267 computeLayout(); 1268 computeLayout();
1268 updateConfig(); 1269 updateConfig();
1269 } 1270 }
1270 if ( mShowWeekView ) 1271 if ( mShowWeekView )
1271 mWidStack->raiseWidget( mWeekView ); 1272 mWidStack->raiseWidget( mWeekView );
1272 else 1273 else
1273 mWidStack->raiseWidget( mMonthView ); 1274 mWidStack->raiseWidget( mMonthView );
1274 clPending = false; 1275 clPending = false;
1275} 1276}
1276 1277
1277int KOMonthView::maxDatesHint() 1278int KOMonthView::maxDatesHint()
1278{ 1279{
1279 return mNumCells; 1280 return mNumCells;
1280} 1281}
1281 1282
1282int KOMonthView::currentDateCount() 1283int KOMonthView::currentDateCount()
1283{ 1284{
1284 return mNumCells; 1285 return mNumCells;
1285} 1286}
1286 1287
1287QPtrList<Incidence> KOMonthView::selectedIncidences() 1288QPtrList<Incidence> KOMonthView::selectedIncidences()
1288{ 1289{
1289 QPtrList<Incidence> selected; 1290 QPtrList<Incidence> selected;
1290 1291
1291 if ( mSelectedCell ) { 1292 if ( mSelectedCell ) {
1292 Incidence *incidence = mSelectedCell->selectedIncidence(); 1293 Incidence *incidence = mSelectedCell->selectedIncidence();
1293 if ( incidence ) selected.append( incidence ); 1294 if ( incidence ) selected.append( incidence );
1294 } 1295 }
1295 1296
1296 return selected; 1297 return selected;
1297} 1298}
1298 1299
1299DateList KOMonthView::selectedDates() 1300DateList KOMonthView::selectedDates()
1300{ 1301{
1301 DateList selected; 1302 DateList selected;
1302 1303
1303 if ( mSelectedCell ) { 1304 if ( mSelectedCell ) {
1304 QDate qd = mSelectedCell->selectedIncidenceDate(); 1305 QDate qd = mSelectedCell->selectedIncidenceDate();
1305 if ( qd.isValid() ) selected.append( qd ); 1306 if ( qd.isValid() ) selected.append( qd );
1306 } 1307 }
1307 1308
1308 return selected; 1309 return selected;
1309} 1310}
1310 1311
1311void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1312void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1312 const QDate &td) 1313 const QDate &td)
1313{ 1314{
1314#ifndef KORG_NOPRINTER 1315#ifndef KORG_NOPRINTER
1315 calPrinter->preview(CalPrinter::Month, fd, td); 1316 calPrinter->preview(CalPrinter::Month, fd, td);
1316#endif 1317#endif
1317} 1318}
1318 1319
1319void KOMonthView::updateConfig() 1320void KOMonthView::updateConfig()
1320{ 1321{
1321 1322
1322 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1323 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1323 1324
1324 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1325 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1325 mWeekStartsMonday = true; 1326 mWeekStartsMonday = true;
1326 } 1327 }
1327 QFontMetrics fontmetric(mDayLabels[0]->font()); 1328 QFontMetrics fontmetric(mDayLabels[0]->font());
1328 mWidthLongDayLabel = 0; 1329 mWidthLongDayLabel = 0;
1329 1330
1330 for (int i = 0; i < 7; i++) { 1331 for (int i = 0; i < 7; i++) {
1331 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1332 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1332 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1333 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1333 } 1334 }
1334 bool temp = mShowSatSunComp ; 1335 bool temp = mShowSatSunComp ;
1335 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1336 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1336 if ( ! mShowWeekView ) { 1337 if ( ! mShowWeekView ) {
1337 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1338 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1338 computeLayout(); 1339 computeLayout();
1339 } 1340 }
1340 updateDayLabels(); 1341 updateDayLabels();
1341 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1342 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1342 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1343 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1343 //resizeEvent( 0 ); 1344 //resizeEvent( 0 );
1344 for (uint i = 0; i < mCells.count(); ++i) { 1345 for (uint i = 0; i < mCells.count(); ++i) {
1345 mCells[i]->updateConfig(); 1346 mCells[i]->updateConfig();
1346 } 1347 }
1347 1348
1348 for (uint i = 0; i < mCellsW.count(); ++i) { 1349 for (uint i = 0; i < mCellsW.count(); ++i) {
1349 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1350 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1350 } 1351 }
1351#ifdef DESKTOP_VERSION 1352#ifdef DESKTOP_VERSION
1352 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1353 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1353#endif 1354#endif
1354 updateView(); 1355 updateView();
1355} 1356}
1356 1357
1357void KOMonthView::updateDayLabels() 1358void KOMonthView::updateDayLabels()
1358{ 1359{
1359 1360
1360 QPtrVector<QLabel> *mDayLabelsT; 1361 QPtrVector<QLabel> *mDayLabelsT;
1361 1362
1362 mDayLabelsT = &mDayLabelsW; 1363 mDayLabelsT = &mDayLabelsW;
1363 for (int i = 0; i < 7; i++) { 1364 for (int i = 0; i < 7; i++) {
1364 { 1365 {
1365 bool show = mShortDayLabelsW; 1366 bool show = mShortDayLabelsW;
1366 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1367 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1367 show = true; 1368 show = true;
1368 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1369 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1369 } 1370 }
1370 } 1371 }
1371 mDayLabelsT = &mDayLabels; 1372 mDayLabelsT = &mDayLabels;
1372 for (int i = 0; i < 7; i++) { 1373 for (int i = 0; i < 7; i++) {
1373 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { 1374 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
1374 bool show = mShortDayLabelsM; 1375 bool show = mShortDayLabelsM;
1375 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1376 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1376 show = true; 1377 show = true;
1377 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1378 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1378 } else { 1379 } else {
1379 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); 1380 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1380 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1381 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1381 1382
1382 } 1383 }
1383 } 1384 }
1384 1385
1385} 1386}
1386 1387
1387void KOMonthView::showDates(const QDate &start, const QDate &) 1388void KOMonthView::showDates(const QDate &start, const QDate &)
1388{ 1389{
1389 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1390 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1390 1391
1391 QPtrVector<MonthViewCell> *cells; 1392 QPtrVector<MonthViewCell> *cells;
1392 QPtrVector<QLabel> *dayLabels; 1393 QPtrVector<QLabel> *dayLabels;
1393 QPtrVector<KOWeekButton> *weekLabels; 1394 QPtrVector<KOWeekButton> *weekLabels;
1394 int weekNum = 6; 1395 int weekNum = 6;
1395 mStartDate = start; 1396 mStartDate = start;
1396 if ( mShowWeekView ) { 1397 if ( mShowWeekView ) {
1397 weekNum = 1; 1398 weekNum = 1;
1398 cells = &mCellsW; 1399 cells = &mCellsW;
1399 dayLabels = &mDayLabelsW; 1400 dayLabels = &mDayLabelsW;
1400 weekLabels = &mWeekLabelsW; 1401 weekLabels = &mWeekLabelsW;
1401 if ( !KGlobal::locale()->weekStartsMonday() ) { 1402 if ( !KGlobal::locale()->weekStartsMonday() ) {
1402 mStartDate = mStartDate.addDays( 1 ); 1403 mStartDate = mStartDate.addDays( 1 );
1403 } 1404 }
1404 } else { 1405 } else {
1405 cells = &mCells; 1406 cells = &mCells;
1406 dayLabels = &mDayLabels; 1407 dayLabels = &mDayLabels;
1407 weekLabels = &mWeekLabels; 1408 weekLabels = &mWeekLabels;
1408 } 1409 }
1409 1410
1410 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1411 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1411 1412
1412 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1413 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1413 mWeekStartsMonday = true; 1414 mWeekStartsMonday = true;
1414 } 1415 }
1415 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1416 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1416 1417
1417 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1418 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1418 mStartDate = mStartDate.addDays( -1 ); 1419 mStartDate = mStartDate.addDays( -1 );
1419 } 1420 }
1420 bool primary = false; 1421 bool primary = false;
1421 uint i; 1422 uint i;
1422 for( i = 0; i < (*cells).size(); ++i ) { 1423 for( i = 0; i < (*cells).size(); ++i ) {
1423 QDate date = mStartDate.addDays( i ); 1424 QDate date = mStartDate.addDays( i );
1424 (*cells)[i]->setDate( date ); 1425 (*cells)[i]->setDate( date );
1425 1426
1426#ifndef KORG_NOPLUGINS 1427#ifndef KORG_NOPLUGINS
1427 // add holiday, if present 1428 // add holiday, if present
1428 QString hstring(KOCore::self()->holiday(date)); 1429 QString hstring(KOCore::self()->holiday(date));
1429 (*cells)[i]->setHoliday( hstring ); 1430 (*cells)[i]->setHoliday( hstring );
1430#endif 1431#endif
1431 1432
1432 } 1433 }
1433 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1434 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1434 for( i = 0; i < weekNum; ++i ) { 1435 for( i = 0; i < weekNum; ++i ) {
1435 int wno; 1436 int wno;
1436 // remember, according to ISO 8601, the first week of the year is the 1437 // remember, according to ISO 8601, the first week of the year is the
1437 // first week that contains a thursday. Thus we must subtract off 4, 1438 // first week that contains a thursday. Thus we must subtract off 4,
1438 // not just 1. 1439 // not just 1.
1439 int dayOfYear = date.dayOfYear(); 1440 int dayOfYear = date.dayOfYear();
1440 if (dayOfYear % 7 != 0) 1441 if (dayOfYear % 7 != 0)
1441 wno = dayOfYear / 7 + 1; 1442 wno = dayOfYear / 7 + 1;
1442 else 1443 else
1443 wno =dayOfYear / 7; 1444 wno =dayOfYear / 7;
1444 (*weekLabels)[i]->setWeekNum( wno ); 1445 (*weekLabels)[i]->setWeekNum( wno );
1445 date = date.addDays( 7 ); 1446 date = date.addDays( 7 );
1446 } 1447 }
1447 updateView(); 1448 updateView();
1448} 1449}
1449 1450
1450void KOMonthView::showEvents(QPtrList<Event>) 1451void KOMonthView::showEvents(QPtrList<Event>)
1451{ 1452{
1452 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1453 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1453} 1454}
1454 1455
1455void KOMonthView::changeEventDisplay(Event *, int) 1456void KOMonthView::changeEventDisplay(Event *, int)
1456{ 1457{
1457 // this should be re-written to be much more efficient, but this 1458 // this should be re-written to be much more efficient, but this
1458 // quick-and-dirty-hack gets the job done for right now. 1459 // quick-and-dirty-hack gets the job done for right now.
1459 //qDebug("KOMonthView::changeEventDisplay "); 1460 //qDebug("KOMonthView::changeEventDisplay ");
1460 updateView(); 1461 updateView();
1461} 1462}
1462 1463
1463void KOMonthView::updateView() 1464void KOMonthView::updateView()
1464{ 1465{
1465 1466
1466 if ( !updatePossible ) 1467 if ( !updatePossible )
1467 return; 1468 return;
1468 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1469 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1469 //QTime ti; 1470 //QTime ti;
1470 //ti.start(); 1471 //ti.start();
1471 clearSelection(); 1472 clearSelection();
1472 QPtrVector<MonthViewCell> *cells; 1473 QPtrVector<MonthViewCell> *cells;
1473 if ( mShowWeekView ) { 1474 if ( mShowWeekView ) {
1474 cells = &mCellsW; 1475 cells = &mCellsW;
1475 } else { 1476 } else {
1476 cells = &mCells; 1477 cells = &mCells;
1477 } 1478 }
1478#if 1 1479#if 1
1479 int i; 1480 int i;
1480 int timeSpan = (*cells).size()-1; 1481 int timeSpan = (*cells).size()-1;
1481 if ( KOPrefs::instance()->mMonthViewWeek ) 1482 if ( KOPrefs::instance()->mMonthViewWeek )
1482 timeSpan = 6; 1483 timeSpan = 6;
1483 for( i = 0; i < timeSpan + 1; ++i ) { 1484 for( i = 0; i < timeSpan + 1; ++i ) {
1484 (*cells)[i]->startUpdateCell(); 1485 (*cells)[i]->startUpdateCell();
1485 } 1486 }
1486 1487
1487 QPtrList<Event> events = calendar()->events(); 1488 QPtrList<Event> events = calendar()->events();
1488 Event *event; 1489 Event *event;
1489 QDateTime dt; 1490 QDateTime dt;
1490 bool ok; 1491 bool ok;
1491 QDate endDate = mStartDate.addDays( timeSpan ); 1492 QDate endDate = mStartDate.addDays( timeSpan );
1492 for( event = events.first(); event; event = events.next() ) { // for event 1493 for( event = events.first(); event; event = events.next() ) { // for event
1493 if ( event->doesRecur() ) { 1494 if ( event->doesRecur() ) {
1494 bool last; 1495 bool last;
1495 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1496 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1496 QDateTime incidenceEnd; 1497 QDateTime incidenceEnd;
1497 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1498 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1498 bool invalid = false; 1499 bool invalid = false;
1499 while( true ) { 1500 while( true ) {
1500 if ( incidenceStart.isValid() ) { 1501 if ( incidenceStart.isValid() ) {
1501 incidenceEnd = incidenceStart.addDays( eventlen ); 1502 incidenceEnd = incidenceStart.addDays( eventlen );
1502 int st = incidenceStart.date().daysTo( endDate ); 1503 int st = incidenceStart.date().daysTo( endDate );
1503 if ( st >= 0 ) { // start before timeend 1504 if ( st >= 0 ) { // start before timeend
1504 int end = mStartDate.daysTo( incidenceEnd.date() ); 1505 int end = mStartDate.daysTo( incidenceEnd.date() );
1505 if ( end >= 0 ) { // end after timestart --- got one! 1506 if ( end >= 0 ) { // end after timestart --- got one!
1506 //normalize 1507 //normalize
1507 st = timeSpan - st; 1508 st = timeSpan - st;
1508 if ( st < 0 ) st = 0; 1509 if ( st < 0 ) st = 0;
1509 if ( end > timeSpan ) end = timeSpan; 1510 if ( end > timeSpan ) end = timeSpan;
1510 int iii; 1511 int iii;
1511 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1512 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1512 for ( iii = st;iii<= end;++iii) 1513 for ( iii = st;iii<= end;++iii)
1513 (*cells)[iii]->insertEvent( event ); 1514 (*cells)[iii]->insertEvent( event );
1514 } 1515 }
1515 } 1516 }
1516 } else { 1517 } else {
1517 if ( invalid ) 1518 if ( invalid )
1518 break; 1519 break;
1519 invalid = true; 1520 invalid = true;
1520 //qDebug("invalid %s", event->summary().latin1()); 1521 //qDebug("invalid %s", event->summary().latin1());
1521 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 1522 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
1522 } 1523 }
1523 if ( last ) 1524 if ( last )
1524 break; 1525 break;
1525 bool ok; 1526 bool ok;
1526 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1527 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1527 if ( ! ok ) 1528 if ( ! ok )
1528 break; 1529 break;
1529 if ( incidenceStart.date() > endDate ) 1530 if ( incidenceStart.date() > endDate )
1530 break; 1531 break;
1531 } 1532 }
1532 } else { // no recur 1533 } else { // no recur
1533 int st = event->dtStart().date().daysTo( endDate ); 1534 int st = event->dtStart().date().daysTo( endDate );
1534 if ( st >= 0 ) { // start before timeend 1535 if ( st >= 0 ) { // start before timeend
1535 int end = mStartDate.daysTo( event->dtEnd().date() ); 1536 int end = mStartDate.daysTo( event->dtEnd().date() );
1536 if ( end >= 0 ) { // end after timestart --- got one! 1537 if ( end >= 0 ) { // end after timestart --- got one!
1537 //normalize 1538 //normalize
1538 st = timeSpan - st; 1539 st = timeSpan - st;
1539 if ( st < 0 ) st = 0; 1540 if ( st < 0 ) st = 0;
1540 if ( end > timeSpan ) end = timeSpan; 1541 if ( end > timeSpan ) end = timeSpan;
1541 int iii; 1542 int iii;
1542 for ( iii = st;iii<= end;++iii) 1543 for ( iii = st;iii<= end;++iii)
1543 (*cells)[iii]->insertEvent( event ); 1544 (*cells)[iii]->insertEvent( event );
1544 } 1545 }
1545 } 1546 }
1546 } 1547 }
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index d67ad52..8ae5b46 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -1,403 +1,422 @@
1#include "kincidenceformatter.h" 1#include "kincidenceformatter.h"
2#include <kstaticdeleter.h> 2#include <kstaticdeleter.h>
3#include <kglobal.h> 3#include <kglobal.h>
4#include <klocale.h> 4#include <klocale.h>
5#ifdef DEKTOP_VERSION 5#ifdef DEKTOP_VERSION
6#include <kabc/stdaddressbook.h> 6#include <kabc/stdaddressbook.h>
7#define size count 7#define size count
8#endif 8#endif
9 9
10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; 10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
11static KStaticDeleter<KIncidenceFormatter> insd; 11static KStaticDeleter<KIncidenceFormatter> insd;
12 12
13QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) 13QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified )
14{ 14{
15// #ifndef QT_NO_INPUTDIALOG 15// #ifndef QT_NO_INPUTDIALOG
16// return QInputDialog::getItem( caption, label, items, current, editable ); 16// return QInputDialog::getItem( caption, label, items, current, editable );
17// #else 17// #else
18// return QString::null; 18// return QString::null;
19// #endif 19// #endif
20 mDetails = details; 20 mDetails = details;
21 mCreated = created ; 21 mCreated = created ;
22 mModified = modified; 22 mModified = modified;
23 mText = ""; 23 mText = "";
24 if ( inc->type() == "Event" ) 24 if ( inc->type() == "Event" )
25 setEvent((Event *) inc ); 25 setEvent((Event *) inc );
26 else if ( inc->type() == "Todo" ) 26 else if ( inc->type() == "Todo" )
27 setTodo((Todo *) inc ); 27 setTodo((Todo *) inc );
28 return mText; 28 return mText;
29} 29}
30 30
31KIncidenceFormatter* KIncidenceFormatter::instance() 31KIncidenceFormatter* KIncidenceFormatter::instance()
32{ 32{
33 if (!mInstance) { 33 if (!mInstance) {
34 mInstance = insd.setObject(new KIncidenceFormatter()); 34 mInstance = insd.setObject(new KIncidenceFormatter());
35 } 35 }
36 return mInstance; 36 return mInstance;
37} 37}
38KIncidenceFormatter::~KIncidenceFormatter() 38KIncidenceFormatter::~KIncidenceFormatter()
39{ 39{
40 if (mInstance == this) 40 if (mInstance == this)
41 mInstance = insd.setObject(0); 41 mInstance = insd.setObject(0);
42 //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); 42 //qDebug("KIncidenceFormatter::~KIncidenceFormatter ");
43} 43}
44KIncidenceFormatter::KIncidenceFormatter() 44KIncidenceFormatter::KIncidenceFormatter()
45{ 45{
46 mColorMode = 0; 46 mColorMode = 0;
47} 47}
48void KIncidenceFormatter::setEvent(Event *event) 48void KIncidenceFormatter::setEvent(Event *event)
49{ 49{
50 int mode = 0; 50 int mode = 0;
51 mCurrentIncidence = event; 51 mCurrentIncidence = event;
52 bool shortDate = true; 52 bool shortDate = true;
53 if ( mode == 0 ) { 53 if ( mode == 0 ) {
54 addTag("h3",deTag(event->summary())); 54 addTag("h3",deTag(event->summary()));
55 } 55 }
56 else { 56 else {
57 if ( mColorMode == 1 ) { 57 if ( mColorMode == 1 ) {
58 mText +="<font color=\"#00A000\">"; 58 mText +="<font color=\"#00A000\">";
59 } 59 }
60 if ( mColorMode == 2 ) { 60 if ( mColorMode == 2 ) {
61 mText +="<font color=\"#C00000\">"; 61 mText +="<font color=\"#C00000\">";
62 } 62 }
63 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 63 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
64 if ( mode == 1 ) { 64 if ( mode == 1 ) {
65 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 65 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
66 } else { 66 } else {
67 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 67 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
68 } 68 }
69 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 69 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
70 if ( mColorMode ) 70 if ( mColorMode )
71 mText += "</font>"; 71 mText += "</font>";
72 } 72 }
73 if (event->cancelled ()) { 73 if (event->cancelled ()) {
74 mText +="<font color=\"#B00000\">"; 74 mText +="<font color=\"#B00000\">";
75 addTag("i",i18n("This event has been cancelled!")); 75 addTag("i",i18n("This event has been cancelled!"));
76 mText.append("<br>"); 76 mText.append("<br>");
77 mText += "</font>"; 77 mText += "</font>";
78 } 78 }
79 if (!event->location().isEmpty()) {
80 addTag("b",i18n("Location: "));
81 mText.append(deTag(event->location())+"<br>");
82 }
83 if (event->doesFloat()) { 79 if (event->doesFloat()) {
84 if (event->isMultiDay()) { 80 if (event->isMultiDay()) {
85 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 81 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
86 .arg(event->dtStartDateStr(shortDate)) 82 .arg(event->dtStartDateStr(shortDate))
87 .arg(event->dtEndDateStr(shortDate))); 83 .arg(event->dtEndDateStr(shortDate)));
88 } else { 84 } else {
89 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 85 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
90 } 86 }
91 } else { 87 } else {
92 if (event->isMultiDay()) { 88 if (event->isMultiDay()) {
93 mText.append(i18n("<p><b>From:</b> %1</p> ") 89 mText.append(i18n("<p><b>From:</b> %1</p> ")
94 .arg(event->dtStartStr( shortDate))); 90 .arg(event->dtStartStr( shortDate)));
95 mText.append(i18n("<p><b>To:</b> %1</p>") 91 mText.append(i18n("<p><b>To:</b> %1</p>")
96 .arg(event->dtEndStr(shortDate))); 92 .arg(event->dtEndStr(shortDate)));
97 } else { 93 } else {
98 mText.append(i18n("<p><b>On:</b> %1</p> ")
99 .arg(event->dtStartDateStr( shortDate )));
100 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 94 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
101 .arg(event->dtStartTimeStr()) 95 .arg(event->dtStartTimeStr())
102 .arg(event->dtEndTimeStr())); 96 .arg(event->dtEndTimeStr()));
97 mText.append(i18n("<p><b>On:</b> %1</p> ")
98 .arg(event->dtStartDateStr( shortDate )));
103 } 99 }
104 } 100 }
101 if (!event->location().isEmpty()) {
102 addTag("b",i18n("Location: "));
103 mText.append(deTag(event->location())+"<br>");
104 }
105 105
106 if (event->recurrence()->doesRecur()) { 106 if (event->recurrence()->doesRecur()) {
107 107
108 QString recurText = event->recurrence()->recurrenceText(); 108 QString recurText = event->recurrence()->recurrenceText();
109 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 109 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
110 110
111 bool ok; 111 bool ok;
112 QDate start = QDate::currentDate(); 112 QDate start = QDate::currentDate();
113 QDateTime next; 113 QDateTime next;
114 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 114 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
115 if ( ok ) { 115 if ( ok ) {
116 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 116 addTag("p",i18n("<b>Next recurrence is on:</b>") );
117 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 117 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
118 118
119 } else { 119 } else {
120 bool last; 120 bool last;
121 QDate nextd; 121 QDate nextd;
122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
123 if ( last ) { 123 if ( last ) {
124 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 124 addTag("p",i18n("<b>Last recurrence was on:</b>") );
125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
126 } 126 }
127 } 127 }
128 } 128 }
129 129
130 130
131 if (event->isAlarmEnabled()) { 131 if (event->isAlarmEnabled()) {
132 Alarm *alarm =event->alarms().first() ; 132 Alarm *alarm =event->alarms().first() ;
133 QDateTime t = alarm->time(); 133 QDateTime t = alarm->time();
134 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 134 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
135 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 135 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
136 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 136 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
137 //addTag("p",s); 137 //addTag("p",s);
138 } 138 }
139 139
140 140
141 141
142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
143 // mText.append(event->secrecyStr()+"<br>"); 143 // mText.append(event->secrecyStr()+"<br>");
144 formatCategories(event); 144 formatCategories(event);
145 if ( mDetails ) {
146 if (!event->description().isEmpty()) {
147 addTag("p",i18n("<b>Details: </b>"));
148 addTag("p",deTag(event->description()));
149 }
150 }
151 145
152 formatReadOnly(event); 146 formatReadOnly(event);
153 formatAttendees(event); 147 formatAttendees(event);
154 148
155 if ( mCreated ) { 149 if ( mCreated ) {
150#ifdef DESKTOP_VERSION
151 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
152#else
156 addTag("p",i18n("<b>Created: ") +" </b>"); 153 addTag("p",i18n("<b>Created: ") +" </b>");
157 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 154 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
155#endif
158 156
159 } 157 }
160 if ( mModified ) { 158 if ( mModified ) {
159#ifdef DESKTOP_VERSION
160 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
161#else
161 addTag("p",i18n("<b>Last modified: ") +" </b>"); 162 addTag("p",i18n("<b>Last modified: ") +" </b>");
162 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 163 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
164#endif
163 165
164 } 166 }
167 if ( mDetails ) {
168 if (!event->description().isEmpty()) {
169 addTag("p",i18n("<b>Details: </b>"));
170 addTag("p",deTag(event->description()));
171 }
172 }
165 173
166} 174}
167 175
168void KIncidenceFormatter::setTodo(Todo *event ) 176void KIncidenceFormatter::setTodo(Todo *event )
169{ 177{
170 int mode = 0; 178 int mode = 0;
171 mCurrentIncidence = event; 179 mCurrentIncidence = event;
172 bool shortDate = true; 180 bool shortDate = true;
173 if (mode == 0 ) 181 if (mode == 0 )
174 addTag("h3",deTag(event->summary())); 182 addTag("h3",deTag(event->summary()));
175 else { 183 else {
176 if ( mColorMode == 1 ) { 184 if ( mColorMode == 1 ) {
177 mText +="<font color=\"#00A000\">"; 185 mText +="<font color=\"#00A000\">";
178 } 186 }
179 if ( mColorMode == 2 ) { 187 if ( mColorMode == 2 ) {
180 mText +="<font color=\"#B00000\">"; 188 mText +="<font color=\"#B00000\">";
181 } 189 }
182 if ( mode == 1 ) { 190 if ( mode == 1 ) {
183 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 191 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
184 } else { 192 } else {
185 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 193 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
186 } 194 }
187 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 195 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
188 if ( mColorMode ) 196 if ( mColorMode )
189 mText += "</font>"; 197 mText += "</font>";
190 } 198 }
191 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 199 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
192 mText +="<font color=\"#B00000\">"; 200 mText +="<font color=\"#B00000\">";
193 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); 201 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
194 mText += "</font>"; 202 mText += "</font>";
195 } else { 203 } else {
196 mText.append(i18n("<p><i>%1 % completed</i></p>") 204 mText.append(i18n("<p><i>%1 % completed</i></p>")
197 .arg(event->percentComplete())); 205 .arg(event->percentComplete()));
198 } 206 }
199 if (event->cancelled ()) { 207 if (event->cancelled ()) {
200 mText +="<font color=\"#B00000\">"; 208 mText +="<font color=\"#B00000\">";
201 addTag("i",i18n("This todo has been cancelled!")); 209 addTag("i",i18n("This todo has been cancelled!"));
202 mText.append("<br>"); 210 mText.append("<br>");
203 mText += "</font>"; 211 mText += "</font>";
204 } 212 }
205 213
206 if (!event->location().isEmpty()) { 214
207 addTag("b",i18n("Location: "));
208 mText.append(deTag(event->location())+"<br>");
209 }
210
211 if (event->recurrence()->doesRecur()) { 215 if (event->recurrence()->doesRecur()) {
212 216
213 QString recurText = event->recurrence()->recurrenceText(); 217 QString recurText = event->recurrence()->recurrenceText();
214 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 218 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
215 } 219 }
216 220
217 if (event->hasStartDate()) { 221 if (event->hasStartDate()) {
218 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); 222 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
219 } 223 }
220 224
221 225
222 if (event->hasDueDate()) { 226 if (event->hasDueDate()) {
223 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 227 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
224 } 228 }
229
230 if (!event->location().isEmpty()) {
231 addTag("b",i18n("Location: "));
232 mText.append(deTag(event->location())+"<br>");
233 }
234
225 mText.append(i18n("<p><b>Priority:</b> %2</p>") 235 mText.append(i18n("<p><b>Priority:</b> %2</p>")
226 .arg(QString::number(event->priority()))); 236 .arg(QString::number(event->priority())));
227 237
228 if (event->isAlarmEnabled()) { 238 if (event->isAlarmEnabled()) {
229 Alarm *alarm =event->alarms().first() ; 239 Alarm *alarm =event->alarms().first() ;
230 QDateTime t = alarm->time(); 240 QDateTime t = alarm->time();
231 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 241 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
232 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 242 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
233 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 243 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
234 //addTag("p",s); 244 //addTag("p",s);
235 } 245 }
236 246
237 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 247 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
238 formatCategories(event); 248 formatCategories(event);
239 if ( mDetails ) { 249
240 if (!event->description().isEmpty()) {
241 addTag("p",i18n("<b>Details: </b>"));
242 addTag("p",deTag(event->description()));
243 }
244 }
245 formatReadOnly(event); 250 formatReadOnly(event);
246 formatAttendees(event); 251 formatAttendees(event);
247 if ( mCreated ) { 252 if ( mCreated ) {
253#ifdef DESKTOP_VERSION
254 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
255#else
248 addTag("p",i18n("<b>Created: ") +" </b>"); 256 addTag("p",i18n("<b>Created: ") +" </b>");
249 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 257 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
258#endif
250 259
251 } 260 }
252 if ( mModified ) { 261 if ( mModified ) {
262#ifdef DESKTOP_VERSION
263 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
264#else
253 addTag("p",i18n("<b>Last modified: ") +" </b>"); 265 addTag("p",i18n("<b>Last modified: ") +" </b>");
254 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 266 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
267#endif
255 268
256 } 269 }
270 if ( mDetails ) {
271 if (!event->description().isEmpty()) {
272 addTag("p",i18n("<b>Details: </b>"));
273 addTag("p",deTag(event->description()));
274 }
275 }
257} 276}
258 277
259void KIncidenceFormatter::setJournal(Journal* ) 278void KIncidenceFormatter::setJournal(Journal* )
260{ 279{
261 280
262} 281}
263 282
264void KIncidenceFormatter::formatCategories(Incidence *event) 283void KIncidenceFormatter::formatCategories(Incidence *event)
265{ 284{
266 if (!event->categoriesStr().isEmpty()) { 285 if (!event->categoriesStr().isEmpty()) {
267 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); 286 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() );
268 //mText.append(event->categoriesStr()); 287 //mText.append(event->categoriesStr());
269 } 288 }
270} 289}
271void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 290void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
272{ 291{
273 int number=text.contains("\n"); 292 int number=text.contains("\n");
274 QString str = "<" + tag + ">"; 293 QString str = "<" + tag + ">";
275 QString tmpText=text; 294 QString tmpText=text;
276 QString tmpStr=str; 295 QString tmpStr=str;
277 if(number !=-1) 296 if(number !=-1)
278 { 297 {
279 if (number > 0) { 298 if (number > 0) {
280 int pos=0; 299 int pos=0;
281 QString tmp; 300 QString tmp;
282 for(int i=0;i<=number;i++) { 301 for(int i=0;i<=number;i++) {
283 pos=tmpText.find("\n"); 302 pos=tmpText.find("\n");
284 tmp=tmpText.left(pos); 303 tmp=tmpText.left(pos);
285 tmpText=tmpText.right(tmpText.length()-pos-1); 304 tmpText=tmpText.right(tmpText.length()-pos-1);
286 tmpStr+=tmp+"<br>"; 305 tmpStr+=tmp+"<br>";
287 } 306 }
288 } 307 }
289 else tmpStr += tmpText; 308 else tmpStr += tmpText;
290 tmpStr+="</" + tag + ">"; 309 tmpStr+="</" + tag + ">";
291 mText.append(tmpStr); 310 mText.append(tmpStr);
292 } 311 }
293 else 312 else
294 { 313 {
295 str += text + "</" + tag + ">"; 314 str += text + "</" + tag + ">";
296 mText.append(str); 315 mText.append(str);
297 } 316 }
298} 317}
299 318
300void KIncidenceFormatter::formatAttendees(Incidence *event) 319void KIncidenceFormatter::formatAttendees(Incidence *event)
301{ 320{
302 QPtrList<Attendee> attendees = event->attendees(); 321 QPtrList<Attendee> attendees = event->attendees();
303 if (attendees.count()) { 322 if (attendees.count()) {
304 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 323 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
305 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 324 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
306 addTag("h3",i18n("Organizer")); 325 addTag("h3",i18n("Organizer"));
307 mText.append("<ul><li>"); 326 mText.append("<ul><li>");
308#if 0 327#if 0
309 //ndef KORG_NOKABC 328 //ndef KORG_NOKABC
310 329
311 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 330 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
312 KABC::Addressee::List addressList; 331 KABC::Addressee::List addressList;
313 addressList = add_book->findByEmail(event->organizer()); 332 addressList = add_book->findByEmail(event->organizer());
314 KABC::Addressee o = addressList.first(); 333 KABC::Addressee o = addressList.first();
315 if (!o.isEmpty() && addressList.size()<2) { 334 if (!o.isEmpty() && addressList.size()<2) {
316 mText += "<a href=\"uid:" + o.uid() + "\">"; 335 mText += "<a href=\"uid:" + o.uid() + "\">";
317 mText += o.formattedName(); 336 mText += o.formattedName();
318 mText += "</a>\n"; 337 mText += "</a>\n";
319 } else { 338 } else {
320 mText.append(event->organizer()); 339 mText.append(event->organizer());
321 } 340 }
322#else 341#else
323 mText.append(event->organizer()); 342 mText.append(event->organizer());
324#endif 343#endif
325 if (iconPath) { 344 if (iconPath) {
326 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 345 mText += " <a href=\"mailto:" + event->organizer() + "\">";
327 mText += "<IMG src=\"" + iconPath + "\">"; 346 mText += "<IMG src=\"" + iconPath + "\">";
328 mText += "</a>\n"; 347 mText += "</a>\n";
329 } 348 }
330 mText.append("</li></ul>"); 349 mText.append("</li></ul>");
331 350
332 addTag("h3",i18n("Attendees")); 351 addTag("h3",i18n("Attendees"));
333 Attendee *a; 352 Attendee *a;
334 mText.append("<ul>"); 353 mText.append("<ul>");
335 for(a=attendees.first();a;a=attendees.next()) { 354 for(a=attendees.first();a;a=attendees.next()) {
336#if 0 355#if 0
337//ndef KORG_NOKABC 356//ndef KORG_NOKABC
338 if (a->name().isEmpty()) { 357 if (a->name().isEmpty()) {
339 addressList = add_book->findByEmail(a->email()); 358 addressList = add_book->findByEmail(a->email());
340 KABC::Addressee o = addressList.first(); 359 KABC::Addressee o = addressList.first();
341 if (!o.isEmpty() && addressList.size()<2) { 360 if (!o.isEmpty() && addressList.size()<2) {
342 mText += "<a href=\"uid:" + o.uid() + "\">"; 361 mText += "<a href=\"uid:" + o.uid() + "\">";
343 mText += o.formattedName(); 362 mText += o.formattedName();
344 mText += "</a>\n"; 363 mText += "</a>\n";
345 } else { 364 } else {
346 mText += "<li>"; 365 mText += "<li>";
347 mText.append(a->email()); 366 mText.append(a->email());
348 mText += "\n"; 367 mText += "\n";
349 } 368 }
350 } else { 369 } else {
351 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 370 mText += "<li><a href=\"uid:" + a->uid() + "\">";
352 if (!a->name().isEmpty()) mText += a->name(); 371 if (!a->name().isEmpty()) mText += a->name();
353 else mText += a->email(); 372 else mText += a->email();
354 mText += "</a>\n"; 373 mText += "</a>\n";
355 } 374 }
356#else 375#else
357 //qDebug("nokabc "); 376 //qDebug("nokabc ");
358 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 377 mText += "<li><a href=\"uid:" + a->uid() + "\">";
359 if (!a->name().isEmpty()) mText += a->name(); 378 if (!a->name().isEmpty()) mText += a->name();
360 else mText += a->email(); 379 else mText += a->email();
361 mText += "</a>\n"; 380 mText += "</a>\n";
362#endif 381#endif
363 382
364 if (!a->email().isEmpty()) { 383 if (!a->email().isEmpty()) {
365 if (iconPath) { 384 if (iconPath) {
366 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; 385 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
367 if ( a->RSVP() ) 386 if ( a->RSVP() )
368 mText += "<IMG src=\"" + iconPath + "\">"; 387 mText += "<IMG src=\"" + iconPath + "\">";
369 else 388 else
370 mText += "<IMG src=\"" + NOiconPath + "\">"; 389 mText += "<IMG src=\"" + NOiconPath + "\">";
371 mText += "</a>\n"; 390 mText += "</a>\n";
372 } 391 }
373 } 392 }
374 if (a->status() != Attendee::NeedsAction ) 393 if (a->status() != Attendee::NeedsAction )
375 mText +="[" + a->statusStr() + "] "; 394 mText +="[" + a->statusStr() + "] ";
376 if (a->role() == Attendee::Chair ) 395 if (a->role() == Attendee::Chair )
377 mText +="(" + a->roleStr().left(1) + ".)"; 396 mText +="(" + a->roleStr().left(1) + ".)";
378 } 397 }
379 mText.append("</li></ul>"); 398 mText.append("</li></ul>");
380 } 399 }
381} 400}
382 401
383void KIncidenceFormatter::formatReadOnly(Incidence *event) 402void KIncidenceFormatter::formatReadOnly(Incidence *event)
384{ 403{
385 if (event->isReadOnly()) { 404 if (event->isReadOnly()) {
386 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 405 addTag("p","<em>(" + i18n("read-only") + ")</em>");
387 } 406 }
388} 407}
389QString KIncidenceFormatter::deTag(QString text) 408QString KIncidenceFormatter::deTag(QString text)
390{ 409{
391#if QT_VERSION >= 0x030000 410#if QT_VERSION >= 0x030000
392 text.replace( '<' , "&lt;" ); 411 text.replace( '<' , "&lt;" );
393 text.replace( '>' , "&gt;" ); 412 text.replace( '>' , "&gt;" );
394#else 413#else
395 if ( text.find ('<') >= 0 ) { 414 if ( text.find ('<') >= 0 ) {
396 text.replace( QRegExp("<") , "&lt;" ); 415 text.replace( QRegExp("<") , "&lt;" );
397 } 416 }
398 if ( text.find ('>') >= 0 ) { 417 if ( text.find ('>') >= 0 ) {
399 text.replace( QRegExp(">") , "&gt;" ); 418 text.replace( QRegExp(">") , "&gt;" );
400 } 419 }
401#endif 420#endif
402 return text; 421 return text;
403} 422}