summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-29 14:16:05 (UTC)
committer zautrix <zautrix>2004-08-29 14:16:05 (UTC)
commit3a5648d8378b44cbe12d66bafa3d557c065f0f6d (patch) (unidiff)
tree1f143371c48b017ee6cf86862fcbc261727421b4
parentf7bf415be8c727c887ec01c2d8fb8f1c2f85d096 (diff)
downloadkdepimpi-3a5648d8378b44cbe12d66bafa3d557c065f0f6d.zip
kdepimpi-3a5648d8378b44cbe12d66bafa3d557c065f0f6d.tar.gz
kdepimpi-3a5648d8378b44cbe12d66bafa3d557c065f0f6d.tar.bz2
Some compilation fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile6
-rw-r--r--kabc/kabc.pro2
-rw-r--r--korganizer/kdatenavigator.cpp7
-rw-r--r--korganizer/koeditorrecurrence.cpp2
-rw-r--r--libkcal/calendar.h4
5 files changed, 11 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 95a3a45..ac314b9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,159 +1,157 @@
1############################################################################# 1#############################################################################
2# Makefile for building: kopi-desktop 2# Makefile for building: kopi-desktop
3# Generated by qmake (1.07a) (Qt 3.3.3) on: Thu Aug 19 22:23:29 2004 3# Generated by qmake (1.07a) (Qt 3.3.1) on: Sun Aug 29 13:39:55 2004
4# Project: kopi-desktop.pro 4# Project: kopi-desktop.pro
5# Template: subdirs 5# Template: subdirs
6# Command: $(QMAKE) -o Makefile kopi-desktop.pro 6# Command: $(QMAKE) -o Makefile kopi-desktop.pro
7############################################################################# 7#############################################################################
8 8
9 MAKEFILE =Makefile 9 MAKEFILE =Makefile
10 QMAKE =qmake 10 QMAKE =qmake
11DEL_FILE = rm -f 11DEL_FILE = rm -f
12CHK_DIR_EXISTS= test -d 12CHK_DIR_EXISTS= test -d
13MKDIR = mkdir -p 13MKDIR = mkdir -p
14INSTALL_FILE=
15INSTALL_DIR =
16 SUBTARGETS = \ 14 SUBTARGETS = \
17 sub-gammu-emb-common \ 15 sub-gammu-emb-common \
18 sub-libical \ 16 sub-libical \
19 sub-libkcal \ 17 sub-libkcal \
20 sub-microkde \ 18 sub-microkde \
21 sub-libkdepim \ 19 sub-libkdepim \
22 sub-kabc \ 20 sub-kabc \
23 sub-korganizer \ 21 sub-korganizer \
24 sub-kaddressbook \ 22 sub-kaddressbook \
25 sub-kabc-plugins-file \ 23 sub-kabc-plugins-file \
26 sub-kabc-plugins-dir 24 sub-kabc-plugins-dir
27 25
28first: all 26first: all
29 27
30all: Makefile $(SUBTARGETS) 28all: Makefile $(SUBTARGETS)
31 29
32gammu/emb/common/$(MAKEFILE): 30gammu/emb/common/$(MAKEFILE):
33 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" 31 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common"
34 cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE) 32 cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE)
35sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE 33sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE
36 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) 34 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE)
37 35
38libical/$(MAKEFILE): 36libical/$(MAKEFILE):
39 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" 37 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
40 cd libical && $(QMAKE) libical.pro -o $(MAKEFILE) 38 cd libical && $(QMAKE) libical.pro -o $(MAKEFILE)
41sub-libical: libical/$(MAKEFILE) FORCE 39sub-libical: libical/$(MAKEFILE) FORCE
42 cd libical && $(MAKE) -f $(MAKEFILE) 40 cd libical && $(MAKE) -f $(MAKEFILE)
43 41
44libkcal/$(MAKEFILE): 42libkcal/$(MAKEFILE):
45 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" 43 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
46 cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE) 44 cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE)
47sub-libkcal: libkcal/$(MAKEFILE) FORCE 45sub-libkcal: libkcal/$(MAKEFILE) FORCE
48 cd libkcal && $(MAKE) -f $(MAKEFILE) 46 cd libkcal && $(MAKE) -f $(MAKEFILE)
49 47
50microkde/$(MAKEFILE): 48microkde/$(MAKEFILE):
51 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" 49 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
52 cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE) 50 cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE)
53sub-microkde: microkde/$(MAKEFILE) FORCE 51sub-microkde: microkde/$(MAKEFILE) FORCE
54 cd microkde && $(MAKE) -f $(MAKEFILE) 52 cd microkde && $(MAKE) -f $(MAKEFILE)
55 53
56libkdepim/$(MAKEFILE): 54libkdepim/$(MAKEFILE):
57 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" 55 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
58 cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE) 56 cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE)
59sub-libkdepim: libkdepim/$(MAKEFILE) FORCE 57sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
60 cd libkdepim && $(MAKE) -f $(MAKEFILE) 58 cd libkdepim && $(MAKE) -f $(MAKEFILE)
61 59
62kabc/$(MAKEFILE): 60kabc/$(MAKEFILE):
63 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" 61 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
64 cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE) 62 cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE)
65sub-kabc: kabc/$(MAKEFILE) FORCE 63sub-kabc: kabc/$(MAKEFILE) FORCE
66 cd kabc && $(MAKE) -f $(MAKEFILE) 64 cd kabc && $(MAKE) -f $(MAKEFILE)
67 65
68korganizer/$(MAKEFILE): 66korganizer/$(MAKEFILE):
69 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" 67 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
70 cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE) 68 cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE)
71sub-korganizer: korganizer/$(MAKEFILE) FORCE 69sub-korganizer: korganizer/$(MAKEFILE) FORCE
72 cd korganizer && $(MAKE) -f $(MAKEFILE) 70 cd korganizer && $(MAKE) -f $(MAKEFILE)
73 71
74kaddressbook/$(MAKEFILE): 72kaddressbook/$(MAKEFILE):
75 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook" 73 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
76 cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE) 74 cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE)
77sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE 75sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
78 cd kaddressbook && $(MAKE) -f $(MAKEFILE) 76 cd kaddressbook && $(MAKE) -f $(MAKEFILE)
79 77
80kabc/plugins/file/$(MAKEFILE): 78kabc/plugins/file/$(MAKEFILE):
81 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" 79 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
82 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE) 80 cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE)
83sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE 81sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
84 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) 82 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
85 83
86kabc/plugins/dir/$(MAKEFILE): 84kabc/plugins/dir/$(MAKEFILE):
87 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir" 85 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
88 cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE) 86 cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE)
89sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE 87sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
90 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE) 88 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
91 89
92Makefile: kopi-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf 90Makefile: kopi-desktop.pro /usr/lib/qt3/mkspecs/default/qmake.conf
93 $(QMAKE) -o Makefile kopi-desktop.pro 91 $(QMAKE) -o Makefile kopi-desktop.pro
94qmake: qmake_all 92qmake: qmake_all
95 @$(QMAKE) -o Makefile kopi-desktop.pro 93 @$(QMAKE) -o Makefile kopi-desktop.pro
96 94
97all: $(SUBTARGETS) 95all: $(SUBTARGETS)
98qmake_all: gammu/emb/common/$(MAKEFILE) libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE) 96qmake_all: gammu/emb/common/$(MAKEFILE) libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE)
99 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 97 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
100 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 98 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
101 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 99 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
102 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 100 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
103 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 101 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
104 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 102 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
105 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 103 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
106 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 104 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
107 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 105 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
108 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 106 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
109clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE 107clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
110 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true 108 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true
111 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true 109 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
112 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true 110 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
113 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true 111 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
114 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true 112 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
115 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true 113 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
116 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true 114 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
117 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true 115 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
118 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true 116 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
119 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true 117 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
120uninstall_subdirs: qmake_all FORCE 118uninstall_subdirs: qmake_all FORCE
121 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 119 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
122 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 120 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
123 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 121 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
124 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 122 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
125 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 123 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
126 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 124 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
127 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 125 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
128 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 126 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
129 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 127 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
130 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 128 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
131install_subdirs: qmake_all FORCE 129install_subdirs: qmake_all FORCE
132 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true 130 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true
133 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true 131 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
134 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true 132 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
135 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true 133 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
136 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true 134 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
137 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true 135 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
138 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true 136 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
139 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true 137 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
140 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true 138 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
141 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true 139 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
142distclean: qmake_all FORCE 140distclean: qmake_all FORCE
143 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 141 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
144 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 142 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
145 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 143 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
146 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 144 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
147 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 145 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
148 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 146 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
149 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 147 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
150 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 148 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
151 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 149 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
152 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 150 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
153 151
154install: install_subdirs 152install: install_subdirs
155 153
156uninstall: uninstall_subdirs 154uninstall: uninstall_subdirs
157 155
158FORCE: 156FORCE:
159 157
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index 95ebd68..417f5b0 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -1,218 +1,218 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3#release debug 3#release debug
4DESTDIR=../bin 4DESTDIR=../bin
5 5
6TARGET = microkabc 6TARGET = microkabc
7 7
8include( ../variables.pri ) 8include( ../variables.pri )
9 9
10INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui .. 10INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui ..
11 11
12#LIBS += -lmicrokde -lldap 12#LIBS += -lmicrokde -lldap
13LIBS += -L$(QPEDIR)/lib 13LIBS += -L$(QPEDIR)/lib
14DEFINES += KAB_EMBEDDED DESKTOP_VERSION 14DEFINES += KAB_EMBEDDED DESKTOP_VERSION
15unix : { 15unix : {
16 16
17OBJECTS_DIR = obj/unix 17OBJECTS_DIR = obj/unix
18MOC_DIR = moc/unix 18MOC_DIR = moc/unix
19} 19}
20win32: { 20win32: {
21DEFINES += _WIN32_ 21DEFINES += _WIN32_
22OBJECTS_DIR = obj/win 22OBJECTS_DIR = obj/win
23MOC_DIR = moc/win 23MOC_DIR = moc/win
24} 24}
25INTERFACES = \ 25INTERFACES = \
26 26
27 27
28HEADERS = \ 28HEADERS = \
29 resource.h \ 29 resource.h \
30 stdaddressbook.h \ 30 stdaddressbook.h \
31 agent.h \ 31 agent.h \
32 geo.h \ 32 geo.h \
33 key.h \ 33 key.h \
34 field.h \ 34 field.h \
35 plugin.h \ 35 plugin.h \
36 address.h \ 36 address.h \
37 addresseelist.h \ 37 addresseelist.h \
38formatfactory.h \ 38formatfactory.h \
39 formatplugin.h \ 39 formatplugin.h \
40 phonenumber.h \ 40 phonenumber.h \
41distributionlist.h \ 41distributionlist.h \
42distributionlistdialog.h \ 42distributionlistdialog.h \
43distributionlisteditor.h \ 43distributionlisteditor.h \
44vcardformatplugin.h \ 44vcardformatplugin.h \
45formats/vcardformatplugin2.h \ 45formats/vcardformatplugin2.h \
46 picture.h \ 46 picture.h \
47 secrecy.h \ 47 secrecy.h \
48 sound.h \ 48 sound.h \
49 addressbook.h \ 49 addressbook.h \
50 syncprefwidget.h \ 50 syncprefwidget.h \
51 timezone.h \ 51 timezone.h \
52 tmpaddressbook.h \ 52 tmpaddressbook.h \
53 addressee.h \ 53 addressee.h \
54 addresseedialog.h \ 54 addresseedialog.h \
55 vcardconverter.h \ 55 vcardconverter.h \
56 vcard21parser.h \ 56 vcard21parser.h \
57 vcardformatimpl.h \ 57 vcardformatimpl.h \
58 plugins/file/resourcefile.h \ 58 plugins/file/resourcefile.h \
59 plugins/file/resourcefileconfig.h \ 59 plugins/file/resourcefileconfig.h \
60 plugins/dir/resourcedir.h \ 60 plugins/dir/resourcedir.h \
61 plugins/dir/resourcedirconfig.h \ 61 plugins/dir/resourcedirconfig.h \
62 vcardparser/vcardline.h \ 62 vcardparser/vcardline.h \
63 vcardparser/vcard.h \ 63 vcardparser/vcard.h \
64 vcardparser/vcardtool.h \ 64 vcardparser/vcardtool.h \
65 vcardparser/vcardparser.h \ 65 vcardparser/vcardparser.h \
66vcard/include/VCardAdrParam.h \ 66vcard/include/VCardAdrParam.h \
67vcard/include/VCardAdrValue.h \ 67vcard/include/VCardAdrValue.h \
68vcard/include/VCardAgentParam.h \ 68vcard/include/VCardAgentParam.h \
69vcard/include/VCardContentLine.h \ 69vcard/include/VCardContentLine.h \
70vcard/include/VCardDateParam.h \ 70vcard/include/VCardDateParam.h \
71vcard/include/VCardDateValue.h \ 71vcard/include/VCardDateValue.h \
72vcard/include/VCardEmailParam.h \ 72vcard/include/VCardEmailParam.h \
73vcard/include/VCardGeoValue.h \ 73vcard/include/VCardGeoValue.h \
74vcard/include/VCardGroup.h \ 74vcard/include/VCardGroup.h \
75vcard/include/VCardImageParam.h \ 75vcard/include/VCardImageParam.h \
76vcard/include/VCardImageValue.h \ 76vcard/include/VCardImageValue.h \
77vcard/include/VCardLangValue.h \ 77vcard/include/VCardLangValue.h \
78vcard/include/VCardNValue.h \ 78vcard/include/VCardNValue.h \
79vcard/include/VCardParam.h \ 79vcard/include/VCardParam.h \
80vcard/include/VCardPhoneNumberValue.h \ 80vcard/include/VCardPhoneNumberValue.h \
81vcard/include/VCardSourceParam.h \ 81vcard/include/VCardSourceParam.h \
82vcard/include/VCardTelParam.h \ 82vcard/include/VCardTelParam.h \
83vcard/include/VCardTextParam.h \ 83vcard/include/VCardTextParam.h \
84vcard/include/VCardTextNSParam.h \
85vcard/include/VCardTextValue.h \ 84vcard/include/VCardTextValue.h \
86vcard/include/VCardTextBinParam.h \ 85vcard/include/VCardTextBinParam.h \
87vcard/include/VCardURIValue.h \ 86vcard/include/VCardURIValue.h \
88vcard/include/VCardVCard.h \ 87vcard/include/VCardVCard.h \
89vcard/include/VCardEntity.h \ 88vcard/include/VCardEntity.h \
90vcard/include/VCardValue.h \ 89vcard/include/VCardValue.h \
91vcard/include/VCardSoundValue.h \ 90vcard/include/VCardSoundValue.h \
92vcard/include/VCardAgentValue.h \ 91vcard/include/VCardAgentValue.h \
93vcard/include/VCardTelValue.h \ 92vcard/include/VCardTelValue.h \
94vcard/include/VCardTextBinValue.h \ 93vcard/include/VCardTextBinValue.h \
95vcard/include/VCardOrgValue.h \ 94vcard/include/VCardOrgValue.h \
96vcard/include/VCardUTCValue.h \ 95vcard/include/VCardUTCValue.h \
97vcard/include/VCardClassValue.h \ 96vcard/include/VCardClassValue.h \
98vcard/include/VCardFloatValue.h \ 97vcard/include/VCardFloatValue.h \
99vcard/include/VCardTextListValue.h \ 98vcard/include/VCardTextListValue.h \
100vcard/include/generated/AdrParam-generated.h \ 99vcard/include/generated/AdrParam-generated.h \
101vcard/include/generated/AdrValue-generated.h \ 100vcard/include/generated/AdrValue-generated.h \
102vcard/include/generated/AgentParam-generated.h \ 101vcard/include/generated/AgentParam-generated.h \
103vcard/include/generated/ContentLine-generated.h \ 102vcard/include/generated/ContentLine-generated.h \
104vcard/include/generated/DateParam-generated.h \ 103vcard/include/generated/DateParam-generated.h \
105vcard/include/generated/DateValue-generated.h \ 104vcard/include/generated/DateValue-generated.h \
106vcard/include/generated/EmailParam-generated.h \ 105vcard/include/generated/EmailParam-generated.h \
107vcard/include/generated/GeoValue-generated.h \ 106vcard/include/generated/GeoValue-generated.h \
108vcard/include/generated/Group-generated.h \ 107vcard/include/generated/Group-generated.h \
109vcard/include/generated/ImageParam-generated.h \ 108vcard/include/generated/ImageParam-generated.h \
110vcard/include/generated/ImageValue-generated.h \ 109vcard/include/generated/ImageValue-generated.h \
111vcard/include/generated/LangValue-generated.h \ 110vcard/include/generated/LangValue-generated.h \
112vcard/include/generated/NValue-generated.h \ 111vcard/include/generated/NValue-generated.h \
113vcard/include/generated/Param-generated.h \ 112vcard/include/generated/Param-generated.h \
114vcard/include/generated/PhoneNumberValue-generated.h \ 113vcard/include/generated/PhoneNumberValue-generated.h \
115vcard/include/generated/SourceParam-generated.h \ 114vcard/include/generated/SourceParam-generated.h \
116vcard/include/generated/TelParam-generated.h \ 115vcard/include/generated/TelParam-generated.h \
117vcard/include/generated/TextParam-generated.h \ 116vcard/include/generated/TextParam-generated.h \
118vcard/include/generated/TextNSParam-generated.h \ 117vcard/include/generated/TextNSParam-generated.h \
119vcard/include/generated/TextValue-generated.h \ 118vcard/include/generated/TextValue-generated.h \
120vcard/include/generated/TextBinParam-generated.h \ 119vcard/include/generated/TextBinParam-generated.h \
121vcard/include/generated/URIValue-generated.h \ 120vcard/include/generated/URIValue-generated.h \
122vcard/include/generated/VCard-generated.h \ 121vcard/include/generated/VCard-generated.h \
123vcard/include/generated/VCardEntity-generated.h \ 122vcard/include/generated/VCardEntity-generated.h \
124vcard/include/generated/Value-generated.h \ 123vcard/include/generated/Value-generated.h \
125vcard/include/generated/SoundValue-generated.h \ 124vcard/include/generated/SoundValue-generated.h \
126vcard/include/generated/AgentValue-generated.h \ 125vcard/include/generated/AgentValue-generated.h \
127vcard/include/generated/TelValue-generated.h \ 126vcard/include/generated/TelValue-generated.h \
128vcard/include/generated/TextBinValue-generated.h \ 127vcard/include/generated/TextBinValue-generated.h \
129vcard/include/generated/OrgValue-generated.h \ 128vcard/include/generated/OrgValue-generated.h \
130vcard/include/generated/UTCValue-generated.h \ 129vcard/include/generated/UTCValue-generated.h \
131vcard/include/generated/ClassValue-generated.h \ 130vcard/include/generated/ClassValue-generated.h \
132vcard/include/generated/FloatValue-generated.h \ 131vcard/include/generated/FloatValue-generated.h \
133vcard/include/generated/TextListValue-generated.h 132vcard/include/generated/TextListValue-generated.h
134 133
135 134
136# plugins/ldap/resourceldap.h \ 135# plugins/ldap/resourceldap.h \
137# plugins/ldap/resourceldapconfig.h \ 136# plugins/ldap/resourceldapconfig.h \
138#formats/binary/binaryformat.h \ 137#formats/binary/binaryformat.h \
139 138
139#vcard/include/VCardTextNSParam.h \
140 140
141SOURCES = \ 141SOURCES = \
142distributionlist.cpp \ 142distributionlist.cpp \
143distributionlistdialog.cpp \ 143distributionlistdialog.cpp \
144distributionlisteditor.cpp \ 144distributionlisteditor.cpp \
145vcardformatplugin.cpp \ 145vcardformatplugin.cpp \
146formats/vcardformatplugin2.cpp \ 146formats/vcardformatplugin2.cpp \
147formatfactory.cpp \ 147formatfactory.cpp \
148 resource.cpp \ 148 resource.cpp \
149 stdaddressbook.cpp \ 149 stdaddressbook.cpp \
150 plugin.cpp \ 150 plugin.cpp \
151 agent.cpp \ 151 agent.cpp \
152 geo.cpp \ 152 geo.cpp \
153 key.cpp \ 153 key.cpp \
154 field.cpp \ 154 field.cpp \
155 address.cpp \ 155 address.cpp \
156 phonenumber.cpp \ 156 phonenumber.cpp \
157 picture.cpp \ 157 picture.cpp \
158 secrecy.cpp \ 158 secrecy.cpp \
159 sound.cpp \ 159 sound.cpp \
160 addressbook.cpp \ 160 addressbook.cpp \
161 syncprefwidget.cpp \ 161 syncprefwidget.cpp \
162 timezone.cpp \ 162 timezone.cpp \
163 tmpaddressbook.cpp \ 163 tmpaddressbook.cpp \
164 addressee.cpp \ 164 addressee.cpp \
165 addresseelist.cpp \ 165 addresseelist.cpp \
166 addresseedialog.cpp \ 166 addresseedialog.cpp \
167 vcardconverter.cpp \ 167 vcardconverter.cpp \
168 vcard21parser.cpp \ 168 vcard21parser.cpp \
169 vcardformatimpl.cpp \ 169 vcardformatimpl.cpp \
170 plugins/file/resourcefile.cpp \ 170 plugins/file/resourcefile.cpp \
171 plugins/file/resourcefileconfig.cpp \ 171 plugins/file/resourcefileconfig.cpp \
172 plugins/dir/resourcedir.cpp \ 172 plugins/dir/resourcedir.cpp \
173 plugins/dir/resourcedirconfig.cpp \ 173 plugins/dir/resourcedirconfig.cpp \
174 vcardparser/vcardline.cpp \ 174 vcardparser/vcardline.cpp \
175 vcardparser/vcard.cpp \ 175 vcardparser/vcard.cpp \
176 vcardparser/vcardtool.cpp \ 176 vcardparser/vcardtool.cpp \
177 vcardparser/vcardparser.cpp \ 177 vcardparser/vcardparser.cpp \
178vcard/AdrParam.cpp \ 178vcard/AdrParam.cpp \
179vcard/AdrValue.cpp \ 179vcard/AdrValue.cpp \
180vcard/AgentParam.cpp \ 180vcard/AgentParam.cpp \
181vcard/ContentLine.cpp \ 181vcard/ContentLine.cpp \
182vcard/DateParam.cpp \ 182vcard/DateParam.cpp \
183vcard/DateValue.cpp \ 183vcard/DateValue.cpp \
184vcard/EmailParam.cpp \ 184vcard/EmailParam.cpp \
185vcard/Entity.cpp \ 185vcard/Entity.cpp \
186vcard/Enum.cpp \ 186vcard/Enum.cpp \
187vcard/GeoValue.cpp \ 187vcard/GeoValue.cpp \
188vcard/ImageParam.cpp \ 188vcard/ImageParam.cpp \
189vcard/ImageValue.cpp \ 189vcard/ImageValue.cpp \
190vcard/LangValue.cpp \ 190vcard/LangValue.cpp \
191vcard/NValue.cpp \ 191vcard/NValue.cpp \
192vcard/Param.cpp \ 192vcard/Param.cpp \
193vcard/PhoneNumberValue.cpp \ 193vcard/PhoneNumberValue.cpp \
194vcard/RToken.cpp \ 194vcard/RToken.cpp \
195vcard/SourceParam.cpp \ 195vcard/SourceParam.cpp \
196vcard/TelParam.cpp \ 196vcard/TelParam.cpp \
197vcard/TextParam.cpp \ 197vcard/TextParam.cpp \
198vcard/TextValue.cpp \ 198vcard/TextValue.cpp \
199vcard/TextBinParam.cpp \ 199vcard/TextBinParam.cpp \
200vcard/URIValue.cpp \ 200vcard/URIValue.cpp \
201vcard/VCardv.cpp \ 201vcard/VCardv.cpp \
202vcard/VCardEntity.cpp \ 202vcard/VCardEntity.cpp \
203vcard/Value.cpp \ 203vcard/Value.cpp \
204vcard/SoundValue.cpp \ 204vcard/SoundValue.cpp \
205vcard/AgentValue.cpp \ 205vcard/AgentValue.cpp \
206vcard/TelValue.cpp \ 206vcard/TelValue.cpp \
207vcard/TextBinValue.cpp \ 207vcard/TextBinValue.cpp \
208vcard/OrgValue.cpp \ 208vcard/OrgValue.cpp \
209vcard/UTCValue.cpp \ 209vcard/UTCValue.cpp \
210vcard/ClassValue.cpp \ 210vcard/ClassValue.cpp \
211vcard/FloatValue.cpp \ 211vcard/FloatValue.cpp \
212vcard/TextListValue.cpp 212vcard/TextListValue.cpp
213 213
214 214
215# plugins/ldap/resourceldap.cpp \ 215# plugins/ldap/resourceldap.cpp \
216# plugins/ldap/resourceldapconfig.cpp \ 216# plugins/ldap/resourceldapconfig.cpp \
217 217
218#formats/binary/binaryformat.cpp \ 218#formats/binary/binaryformat.cpp \
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 7d0c516..b420351 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -1,364 +1,367 @@
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, Calendar *calendar, 48KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar,
49 bool show_week_nums, const char *name, 49 bool show_week_nums, const char *name,
50 QDate startDate ) 50 QDate startDate )
51 : QFrame(parent, name), 51 : QFrame(parent, name),
52 updateTimer(0L) 52 updateTimer(0L)
53{ 53{
54 mCalendar = calendar; 54 mCalendar = calendar;
55 55
56 setFrameStyle(QFrame::NoFrame); 56 setFrameStyle(QFrame::NoFrame);
57 57
58 QGridLayout *topLayout = new QGridLayout(this,8,8); 58 QGridLayout *topLayout = new QGridLayout(this,8,8);
59 59
60 if (! startDate.isValid()) { 60 if (! startDate.isValid()) {
61 kdDebug() << "KDateNavigator::KDateNavigator(): an invalid date was passed as a parameter!" << endl; 61 kdDebug() << "KDateNavigator::KDateNavigator(): an invalid date was passed as a parameter!" << endl;
62 startDate = QDate::currentDate(); 62 startDate = QDate::currentDate();
63 } 63 }
64 64
65 mSelectedDates.append(startDate); 65 mSelectedDates.append(startDate);
66 m_MthYr = startDate; 66 m_MthYr = startDate;
67 m_bShowWeekNums = show_week_nums; 67 m_bShowWeekNums = show_week_nums;
68 68
69 setFont( KOPrefs::instance()->mDateNavigatorFont ); 69 setFont( KOPrefs::instance()->mDateNavigatorFont );
70 mNavigatorBar = new NavigatorBar( startDate, this ); 70 mNavigatorBar = new NavigatorBar( startDate, this );
71 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 71 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
72 //mNavigatorBar->resize( 1,1); 72 //mNavigatorBar->resize( 1,1);
73 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 73 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
74 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 74 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
75 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 75 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
76 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 76 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
77 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); 77 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) );
78 78
79 // get the day of the week on the first day 79 // get the day of the week on the first day
80 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 80 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
81 m_fstDayOfWk = dayone.dayOfWeek(); 81 m_fstDayOfWk = dayone.dayOfWeek();
82 82
83 int i; 83 int i;
84 84
85 // Set up the heading fields. 85 // Set up the heading fields.
86 for( i = 0; i < 7; i++ ) { 86 for( i = 0; i < 7; i++ ) {
87 headings[i] = new QLabel("",this); 87 headings[i] = new QLabel("",this);
88 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 88 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
89 headings[i]->setAlignment(AlignCenter); 89 headings[i]->setAlignment(AlignCenter);
90 90
91 topLayout->addWidget(headings[i],1,i+1); 91 topLayout->addWidget(headings[i],1,i+1);
92 } 92 }
93 93
94 // Create the weeknumber labels 94 // Create the weeknumber labels
95 for( i = 0; i < 6; i++ ) { 95 for( i = 0; i < 6; i++ ) {
96 weeknos[i] = new QLabel(this); 96 weeknos[i] = new QLabel(this);
97 weeknos[i]->setAlignment(AlignCenter); 97 weeknos[i]->setAlignment(AlignCenter);
98 //weeknos[i]->setFont(QFont("Arial", 10)); 98 //weeknos[i]->setFont(QFont("Arial", 10));
99 if(!show_week_nums) { 99 if(!show_week_nums) {
100 weeknos[i]->hide(); 100 weeknos[i]->hide();
101 } 101 }
102 weeknos[i]->installEventFilter(this); 102 weeknos[i]->installEventFilter(this);
103 103
104 topLayout->addWidget(weeknos[i],i+2,0); 104 topLayout->addWidget(weeknos[i],i+2,0);
105 } 105 }
106 106
107 daymatrix = new KODayMatrix( this, mCalendar, dayone, 107 daymatrix = new KODayMatrix( this, mCalendar, dayone,
108 "KDateNavigator::DayMatrix"); 108 "KDateNavigator::DayMatrix");
109 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 109 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
110 daymatrix->setLineWidth(1); 110 daymatrix->setLineWidth(1);
111 111
112 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 112 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
113 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 113 SIGNAL( datesSelected( const KCal::DateList & ) ) );
114 114
115 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 115 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
116 SIGNAL( eventDropped( Event * ) ) ); 116 SIGNAL( eventDropped( Event * ) ) );
117 117
118 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 118 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
119 119
120 // read settings from configuration file. 120 // read settings from configuration file.
121 updateConfig(); 121 updateConfig();
122 enableRollover(FollowMonth); 122 enableRollover(FollowMonth);
123 setFixedSize ( sizeHint() ); 123 setFixedSize ( sizeHint() );
124} 124}
125 125
126void KDateNavigator::enableRollover(RolloverType r) 126void KDateNavigator::enableRollover(RolloverType r)
127{ 127{
128 switch(r) 128 switch(r)
129 { 129 {
130 case None : 130 case None :
131 if (updateTimer) 131 if (updateTimer)
132 { 132 {
133 updateTimer->stop(); 133 updateTimer->stop();
134 delete updateTimer; 134 delete updateTimer;
135 updateTimer=0L; 135 updateTimer=0L;
136 } 136 }
137 break; 137 break;
138 case FollowDay : 138 case FollowDay :
139 case FollowMonth : 139 case FollowMonth :
140 if (!updateTimer) 140 if (!updateTimer)
141 { 141 {
142 updateTimer = new QTimer(this); 142 updateTimer = new QTimer(this);
143 QObject::connect(updateTimer,SIGNAL(timeout()), 143 QObject::connect(updateTimer,SIGNAL(timeout()),
144 this,SLOT(possiblyPastMidnight())); 144 this,SLOT(possiblyPastMidnight()));
145 } 145 }
146 updateTimer->start(0,true); 146 updateTimer->start(0,true);
147 lastDayChecked = QDate::currentDate(); 147 lastDayChecked = QDate::currentDate();
148 } 148 }
149 updateRollover=r; 149 updateRollover=r;
150} 150}
151 151
152 152
153KDateNavigator::~KDateNavigator() 153KDateNavigator::~KDateNavigator()
154{ 154{
155} 155}
156 156
157 157
158void KDateNavigator::passedMidnight() 158void KDateNavigator::passedMidnight()
159{ 159{
160 QDate today = QDate::currentDate(); 160 QDate today = QDate::currentDate();
161 bool emitMonth = false; 161 bool emitMonth = false;
162 162
163 if (today.month() != lastDayChecked.month()) 163 if (today.month() != lastDayChecked.month())
164 { 164 {
165 if (updateRollover==FollowMonth && 165 if (updateRollover==FollowMonth &&
166 daymatrix->isEndOfMonth()) { 166 daymatrix->isEndOfMonth()) {
167 goNextMonth(); 167 goNextMonth();
168 emitMonth=true; 168 emitMonth=true;
169 } 169 }
170 } 170 }
171 daymatrix->recalculateToday(); 171 daymatrix->recalculateToday();
172 daymatrix->repaint(); 172 daymatrix->repaint();
173 emit dayPassed(today); 173 emit dayPassed(today);
174 if (emitMonth) { emit monthPassed(today); } 174 if (emitMonth) { emit monthPassed(today); }
175} 175}
176 176
177/* slot */ void KDateNavigator::possiblyPastMidnight() 177/* slot */ void KDateNavigator::possiblyPastMidnight()
178{ 178{
179 if (lastDayChecked!=QDate::currentDate()) 179 if (lastDayChecked!=QDate::currentDate())
180 { 180 {
181 passedMidnight(); 181 passedMidnight();
182 lastDayChecked=QDate::currentDate(); 182 lastDayChecked=QDate::currentDate();
183 } 183 }
184 // Set the timer to go off 1 second after midnight 184 // Set the timer to go off 1 second after midnight
185 // or after 8 minutes, whichever comes first. 185 // or after 8 minutes, whichever comes first.
186 if (updateTimer) 186 if (updateTimer)
187 { 187 {
188 QTime now = QTime::currentTime(); 188 QTime now = QTime::currentTime();
189 QTime midnight = QTime(23,59,59); 189 QTime midnight = QTime(23,59,59);
190 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); 190 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000);
191 191
192 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) 192 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait))
193 //.arg(now.toString()).arg(midnight.toString())); 193 //.arg(now.toString()).arg(midnight.toString()));
194 194
195 updateTimer->stop(); 195 updateTimer->stop();
196 updateTimer->start(msecsWait,true); 196 updateTimer->start(msecsWait,true);
197 } 197 }
198} 198}
199 199
200void KDateNavigator::updateDates() 200void KDateNavigator::updateDates()
201{ 201{
202 // Find the first day of the week of the current month. 202 // Find the first day of the week of the current month.
203 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); 203 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr );
204 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); 204 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() );
205 int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); 205 int d2 = KOGlobals::self()->calendarSystem()->day( dayone );
206 //int di = d1 - d2 + 1; 206 //int di = d1 - d2 + 1;
207 dayone = dayone.addDays( -d2 + 1 ); 207 dayone = dayone.addDays( -d2 + 1 );
208 208
209 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); 209 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone );
210 210
211 // If month begins on Monday and Monday is first day of week, 211 // If month begins on Monday and Monday is first day of week,
212 // month should begin on second line. Sunday doesn't have this problem. 212 // month should begin on second line. Sunday doesn't have this problem.
213 int nextLine = ( ( m_fstDayOfWkCalsys == 1) && 213 int nextLine = ( ( m_fstDayOfWkCalsys == 1) &&
214 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; 214 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0;
215 215
216 // update the matrix dates 216 // update the matrix dates
217 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; 217 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine;
218 218
219 219
220 daymatrix->updateView(dayone.addDays(index)); 220 daymatrix->updateView(dayone.addDays(index));
221//each updateDates is followed by an updateView -> repaint is issued there ! 221//each updateDates is followed by an updateView -> repaint is issued there !
222// daymatrix->repaint(); 222// daymatrix->repaint();
223} 223}
224 224
225void KDateNavigator::updateDayMatrix() 225void KDateNavigator::updateDayMatrix()
226{ 226{
227 daymatrix->updateView(); 227 daymatrix->updateView();
228 daymatrix->repaint(); 228 daymatrix->repaint();
229} 229}
230 230
231 231
232void KDateNavigator::updateView() 232void KDateNavigator::updateView()
233{ 233{
234 234
235 setUpdatesEnabled( false ); 235 setUpdatesEnabled( false );
236 236
237 int i; 237 int i;
238 238
239// kdDebug() << "updateView() -> daymatrix->updateView()" << endl; 239// kdDebug() << "updateView() -> daymatrix->updateView()" << endl;
240 daymatrix->updateView(); 240 daymatrix->updateView();
241 241
242 // set the week numbers. 242 // set the week numbers.
243 for(i = 0; i < 6; i++) { 243 for(i = 0; i < 6; i++) {
244 QString weeknum; 244 QString weeknum;
245 // remember, according to ISO 8601, the first week of the year is the 245 // remember, according to ISO 8601, the first week of the year is the
246 // first week that contains a thursday. Thus we must subtract off 4, 246 // first week that contains a thursday. Thus we must subtract off 4,
247 // not just 1. 247 // not just 1.
248 248
249 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); 249 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear();
250 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); 250 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4)));
251 251
252 int add = 0;
253 if ( ! KGlobal::locale()->weekStartsMonday() )
254 ++add;
252 if (dayOfYear % 7 != 0) 255 if (dayOfYear % 7 != 0)
253 weeknum.setNum(dayOfYear / 7 + 1); 256 weeknum.setNum(dayOfYear / 7 + 1+add);
254 else 257 else
255 weeknum.setNum(dayOfYear / 7); 258 weeknum.setNum(dayOfYear / 7 +add);
256 weeknos[i]->setText(weeknum); 259 weeknos[i]->setText(weeknum);
257 } 260 }
258 261
259 setUpdatesEnabled( true ); 262 setUpdatesEnabled( true );
260// kdDebug() << "updateView() -> repaint()" << endl; 263// kdDebug() << "updateView() -> repaint()" << endl;
261 repaint(); 264 repaint();
262 daymatrix->repaint(); 265 daymatrix->repaint();
263} 266}
264 267
265void KDateNavigator::updateConfig() 268void KDateNavigator::updateConfig()
266{ 269{
267 int day; 270 int day;
268 for(int i=0; i<7; i++) { 271 for(int i=0; i<7; i++) {
269 // take the first letter of the day name to be the abbreviation 272 // take the first letter of the day name to be the abbreviation
270 if (KGlobal::locale()->weekStartsMonday()) { 273 if (KGlobal::locale()->weekStartsMonday()) {
271 day = i+1; 274 day = i+1;
272 } else { 275 } else {
273 if (i==0) day = 7; 276 if (i==0) day = 7;
274 else day = i; 277 else day = i;
275 } 278 }
276 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 279 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
277 true ); 280 true );
278 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 281 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
279 headings[i]->setText( dayName ); 282 headings[i]->setText( dayName );
280 } 283 }
281 updateDates(); 284 updateDates();
282 updateView(); 285 updateView();
283} 286}
284 287
285void KDateNavigator::setShowWeekNums(bool enabled) 288void KDateNavigator::setShowWeekNums(bool enabled)
286{ 289{
287 m_bShowWeekNums = enabled; 290 m_bShowWeekNums = enabled;
288 for(int i=0; i<6; i++) { 291 for(int i=0; i<6; i++) {
289 if(enabled) 292 if(enabled)
290 weeknos[i]->show(); 293 weeknos[i]->show();
291 else 294 else
292 weeknos[i]->hide(); 295 weeknos[i]->hide();
293 } 296 }
294 resize(size()); 297 resize(size());
295} 298}
296 299
297void KDateNavigator::selectDates(const DateList& dateList) 300void KDateNavigator::selectDates(const DateList& dateList)
298{ 301{
299 302
300 if (dateList.count() > 0) { 303 if (dateList.count() > 0) {
301 mNavigatorBar->selectDates( dateList ); 304 mNavigatorBar->selectDates( dateList );
302 mSelectedDates = dateList; 305 mSelectedDates = dateList;
303 306
304 // set our record of the month and year that this datetbl is 307 // set our record of the month and year that this datetbl is
305 // displaying. 308 // displaying.
306 m_MthYr = mSelectedDates.first(); 309 m_MthYr = mSelectedDates.first();
307 310
308 311
309 // set our record of the first day of the week of the current 312 // set our record of the first day of the week of the current
310 // month. This needs to be done before calling dayToIndex, since it 313 // month. This needs to be done before calling dayToIndex, since it
311 // relies on this information being up to date. 314 // relies on this information being up to date.
312 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 315 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
313 m_fstDayOfWk = dayone.dayOfWeek(); 316 m_fstDayOfWk = dayone.dayOfWeek();
314 317
315 updateDates(); 318 updateDates();
316 319
317 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 320 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
318 321
319 updateView(); 322 updateView();
320 } 323 }
321} 324}
322 325
323int KDateNavigator::dayNum(int row, int col) 326int KDateNavigator::dayNum(int row, int col)
324{ 327{
325 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; 328 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk;
326} 329}
327 330
328int KDateNavigator::dayToIndex(int dayNum) 331int KDateNavigator::dayToIndex(int dayNum)
329{ 332{
330 int row, col; 333 int row, col;
331 334
332 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; 335 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7;
333 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) 336 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1))
334 row++; 337 row++;
335 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; 338 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7;
336 return row * 7 + col; 339 return row * 7 + col;
337} 340}
338 341
339void KDateNavigator::wheelEvent (QWheelEvent *e) 342void KDateNavigator::wheelEvent (QWheelEvent *e)
340{ 343{
341 if(e->delta()>0) emit goPrevious(); 344 if(e->delta()>0) emit goPrevious();
342 else emit goNext(); 345 else emit goNext();
343 346
344 e->accept(); 347 e->accept();
345} 348}
346 349
347bool KDateNavigator::eventFilter (QObject *o,QEvent *e) 350bool KDateNavigator::eventFilter (QObject *o,QEvent *e)
348{ 351{
349 if (e->type() == QEvent::MouseButtonPress) { 352 if (e->type() == QEvent::MouseButtonPress) {
350 int i; 353 int i;
351 for(i=0;i<6;++i) { 354 for(i=0;i<6;++i) {
352 if (o == weeknos[i]) { 355 if (o == weeknos[i]) {
353 QDate weekstart = daymatrix->getDate(i*7); 356 QDate weekstart = daymatrix->getDate(i*7);
354 emit weekClicked(weekstart); 357 emit weekClicked(weekstart);
355 break; 358 break;
356 } 359 }
357 } 360 }
358 return true; 361 return true;
359 } else { 362 } else {
360 return false; 363 return false;
361 } 364 }
362} 365}
363 366
364//#include "kdatenavigator.moc" 367//#include "kdatenavigator.moc"
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 584d1ed..4209e10 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -31,1109 +31,1109 @@
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qlistbox.h> 32#include <qlistbox.h>
33#include <qspinbox.h> 33#include <qspinbox.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qapplication.h> 35#include <qapplication.h>
36 36
37#include <kdialog.h> 37#include <kdialog.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <knumvalidator.h> 42#include <knumvalidator.h>
43 43
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45 45
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49 49
50#include "koeditorrecurrence.h" 50#include "koeditorrecurrence.h"
51 51
52/////////////////////////// RecurBase /////////////////////////////// 52/////////////////////////// RecurBase ///////////////////////////////
53 53
54RecurBase::RecurBase( QWidget *parent, const char *name ) : 54RecurBase::RecurBase( QWidget *parent, const char *name ) :
55 QWidget( parent, name ) 55 QWidget( parent, name )
56{ 56{
57 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); 57 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this );
58 mFrequencyEdit->setValue( 1 ); 58 mFrequencyEdit->setValue( 1 );
59} 59}
60 60
61QWidget *RecurBase::frequencyEdit() 61QWidget *RecurBase::frequencyEdit()
62{ 62{
63 return mFrequencyEdit; 63 return mFrequencyEdit;
64} 64}
65 65
66void RecurBase::setFrequency( int f ) 66void RecurBase::setFrequency( int f )
67{ 67{
68 if ( f < 1 ) f = 1; 68 if ( f < 1 ) f = 1;
69 69
70 mFrequencyEdit->setValue( f ); 70 mFrequencyEdit->setValue( f );
71} 71}
72 72
73int RecurBase::frequency() 73int RecurBase::frequency()
74{ 74{
75 return mFrequencyEdit->value(); 75 return mFrequencyEdit->value();
76} 76}
77 77
78/////////////////////////// RecurDaily /////////////////////////////// 78/////////////////////////// RecurDaily ///////////////////////////////
79 79
80RecurDaily::RecurDaily( QWidget *parent, const char *name ) : 80RecurDaily::RecurDaily( QWidget *parent, const char *name ) :
81 RecurBase( parent, name ) 81 RecurBase( parent, name )
82{ 82{
83 QBoxLayout *topLayout = new QHBoxLayout( this ); 83 QBoxLayout *topLayout = new QHBoxLayout( this );
84 topLayout->setSpacing( KDialog::spacingHint() ); 84 topLayout->setSpacing( KDialog::spacingHint() );
85 85
86 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 86 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
87 topLayout->addWidget( preLabel ); 87 topLayout->addWidget( preLabel );
88 88
89 topLayout->addWidget( frequencyEdit() ); 89 topLayout->addWidget( frequencyEdit() );
90 90
91 QLabel *postLabel = new QLabel( i18n("day(s)"), this ); 91 QLabel *postLabel = new QLabel( i18n("day(s)"), this );
92 topLayout->addWidget( postLabel ); 92 topLayout->addWidget( postLabel );
93} 93}
94 94
95 95
96/////////////////////////// RecurWeekly /////////////////////////////// 96/////////////////////////// RecurWeekly ///////////////////////////////
97 97
98RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : 98RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) :
99 RecurBase( parent, name ) 99 RecurBase( parent, name )
100{ 100{
101 QBoxLayout *topLayout = new QVBoxLayout( this ); 101 QBoxLayout *topLayout = new QVBoxLayout( this );
102 topLayout->setSpacing( KDialog::spacingHint() ); 102 topLayout->setSpacing( KDialog::spacingHint() );
103 103
104 topLayout->addStretch( 1 ); 104 topLayout->addStretch( 1 );
105 105
106 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); 106 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout );
107 107
108 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 108 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
109 weeksLayout->addWidget( preLabel ); 109 weeksLayout->addWidget( preLabel );
110 110
111 weeksLayout->addWidget( frequencyEdit() ); 111 weeksLayout->addWidget( frequencyEdit() );
112 112
113 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); 113 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this );
114 weeksLayout->addWidget( postLabel ); 114 weeksLayout->addWidget( postLabel );
115 115
116 QHBox *dayBox = new QHBox( this ); 116 QHBox *dayBox = new QHBox( this );
117 topLayout->addWidget( dayBox, 1, AlignVCenter ); 117 topLayout->addWidget( dayBox, 1, AlignVCenter );
118 // TODO: Respect start of week setting 118 // TODO: Respect start of week setting
119 for ( int i = 0; i < 7; ++i ) { 119 for ( int i = 0; i < 7; ++i ) {
120 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); 120 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true );
121 if ( KOPrefs::instance()->mCompactDialogs ) { 121 if ( KOPrefs::instance()->mCompactDialogs ) {
122 weekDayName = weekDayName.left( 1 ); 122 weekDayName = weekDayName.left( 1 );
123 } 123 }
124 mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); 124 mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox );
125 } 125 }
126 126
127 topLayout->addStretch( 1 ); 127 topLayout->addStretch( 1 );
128} 128}
129 129
130void RecurWeekly::setDays( const QBitArray &days ) 130void RecurWeekly::setDays( const QBitArray &days )
131{ 131{
132 for ( int i = 0; i < 7; ++i ) { 132 for ( int i = 0; i < 7; ++i ) {
133 mDayBoxes[ i ]->setChecked( days.testBit( i ) ); 133 mDayBoxes[ i ]->setChecked( days.testBit( i ) );
134 } 134 }
135} 135}
136 136
137QBitArray RecurWeekly::days() 137QBitArray RecurWeekly::days()
138{ 138{
139 QBitArray days( 7 ); 139 QBitArray days( 7 );
140 140
141 for ( int i = 0; i < 7; ++i ) { 141 for ( int i = 0; i < 7; ++i ) {
142 days.setBit( i, mDayBoxes[ i ]->isChecked() ); 142 days.setBit( i, mDayBoxes[ i ]->isChecked() );
143 } 143 }
144 144
145 return days; 145 return days;
146} 146}
147 147
148/////////////////////////// RecurMonthly /////////////////////////////// 148/////////////////////////// RecurMonthly ///////////////////////////////
149 149
150RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : 150RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
151 RecurBase( parent, name ) 151 RecurBase( parent, name )
152{ 152{
153 QBoxLayout *topLayout = new QVBoxLayout( this ); 153 QBoxLayout *topLayout = new QVBoxLayout( this );
154 topLayout->setSpacing( KDialog::spacingHint() ); 154 topLayout->setSpacing( KDialog::spacingHint() );
155 155
156 156
157 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 157 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
158 158
159 QLabel *preLabel = new QLabel( i18n("every"), this ); 159 QLabel *preLabel = new QLabel( i18n("every"), this );
160 freqLayout->addWidget( preLabel ); 160 freqLayout->addWidget( preLabel );
161 161
162 freqLayout->addWidget( frequencyEdit() ); 162 freqLayout->addWidget( frequencyEdit() );
163 163
164 QLabel *postLabel = new QLabel( i18n("month(s)"), this ); 164 QLabel *postLabel = new QLabel( i18n("month(s)"), this );
165 freqLayout->addWidget( postLabel ); 165 freqLayout->addWidget( postLabel );
166 166
167 167
168 QButtonGroup *buttonGroup = new QButtonGroup( this ); 168 QButtonGroup *buttonGroup = new QButtonGroup( this );
169 buttonGroup->setFrameStyle( QFrame::NoFrame ); 169 buttonGroup->setFrameStyle( QFrame::NoFrame );
170 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 170 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
171 171
172 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); 172 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 );
173 buttonLayout->setSpacing( KDialog::spacingHint() ); 173 buttonLayout->setSpacing( KDialog::spacingHint() );
174 174
175 175
176 QString recurOnText; 176 QString recurOnText;
177 if ( !KOPrefs::instance()->mCompactDialogs ) { 177 if ( !KOPrefs::instance()->mCompactDialogs ) {
178 recurOnText = i18n("Recur on the"); 178 recurOnText = i18n("Recur on the");
179 } 179 }
180 180
181 mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); 181 mByDayRadio = new QRadioButton( recurOnText, buttonGroup );
182 buttonLayout->addWidget( mByDayRadio, 0, 0 ); 182 buttonLayout->addWidget( mByDayRadio, 0, 0 );
183 183
184 mByDayCombo = new QComboBox( buttonGroup ); 184 mByDayCombo = new QComboBox( buttonGroup );
185 mByDayCombo->setSizeLimit( 7 ); 185 mByDayCombo->setSizeLimit( 7 );
186 mByDayCombo->insertItem( i18n("1st") ); 186 mByDayCombo->insertItem( i18n("1st") );
187 mByDayCombo->insertItem( i18n("2nd") ); 187 mByDayCombo->insertItem( i18n("2nd") );
188 mByDayCombo->insertItem( i18n("3rd") ); 188 mByDayCombo->insertItem( i18n("3rd") );
189 mByDayCombo->insertItem( i18n("4th") ); 189 mByDayCombo->insertItem( i18n("4th") );
190 mByDayCombo->insertItem( i18n("5th") ); 190 mByDayCombo->insertItem( i18n("5th") );
191 mByDayCombo->insertItem( i18n("6th") ); 191 mByDayCombo->insertItem( i18n("6th") );
192 mByDayCombo->insertItem( i18n("7th") ); 192 mByDayCombo->insertItem( i18n("7th") );
193 mByDayCombo->insertItem( i18n("8th") ); 193 mByDayCombo->insertItem( i18n("8th") );
194 mByDayCombo->insertItem( i18n("9th") ); 194 mByDayCombo->insertItem( i18n("9th") );
195 mByDayCombo->insertItem( i18n("10th") ); 195 mByDayCombo->insertItem( i18n("10th") );
196 mByDayCombo->insertItem( i18n("11th") ); 196 mByDayCombo->insertItem( i18n("11th") );
197 mByDayCombo->insertItem( i18n("12th") ); 197 mByDayCombo->insertItem( i18n("12th") );
198 mByDayCombo->insertItem( i18n("13th") ); 198 mByDayCombo->insertItem( i18n("13th") );
199 mByDayCombo->insertItem( i18n("14th") ); 199 mByDayCombo->insertItem( i18n("14th") );
200 mByDayCombo->insertItem( i18n("15th") ); 200 mByDayCombo->insertItem( i18n("15th") );
201 mByDayCombo->insertItem( i18n("16th") ); 201 mByDayCombo->insertItem( i18n("16th") );
202 mByDayCombo->insertItem( i18n("17th") ); 202 mByDayCombo->insertItem( i18n("17th") );
203 mByDayCombo->insertItem( i18n("18th") ); 203 mByDayCombo->insertItem( i18n("18th") );
204 mByDayCombo->insertItem( i18n("19th") ); 204 mByDayCombo->insertItem( i18n("19th") );
205 mByDayCombo->insertItem( i18n("20th") ); 205 mByDayCombo->insertItem( i18n("20th") );
206 mByDayCombo->insertItem( i18n("21st") ); 206 mByDayCombo->insertItem( i18n("21st") );
207 mByDayCombo->insertItem( i18n("22nd") ); 207 mByDayCombo->insertItem( i18n("22nd") );
208 mByDayCombo->insertItem( i18n("23rd") ); 208 mByDayCombo->insertItem( i18n("23rd") );
209 mByDayCombo->insertItem( i18n("24th") ); 209 mByDayCombo->insertItem( i18n("24th") );
210 mByDayCombo->insertItem( i18n("25th") ); 210 mByDayCombo->insertItem( i18n("25th") );
211 mByDayCombo->insertItem( i18n("26th") ); 211 mByDayCombo->insertItem( i18n("26th") );
212 mByDayCombo->insertItem( i18n("27th") ); 212 mByDayCombo->insertItem( i18n("27th") );
213 mByDayCombo->insertItem( i18n("28th") ); 213 mByDayCombo->insertItem( i18n("28th") );
214 mByDayCombo->insertItem( i18n("29th") ); 214 mByDayCombo->insertItem( i18n("29th") );
215 mByDayCombo->insertItem( i18n("30th") ); 215 mByDayCombo->insertItem( i18n("30th") );
216 mByDayCombo->insertItem( i18n("31st") ); 216 mByDayCombo->insertItem( i18n("31st") );
217 buttonLayout->addWidget( mByDayCombo, 0, 1 ); 217 buttonLayout->addWidget( mByDayCombo, 0, 1 );
218 218
219 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); 219 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup );
220 buttonLayout->addWidget( byDayLabel, 0, 2 ); 220 buttonLayout->addWidget( byDayLabel, 0, 2 );
221 221
222 222
223 mByPosRadio = new QRadioButton( recurOnText, buttonGroup); 223 mByPosRadio = new QRadioButton( recurOnText, buttonGroup);
224 buttonLayout->addWidget( mByPosRadio, 1, 0 ); 224 buttonLayout->addWidget( mByPosRadio, 1, 0 );
225 225
226 mByPosCountCombo = new QComboBox( buttonGroup ); 226 mByPosCountCombo = new QComboBox( buttonGroup );
227 mByPosCountCombo->insertItem( i18n("1st") ); 227 mByPosCountCombo->insertItem( i18n("1st") );
228 mByPosCountCombo->insertItem( i18n("2nd") ); 228 mByPosCountCombo->insertItem( i18n("2nd") );
229 mByPosCountCombo->insertItem( i18n("3rd") ); 229 mByPosCountCombo->insertItem( i18n("3rd") );
230 mByPosCountCombo->insertItem( i18n("4th") ); 230 mByPosCountCombo->insertItem( i18n("4th") );
231 mByPosCountCombo->insertItem( i18n("5th") ); 231 mByPosCountCombo->insertItem( i18n("5th") );
232 buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); 232 buttonLayout->addWidget( mByPosCountCombo, 1, 1 );
233 233
234 mByPosWeekdayCombo = new QComboBox( buttonGroup ); 234 mByPosWeekdayCombo = new QComboBox( buttonGroup );
235 mByPosWeekdayCombo->insertItem( i18n("Monday") ); 235 mByPosWeekdayCombo->insertItem( i18n("Monday") );
236 mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); 236 mByPosWeekdayCombo->insertItem( i18n("Tuesday") );
237 mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); 237 mByPosWeekdayCombo->insertItem( i18n("Wednesday") );
238 mByPosWeekdayCombo->insertItem( i18n("Thursday") ); 238 mByPosWeekdayCombo->insertItem( i18n("Thursday") );
239 mByPosWeekdayCombo->insertItem( i18n("Friday") ); 239 mByPosWeekdayCombo->insertItem( i18n("Friday") );
240 mByPosWeekdayCombo->insertItem( i18n("Saturday") ); 240 mByPosWeekdayCombo->insertItem( i18n("Saturday") );
241 mByPosWeekdayCombo->insertItem( i18n("Sunday") ); 241 mByPosWeekdayCombo->insertItem( i18n("Sunday") );
242 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); 242 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 );
243} 243}
244 244
245void RecurMonthly::setByDay( int day ) 245void RecurMonthly::setByDay( int day )
246{ 246{
247 mByDayRadio->setChecked( true ); 247 mByDayRadio->setChecked( true );
248 mByDayCombo->setCurrentItem( day ); 248 mByDayCombo->setCurrentItem( day );
249} 249}
250 250
251void RecurMonthly::setByPos( int count, int weekday ) 251void RecurMonthly::setByPos( int count, int weekday )
252{ 252{
253 mByPosRadio->setChecked( true ); 253 mByPosRadio->setChecked( true );
254 mByPosCountCombo->setCurrentItem( count ); 254 mByPosCountCombo->setCurrentItem( count );
255 mByPosWeekdayCombo->setCurrentItem( weekday ); 255 mByPosWeekdayCombo->setCurrentItem( weekday );
256} 256}
257 257
258bool RecurMonthly::byDay() 258bool RecurMonthly::byDay()
259{ 259{
260 return mByDayRadio->isChecked(); 260 return mByDayRadio->isChecked();
261} 261}
262 262
263bool RecurMonthly::byPos() 263bool RecurMonthly::byPos()
264{ 264{
265 return mByPosRadio->isChecked(); 265 return mByPosRadio->isChecked();
266} 266}
267 267
268int RecurMonthly::day() 268int RecurMonthly::day()
269{ 269{
270 return mByDayCombo->currentItem() + 1; 270 return mByDayCombo->currentItem() + 1;
271} 271}
272 272
273int RecurMonthly::count() 273int RecurMonthly::count()
274{ 274{
275 return mByPosCountCombo->currentItem() + 1; 275 return mByPosCountCombo->currentItem() + 1;
276} 276}
277 277
278int RecurMonthly::weekday() 278int RecurMonthly::weekday()
279{ 279{
280 return mByPosWeekdayCombo->currentItem(); 280 return mByPosWeekdayCombo->currentItem();
281} 281}
282 282
283/////////////////////////// RecurYearly /////////////////////////////// 283/////////////////////////// RecurYearly ///////////////////////////////
284 284
285RecurYearly::RecurYearly( QWidget *parent, const char *name ) : 285RecurYearly::RecurYearly( QWidget *parent, const char *name ) :
286 RecurBase( parent, name ) 286 RecurBase( parent, name )
287{ 287{
288 QBoxLayout *topLayout = new QVBoxLayout( this ); 288 QBoxLayout *topLayout = new QVBoxLayout( this );
289 topLayout->setSpacing( KDialog::spacingHint() ); 289 topLayout->setSpacing( KDialog::spacingHint() );
290 290
291 291
292 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 292 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
293 293
294 QLabel *preLabel = new QLabel( i18n("every"), this ); 294 QLabel *preLabel = new QLabel( i18n("every"), this );
295 freqLayout->addWidget( preLabel ); 295 freqLayout->addWidget( preLabel );
296 296
297 freqLayout->addWidget( frequencyEdit() ); 297 freqLayout->addWidget( frequencyEdit() );
298 298
299 QLabel *postLabel = new QLabel( i18n("year(s)"), this ); 299 QLabel *postLabel = new QLabel( i18n("year(s)"), this );
300 freqLayout->addWidget( postLabel ); 300 freqLayout->addWidget( postLabel );
301 301
302 302
303 QButtonGroup *buttonGroup = new QButtonGroup( this ); 303 QButtonGroup *buttonGroup = new QButtonGroup( this );
304 buttonGroup->setFrameStyle( QFrame::NoFrame ); 304 buttonGroup->setFrameStyle( QFrame::NoFrame );
305 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 305 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
306 306
307 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); 307 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 );
308 308
309 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); 309 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup);
310 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); 310 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight);
311 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); 311 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup );
312 312
313 buttonLayout->addWidget( mByDayLabel, 0, 1 ); 313 buttonLayout->addWidget( mByDayLabel, 0, 1 );
314 mByMonthCombo = new QComboBox( buttonGroup ); 314 mByMonthCombo = new QComboBox( buttonGroup );
315 mByMonthCombo->insertItem( i18n("January") ); 315 mByMonthCombo->insertItem( i18n("January") );
316 mByMonthCombo->insertItem( i18n("February") ); 316 mByMonthCombo->insertItem( i18n("February") );
317 mByMonthCombo->insertItem( i18n("March") ); 317 mByMonthCombo->insertItem( i18n("March") );
318 mByMonthCombo->insertItem( i18n("April") ); 318 mByMonthCombo->insertItem( i18n("April") );
319 mByMonthCombo->insertItem( i18n("May") ); 319 mByMonthCombo->insertItem( i18n("May") );
320 mByMonthCombo->insertItem( i18n("June") ); 320 mByMonthCombo->insertItem( i18n("June") );
321 mByMonthCombo->insertItem( i18n("July") ); 321 mByMonthCombo->insertItem( i18n("July") );
322 mByMonthCombo->insertItem( i18n("August") ); 322 mByMonthCombo->insertItem( i18n("August") );
323 mByMonthCombo->insertItem( i18n("September") ); 323 mByMonthCombo->insertItem( i18n("September") );
324 mByMonthCombo->insertItem( i18n("October") ); 324 mByMonthCombo->insertItem( i18n("October") );
325 mByMonthCombo->insertItem( i18n("November") ); 325 mByMonthCombo->insertItem( i18n("November") );
326 mByMonthCombo->insertItem( i18n("December") ); 326 mByMonthCombo->insertItem( i18n("December") );
327 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft ); 327 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft );
328 if ( QApplication::desktop()->width() <= 640 ) { 328 if ( QApplication::desktop()->width() <= 640 ) {
329 mByMonthCombo->setSizeLimit( 6 ); 329 mByMonthCombo->setSizeLimit( 6 );
330 } 330 }
331 331
332 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup); 332 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup);
333 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight); 333 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight);
334 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup ); 334 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup );
335 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 ); 335 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 );
336 336
337} 337}
338 338
339void RecurYearly::setByDay( int doy ) 339void RecurYearly::setByDay( int doy )
340{ 340{
341 mByDayRadio->setChecked( true ); 341 mByDayRadio->setChecked( true );
342 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) ); 342 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) );
343} 343}
344 344
345void RecurYearly::setByMonth( int month, int day ) 345void RecurYearly::setByMonth( int month, int day )
346{ 346{
347 mByMonthRadio->setChecked( true ); 347 mByMonthRadio->setChecked( true );
348 mByMonthCombo->setCurrentItem( month - 1 ); 348 mByMonthCombo->setCurrentItem( month - 1 );
349 mByDayLabel->setText(i18n("%1 of ").arg( day ) ); 349 mByDayLabel->setText(i18n("%1 of ").arg( day ) );
350 mDay = day; 350 mDay = day;
351} 351}
352 352
353bool RecurYearly::byMonth() 353bool RecurYearly::byMonth()
354{ 354{
355 return mByMonthRadio->isChecked(); 355 return mByMonthRadio->isChecked();
356} 356}
357 357
358bool RecurYearly::byDay() 358bool RecurYearly::byDay()
359{ 359{
360 return mByDayRadio->isChecked(); 360 return mByDayRadio->isChecked();
361} 361}
362 362
363int RecurYearly::month() 363int RecurYearly::month()
364{ 364{
365 return mByMonthCombo->currentItem() + 1; 365 return mByMonthCombo->currentItem() + 1;
366} 366}
367int RecurYearly::day() 367int RecurYearly::day()
368{ 368{
369 return mDay;//mByDayCombo->currentItem() + 1; 369 return mDay;//mByDayCombo->currentItem() + 1;
370} 370}
371 371
372//////////////////////////// ExceptionsWidget ////////////////////////// 372//////////////////////////// ExceptionsWidget //////////////////////////
373 373
374ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : 374ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) :
375 QWidget( parent, name ) 375 QWidget( parent, name )
376{ 376{
377 QBoxLayout *topLayout = new QVBoxLayout( this ); 377 QBoxLayout *topLayout = new QVBoxLayout( this );
378 378
379 QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), 379 QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"),
380 this ); 380 this );
381 topLayout->addWidget( groupBox ); 381 topLayout->addWidget( groupBox );
382 382
383 QWidget *box = new QWidget( groupBox ); 383 QWidget *box = new QWidget( groupBox );
384 384
385 QGridLayout *boxLayout = new QGridLayout( box ); 385 QGridLayout *boxLayout = new QGridLayout( box );
386 386
387 mExceptionDateEdit = new KDateEdit( box ); 387 mExceptionDateEdit = new KDateEdit( box );
388 boxLayout->addWidget( mExceptionDateEdit, 0, 0 ); 388 boxLayout->addWidget( mExceptionDateEdit, 0, 0 );
389 389
390 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box ); 390 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box );
391 boxLayout->addWidget( addExceptionButton, 1, 0 ); 391 boxLayout->addWidget( addExceptionButton, 1, 0 );
392 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box ); 392 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box );
393 boxLayout->addWidget( changeExceptionButton, 2, 0 ); 393 boxLayout->addWidget( changeExceptionButton, 2, 0 );
394 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box ); 394 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box );
395 boxLayout->addWidget( deleteExceptionButton, 3, 0 ); 395 boxLayout->addWidget( deleteExceptionButton, 3, 0 );
396 396
397 mExceptionList = new QListBox( box ); 397 mExceptionList = new QListBox( box );
398 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 ); 398 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 );
399 399
400 boxLayout->setRowStretch( 4, 1 ); 400 boxLayout->setRowStretch( 4, 1 );
401 boxLayout->setColStretch( 1, 3 ); 401 boxLayout->setColStretch( 1, 3 );
402 402
403 connect( addExceptionButton, SIGNAL( clicked() ), 403 connect( addExceptionButton, SIGNAL( clicked() ),
404 SLOT( addException() ) ); 404 SLOT( addException() ) );
405 connect( changeExceptionButton, SIGNAL( clicked() ), 405 connect( changeExceptionButton, SIGNAL( clicked() ),
406 SLOT( changeException() ) ); 406 SLOT( changeException() ) );
407 connect( deleteExceptionButton, SIGNAL( clicked() ), 407 connect( deleteExceptionButton, SIGNAL( clicked() ),
408 SLOT( deleteException() ) ); 408 SLOT( deleteException() ) );
409 if ( QApplication::desktop()->width() < 480 ) { 409 if ( QApplication::desktop()->width() < 480 ) {
410 setMinimumWidth( 220 ); 410 setMinimumWidth( 220 );
411 } else { 411 } else {
412 setMinimumWidth( 440 ); 412 setMinimumWidth( 440 );
413 mExceptionDateEdit->setMinimumWidth( 200 ); 413 mExceptionDateEdit->setMinimumWidth( 200 );
414 } 414 }
415} 415}
416 416
417void ExceptionsWidget::setDefaults( const QDateTime &from ) 417void ExceptionsWidget::setDefaults( const QDateTime &from )
418{ 418{
419 mExceptionDateEdit->setDate( from.date() ); 419 mExceptionDateEdit->setDate( from.date() );
420} 420}
421 421
422void ExceptionsWidget::addException() 422void ExceptionsWidget::addException()
423{ 423{
424 QDate date = mExceptionDateEdit->date(); 424 QDate date = mExceptionDateEdit->date();
425 QString dateStr = KGlobal::locale()->formatDate( date ); 425 QString dateStr = KGlobal::locale()->formatDate( date );
426 if( !mExceptionList->findItem( dateStr ) ) { 426 if( !mExceptionList->findItem( dateStr ) ) {
427 mExceptionDates.append( date ); 427 mExceptionDates.append( date );
428 mExceptionList->insertItem( dateStr ); 428 mExceptionList->insertItem( dateStr );
429 } 429 }
430} 430}
431 431
432void ExceptionsWidget::changeException() 432void ExceptionsWidget::changeException()
433{ 433{
434 int pos = mExceptionList->currentItem(); 434 int pos = mExceptionList->currentItem();
435 if ( pos < 0 ) return; 435 if ( pos < 0 ) return;
436 436
437 QDate date = mExceptionDateEdit->date(); 437 QDate date = mExceptionDateEdit->date();
438 mExceptionDates[ pos ] = date; 438 mExceptionDates[ pos ] = date;
439 mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos ); 439 mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos );
440} 440}
441 441
442void ExceptionsWidget::deleteException() 442void ExceptionsWidget::deleteException()
443{ 443{
444 int pos = mExceptionList->currentItem(); 444 int pos = mExceptionList->currentItem();
445 if ( pos < 0 ) return; 445 if ( pos < 0 ) return;
446 446
447 mExceptionDates.remove( mExceptionDates.at( pos ) ); 447 mExceptionDates.remove( mExceptionDates.at( pos ) );
448 mExceptionList->removeItem( pos ); 448 mExceptionList->removeItem( pos );
449} 449}
450 450
451void ExceptionsWidget::setDates( const DateList &dates ) 451void ExceptionsWidget::setDates( const DateList &dates )
452{ 452{
453 mExceptionList->clear(); 453 mExceptionList->clear();
454 mExceptionDates.clear(); 454 mExceptionDates.clear();
455 DateList::ConstIterator dit; 455 DateList::ConstIterator dit;
456 for ( dit = dates.begin(); dit != dates.end(); ++dit ) { 456 for ( dit = dates.begin(); dit != dates.end(); ++dit ) {
457 mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) ); 457 mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) );
458 mExceptionDates.append( *dit ); 458 mExceptionDates.append( *dit );
459 } 459 }
460} 460}
461 461
462DateList ExceptionsWidget::dates() 462DateList ExceptionsWidget::dates()
463{ 463{
464 return mExceptionDates; 464 return mExceptionDates;
465} 465}
466 466
467///////////////////////// ExceptionsDialog /////////////////////////// 467///////////////////////// ExceptionsDialog ///////////////////////////
468 468
469ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) : 469ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) :
470 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel ) 470 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel )
471{ 471{
472 mExceptions = new ExceptionsWidget( this ); 472 mExceptions = new ExceptionsWidget( this );
473 setMainWidget( mExceptions ); 473 setMainWidget( mExceptions );
474 resize(220,10); 474 resize(220,10);
475} 475}
476 476
477void ExceptionsDialog::setDefaults( const QDateTime &from ) 477void ExceptionsDialog::setDefaults( const QDateTime &from )
478{ 478{
479 mExceptions->setDefaults( from ); 479 mExceptions->setDefaults( from );
480} 480}
481 481
482void ExceptionsDialog::setDates( const DateList &dates ) 482void ExceptionsDialog::setDates( const DateList &dates )
483{ 483{
484 mExceptions->setDates( dates ); 484 mExceptions->setDates( dates );
485} 485}
486 486
487DateList ExceptionsDialog::dates() 487DateList ExceptionsDialog::dates()
488{ 488{
489 return mExceptions->dates(); 489 return mExceptions->dates();
490} 490}
491 491
492///////////////////////// RecurrenceRangeWidget /////////////////////////// 492///////////////////////// RecurrenceRangeWidget ///////////////////////////
493 493
494RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, 494RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
495 const char *name ) 495 const char *name )
496 : QWidget( parent, name ) 496 : QWidget( parent, name )
497{ 497{
498 QBoxLayout *topLayout = new QVBoxLayout( this ); 498 QBoxLayout *topLayout = new QVBoxLayout( this );
499 499
500 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), 500 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"),
501 this ); 501 this );
502 topLayout->addWidget( mRangeGroupBox ); 502 topLayout->addWidget( mRangeGroupBox );
503 503
504 QWidget *rangeBox = new QWidget( mRangeGroupBox ); 504 QWidget *rangeBox = new QWidget( mRangeGroupBox );
505 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); 505 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox );
506 rangeLayout->setSpacing( KDialog::spacingHint() ); 506 rangeLayout->setSpacing( KDialog::spacingHint() );
507 507
508 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); 508 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
509 rangeLayout->addWidget( mStartDateLabel ); 509 rangeLayout->addWidget( mStartDateLabel );
510 510
511 QButtonGroup *rangeButtonGroup = new QButtonGroup; 511 QButtonGroup *rangeButtonGroup = new QButtonGroup;
512 512
513 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); 513 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
514 rangeButtonGroup->insert( mNoEndDateButton ); 514 rangeButtonGroup->insert( mNoEndDateButton );
515 rangeLayout->addWidget( mNoEndDateButton ); 515 rangeLayout->addWidget( mNoEndDateButton );
516 516
517 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); 517 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout );
518 durationLayout->setSpacing( KDialog::spacingHint() ); 518 durationLayout->setSpacing( KDialog::spacingHint() );
519 519
520 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); 520 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
521 rangeButtonGroup->insert( mEndDurationButton ); 521 rangeButtonGroup->insert( mEndDurationButton );
522 durationLayout->addWidget( mEndDurationButton ); 522 durationLayout->addWidget( mEndDurationButton );
523 523
524 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); 524 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
525 durationLayout->addWidget( mEndDurationEdit ); 525 durationLayout->addWidget( mEndDurationEdit );
526 526
527 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); 527 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
528 durationLayout ->addWidget( endDurationLabel ); 528 durationLayout ->addWidget( endDurationLabel );
529 529
530 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); 530 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout );
531 endDateLayout->setSpacing( KDialog::spacingHint() ); 531 endDateLayout->setSpacing( KDialog::spacingHint() );
532 532
533 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); 533 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
534 rangeButtonGroup->insert( mEndDateButton ); 534 rangeButtonGroup->insert( mEndDateButton );
535 endDateLayout->addWidget( mEndDateButton ); 535 endDateLayout->addWidget( mEndDateButton );
536 536
537 mEndDateEdit = new KDateEdit( rangeBox ); 537 mEndDateEdit = new KDateEdit( rangeBox );
538 endDateLayout->addWidget( mEndDateEdit ); 538 endDateLayout->addWidget( mEndDateEdit );
539 539
540 endDateLayout->addStretch( 1 ); 540 endDateLayout->addStretch( 1 );
541 541
542 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), 542 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
543 SLOT( showCurrentRange() ) ); 543 SLOT( showCurrentRange() ) );
544 connect( mEndDurationButton, SIGNAL( toggled( bool ) ), 544 connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
545 SLOT( showCurrentRange() ) ); 545 SLOT( showCurrentRange() ) );
546 connect( mEndDateButton, SIGNAL( toggled( bool ) ), 546 connect( mEndDateButton, SIGNAL( toggled( bool ) ),
547 SLOT( showCurrentRange() ) ); 547 SLOT( showCurrentRange() ) );
548} 548}
549 549
550void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) 550void RecurrenceRangeWidget::setDefaults( const QDateTime &from )
551{ 551{
552 mNoEndDateButton->setChecked( true ); 552 mNoEndDateButton->setChecked( true );
553 553
554 setDateTimes( from ); 554 setDateTimes( from );
555 mEndDateEdit->setDate( from.date() ); 555 mEndDateEdit->setDate( from.date() );
556} 556}
557 557
558void RecurrenceRangeWidget::setDuration( int duration ) 558void RecurrenceRangeWidget::setDuration( int duration )
559{ 559{
560 if ( duration == -1 ) { 560 if ( duration == -1 ) {
561 mNoEndDateButton->setChecked( true ); 561 mNoEndDateButton->setChecked( true );
562 } else if ( duration == 0 ) { 562 } else if ( duration == 0 ) {
563 mEndDateButton->setChecked( true ); 563 mEndDateButton->setChecked( true );
564 } else { 564 } else {
565 mEndDurationButton->setChecked( true ); 565 mEndDurationButton->setChecked( true );
566 mEndDurationEdit->setValue( duration ); 566 mEndDurationEdit->setValue( duration );
567 } 567 }
568} 568}
569 569
570int RecurrenceRangeWidget::duration() 570int RecurrenceRangeWidget::duration()
571{ 571{
572 if ( mNoEndDateButton->isChecked() ) { 572 if ( mNoEndDateButton->isChecked() ) {
573 return -1; 573 return -1;
574 } else if ( mEndDurationButton->isChecked() ) { 574 } else if ( mEndDurationButton->isChecked() ) {
575 return mEndDurationEdit->value(); 575 return mEndDurationEdit->value();
576 } else { 576 } else {
577 return 0; 577 return 0;
578 } 578 }
579} 579}
580 580
581void RecurrenceRangeWidget::setEndDate( const QDate &date ) 581void RecurrenceRangeWidget::setEndDate( const QDate &date )
582{ 582{
583 mEndDateEdit->setDate( date ); 583 mEndDateEdit->setDate( date );
584} 584}
585 585
586QDate RecurrenceRangeWidget::endDate() 586QDate RecurrenceRangeWidget::endDate()
587{ 587{
588 return mEndDateEdit->date(); 588 return mEndDateEdit->date();
589} 589}
590 590
591void RecurrenceRangeWidget::showCurrentRange() 591void RecurrenceRangeWidget::showCurrentRange()
592{ 592{
593 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); 593 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() );
594 mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); 594 mEndDateEdit->setEnabled( mEndDateButton->isChecked() );
595} 595}
596 596
597void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, 597void RecurrenceRangeWidget::setDateTimes( const QDateTime &start,
598 const QDateTime & ) 598 const QDateTime & )
599{ 599{
600 mStartDateLabel->setText( i18n("Start date: %1") 600 mStartDateLabel->setText( i18n("Start date: %1")
601 .arg( KGlobal::locale()->formatDate( start.date() ) ) ); 601 .arg( KGlobal::locale()->formatDate( start.date() ) ) );
602 602
603 if(!mEndDateButton->isChecked()) 603 if(!mEndDateButton->isChecked())
604 mEndDateEdit->setDate( start.date() ); 604 mEndDateEdit->setDate( start.date() );
605} 605}
606 606
607///////////////////////// RecurrenceRangeDialog /////////////////////////// 607///////////////////////// RecurrenceRangeDialog ///////////////////////////
608 608
609RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent, 609RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent,
610 const char *name ) : 610 const char *name ) :
611 KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel ) 611 KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel )
612{ 612{
613 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); 613 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this );
614 setMainWidget( mRecurrenceRangeWidget ); 614 setMainWidget( mRecurrenceRangeWidget );
615} 615}
616 616
617void RecurrenceRangeDialog::setDefaults( const QDateTime &from ) 617void RecurrenceRangeDialog::setDefaults( const QDateTime &from )
618{ 618{
619 mRecurrenceRangeWidget->setDefaults( from ); 619 mRecurrenceRangeWidget->setDefaults( from );
620} 620}
621 621
622void RecurrenceRangeDialog::setDuration( int duration ) 622void RecurrenceRangeDialog::setDuration( int duration )
623{ 623{
624 mRecurrenceRangeWidget->setDuration( duration ); 624 mRecurrenceRangeWidget->setDuration( duration );
625} 625}
626 626
627int RecurrenceRangeDialog::duration() 627int RecurrenceRangeDialog::duration()
628{ 628{
629 return mRecurrenceRangeWidget->duration(); 629 return mRecurrenceRangeWidget->duration();
630} 630}
631 631
632void RecurrenceRangeDialog::setEndDate( const QDate &date ) 632void RecurrenceRangeDialog::setEndDate( const QDate &date )
633{ 633{
634 mRecurrenceRangeWidget->setEndDate( date ); 634 mRecurrenceRangeWidget->setEndDate( date );
635} 635}
636 636
637QDate RecurrenceRangeDialog::endDate() 637QDate RecurrenceRangeDialog::endDate()
638{ 638{
639 return mRecurrenceRangeWidget->endDate(); 639 return mRecurrenceRangeWidget->endDate();
640} 640}
641 641
642void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, 642void RecurrenceRangeDialog::setDateTimes( const QDateTime &start,
643 const QDateTime &end ) 643 const QDateTime &end )
644{ 644{
645 mRecurrenceRangeWidget->setDateTimes( start, end ); 645 mRecurrenceRangeWidget->setDateTimes( start, end );
646} 646}
647 647
648//////////////////////////// RecurrenceChooser //////////////////////// 648//////////////////////////// RecurrenceChooser ////////////////////////
649 649
650RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : 650RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) :
651 QWidget( parent, name ) 651 QWidget( parent, name )
652{ 652{
653 QBoxLayout *topLayout = new QVBoxLayout( this ); 653 QBoxLayout *topLayout = new QVBoxLayout( this );
654 654
655 if ( KOPrefs::instance()->mCompactDialogs ) { 655 if ( KOPrefs::instance()->mCompactDialogs ) {
656 mTypeCombo = new QComboBox( this ); 656 mTypeCombo = new QComboBox( this );
657 mTypeCombo->insertItem( i18n("Daily") ); 657 mTypeCombo->insertItem( i18n("Daily") );
658 mTypeCombo->insertItem( i18n("Weekly") ); 658 mTypeCombo->insertItem( i18n("Weekly") );
659 mTypeCombo->insertItem( i18n("Monthly") ); 659 mTypeCombo->insertItem( i18n("Monthly") );
660 mTypeCombo->insertItem( i18n("Yearly") ); 660 mTypeCombo->insertItem( i18n("Yearly") );
661 661
662 topLayout->addWidget( mTypeCombo ); 662 topLayout->addWidget( mTypeCombo );
663 663
664 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); 664 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) );
665 } else { 665 } else {
666 mTypeCombo = 0; 666 mTypeCombo = 0;
667 667
668 QButtonGroup *ruleButtonGroup = new QButtonGroup( 1, Horizontal, this ); 668 QButtonGroup *ruleButtonGroup = new QButtonGroup( 1, Horizontal, this );
669 ruleButtonGroup->setFrameStyle( QFrame::NoFrame ); 669 ruleButtonGroup->setFrameStyle( QFrame::NoFrame );
670 topLayout->addWidget( ruleButtonGroup ); 670 topLayout->addWidget( ruleButtonGroup );
671 671
672 mDailyButton = new QRadioButton( i18n("Daily"), ruleButtonGroup ); 672 mDailyButton = new QRadioButton( i18n("Daily"), ruleButtonGroup );
673 mWeeklyButton = new QRadioButton( i18n("Weekly"), ruleButtonGroup ); 673 mWeeklyButton = new QRadioButton( i18n("Weekly"), ruleButtonGroup );
674 mMonthlyButton = new QRadioButton( i18n("Monthly"), ruleButtonGroup ); 674 mMonthlyButton = new QRadioButton( i18n("Monthly"), ruleButtonGroup );
675 mYearlyButton = new QRadioButton( i18n("Yearly"), ruleButtonGroup ); 675 mYearlyButton = new QRadioButton( i18n("Yearly"), ruleButtonGroup );
676 676
677 connect( mDailyButton, SIGNAL( toggled( bool ) ), 677 connect( mDailyButton, SIGNAL( toggled( bool ) ),
678 SLOT( emitChoice() ) ); 678 SLOT( emitChoice() ) );
679 connect( mWeeklyButton, SIGNAL( toggled( bool ) ), 679 connect( mWeeklyButton, SIGNAL( toggled( bool ) ),
680 SLOT( emitChoice() ) ); 680 SLOT( emitChoice() ) );
681 connect( mMonthlyButton, SIGNAL( toggled( bool ) ), 681 connect( mMonthlyButton, SIGNAL( toggled( bool ) ),
682 SLOT( emitChoice() ) ); 682 SLOT( emitChoice() ) );
683 connect( mYearlyButton, SIGNAL( toggled( bool ) ), 683 connect( mYearlyButton, SIGNAL( toggled( bool ) ),
684 SLOT( emitChoice() ) ); 684 SLOT( emitChoice() ) );
685 } 685 }
686} 686}
687 687
688int RecurrenceChooser::type() 688int RecurrenceChooser::type()
689{ 689{
690 if ( mTypeCombo ) { 690 if ( mTypeCombo ) {
691 return mTypeCombo->currentItem(); 691 return mTypeCombo->currentItem();
692 } else { 692 } else {
693 if ( mDailyButton->isChecked() ) return Daily; 693 if ( mDailyButton->isChecked() ) return Daily;
694 else if ( mWeeklyButton->isChecked() ) return Weekly; 694 else if ( mWeeklyButton->isChecked() ) return Weekly;
695 else if ( mMonthlyButton->isChecked() ) return Monthly; 695 else if ( mMonthlyButton->isChecked() ) return Monthly;
696 else return Yearly; 696 else return Yearly;
697 } 697 }
698} 698}
699 699
700void RecurrenceChooser::setType( int type ) 700void RecurrenceChooser::setType( int type )
701{ 701{
702 if ( mTypeCombo ) { 702 if ( mTypeCombo ) {
703 mTypeCombo->setCurrentItem( type ); 703 mTypeCombo->setCurrentItem( type );
704 } else { 704 } else {
705 switch ( type ) { 705 switch ( type ) {
706 case Daily: 706 case Daily:
707 mDailyButton->setChecked( true ); 707 mDailyButton->setChecked( true );
708 break; 708 break;
709 case Weekly: 709 case Weekly:
710 mWeeklyButton->setChecked( true ); 710 mWeeklyButton->setChecked( true );
711 break; 711 break;
712 case Monthly: 712 case Monthly:
713 mMonthlyButton->setChecked( true ); 713 mMonthlyButton->setChecked( true );
714 break; 714 break;
715 case Yearly: 715 case Yearly:
716 default: 716 default:
717 mYearlyButton->setChecked( true ); 717 mYearlyButton->setChecked( true );
718 break; 718 break;
719 } 719 }
720 } 720 }
721} 721}
722 722
723void RecurrenceChooser::emitChoice() 723void RecurrenceChooser::emitChoice()
724{ 724{
725 emit chosen ( type() ); 725 emit chosen ( type() );
726} 726}
727 727
728/////////////////////////////// Main Widget ///////////////////////////// 728/////////////////////////////// Main Widget /////////////////////////////
729 729
730KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : 730KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
731 QWidget( parent, name ) 731 QWidget( parent, name )
732{ 732{
733 QGridLayout *topLayout = new QGridLayout( this, 2,2 ); 733 QGridLayout *topLayout = new QGridLayout( this, 2,2 );
734 topLayout->setSpacing( KDialog::spacingHint() ); 734 topLayout->setSpacing( KDialog::spacingHint() );
735 735
736 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); 736 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this );
737 connect( mEnabledCheck, SIGNAL( toggled( bool ) ), 737 connect( mEnabledCheck, SIGNAL( toggled( bool ) ),
738 SLOT( setEnabled( bool ) ) ); 738 SLOT( setEnabled( bool ) ) );
739 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); 739 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 );
740 740
741 741
742 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "), 742 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "),
743 this ); 743 this );
744 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); 744 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 );
745 745
746 if ( KOPrefs::instance()->mCompactDialogs ) { 746 if ( KOPrefs::instance()->mCompactDialogs ) {
747 mTimeGroupBox->hide(); 747 mTimeGroupBox->hide();
748 } 748 }
749 749
750// QFrame *timeFrame = new QFrame( mTimeGroupBox ); 750// QFrame *timeFrame = new QFrame( mTimeGroupBox );
751// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); 751// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame );
752// layoutTimeFrame->setSpacing( KDialog::spacingHint() ); 752// layoutTimeFrame->setSpacing( KDialog::spacingHint() );
753 753
754 mDateTimeLabel = new QLabel( mTimeGroupBox ); 754 mDateTimeLabel = new QLabel( mTimeGroupBox );
755// mDateTimeLabel = new QLabel( timeFrame ); 755// mDateTimeLabel = new QLabel( timeFrame );
756// layoutTimeFrame->addWidget( mDateTimeLabel ); 756// layoutTimeFrame->addWidget( mDateTimeLabel );
757 757
758 Qt::Orientation orientation; 758 Qt::Orientation orientation;
759 if ( KOPrefs::instance()->mCompactDialogs ) orientation = Horizontal; 759 if ( KOPrefs::instance()->mCompactDialogs ) orientation = Horizontal;
760 else orientation = Vertical; 760 else orientation = Vertical;
761 761
762 mRuleBox = new QGroupBox( 1, orientation, i18n("Recurrence Rule"), this ); 762 mRuleBox = new QGroupBox( 1, orientation, i18n("Recurrence Rule"), this );
763 if ( KOPrefs::instance()->mCompactDialogs ) { 763 if ( KOPrefs::instance()->mCompactDialogs ) {
764 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); 764 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
765 } else { 765 } else {
766 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); 766 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
767 } 767 }
768 768
769 mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); 769 mRecurrenceChooser = new RecurrenceChooser( mRuleBox );
770 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), 770 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ),
771 SLOT( showCurrentRule( int ) ) ); 771 SLOT( showCurrentRule( int ) ) );
772 772
773 if ( !KOPrefs::instance()->mCompactDialogs ) { 773 if ( !KOPrefs::instance()->mCompactDialogs ) {
774 QFrame *ruleSepFrame = new QFrame( mRuleBox ); 774 QFrame *ruleSepFrame = new QFrame( mRuleBox );
775 ruleSepFrame->setFrameStyle( QFrame::VLine | QFrame::Sunken ); 775 ruleSepFrame->setFrameStyle( QFrame::VLine | QFrame::Sunken );
776 } 776 }
777 777
778 mRuleStack = new QWidgetStack( mRuleBox ); 778 mRuleStack = new QWidgetStack( mRuleBox );
779 779
780 mDaily = new RecurDaily( mRuleStack ); 780 mDaily = new RecurDaily( mRuleStack );
781 mRuleStack->addWidget( mDaily, 0 ); 781 mRuleStack->addWidget( mDaily, 0 );
782 782
783 mWeekly = new RecurWeekly( mRuleStack ); 783 mWeekly = new RecurWeekly( mRuleStack );
784 mRuleStack->addWidget( mWeekly, 0 ); 784 mRuleStack->addWidget( mWeekly, 0 );
785 785
786 mMonthly = new RecurMonthly( mRuleStack ); 786 mMonthly = new RecurMonthly( mRuleStack );
787 mRuleStack->addWidget( mMonthly, 0 ); 787 mRuleStack->addWidget( mMonthly, 0 );
788 788
789 mYearly = new RecurYearly( mRuleStack ); 789 mYearly = new RecurYearly( mRuleStack );
790 mRuleStack->addWidget( mYearly, 0 ); 790 mRuleStack->addWidget( mYearly, 0 );
791 791
792 showCurrentRule( mRecurrenceChooser->type() ); 792 showCurrentRule( mRecurrenceChooser->type() );
793 793
794 if ( KOPrefs::instance()->mCompactDialogs ) { 794 if ( KOPrefs::instance()->mCompactDialogs ) {
795 mRecurrenceRangeWidget = 0; 795 mRecurrenceRangeWidget = 0;
796 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); 796 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this );
797 mRecurrenceRange = mRecurrenceRangeDialog; 797 mRecurrenceRange = mRecurrenceRangeDialog;
798 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), 798 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."),
799 this ); 799 this );
800 800
801 connect( mRecurrenceRangeButton, SIGNAL( clicked() ), 801 connect( mRecurrenceRangeButton, SIGNAL( clicked() ),
802 SLOT( showRecurrenceRangeDialog() ) ); 802 SLOT( showRecurrenceRangeDialog() ) );
803 803
804 mExceptionsWidget = 0; 804 mExceptionsWidget = 0;
805 mExceptionsDialog = new ExceptionsDialog( this ); 805 mExceptionsDialog = new ExceptionsDialog( this );
806 mExceptions = mExceptionsDialog; 806 mExceptions = mExceptionsDialog;
807 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); 807 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this );
808 if ( QApplication::desktop()->width() < 320 ) { 808 if ( QApplication::desktop()->width() < 320 ) {
809 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); 809 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 );
810 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); 810 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 );
811 } else { 811 } else {
812 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); 812 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 );
813 topLayout->addWidget( mExceptionsButton, 3, 1 ); 813 topLayout->addWidget( mExceptionsButton, 3, 1 );
814 } 814 }
815 connect( mExceptionsButton, SIGNAL( clicked() ), 815 connect( mExceptionsButton, SIGNAL( clicked() ),
816 SLOT( showExceptionsDialog() ) ); 816 SLOT( showExceptionsDialog() ) );
817 817
818 } else { 818 } else {
819 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); 819 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this );
820 mRecurrenceRangeDialog = 0; 820 mRecurrenceRangeDialog = 0;
821 mRecurrenceRange = mRecurrenceRangeWidget; 821 mRecurrenceRange = mRecurrenceRangeWidget;
822 mRecurrenceRangeButton = 0; 822 mRecurrenceRangeButton = 0;
823 topLayout->addWidget( mRecurrenceRangeWidget, 3, 0 ); 823 topLayout->addWidget( mRecurrenceRangeWidget, 3, 0 );
824 824
825 mExceptionsWidget = new ExceptionsWidget( this ); 825 mExceptionsWidget = new ExceptionsWidget( this );
826 mExceptionsDialog = 0; 826 mExceptionsDialog = 0;
827 mExceptions = mExceptionsWidget; 827 mExceptions = mExceptionsWidget;
828 mExceptionsButton = 0; 828 mExceptionsButton = 0;
829 topLayout->addWidget( mExceptionsWidget, 3, 1 ); 829 topLayout->addWidget( mExceptionsWidget, 3, 1 );
830 } 830 }
831} 831}
832 832
833KOEditorRecurrence::~KOEditorRecurrence() 833KOEditorRecurrence::~KOEditorRecurrence()
834{ 834{
835} 835}
836 836
837void KOEditorRecurrence::setEnabled( bool enabled ) 837void KOEditorRecurrence::setEnabled( bool enabled )
838{ 838{
839// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; 839// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl;
840 840
841 mTimeGroupBox->setEnabled( enabled ); 841 mTimeGroupBox->setEnabled( enabled );
842 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); 842 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled );
843 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); 843 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled );
844 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); 844 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled );
845 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); 845 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled );
846 mRuleBox->setEnabled( enabled ); 846 mRuleBox->setEnabled( enabled );
847} 847}
848 848
849void KOEditorRecurrence::showCurrentRule( int current ) 849void KOEditorRecurrence::showCurrentRule( int current )
850{ 850{
851 switch ( current ) { 851 switch ( current ) {
852 case Daily: 852 case Daily:
853 mRuleStack->raiseWidget( mDaily ); 853 mRuleStack->raiseWidget( mDaily );
854 break; 854 break;
855 case Weekly: 855 case Weekly:
856 mRuleStack->raiseWidget( mWeekly ); 856 mRuleStack->raiseWidget( mWeekly );
857 break; 857 break;
858 case Monthly: 858 case Monthly:
859 mRuleStack->raiseWidget( mMonthly ); 859 mRuleStack->raiseWidget( mMonthly );
860 break; 860 break;
861 default: 861 default:
862 case Yearly: 862 case Yearly:
863 mRuleStack->raiseWidget( mYearly ); 863 mRuleStack->raiseWidget( mYearly );
864 break; 864 break;
865 } 865 }
866} 866}
867 867
868void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) 868void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end )
869{ 869{
870// kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; 870// kdDebug() << "KOEditorRecurrence::setDateTimes" << endl;
871 871
872 mRecurrenceRange->setDateTimes( start, end ); 872 mRecurrenceRange->setDateTimes( start, end );
873 mExceptions->setDefaults( end ); 873 mExceptions->setDefaults( end );
874 874
875} 875}
876 876
877void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) 877void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
878{ 878{
879 879
880 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); 880 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() );
881 setDateTimes( from, to ); 881 setDateTimes( from, to );
882 882
883 bool enabled = false; 883 bool enabled = false;
884 mEnabledCheck->setChecked( enabled ); 884 mEnabledCheck->setChecked( enabled );
885 setEnabled( enabled ); 885 setEnabled( enabled );
886 886
887 mExceptions->setDefaults( to ); 887 mExceptions->setDefaults( to );
888 mRecurrenceRange->setDefaults( to ); 888 mRecurrenceRange->setDefaults( to );
889 889
890 mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); 890 mRecurrenceChooser->setType( RecurrenceChooser::Weekly );
891 showCurrentRule( mRecurrenceChooser->type() ); 891 showCurrentRule( mRecurrenceChooser->type() );
892 892
893 mDaily->setFrequency( 1 ); 893 mDaily->setFrequency( 1 );
894 894
895 mWeekly->setFrequency( 1 ); 895 mWeekly->setFrequency( 1 );
896 QBitArray days( 7 ); 896 QBitArray days( 7 );
897 days.fill( 0 ); 897 days.fill( 0 );
898 days.setBit( from.date().dayOfWeek()- 1); 898 days.setBit( from.date().dayOfWeek()- 1);
899 mWeekly->setDays( days ); 899 mWeekly->setDays( days );
900 mMonthly->setFrequency( 1 ); 900 mMonthly->setFrequency( 1 );
901 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); 901 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
902 mMonthly->setByDay( from.date().day()-1 ); 902 mMonthly->setByDay( from.date().day()-1 );
903 mYearly->setFrequency( 1 ); 903 mYearly->setFrequency( 1 );
904 mYearly->setByDay( from.date().dayOfYear() ); 904 mYearly->setByDay( from.date().dayOfYear() );
905 mYearly->setByMonth( from.date().month(), from.date().day() ); 905 mYearly->setByMonth( from.date().month(), from.date().day() );
906} 906}
907 907
908void KOEditorRecurrence::readEvent(Event *event) 908void KOEditorRecurrence::readEvent(Event *event)
909{ 909{
910 setDefaults( event->dtStart(), event->dtEnd(), true ); 910 setDefaults( event->dtStart(), event->dtEnd(), true );
911 QBitArray rDays( 7 ); 911 QBitArray rDays( 7 );
912 QPtrList<Recurrence::rMonthPos> rmp; 912 QPtrList<Recurrence::rMonthPos> rmp;
913 QPtrList<int> rmd; 913 QPtrList<int> rmd;
914 int day = 0; 914 int day = 0;
915 int count = 0; 915 int count = 0;
916 int month = 0; 916 int month = 0;
917 setDateTimes( event->dtStart(), event->dtEnd() ); 917 setDateTimes( event->dtStart(), event->dtEnd() );
918 918
919 Recurrence *r = event->recurrence(); 919 Recurrence *r = event->recurrence();
920 int f = r->frequency(); 920 int f = r->frequency();
921 921
922 int recurs = r->doesRecur(); 922 int recurs = r->doesRecur();
923 923
924 mEnabledCheck->setChecked( recurs ); 924 mEnabledCheck->setChecked( recurs );
925 setEnabled( recurs ); 925 setEnabled( recurs );
926 926
927 int recurrenceType = RecurrenceChooser::Weekly; 927 int recurrenceType = RecurrenceChooser::Weekly;
928 928
929 switch ( recurs ) { 929 switch ( recurs ) {
930 case Recurrence::rNone: 930 case Recurrence::rNone:
931 setDefaults( event->dtStart(), event->dtEnd(), true ); 931 setDefaults( event->dtStart(), event->dtEnd(), true );
932 break; 932 break;
933 case Recurrence::rDaily: 933 case Recurrence::rDaily:
934 recurrenceType = RecurrenceChooser::Daily; 934 recurrenceType = RecurrenceChooser::Daily;
935 mDaily->setFrequency( f ); 935 mDaily->setFrequency( f );
936 break; 936 break;
937 case Recurrence::rWeekly: 937 case Recurrence::rWeekly:
938 recurrenceType = RecurrenceChooser::Weekly; 938 recurrenceType = RecurrenceChooser::Weekly;
939 mWeekly->setFrequency( f ); 939 mWeekly->setFrequency( f );
940 mWeekly->setDays( r->days() ); 940 mWeekly->setDays( r->days() );
941 break; 941 break;
942 case Recurrence::rMonthlyPos: 942 case Recurrence::rMonthlyPos:
943 // we only handle one possibility in the list right now, 943 // we only handle one possibility in the list right now,
944 // so I have hardcoded calls with first(). If we make the GUI 944 // so I have hardcoded calls with first(). If we make the GUI
945 // more extended, this can be changed. 945 // more extended, this can be changed.
946 recurrenceType = RecurrenceChooser::Monthly; 946 recurrenceType = RecurrenceChooser::Monthly;
947 947
948 rmp = r->monthPositions(); 948 rmp = r->monthPositions();
949 if ( rmp.first()->negative ) 949 if ( rmp.first()->negative )
950 count = 5 - rmp.first()->rPos - 1; 950 count = 5 - rmp.first()->rPos - 1;
951 else 951 else
952 count = rmp.first()->rPos - 1; 952 count = rmp.first()->rPos - 1;
953 day = 0; 953 day = 0;
954 while ( !rmp.first()->rDays.testBit( day ) ) ++day; 954 while ( !rmp.first()->rDays.testBit( day ) ) ++day;
955 mMonthly->setByPos( count, day ); 955 mMonthly->setByPos( count, day );
956 956
957 mMonthly->setFrequency( f ); 957 mMonthly->setFrequency( f );
958 958
959 break; 959 break;
960 case Recurrence::rMonthlyDay: 960 case Recurrence::rMonthlyDay:
961 recurrenceType = RecurrenceChooser::Monthly; 961 recurrenceType = RecurrenceChooser::Monthly;
962 962
963 rmd = r->monthDays(); 963 rmd = r->monthDays();
964 day = *rmd.first() - 1; 964 day = *rmd.first() - 1;
965 mMonthly->setByDay( day ); 965 mMonthly->setByDay( day );
966 966
967 mMonthly->setFrequency( f ); 967 mMonthly->setFrequency( f );
968 968
969 break; 969 break;
970 case Recurrence::rYearlyMonth: 970 case Recurrence::rYearlyMonth:
971 { 971 {
972 recurrenceType = RecurrenceChooser::Yearly; 972 recurrenceType = RecurrenceChooser::Yearly;
973 qDebug("Recurrence::rYearlyMonth: "); 973 qDebug("Recurrence::rYearlyMonth: ");
974 day = event->dtStart().date().day(); 974 day = event->dtStart().date().day();
975 rmd = r->yearNums(); 975 rmd = r->yearNums();
976 if ( rmd.count() > 0 ) 976 if ( rmd.count() > 0 )
977 month = *rmd.first(); 977 month = *rmd.first();
978 else 978 else
979 month = event->dtStart().date().month() ; 979 month = event->dtStart().date().month() ;
980 mYearly->setByMonth( month, day ); 980 mYearly->setByMonth( month, day );
981#if 0 981#if 0
982 qDebug("2day = %d ",day ); 982 qDebug("2day = %d ",day );
983 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); 983 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
984 int month; 984 int month;
985 if ( !monthlist.isEmpty() ) { 985 if ( !monthlist.isEmpty() ) {
986 month = monthlist.first()->rPos ; 986 month = monthlist.first()->rPos ;
987 } else { 987 } else {
988 month = event->dtStart().date().month() ; 988 month = event->dtStart().date().month() ;
989 } 989 }
990 mYearly->setByMonth( day, month ); 990 mYearly->setByMonth( day, month );
991#endif 991#endif
992 mYearly->setFrequency( f ); 992 mYearly->setFrequency( f );
993 } 993 }
994 994
995 break; 995 break;
996 case Recurrence::rYearlyDay: 996 case Recurrence::rYearlyDay:
997 qDebug("Recurrence::rYearlyDay: "); 997 qDebug("Recurrence::rYearlyDay: ");
998 recurrenceType = RecurrenceChooser::Yearly; 998 recurrenceType = RecurrenceChooser::Yearly;
999 mYearly->setByDay( event->dtStart().date().dayOfYear() ); 999 mYearly->setByDay( event->dtStart().date().dayOfYear() );
1000 mYearly->setFrequency( f ); 1000 mYearly->setFrequency( f );
1001 break; 1001 break;
1002 default: 1002 default:
1003 setDefaults( event->dtStart(), event->dtEnd(), true ); 1003 setDefaults( event->dtStart(), event->dtEnd(), true );
1004 break; 1004 break;
1005 } 1005 }
1006 1006
1007 mRecurrenceChooser->setType( recurrenceType ); 1007 mRecurrenceChooser->setType( recurrenceType );
1008 showCurrentRule( recurrenceType ); 1008 showCurrentRule( recurrenceType );
1009 1009
1010 mRecurrenceRange->setDateTimes( event->dtStart() ); 1010 mRecurrenceRange->setDateTimes( event->dtStart() );
1011 1011
1012 if ( r->doesRecur() ) { 1012 if ( r->doesRecur() ) {
1013 mRecurrenceRange->setDuration( r->duration() ); 1013 mRecurrenceRange->setDuration( r->duration() );
1014 if ( r->duration() == 0 ) 1014 if ( r->duration() == 0 )
1015 { 1015 {
1016 if ( r->endDate() < event->dtStart().date() ) 1016 if ( r->endDate() < event->dtStart().date() )
1017 mRecurrenceRange->setEndDate( event->dtStart().date() ); 1017 mRecurrenceRange->setEndDate( event->dtStart().date() );
1018 else 1018 else
1019 mRecurrenceRange->setEndDate( r->endDate() ); 1019 mRecurrenceRange->setEndDate( r->endDate() );
1020 } else 1020 } else
1021 mRecurrenceRange->setEndDate( event->dtStart().date() ); 1021 mRecurrenceRange->setEndDate( event->dtStart().date() );
1022 } 1022 }
1023 1023
1024 mExceptions->setDates( event->exDates() ); 1024 mExceptions->setDates( event->exDates() );
1025} 1025}
1026 1026
1027void KOEditorRecurrence::writeEvent( Event *event ) 1027void KOEditorRecurrence::writeEvent( Event *event )
1028{ 1028{
1029 Recurrence *r = event->recurrence(); 1029 Recurrence *r = event->recurrence();
1030 1030
1031 // clear out any old settings; 1031 // clear out any old settings;
1032 r->unsetRecurs(); 1032 r->unsetRecurs();
1033 1033
1034 if ( mEnabledCheck->isChecked() ) { 1034 if ( mEnabledCheck->isChecked() ) {
1035 int duration = mRecurrenceRange->duration(); 1035 int duration = mRecurrenceRange->duration();
1036 QDate endDate; 1036 QDate endDate;
1037 if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); 1037 if ( duration == 0 ) endDate = mRecurrenceRange->endDate();
1038 1038
1039 int recurrenceType = mRecurrenceChooser->type(); 1039 int recurrenceType = mRecurrenceChooser->type();
1040 1040
1041 if ( recurrenceType == RecurrenceChooser::Daily ) { 1041 if ( recurrenceType == RecurrenceChooser::Daily ) {
1042 int freq = mDaily->frequency(); 1042 int freq = mDaily->frequency();
1043 if ( duration != 0 ) r->setDaily( freq, duration ); 1043 if ( duration != 0 ) r->setDaily( freq, duration );
1044 else r->setDaily( freq, endDate ); 1044 else r->setDaily( freq, endDate );
1045 } else if ( recurrenceType == RecurrenceChooser::Weekly ) { 1045 } else if ( recurrenceType == RecurrenceChooser::Weekly ) {
1046 int freq = mWeekly->frequency(); 1046 int freq = mWeekly->frequency();
1047 QBitArray days = mWeekly->days(); 1047 QBitArray days = mWeekly->days();
1048 int j; 1048 int j;
1049 bool found = false; 1049 bool found = false;
1050 for (j = 0; j < 7 ; ++j ) { 1050 for (j = 0; j < 7 ; ++j ) {
1051 found |=days.at(j); 1051 found |=days.at(j);
1052 } 1052 }
1053 if ( !found ) { 1053 if ( !found ) {
1054 days.setBit( event->dtStart().date().dayOfWeek()-1); 1054 days.setBit( event->dtStart().date().dayOfWeek()-1);
1055 qDebug("bit set %d "); 1055 qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1);
1056 } 1056 }
1057 if ( duration != 0 ) r->setWeekly( freq, days, duration ); 1057 if ( duration != 0 ) r->setWeekly( freq, days, duration );
1058 else r->setWeekly( freq, days, endDate ); 1058 else r->setWeekly( freq, days, endDate );
1059 } else if ( recurrenceType == RecurrenceChooser::Monthly ) { 1059 } else if ( recurrenceType == RecurrenceChooser::Monthly ) {
1060 int freq = mMonthly->frequency(); 1060 int freq = mMonthly->frequency();
1061 if ( mMonthly->byPos() ) { 1061 if ( mMonthly->byPos() ) {
1062 int pos = mMonthly->count(); 1062 int pos = mMonthly->count();
1063 1063
1064 QBitArray days( 7 ); 1064 QBitArray days( 7 );
1065 days.fill( false ); 1065 days.fill( false );
1066 1066
1067 days.setBit( mMonthly->weekday() ); 1067 days.setBit( mMonthly->weekday() );
1068 if ( duration != 0 ) 1068 if ( duration != 0 )
1069 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 1069 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
1070 else 1070 else
1071 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 1071 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
1072 r->addMonthlyPos( pos, days ); 1072 r->addMonthlyPos( pos, days );
1073 } else { 1073 } else {
1074 // it's by day 1074 // it's by day
1075 int day = mMonthly->day(); 1075 int day = mMonthly->day();
1076 1076
1077 if ( duration != 0 ) { 1077 if ( duration != 0 ) {
1078 r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); 1078 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
1079 } else { 1079 } else {
1080 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 1080 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
1081 } 1081 }
1082 r->addMonthlyDay( day ); 1082 r->addMonthlyDay( day );
1083 } 1083 }
1084 } else if ( recurrenceType == RecurrenceChooser::Yearly ) { 1084 } else if ( recurrenceType == RecurrenceChooser::Yearly ) {
1085 qDebug("RecurrenceChooser::Yearly "); 1085 qDebug("RecurrenceChooser::Yearly ");
1086 int freq = mYearly->frequency(); 1086 int freq = mYearly->frequency();
1087 if ( mYearly->byDay() ) { 1087 if ( mYearly->byDay() ) {
1088 if ( duration != 0 ) { 1088 if ( duration != 0 ) {
1089 r->setYearly( Recurrence::rYearlyDay, freq, duration ); 1089 r->setYearly( Recurrence::rYearlyDay, freq, duration );
1090 } else { 1090 } else {
1091 r->setYearly( Recurrence::rYearlyDay, freq, endDate ); 1091 r->setYearly( Recurrence::rYearlyDay, freq, endDate );
1092 } 1092 }
1093 r->addYearlyNum( event->dtStart().date().dayOfYear() ); 1093 r->addYearlyNum( event->dtStart().date().dayOfYear() );
1094 } else { 1094 } else {
1095 if ( duration != 0 ) { 1095 if ( duration != 0 ) {
1096 r->setYearly( Recurrence::rYearlyMonth, freq, duration ); 1096 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
1097 } else { 1097 } else {
1098 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 1098 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
1099 } 1099 }
1100 r->addYearlyNum( mYearly->month() ); 1100 r->addYearlyNum( mYearly->month() );
1101 } 1101 }
1102 1102
1103 } 1103 }
1104 1104
1105 event->setExDates( mExceptions->dates() ); 1105 event->setExDates( mExceptions->dates() );
1106 } 1106 }
1107} 1107}
1108 1108
1109void KOEditorRecurrence::setDateTimeStr( const QString &str ) 1109void KOEditorRecurrence::setDateTimeStr( const QString &str )
1110{ 1110{
1111 mDateTimeLabel->setText( str ); 1111 mDateTimeLabel->setText( str );
1112} 1112}
1113 1113
1114bool KOEditorRecurrence::validateInput() 1114bool KOEditorRecurrence::validateInput()
1115{ 1115{
1116 // Check input here 1116 // Check input here
1117 1117
1118 return true; 1118 return true;
1119} 1119}
1120 1120
1121void KOEditorRecurrence::showExceptionsDialog() 1121void KOEditorRecurrence::showExceptionsDialog()
1122{ 1122{
1123 DateList dates = mExceptions->dates(); 1123 DateList dates = mExceptions->dates();
1124 int result = mExceptionsDialog->exec(); 1124 int result = mExceptionsDialog->exec();
1125 if ( result == QDialog::Rejected ) mExceptions->setDates( dates ); 1125 if ( result == QDialog::Rejected ) mExceptions->setDates( dates );
1126} 1126}
1127 1127
1128void KOEditorRecurrence::showRecurrenceRangeDialog() 1128void KOEditorRecurrence::showRecurrenceRangeDialog()
1129{ 1129{
1130 int duration = mRecurrenceRange->duration(); 1130 int duration = mRecurrenceRange->duration();
1131 QDate endDate = mRecurrenceRange->endDate(); 1131 QDate endDate = mRecurrenceRange->endDate();
1132 1132
1133 int result = mRecurrenceRangeDialog->exec(); 1133 int result = mRecurrenceRangeDialog->exec();
1134 if ( result == QDialog::Rejected ) { 1134 if ( result == QDialog::Rejected ) {
1135 mRecurrenceRange->setDuration( duration ); 1135 mRecurrenceRange->setDuration( duration );
1136 mRecurrenceRange->setEndDate( endDate ); 1136 mRecurrenceRange->setEndDate( endDate );
1137 } 1137 }
1138 1138
1139} 1139}
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 06a911c..c45d81f 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -1,351 +1,351 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#ifndef CALENDAR_H 22#ifndef CALENDAR_H
23#define CALENDAR_H 23#define CALENDAR_H
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qptrlist.h> 28#include <qptrlist.h>
29#include <qdict.h> 29#include <qdict.h>
30 30
31#include "customproperties.h" 31#include "customproperties.h"
32#include "event.h" 32#include "event.h"
33#include "todo.h" 33#include "todo.h"
34#include "journal.h" 34#include "journal.h"
35#include "calfilter.h"
35 36
36#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ 37//#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */
37 38
38class KConfig; 39class KConfig;
39 40
40namespace KCal { 41namespace KCal {
41 42
42class CalFilter;
43 43
44/** 44/**
45 This is the main "calendar" object class for KOrganizer. It holds 45 This is the main "calendar" object class for KOrganizer. It holds
46 information like all appointments/events, user information, etc. etc. 46 information like all appointments/events, user information, etc. etc.
47 one calendar is associated with each CalendarView (@see calendarview.h). 47 one calendar is associated with each CalendarView (@see calendarview.h).
48 This is an abstract base class defining the interface to a calendar. It is 48 This is an abstract base class defining the interface to a calendar. It is
49 implemented by subclasses like @see CalendarLocal, which use different 49 implemented by subclasses like @see CalendarLocal, which use different
50 methods to store and access the data. 50 methods to store and access the data.
51 51
52 Ownership of events etc. is handled by the following policy: As soon as an 52 Ownership of events etc. is handled by the following policy: As soon as an
53 event (or any other subclass of IncidenceBase) object is added to the 53 event (or any other subclass of IncidenceBase) object is added to the
54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes 54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes
55 care of deleting it. All Events returned by the query functions are returned 55 care of deleting it. All Events returned by the query functions are returned
56 as pointers, that means all changes to the returned events are immediately 56 as pointers, that means all changes to the returned events are immediately
57 visible in the Calendar. You shouldn't delete any Event object you get from 57 visible in the Calendar. You shouldn't delete any Event object you get from
58 Calendar. 58 Calendar.
59*/ 59*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 Calendar(); 65 Calendar();
66 Calendar(const QString &timeZoneId); 66 Calendar(const QString &timeZoneId);
67 virtual ~Calendar(); 67 virtual ~Calendar();
68 void deleteIncidence(Incidence *in); 68 void deleteIncidence(Incidence *in);
69 void resetTempSyncStat(); 69 void resetTempSyncStat();
70 /** 70 /**
71 Clears out the current calendar, freeing all used memory etc. 71 Clears out the current calendar, freeing all used memory etc.
72 */ 72 */
73 virtual void close() = 0; 73 virtual void close() = 0;
74 74
75 /** 75 /**
76 Sync changes in memory to persistant storage. 76 Sync changes in memory to persistant storage.
77 */ 77 */
78 virtual void save() = 0; 78 virtual void save() = 0;
79 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 79 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
80 virtual bool isSaving() { return false; } 80 virtual bool isSaving() { return false; }
81 81
82 /** 82 /**
83 Return the owner of the calendar's full name. 83 Return the owner of the calendar's full name.
84 */ 84 */
85 const QString &getOwner() const; 85 const QString &getOwner() const;
86 /** 86 /**
87 Set the owner of the calendar. Should be owner's full name. 87 Set the owner of the calendar. Should be owner's full name.
88 */ 88 */
89 void setOwner( const QString &os ); 89 void setOwner( const QString &os );
90 /** 90 /**
91 Return the email address of the calendar owner. 91 Return the email address of the calendar owner.
92 */ 92 */
93 const QString &getEmail(); 93 const QString &getEmail();
94 /** 94 /**
95 Set the email address of the calendar owner. 95 Set the email address of the calendar owner.
96 */ 96 */
97 void setEmail( const QString & ); 97 void setEmail( const QString & );
98 98
99 /** 99 /**
100 Set time zone from a timezone string (e.g. -2:00) 100 Set time zone from a timezone string (e.g. -2:00)
101 */ 101 */
102 void setTimeZone( const QString &tz ); 102 void setTimeZone( const QString &tz );
103 /** 103 /**
104 Set time zone from a minutes value (e.g. -60) 104 Set time zone from a minutes value (e.g. -60)
105 */ 105 */
106 void setTimeZone( int tz ); 106 void setTimeZone( int tz );
107 /** 107 /**
108 Return time zone as offest in minutes. 108 Return time zone as offest in minutes.
109 */ 109 */
110 int getTimeZone() const; 110 int getTimeZone() const;
111 /** 111 /**
112 Compute an ISO 8601 format string from the time zone. 112 Compute an ISO 8601 format string from the time zone.
113 */ 113 */
114 QString getTimeZoneStr() const; 114 QString getTimeZoneStr() const;
115 /** 115 /**
116 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal 116 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal
117 values). 117 values).
118 */ 118 */
119 void setTimeZoneId( const QString & ); 119 void setTimeZoneId( const QString & );
120 /** 120 /**
121 Return time zone id. 121 Return time zone id.
122 */ 122 */
123 QString timeZoneId() const; 123 QString timeZoneId() const;
124 /** 124 /**
125 Use local time, not UTC or a time zone. 125 Use local time, not UTC or a time zone.
126 */ 126 */
127 void setLocalTime(); 127 void setLocalTime();
128 /** 128 /**
129 Return whether local time is being used. 129 Return whether local time is being used.
130 */ 130 */
131 bool isLocalTime() const; 131 bool isLocalTime() const;
132 132
133 /** 133 /**
134 Add an incidence to calendar. 134 Add an incidence to calendar.
135 135
136 @return true on success, false on error. 136 @return true on success, false on error.
137 */ 137 */
138 virtual bool addIncidence( Incidence * ); 138 virtual bool addIncidence( Incidence * );
139 /** 139 /**
140 Return filtered list of all incidences of this calendar. 140 Return filtered list of all incidences of this calendar.
141 */ 141 */
142 virtual QPtrList<Incidence> incidences(); 142 virtual QPtrList<Incidence> incidences();
143 143
144 /** 144 /**
145 Return unfiltered list of all incidences of this calendar. 145 Return unfiltered list of all incidences of this calendar.
146 */ 146 */
147 virtual QPtrList<Incidence> rawIncidences(); 147 virtual QPtrList<Incidence> rawIncidences();
148 148
149 /** 149 /**
150 Adds a Event to this calendar object. 150 Adds a Event to this calendar object.
151 @param anEvent a pointer to the event to add 151 @param anEvent a pointer to the event to add
152 152
153 @return true on success, false on error. 153 @return true on success, false on error.
154 */ 154 */
155 virtual bool addEventNoDup( Event *event ) = 0; 155 virtual bool addEventNoDup( Event *event ) = 0;
156 virtual bool addAnniversaryNoDup( Event *event ) = 0; 156 virtual bool addAnniversaryNoDup( Event *event ) = 0;
157 virtual bool addEvent( Event *anEvent ) = 0; 157 virtual bool addEvent( Event *anEvent ) = 0;
158 /** 158 /**
159 Delete event from calendar. 159 Delete event from calendar.
160 */ 160 */
161 virtual void deleteEvent( Event * ) = 0; 161 virtual void deleteEvent( Event * ) = 0;
162 /** 162 /**
163 Retrieves an event on the basis of the unique string ID. 163 Retrieves an event on the basis of the unique string ID.
164 */ 164 */
165 virtual Event *event( const QString &UniqueStr ) = 0; 165 virtual Event *event( const QString &UniqueStr ) = 0;
166 virtual Event *event( QString, QString ) = 0; 166 virtual Event *event( QString, QString ) = 0;
167 /** 167 /**
168 Builds and then returns a list of all events that match for the 168 Builds and then returns a list of all events that match for the
169 date specified. useful for dayView, etc. etc. 169 date specified. useful for dayView, etc. etc.
170 The calendar filter is applied. 170 The calendar filter is applied.
171 */ 171 */
172 QPtrList<Event> events( const QDate &date, bool sorted = false); 172 QPtrList<Event> events( const QDate &date, bool sorted = false);
173 /** 173 /**
174 Get events, which occur on the given date. 174 Get events, which occur on the given date.
175 The calendar filter is applied. 175 The calendar filter is applied.
176 */ 176 */
177 QPtrList<Event> events( const QDateTime &qdt ); 177 QPtrList<Event> events( const QDateTime &qdt );
178 /** 178 /**
179 Get events in a range of dates. If inclusive is set to true, only events 179 Get events in a range of dates. If inclusive is set to true, only events
180 are returned, which are completely included in the range. 180 are returned, which are completely included in the range.
181 The calendar filter is applied. 181 The calendar filter is applied.
182 */ 182 */
183 QPtrList<Event> events( const QDate &start, const QDate &end, 183 QPtrList<Event> events( const QDate &start, const QDate &end,
184 bool inclusive = false); 184 bool inclusive = false);
185 /** 185 /**
186 Return filtered list of all events in calendar. 186 Return filtered list of all events in calendar.
187 */ 187 */
188 virtual QPtrList<Event> events(); 188 virtual QPtrList<Event> events();
189 /** 189 /**
190 Return unfiltered list of all events in calendar. 190 Return unfiltered list of all events in calendar.
191 */ 191 */
192 virtual QPtrList<Event> rawEvents() = 0; 192 virtual QPtrList<Event> rawEvents() = 0;
193 193
194 /** 194 /**
195 Add a todo to the todolist. 195 Add a todo to the todolist.
196 196
197 @return true on success, false on error. 197 @return true on success, false on error.
198 */ 198 */
199 virtual bool addTodo( Todo *todo ) = 0; 199 virtual bool addTodo( Todo *todo ) = 0;
200 virtual bool addTodoNoDup( Todo *todo ) = 0; 200 virtual bool addTodoNoDup( Todo *todo ) = 0;
201 /** 201 /**
202 Remove a todo from the todolist. 202 Remove a todo from the todolist.
203 */ 203 */
204 virtual void deleteTodo( Todo * ) = 0; 204 virtual void deleteTodo( Todo * ) = 0;
205 virtual void deleteJournal( Journal * ) = 0; 205 virtual void deleteJournal( Journal * ) = 0;
206 /** 206 /**
207 Return filterd list of todos. 207 Return filterd list of todos.
208 */ 208 */
209 virtual QPtrList<Todo> todos(); 209 virtual QPtrList<Todo> todos();
210 /** 210 /**
211 Searches todolist for an event with this unique string identifier, 211 Searches todolist for an event with this unique string identifier,
212 returns a pointer or null. 212 returns a pointer or null.
213 */ 213 */
214 virtual Todo *todo( const QString &uid ) = 0; 214 virtual Todo *todo( const QString &uid ) = 0;
215 virtual Todo *todo( QString, QString ) = 0; 215 virtual Todo *todo( QString, QString ) = 0;
216 /** 216 /**
217 Returns list of todos due on the specified date. 217 Returns list of todos due on the specified date.
218 */ 218 */
219 virtual QPtrList<Todo> todos( const QDate &date ) = 0; 219 virtual QPtrList<Todo> todos( const QDate &date ) = 0;
220 /** 220 /**
221 Return unfiltered list of todos. 221 Return unfiltered list of todos.
222 */ 222 */
223 virtual QPtrList<Todo> rawTodos() = 0; 223 virtual QPtrList<Todo> rawTodos() = 0;
224 224
225 /** 225 /**
226 Add a Journal entry to calendar. 226 Add a Journal entry to calendar.
227 227
228 @return true on success, false on error. 228 @return true on success, false on error.
229 */ 229 */
230 virtual bool addJournal( Journal * ) = 0; 230 virtual bool addJournal( Journal * ) = 0;
231 /** 231 /**
232 Return Journal for given date. 232 Return Journal for given date.
233 */ 233 */
234 virtual Journal *journal( const QDate & ) = 0; 234 virtual Journal *journal( const QDate & ) = 0;
235 /** 235 /**
236 Return Journal with given UID. 236 Return Journal with given UID.
237 */ 237 */
238 virtual Journal *journal( const QString &UID ) = 0; 238 virtual Journal *journal( const QString &UID ) = 0;
239 /** 239 /**
240 Return list of all Journal entries. 240 Return list of all Journal entries.
241 */ 241 */
242 virtual QPtrList<Journal> journals() = 0; 242 virtual QPtrList<Journal> journals() = 0;
243 243
244 /** 244 /**
245 Searches all incidence types for an incidence with this unique 245 Searches all incidence types for an incidence with this unique
246 string identifier, returns a pointer or null. 246 string identifier, returns a pointer or null.
247 */ 247 */
248 Incidence* incidence( const QString&UID ); 248 Incidence* incidence( const QString&UID );
249 249
250 /** 250 /**
251 Setup relations for an incidence. 251 Setup relations for an incidence.
252 */ 252 */
253 virtual void setupRelations( Incidence * ); 253 virtual void setupRelations( Incidence * );
254 /** 254 /**
255 Remove all relations to an incidence 255 Remove all relations to an incidence
256 */ 256 */
257 virtual void removeRelations( Incidence * ); 257 virtual void removeRelations( Incidence * );
258 258
259 /** 259 /**
260 Set calendar filter, which filters events for the events() functions. 260 Set calendar filter, which filters events for the events() functions.
261 The Filter object is owned by the caller. 261 The Filter object is owned by the caller.
262 */ 262 */
263 void setFilter( CalFilter * ); 263 void setFilter( CalFilter * );
264 /** 264 /**
265 Return calendar filter. 265 Return calendar filter.
266 */ 266 */
267 CalFilter *filter(); 267 CalFilter *filter();
268 virtual QDateTime nextAlarm( int daysTo ) = 0; 268 virtual QDateTime nextAlarm( int daysTo ) = 0;
269 virtual QString nextSummary( ) const = 0; 269 virtual QString nextSummary( ) const = 0;
270 virtual void reInitAlarmSettings() = 0; 270 virtual void reInitAlarmSettings() = 0;
271 virtual QDateTime nextAlarmEventDateTime() const = 0; 271 virtual QDateTime nextAlarmEventDateTime() const = 0;
272 virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; 272 virtual void checkAlarmForIncidence( Incidence *, bool ) = 0;
273 /** 273 /**
274 Return all alarms, which ocur in the given time interval. 274 Return all alarms, which ocur in the given time interval.
275 */ 275 */
276 virtual Alarm::List alarms( const QDateTime &from, 276 virtual Alarm::List alarms( const QDateTime &from,
277 const QDateTime &to ) = 0; 277 const QDateTime &to ) = 0;
278 278
279 class Observer { 279 class Observer {
280 public: 280 public:
281 virtual void calendarModified( bool, Calendar * ) = 0; 281 virtual void calendarModified( bool, Calendar * ) = 0;
282 }; 282 };
283 283
284 void registerObserver( Observer * ); 284 void registerObserver( Observer * );
285 285
286 void setModified( bool ); 286 void setModified( bool );
287 287
288 /** 288 /**
289 Set product id returned by loadedProductId(). This function is only 289 Set product id returned by loadedProductId(). This function is only
290 useful for the calendar loading code. 290 useful for the calendar loading code.
291 */ 291 */
292 void setLoadedProductId( const QString & ); 292 void setLoadedProductId( const QString & );
293 /** 293 /**
294 Return product id taken from file that has been loaded. Returns 294 Return product id taken from file that has been loaded. Returns
295 QString::null, if no calendar has been loaded. 295 QString::null, if no calendar has been loaded.
296 */ 296 */
297 QString loadedProductId(); 297 QString loadedProductId();
298 298
299 signals: 299 signals:
300 void calendarChanged(); 300 void calendarChanged();
301 void calendarSaved(); 301 void calendarSaved();
302 void calendarLoaded(); 302 void calendarLoaded();
303 void addAlarm(const QDateTime &qdt, const QString &noti ); 303 void addAlarm(const QDateTime &qdt, const QString &noti );
304 void removeAlarm(const QDateTime &qdt, const QString &noti ); 304 void removeAlarm(const QDateTime &qdt, const QString &noti );
305 305
306 protected: 306 protected:
307 /** 307 /**
308 Get unfiltered events, which occur on the given date. 308 Get unfiltered events, which occur on the given date.
309 */ 309 */
310 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; 310 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
311 /** 311 /**
312 Get unfiltered events, which occur on the given date. 312 Get unfiltered events, which occur on the given date.
313 */ 313 */
314 virtual QPtrList<Event> rawEventsForDate( const QDate &date, 314 virtual QPtrList<Event> rawEventsForDate( const QDate &date,
315 bool sorted = false ) = 0; 315 bool sorted = false ) = 0;
316 /** 316 /**
317 Get events in a range of dates. If inclusive is set to true, only events 317 Get events in a range of dates. If inclusive is set to true, only events
318 are returned, which are completely included in the range. 318 are returned, which are completely included in the range.
319 */ 319 */
320 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 320 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
321 bool inclusive = false ) = 0; 321 bool inclusive = false ) = 0;
322 Incidence *mNextAlarmIncidence; 322 Incidence *mNextAlarmIncidence;
323 323
324private: 324private:
325 void init(); 325 void init();
326 326
327 QString mOwner; // who the calendar belongs to 327 QString mOwner; // who the calendar belongs to
328 QString mOwnerEmail; // email address of the owner 328 QString mOwnerEmail; // email address of the owner
329 int mTimeZone; // timezone OFFSET from GMT (MINUTES) 329 int mTimeZone; // timezone OFFSET from GMT (MINUTES)
330 bool mLocalTime; // use local time, not UTC or a time zone 330 bool mLocalTime; // use local time, not UTC or a time zone
331 331
332 CalFilter *mFilter; 332 CalFilter *mFilter;
333 CalFilter *mDefaultFilter; 333 CalFilter *mDefaultFilter;
334 334
335 QString mTimeZoneId; 335 QString mTimeZoneId;
336 336
337 Observer *mObserver; 337 Observer *mObserver;
338 bool mNewObserver; 338 bool mNewObserver;
339 339
340 bool mModified; 340 bool mModified;
341 341
342 QString mLoadedProductId; 342 QString mLoadedProductId;
343 343
344 // This list is used to put together related todos 344 // This list is used to put together related todos
345 QDict<Incidence> mOrphans; 345 QDict<Incidence> mOrphans;
346 QDict<Incidence> mOrphanUids; 346 QDict<Incidence> mOrphanUids;
347}; 347};
348 348
349} 349}
350 350
351#endif 351#endif