summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--libkcal/phoneformat.cpp16
-rw-r--r--libkcal/sharpformat.cpp8
3 files changed, 23 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index cfaec5a..c1d07e4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,159 +1,159 @@
1############################################################################# 1#############################################################################
2# Makefile for building: kopi-desktop 2# Makefile for building: kopi-desktop
3# Generated by qmake (1.07a) (Qt 3.3.2) on: Sun Aug 8 12:23:00 2004 3# Generated by qmake (1.07a) (Qt 3.3.3) on: Mon Aug 9 12:10:32 2004
4# Project: kopi-desktop.pro 4# Project: kopi-desktop.pro
5# Template: subdirs 5# Template: subdirs
6# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro 6# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -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= 14INSTALL_FILE=
15INSTALL_DIR = 15INSTALL_DIR =
16 SUBTARGETS = \ 16 SUBTARGETS = \
17 sub-gammu-emb-common \ 17 sub-gammu-emb-common \
18 sub-libical \ 18 sub-libical \
19 sub-libkcal \ 19 sub-libkcal \
20 sub-microkde \ 20 sub-microkde \
21 sub-libkdepim \ 21 sub-libkdepim \
22 sub-kabc \ 22 sub-kabc \
23 sub-korganizer \ 23 sub-korganizer \
24 sub-kaddressbook \ 24 sub-kaddressbook \
25 sub-kabc-plugins-file \ 25 sub-kabc-plugins-file \
26 sub-kabc-plugins-dir 26 sub-kabc-plugins-dir
27 27
28first: all 28first: all
29 29
30all: Makefile $(SUBTARGETS) 30all: Makefile $(SUBTARGETS)
31 31
32gammu/emb/common/$(MAKEFILE): 32gammu/emb/common/$(MAKEFILE):
33 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" 33 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common"
34 cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 34 cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
35sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE 35sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE
36 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) 36 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE)
37 37
38libical/$(MAKEFILE): 38libical/$(MAKEFILE):
39 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" 39 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
40 cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 40 cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
41sub-libical: libical/$(MAKEFILE) FORCE 41sub-libical: libical/$(MAKEFILE) FORCE
42 cd libical && $(MAKE) -f $(MAKEFILE) 42 cd libical && $(MAKE) -f $(MAKEFILE)
43 43
44libkcal/$(MAKEFILE): 44libkcal/$(MAKEFILE):
45 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" 45 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
46 cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 46 cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
47sub-libkcal: libkcal/$(MAKEFILE) FORCE 47sub-libkcal: libkcal/$(MAKEFILE) FORCE
48 cd libkcal && $(MAKE) -f $(MAKEFILE) 48 cd libkcal && $(MAKE) -f $(MAKEFILE)
49 49
50microkde/$(MAKEFILE): 50microkde/$(MAKEFILE):
51 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" 51 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
52 cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 52 cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
53sub-microkde: microkde/$(MAKEFILE) FORCE 53sub-microkde: microkde/$(MAKEFILE) FORCE
54 cd microkde && $(MAKE) -f $(MAKEFILE) 54 cd microkde && $(MAKE) -f $(MAKEFILE)
55 55
56libkdepim/$(MAKEFILE): 56libkdepim/$(MAKEFILE):
57 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" 57 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
58 cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 58 cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
59sub-libkdepim: libkdepim/$(MAKEFILE) FORCE 59sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
60 cd libkdepim && $(MAKE) -f $(MAKEFILE) 60 cd libkdepim && $(MAKE) -f $(MAKEFILE)
61 61
62kabc/$(MAKEFILE): 62kabc/$(MAKEFILE):
63 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" 63 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
64 cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 64 cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
65sub-kabc: kabc/$(MAKEFILE) FORCE 65sub-kabc: kabc/$(MAKEFILE) FORCE
66 cd kabc && $(MAKE) -f $(MAKEFILE) 66 cd kabc && $(MAKE) -f $(MAKEFILE)
67 67
68korganizer/$(MAKEFILE): 68korganizer/$(MAKEFILE):
69 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" 69 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
70 cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 70 cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
71sub-korganizer: korganizer/$(MAKEFILE) FORCE 71sub-korganizer: korganizer/$(MAKEFILE) FORCE
72 cd korganizer && $(MAKE) -f $(MAKEFILE) 72 cd korganizer && $(MAKE) -f $(MAKEFILE)
73 73
74kaddressbook/$(MAKEFILE): 74kaddressbook/$(MAKEFILE):
75 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook" 75 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
76 cd kaddressbook && $(QMAKE) kaddressbook.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 76 cd kaddressbook && $(QMAKE) kaddressbook.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
77sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE 77sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
78 cd kaddressbook && $(MAKE) -f $(MAKEFILE) 78 cd kaddressbook && $(MAKE) -f $(MAKEFILE)
79 79
80kabc/plugins/file/$(MAKEFILE): 80kabc/plugins/file/$(MAKEFILE):
81 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" 81 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
82 cd kabc/plugins/file && $(QMAKE) file.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 82 cd kabc/plugins/file && $(QMAKE) file.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
83sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE 83sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
84 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) 84 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
85 85
86kabc/plugins/dir/$(MAKEFILE): 86kabc/plugins/dir/$(MAKEFILE):
87 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir" 87 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
88 cd kabc/plugins/dir && $(QMAKE) dir.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 88 cd kabc/plugins/dir && $(QMAKE) dir.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
89sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE 89sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
90 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE) 90 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
91 91
92Makefile: kopi-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf 92Makefile: kopi-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf
93 $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro 93 $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
94qmake: qmake_all 94qmake: qmake_all
95 @$(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro 95 @$(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
96 96
97all: $(SUBTARGETS) 97all: $(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) 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)
99 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 99 ( [ -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 100 ( [ -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 101 ( [ -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 102 ( [ -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 103 ( [ -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 104 ( [ -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 105 ( [ -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 106 ( [ -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 107 ( [ -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 108 ( [ -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 109clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
110 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true 110 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true
111 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true 111 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
112 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true 112 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
113 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true 113 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
114 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true 114 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
115 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true 115 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
116 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true 116 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
117 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true 117 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
118 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true 118 ( [ -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 119 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
120uninstall_subdirs: qmake_all FORCE 120uninstall_subdirs: qmake_all FORCE
121 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 121 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
122 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 122 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
123 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 123 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
124 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 124 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
125 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 125 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
126 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 126 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
127 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 127 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
128 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 128 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
129 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 129 ( [ -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 130 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
131install_subdirs: qmake_all FORCE 131install_subdirs: qmake_all FORCE
132 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true 132 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true
133 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true 133 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
134 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true 134 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
135 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true 135 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
136 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true 136 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
137 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true 137 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
138 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true 138 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
139 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true 139 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
140 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true 140 ( [ -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 141 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
142distclean: qmake_all FORCE 142distclean: qmake_all FORCE
143 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 143 ( [ -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 144 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
145 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 145 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
146 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 146 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
147 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 147 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
148 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 148 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
149 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 149 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
150 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 150 ( [ -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 151 ( [ -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 152 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
153 153
154install: install_subdirs 154install: install_subdirs
155 155
156uninstall: uninstall_subdirs 156uninstall: uninstall_subdirs
157 157
158FORCE: 158FORCE:
159 159
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 7e1c9cd..94744fb 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -1,644 +1,656 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2003 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#include <qdatetime.h> 22#include <qdatetime.h>
23#include <qstring.h> 23#include <qstring.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qclipboard.h> 28#include <qclipboard.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qtextcodec.h> 31#include <qtextcodec.h>
32#include <qxml.h> 32#include <qxml.h>
33#include <qlabel.h> 33#include <qlabel.h>
34 34
35#include <kdebug.h> 35#include <kdebug.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kglobal.h> 37#include <kglobal.h>
38 38
39#include "calendar.h" 39#include "calendar.h"
40#include "alarm.h" 40#include "alarm.h"
41#include "recurrence.h" 41#include "recurrence.h"
42#include "calendarlocal.h" 42#include "calendarlocal.h"
43 43
44#include "phoneformat.h" 44#include "phoneformat.h"
45#include "syncdefines.h" 45#include "syncdefines.h"
46 46
47using namespace KCal; 47using namespace KCal;
48 48
49class PhoneParser : public QObject 49class PhoneParser : public QObject
50{ 50{
51public: 51public:
52 PhoneParser( Calendar *calendar, QString profileName ) : mCalendar( calendar ), mProfileName ( profileName ) { 52 PhoneParser( Calendar *calendar, QString profileName ) : mCalendar( calendar ), mProfileName ( profileName ) {
53 ; 53 ;
54 } 54 }
55 bool readTodo( Calendar *existingCalendar,GSM_ToDoEntry *ToDo, GSM_StateMachine* s) 55 bool readTodo( Calendar *existingCalendar,GSM_ToDoEntry *ToDo, GSM_StateMachine* s)
56 { 56 {
57 57
58 int id = ToDo->Location; 58 int id = ToDo->Location;
59 Todo *todo; 59 Todo *todo;
60 todo = existingCalendar->todo( mProfileName ,QString::number( id ) ); 60 todo = existingCalendar->todo( mProfileName ,QString::number( id ) );
61 if (todo ) 61 if (todo )
62 todo = (Todo *)todo->clone(); 62 todo = (Todo *)todo->clone();
63 else 63 else
64 todo = new Todo; 64 todo = new Todo;
65 todo->setID( mProfileName,QString::number( id ) ); 65 todo->setID( mProfileName,QString::number( id ) );
66 todo->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); 66 todo->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
67 int priority; 67 int priority;
68 switch (ToDo->Priority) { 68 switch (ToDo->Priority) {
69 case GSM_Priority_Low : priority = 1; break; 69 case GSM_Priority_Low : priority = 1; break;
70 case GSM_Priority_Medium : priority = 3; break; 70 case GSM_Priority_Medium : priority = 3; break;
71 case GSM_Priority_High : priority = 5; break; 71 case GSM_Priority_High : priority = 5; break;
72 default :priority = 3 ;break; 72 default :priority = 3 ;break;
73 } 73 }
74 todo->setPriority( priority ); 74 todo->setPriority( priority );
75 GSM_Phone_Functions*Phone; 75 GSM_Phone_Functions*Phone;
76 Phone=s->Phone.Functions; 76 Phone=s->Phone.Functions;
77 int j; 77 int j;
78 GSM_DateTime* dtp; 78 GSM_DateTime* dtp;
79 bool alarm = false; 79 bool alarm = false;
80 QDateTime alarmDt; 80 QDateTime alarmDt;
81 GSM_Category Category; 81 GSM_Category Category;
82 int error; 82 int error;
83 QString completedString = "no"; 83 QString completedString = "no";
84 for (j=0;j<ToDo->EntriesNum;j++) { 84 for (j=0;j<ToDo->EntriesNum;j++) {
85 85
86 //qDebug(" for todo %d",ToDo->Location ); 86 //qDebug(" for todo %d",ToDo->Location );
87 switch (ToDo->Entries[j].EntryType) { 87 switch (ToDo->Entries[j].EntryType) {
88 case TODO_END_DATETIME: 88 case TODO_END_DATETIME:
89 dtp = &ToDo->Entries[j].Date ; 89 dtp = &ToDo->Entries[j].Date ;
90 todo->setDtDue (fromGSM ( dtp )); 90 todo->setDtDue (fromGSM ( dtp ));
91 break; 91 break;
92 case TODO_COMPLETED: 92 case TODO_COMPLETED:
93 if ( ToDo->Entries[j].Number == 1 ) { 93 if ( ToDo->Entries[j].Number == 1 ) {
94 todo->setCompleted( true ); 94 todo->setCompleted( true );
95 completedString = "yes"; 95 completedString = "yes";
96 } 96 }
97 else { 97 else {
98 todo->setCompleted( false ); 98 todo->setCompleted( false );
99 } 99 }
100 break; 100 break;
101 case TODO_ALARM_DATETIME: 101 case TODO_ALARM_DATETIME:
102 dtp = &ToDo->Entries[j].Date ; 102 dtp = &ToDo->Entries[j].Date ;
103 alarm = true; 103 alarm = true;
104 alarmDt = fromGSM ( dtp ); 104 alarmDt = fromGSM ( dtp );
105 break; 105 break;
106 case TODO_SILENT_ALARM_DATETIME: 106 case TODO_SILENT_ALARM_DATETIME:
107 dtp = &ToDo->Entries[j].Date ; 107 dtp = &ToDo->Entries[j].Date ;
108 alarm = true; 108 alarm = true;
109 alarmDt = fromGSM ( dtp ); 109 alarmDt = fromGSM ( dtp );
110 break; 110 break;
111 case TODO_TEXT: 111 case TODO_TEXT:
112 //qDebug(" text *%s* ", (const char*) DecodeUnicodeConsole(ToDo->Entries[j].Text )); 112 //qDebug(" text *%s* ", (const char*) DecodeUnicodeConsole(ToDo->Entries[j].Text ));
113 todo->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole(ToDo->Entries[j].Text ))); 113 todo->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole(ToDo->Entries[j].Text )));
114 break; 114 break;
115 case TODO_PRIVATE: 115 case TODO_PRIVATE:
116 if ( ToDo->Entries[j].Number == 1 ) 116 if ( ToDo->Entries[j].Number == 1 )
117 todo->setSecrecy( Incidence::SecrecyPrivate ); 117 todo->setSecrecy( Incidence::SecrecyPrivate );
118 else 118 else
119 todo->setSecrecy( Incidence::SecrecyPublic ); 119 todo->setSecrecy( Incidence::SecrecyPublic );
120 break; 120 break;
121 case TODO_CATEGORY: 121 case TODO_CATEGORY:
122 Category.Location = ToDo->Entries[j].Number; 122 Category.Location = ToDo->Entries[j].Number;
123 Category.Type = Category_ToDo; 123 Category.Type = Category_ToDo;
124 error=Phone->GetCategory(s, &Category); 124 error=Phone->GetCategory(s, &Category);
125 if (error == ERR_NONE) { 125 if (error == ERR_NONE) {
126 QStringList cat = todo->categories(); 126 QStringList cat = todo->categories();
127 QString nCat = QString ( (const char*)Category.Name ); 127 QString nCat = QString ( (const char*)Category.Name );
128 if ( !nCat.isEmpty() ) 128 if ( !nCat.isEmpty() )
129 if ( !cat.contains( nCat )) { 129 if ( !cat.contains( nCat )) {
130 cat << nCat; 130 cat << nCat;
131 todo->setCategories( cat ); 131 todo->setCategories( cat );
132 } 132 }
133 } 133 }
134 break; 134 break;
135 case TODO_CONTACTID: 135 case TODO_CONTACTID:
136#if 0 136#if 0
137 // not supported 137 // not supported
138 entry.Location = ToDo->Entries[j].Number; 138 entry.Location = ToDo->Entries[j].Number;
139 entry.MemoryType = MEM_ME; 139 entry.MemoryType = MEM_ME;
140 error=Phone->GetMemory(s, &entry); 140 error=Phone->GetMemory(s, &entry);
141 if (error == ERR_NONE) { 141 if (error == ERR_NONE) {
142 name = GSM_PhonebookGetEntryName(&entry); 142 name = GSM_PhonebookGetEntryName(&entry);
143 if (name != NULL) { 143 if (name != NULL) {
144 printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number); 144 printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number);
145 } else { 145 } else {
146 printmsg("Contact ID : %d\n",ToDo->Entries[j].Number); 146 printmsg("Contact ID : %d\n",ToDo->Entries[j].Number);
147 } 147 }
148 } else { 148 } else {
149 printmsg("Contact : %d\n",ToDo->Entries[j].Number); 149 printmsg("Contact : %d\n",ToDo->Entries[j].Number);
150 } 150 }
151#endif 151#endif
152 break; 152 break;
153 case TODO_PHONE: 153 case TODO_PHONE:
154#if 0 154#if 0
155 // not supported 155 // not supported
156 printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); 156 printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text));
157#endif 157#endif
158 break; 158 break;
159 } 159 }
160 } 160 }
161 QString alarmString = ""; 161 QString alarmString = "";
162 if ( alarm ) { 162 if ( alarm ) {
163 Alarm *alarm; 163 Alarm *alarm;
164 if ( todo->alarms().count() > 0 ) 164 if ( todo->alarms().count() > 0 )
165 alarm = todo->alarms().first(); 165 alarm = todo->alarms().first();
166 else { 166 else {
167 alarm = new Alarm( todo ); 167 alarm = new Alarm( todo );
168 todo->addAlarm( alarm ); 168 todo->addAlarm( alarm );
169 } 169 }
170 alarm->setType( Alarm::Audio ); 170 alarm->setType( Alarm::Audio );
171 alarm->setEnabled( true ); 171 alarm->setEnabled( true );
172 int alarmOffset = alarmDt.secsTo( todo->dtStart() ); 172 int alarmOffset = alarmDt.secsTo( todo->dtStart() );
173 alarm->setStartOffset( alarmOffset ); 173 alarm->setStartOffset( -alarmOffset );
174 alarmString = QString::number( alarmOffset ); 174 alarmString = QString::number( alarmOffset );
175 } else {
176 Alarm *alarm;
177 if ( todo->alarms().count() > 0 ) {
178 alarm = todo->alarms().first();
179 alarm->setEnabled( false );
180 }
175 } 181 }
176 // csum ***************************************** 182 // csum *****************************************
177 QStringList attList; 183 QStringList attList;
178 uint cSum; 184 uint cSum;
179 if ( todo->hasDueDate() ) 185 if ( todo->hasDueDate() )
180 attList << dtToString ( todo->dtDue() ); 186 attList << dtToString ( todo->dtDue() );
181 attList << QString::number( id ); 187 attList << QString::number( id );
182 attList << todo->summary(); 188 attList << todo->summary();
183 attList << completedString; 189 attList << completedString;
184 attList << QString::number( todo->priority() ); 190 attList << QString::number( todo->priority() );
185 attList << alarmString; 191 attList << alarmString;
186 attList << todo->categoriesStr(); 192 attList << todo->categoriesStr();
187 attList << todo->secrecyStr(); 193 attList << todo->secrecyStr();
188 cSum = PhoneFormat::getCsum(attList ); 194 cSum = PhoneFormat::getCsum(attList );
189 todo->setCsum( mProfileName, QString::number( cSum )); 195 todo->setCsum( mProfileName, QString::number( cSum ));
190 mCalendar->addTodo( todo); 196 mCalendar->addTodo( todo);
191 197
192 return true; 198 return true;
193 } 199 }
194 bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) 200 bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note)
195 { 201 {
196 202
197 int id = Note->Location; 203 int id = Note->Location;
198 Event *event; 204 Event *event;
199 event = existingCalendar->event( mProfileName ,QString::number( id ) ); 205 event = existingCalendar->event( mProfileName ,QString::number( id ) );
200 if ( event ) 206 if ( event )
201 event = (Event*)event->clone(); 207 event = (Event*)event->clone();
202 else 208 else
203 event = new Event; 209 event = new Event;
204 event->setID( mProfileName,QString::number( id ) ); 210 event->setID( mProfileName,QString::number( id ) );
205 event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); 211 event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
206 212
207 213
208 int i = 0; 214 int i = 0;
209 bool repeating = false; 215 bool repeating = false;
210 int repeat_dayofweek = -1; 216 int repeat_dayofweek = -1;
211 int repeat_day = -1; 217 int repeat_day = -1;
212 int repeat_weekofmonth = -1; 218 int repeat_weekofmonth = -1;
213 int repeat_month = -1; 219 int repeat_month = -1;
214 int repeat_frequency = -1; 220 int repeat_frequency = -1;
215 int rec_type = -1; 221 int rec_type = -1;
216 GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; 222 GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0};
217 GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; 223 GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0};
218 GSM_DateTime* dtp; 224 GSM_DateTime* dtp;
219 bool alarm = false; 225 bool alarm = false;
220 QDateTime alarmDt; 226 QDateTime alarmDt;
221 repeat_startdate.Day= 0; 227 repeat_startdate.Day= 0;
222 repeat_stopdate.Day = 0; 228 repeat_stopdate.Day = 0;
223 for (i=0;i<Note->EntriesNum;i++) { 229 for (i=0;i<Note->EntriesNum;i++) {
224 230
225 //qDebug(" for ev"); 231 //qDebug(" for ev");
226 switch (Note->Entries[i].EntryType) { 232 switch (Note->Entries[i].EntryType) {
227 case CAL_START_DATETIME: 233 case CAL_START_DATETIME:
228 dtp = &Note->Entries[i].Date ; 234 dtp = &Note->Entries[i].Date ;
229 if ( dtp->Hour > 24 ) { 235 if ( dtp->Hour > 24 ) {
230 event->setFloats( true ); 236 event->setFloats( true );
231 event->setDtStart( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); 237 event->setDtStart( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 )));
232 } else { 238 } else {
233 event->setDtStart (fromGSM ( dtp )); 239 event->setDtStart (fromGSM ( dtp ));
234 240
235 } 241 }
236 break; 242 break;
237 case CAL_END_DATETIME: 243 case CAL_END_DATETIME:
238 dtp = &Note->Entries[i].Date ; 244 dtp = &Note->Entries[i].Date ;
239 if ( dtp->Hour > 24 ) { 245 if ( dtp->Hour > 24 ) {
240 event->setFloats( true ); 246 event->setFloats( true );
241 event->setDtEnd( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); 247 event->setDtEnd( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 )));
242 } else { 248 } else {
243 event->setDtEnd (fromGSM ( dtp )); 249 event->setDtEnd (fromGSM ( dtp ));
244 } 250 }
245 break; 251 break;
246 case CAL_ALARM_DATETIME: 252 case CAL_ALARM_DATETIME:
247 dtp = &Note->Entries[i].Date ; 253 dtp = &Note->Entries[i].Date ;
248 alarm = true; 254 alarm = true;
249 alarmDt = fromGSM ( dtp ); 255 alarmDt = fromGSM ( dtp );
250 break; 256 break;
251 case CAL_SILENT_ALARM_DATETIME: 257 case CAL_SILENT_ALARM_DATETIME:
252 dtp = &Note->Entries[i].Date ; 258 dtp = &Note->Entries[i].Date ;
253 alarm = true; 259 alarm = true;
254 alarmDt = fromGSM ( dtp ); 260 alarmDt = fromGSM ( dtp );
255 break; 261 break;
256 case CAL_RECURRANCE: 262 case CAL_RECURRANCE:
257 rec_type = Note->Entries[i].Number; 263 rec_type = Note->Entries[i].Number;
258 //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); 264 //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" );
259 break; 265 break;
260 case CAL_TEXT: 266 case CAL_TEXT:
261 //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); 267 //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) );
262 event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); 268 event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text )));
263 break; 269 break;
264 case CAL_LOCATION: 270 case CAL_LOCATION:
265 event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); 271 event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) ));
266 break; 272 break;
267 case CAL_PHONE: 273 case CAL_PHONE:
268 //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); 274 //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text));
269 break; 275 break;
270 case CAL_PRIVATE: 276 case CAL_PRIVATE:
271 if ( Note->Entries[i].Number == 1 ) 277 if ( Note->Entries[i].Number == 1 )
272 event->setSecrecy( Incidence::SecrecyPrivate ); 278 event->setSecrecy( Incidence::SecrecyPrivate );
273 else 279 else
274 event->setSecrecy( Incidence::SecrecyPublic ); 280 event->setSecrecy( Incidence::SecrecyPublic );
275 281
276 break; 282 break;
277 case CAL_CONTACTID: 283 case CAL_CONTACTID:
278#if 0 284#if 0
279 entry.Location = Note->Entries[i].Number; 285 entry.Location = Note->Entries[i].Number;
280 entry.MemoryType = MEM_ME; 286 entry.MemoryType = MEM_ME;
281 error=Phone->GetMemory(&s, &entry); 287 error=Phone->GetMemory(&s, &entry);
282 if (error == ERR_NONE) { 288 if (error == ERR_NONE) {
283 name = GSM_PhonebookGetEntryName(&entry); 289 name = GSM_PhonebookGetEntryName(&entry);
284 if (name != NULL) { 290 if (name != NULL) {
285 //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); 291 //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number);
286 } else { 292 } else {
287 //printmsg("Contact ID : %d\n",Note->Entries[i].Number); 293 //printmsg("Contact ID : %d\n",Note->Entries[i].Number);
288 } 294 }
289 } else { 295 } else {
290 //printmsg("Contact ID : %d\n",Note->Entries[i].Number); 296 //printmsg("Contact ID : %d\n",Note->Entries[i].Number);
291 } 297 }
292#endif 298#endif
293 break; 299 break;
294 case CAL_REPEAT_DAYOFWEEK: 300 case CAL_REPEAT_DAYOFWEEK:
295 repeat_dayofweek = Note->Entries[i].Number; 301 repeat_dayofweek = Note->Entries[i].Number;
296 repeating = true; 302 repeating = true;
297 break; 303 break;
298 case CAL_REPEAT_DAY: 304 case CAL_REPEAT_DAY:
299 repeat_day = Note->Entries[i].Number; 305 repeat_day = Note->Entries[i].Number;
300 repeating = true; 306 repeating = true;
301 break; 307 break;
302 case CAL_REPEAT_WEEKOFMONTH: 308 case CAL_REPEAT_WEEKOFMONTH:
303 repeat_weekofmonth = Note->Entries[i].Number; 309 repeat_weekofmonth = Note->Entries[i].Number;
304 repeating = true; 310 repeating = true;
305 break; 311 break;
306 case CAL_REPEAT_MONTH: 312 case CAL_REPEAT_MONTH:
307 repeat_month = Note->Entries[i].Number; 313 repeat_month = Note->Entries[i].Number;
308 repeating = true; 314 repeating = true;
309 break; 315 break;
310 case CAL_REPEAT_FREQUENCY: 316 case CAL_REPEAT_FREQUENCY:
311 repeat_frequency = Note->Entries[i].Number; 317 repeat_frequency = Note->Entries[i].Number;
312 repeating = true; 318 repeating = true;
313 break; 319 break;
314 case CAL_REPEAT_STARTDATE: 320 case CAL_REPEAT_STARTDATE:
315 repeat_startdate = Note->Entries[i].Date; 321 repeat_startdate = Note->Entries[i].Date;
316 repeating = true; 322 repeating = true;
317 break; 323 break;
318 case CAL_REPEAT_STOPDATE: 324 case CAL_REPEAT_STOPDATE:
319 repeat_stopdate = Note->Entries[i].Date; 325 repeat_stopdate = Note->Entries[i].Date;
320 repeating = true; 326 repeating = true;
321 break; 327 break;
322 } 328 }
323 } 329 }
324#if 0 330#if 0
325 event->setDescription( attList[4] ); 331 event->setDescription( attList[4] );
326 bool repeating = false; 332 bool repeating = false;
327 int repeat_dayofweek = -1; 333 int repeat_dayofweek = -1;
328 int repeat_day = -1; 334 int repeat_day = -1;
329 int repeat_weekofmonth = -1; 335 int repeat_weekofmonth = -1;
330 int repeat_month = -1; 336 int repeat_month = -1;
331 int repeat_frequency = -1; 337 int repeat_frequency = -1;
332 GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; 338 GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0};
333 GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; 339 GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0};
334 340
335#endif 341#endif
336 342
337 QString recurString = "no"; 343 QString recurString = "no";
338 if ( repeating ) { 344 if ( repeating ) {
339 recurString = "y"; 345 recurString = "y";
340 if ( repeat_dayofweek >= 0 ) 346 if ( repeat_dayofweek >= 0 )
341 recurString += "dow" + QString::number (repeat_dayofweek); 347 recurString += "dow" + QString::number (repeat_dayofweek);
342 if ( repeat_day >= 0 ) 348 if ( repeat_day >= 0 )
343 recurString += "d" + QString::number (repeat_day); 349 recurString += "d" + QString::number (repeat_day);
344 if ( repeat_weekofmonth >= 0 ) 350 if ( repeat_weekofmonth >= 0 )
345 recurString += "w" + QString::number (repeat_weekofmonth); 351 recurString += "w" + QString::number (repeat_weekofmonth);
346 if ( repeat_month >= 0 ) 352 if ( repeat_month >= 0 )
347 recurString += "m" + QString::number ( repeat_month ); 353 recurString += "m" + QString::number ( repeat_month );
348 if ( repeat_frequency >= 0 ) 354 if ( repeat_frequency >= 0 )
349 recurString += "f" + QString::number (repeat_frequency ); 355 recurString += "f" + QString::number (repeat_frequency );
350 356
351 int rtype = 0; 357 int rtype = 0;
352 // qDebug("recurs "); 358 // qDebug("recurs ");
353 QDate startDate, endDate; 359 QDate startDate, endDate;
354 if ( repeat_startdate.Day > 0 ) 360 if ( repeat_startdate.Day > 0 )
355 startDate = datefromGSM ( &repeat_startdate ); 361 startDate = datefromGSM ( &repeat_startdate );
356 else 362 else
357 startDate = event->dtStart().date(); 363 startDate = event->dtStart().date();
358 int freq = repeat_frequency; 364 int freq = repeat_frequency;
359 bool hasEndDate = false; 365 bool hasEndDate = false;
360 if ( repeat_stopdate.Day > 0 ) { 366 if ( repeat_stopdate.Day > 0 ) {
361 endDate = datefromGSM ( &repeat_stopdate ); 367 endDate = datefromGSM ( &repeat_stopdate );
362 hasEndDate = true; 368 hasEndDate = true;
363 } 369 }
364 370
365 uint weekDaysNum = repeat_dayofweek ; 371 uint weekDaysNum = repeat_dayofweek ;
366 372
367 QBitArray weekDays( 7 ); 373 QBitArray weekDays( 7 );
368 int i; 374 int i;
369 int bb = 1; 375 int bb = 1;
370 for( i = 1; i <= 7; ++i ) { 376 for( i = 1; i <= 7; ++i ) {
371 weekDays.setBit( i - 1, ( bb & weekDaysNum )); 377 weekDays.setBit( i - 1, ( bb & weekDaysNum ));
372 bb = 2 << (i-1); 378 bb = 2 << (i-1);
373 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); 379 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
374 } 380 }
375 // qDebug("next "); 381 // qDebug("next ");
376 int pos = 0; 382 int pos = 0;
377 Recurrence *r = event->recurrence(); 383 Recurrence *r = event->recurrence();
378 /* 384 /*
379 0 daily; 385 0 daily;
380 1 weekly;x 386 1 weekly;x
381 2 monthpos;x 387 2 monthpos;x
382 3 monthlyday; 388 3 monthlyday;
383 4 rYearlyMont 389 4 rYearlyMont
384 bool repeating = false; 390 bool repeating = false;
385 int repeat_dayofweek = -1; 391 int repeat_dayofweek = -1;
386 int repeat_day = -1; 392 int repeat_day = -1;
387 int repeat_weekofmonth = -1; 393 int repeat_weekofmonth = -1;
388 int repeat_month = -1; 394 int repeat_month = -1;
389 int repeat_frequency = -1; 395 int repeat_frequency = -1;
390 */ 396 */
391 int dayOfWeek = startDate.dayOfWeek(); 397 int dayOfWeek = startDate.dayOfWeek();
392 if ( repeat_weekofmonth >= 0 ) { 398 if ( repeat_weekofmonth >= 0 ) {
393 rtype = 2; 399 rtype = 2;
394 pos = repeat_weekofmonth; 400 pos = repeat_weekofmonth;
395 if ( repeat_dayofweek >= 0 ) 401 if ( repeat_dayofweek >= 0 )
396 dayOfWeek = repeat_dayofweek; 402 dayOfWeek = repeat_dayofweek;
397 } else if ( repeat_dayofweek >= 0 ) { 403 } else if ( repeat_dayofweek >= 0 ) {
398 rtype = 1; 404 rtype = 1;
399 } if ( repeat_dayofweek >= 0 ) { 405 } if ( repeat_dayofweek >= 0 ) {
400 rtype = 1; 406 rtype = 1;
401 } 407 }
402 408
403 if ( rtype == 0 ) { 409 if ( rtype == 0 ) {
404 if ( hasEndDate ) r->setDaily( freq, endDate ); 410 if ( hasEndDate ) r->setDaily( freq, endDate );
405 else r->setDaily( freq, -1 ); 411 else r->setDaily( freq, -1 );
406 } else if ( rtype == 1 ) { 412 } else if ( rtype == 1 ) {
407 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); 413 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
408 else r->setWeekly( freq, weekDays, -1 ); 414 else r->setWeekly( freq, weekDays, -1 );
409 } else if ( rtype == 3 ) { 415 } else if ( rtype == 3 ) {
410 if ( hasEndDate ) 416 if ( hasEndDate )
411 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 417 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
412 else 418 else
413 r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); 419 r->setMonthly( Recurrence::rMonthlyDay, freq, -1 );
414 r->addMonthlyDay( startDate.day() ); 420 r->addMonthlyDay( startDate.day() );
415 } else if ( rtype == 2 ) { 421 } else if ( rtype == 2 ) {
416 if ( hasEndDate ) 422 if ( hasEndDate )
417 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 423 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
418 else 424 else
419 r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); 425 r->setMonthly( Recurrence::rMonthlyPos, freq, -1 );
420 QBitArray days( 7 ); 426 QBitArray days( 7 );
421 days.fill( false ); 427 days.fill( false );
422 days.setBit( dayOfWeek - 1 ); 428 days.setBit( dayOfWeek - 1 );
423 r->addMonthlyPos( pos, days ); 429 r->addMonthlyPos( pos, days );
424 } else if ( rtype == 4 ) { 430 } else if ( rtype == 4 ) {
425 if ( hasEndDate ) 431 if ( hasEndDate )
426 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 432 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
427 else 433 else
428 r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); 434 r->setYearly( Recurrence::rYearlyMonth, freq, -1 );
429 r->addYearlyNum( startDate.month() ); 435 r->addYearlyNum( startDate.month() );
430 } 436 }
431 } else { 437 } else {
432 event->recurrence()->unsetRecurs(); 438 event->recurrence()->unsetRecurs();
433 } 439 }
434 440
435 QStringList categoryList; 441 QStringList categoryList;
436 categoryList << getCategory( Note ); 442 categoryList << getCategory( Note );
437 event->setCategories( categoryList ); 443 event->setCategories( categoryList );
438 QString alarmString = ""; 444 QString alarmString = "";
439 // strange 0 semms to mean: alarm enabled 445 // strange 0 semms to mean: alarm enabled
440 if ( alarm ) { 446 if ( alarm ) {
441 Alarm *alarm; 447 Alarm *alarm;
442 if ( event->alarms().count() > 0 ) 448 if ( event->alarms().count() > 0 )
443 alarm = event->alarms().first(); 449 alarm = event->alarms().first();
444 else { 450 else {
445 alarm = new Alarm( event ); 451 alarm = new Alarm( event );
446 event->addAlarm( alarm ); 452 event->addAlarm( alarm );
447 } 453 }
448 alarm->setType( Alarm::Audio ); 454 alarm->setType( Alarm::Audio );
449 alarm->setEnabled( true ); 455 alarm->setEnabled( true );
450 int alarmOffset = alarmDt.secsTo( event->dtStart() ); 456 int alarmOffset = alarmDt.secsTo( event->dtStart() );
451 alarm->setStartOffset( alarmOffset ); 457 alarm->setStartOffset( -alarmOffset );
452 alarmString = QString::number( alarmOffset ); 458 alarmString = QString::number( alarmOffset );
459 } else {
460 Alarm *alarm;
461 if ( event->alarms().count() > 0 ) {
462 alarm = event->alarms().first();
463 alarm->setEnabled( false );
464 }
453 } 465 }
454 // csum ***************************************** 466 // csum *****************************************
455 QStringList attList; 467 QStringList attList;
456 uint cSum; 468 uint cSum;
457 attList << dtToString ( event->dtStart() ); 469 attList << dtToString ( event->dtStart() );
458 attList << dtToString ( event->dtEnd() ); 470 attList << dtToString ( event->dtEnd() );
459 attList << QString::number( id ); 471 attList << QString::number( id );
460 attList << event->summary(); 472 attList << event->summary();
461 attList << event->location(); 473 attList << event->location();
462 attList << alarmString; 474 attList << alarmString;
463 attList << recurString; 475 attList << recurString;
464 attList << event->categoriesStr(); 476 attList << event->categoriesStr();
465 attList << event->secrecyStr(); 477 attList << event->secrecyStr();
466 cSum = PhoneFormat::getCsum(attList ); 478 cSum = PhoneFormat::getCsum(attList );
467 event->setCsum( mProfileName, QString::number( cSum )); 479 event->setCsum( mProfileName, QString::number( cSum ));
468 mCalendar->addEvent( event); 480 mCalendar->addEvent( event);
469 481
470 return true; 482 return true;
471 } 483 }
472 484
473 485
474 QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { 486 QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) {
475 QDateTime dt; 487 QDateTime dt;
476 int y,m,t,h,min,sec; 488 int y,m,t,h,min,sec;
477 y = dtp->Year; 489 y = dtp->Year;
478 m = dtp->Month; 490 m = dtp->Month;
479 t = dtp->Day; 491 t = dtp->Day;
480 h = dtp->Hour; 492 h = dtp->Hour;
481 min = dtp->Minute; 493 min = dtp->Minute;
482 sec = dtp->Second; 494 sec = dtp->Second;
483 dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); 495 dt = QDateTime(QDate(y,m,t), QTime(h,min,sec));
484 // dtp->Timezone: offset in hours 496 // dtp->Timezone: offset in hours
485 int offset = KGlobal::locale()->localTimeOffset( dt ); 497 int offset = KGlobal::locale()->localTimeOffset( dt );
486 if ( useTz ) 498 if ( useTz )
487 dt = dt.addSecs ( offset*60); 499 dt = dt.addSecs ( offset*60);
488 return dt; 500 return dt;
489 501
490 } 502 }
491 503
492 QString dtToString( const QDateTime& dti, bool useTZ = false ) 504 QString dtToString( const QDateTime& dti, bool useTZ = false )
493 { 505 {
494 QString datestr; 506 QString datestr;
495 QString timestr; 507 QString timestr;
496 int offset = KGlobal::locale()->localTimeOffset( dti ); 508 int offset = KGlobal::locale()->localTimeOffset( dti );
497 QDateTime dt; 509 QDateTime dt;
498 if (useTZ) 510 if (useTZ)
499 dt = dti.addSecs ( -(offset*60)); 511 dt = dti.addSecs ( -(offset*60));
500 else 512 else
501 dt = dti; 513 dt = dti;
502 if(dt.date().isValid()){ 514 if(dt.date().isValid()){
503 const QDate& date = dt.date(); 515 const QDate& date = dt.date();
504 datestr.sprintf("%04d%02d%02d", 516 datestr.sprintf("%04d%02d%02d",
505 date.year(), date.month(), date.day()); 517 date.year(), date.month(), date.day());
506 } 518 }
507 if(dt.time().isValid()){ 519 if(dt.time().isValid()){
508 const QTime& time = dt.time(); 520 const QTime& time = dt.time();
509 timestr.sprintf("T%02d%02d%02d", 521 timestr.sprintf("T%02d%02d%02d",
510 time.hour(), time.minute(), time.second()); 522 time.hour(), time.minute(), time.second());
511 } 523 }
512 return datestr + timestr; 524 return datestr + timestr;
513 } 525 }
514 QDate datefromGSM ( GSM_DateTime*dtp ) { 526 QDate datefromGSM ( GSM_DateTime*dtp ) {
515 return QDate ( dtp->Year, dtp->Month, dtp->Day ); 527 return QDate ( dtp->Year, dtp->Month, dtp->Day );
516 } 528 }
517 QString getCategory( GSM_CalendarEntry*Note) 529 QString getCategory( GSM_CalendarEntry*Note)
518 { 530 {
519 QString CATEGORY; 531 QString CATEGORY;
520 switch (Note->Type) { 532 switch (Note->Type) {
521 case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; 533 case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break;
522 case GSM_CAL_CALL : CATEGORY = QString("Call"); break; 534 case GSM_CAL_CALL : CATEGORY = QString("Call"); break;
523 case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; 535 case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break;
524 case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; 536 case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break;
525 case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; 537 case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break;
526 case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; 538 case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break;
527 case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; 539 case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break;
528 case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; 540 case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break;
529 case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; 541 case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break;
530 case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; 542 case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break;
531 case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; 543 case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break;
532 case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; 544 case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break;
533 case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; 545 case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break;
534 case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; 546 case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break;
535 case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; 547 case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break;
536 case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; 548 case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break;
537 case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; 549 case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break;
538 case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; 550 case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break;
539 case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; 551 case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break;
540 case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; 552 case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break;
541 case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; 553 case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break;
542 case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; 554 case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break;
543 case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; 555 case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break;
544 case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; 556 case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break;
545 case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; 557 case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break;
546 case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; 558 case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break;
547 case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; 559 case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break;
548 case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; 560 case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break;
549 default : CATEGORY = QString(""); 561 default : CATEGORY = QString("");
550 } 562 }
551 563
552 return CATEGORY; 564 return CATEGORY;
553 } 565 }
554 566
555protected: 567protected:
556private: 568private:
557 Calendar *mCalendar; 569 Calendar *mCalendar;
558 QString mProfileName ; 570 QString mProfileName ;
559}; 571};
560 572
561 573
562PhoneFormat::PhoneFormat() 574PhoneFormat::PhoneFormat()
563{ 575{
564 ; 576 ;
565} 577}
566 578
567PhoneFormat::~PhoneFormat() 579PhoneFormat::~PhoneFormat()
568{ 580{
569} 581}
570ulong PhoneFormat::getCsum( const QStringList & attList) 582ulong PhoneFormat::getCsum( const QStringList & attList)
571{ 583{
572 int max = attList.count() -1; 584 int max = attList.count() -1;
573 ulong cSum = 0; 585 ulong cSum = 0;
574 int j,k,i; 586 int j,k,i;
575 int add; 587 int add;
576 for ( i = 1; i < max ; ++i ) { 588 for ( i = 1; i < max ; ++i ) {
577 QString s = attList[i]; 589 QString s = attList[i];
578 if ( ! s.isEmpty() ){ 590 if ( ! s.isEmpty() ){
579 j = s.length(); 591 j = s.length();
580 for ( k = 0; k < j; ++k ) { 592 for ( k = 0; k < j; ++k ) {
581 int mul = k +1; 593 int mul = k +1;
582 add = s[k].unicode (); 594 add = s[k].unicode ();
583 if ( k < 16 ) 595 if ( k < 16 )
584 mul = mul * mul; 596 mul = mul * mul;
585 add = add * mul *i*i*i; 597 add = add * mul *i*i*i;
586 cSum += add; 598 cSum += add;
587 } 599 }
588 } 600 }
589 } 601 }
590 return cSum; 602 return cSum;
591 603
592} 604}
593//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); 605//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
594#include <stdlib.h> 606#include <stdlib.h>
595#define DEBUGMODE false 607#define DEBUGMODE false
596bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profileName, QString device,QString connection, QString model ) 608bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profileName, QString device,QString connection, QString model )
597{ 609{
598 mProfileName = profileName; 610 mProfileName = profileName;
599 GSM_StateMachines; 611 GSM_StateMachines;
600 qDebug(" load "); 612 qDebug(" load ");
601 s.opened = false; 613 s.opened = false;
602 s.msg = NULL; 614 s.msg = NULL;
603 s.ConfigNum = 0; 615 s.ConfigNum = 0;
604#if 0 616#if 0
605 static char*cp; 617 static char*cp;
606 static INI_Section *cfg = NULL; 618 static INI_Section *cfg = NULL;
607 cfg=GSM_FindGammuRC(); 619 cfg=GSM_FindGammuRC();
608 int i; 620 int i;
609 for (i = 0; i <= MAX_CONFIG_NUM; i++) { 621 for (i = 0; i <= MAX_CONFIG_NUM; i++) {
610 if (cfg!=NULL) { 622 if (cfg!=NULL) {
611 cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); 623 cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false);
612 if (cp) di.coding = cp; 624 if (cp) di.coding = cp;
613 625
614 s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); 626 s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false);
615 if (s.Config[i].Localize) { 627 if (s.Config[i].Localize) {
616 s.msg=INI_ReadFile(s.Config[i].Localize, true); 628 s.msg=INI_ReadFile(s.Config[i].Localize, true);
617 } else { 629 } else {
618#if !defined(WIN32) && defined(LOCALE_PATH) 630#if !defined(WIN32) && defined(LOCALE_PATH)
619 locale = setlocale(LC_MESSAGES, NULL); 631 locale = setlocale(LC_MESSAGES, NULL);
620 if (locale != NULL) { 632 if (locale != NULL) {
621 snprintf(locale_file, 200, "%s/gammu_%c%c.txt", 633 snprintf(locale_file, 200, "%s/gammu_%c%c.txt",
622 LOCALE_PATH, 634 LOCALE_PATH,
623 tolower(locale[0]), 635 tolower(locale[0]),
624 tolower(locale[1])); 636 tolower(locale[1]));
625 s.msg = INI_ReadFile(locale_file, true); 637 s.msg = INI_ReadFile(locale_file, true);
626 } 638 }
627#endif 639#endif
628 } 640 }
629 } 641 }
630 642
631 /* Wanted user specific configuration? */ 643 /* Wanted user specific configuration? */
632 644
633 if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; 645 if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break;
634 646
635 s.ConfigNum++; 647 s.ConfigNum++;
636 648
637 /* We want to use only one file descriptor for global and state machine debug output */ 649 /* We want to use only one file descriptor for global and state machine debug output */
638 s.Config[i].UseGlobalDebugFile = true; 650 s.Config[i].UseGlobalDebugFile = true;
639 651
640 652
641 653
642 /* We wanted to read just user specified configuration. */ 654 /* We wanted to read just user specified configuration. */
643 {break;} 655 {break;}
644 } 656 }
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index 4e54fdf..f8b066d 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -1,377 +1,385 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2003 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#include <qdatetime.h> 22#include <qdatetime.h>
23#include <qstring.h> 23#include <qstring.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qclipboard.h> 28#include <qclipboard.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qtextcodec.h> 31#include <qtextcodec.h>
32#include <qxml.h> 32#include <qxml.h>
33#include <qlabel.h> 33#include <qlabel.h>
34 34
35#include <kdebug.h> 35#include <kdebug.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kglobal.h> 37#include <kglobal.h>
38 38
39#include "calendar.h" 39#include "calendar.h"
40#include "alarm.h" 40#include "alarm.h"
41#include "recurrence.h" 41#include "recurrence.h"
42#include "calendarlocal.h" 42#include "calendarlocal.h"
43 43
44#include "sharpformat.h" 44#include "sharpformat.h"
45#include "syncdefines.h" 45#include "syncdefines.h"
46 46
47using namespace KCal; 47using namespace KCal;
48 48
49//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY 49//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY
50// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 50// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
51 51
52//ARSD silentalarm = 0 52//ARSD silentalarm = 0
53// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly 53// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly
54// 12 RFRQ 54// 12 RFRQ
55// 13 RPOS pos = 4. monday in month 55// 13 RPOS pos = 4. monday in month
56// 14 RDYS days: 1 mon/ 2 tue .. 64 sun 56// 14 RDYS days: 1 mon/ 2 tue .. 64 sun
57// 15 REND 0 = no end/ 1 = end 57// 15 REND 0 = no end/ 1 = end
58// 16 REDT rec end dt 58// 16 REDT rec end dt
59//ALSD 59//ALSD
60//ALED 60//ALED
61//MDAY 61//MDAY
62 62
63class SharpParser : public QObject 63class SharpParser : public QObject
64{ 64{
65 public: 65 public:
66 SharpParser( Calendar *calendar ) : mCalendar( calendar ) { 66 SharpParser( Calendar *calendar ) : mCalendar( calendar ) {
67 oldCategories = 0; 67 oldCategories = 0;
68 } 68 }
69 69
70 bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName ) 70 bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName )
71 { 71 {
72 int i = 1; 72 int i = 1;
73 bool skip = true; 73 bool skip = true;
74 int max = attList.count() -2; 74 int max = attList.count() -2;
75 while ( i < max ) { 75 while ( i < max ) {
76 if ( !attList[i].isEmpty() ) { 76 if ( !attList[i].isEmpty() ) {
77 skip = false; 77 skip = false;
78 break; 78 break;
79 } 79 }
80 ++i ; 80 ++i ;
81 } 81 }
82 if ( skip ) 82 if ( skip )
83 return false; 83 return false;
84 ulong cSum = SharpFormat::getCsum(attList ); 84 ulong cSum = SharpFormat::getCsum(attList );
85 85
86 if ( qName == "Event" ) { 86 if ( qName == "Event" ) {
87 Event *event; 87 Event *event;
88 event = existingCalendar->event( "Sharp_DTM",attList[0] ); 88 event = existingCalendar->event( "Sharp_DTM",attList[0] );
89 if ( event ) 89 if ( event )
90 event = (Event*)event->clone(); 90 event = (Event*)event->clone();
91 else 91 else
92 event = new Event; 92 event = new Event;
93 event->setID("Sharp_DTM", attList[0] ); 93 event->setID("Sharp_DTM", attList[0] );
94 event->setCsum( "Sharp_DTM", QString::number( cSum )); 94 event->setCsum( "Sharp_DTM", QString::number( cSum ));
95 event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); 95 event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
96 96
97 event->setSummary( attList[2] ); 97 event->setSummary( attList[2] );
98 event->setLocation( attList[3] ); 98 event->setLocation( attList[3] );
99 event->setDescription( attList[4] ); 99 event->setDescription( attList[4] );
100 if ( attList[7] == "1" ) { 100 if ( attList[7] == "1" ) {
101 event->setDtStart( QDateTime(fromString( attList[17]+"T000000", false ).date(),QTime(0,0,0 ) )); 101 event->setDtStart( QDateTime(fromString( attList[17]+"T000000", false ).date(),QTime(0,0,0 ) ));
102 event->setDtEnd( QDateTime(fromString( attList[18]+"T000000", false ).date(),QTime(0,0,0 ))); 102 event->setDtEnd( QDateTime(fromString( attList[18]+"T000000", false ).date(),QTime(0,0,0 )));
103 event->setFloats( true ); 103 event->setFloats( true );
104 } else { 104 } else {
105 event->setFloats( false ); 105 event->setFloats( false );
106 event->setDtStart( fromString( attList[5] ) ); 106 event->setDtStart( fromString( attList[5] ) );
107 event->setDtEnd( fromString( attList[6] )); 107 event->setDtEnd( fromString( attList[6] ));
108 } 108 }
109 109
110 QString rtype = attList[11]; 110 QString rtype = attList[11];
111 if ( rtype != "255" ) { 111 if ( rtype != "255" ) {
112 // qDebug("recurs "); 112 // qDebug("recurs ");
113 QDate startDate = event->dtStart().date(); 113 QDate startDate = event->dtStart().date();
114 114
115 QString freqStr = attList[12]; 115 QString freqStr = attList[12];
116 int freq = freqStr.toInt(); 116 int freq = freqStr.toInt();
117 117
118 QString hasEndDateStr = attList[15] ; 118 QString hasEndDateStr = attList[15] ;
119 bool hasEndDate = hasEndDateStr == "1"; 119 bool hasEndDate = hasEndDateStr == "1";
120 120
121 QString endDateStr = attList[16]; 121 QString endDateStr = attList[16];
122 QDate endDate = fromString( endDateStr ).date(); 122 QDate endDate = fromString( endDateStr ).date();
123 123
124 QString weekDaysStr = attList[14]; 124 QString weekDaysStr = attList[14];
125 uint weekDaysNum = weekDaysStr.toInt(); 125 uint weekDaysNum = weekDaysStr.toInt();
126 126
127 QBitArray weekDays( 7 ); 127 QBitArray weekDays( 7 );
128 int i; 128 int i;
129 int bb = 1; 129 int bb = 1;
130 for( i = 1; i <= 7; ++i ) { 130 for( i = 1; i <= 7; ++i ) {
131 weekDays.setBit( i - 1, ( bb & weekDaysNum )); 131 weekDays.setBit( i - 1, ( bb & weekDaysNum ));
132 bb = 2 << (i-1); 132 bb = 2 << (i-1);
133 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); 133 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
134 } 134 }
135 // qDebug("next "); 135 // qDebug("next ");
136 QString posStr = attList[13]; 136 QString posStr = attList[13];
137 int pos = posStr.toInt(); 137 int pos = posStr.toInt();
138 Recurrence *r = event->recurrence(); 138 Recurrence *r = event->recurrence();
139 139
140 if ( rtype == "0" ) { 140 if ( rtype == "0" ) {
141 if ( hasEndDate ) r->setDaily( freq, endDate ); 141 if ( hasEndDate ) r->setDaily( freq, endDate );
142 else r->setDaily( freq, -1 ); 142 else r->setDaily( freq, -1 );
143 } else if ( rtype == "1" ) { 143 } else if ( rtype == "1" ) {
144 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); 144 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
145 else r->setWeekly( freq, weekDays, -1 ); 145 else r->setWeekly( freq, weekDays, -1 );
146 } else if ( rtype == "3" ) { 146 } else if ( rtype == "3" ) {
147 if ( hasEndDate ) 147 if ( hasEndDate )
148 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 148 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
149 else 149 else
150 r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); 150 r->setMonthly( Recurrence::rMonthlyDay, freq, -1 );
151 r->addMonthlyDay( startDate.day() ); 151 r->addMonthlyDay( startDate.day() );
152 } else if ( rtype == "2" ) { 152 } else if ( rtype == "2" ) {
153 if ( hasEndDate ) 153 if ( hasEndDate )
154 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 154 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
155 else 155 else
156 r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); 156 r->setMonthly( Recurrence::rMonthlyPos, freq, -1 );
157 QBitArray days( 7 ); 157 QBitArray days( 7 );
158 days.fill( false ); 158 days.fill( false );
159 days.setBit( startDate.dayOfWeek() - 1 ); 159 days.setBit( startDate.dayOfWeek() - 1 );
160 r->addMonthlyPos( pos, days ); 160 r->addMonthlyPos( pos, days );
161 } else if ( rtype == "4" ) { 161 } else if ( rtype == "4" ) {
162 if ( hasEndDate ) 162 if ( hasEndDate )
163 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 163 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
164 else 164 else
165 r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); 165 r->setYearly( Recurrence::rYearlyMonth, freq, -1 );
166 r->addYearlyNum( startDate.month() ); 166 r->addYearlyNum( startDate.month() );
167 } 167 }
168 } else {
169 event->recurrence()->unsetRecurs();
168 } 170 }
169 171
170 QString categoryList = attList[1] ; 172 QString categoryList = attList[1] ;
171 event->setCategories( lookupCategories( categoryList ) ); 173 event->setCategories( lookupCategories( categoryList ) );
172 174
173 // strange 0 semms to mean: alarm enabled 175 // strange 0 semms to mean: alarm enabled
174 if ( attList[8] == "0" ) { 176 if ( attList[8] == "0" ) {
175 Alarm *alarm; 177 Alarm *alarm;
176 if ( event->alarms().count() > 0 ) 178 if ( event->alarms().count() > 0 )
177 alarm = event->alarms().first(); 179 alarm = event->alarms().first();
178 else { 180 else {
179 alarm = new Alarm( event ); 181 alarm = new Alarm( event );
180 event->addAlarm( alarm ); 182 event->addAlarm( alarm );
181 } 183 }
182 alarm->setType( Alarm::Audio ); 184 alarm->setType( Alarm::Audio );
183 alarm->setEnabled( true ); 185 alarm->setEnabled( true );
184 int alarmOffset = attList[9].toInt(); 186 int alarmOffset = attList[9].toInt();
185 alarm->setStartOffset( alarmOffset * -60 ); 187 alarm->setStartOffset( alarmOffset * -60 );
188 } else {
189 Alarm *alarm;
190 if ( event->alarms().count() > 0 ) {
191 alarm = event->alarms().first();
192 alarm->setEnabled( false );
193 }
186 } 194 }
187 195
188 mCalendar->addEvent( event); 196 mCalendar->addEvent( event);
189 } else if ( qName == "Todo" ) { 197 } else if ( qName == "Todo" ) {
190 Todo *todo; 198 Todo *todo;
191 199
192 todo = existingCalendar->todo( "Sharp_DTM", attList[0] ); 200 todo = existingCalendar->todo( "Sharp_DTM", attList[0] );
193 if (todo ) 201 if (todo )
194 todo = (Todo*)todo->clone(); 202 todo = (Todo*)todo->clone();
195 else 203 else
196 todo = new Todo; 204 todo = new Todo;
197 205
198//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 206//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1
199// 0 1 2 3 4 5 6 7 8 207// 0 1 2 3 4 5 6 7 8
200//1,,,,,1,4,Loch zumachen,"" 208//1,,,,,1,4,Loch zumachen,""
201//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " 209//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
202//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes 210//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes
203 211
204 todo->setID( "Sharp_DTM", attList[0]); 212 todo->setID( "Sharp_DTM", attList[0]);
205 todo->setCsum( "Sharp_DTM", QString::number( cSum )); 213 todo->setCsum( "Sharp_DTM", QString::number( cSum ));
206 todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 214 todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
207 215
208 todo->setSummary( attList[7] ); 216 todo->setSummary( attList[7] );
209 todo->setDescription( attList[8]); 217 todo->setDescription( attList[8]);
210 218
211 int priority = attList[6].toInt(); 219 int priority = attList[6].toInt();
212 if ( priority == 0 ) priority = 3; 220 if ( priority == 0 ) priority = 3;
213 todo->setPriority( priority ); 221 todo->setPriority( priority );
214 222
215 QString categoryList = attList[1]; 223 QString categoryList = attList[1];
216 todo->setCategories( lookupCategories( categoryList ) ); 224 todo->setCategories( lookupCategories( categoryList ) );
217 225
218 226
219 227
220 QString hasDateStr = attList[3]; // due 228 QString hasDateStr = attList[3]; // due
221 if ( !hasDateStr.isEmpty() ) { 229 if ( !hasDateStr.isEmpty() ) {
222 if ( hasDateStr.right(6) == "000000" ) { 230 if ( hasDateStr.right(6) == "000000" ) {
223 todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); 231 todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) );
224 todo->setFloats( true ); 232 todo->setFloats( true );
225 } 233 }
226 else { 234 else {
227 todo->setDtDue( fromString( hasDateStr ) ); 235 todo->setDtDue( fromString( hasDateStr ) );
228 todo->setFloats( false ); 236 todo->setFloats( false );
229 } 237 }
230 238
231 todo->setHasDueDate( true ); 239 todo->setHasDueDate( true );
232 } 240 }
233 hasDateStr = attList[2];//start 241 hasDateStr = attList[2];//start
234 if ( !hasDateStr.isEmpty() ) { 242 if ( !hasDateStr.isEmpty() ) {
235 243
236 todo->setDtStart( fromString( hasDateStr ) ); 244 todo->setDtStart( fromString( hasDateStr ) );
237 todo->setHasStartDate( true); 245 todo->setHasStartDate( true);
238 } else 246 } else
239 todo->setHasStartDate( false ); 247 todo->setHasStartDate( false );
240 hasDateStr = attList[4];//completed 248 hasDateStr = attList[4];//completed
241 if ( !hasDateStr.isEmpty() ) { 249 if ( !hasDateStr.isEmpty() ) {
242 todo->setCompleted(fromString( hasDateStr ) ); 250 todo->setCompleted(fromString( hasDateStr ) );
243 } 251 }
244 QString completedStr = attList[5]; 252 QString completedStr = attList[5];
245 if ( completedStr == "0" ) 253 if ( completedStr == "0" )
246 todo->setCompleted( true ); 254 todo->setCompleted( true );
247 else 255 else
248 todo->setCompleted( false ); 256 todo->setCompleted( false );
249 mCalendar->addTodo( todo ); 257 mCalendar->addTodo( todo );
250 258
251 } else if ( qName == "Category" ) { 259 } else if ( qName == "Category" ) {
252 /* 260 /*
253 QString id = attributes.value( "id" ); 261 QString id = attributes.value( "id" );
254 QString name = attributes.value( "name" ); 262 QString name = attributes.value( "name" );
255 setCategory( id, name ); 263 setCategory( id, name );
256 */ 264 */
257 } 265 }
258 //qDebug("end "); 266 //qDebug("end ");
259 return true; 267 return true;
260 } 268 }
261 269
262 270
263 void setCategoriesList ( QStringList * c ) 271 void setCategoriesList ( QStringList * c )
264 { 272 {
265 oldCategories = c; 273 oldCategories = c;
266 } 274 }
267 275
268 QDateTime fromString ( QString s, bool useTz = true ) { 276 QDateTime fromString ( QString s, bool useTz = true ) {
269 QDateTime dt; 277 QDateTime dt;
270 int y,m,t,h,min,sec; 278 int y,m,t,h,min,sec;
271 y = s.mid(0,4).toInt(); 279 y = s.mid(0,4).toInt();
272 m = s.mid(4,2).toInt(); 280 m = s.mid(4,2).toInt();
273 t = s.mid(6,2).toInt(); 281 t = s.mid(6,2).toInt();
274 h = s.mid(9,2).toInt(); 282 h = s.mid(9,2).toInt();
275 min = s.mid(11,2).toInt(); 283 min = s.mid(11,2).toInt();
276 sec = s.mid(13,2).toInt(); 284 sec = s.mid(13,2).toInt();
277 dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); 285 dt = QDateTime(QDate(y,m,t), QTime(h,min,sec));
278 int offset = KGlobal::locale()->localTimeOffset( dt ); 286 int offset = KGlobal::locale()->localTimeOffset( dt );
279 if ( useTz ) 287 if ( useTz )
280 dt = dt.addSecs ( offset*60); 288 dt = dt.addSecs ( offset*60);
281 return dt; 289 return dt;
282 290
283 } 291 }
284 protected: 292 protected:
285 QDateTime toDateTime( const QString &value ) 293 QDateTime toDateTime( const QString &value )
286 { 294 {
287 QDateTime dt; 295 QDateTime dt;
288 dt.setTime_t( value.toUInt() ); 296 dt.setTime_t( value.toUInt() );
289 297
290 return dt; 298 return dt;
291 } 299 }
292 300
293 QStringList lookupCategories( const QString &categoryList ) 301 QStringList lookupCategories( const QString &categoryList )
294 { 302 {
295 QStringList categoryIds = QStringList::split( ";", categoryList ); 303 QStringList categoryIds = QStringList::split( ";", categoryList );
296 QStringList categories; 304 QStringList categories;
297 QStringList::ConstIterator it; 305 QStringList::ConstIterator it;
298 for( it = categoryIds.begin(); it != categoryIds.end(); ++it ) { 306 for( it = categoryIds.begin(); it != categoryIds.end(); ++it ) {
299 QString cate = category( *it ); 307 QString cate = category( *it );
300 if ( oldCategories ) { 308 if ( oldCategories ) {
301 if ( ! oldCategories->contains( cate ) ) 309 if ( ! oldCategories->contains( cate ) )
302 oldCategories->append( cate ); 310 oldCategories->append( cate );
303 } 311 }
304 categories.append(cate ); 312 categories.append(cate );
305 } 313 }
306 return categories; 314 return categories;
307 } 315 }
308 316
309 private: 317 private:
310 Calendar *mCalendar; 318 Calendar *mCalendar;
311 QStringList * oldCategories; 319 QStringList * oldCategories;
312 static QString category( const QString &id ) 320 static QString category( const QString &id )
313 { 321 {
314 QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id ); 322 QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id );
315 if ( it == mCategoriesMap.end() ) return id; 323 if ( it == mCategoriesMap.end() ) return id;
316 else return *it; 324 else return *it;
317 } 325 }
318 326
319 static void setCategory( const QString &id, const QString &name ) 327 static void setCategory( const QString &id, const QString &name )
320 { 328 {
321 mCategoriesMap.insert( id, name ); 329 mCategoriesMap.insert( id, name );
322 } 330 }
323 331
324 static QMap<QString,QString> mCategoriesMap; 332 static QMap<QString,QString> mCategoriesMap;
325}; 333};
326 334
327QMap<QString,QString> SharpParser::mCategoriesMap; 335QMap<QString,QString> SharpParser::mCategoriesMap;
328 336
329SharpFormat::SharpFormat() 337SharpFormat::SharpFormat()
330{ 338{
331 mCategories = 0; 339 mCategories = 0;
332} 340}
333 341
334SharpFormat::~SharpFormat() 342SharpFormat::~SharpFormat()
335{ 343{
336} 344}
337ulong SharpFormat::getCsum( const QStringList & attList) 345ulong SharpFormat::getCsum( const QStringList & attList)
338{ 346{
339 int max = attList.count() -1; 347 int max = attList.count() -1;
340 ulong cSum = 0; 348 ulong cSum = 0;
341 int j,k,i; 349 int j,k,i;
342 int add; 350 int add;
343 for ( i = 1; i < max ; ++i ) { 351 for ( i = 1; i < max ; ++i ) {
344 QString s = attList[i]; 352 QString s = attList[i];
345 if ( ! s.isEmpty() ){ 353 if ( ! s.isEmpty() ){
346 j = s.length(); 354 j = s.length();
347 for ( k = 0; k < j; ++k ) { 355 for ( k = 0; k < j; ++k ) {
348 int mul = k +1; 356 int mul = k +1;
349 add = s[k].unicode (); 357 add = s[k].unicode ();
350 if ( k < 16 ) 358 if ( k < 16 )
351 mul = mul * mul; 359 mul = mul * mul;
352 add = add * mul *i*i*i; 360 add = add * mul *i*i*i;
353 cSum += add; 361 cSum += add;
354 } 362 }
355 } 363 }
356 } 364 }
357 return cSum; 365 return cSum;
358 366
359} 367}
360#include <stdlib.h> 368#include <stdlib.h>
361#define DEBUGMODE false 369#define DEBUGMODE false
362bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) 370bool SharpFormat::load( Calendar *calendar, Calendar *existngCal )
363{ 371{
364 372
365 373
366 bool debug = DEBUGMODE; 374 bool debug = DEBUGMODE;
367 //debug = true; 375 //debug = true;
368 QString text; 376 QString text;
369 QString codec = "utf8"; 377 QString codec = "utf8";
370 QLabel status ( i18n("Reading events ..."), 0 ); 378 QLabel status ( i18n("Reading events ..."), 0 );
371 379
372 int w = status.sizeHint().width()+20 ; 380 int w = status.sizeHint().width()+20 ;
373 if ( w < 200 ) w = 200; 381 if ( w < 200 ) w = 200;
374 int h = status.sizeHint().height()+20 ; 382 int h = status.sizeHint().height()+20 ;
375 int dw = QApplication::desktop()->width(); 383 int dw = QApplication::desktop()->width();
376 int dh = QApplication::desktop()->height(); 384 int dh = QApplication::desktop()->height();
377 status.setCaption(i18n("Reading DTM Data") ); 385 status.setCaption(i18n("Reading DTM Data") );