summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile662
-rw-r--r--kabc/plugins/file/resourcefile.cpp22
-rw-r--r--korganizer/datenavigatorcontainer.cpp36
-rw-r--r--korganizer/kdatenavigator.cpp1
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp26
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h1
6 files changed, 442 insertions, 306 deletions
diff --git a/Makefile b/Makefile
index df71188..594d47d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,279 +1,385 @@
1############################################################################# 1export KDEPIMDIR = $(shell pwd)
2# Makefile for building: kdepim-desktop 2
3# Generated by qmake (1.07a) (Qt 3.3.4) on: Wed Mar 30 01:16:42 2005 3export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version)
4# Project: kdepim-desktop.pro 4
5# Template: subdirs 5ifeq ($(PLATFORM) , zaurus)
6# Command: $(QMAKE) -o Makefile kdepim-desktop.pro 6 BUILD_NO_LDAP_PLUGIN=1
7############################################################################# 7endif
8 8
9 MAKEFILE =Makefile 9ifneq ($(PLATFORM) , zaurus)
10 QMAKE =qmake 10 BUILD_NO_SHARP_PLUGIN=1
11DEL_FILE = rm -f 11endif
12CHK_DIR_EXISTS= test -d 12
13MKDIR = mkdir -p 13#opie plugin is deprecated. The qtopia plugin handles the task from now on.
14INSTALL_FILE= 14BUILD_NO_OPIE_PLUGIN=1
15INSTALL_DIR = 15
16 SUBTARGETS = \ 16SUBDIRS_MICROKDE = \
17 sub-libical \ 17 libical/src/libical \
18 sub-libkcal \ 18 libical/src/libicalss \
19 sub-kabc \ 19 qtcompat \
20 sub-libkdepim \ 20 microkde \
21 sub-microkde \ 21 libkcal \
22 sub-korganizer \ 22 libkdepim \
23 sub-kaddressbook \ 23 kabc \
24 sub-kabc-plugins-file \ 24 kabc/formats/binary \
25 sub-kabc-plugins-dir \ 25 kabc/plugins/file \
26 sub-kabc-plugins-qtopia \ 26 kabc/plugins/dir \
27 sub-gammu-emb-common \ 27 korganizer \
28 sub-gammu-emb-gammu \ 28 kalarmd \
29 sub-libetpan \ 29 kaddressbook
30 sub-kmicromail-libmailwrapper \ 30
31 sub-kmicromail \ 31SUBDIRS_QTOPIA_PLUGIN = \
32 sub-pwmanager-libcrypt-cipher \ 32 kabc/plugins/qtopia
33 sub-pwmanager-libcrypt-error \ 33
34 sub-pwmanager-libcrypt-mpi \ 34SUBDIRS_OPIE_PLUGIN = \
35 sub-pwmanager-libcrypt-zlib \ 35 kabc/plugins/opie
36 sub-pwmanager-pwmanager 36
37 37SUBDIRS_SHARP_PLUGIN = \
38first: all 38 kabc/plugins/sharpdtm
39 39
40all: Makefile $(SUBTARGETS) 40SUBDIRS_LDAP_PLUGIN = \
41 41 kabc/plugins/ldap
42libical/$(MAKEFILE): 42
43 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" 43SUBDIRS_MICROMAIL = \
44 cd libical && $(QMAKE) libical.pro -o $(MAKEFILE) 44 libetpan \
45sub-libical: libical/$(MAKEFILE) FORCE 45 kmicromail/libmailwrapper \
46 cd libical && $(MAKE) -f $(MAKEFILE) 46 kmicromail
47 47
48libkcal/$(MAKEFILE): 48SUBDIRS_GAMMU = \
49 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" 49 gammu/emb/common \
50 cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE) 50 gammu/emb/gammu
51sub-libkcal: libkcal/$(MAKEFILE) FORCE 51
52 cd libkcal && $(MAKE) -f $(MAKEFILE) 52SUBDIRS_PWMANAGER = \
53 53 pwmanager/libcrypt/mpi \
54kabc/$(MAKEFILE): 54 pwmanager/libcrypt/error \
55 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" 55 pwmanager/libcrypt/cipher \
56 cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE) 56 pwmanager/libcrypt/zlib \
57sub-kabc: kabc/$(MAKEFILE) FORCE 57 pwmanager/pwmanager
58 cd kabc && $(MAKE) -f $(MAKEFILE) 58
59 59SUBDIRS = \
60libkdepim/$(MAKEFILE): 60 $(SUBDIRS_MICROKDE) \
61 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" 61 $(SUBDIRS_QTOPIA_PLUGIN) \
62 cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE) 62 $(SUBDIRS_OPIE_PLUGIN) \
63sub-libkdepim: libkdepim/$(MAKEFILE) FORCE 63 $(SUBDIRS_SHARP_PLUGIN) \
64 cd libkdepim && $(MAKE) -f $(MAKEFILE) 64 $(SUBDIRS_LDAP_PLUGIN) \
65 65 $(SUBDIRS_MICROMAIL) \
66microkde/$(MAKEFILE): 66 $(SUBDIRS_GAMMU) \
67 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" 67 $(SUBDIRS_PWMANAGER)
68 cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE) 68
69sub-microkde: microkde/$(MAKEFILE) FORCE 69
70 cd microkde && $(MAKE) -f $(MAKEFILE) 70all: build_microkde \
71 71 build_qtopia_plugin \
72korganizer/$(MAKEFILE): 72 build_opie_plugin \
73 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" 73 build_sharp_plugin \
74 cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE) 74 build_ldap_plugin \
75sub-korganizer: korganizer/$(MAKEFILE) FORCE 75 build_micromail \
76 cd korganizer && $(MAKE) -f $(MAKEFILE) 76 build_gammu \
77 77 build_pwmanager
78kaddressbook/$(MAKEFILE): 78
79 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook" 79
80 cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE) 80build_microkde: variable_test tmake
81sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE 81 for i in $(SUBDIRS_MICROKDE); do pushd $$i; \
82 cd kaddressbook && $(MAKE) -f $(MAKEFILE) 82 make -f Makefile$(PLATFORM) || exit 1; popd; \
83 83 done
84kabc/plugins/file/$(MAKEFILE): 84
85 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" 85build_qtopia_plugin: build_microkde
86 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE) 86 ifdef BUILD_NO_QTOPIA_PLUGIN
87sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE 87 @echo == qtopia plugin not build.
88 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) 88 else
89 89 for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \
90kabc/plugins/dir/$(MAKEFILE): 90 make -f Makefile$(PLATFORM) || exit 1; popd; \
91 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir" 91 done
92 cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE) 92 endif
93sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE 93
94 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE) 94build_opie_plugin: build_microkde
95 95 ifdef BUILD_NO_OPIE_PLUGIN
96kabc/plugins/qtopia/$(MAKEFILE): 96 @echo == opie plugin not build.
97 @$(CHK_DIR_EXISTS) "kabc/plugins/qtopia" || $(MKDIR) "kabc/plugins/qtopia" 97 else
98 cd kabc/plugins/qtopia && $(QMAKE) qtopia.pro -o $(MAKEFILE) 98 for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \
99sub-kabc-plugins-qtopia: kabc/plugins/qtopia/$(MAKEFILE) FORCE 99 make -f Makefile$(PLATFORM) || exit 1; popd; \
100 cd kabc/plugins/qtopia && $(MAKE) -f $(MAKEFILE) 100 done
101 101 endif
102gammu/emb/common/$(MAKEFILE): 102
103 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" 103build_sharp_plugin: build_microkde
104 cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE) 104 ifdef BUILD_NO_SHARP_PLUGIN
105sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE 105 @echo == ldap plugin not build.
106 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) 106 else
107 107 for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \
108gammu/emb/gammu/$(MAKEFILE): 108 make -f Makefile$(PLATFORM) || exit 1; popd; \
109 @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu" 109 done
110 cd gammu/emb/gammu && $(QMAKE) gammu.pro -o $(MAKEFILE) 110 endif
111sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE 111
112 cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE) 112build_ldap_plugin: build_microkde
113 113 ifdef BUILD_NO_LDAP_PLUGIN
114libetpan/$(MAKEFILE): 114 @echo == ldap plugin not build.
115 @$(CHK_DIR_EXISTS) "libetpan" || $(MKDIR) "libetpan" 115 else
116 cd libetpan && $(QMAKE) libetpan.pro -o $(MAKEFILE) 116 for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \
117sub-libetpan: libetpan/$(MAKEFILE) FORCE 117 make -f Makefile$(PLATFORM) || exit 1; popd; \
118 cd libetpan && $(MAKE) -f $(MAKEFILE) 118 done
119 119 endif
120kmicromail/libmailwrapper/$(MAKEFILE): 120
121 @$(CHK_DIR_EXISTS) "kmicromail/libmailwrapper" || $(MKDIR) "kmicromail/libmailwrapper" 121
122 cd kmicromail/libmailwrapper && $(QMAKE) libmailwrapper.pro -o $(MAKEFILE) 122build_micromail: build_microkde
123sub-kmicromail-libmailwrapper: kmicromail/libmailwrapper/$(MAKEFILE) FORCE 123 ifdef BUILD_NO_MICROMAIL
124 cd kmicromail/libmailwrapper && $(MAKE) -f $(MAKEFILE) 124 @echo == kmicromail not build.
125 125 else
126kmicromail/$(MAKEFILE): 126 for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \
127 @$(CHK_DIR_EXISTS) "kmicromail" || $(MKDIR) "kmicromail" 127 make -f Makefile$(PLATFORM) || exit 1; popd; \
128 cd kmicromail && $(QMAKE) kmicromail.pro -o $(MAKEFILE) 128 done
129sub-kmicromail: kmicromail/$(MAKEFILE) FORCE 129 endif
130 cd kmicromail && $(MAKE) -f $(MAKEFILE) 130
131 131build_gammu: variable_test tmake
132pwmanager/libcrypt/cipher/$(MAKEFILE): 132 ifdef BUILD_NO_GAMMU
133 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/cipher" || $(MKDIR) "pwmanager/libcrypt/cipher" 133 @echo == gammu not build.
134 cd pwmanager/libcrypt/cipher && $(QMAKE) cipher.pro -o $(MAKEFILE) 134 else
135sub-pwmanager-libcrypt-cipher: pwmanager/libcrypt/cipher/$(MAKEFILE) FORCE 135 for i in $(SUBDIRS_GAMMU); do pushd $$i; \
136 cd pwmanager/libcrypt/cipher && $(MAKE) -f $(MAKEFILE) 136 make -f Makefile$(PLATFORM) || exit 1; popd; \
137 137 done
138pwmanager/libcrypt/error/$(MAKEFILE): 138 endif
139 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/error" || $(MKDIR) "pwmanager/libcrypt/error" 139
140 cd pwmanager/libcrypt/error && $(QMAKE) error.pro -o $(MAKEFILE) 140build_pwmanager: build_microkde
141sub-pwmanager-libcrypt-error: pwmanager/libcrypt/error/$(MAKEFILE) FORCE 141 ifdef BUILD_NO_PWMANAGER
142 cd pwmanager/libcrypt/error && $(MAKE) -f $(MAKEFILE) 142 @echo == pwmanager not build.
143 143 else
144pwmanager/libcrypt/mpi/$(MAKEFILE): 144 for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \
145 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/mpi" || $(MKDIR) "pwmanager/libcrypt/mpi" 145 make -f Makefile$(PLATFORM) || exit 1; popd; \
146 cd pwmanager/libcrypt/mpi && $(QMAKE) mpi.pro -o $(MAKEFILE) 146 done
147sub-pwmanager-libcrypt-mpi: pwmanager/libcrypt/mpi/$(MAKEFILE) FORCE 147 endif
148 cd pwmanager/libcrypt/mpi && $(MAKE) -f $(MAKEFILE) 148
149 149
150pwmanager/libcrypt/zlib/$(MAKEFILE): 150variable_info:
151 @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/zlib" || $(MKDIR) "pwmanager/libcrypt/zlib" 151 @echo --------------------------------------
152 cd pwmanager/libcrypt/zlib && $(QMAKE) zlib.pro -o $(MAKEFILE) 152 @echo KDEPIM buildsystem, variableinfo...
153sub-pwmanager-libcrypt-zlib: pwmanager/libcrypt/zlib/$(MAKEFILE) FORCE 153 @echo KDEPIMDIR=$(KDEPIMDIR)
154 cd pwmanager/libcrypt/zlib && $(MAKE) -f $(MAKEFILE) 154 @echo QTDIR=$(QTDIR)
155 155 @echo QPEDIR=$(QPEDIR)
156pwmanager/pwmanager/$(MAKEFILE): 156 @echo OPIEDIR=$(OPIEDIR)
157 @$(CHK_DIR_EXISTS) "pwmanager/pwmanager" || $(MKDIR) "pwmanager/pwmanager" 157 @echo PLATFORM=$(PLATFORM)
158 cd pwmanager/pwmanager && $(QMAKE) pwmanager.pro -o $(MAKEFILE) 158 @echo RELEASE_DEBUG=$(RELEASE_DEBUG)
159sub-pwmanager-pwmanager: pwmanager/pwmanager/$(MAKEFILE) FORCE 159 @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL)
160 cd pwmanager/pwmanager && $(MAKE) -f $(MAKEFILE) 160 @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN)
161 161 @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN)
162Makefile: kdepim-desktop.pro /usr/lib/qt3/mkspecs/default/qmake.conf 162 @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN)
163 $(QMAKE) -o Makefile kdepim-desktop.pro 163 @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN)
164qmake: qmake_all 164 ifndef BUILD_NO_SHARP_PLUGIN
165 @$(QMAKE) -o Makefile kdepim-desktop.pro 165 @echo SHARPDTMSDK=$(SHARPDTMSDK)
166 166 endif
167all: $(SUBTARGETS) 167 @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU)
168qmake_all: libical/$(MAKEFILE) libkcal/$(MAKEFILE) kabc/$(MAKEFILE) libkdepim/$(MAKEFILE) microkde/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE) kabc/plugins/qtopia/$(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) 168 @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER)
169 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 169 @echo --------------------------------------
170 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 170
171 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 171variable_test: variable_info
172 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 172 @echo KDEPIM buildsystem, variablecheck...
173 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 173 ifndef KDEPIMDIR
174 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 174 @echo KDEPIMDIR is not defined.
175 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 175 $(error KDEPIMDIR is not defined)
176 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 176 endif
177 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 177 ifndef PLATFORM
178 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 178 @echo PLATFORM is not defined.
179 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 179 $(error PLATFORM is not defined)
180 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 180 endif
181 ( [ -d libetpan ] && cd libetpan ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 181 ifdef BUILD_NO_LDAP_PLUGIN
182 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; 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)
183 ( [ -d kmicromail ] && cd kmicromail ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 183 endif
184 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 184 ifdef BUILD_NO_OPIE_PLUGIN
185 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; 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)
186 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 186 endif
187 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 187 ifdef BUILD_NO_QTOPIA_PLUGIN
188 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; 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)
189clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE 189 endif
190 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true 190 ifdef BUILD_NO_MICROMAIL
191 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true 191 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL)
192 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true 192 endif
193 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true 193 ifdef BUILD_NO_SHARP_PLUGIN
194 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true 194 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN)
195 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true 195 else
196 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true 196 ifndef SHARPDTMSDK
197 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true 197 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK)
198 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true 198 $(error SHARPDTMSDK is not defined)
199 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; ) || true 199 endif
200 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true 200 endif
201 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true 201 ifdef BUILD_NO_GAMMU
202 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) $@; ) || true 202 @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU)
203 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) $@; ) || true 203 endif
204 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) $@; ) || true 204 ifdef BUILD_NO_PWMANAGER
205 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; ) || true 205 @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER)
206 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; ) || true 206 endif
207 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; ) || true 207 @echo --------------------------------------
208 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; ) || true 208
209 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; ) || true 209
210uninstall_subdirs: qmake_all FORCE 210objects:
211 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 211 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
212 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 212 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
213 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 213 mkdir -p libical/lib/$(PLATFORM)
214 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 214 mkdir -p dest
215 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 215 mkdir -p dest$(LIBICAL_PATH)
216 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 216 mkdir -p pwmanager/libcrypt/$(PLATFORM)
217 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 217
218 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 218clean:
219 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 219 rm -rf libical/lib/$(PLATFORM)/*;
220 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 220 rm -rf pwmanager/libcrypt/$(PLATFORM)/*;
221 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 221 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
222 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 222 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
223 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 223 done
224 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 224
225 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 225pac:
226 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 226 rm -f $(QPEDIR)/lib/libmicro*
227 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 227 rm -f $(QPEDIR)/plugins/applets/libkopi*
228 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 228 make
229 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 229 make install
230 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 230 make dist
231install_subdirs: qmake_all FORCE 231install:
232 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true 232
233 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true 233 cd bin/kdepim; make install
234 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true 234 cp -r Pim $(QPEDIR)/apps
235 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true 235 cp db2file/db2file $(QPEDIR)/bin/db2file
236 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true 236 chmod ugo+x $(QPEDIR)/bin/db2file
237 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true 237 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
238 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true 238 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
239 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true 239 cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop
240 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true 240 cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop
241 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) install; ) || true 241
242 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true 242dist:
243 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true 243 @echo Dont forget to do "make install" before "make dist"
244 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) install; ) || true 244 rm -f *arm.ipk
245 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) install; ) || true 245 rm -f *ipk.zip
246 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) install; ) || true 246 rm -rf ../kdepimpi_$(KDEPIM_VERSION)/*
247 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) install; ) || true 247 rm -f *~
248 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) install; ) || true 248 cd ..;mkdir -p kdepimpi_$(KDEPIM_VERSION)
249 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) install; ) || true 249 cd ../kdepimpi_$(KDEPIM_VERSION);mkdir -p ipk
250 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(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
251 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) install; ) || true 251 mkipks kmicrokdelibs.control
252distclean: qmake_all FORCE 252 mkipks korganizer.control
253 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 253 mkipks kaddressbook.control
254 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 254 ifndef BUILD_NO_MICROMAIL
255 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 255 mkipks kopiemail.control
256 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 256 endif
257 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 257 ifndef BUILD_NO_SHARP_PLUGIN
258 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 258 mkipks ksharpPIM-DTMaccess.control
259 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 259 endif
260 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 260 mkipks korganizer-alarm.control
261 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 261 ifndef BUILD_NO_GAMMU
262 ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 262 mkipks kmobilephoneaccess.control
263 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 263 endif
264 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 264 ifndef BUILD_NO_PWMANAGER
265 ( [ -d libetpan ] && cd libetpan ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 265 mkipks pwmanager.control
266 ( [ -d kmicromail/libmailwrapper ] && cd kmicromail/libmailwrapper ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 266 endif
267 ( [ -d kmicromail ] && cd kmicromail ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 267 mkipks pimTABicon.control
268 ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 268 zip kdepim_$(KDEPIM_VERSION)_for_SharpRom.ipk.zip *.ipk ReleaseNotes.txt
269 ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 269 mv *.ipk ../kdepimpi_$(KDEPIM_VERSION)/ipk/
270 ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 270 mv *for_SharpRom.ipk.zip ../kdepimpi_$(KDEPIM_VERSION)/
271 ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 271 mv ../kdepimpi-$(KDEPIM_VERSION).tar.gz ../kdepimpi_$(KDEPIM_VERSION)/
272 ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 272
273 273tmake: objects \
274install: install_subdirs 274 qtcompat/Makefile$(PLATFORM) \
275 275 microkde/Makefile$(PLATFORM) \
276uninstall: uninstall_subdirs 276 libkcal/Makefile$(PLATFORM) \
277 277 libkdepim/Makefile$(PLATFORM) \
278FORCE: 278 korganizer/Makefile$(PLATFORM) \
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
279 385
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 4ab7f02..0e6c2a3 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -1,421 +1,427 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#ifndef _WIN32_ 30#ifndef _WIN32_
31#include <unistd.h> 31#include <unistd.h>
32#endif 32#endif
33 33
34#include <qfile.h> 34#include <qfile.h>
35#include <qfileinfo.h> 35#include <qfileinfo.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qtimer.h> 37#include <qtimer.h>
38 38
39#include <kapplication.h> 39#include <kapplication.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <klocale.h> 42#include <klocale.h>
43//US #include <ksavefile.h> 43//US #include <ksavefile.h>
44#include <kstandarddirs.h> 44#include <kstandarddirs.h>
45#include <kmessagebox.h> 45#include <kmessagebox.h>
46 46
47#include "formatfactory.h" 47#include "formatfactory.h"
48 48
49#include "resource.h" 49#include "resource.h"
50#include "resourcefileconfig.h" 50#include "resourcefileconfig.h"
51#include "stdaddressbook.h" 51#include "stdaddressbook.h"
52#define NO_DIRWATCH 52#define NO_DIRWATCH
53#include "resourcefile.h" 53#include "resourcefile.h"
54 54
55//#define ALLOW_LOCKING 55//#define ALLOW_LOCKING
56 56
57 57
58using namespace KABC; 58using namespace KABC;
59 59
60extern "C" 60extern "C"
61#ifdef _WIN32_ 61#ifdef _WIN32_
62__declspec(dllexport) 62__declspec(dllexport)
63#else 63#else
64{ 64{
65#endif 65#endif
66 66
67//US void *init_kabc_file() 67//US void *init_kabc_file()
68 void *init_microkabc_file() 68 void *init_microkabc_file()
69 { 69 {
70 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); 70 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>();
71 } 71 }
72#ifndef _WIN32_ 72#ifndef _WIN32_
73} 73}
74#endif 74#endif
75 75
76ResourceFile::ResourceFile( const KConfig *config ) 76ResourceFile::ResourceFile( const KConfig *config )
77 : Resource( config ) , mFormat( 0 ) 77 : Resource( config ) , mFormat( 0 )
78{ 78{
79 QString fileName, formatName, default_fileName; 79 QString fileName, formatName, default_fileName;
80 80
81 default_fileName = StdAddressBook::fileName(); 81 default_fileName = StdAddressBook::fileName();
82 82
83 KConfig *cfg = (KConfig *)config; 83 KConfig *cfg = (KConfig *)config;
84 if ( cfg ) { 84 if ( cfg ) {
85 fileName = cfg->readEntry( "FileName", default_fileName ); 85 fileName = cfg->readEntry( "FileName", default_fileName );
86 formatName = cfg->readEntry( "FileFormat", "vcard" ); 86 formatName = cfg->readEntry( "FileFormat", "vcard" );
87 } else { 87 } else {
88 fileName = default_fileName; 88 fileName = default_fileName;
89 formatName = "vcard"; 89 formatName = "vcard";
90 } 90 }
91 91
92 init( fileName, formatName ); 92 init( fileName, formatName );
93} 93}
94 94
95ResourceFile::ResourceFile( const QString &fileName , 95ResourceFile::ResourceFile( const QString &fileName ,
96 const QString &formatName ) 96 const QString &formatName )
97 : Resource( 0 ) 97 : Resource( 0 )
98{ 98{
99// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); 99// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1());
100 100
101 101
102 102
103 init( fileName, formatName ); 103 init( fileName, formatName );
104} 104}
105 105
106void ResourceFile::init( const QString &fileName, const QString &formatName ) 106void ResourceFile::init( const QString &fileName, const QString &formatName )
107{ 107{
108 mFormatName = formatName; 108 mFormatName = formatName;
109 109
110 FormatFactory *factory = FormatFactory::self(); 110 FormatFactory *factory = FormatFactory::self();
111 mFormat = factory->format( mFormatName ); 111 mFormat = factory->format( mFormatName );
112 112
113 if ( !mFormat ) { 113 if ( !mFormat ) {
114 mFormatName = "vcard"; 114 mFormatName = "vcard";
115 mFormat = factory->format( mFormatName ); 115 mFormat = factory->format( mFormatName );
116 } 116 }
117 117
118#ifndef NO_DIRWATCH 118#ifndef NO_DIRWATCH
119 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 119 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
120 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 120 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
121 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 121 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
122#endif 122#endif
123 123
124 124
125 QString localKdeDir; 125 QString localKdeDir;
126 localKdeDir = readEnvPath("LOCALMICROKDEHOME"); 126 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
127 if ( ! localKdeDir.isEmpty() ) { 127 if ( ! localKdeDir.isEmpty() ) {
128 qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() ); 128 qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() );
129 129 QFileInfo fi ( fileName );
130 130 QString localname = localKdeDir + "/apps/kabc/" + fi.fileName ();
131 131 QFileInfo fi2 ( localname );
132 if ( ! fi2.exists() ) {
133 KMessageBox::error(0,i18n("Addressbook resource file not found:\n '%1'.\nIn LOCAL mode only resource files in\n'%2'\nare supported.\n(i.e. in the dir ./apps/kabc/ relative to the kapi(.exe) binary.)\n\nIf you are starting KA/Pi for the very first time\nyou will get this error message as well.\nIt will create the missing file automatically for you.").arg(localname).arg(localKdeDir+"/apps/kabc/") );
134 setFileName( localname );
135 return;
136
137 } else {
138 qDebug("Local resource file found. Changing filename to: %s",localname.latin1() );
139 setFileName( localname );
140 return;
141 }
132 142
133 } 143 }
134 qDebug("RESOURCE: %s ", fileName.latin1()); 144 setFileName( fileName );
135
136
137
138 setFileName( fileName );
139} 145}
140 146
141ResourceFile::~ResourceFile() 147ResourceFile::~ResourceFile()
142{ 148{
143 delete mFormat; 149 delete mFormat;
144 mFormat = 0; 150 mFormat = 0;
145} 151}
146 152
147void ResourceFile::writeConfig( KConfig *config ) 153void ResourceFile::writeConfig( KConfig *config )
148{ 154{
149 155
150 config->setGroup( "Resource_" + identifier() ); 156 config->setGroup( "Resource_" + identifier() );
151 Resource::writeConfig( config ); 157 Resource::writeConfig( config );
152 158
153 config->writeEntry( "FileName", fileName() ); 159 config->writeEntry( "FileName", fileName() );
154 config->writeEntry( "FileFormat", mFormatName ); 160 config->writeEntry( "FileFormat", mFormatName );
155 161
156// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); 162// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1());
157 163
158} 164}
159 165
160Ticket *ResourceFile::requestSaveTicket() 166Ticket *ResourceFile::requestSaveTicket()
161{ 167{
162 kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; 168 kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl;
163 169
164 if ( !addressBook() ) return 0; 170 if ( !addressBook() ) return 0;
165 171
166#ifdef ALLOW_LOCKING 172#ifdef ALLOW_LOCKING
167 if ( !lock( mFileName ) ) { 173 if ( !lock( mFileName ) ) {
168 qDebug("unablt to lock file "); 174 qDebug("unablt to lock file ");
169 return 0; 175 return 0;
170 } 176 }
171#endif 177#endif
172 return createTicket( this ); 178 return createTicket( this );
173} 179}
174 180
175 181
176bool ResourceFile::doOpen() 182bool ResourceFile::doOpen()
177{ 183{
178 QFile file( fileName() ); 184 QFile file( fileName() );
179 qDebug("ResourceFile::openfile %s ", fileName().latin1()); 185 qDebug("ResourceFile::openfile %s ", fileName().latin1());
180 186
181 if ( !file.exists() ) { 187 if ( !file.exists() ) {
182 // try to create the file 188 // try to create the file
183 bool ok = file.open( IO_WriteOnly ); 189 bool ok = file.open( IO_WriteOnly );
184 if ( ok ) 190 if ( ok )
185 file.close(); 191 file.close();
186 192
187 return ok; 193 return ok;
188 } else { 194 } else {
189 if ( !file.open( IO_ReadWrite ) ) 195 if ( !file.open( IO_ReadWrite ) )
190 return false; 196 return false;
191 197
192 if ( file.size() == 0 ) { 198 if ( file.size() == 0 ) {
193 file.close(); 199 file.close();
194 return true; 200 return true;
195 } 201 }
196 202
197 bool ok = mFormat->checkFormat( &file ); 203 bool ok = mFormat->checkFormat( &file );
198 file.close(); 204 file.close();
199 205
200 return ok; 206 return ok;
201 } 207 }
202} 208}
203 209
204void ResourceFile::doClose() 210void ResourceFile::doClose()
205{ 211{
206} 212}
207 213
208bool ResourceFile::load() 214bool ResourceFile::load()
209{ 215{
210 216
211 QFile file( fileName() ); 217 QFile file( fileName() );
212 if ( !file.open( IO_ReadOnly ) ) { 218 if ( !file.open( IO_ReadOnly ) ) {
213 addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) ); 219 addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) );
214 return false; 220 return false;
215 } 221 }
216 222
217// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); 223// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1());
218 224
219 return mFormat->loadAll( addressBook(), this, &file ); 225 return mFormat->loadAll( addressBook(), this, &file );
220} 226}
221 227
222bool ResourceFile::save( Ticket *ticket ) 228bool ResourceFile::save( Ticket *ticket )
223{ 229{
224// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); 230// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
225 231
226 232
227 // create backup file 233 // create backup file
228 QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); 234 QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
229 235
230/*US we use a simpler method to create a backupfile 236/*US we use a simpler method to create a backupfile
231 237
232 (void) KSaveFile::backupFile( mFileName, QString::null 238 (void) KSaveFile::backupFile( mFileName, QString::null
233 ,extension ); 239 ,extension );
234 240
235 KSaveFile saveFile( mFileName ); 241 KSaveFile saveFile( mFileName );
236 bool ok = false; 242 bool ok = false;
237 if ( saveFile.status() == 0 && saveFile.file() ) 243 if ( saveFile.status() == 0 && saveFile.file() )
238 { 244 {
239 mFormat->saveAll( addressBook(), this, saveFile.file() ); 245 mFormat->saveAll( addressBook(), this, saveFile.file() );
240 ok = saveFile.close(); 246 ok = saveFile.close();
241 } 247 }
242*/ 248*/
243 249
244//US ToDo: write backupfile 250//US ToDo: write backupfile
245#ifndef NO_DIRWATCH 251#ifndef NO_DIRWATCH
246 mDirWatch.stopScan(); 252 mDirWatch.stopScan();
247#endif 253#endif
248 QFile info; 254 QFile info;
249 info.setName( fileName() ); 255 info.setName( fileName() );
250 bool ok = info.open( IO_WriteOnly ); 256 bool ok = info.open( IO_WriteOnly );
251 if ( ok ) { 257 if ( ok ) {
252 mFormat->saveAll( addressBook(), this, &info ); 258 mFormat->saveAll( addressBook(), this, &info );
253 259
254 info.close(); 260 info.close();
255 ok = true; 261 ok = true;
256 } 262 }
257 else { 263 else {
258 264
259 } 265 }
260 266
261 if ( !ok ) 267 if ( !ok )
262 addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) ); 268 addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) );
263#ifndef NO_DIRWATCH 269#ifndef NO_DIRWATCH
264 mDirWatch.startScan(); 270 mDirWatch.startScan();
265#endif 271#endif
266 delete ticket; 272 delete ticket;
267#ifdef ALLOW_LOCKING 273#ifdef ALLOW_LOCKING
268 unlock( mFileName ); 274 unlock( mFileName );
269#endif 275#endif
270 276
271 return ok; 277 return ok;
272} 278}
273 279
274bool ResourceFile::lock( const QString &fileName ) 280bool ResourceFile::lock( const QString &fileName )
275{ 281{
276#ifdef ALLOW_LOCKING 282#ifdef ALLOW_LOCKING
277 283
278 284
279 QString fn = fileName; 285 QString fn = fileName;
280 286
281//US change the implementation how the lockfilename is getting created 287//US change the implementation how the lockfilename is getting created
282//US fn.replace( QRegExp("/"), "_" ); 288//US fn.replace( QRegExp("/"), "_" );
283//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); 289//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
284 290
285 KURL url(fn); 291 KURL url(fn);
286 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); 292 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
287 293
288 294
289 295
290 if (QFile::exists( lockName )) return false; 296 if (QFile::exists( lockName )) return false;
291 297
292 QString lockUniqueName; 298 QString lockUniqueName;
293 lockUniqueName = fn + KApplication::randomString( 8 ); 299 lockUniqueName = fn + KApplication::randomString( 8 );
294 300
295 url = lockUniqueName; 301 url = lockUniqueName;
296//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); 302//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
297 mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); 303 mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
298 kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; 304 kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
299 305
300 // Create unique file 306 // Create unique file
301 QFile file( mLockUniqueName ); 307 QFile file( mLockUniqueName );
302 file.open( IO_WriteOnly ); 308 file.open( IO_WriteOnly );
303 file.close(); 309 file.close();
304 310
305 // Create lock file 311 // Create lock file
306 int result = 0; 312 int result = 0;
307#ifndef _WIN32_ 313#ifndef _WIN32_
308 result = ::link( QFile::encodeName( mLockUniqueName ), 314 result = ::link( QFile::encodeName( mLockUniqueName ),
309 QFile::encodeName( lockName ) ); 315 QFile::encodeName( lockName ) );
310#endif 316#endif
311 if ( result == 0 ) { 317 if ( result == 0 ) {
312 addressBook()->emitAddressBookLocked(); 318 addressBook()->emitAddressBookLocked();
313 return true; 319 return true;
314 } 320 }
315 321
316 // TODO: check stat 322 // TODO: check stat
317 323
318 return false; 324 return false;
319#else 325#else
320 return true; 326 return true;
321#endif 327#endif
322} 328}
323 329
324void ResourceFile::unlock( const QString &fileName ) 330void ResourceFile::unlock( const QString &fileName )
325{ 331{
326#ifdef ALLOW_LOCKING 332#ifdef ALLOW_LOCKING
327 QString fn = fileName; 333 QString fn = fileName;
328//US change the implementation how the lockfilename is getting created 334//US change the implementation how the lockfilename is getting created
329//US fn.replace( QRegExp( "/" ), "_" ); 335//US fn.replace( QRegExp( "/" ), "_" );
330//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); 336//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
331//US QString lockName = fn + ".lock"; 337//US QString lockName = fn + ".lock";
332 KURL url(fn); 338 KURL url(fn);
333 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); 339 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
334 340
335 QFile::remove( lockName ); 341 QFile::remove( lockName );
336 QFile::remove( mLockUniqueName ); 342 QFile::remove( mLockUniqueName );
337 addressBook()->emitAddressBookUnlocked(); 343 addressBook()->emitAddressBookUnlocked();
338#else 344#else
339 return; 345 return;
340#endif 346#endif
341} 347}
342 348
343void ResourceFile::setFileName( const QString &fileName ) 349void ResourceFile::setFileName( const QString &fileName )
344{ 350{
345#ifndef NO_DIRWATCH 351#ifndef NO_DIRWATCH
346 mDirWatch.stopScan(); 352 mDirWatch.stopScan();
347 mDirWatch.removeFile( mFileName ); 353 mDirWatch.removeFile( mFileName );
348 mFileName = fileName; 354 mFileName = fileName;
349 355
350 356
351 mDirWatch.addFile( mFileName ); 357 mDirWatch.addFile( mFileName );
352 mDirWatch.startScan(); 358 mDirWatch.startScan();
353#else 359#else
354 mFileName2 = fileName; 360 mFileName2 = fileName;
355#endif 361#endif
356 362
357//US simulate KDirWatch event 363//US simulate KDirWatch event
358//US fileChanged(); 364//US fileChanged();
359} 365}
360 366
361QString ResourceFile::fileName() const 367QString ResourceFile::fileName() const
362{ 368{
363 return mFileName2; 369 return mFileName2;
364} 370}
365 371
366void ResourceFile::setFormat( const QString &format ) 372void ResourceFile::setFormat( const QString &format )
367{ 373{
368 mFormatName = format; 374 mFormatName = format;
369 delete mFormat; 375 delete mFormat;
370 376
371 FormatFactory *factory = FormatFactory::self(); 377 FormatFactory *factory = FormatFactory::self();
372 mFormat = factory->format( mFormatName ); 378 mFormat = factory->format( mFormatName );
373/*US 379/*US
374//qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1()); 380//qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1());
375 if (mFormatName == "vcard") { 381 if (mFormatName == "vcard") {
376 mFormat = new VCardFormatPlugin2(); 382 mFormat = new VCardFormatPlugin2();
377// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); 383// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
378 } 384 }
379 else if (mFormatName == "binary") { 385 else if (mFormatName == "binary") {
380 mFormat = new BinaryFormat(); 386 mFormat = new BinaryFormat();
381// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); 387// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
382 } 388 }
383 else 389 else
384 qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1()); 390 qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1());
385*/ 391*/
386 392
387} 393}
388 394
389QString ResourceFile::format() const 395QString ResourceFile::format() const
390{ 396{
391 return mFormatName; 397 return mFormatName;
392} 398}
393 399
394void ResourceFile::fileChanged() 400void ResourceFile::fileChanged()
395{ 401{
396 // There is a small theoretical chance that KDirWatch calls us before 402 // There is a small theoretical chance that KDirWatch calls us before
397 // we are fully constructed 403 // we are fully constructed
398 if (!addressBook()) 404 if (!addressBook())
399 return; 405 return;
400 406
401 407
402 QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) ); 408 QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) );
403 if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { 409 if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) {
404 load(); 410 load();
405 addressBook()->emitAddressBookChanged(); 411 addressBook()->emitAddressBookChanged();
406 } 412 }
407} 413}
408 414
409void ResourceFile::removeAddressee( const Addressee &addr ) 415void ResourceFile::removeAddressee( const Addressee &addr )
410{ 416{
411 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); 417 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) );
412 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) ); 418 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) );
413 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) ); 419 QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) );
414} 420}
415 421
416void ResourceFile::cleanUp() 422void ResourceFile::cleanUp()
417{ 423{
418 unlock( fileName() ); 424 unlock( fileName() );
419} 425}
420 426
421//US #include "resourcefile.moc" 427//US #include "resourcefile.moc"
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 27ba9e0..f6f62a4 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -1,431 +1,429 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 39 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 42{
43 mResizeEnabled = false; 43 mResizeEnabled = false;
44 mExtraViews.setAutoDelete( true ); 44 mExtraViews.setAutoDelete( true );
45 45
46 mNavigatorView = new KDateNavigator( this, name ); 46 mNavigatorView = new KDateNavigator( this, name );
47 mNavigatorView->hide(); 47 mNavigatorView->hide();
48 connectNavigatorView( mNavigatorView ); 48 connectNavigatorView( mNavigatorView );
49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
50 mLastDisplayedDN = 0; 50 mLastDisplayedDN = 0;
51 mUpdateTimer; 51 mUpdateTimer;
52 mUpdateTimer = new QTimer( this ); 52 mUpdateTimer = new QTimer( this );
53 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); 53 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
54 mFirstSelectedDate = QDate::currentDate(); 54 mFirstSelectedDate = QDate::currentDate();
55 mSelectedDateCount = 1; 55 mSelectedDateCount = 1;
56} 56}
57 57
58DateNavigatorContainer::~DateNavigatorContainer() 58DateNavigatorContainer::~DateNavigatorContainer()
59{ 59{
60} 60}
61 61
62void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 62void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
63{ 63{
64 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 64 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
65 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 65 SIGNAL( datesSelected( const KCal::DateList & ) ) );
66#if 0 66#if 0
67 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 67 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
68 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 68 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
69 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 69 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
70 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 70 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
71#endif 71#endif
72 connect( v, SIGNAL( weekClicked( const QDate & ) ), 72 connect( v, SIGNAL( weekClicked( const QDate & ) ),
73 SIGNAL( weekClicked( const QDate & ) ) ); 73 SIGNAL( weekClicked( const QDate & ) ) );
74 connect( v, SIGNAL( showMonth( const QDate & ) ), 74 connect( v, SIGNAL( showMonth( const QDate & ) ),
75 SIGNAL( showMonth( const QDate & ) ) ); 75 SIGNAL( showMonth( const QDate & ) ) );
76 76
77 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 77 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
78 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 78 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
79 79
80 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); 80 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) );
81 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); 81 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) );
82 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); 82 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) );
83 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); 83 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) );
84 84
85 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 85 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
86} 86}
87void DateNavigatorContainer::slotgoNextYear() 87void DateNavigatorContainer::slotgoNextYear()
88{ 88{
89 jumpMonth( 12 ); 89 jumpMonth( 12 );
90 emit goNextYear(); 90 emit goNextYear();
91 91
92} 92}
93void DateNavigatorContainer::slotgoPrevYear() 93void DateNavigatorContainer::slotgoPrevYear()
94{ 94{
95 jumpMonth( -12 ); 95 jumpMonth( -12 );
96 emit goPrevYear(); 96 emit goPrevYear();
97 97
98} 98}
99void DateNavigatorContainer::slotgoPrevMonth() 99void DateNavigatorContainer::slotgoPrevMonth()
100{ 100{
101 jumpMonth( -1 ); 101 jumpMonth( -1 );
102 emit goPrevMonth(); 102 emit goPrevMonth();
103 103
104} 104}
105void DateNavigatorContainer::slotgoNextMonth() 105void DateNavigatorContainer::slotgoNextMonth()
106{ 106{
107 jumpMonth( 1 ); 107 jumpMonth( 1 );
108 emit goNextMonth(); 108 emit goNextMonth();
109} 109}
110void DateNavigatorContainer::jumpMonth( int month ) 110void DateNavigatorContainer::jumpMonth( int month )
111{ 111{
112 112
113 QDate baseDate = mNavigatorView->baseDate(); 113 QDate baseDate = mNavigatorView->baseDate();
114 computeMonthSelected( baseDate.month() + month, false ); 114 computeMonthSelected( baseDate.month() + month, false );
115} 115}
116void DateNavigatorContainer::slotMonthSelected( int month ) 116void DateNavigatorContainer::slotMonthSelected( int month )
117{ 117{
118 computeMonthSelected( month, true ); 118 computeMonthSelected( month, true );
119} 119}
120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) 120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
121{ 121{
122 //qDebug("slotMonthSelected %d ", month); 122 //qDebug("slotMonthSelected %d ", month);
123 QDate baseDate = mNavigatorView->baseDate(); 123 QDate baseDate = mNavigatorView->baseDate();
124 if ( baseDate.month() == month ) 124 if ( baseDate.month() == month )
125 return; 125 return;
126 //qDebug("month %d %d ",baseDate.month(),month); 126 //qDebug("month %d %d ",baseDate.month(),month);
127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
128 date = date.addDays( -(baseDate.month()-month ) *30 ); 128 date = date.addDays( -(baseDate.month()-month ) *30 );
129 QDate newBase = QDate ( date.year(), date.month() ,1 ); 129 QDate newBase = QDate ( date.year(), date.month() ,1 );
130 130
131 //qDebug("NEW BASE %s", newBase.toString().latin1()); 131 //qDebug("NEW BASE %s", newBase.toString().latin1());
132 mNavigatorView->setBaseDate( newBase ); 132 mNavigatorView->setBaseDate( newBase );
133 QDate last = lastAvailableDate(); 133 QDate last = lastAvailableDate();
134 QDate first = firstAvailableDate(); 134 QDate first = firstAvailableDate();
135 135
136 QDate selFirst = mFirstSelectedDate; 136 QDate selFirst = mFirstSelectedDate;
137 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 137 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
138 if ( selFirst >= first && selLast <= last ) { 138 if ( selFirst >= first && selLast <= last ) {
139 setBaseDates(); 139 setBaseDates();
140 if ( forceEmit ) 140 if ( forceEmit )
141 updateDayMatrixDates(); 141 updateDayMatrixDates();
142 } 142 }
143 else { 143 else {
144 setBaseDates(); 144 setBaseDates();
145 if ( forceEmit ) 145 if ( forceEmit )
146 updateDayMatrixDates(); 146 updateDayMatrixDates();
147 if ( forceEmit ) 147 if ( forceEmit )
148 emit monthSelected( month ); 148 emit monthSelected( month );
149 } 149 }
150} 150}
151void DateNavigatorContainer::setCalendar( Calendar *cal ) 151void DateNavigatorContainer::setCalendar( Calendar *cal )
152{ 152{
153 mCalendar = cal; 153 mCalendar = cal;
154 mNavigatorView->setCalendar( cal ); 154 mNavigatorView->setCalendar( cal );
155 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 155 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
156 KDateNavigator *n = mExtraViews.at( i ); 156 KDateNavigator *n = mExtraViews.at( i );
157 n->setCalendar( cal ); 157 n->setCalendar( cal );
158 } 158 }
159} 159}
160void DateNavigatorContainer::checkUpdateDayMatrixDates() 160void DateNavigatorContainer::checkUpdateDayMatrixDates()
161{ 161{
162 //qDebug("KODNC: wid %d hei %d ", width(), height()); 162 //qDebug("KODNC: wid %d hei %d ", width(), height());
163 mUpdateTimer->stop(); 163 mUpdateTimer->stop();
164 //return; 164 //return;
165 if ( width() < 3 || height() < 3 ) 165 if ( width() < 3 || height() < 3 )
166 return; 166 return;
167 static int lastWid = 0; 167 static int lastWid = 0;
168 static int lastHei = 0; 168 static int lastHei = 0;
169 if ( lastWid == width() && height() == lastHei ) { 169 if ( lastWid == width() && height() == lastHei ) {
170 qDebug("KODNC: No layout computing needed. "); 170 qDebug("KODNC: No layout computing needed. ");
171 } else { 171 } else {
172 lastWid = width(); 172 lastWid = width();
173 lastHei = height(); 173 lastHei = height();
174 174
175 QSize minSize = mNavigatorView->yourSizeHint(); 175 QSize minSize = mNavigatorView->yourSizeHint();
176 176
177 int verticalCount = size().height() / minSize.height(); 177 int verticalCount = size().height() / minSize.height();
178 int horizontalCount = size().width() / minSize.width(); 178 int horizontalCount = size().width() / minSize.width();
179 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 179 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
180 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 180 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
181 bool fontchange = false; 181 bool fontchange = false;
182 if ( horizontalCount == 1) 182 if ( horizontalCount == 1)
183 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); 183 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
184 QFont fo; 184 QFont fo;
185 if ( horizontalCount != mHorizontalCount || 185 if ( horizontalCount != mHorizontalCount ||
186 verticalCount != mVerticalCount ) { 186 verticalCount != mVerticalCount ) {
187 uint count = horizontalCount * verticalCount; 187 uint count = horizontalCount * verticalCount;
188 if ( count == 0 ) { 188 if ( count == 0 ) {
189 bool ok; 189 bool ok;
190 fo = mNavigatorView->yourFontHint( size() , &ok ); 190 fo = mNavigatorView->yourFontHint( size() , &ok );
191 //mNavigatorView->resize( size() ); 191 //mNavigatorView->resize( size() );
192 //if ( ! ok ) 192 //if ( ! ok )
193 // return; 193 // return;
194 int butt = 2; 194 int butt = 2;
195 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); 195 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
196 if ( horizontalCount <= 1 ) 196 if ( horizontalCount <= 1 )
197 minSize = mNavigatorView->sizeHintTwoButtons( 4 ); 197 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
198 else 198 else
199 minSize = mNavigatorView->sizeHintTwoButtons(); 199 minSize = mNavigatorView->sizeHintTwoButtons();
200 verticalCount = size().height() / minSize.height(); 200 verticalCount = size().height() / minSize.height();
201 horizontalCount = size().width() / minSize.width(); 201 horizontalCount = size().width() / minSize.width();
202 if ( horizontalCount == 0 ) 202 if ( horizontalCount == 0 )
203 horizontalCount = 1; 203 horizontalCount = 1;
204 if ( verticalCount == 0 ) 204 if ( verticalCount == 0 )
205 verticalCount = 1; 205 verticalCount = 1;
206 fontchange = true; 206 fontchange = true;
207 count = horizontalCount * verticalCount; 207 count = horizontalCount * verticalCount;
208 } else { 208 }
209 if ( mNavigatorView->fontChanged() ) { 209
210 fontchange = true;
211 fo = KOPrefs::instance()->mDateNavigatorFont;
212 mNavigatorView->changeFont( fo );
213 mNavigatorView->unsetFontChanged();
214 }
215 }
216
217 mLastDisplayedDN = horizontalCount*verticalCount-1; 210 mLastDisplayedDN = horizontalCount*verticalCount-1;
218 while ( count > ( mExtraViews.count() + 1 ) ) { 211 while ( count > ( mExtraViews.count() + 1 ) ) {
219 KDateNavigator *n = new KDateNavigator( this ); 212 KDateNavigator *n = new KDateNavigator( this );
220 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 213 n->setMonthSignalOffset ( mExtraViews.count()+1 );
221 mExtraViews.append( n ); 214 mExtraViews.append( n );
222 n->setCalendar( mCalendar ); 215 n->setCalendar( mCalendar );
223 connectNavigatorView( n ); 216 connectNavigatorView( n );
224 // n->show(); 217 // n->show();
225 } 218 }
226 219
227
228 setBaseDates(); 220 setBaseDates();
229 if ( fontchange ) {
230 //mNavigatorView->changeFont( fo );
231 uint i;
232 for( i = 0; i < mExtraViews.count(); ++i ) {
233 KDateNavigator *view = mExtraViews.at( i );
234 view->changeFont( fo );
235 }
236 }
237 mHorizontalCount = horizontalCount; 221 mHorizontalCount = horizontalCount;
238 mVerticalCount = verticalCount; 222 mVerticalCount = verticalCount;
239 223
240 } 224 }
241 225 if ( !fontchange ) {
226 if ( mNavigatorView->fontChanged() ) {
227 fontchange = true;
228 fo = KOPrefs::instance()->mDateNavigatorFont;
229 mNavigatorView->changeFont( fo );
230 mNavigatorView->unsetFontChanged();
231 }
232 }
233 if ( fontchange ) {
234 uint i;
235 for( i = 0; i < mLastDisplayedDN; ++i ) {
236 KDateNavigator *view = mExtraViews.at( i );
237 view->changeFont( fo );
238 }
239 }
242 int theight = height() / mVerticalCount; 240 int theight = height() / mVerticalCount;
243 int twidth = width() / mHorizontalCount; 241 int twidth = width() / mHorizontalCount;
244 242
245 NavigatorBar *bar = mNavigatorView->navigatorBar(); 243 NavigatorBar *bar = mNavigatorView->navigatorBar();
246 if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); 244 if ( mHorizontalCount > 1 ) bar->showButtons( true, false );
247 else bar->showButtons( true, true ); 245 else bar->showButtons( true, true );
248 246
249 mNavigatorView->setGeometry(0, 247 mNavigatorView->setGeometry(0,
250 0, twidth, theight ); 248 0, twidth, theight );
251 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 249 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
252 int x = ( i + 1 ) % mHorizontalCount; 250 int x = ( i + 1 ) % mHorizontalCount;
253 int y = ( i + 1 ) / mHorizontalCount; 251 int y = ( i + 1 ) / mHorizontalCount;
254 252
255 KDateNavigator *view = mExtraViews.at( i ); 253 KDateNavigator *view = mExtraViews.at( i );
256 bar = view->navigatorBar(); 254 bar = view->navigatorBar();
257 if ( y > 0 ) bar->showButtons( false, false ); 255 if ( y > 0 ) bar->showButtons( false, false );
258 else { 256 else {
259 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); 257 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true );
260 else bar->showButtons( false, false ); 258 else bar->showButtons( false, false );
261 } 259 }
262 view->setGeometry( x * twidth, 260 view->setGeometry( x * twidth,
263 y * theight, twidth, theight ); 261 y * theight, twidth, theight );
264 } 262 }
265 int iii = 0; 263 int iii = 0;
266 int ccc = mHorizontalCount * mVerticalCount; 264 int ccc = mHorizontalCount * mVerticalCount;
267 mNavigatorView->show(); 265 mNavigatorView->show();
268 while ( iii < ( mExtraViews.count() ) ) { 266 while ( iii < ( mExtraViews.count() ) ) {
269 if ( iii < ccc-1 ) 267 if ( iii < ccc-1 )
270 mExtraViews.at( iii )->show(); 268 mExtraViews.at( iii )->show();
271 else 269 else
272 mExtraViews.at( iii )->hide(); 270 mExtraViews.at( iii )->hide();
273 ++iii; 271 ++iii;
274 } 272 }
275 } 273 }
276 274
277 QDate last = lastAvailableDate(); 275 QDate last = lastAvailableDate();
278 QDate first = firstAvailableDate(); 276 QDate first = firstAvailableDate();
279 277
280 QDate selFirst = mFirstSelectedDate; 278 QDate selFirst = mFirstSelectedDate;
281 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 279 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
282 if ( selFirst >= first && selLast <= last ) { 280 if ( selFirst >= first && selLast <= last ) {
283 updateDayMatrixDates(); 281 updateDayMatrixDates();
284 } 282 }
285 else { 283 else {
286 updateDayMatrixDates(); 284 updateDayMatrixDates();
287 emit monthSelected( mFirstSelectedDate.month() ); 285 emit monthSelected( mFirstSelectedDate.month() );
288 } 286 }
289} 287}
290void DateNavigatorContainer::updateDayMatrixDates() 288void DateNavigatorContainer::updateDayMatrixDates()
291{ 289{
292 QDate fDate = mFirstSelectedDate; 290 QDate fDate = mFirstSelectedDate;
293 QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); 291 QDate lDate = fDate.addDays( mSelectedDateCount - 1 );
294 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); 292 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
295 mNavigatorView->dayMatrix()->repaint( false ); 293 mNavigatorView->dayMatrix()->repaint( false );
296 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 294 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
297 KDateNavigator *n = mExtraViews.at( i ); 295 KDateNavigator *n = mExtraViews.at( i );
298 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { 296 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) {
299 n->dayMatrix()->repaint( false ); 297 n->dayMatrix()->repaint( false );
300 } 298 }
301 } 299 }
302} 300}
303 301
304void DateNavigatorContainer::updateDayMatrix() 302void DateNavigatorContainer::updateDayMatrix()
305{ 303{
306 mNavigatorView->updateDayMatrix(); 304 mNavigatorView->updateDayMatrix();
307 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 305 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
308 KDateNavigator *n = mExtraViews.at( i ); 306 KDateNavigator *n = mExtraViews.at( i );
309 n->updateDayMatrix(); 307 n->updateDayMatrix();
310 } 308 }
311} 309}
312 310
313void DateNavigatorContainer::updateToday() 311void DateNavigatorContainer::updateToday()
314{ 312{
315 qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); 313 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
316#if 0 314#if 0
317 mNavigatorView->updateToday(); 315 mNavigatorView->updateToday();
318 KDateNavigator *n; 316 KDateNavigator *n;
319 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 317 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
320 n->updateToday(); 318 n->updateToday();
321 } 319 }
322#endif 320#endif
323} 321}
324 322
325void DateNavigatorContainer::updateView() 323void DateNavigatorContainer::updateView()
326{ 324{
327 mNavigatorView->updateView(); 325 mNavigatorView->updateView();
328 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 326 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
329 KDateNavigator *n = mExtraViews.at( i ); 327 KDateNavigator *n = mExtraViews.at( i );
330 n->updateView(); 328 n->updateView();
331 } 329 }
332} 330}
333 331
334void DateNavigatorContainer::updateConfig() 332void DateNavigatorContainer::updateConfig()
335{ 333{
336 mNavigatorView->updateConfig(); 334 mNavigatorView->updateConfig();
337 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 335 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
338 KDateNavigator *n = mExtraViews.at( i ); 336 KDateNavigator *n = mExtraViews.at( i );
339 n->updateConfig(); 337 n->updateConfig();
340 } 338 }
341} 339}
342QDate DateNavigatorContainer::lastAvailableDate() const 340QDate DateNavigatorContainer::lastAvailableDate() const
343{ 341{
344 QDate date = mNavigatorView->baseDate(); 342 QDate date = mNavigatorView->baseDate();
345 QDate last = QDate ( date.year(), date.month(), date.daysInMonth() ); 343 QDate last = QDate ( date.year(), date.month(), date.daysInMonth() );
346 int iii = mLastDisplayedDN; 344 int iii = mLastDisplayedDN;
347 if ( mLastDisplayedDN ) 345 if ( mLastDisplayedDN )
348 last = last.addDays( 1); 346 last = last.addDays( 1);
349 while ( iii ) { 347 while ( iii ) {
350 last = last.addDays( last.daysInMonth ()); 348 last = last.addDays( last.daysInMonth ());
351 //qDebug("DATE %s ", last.toString().latin1() ); 349 //qDebug("DATE %s ", last.toString().latin1() );
352 --iii; 350 --iii;
353 } 351 }
354 if ( mLastDisplayedDN ) 352 if ( mLastDisplayedDN )
355 last = last.addDays( -1); 353 last = last.addDays( -1);
356 return last; 354 return last;
357} 355}
358QDate DateNavigatorContainer::firstAvailableDate() const 356QDate DateNavigatorContainer::firstAvailableDate() const
359{ 357{
360 return QDate ( mNavigatorView->baseDate().year(), mNavigatorView->baseDate().month(), 1 ); 358 return QDate ( mNavigatorView->baseDate().year(), mNavigatorView->baseDate().month(), 1 );
361} 359}
362void DateNavigatorContainer::selectDates( const DateList &dateList ) 360void DateNavigatorContainer::selectDates( const DateList &dateList )
363{ 361{
364 mFirstSelectedDate = dateList.first() ; 362 mFirstSelectedDate = dateList.first() ;
365 mSelectedDateCount = dateList.count() ; 363 mSelectedDateCount = dateList.count() ;
366 if ( !mLastDisplayedDN ) { 364 if ( !mLastDisplayedDN ) {
367 mNavigatorView->selectDates( dateList ); 365 mNavigatorView->selectDates( dateList );
368 return; 366 return;
369 } 367 }
370 QDate fDate = dateList.first(); 368 QDate fDate = dateList.first();
371 QDate lDate = dateList.last(); 369 QDate lDate = dateList.last();
372 //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); 370 //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() );
373 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); 371 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() );
374 if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) { 372 if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) {
375 updateDayMatrixDates(); 373 updateDayMatrixDates();
376 return; 374 return;
377 } 375 }
378 mNavigatorView->selectDates( dateList ); 376 mNavigatorView->selectDates( dateList );
379 setBaseDates(); 377 setBaseDates();
380 if ( mLastDisplayedDN ) { 378 if ( mLastDisplayedDN ) {
381 KDateNavigator *view = mExtraViews.at( 0 ); 379 KDateNavigator *view = mExtraViews.at( 0 );
382 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 380 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
383 view->dayMatrix()->repaint( false ); 381 view->dayMatrix()->repaint( false );
384 if ( mLastDisplayedDN > 1 ) { 382 if ( mLastDisplayedDN > 1 ) {
385 KDateNavigator *view = mExtraViews.at( 1 ); 383 KDateNavigator *view = mExtraViews.at( 1 );
386 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 384 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
387 view->dayMatrix()->repaint( false ); 385 view->dayMatrix()->repaint( false );
388 } 386 }
389 } 387 }
390} 388}
391 389
392void DateNavigatorContainer::setBaseDates() 390void DateNavigatorContainer::setBaseDates()
393{ 391{
394 QDate baseDate = mNavigatorView->baseDate(); 392 QDate baseDate = mNavigatorView->baseDate();
395 bool doRepaint = true; 393 bool doRepaint = true;
396 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 394 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
397 KDateNavigator *n = mExtraViews.at( i ); 395 KDateNavigator *n = mExtraViews.at( i );
398 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); 396 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 );
399 n->setBaseDate( baseDate, doRepaint ); 397 n->setBaseDate( baseDate, doRepaint );
400 } 398 }
401} 399}
402void DateNavigatorContainer::setResizeEnabled() 400void DateNavigatorContainer::setResizeEnabled()
403{ 401{
404 mResizeEnabled = true; 402 mResizeEnabled = true;
405 //qDebug("DateNavigatorContainer::setResizeEnabled "); 403 //qDebug("DateNavigatorContainer::setResizeEnabled ");
406 checkUpdateDayMatrixDates(); 404 checkUpdateDayMatrixDates();
407} 405}
408void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) 406void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
409{ 407{
410 408
411 //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height()); 409 //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height());
412 //qDebug("COUNT %d ", mExtraViews.count()); 410 //qDebug("COUNT %d ", mExtraViews.count());
413 if ( ! mResizeEnabled ) { 411 if ( ! mResizeEnabled ) {
414 //qDebug("NOT ResizeEnabled"); 412 //qDebug("NOT ResizeEnabled");
415 return; 413 return;
416 } 414 }
417 else 415 else
418 mUpdateTimer->start( 250 ); 416 mUpdateTimer->start( 250 );
419 417
420 //updateDayMatrixDates(); 418 //updateDayMatrixDates();
421} 419}
422 420
423QSize DateNavigatorContainer::minimumSizeHint() const 421QSize DateNavigatorContainer::minimumSizeHint() const
424{ 422{
425 return mNavigatorView->minimumSizeHint(); 423 return mNavigatorView->minimumSizeHint();
426} 424}
427 425
428QSize DateNavigatorContainer::sizeHint() const 426QSize DateNavigatorContainer::sizeHint() const
429{ 427{
430 return mNavigatorView->yourSizeHint(); 428 return mNavigatorView->yourSizeHint();
431} 429}
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 2fca49e..1d09f40 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -1,468 +1,467 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001,2002 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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qstring.h> 24#include <qstring.h>
25#include <qkeycode.h> 25#include <qkeycode.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qframe.h> 28#include <qframe.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kglobal.h> 34#include <kglobal.h>
35 35
36#include "koglobals.h" 36#include "koglobals.h"
37#include "koprefs.h" 37#include "koprefs.h"
38#ifndef KORG_NOPLUGINS 38#ifndef KORG_NOPLUGINS
39#include "kocore.h" 39#include "kocore.h"
40#endif 40#endif
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#include "navigatorbar.h" 44#include "navigatorbar.h"
45 45
46#include "kdatenavigator.h" 46#include "kdatenavigator.h"
47 47
48KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) 48KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
49 : QFrame(parent, name), 49 : QFrame(parent, name),
50 updateTimer(0L) 50 updateTimer(0L)
51{ 51{
52 setFrameStyle(QFrame::NoFrame); 52 setFrameStyle(QFrame::NoFrame);
53 QDate startDate = QDate::currentDate(); 53 QDate startDate = QDate::currentDate();
54 QGridLayout *topLayout = new QGridLayout(this,8,8); 54 QGridLayout *topLayout = new QGridLayout(this,8,8);
55 55
56 if (! startDate.isValid()) { 56 if (! startDate.isValid()) {
57 qDebug("KDateNavigator::invalid startdate "); 57 qDebug("KDateNavigator::invalid startdate ");
58 startDate = QDate::currentDate(); 58 startDate = QDate::currentDate();
59 } 59 }
60 mMonthSignalOffset = 0; 60 mMonthSignalOffset = 0;
61 mSelectedDates.append(startDate); 61 mSelectedDates.append(startDate);
62 m_MthYr = startDate; 62 m_MthYr = startDate;
63 m_bShowWeekNums = true; 63 m_bShowWeekNums = true;
64
65 setFont( KOPrefs::instance()->mDateNavigatorFont ); 64 setFont( KOPrefs::instance()->mDateNavigatorFont );
66 mNavigatorBar = new NavigatorBar( startDate, this ); 65 mNavigatorBar = new NavigatorBar( startDate, this );
67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 66 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
68 //mNavigatorBar->resize( 1,1); 67 //mNavigatorBar->resize( 1,1);
69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 68 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 69 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 70 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 71 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 72 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
74 73
75 // get the day of the week on the first day 74 // get the day of the week on the first day
76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 75 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
77 m_fstDayOfWk = dayone.dayOfWeek(); 76 m_fstDayOfWk = dayone.dayOfWeek();
78 77
79 int i; 78 int i;
80 79
81 // Set up the heading fields. 80 // Set up the heading fields.
82 for( i = 0; i < 7; i++ ) { 81 for( i = 0; i < 7; i++ ) {
83 headings[i] = new QLabel("",this); 82 headings[i] = new QLabel("",this);
84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 83 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
85 headings[i]->setAlignment(AlignCenter); 84 headings[i]->setAlignment(AlignCenter);
86 headings[i]->installEventFilter(this); 85 headings[i]->installEventFilter(this);
87 86
88 topLayout->addWidget(headings[i],1,i+1); 87 topLayout->addWidget(headings[i],1,i+1);
89 } 88 }
90 89
91 // Create the weeknumber labels 90 // Create the weeknumber labels
92 for( i = 0; i < 6; i++ ) { 91 for( i = 0; i < 6; i++ ) {
93 weeknos[i] = new QLabel(this); 92 weeknos[i] = new QLabel(this);
94 weeknos[i]->setAlignment(AlignCenter); 93 weeknos[i]->setAlignment(AlignCenter);
95 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
96 if(!m_bShowWeekNums) { 95 if(!m_bShowWeekNums) {
97 weeknos[i]->hide(); 96 weeknos[i]->hide();
98 } 97 }
99 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
100 99
101 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
102 } 101 }
103 102
104 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
105 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
106 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
107 106
108 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
109 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
110 109
111 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
112 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
113 112
114 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
115 114
116 // read settings from configuration file. 115 // read settings from configuration file.
117 updateConfig(); 116 updateConfig();
118 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
119 mySizeHint = sizeHintTwoButtons(); 118 mySizeHint = sizeHintTwoButtons();
120 myFullSizeHint = sizeHintTwoButtons( 4 ); 119 myFullSizeHint = sizeHintTwoButtons( 4 );
121 mFontChanged = false; 120 mFontChanged = false;
122 //resize ( 3,3 ); 121 //resize ( 3,3 );
123 122
124} 123}
125void KDateNavigator::changeFont ( QFont fo ) 124void KDateNavigator::changeFont ( QFont fo )
126{ 125{
127 setFont( fo ); 126 setFont( fo );
128 mNavigatorBar->resetFont( fo ); 127 mNavigatorBar->resetFont( fo );
129} 128}
130QFont KDateNavigator::yourFontHint( QSize si , bool *b) 129QFont KDateNavigator::yourFontHint( QSize si , bool *b)
131{ 130{
132 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 131 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
133 *b = false; 132 *b = false;
134 int fontPoint = fo.pointSize(); 133 int fontPoint = fo.pointSize();
135 while ( fontPoint > 5 ) { 134 while ( fontPoint > 5 ) {
136 --fontPoint; 135 --fontPoint;
137 fo.setPointSize( fontPoint ); 136 fo.setPointSize( fontPoint );
138 setFont( fo ); 137 setFont( fo );
139 mFontChanged = true; 138 mFontChanged = true;
140 mNavigatorBar->resetFont( fo ); 139 mNavigatorBar->resetFont( fo );
141 QSize sh = sizeHintTwoButtons( 2 ); 140 QSize sh = sizeHintTwoButtons( 2 );
142 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
143 if ( si.width() > sh.width() && si.height() > sh.height()) { 142 if ( si.width() > sh.width() && si.height() > sh.height()) {
144 if ( si.width() / sh.width() == 1 ) { 143 if ( si.width() / sh.width() == 1 ) {
145 if ( si.width() < sizeHintTwoButtons( 4 ).width()) 144 if ( si.width() < sizeHintTwoButtons( 4 ).width())
146 continue; 145 continue;
147 } 146 }
148 *b = true; 147 *b = true;
149 //qDebug("fooooooooooooooooooooooouuuuund "); 148 //qDebug("fooooooooooooooooooooooouuuuund ");
150 break; 149 break;
151 } 150 }
152 } 151 }
153 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); 152 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
154 return fo; 153 return fo;
155} 154}
156QSize KDateNavigator::sizeHint() const 155QSize KDateNavigator::sizeHint() const
157{ 156{
158 QFontMetrics fm ( font() ); 157 QFontMetrics fm ( font() );
159 QSize day = daymatrix->sizeHint(); 158 QSize day = daymatrix->sizeHint();
160 QSize nav = mNavigatorBar->sizeHint(); 159 QSize nav = mNavigatorBar->sizeHint();
161 int wid = fm.width( "30") + day.width()+3; 160 int wid = fm.width( "30") + day.width()+3;
162 int hei = fm.height() +day.height()+nav.height()+2; 161 int hei = fm.height() +day.height()+nav.height()+2;
163 if ( wid < nav.width() ) 162 if ( wid < nav.width() )
164 wid = nav.width() ; 163 wid = nav.width() ;
165 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 164 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
166 return QSize ( wid, hei ); 165 return QSize ( wid, hei );
167} 166}
168QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const 167QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
169{ 168{
170 QFontMetrics fm ( font() ); 169 QFontMetrics fm ( font() );
171 QSize day = daymatrix->sizeHint(); 170 QSize day = daymatrix->sizeHint();
172 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); 171 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
173 int wid = fm.width( "30") + day.width()+3; 172 int wid = fm.width( "30") + day.width()+3;
174 int hei = fm.height() +day.height()+nav.height()+2; 173 int hei = fm.height() +day.height()+nav.height()+2;
175 if ( wid < nav.width() ) 174 if ( wid < nav.width() )
176 wid = nav.width() ; 175 wid = nav.width() ;
177 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 176 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
178 return QSize ( wid, hei ); 177 return QSize ( wid, hei );
179} 178}
180void KDateNavigator::slotMonthSelected( int m ) 179void KDateNavigator::slotMonthSelected( int m )
181{ 180{
182 if ( m_MthYr.month() <= mMonthSignalOffset) 181 if ( m_MthYr.month() <= mMonthSignalOffset)
183 m += 12; 182 m += 12;
184 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); 183 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset);
185 emit monthSelected( m - mMonthSignalOffset ); 184 emit monthSelected( m - mMonthSignalOffset );
186 185
187} 186}
188void KDateNavigator::setCalendar( Calendar *cal ) 187void KDateNavigator::setCalendar( Calendar *cal )
189{ 188{
190 daymatrix->setCalendar( cal ); 189 daymatrix->setCalendar( cal );
191} 190}
192 191
193void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true 192void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true
194{ 193{
195 m_MthYr = date; 194 m_MthYr = date;
196 //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1()); 195 //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1());
197 196
198 updateDates(); 197 updateDates();
199 updateView(); 198 updateView();
200 199
201 KCal::DateList dates; 200 KCal::DateList dates;
202 dates.append( date ); 201 dates.append( date );
203 mNavigatorBar->selectDates( dates ); 202 mNavigatorBar->selectDates( dates );
204 203
205 daymatrix->clearSelection(); 204 daymatrix->clearSelection();
206 if ( doRepaint ) 205 if ( doRepaint )
207 daymatrix->repaint( false ); 206 daymatrix->repaint( false );
208} 207}
209 208
210void KDateNavigator::enableRollover(RolloverType r) 209void KDateNavigator::enableRollover(RolloverType r)
211{ 210{
212 switch(r) 211 switch(r)
213 { 212 {
214 case None : 213 case None :
215 if (updateTimer) 214 if (updateTimer)
216 { 215 {
217 updateTimer->stop(); 216 updateTimer->stop();
218 delete updateTimer; 217 delete updateTimer;
219 updateTimer=0L; 218 updateTimer=0L;
220 } 219 }
221 break; 220 break;
222 case FollowDay : 221 case FollowDay :
223 case FollowMonth : 222 case FollowMonth :
224 if (!updateTimer) 223 if (!updateTimer)
225 { 224 {
226 updateTimer = new QTimer(this); 225 updateTimer = new QTimer(this);
227 QObject::connect(updateTimer,SIGNAL(timeout()), 226 QObject::connect(updateTimer,SIGNAL(timeout()),
228 this,SLOT(possiblyPastMidnight())); 227 this,SLOT(possiblyPastMidnight()));
229 } 228 }
230 updateTimer->start(0,true); 229 updateTimer->start(0,true);
231 lastDayChecked = QDate::currentDate(); 230 lastDayChecked = QDate::currentDate();
232 } 231 }
233 updateRollover=r; 232 updateRollover=r;
234} 233}
235 234
236 235
237KDateNavigator::~KDateNavigator() 236KDateNavigator::~KDateNavigator()
238{ 237{
239} 238}
240 239
241 240
242void KDateNavigator::passedMidnight() 241void KDateNavigator::passedMidnight()
243{ 242{
244 QDate today = QDate::currentDate(); 243 QDate today = QDate::currentDate();
245 bool emitMonth = false; 244 bool emitMonth = false;
246 245
247 if (today.month() != lastDayChecked.month()) 246 if (today.month() != lastDayChecked.month())
248 { 247 {
249 if (updateRollover==FollowMonth && 248 if (updateRollover==FollowMonth &&
250 daymatrix->isEndOfMonth()) { 249 daymatrix->isEndOfMonth()) {
251 goNextMonth(); 250 goNextMonth();
252 emitMonth=true; 251 emitMonth=true;
253 } 252 }
254 } 253 }
255 daymatrix->recalculateToday(); 254 daymatrix->recalculateToday();
256 daymatrix->repaint( false ); 255 daymatrix->repaint( false );
257 emit dayPassed(today); 256 emit dayPassed(today);
258 if (emitMonth) { emit monthPassed(today); } 257 if (emitMonth) { emit monthPassed(today); }
259} 258}
260 259
261/* slot */ void KDateNavigator::possiblyPastMidnight() 260/* slot */ void KDateNavigator::possiblyPastMidnight()
262{ 261{
263 if (lastDayChecked!=QDate::currentDate()) 262 if (lastDayChecked!=QDate::currentDate())
264 { 263 {
265 passedMidnight(); 264 passedMidnight();
266 lastDayChecked=QDate::currentDate(); 265 lastDayChecked=QDate::currentDate();
267 } 266 }
268 // Set the timer to go off 1 second after midnight 267 // Set the timer to go off 1 second after midnight
269 // or after 8 minutes, whichever comes first. 268 // or after 8 minutes, whichever comes first.
270 if (updateTimer) 269 if (updateTimer)
271 { 270 {
272 QTime now = QTime::currentTime(); 271 QTime now = QTime::currentTime();
273 QTime midnight = QTime(23,59,59); 272 QTime midnight = QTime(23,59,59);
274 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); 273 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000);
275 274
276 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) 275 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait))
277 //.arg(now.toString()).arg(midnight.toString())); 276 //.arg(now.toString()).arg(midnight.toString()));
278 277
279 updateTimer->stop(); 278 updateTimer->stop();
280 updateTimer->start(msecsWait,true); 279 updateTimer->start(msecsWait,true);
281 } 280 }
282} 281}
283 282
284void KDateNavigator::updateDates() 283void KDateNavigator::updateDates()
285{ 284{
286 // Find the first day of the week of the current month. 285 // Find the first day of the week of the current month.
287 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); 286 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr );
288 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); 287 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() );
289 int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); 288 int d2 = KOGlobals::self()->calendarSystem()->day( dayone );
290 //int di = d1 - d2 + 1; 289 //int di = d1 - d2 + 1;
291 dayone = dayone.addDays( -d2 + 1 ); 290 dayone = dayone.addDays( -d2 + 1 );
292 291
293 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); 292 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone );
294 293
295 // If month begins on Monday and Monday is first day of week, 294 // If month begins on Monday and Monday is first day of week,
296 // month should begin on second line. Sunday doesn't have this problem. 295 // month should begin on second line. Sunday doesn't have this problem.
297 int nextLine = ( ( m_fstDayOfWkCalsys == 1) && 296 int nextLine = ( ( m_fstDayOfWkCalsys == 1) &&
298 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; 297 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0;
299 298
300 // update the matrix dates 299 // update the matrix dates
301 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; 300 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine;
302 301
303 302
304 daymatrix->updateView(dayone.addDays(index)); 303 daymatrix->updateView(dayone.addDays(index));
305//each updateDates is followed by an updateView -> repaint is issued there ! 304//each updateDates is followed by an updateView -> repaint is issued there !
306// daymatrix->repaint(); 305// daymatrix->repaint();
307} 306}
308 307
309void KDateNavigator::updateDayMatrix() 308void KDateNavigator::updateDayMatrix()
310{ 309{
311 daymatrix->updateView(); 310 daymatrix->updateView();
312 //daymatrix->repaint(); 311 //daymatrix->repaint();
313} 312}
314 313
315 314
316void KDateNavigator::updateView() 315void KDateNavigator::updateView()
317{ 316{
318 317
319 setUpdatesEnabled( false ); 318 setUpdatesEnabled( false );
320 319
321 int i; 320 int i;
322 321
323// kdDebug() << "updateView() -> daymatrix->updateView()" << endl; 322// kdDebug() << "updateView() -> daymatrix->updateView()" << endl;
324 daymatrix->updateView(); 323 daymatrix->updateView();
325 int sub = 4; 324 int sub = 4;
326 if ( ! KGlobal::locale()->weekStartsMonday() ) 325 if ( ! KGlobal::locale()->weekStartsMonday() )
327 --sub; 326 --sub;
328 // set the week numbers. 327 // set the week numbers.
329 for(i = 0; i < 6; i++) { 328 for(i = 0; i < 6; i++) {
330 // remember, according to ISO 8601, the first week of the year is the 329 // remember, according to ISO 8601, the first week of the year is the
331 // first week that contains a thursday. Thus we must subtract off 4, 330 // first week that contains a thursday. Thus we must subtract off 4,
332 // not just 1. 331 // not just 1.
333 332
334 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); 333 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear();
335 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-sub))); 334 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-sub)));
336 int weekNo; 335 int weekNo;
337 if (dayOfYear % 7 != 0) 336 if (dayOfYear % 7 != 0)
338 weekNo = (dayOfYear / 7 + 1); 337 weekNo = (dayOfYear / 7 + 1);
339 else 338 else
340 weekNo = (dayOfYear / 7); 339 weekNo = (dayOfYear / 7);
341 weeknos[i]->setText(QString::number( weekNo )); 340 weeknos[i]->setText(QString::number( weekNo ));
342 } 341 }
343 342
344 setUpdatesEnabled( true ); 343 setUpdatesEnabled( true );
345// kdDebug() << "updateView() -> repaint()" << endl; 344// kdDebug() << "updateView() -> repaint()" << endl;
346 repaint(); 345 repaint();
347 // daymatrix->repaint(); 346 // daymatrix->repaint();
348} 347}
349 348
350void KDateNavigator::updateConfig() 349void KDateNavigator::updateConfig()
351{ 350{
352 int day; 351 int day;
353 for(int i=0; i<7; i++) { 352 for(int i=0; i<7; i++) {
354 // take the first letter of the day name to be the abbreviation 353 // take the first letter of the day name to be the abbreviation
355 if (KGlobal::locale()->weekStartsMonday()) { 354 if (KGlobal::locale()->weekStartsMonday()) {
356 day = i+1; 355 day = i+1;
357 } else { 356 } else {
358 if (i==0) day = 7; 357 if (i==0) day = 7;
359 else day = i; 358 else day = i;
360 } 359 }
361 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 360 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
362 true ); 361 true );
363 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 362 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
364 headings[i]->setText( dayName ); 363 headings[i]->setText( dayName );
365 } 364 }
366 updateDates(); 365 updateDates();
367 updateView(); 366 updateView();
368} 367}
369 368
370void KDateNavigator::setShowWeekNums(bool enabled) 369void KDateNavigator::setShowWeekNums(bool enabled)
371{ 370{
372 qDebug("KDateNavigator::setShowWeekNums***************************** "); 371 qDebug("KDateNavigator::setShowWeekNums***************************** ");
373 m_bShowWeekNums = enabled; 372 m_bShowWeekNums = enabled;
374 for(int i=0; i<6; i++) { 373 for(int i=0; i<6; i++) {
375 if(enabled) 374 if(enabled)
376 weeknos[i]->show(); 375 weeknos[i]->show();
377 else 376 else
378 weeknos[i]->hide(); 377 weeknos[i]->hide();
379 } 378 }
380 resize(size()); 379 resize(size());
381} 380}
382 381
383void KDateNavigator::selectDates(const DateList& dateList) 382void KDateNavigator::selectDates(const DateList& dateList)
384{ 383{
385 384
386 if (dateList.count() > 0) { 385 if (dateList.count() > 0) {
387 mNavigatorBar->selectDates( dateList ); 386 mNavigatorBar->selectDates( dateList );
388 mSelectedDates = dateList; 387 mSelectedDates = dateList;
389 388
390 // set our record of the month and year that this datetbl is 389 // set our record of the month and year that this datetbl is
391 // displaying. 390 // displaying.
392 m_MthYr = mSelectedDates.first(); 391 m_MthYr = mSelectedDates.first();
393 392
394 393
395 // set our record of the first day of the week of the current 394 // set our record of the first day of the week of the current
396 // month. This needs to be done before calling dayToIndex, since it 395 // month. This needs to be done before calling dayToIndex, since it
397 // relies on this information being up to date. 396 // relies on this information being up to date.
398 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 397 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
399 m_fstDayOfWk = dayone.dayOfWeek(); 398 m_fstDayOfWk = dayone.dayOfWeek();
400 399
401 updateDates(); 400 updateDates();
402 401
403 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 402 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
404 403
405 updateView(); 404 updateView();
406 } 405 }
407} 406}
408 407
409int KDateNavigator::dayNum(int row, int col) 408int KDateNavigator::dayNum(int row, int col)
410{ 409{
411 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; 410 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk;
412} 411}
413 412
414int KDateNavigator::dayToIndex(int dayNum) 413int KDateNavigator::dayToIndex(int dayNum)
415{ 414{
416 int row, col; 415 int row, col;
417 416
418 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; 417 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7;
419 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) 418 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1))
420 row++; 419 row++;
421 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; 420 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7;
422 return row * 7 + col; 421 return row * 7 + col;
423} 422}
424 423
425void KDateNavigator::wheelEvent (QWheelEvent *e) 424void KDateNavigator::wheelEvent (QWheelEvent *e)
426{ 425{
427 if(e->delta()>0) emit goPrevious(); 426 if(e->delta()>0) emit goPrevious();
428 else emit goNext(); 427 else emit goNext();
429 428
430 e->accept(); 429 e->accept();
431} 430}
432 431
433bool KDateNavigator::eventFilter (QObject *o,QEvent *e) 432bool KDateNavigator::eventFilter (QObject *o,QEvent *e)
434{ 433{
435 if (e->type() == QEvent::MouseButtonPress) { 434 if (e->type() == QEvent::MouseButtonPress) {
436 int i; 435 int i;
437 for(i=0;i<6;++i) { 436 for(i=0;i<6;++i) {
438 if (o == weeknos[i]) { 437 if (o == weeknos[i]) {
439 QDate weekstart = daymatrix->getDate(i*7); 438 QDate weekstart = daymatrix->getDate(i*7);
440 emit weekClicked(weekstart); 439 emit weekClicked(weekstart);
441 break; 440 break;
442 } 441 }
443 } 442 }
444 for(i=0;i<7;++i) { 443 for(i=0;i<7;++i) {
445 if (o == headings[i]) { 444 if (o == headings[i]) {
446 KCal::DateList selDays; 445 KCal::DateList selDays;
447 QDate date = daymatrix->getDate(14); 446 QDate date = daymatrix->getDate(14);
448 emit showMonth(date ); 447 emit showMonth(date );
449#if 0 448#if 0
450 int dio = date.daysInMonth(); 449 int dio = date.daysInMonth();
451 int j; 450 int j;
452 int ye = date.year(); 451 int ye = date.year();
453 int mo = date.month(); 452 int mo = date.month();
454 for ( j = 1; j <= dio; ++j ) { 453 for ( j = 1; j <= dio; ++j ) {
455 selDays.append( QDate( ye, mo, j ) ); 454 selDays.append( QDate( ye, mo, j ) );
456 } 455 }
457 emit datesSelected( selDays ); 456 emit datesSelected( selDays );
458#endif 457#endif
459 break; 458 break;
460 } 459 }
461 } 460 }
462 return true; 461 return true;
463 } else { 462 } else {
464 return false; 463 return false;
465 } 464 }
466} 465}
467 466
468//#include "kdatenavigator.moc" 467//#include "kdatenavigator.moc"
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 5cd845e..4fe1e66 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,649 +1,675 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qbuttongroup.h> 37#include <qbuttongroup.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qvbox.h> 39#include <qvbox.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qregexp.h> 41#include <qregexp.h>
42 42
43#include <kdialog.h> 43#include <kdialog.h>
44#include <kprefsdialog.h> 44#include <kprefsdialog.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kdateedit.h> 46#include <kdateedit.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50/*US 50/*US
51#include <qcheckbox.h> 51#include <qcheckbox.h>
52#include <qframe.h> 52#include <qframe.h>
53#include <qpushbutton.h> 53#include <qpushbutton.h>
54#include <qcombobox.h> 54#include <qcombobox.h>
55#include <qlineedit.h> 55#include <qlineedit.h>
56#include <qlabel.h> 56#include <qlabel.h>
57#include <qfile.h> 57#include <qfile.h>
58 58
59#include <kconfig.h> 59#include <kconfig.h>
60#include <kdebug.h> 60#include <kdebug.h>
61#include <kdialog.h> 61#include <kdialog.h>
62#include <klistview.h> 62#include <klistview.h>
63#include <klocale.h> 63#include <klocale.h>
64#include <kglobal.h> 64#include <kglobal.h>
65#include <kmessagebox.h> 65#include <kmessagebox.h>
66#include <kstandarddirs.h> 66#include <kstandarddirs.h>
67 67
68#ifndef KAB_EMBEDDED 68#ifndef KAB_EMBEDDED
69#include <ktrader.h> 69#include <ktrader.h>
70#else // KAB_EMBEDDED 70#else // KAB_EMBEDDED
71#include <mergewidget.h> 71#include <mergewidget.h>
72#include <distributionlistwidget.h> 72#include <distributionlistwidget.h>
73#endif // KAB_EMBEDDED 73#endif // KAB_EMBEDDED
74 74
75#include "addresseewidget.h" 75#include "addresseewidget.h"
76#include "extensionconfigdialog.h" 76#include "extensionconfigdialog.h"
77#include "extensionwidget.h" 77#include "extensionwidget.h"
78*/ 78*/
79 79
80#include "qapplication.h" 80#include "qapplication.h"
81 81
82#include "kpimglobalprefs.h" 82#include "kpimglobalprefs.h"
83 83
84#include "kdepimconfigwidget.h" 84#include "kdepimconfigwidget.h"
85#include <kprefs.h> 85#include <kprefs.h>
86#include <kmessagebox.h>
86 87
87 88
88KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 89KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
89 : KPrefsWidget(prefs, parent, name ) 90 : KPrefsWidget(prefs, parent, name )
90{ 91{
91 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 92 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
92 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 93 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
93 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 94 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
94 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 95 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
95 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 96 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
96 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 97 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
97 98
98 99
99 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 100 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
100 KDialog::spacingHint() ); 101 KDialog::spacingHint() );
101 102
102 tabWidget = new QTabWidget( this ); 103 tabWidget = new QTabWidget( this );
103 topLayout->addWidget( tabWidget ); 104 topLayout->addWidget( tabWidget );
104 105
105 106
106 setupLocaleTab(); 107 setupLocaleTab();
107 setupLocaleDateTab(); 108 setupLocaleDateTab();
108 setupTimeZoneTab(); 109 setupTimeZoneTab();
109 setupExternalAppTab(); 110 setupExternalAppTab();
110 setupStoreTab(); 111 setupStoreTab();
111 112
112} 113}
113void KDEPIMConfigWidget::showTimeZoneTab() 114void KDEPIMConfigWidget::showTimeZoneTab()
114{ 115{
115 tabWidget->setCurrentPage ( 3 ) ; 116 tabWidget->setCurrentPage ( 3 ) ;
116} 117}
117void KDEPIMConfigWidget::setupStoreTab() 118void KDEPIMConfigWidget::setupStoreTab()
118{ 119{
119 QVBox *storePage = new QVBox( this ); 120 QVBox *storePage = new QVBox( this );
120 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); 121 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
121 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 122 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
122 mStoreUrl = new KURLRequester( storePage ); 123 mStoreUrl = new KURLRequester( storePage );
123 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 124 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
125#ifdef DESKTOP_VERSION
126 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
127 QFileInfo fi ( confFile );
128 if ( fi.exists() ) {
129 KConfig cfg ( confFile );
130 cfg.setGroup("Global");
131 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
132 if ( localKdeDir != "x_x_x" ) {
133 mStoreUrl->setURL( localKdeDir );
134 qDebug("Reading config from %s ", confFile.latin1());
135 }
136 }
137
138#endif
124 new QLabel( i18n("New dirs are created automatically"), storePage ); 139 new QLabel( i18n("New dirs are created automatically"), storePage );
125 QHBox *bb = new QHBox( storePage ); 140 QHBox *bb = new QHBox( storePage );
126 QPushButton * pb; 141 QPushButton * pb;
127 if ( QApplication::desktop()->width() < 640 ) 142 if ( QApplication::desktop()->width() < 640 )
128 pb = new QPushButton ( i18n("Save"), bb ); 143 pb = new QPushButton ( i18n("Save"), bb );
129 else 144 else
130 pb = new QPushButton ( i18n("Save settings"), bb ); 145 pb = new QPushButton ( i18n("Save settings"), bb );
131 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 146 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
132 pb = new QPushButton ( i18n("Save standard"), bb ); 147 pb = new QPushButton ( i18n("Save standard"), bb );
133 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 148 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
149#ifdef DESKTOP_VERSION
150 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
151 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
152#endif
134 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); 153 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
135 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); 154 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
136 tabWidget->addTab( storePage, i18n( "Data storage path" ) ); 155 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
137} 156}
157void KDEPIMConfigWidget::setLocalStore()
158{
159 mStoreUrl->setURL( "LOCAL:kdepimpi" );
160 saveStoreSettings();
161 QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data.");
162 KMessageBox::information( this, message);
163}
138void KDEPIMConfigWidget::setStandardStore() 164void KDEPIMConfigWidget::setStandardStore()
139{ 165{
140 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 166 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
141 saveStoreSettings(); 167 saveStoreSettings();
142} 168}
143void KDEPIMConfigWidget::saveStoreSettings() 169void KDEPIMConfigWidget::saveStoreSettings()
144{ 170{
145 if ( !mStoreUrl->url().isEmpty() ) { 171 if ( !mStoreUrl->url().isEmpty() ) {
146 QString path = QDir::homeDirPath(); 172 QString path = QDir::homeDirPath();
147 QString url = mStoreUrl->url(); 173 QString url = mStoreUrl->url();
148#ifdef DESKTOP_VERSION 174#ifdef DESKTOP_VERSION
149 if ( url.startsWith( "LOCAL:" ) ) { 175 if ( url.startsWith( "LOCAL:" ) ) {
150 path = qApp->applicationDirPath () ; 176 path = qApp->applicationDirPath () ;
151 } 177 }
152#endif 178#endif
153 KConfig cfg ( path + "/.microkdehome" ); 179 KConfig cfg ( path + "/.microkdehome" );
154 cfg.setGroup("Global"); 180 cfg.setGroup("Global");
155 cfg.writeEntry( "MICROKDEHOME", url ); 181 cfg.writeEntry( "MICROKDEHOME", url );
156 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); 182 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1());
157 cfg.sync(); 183 cfg.sync();
158 } else { 184 } else {
159 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 185 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
160 saveStoreSettings(); 186 saveStoreSettings();
161 } 187 }
162} 188}
163void KDEPIMConfigWidget::setupExternalAppTab() 189void KDEPIMConfigWidget::setupExternalAppTab()
164{ 190{
165 QWidget *externalAppsPage = new QWidget( this ); 191 QWidget *externalAppsPage = new QWidget( this );
166 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 192 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
167 KDialog::spacingHintSmall() ); 193 KDialog::spacingHintSmall() );
168 194
169 mExternalApps = new QComboBox( externalAppsPage ); 195 mExternalApps = new QComboBox( externalAppsPage );
170 196
171 QMap<ExternalAppHandler::Types, QString>::Iterator it; 197 QMap<ExternalAppHandler::Types, QString>::Iterator it;
172 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 198 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
173 mExternalApps->insertItem( it.data(), it.key() ); 199 mExternalApps->insertItem( it.data(), it.key() );
174 200
175 layout->addWidget( mExternalApps ); 201 layout->addWidget( mExternalApps );
176 202
177 connect( mExternalApps, SIGNAL( activated( int ) ), 203 connect( mExternalApps, SIGNAL( activated( int ) ),
178 this, SLOT (externalapp_changed( int ) ) ); 204 this, SLOT (externalapp_changed( int ) ) );
179 205
180 206
181 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 207 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
182 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 208 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
183 mExternalAppGroupBox->layout()->setMargin(5); 209 mExternalAppGroupBox->layout()->setMargin(5);
184 210
185 mClient = new QComboBox( mExternalAppGroupBox ); 211 mClient = new QComboBox( mExternalAppGroupBox );
186 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 212 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
187 213
188 connect( mClient, SIGNAL( activated( int ) ), 214 connect( mClient, SIGNAL( activated( int ) ),
189 this, SLOT (client_changed( int ) ) ); 215 this, SLOT (client_changed( int ) ) );
190 216
191 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 217 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
192 boxLayout->addWidget( lab, 1, 0 ); 218 boxLayout->addWidget( lab, 1, 0 );
193 mChannel = new QLineEdit(mExternalAppGroupBox); 219 mChannel = new QLineEdit(mExternalAppGroupBox);
194 mChannel->setReadOnly(true); 220 mChannel->setReadOnly(true);
195 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 221 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
196 222
197 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 223 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
198 boxLayout->addWidget( lab, 3, 0 ); 224 boxLayout->addWidget( lab, 3, 0 );
199 mMessage = new QLineEdit(mExternalAppGroupBox); 225 mMessage = new QLineEdit(mExternalAppGroupBox);
200 mMessage->setReadOnly(true); 226 mMessage->setReadOnly(true);
201 boxLayout->addWidget( mMessage , 4, 0); 227 boxLayout->addWidget( mMessage , 4, 0);
202 228
203 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 229 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
204 boxLayout->addWidget( lab, 3, 1 ); 230 boxLayout->addWidget( lab, 3, 1 );
205 mParameters = new QLineEdit(mExternalAppGroupBox); 231 mParameters = new QLineEdit(mExternalAppGroupBox);
206 mParameters->setReadOnly(true); 232 mParameters->setReadOnly(true);
207 boxLayout->addWidget( mParameters, 4, 1 ); 233 boxLayout->addWidget( mParameters, 4, 1 );
208 234
209 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 235 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
210 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 236 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
211 237
212 238
213 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 239 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
214 boxLayout->addWidget( lab, 6, 0 ); 240 boxLayout->addWidget( lab, 6, 0 );
215 mMessage2 = new QLineEdit(mExternalAppGroupBox); 241 mMessage2 = new QLineEdit(mExternalAppGroupBox);
216 mMessage2->setReadOnly(true); 242 mMessage2->setReadOnly(true);
217 boxLayout->addWidget( mMessage2 , 7, 0); 243 boxLayout->addWidget( mMessage2 , 7, 0);
218 244
219 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 245 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
220 boxLayout->addWidget( lab, 6, 1 ); 246 boxLayout->addWidget( lab, 6, 1 );
221 mParameters2 = new QLineEdit(mExternalAppGroupBox); 247 mParameters2 = new QLineEdit(mExternalAppGroupBox);
222 mParameters2->setReadOnly(true); 248 mParameters2->setReadOnly(true);
223 boxLayout->addWidget( mParameters2, 7, 1 ); 249 boxLayout->addWidget( mParameters2, 7, 1 );
224 250
225 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 251 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
226 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 252 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
227 253
228 254
229 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 255 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
230 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 256 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
231 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 257 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
232 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 258 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
233 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 259 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
234 260
235 261
236 layout->addWidget( mExternalAppGroupBox ); 262 layout->addWidget( mExternalAppGroupBox );
237 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 263 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
238 264
239} 265}
240 266
241 267
242void KDEPIMConfigWidget::setupLocaleDateTab() 268void KDEPIMConfigWidget::setupLocaleDateTab()
243{ 269{
244 QWidget *topFrame = new QWidget( this ); 270 QWidget *topFrame = new QWidget( this );
245 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); 271 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
246 272
247 topLayout->setSpacing(KDialog::spacingHintSmall()); 273 topLayout->setSpacing(KDialog::spacingHintSmall());
248 topLayout->setMargin(KDialog::marginHintSmall()); 274 topLayout->setMargin(KDialog::marginHintSmall());
249 int iii = 0; 275 int iii = 0;
250 276
251 277
252 KPrefsWidRadios *syncPrefsGroup = 278 KPrefsWidRadios *syncPrefsGroup =
253 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); 279 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
254 QString format; 280 QString format;
255 if ( QApplication::desktop()->width() < 480 ) 281 if ( QApplication::desktop()->width() < 480 )
256 format = "(%d.%m.%Y)"; 282 format = "(%d.%m.%Y)";
257 else 283 else
258 format = "(%d.%m.%Y|%A %d %B %Y)"; 284 format = "(%d.%m.%Y|%A %d %B %Y)";
259 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 285 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
260 if ( QApplication::desktop()->width() < 480 ) 286 if ( QApplication::desktop()->width() < 480 )
261 format = "(%m.%d.%Y)"; 287 format = "(%m.%d.%Y)";
262 else 288 else
263 format = "(%m.%d.%Y|%A %B %d %Y)"; 289 format = "(%m.%d.%Y|%A %B %d %Y)";
264 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 290 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
265 if ( QApplication::desktop()->width() < 480 ) 291 if ( QApplication::desktop()->width() < 480 )
266 format = "(%Y-%m-%d)"; 292 format = "(%Y-%m-%d)";
267 else 293 else
268 format = "(%Y-%m-%d|%A %Y %B %d)"; 294 format = "(%Y-%m-%d|%A %Y %B %d)";
269 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 295 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
270 syncPrefsGroup->addRadio(i18n("User defined")); 296 syncPrefsGroup->addRadio(i18n("User defined"));
271 if ( QApplication::desktop()->width() < 480 ) { 297 if ( QApplication::desktop()->width() < 480 ) {
272 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 298 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
273 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 299 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
274 } 300 }
275 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 301 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
276 ++iii; 302 ++iii;
277 ++iii; 303 ++iii;
278 QLabel * lab; 304 QLabel * lab;
279 mUserDateFormatLong = new QLineEdit(topFrame); 305 mUserDateFormatLong = new QLineEdit(topFrame);
280 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 306 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
281 topLayout->addWidget(lab ,iii,0); 307 topLayout->addWidget(lab ,iii,0);
282 topLayout->addWidget(mUserDateFormatLong,iii,1); 308 topLayout->addWidget(mUserDateFormatLong,iii,1);
283 ++iii; 309 ++iii;
284 mUserDateFormatShort = new QLineEdit(topFrame); 310 mUserDateFormatShort = new QLineEdit(topFrame);
285 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 311 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
286 topLayout->addWidget(lab ,iii,0); 312 topLayout->addWidget(lab ,iii,0);
287 topLayout->addWidget(mUserDateFormatShort,iii,1); 313 topLayout->addWidget(mUserDateFormatShort,iii,1);
288 ++iii; 314 ++iii;
289 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 315 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
290 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 316 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
291 ++iii; 317 ++iii;
292 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 318 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
293 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 319 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
294 ++iii; 320 ++iii;
295 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 321 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
296 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 322 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
297 ++iii; 323 ++iii;
298 324
299 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 325 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
300 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 326 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
301 327
302 328
303 tabWidget->addTab( topFrame, i18n( "Date Format" ) ); 329 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
304} 330}
305 331
306void KDEPIMConfigWidget::setupLocaleTab() 332void KDEPIMConfigWidget::setupLocaleTab()
307{ 333{
308 334
309 QWidget *topFrame = new QWidget( this ); 335 QWidget *topFrame = new QWidget( this );
310 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 336 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
311 337
312 topLayout->setSpacing(KDialog::spacingHint()); 338 topLayout->setSpacing(KDialog::spacingHint());
313 topLayout->setMargin(KDialog::marginHint()); 339 topLayout->setMargin(KDialog::marginHint());
314 int iii = 0; 340 int iii = 0;
315 KPrefsWidRadios *syncPrefsGroup = 341 KPrefsWidRadios *syncPrefsGroup =
316 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); 342 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
317 syncPrefsGroup->addRadio(i18n("English")); 343 syncPrefsGroup->addRadio(i18n("English"));
318 syncPrefsGroup->addRadio(i18n("German")); 344 syncPrefsGroup->addRadio(i18n("German"));
319 syncPrefsGroup->addRadio(i18n("French")); 345 syncPrefsGroup->addRadio(i18n("French"));
320 syncPrefsGroup->addRadio(i18n("Italian")); 346 syncPrefsGroup->addRadio(i18n("Italian"));
321 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 347 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
322 if ( QApplication::desktop()->width() < 300 ) { 348 if ( QApplication::desktop()->width() < 300 ) {
323 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 349 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
324 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 350 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
325 } 351 }
326 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 352 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
327 ++iii; 353 ++iii;
328 354
329 355
330 tabWidget->addTab( topFrame, i18n( "Language" ) ); 356 tabWidget->addTab( topFrame, i18n( "Language" ) );
331 topFrame = new QWidget( this ); 357 topFrame = new QWidget( this );
332 topLayout = new QGridLayout(topFrame,4,2); 358 topLayout = new QGridLayout(topFrame,4,2);
333 359
334 topLayout->setSpacing(KDialog::spacingHint()); 360 topLayout->setSpacing(KDialog::spacingHint());
335 topLayout->setMargin(KDialog::marginHint()); 361 topLayout->setMargin(KDialog::marginHint());
336 iii = 0; 362 iii = 0;
337 syncPrefsGroup = 363 syncPrefsGroup =
338 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); 364 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
339 if ( QApplication::desktop()->width() > 300 ) 365 if ( QApplication::desktop()->width() > 300 )
340 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 366 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
341 syncPrefsGroup->addRadio(i18n("24:00")); 367 syncPrefsGroup->addRadio(i18n("24:00"));
342 syncPrefsGroup->addRadio(i18n("12:00am")); 368 syncPrefsGroup->addRadio(i18n("12:00am"));
343 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 369 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
344 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 370 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
345 ++iii; 371 ++iii;
346 372
347 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), 373 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
348 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); 374 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
349 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 375 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
350 ++iii; 376 ++iii;
351 377
352 378
353 tabWidget->addTab( topFrame, i18n( "Time Format" ) ); 379 tabWidget->addTab( topFrame, i18n( "Time Format" ) );
354 380
355} 381}
356 382
357 383
358void KDEPIMConfigWidget::setupTimeZoneTab() 384void KDEPIMConfigWidget::setupTimeZoneTab()
359{ 385{
360 QWidget *topFrame; 386 QWidget *topFrame;
361 QGridLayout *topLayout ; 387 QGridLayout *topLayout ;
362 388
363 389
364 390
365 391
366 392
367 393
368 topFrame = new QWidget( this ); 394 topFrame = new QWidget( this );
369 topLayout = new QGridLayout( topFrame, 5, 2); 395 topLayout = new QGridLayout( topFrame, 5, 2);
370 topLayout->setSpacing(KDialog::spacingHintSmall()); 396 topLayout->setSpacing(KDialog::spacingHintSmall());
371 topLayout->setMargin(KDialog::marginHintSmall()); 397 topLayout->setMargin(KDialog::marginHintSmall());
372 398
373 QHBox *timeZoneBox = new QHBox( topFrame ); 399 QHBox *timeZoneBox = new QHBox( topFrame );
374 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 400 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
375 401
376 new QLabel( i18n("Timezone:"), timeZoneBox ); 402 new QLabel( i18n("Timezone:"), timeZoneBox );
377 mTimeZoneCombo = new QComboBox( timeZoneBox ); 403 mTimeZoneCombo = new QComboBox( timeZoneBox );
378 if ( QApplication::desktop()->width() < 300 ) { 404 if ( QApplication::desktop()->width() < 300 ) {
379 mTimeZoneCombo->setMaximumWidth(150); 405 mTimeZoneCombo->setMaximumWidth(150);
380 } 406 }
381 407
382 QStringList list; 408 QStringList list;
383 list = KGlobal::locale()->timeZoneList(); 409 list = KGlobal::locale()->timeZoneList();
384 mTimeZoneCombo->insertStringList(list); 410 mTimeZoneCombo->insertStringList(list);
385 411
386 // find the currently set time zone and select it 412 // find the currently set time zone and select it
387 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; 413 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
388 int nCurrentlySet = 11; 414 int nCurrentlySet = 11;
389 for (int i = 0; i < mTimeZoneCombo->count(); i++) 415 for (int i = 0; i < mTimeZoneCombo->count(); i++)
390 { 416 {
391 if (mTimeZoneCombo->text(i) == sCurrentlySet) 417 if (mTimeZoneCombo->text(i) == sCurrentlySet)
392 { 418 {
393 nCurrentlySet = i; 419 nCurrentlySet = i;
394 break; 420 break;
395 } 421 }
396 } 422 }
397 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 423 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
398 int iii = 1; 424 int iii = 1;
399 KPrefsWidBool *sb = 425 KPrefsWidBool *sb =
400 addWidBool(i18n("Add 30 min to selected Timezone"), 426 addWidBool(i18n("Add 30 min to selected Timezone"),
401 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); 427 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame);
402 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 428 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
403 ++iii; 429 ++iii;
404 sb = 430 sb =
405 addWidBool(i18n("Timezone has daylight saving"), 431 addWidBool(i18n("Timezone has daylight saving"),
406 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); 432 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
407 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 433 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
408 ++iii; 434 ++iii;
409 QLabel* lab; 435 QLabel* lab;
410 436
411 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 437 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
412 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 438 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
413 ++iii; 439 ++iii;
414 440
415 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 441 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
416 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 442 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
417 ++iii; 443 ++iii;
418 lab = new QLabel( i18n("Daylight start:"), topFrame ); 444 lab = new QLabel( i18n("Daylight start:"), topFrame );
419 topLayout->addWidget(lab, iii,0); 445 topLayout->addWidget(lab, iii,0);
420 mStartDateSavingEdit = new KDateEdit(topFrame); 446 mStartDateSavingEdit = new KDateEdit(topFrame);
421 topLayout->addWidget(mStartDateSavingEdit, iii,1); 447 topLayout->addWidget(mStartDateSavingEdit, iii,1);
422 ++iii; 448 ++iii;
423 449
424 lab = new QLabel( i18n("Daylight end:"), topFrame ); 450 lab = new QLabel( i18n("Daylight end:"), topFrame );
425 topLayout->addWidget(lab, iii,0); 451 topLayout->addWidget(lab, iii,0);
426 mEndDateSavingEdit = new KDateEdit(topFrame); 452 mEndDateSavingEdit = new KDateEdit(topFrame);
427 topLayout->addWidget(mEndDateSavingEdit, iii,1); 453 topLayout->addWidget(mEndDateSavingEdit, iii,1);
428 ++iii; 454 ++iii;
429 QDate current ( 2001, 1,1); 455 QDate current ( 2001, 1,1);
430 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); 456 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
431 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); 457 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
432 458
433 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 459 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
434 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 460 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
435 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); 461 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
436 tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); 462 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
437 463
438 464
439 topFrame = new QWidget( this ); 465 topFrame = new QWidget( this );
440 topLayout = new QGridLayout( topFrame, 3, 2); 466 topLayout = new QGridLayout( topFrame, 3, 2);
441 topLayout->setSpacing(KDialog::spacingHintSmall()); 467 topLayout->setSpacing(KDialog::spacingHintSmall());
442 topLayout->setMargin(KDialog::marginHintSmall()); 468 topLayout->setMargin(KDialog::marginHintSmall());
443 tabWidget->addTab( topFrame, i18n( "Fonts" ) ); 469 tabWidget->addTab( topFrame, i18n( "Fonts" ) );
444 470
445 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); 471 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame );
446 topLayout->addMultiCellWidget(labb,0,0,0,2); 472 topLayout->addMultiCellWidget(labb,0,0,0,2);
447 int i = 1; 473 int i = 1;
448 KPrefsWidFont *timeLabelsFont = 474 KPrefsWidFont *timeLabelsFont =
449 addWidFont(i18n("Kx/Pi"),i18n("Application Font"), 475 addWidFont(i18n("Kx/Pi"),i18n("Application Font"),
450 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); 476 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame);
451 topLayout->addWidget(timeLabelsFont->label(),i,0); 477 topLayout->addWidget(timeLabelsFont->label(),i,0);
452 topLayout->addWidget(timeLabelsFont->preview(),i,1); 478 topLayout->addWidget(timeLabelsFont->preview(),i,1);
453 topLayout->addWidget(timeLabelsFont->button(),i,2); 479 topLayout->addWidget(timeLabelsFont->button(),i,2);
454} 480}
455 481
456void KDEPIMConfigWidget::externalapp_changed( int newApp ) 482void KDEPIMConfigWidget::externalapp_changed( int newApp )
457{ 483{
458 // first store the current data 484 // first store the current data
459 saveEditFieldSettings(); 485 saveEditFieldSettings();
460 486
461 // set mCurrentApp 487 // set mCurrentApp
462 mCurrentApp = (ExternalAppHandler::Types)newApp; 488 mCurrentApp = (ExternalAppHandler::Types)newApp;
463 489
464 // set mCurrentClient 490 // set mCurrentClient
465 switch(mCurrentApp) 491 switch(mCurrentApp)
466 { 492 {
467 case(ExternalAppHandler::EMAIL): 493 case(ExternalAppHandler::EMAIL):
468 mCurrentClient = mEmailClient; 494 mCurrentClient = mEmailClient;
469 break; 495 break;
470 case(ExternalAppHandler::PHONE): 496 case(ExternalAppHandler::PHONE):
471 mCurrentClient = mPhoneClient; 497 mCurrentClient = mPhoneClient;
472 break; 498 break;
473 case(ExternalAppHandler::SMS): 499 case(ExternalAppHandler::SMS):
474 mCurrentClient = mSMSClient; 500 mCurrentClient = mSMSClient;
475 break; 501 break;
476 case(ExternalAppHandler::FAX): 502 case(ExternalAppHandler::FAX):
477 mCurrentClient = mFaxClient; 503 mCurrentClient = mFaxClient;
478 break; 504 break;
479 case(ExternalAppHandler::PAGER): 505 case(ExternalAppHandler::PAGER):
480 mCurrentClient = mPagerClient; 506 mCurrentClient = mPagerClient;
481 break; 507 break;
482 case(ExternalAppHandler::SIP): 508 case(ExternalAppHandler::SIP):
483 mCurrentClient = mSipClient; 509 mCurrentClient = mSipClient;
484 break; 510 break;
485 default: 511 default:
486 return; 512 return;
487 } 513 }
488 514
489 // and at last update the widgets 515 // and at last update the widgets
490 updateClientWidgets(); 516 updateClientWidgets();
491} 517}
492 518
493 519
494 520
495void KDEPIMConfigWidget::client_changed( int newClient ) 521void KDEPIMConfigWidget::client_changed( int newClient )
496{ 522{
497 if (newClient == mCurrentClient) 523 if (newClient == mCurrentClient)
498 return; 524 return;
499 525
500 // first store the current data 526 // first store the current data
501 saveEditFieldSettings(); 527 saveEditFieldSettings();
502 528
503 529
504 //then reset the clientvariable 530 //then reset the clientvariable
505 mCurrentClient = newClient; 531 mCurrentClient = newClient;
506 532
507 // and at last update the widgets 533 // and at last update the widgets
508 updateClientWidgets(); 534 updateClientWidgets();
509 535
510 KPrefsWidget::modified(); 536 KPrefsWidget::modified();
511} 537}
512 538
513void KDEPIMConfigWidget::saveEditFieldSettings() 539void KDEPIMConfigWidget::saveEditFieldSettings()
514{ 540{
515 541
516 switch(mCurrentApp) 542 switch(mCurrentApp)
517 { 543 {
518 case(ExternalAppHandler::EMAIL): 544 case(ExternalAppHandler::EMAIL):
519 mEmailClient = mClient->currentItem(); 545 mEmailClient = mClient->currentItem();
520 break; 546 break;
521 case(ExternalAppHandler::PHONE): 547 case(ExternalAppHandler::PHONE):
522 mPhoneClient= mClient->currentItem(); 548 mPhoneClient= mClient->currentItem();
523 break; 549 break;
524 case(ExternalAppHandler::SMS): 550 case(ExternalAppHandler::SMS):
525 mSMSClient = mClient->currentItem(); 551 mSMSClient = mClient->currentItem();
526 break; 552 break;
527 case(ExternalAppHandler::FAX): 553 case(ExternalAppHandler::FAX):
528 mFaxClient = mClient->currentItem(); 554 mFaxClient = mClient->currentItem();
529 break; 555 break;
530 case(ExternalAppHandler::PAGER): 556 case(ExternalAppHandler::PAGER):
531 mPagerClient = mClient->currentItem(); 557 mPagerClient = mClient->currentItem();
532 break; 558 break;
533 case(ExternalAppHandler::SIP): 559 case(ExternalAppHandler::SIP):
534 mSipClient = mClient->currentItem(); 560 mSipClient = mClient->currentItem();
535 break; 561 break;
536 default: 562 default:
537 return; 563 return;
538 } 564 }
539 565
540 //store the current data back to the apropriate membervariables if we had set it to "other" 566 //store the current data back to the apropriate membervariables if we had set it to "other"
541 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 567 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
542 { 568 {
543 mEmailOtherChannel = mChannel->text(); 569 mEmailOtherChannel = mChannel->text();
544 mEmailOtherMessage = mMessage->text(); 570 mEmailOtherMessage = mMessage->text();
545 mEmailOtherMessageParameters = mParameters->text(); 571 mEmailOtherMessageParameters = mParameters->text();
546 mEmailOtherMessage2 = mMessage2->text(); 572 mEmailOtherMessage2 = mMessage2->text();
547 mEmailOtherMessageParameters2 = mParameters2->text(); 573 mEmailOtherMessageParameters2 = mParameters2->text();
548 } 574 }
549 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 575 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
550 { 576 {
551 mPhoneOtherChannel = mChannel->text(); 577 mPhoneOtherChannel = mChannel->text();
552 mPhoneOtherMessage = mMessage->text(); 578 mPhoneOtherMessage = mMessage->text();
553 mPhoneOtherMessageParameters = mParameters->text(); 579 mPhoneOtherMessageParameters = mParameters->text();
554 } 580 }
555 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 581 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
556 { 582 {
557 mSMSOtherChannel = mChannel->text(); 583 mSMSOtherChannel = mChannel->text();
558 mSMSOtherMessage = mMessage->text(); 584 mSMSOtherMessage = mMessage->text();
559 mSMSOtherMessageParameters = mParameters->text(); 585 mSMSOtherMessageParameters = mParameters->text();
560 } 586 }
561 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 587 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
562 { 588 {
563 mFaxOtherChannel = mChannel->text(); 589 mFaxOtherChannel = mChannel->text();
564 mFaxOtherMessage = mMessage->text(); 590 mFaxOtherMessage = mMessage->text();
565 mFaxOtherMessageParameters = mParameters->text(); 591 mFaxOtherMessageParameters = mParameters->text();
566 } 592 }
567 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 593 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
568 { 594 {
569 mPagerOtherChannel = mChannel->text(); 595 mPagerOtherChannel = mChannel->text();
570 mPagerOtherMessage = mMessage->text(); 596 mPagerOtherMessage = mMessage->text();
571 mPagerOtherMessageParameters = mParameters->text(); 597 mPagerOtherMessageParameters = mParameters->text();
572 } 598 }
573 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 599 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
574 { 600 {
575 mSipOtherChannel = mChannel->text(); 601 mSipOtherChannel = mChannel->text();
576 mSipOtherMessage = mMessage->text(); 602 mSipOtherMessage = mMessage->text();
577 mSipOtherMessageParameters = mParameters->text(); 603 mSipOtherMessageParameters = mParameters->text();
578 } 604 }
579 605
580 606
581} 607}
582 608
583void KDEPIMConfigWidget::updateClientWidgets() 609void KDEPIMConfigWidget::updateClientWidgets()
584{ 610{
585 bool blocked = signalsBlocked(); 611 bool blocked = signalsBlocked();
586 blockSignals( true ); 612 blockSignals( true );
587 613
588 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 614 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
589 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); 615 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
590 if (it == mExternalAppsMap.end()) 616 if (it == mExternalAppsMap.end())
591 return; 617 return;
592 618
593 // update group box 619 // update group box
594 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 620 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
595 621
596 //update the entries in the client combobox 622 //update the entries in the client combobox
597 mClient->clear(); 623 mClient->clear();
598 624
599 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 625 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
600 DefaultAppItem* dai; 626 DefaultAppItem* dai;
601 for ( dai=items.first(); dai != 0; dai=items.next() ) 627 for ( dai=items.first(); dai != 0; dai=items.next() )
602 { 628 {
603 mClient->insertItem( i18n(dai->_label), dai->_id ); 629 mClient->insertItem( i18n(dai->_label), dai->_id );
604 630
605 if (dai->_id == mCurrentClient) 631 if (dai->_id == mCurrentClient)
606 { 632 {
607 //restore the edit fields with the data of the local membervariables if we had set it to "other". 633 //restore the edit fields with the data of the local membervariables if we had set it to "other".
608 //Otherwise take the default data from externalapphandler. 634 //Otherwise take the default data from externalapphandler.
609 mChannel->setText(dai->_channel); 635 mChannel->setText(dai->_channel);
610 mMessage->setText(dai->_message); 636 mMessage->setText(dai->_message);
611 mParameters->setText(dai->_parameters); 637 mParameters->setText(dai->_parameters);
612 mMessage2->setText(dai->_message2); 638 mMessage2->setText(dai->_message2);
613 mParameters2->setText(dai->_parameters2); 639 mParameters2->setText(dai->_parameters2);
614 640
615 641
616 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 642 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
617 { 643 {
618 mChannel->setText(mEmailOtherChannel); 644 mChannel->setText(mEmailOtherChannel);
619 mMessage->setText(mEmailOtherMessage); 645 mMessage->setText(mEmailOtherMessage);
620 mParameters->setText(mEmailOtherMessageParameters); 646 mParameters->setText(mEmailOtherMessageParameters);
621 mMessage2->setText(mEmailOtherMessage2); 647 mMessage2->setText(mEmailOtherMessage2);
622 mParameters2->setText(mEmailOtherMessageParameters2); 648 mParameters2->setText(mEmailOtherMessageParameters2);
623 } 649 }
624 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 650 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
625 { 651 {
626 mChannel->setText(mPhoneOtherChannel); 652 mChannel->setText(mPhoneOtherChannel);
627 mMessage->setText(mPhoneOtherMessage); 653 mMessage->setText(mPhoneOtherMessage);
628 mParameters->setText(mPhoneOtherMessageParameters); 654 mParameters->setText(mPhoneOtherMessageParameters);
629 } 655 }
630 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 656 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
631 { 657 {
632 mChannel->setText(mSMSOtherChannel); 658 mChannel->setText(mSMSOtherChannel);
633 mMessage->setText(mSMSOtherMessage); 659 mMessage->setText(mSMSOtherMessage);
634 mParameters->setText(mSMSOtherMessageParameters); 660 mParameters->setText(mSMSOtherMessageParameters);
635 } 661 }
636 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 662 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
637 { 663 {
638 mChannel->setText(mFaxOtherChannel); 664 mChannel->setText(mFaxOtherChannel);
639 mMessage->setText(mFaxOtherMessage); 665 mMessage->setText(mFaxOtherMessage);
640 mParameters->setText(mFaxOtherMessageParameters); 666 mParameters->setText(mFaxOtherMessageParameters);
641 } 667 }
642 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 668 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
643 { 669 {
644 mChannel->setText(mPagerOtherChannel); 670 mChannel->setText(mPagerOtherChannel);
645 mMessage->setText(mPagerOtherMessage); 671 mMessage->setText(mPagerOtherMessage);
646 mParameters->setText(mPagerOtherMessageParameters); 672 mParameters->setText(mPagerOtherMessageParameters);
647 } 673 }
648 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 674 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
649 { 675 {
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index c545207..984e4e0 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -1,160 +1,161 @@
1/* 1/*
2 This file is part of KDEPim/Pi. 2 This file is part of KDEPim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KDEPIMCONFIGWIDGET_H 31#ifndef KDEPIMCONFIGWIDGET_H
32#define KDEPIMCONFIGWIDGET_H 32#define KDEPIMCONFIGWIDGET_H
33 33
34#include <kprefswidget.h> 34#include <kprefswidget.h>
35#include <kio/kfile/kurlrequester.h> 35#include <kio/kfile/kurlrequester.h>
36#include <qmap.h> 36#include <qmap.h>
37 37
38#include "externalapphandler.h" 38#include "externalapphandler.h"
39 39
40 40
41class QComboBox; 41class QComboBox;
42class QLineEdit; 42class QLineEdit;
43class KPimGlobalPrefs; 43class KPimGlobalPrefs;
44class QGroupBox; 44class QGroupBox;
45class QTabWidget; 45class QTabWidget;
46class KDateEdit; 46class KDateEdit;
47 47
48class KDEPIMConfigWidget : public KPrefsWidget 48class KDEPIMConfigWidget : public KPrefsWidget
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52 public: 52 public:
53 KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 ); 53 KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 );
54 54
55 public slots: 55 public slots:
56 void textChanged( const QString& text ); 56 void textChanged( const QString& text );
57 void showTimeZoneTab(); 57 void showTimeZoneTab();
58 58
59 protected: 59 protected:
60 /** Implement this to read custom configuration widgets. */ 60 /** Implement this to read custom configuration widgets. */
61 virtual void usrReadConfig(); 61 virtual void usrReadConfig();
62 /** Implement this to write custom configuration widgets. */ 62 /** Implement this to write custom configuration widgets. */
63 virtual void usrWriteConfig(); 63 virtual void usrWriteConfig();
64 64
65 65
66 private slots: 66 private slots:
67// void configureExtension(); 67// void configureExtension();
68// void selectionChanged( QListViewItem* ); 68// void selectionChanged( QListViewItem* );
69// void itemClicked( QListViewItem* ); 69// void itemClicked( QListViewItem* );
70 void client_changed( int newClient ); 70 void client_changed( int newClient );
71 void externalapp_changed( int newApp ); 71 void externalapp_changed( int newApp );
72 void saveStoreSettings(); 72 void saveStoreSettings();
73 void setStandardStore(); 73 void setStandardStore();
74 void setLocalStore();
74 75
75 private: 76 private:
76 void setupExternalAppTab(); 77 void setupExternalAppTab();
77 void setupLocaleDateTab(); 78 void setupLocaleDateTab();
78 void setupLocaleTab(); 79 void setupLocaleTab();
79 void setupTimeZoneTab(); 80 void setupTimeZoneTab();
80 void setupStoreTab(); 81 void setupStoreTab();
81 KURLRequester* mStoreUrl; 82 KURLRequester* mStoreUrl;
82 83
83 void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); 84 void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
84 85
85 86
86 void saveEditFieldSettings(); 87 void saveEditFieldSettings();
87 void updateClientWidgets(); 88 void updateClientWidgets();
88 89
89 QTabWidget *tabWidget; 90 QTabWidget *tabWidget;
90 91
91 92
92 QLineEdit* mUserDateFormatShort; 93 QLineEdit* mUserDateFormatShort;
93 QLineEdit* mUserDateFormatLong; 94 QLineEdit* mUserDateFormatLong;
94 QComboBox* mTimeZoneCombo; 95 QComboBox* mTimeZoneCombo;
95 KDateEdit* mStartDateSavingEdit; 96 KDateEdit* mStartDateSavingEdit;
96 KDateEdit* mEndDateSavingEdit; 97 KDateEdit* mEndDateSavingEdit;
97 98
98// void restoreExtensionSettings(); 99// void restoreExtensionSettings();
99// void saveExtensionSettings(); 100// void saveExtensionSettings();
100 101
101// KListView *mExtensionView; 102// KListView *mExtensionView;
102 103
103// QCheckBox *mNameParsing; 104// QCheckBox *mNameParsing;
104// QCheckBox *mViewsSingleClickBox; 105// QCheckBox *mViewsSingleClickBox;
105// QPushButton *mConfigureButton; 106// QPushButton *mConfigureButton;
106 QComboBox* mExternalApps; 107 QComboBox* mExternalApps;
107 QGroupBox* mExternalAppGroupBox; 108 QGroupBox* mExternalAppGroupBox;
108 109
109 110
110 QComboBox* mClient; 111 QComboBox* mClient;
111 QLineEdit* mChannel; 112 QLineEdit* mChannel;
112 QLineEdit* mMessage; 113 QLineEdit* mMessage;
113 QLineEdit* mParameters; 114 QLineEdit* mParameters;
114 QLineEdit* mMessage2; 115 QLineEdit* mMessage2;
115 QLineEdit* mParameters2; 116 QLineEdit* mParameters2;
116 117
117 ExternalAppHandler::Types mCurrentApp; 118 ExternalAppHandler::Types mCurrentApp;
118 int mCurrentClient; 119 int mCurrentClient;
119 120
120 121
121 int mEmailClient; 122 int mEmailClient;
122 QString mEmailOtherChannel; 123 QString mEmailOtherChannel;
123 QString mEmailOtherMessage; 124 QString mEmailOtherMessage;
124 QString mEmailOtherMessageParameters; 125 QString mEmailOtherMessageParameters;
125 QString mEmailOtherMessage2; 126 QString mEmailOtherMessage2;
126 QString mEmailOtherMessageParameters2; 127 QString mEmailOtherMessageParameters2;
127 128
128 int mPhoneClient; 129 int mPhoneClient;
129 QString mPhoneOtherChannel; 130 QString mPhoneOtherChannel;
130 QString mPhoneOtherMessage; 131 QString mPhoneOtherMessage;
131 QString mPhoneOtherMessageParameters; 132 QString mPhoneOtherMessageParameters;
132 133
133 int mFaxClient; 134 int mFaxClient;
134 QString mFaxOtherChannel; 135 QString mFaxOtherChannel;
135 QString mFaxOtherMessage; 136 QString mFaxOtherMessage;
136 QString mFaxOtherMessageParameters; 137 QString mFaxOtherMessageParameters;
137 138
138 int mSMSClient; 139 int mSMSClient;
139 QString mSMSOtherChannel; 140 QString mSMSOtherChannel;
140 QString mSMSOtherMessage; 141 QString mSMSOtherMessage;
141 QString mSMSOtherMessageParameters; 142 QString mSMSOtherMessageParameters;
142 143
143 int mPagerClient; 144 int mPagerClient;
144 QString mPagerOtherChannel; 145 QString mPagerOtherChannel;
145 QString mPagerOtherMessage; 146 QString mPagerOtherMessage;
146 QString mPagerOtherMessageParameters; 147 QString mPagerOtherMessageParameters;
147 148
148 int mSipClient; 149 int mSipClient;
149 QString mSipOtherChannel; 150 QString mSipOtherChannel;
150 QString mSipOtherMessage; 151 QString mSipOtherMessage;
151 QString mSipOtherMessageParameters; 152 QString mSipOtherMessageParameters;
152 153
153 154
154 155
155 QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; 156 QMap<ExternalAppHandler::Types, QString> mExternalAppsMap;
156 157
157// AddresseeWidget *mAddresseeWidget; 158// AddresseeWidget *mAddresseeWidget;
158}; 159};
159 160
160#endif 161#endif