-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 34 |
2 files changed, 26 insertions, 10 deletions
@@ -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.3) on: Mon Aug 9 12:10:32 2004 | 3 | # Generated by qmake (1.07a) (Qt 3.3.3) on: Mon Aug 9 13:18:13 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 |
11 | DEL_FILE = rm -f | 11 | DEL_FILE = rm -f |
12 | CHK_DIR_EXISTS= test -d | 12 | CHK_DIR_EXISTS= test -d |
13 | MKDIR = mkdir -p | 13 | MKDIR = mkdir -p |
14 | INSTALL_FILE= | 14 | INSTALL_FILE= |
15 | INSTALL_DIR = | 15 | INSTALL_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 | ||
28 | first: all | 28 | first: all |
29 | 29 | ||
30 | all: Makefile $(SUBTARGETS) | 30 | all: Makefile $(SUBTARGETS) |
31 | 31 | ||
32 | gammu/emb/common/$(MAKEFILE): | 32 | gammu/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) |
35 | sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE | 35 | sub-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 | ||
38 | libical/$(MAKEFILE): | 38 | libical/$(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) |
41 | sub-libical: libical/$(MAKEFILE) FORCE | 41 | sub-libical: libical/$(MAKEFILE) FORCE |
42 | cd libical && $(MAKE) -f $(MAKEFILE) | 42 | cd libical && $(MAKE) -f $(MAKEFILE) |
43 | 43 | ||
44 | libkcal/$(MAKEFILE): | 44 | libkcal/$(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) |
47 | sub-libkcal: libkcal/$(MAKEFILE) FORCE | 47 | sub-libkcal: libkcal/$(MAKEFILE) FORCE |
48 | cd libkcal && $(MAKE) -f $(MAKEFILE) | 48 | cd libkcal && $(MAKE) -f $(MAKEFILE) |
49 | 49 | ||
50 | microkde/$(MAKEFILE): | 50 | microkde/$(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) |
53 | sub-microkde: microkde/$(MAKEFILE) FORCE | 53 | sub-microkde: microkde/$(MAKEFILE) FORCE |
54 | cd microkde && $(MAKE) -f $(MAKEFILE) | 54 | cd microkde && $(MAKE) -f $(MAKEFILE) |
55 | 55 | ||
56 | libkdepim/$(MAKEFILE): | 56 | libkdepim/$(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) |
59 | sub-libkdepim: libkdepim/$(MAKEFILE) FORCE | 59 | sub-libkdepim: libkdepim/$(MAKEFILE) FORCE |
60 | cd libkdepim && $(MAKE) -f $(MAKEFILE) | 60 | cd libkdepim && $(MAKE) -f $(MAKEFILE) |
61 | 61 | ||
62 | kabc/$(MAKEFILE): | 62 | kabc/$(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) |
65 | sub-kabc: kabc/$(MAKEFILE) FORCE | 65 | sub-kabc: kabc/$(MAKEFILE) FORCE |
66 | cd kabc && $(MAKE) -f $(MAKEFILE) | 66 | cd kabc && $(MAKE) -f $(MAKEFILE) |
67 | 67 | ||
68 | korganizer/$(MAKEFILE): | 68 | korganizer/$(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) |
71 | sub-korganizer: korganizer/$(MAKEFILE) FORCE | 71 | sub-korganizer: korganizer/$(MAKEFILE) FORCE |
72 | cd korganizer && $(MAKE) -f $(MAKEFILE) | 72 | cd korganizer && $(MAKE) -f $(MAKEFILE) |
73 | 73 | ||
74 | kaddressbook/$(MAKEFILE): | 74 | kaddressbook/$(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) |
77 | sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE | 77 | sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE |
78 | cd kaddressbook && $(MAKE) -f $(MAKEFILE) | 78 | cd kaddressbook && $(MAKE) -f $(MAKEFILE) |
79 | 79 | ||
80 | kabc/plugins/file/$(MAKEFILE): | 80 | kabc/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) |
83 | sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE | 83 | sub-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 | ||
86 | kabc/plugins/dir/$(MAKEFILE): | 86 | kabc/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) |
89 | sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE | 89 | sub-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 | ||
92 | Makefile: kopi-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf | 92 | Makefile: 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 |
94 | qmake: qmake_all | 94 | qmake: 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 | ||
97 | all: $(SUBTARGETS) | 97 | all: $(SUBTARGETS) |
98 | qmake_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) | 98 | qmake_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 |
109 | clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE | 109 | clean 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 |
120 | uninstall_subdirs: qmake_all FORCE | 120 | uninstall_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 |
131 | install_subdirs: qmake_all FORCE | 131 | install_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 |
142 | distclean: qmake_all FORCE | 142 | distclean: 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 | ||
154 | install: install_subdirs | 154 | install: install_subdirs |
155 | 155 | ||
156 | uninstall: uninstall_subdirs | 156 | uninstall: uninstall_subdirs |
157 | 157 | ||
158 | FORCE: | 158 | FORCE: |
159 | 159 | ||
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index bc1b863..596148e 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -1,1170 +1,1186 @@ | |||
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 | ||
47 | using namespace KCal; | 47 | using namespace KCal; |
48 | 48 | ||
49 | class PhoneParser : public QObject | 49 | class PhoneParser : public QObject |
50 | { | 50 | { |
51 | public: | 51 | public: |
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 = "na"; | 161 | QString alarmString = "na"; |
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 { | 175 | } else { |
176 | Alarm *alarm; | 176 | Alarm *alarm; |
177 | if ( todo->alarms().count() > 0 ) { | 177 | if ( todo->alarms().count() > 0 ) { |
178 | alarm = todo->alarms().first(); | 178 | alarm = todo->alarms().first(); |
179 | alarm->setType( Alarm::Audio ); | 179 | alarm->setType( Alarm::Audio ); |
180 | alarm->setStartOffset( -60*15 ); | 180 | alarm->setStartOffset( -60*15 ); |
181 | alarm->setEnabled( false ); | 181 | alarm->setEnabled( false ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | // csum ***************************************** | 184 | // csum ***************************************** |
185 | QStringList attList; | 185 | QStringList attList; |
186 | uint cSum; | 186 | uint cSum; |
187 | if ( todo->hasDueDate() ) | 187 | if ( todo->hasDueDate() ) |
188 | attList << dtToString ( todo->dtDue() ); | 188 | attList << dtToString ( todo->dtDue() ); |
189 | attList << QString::number( id ); | 189 | attList << QString::number( id ); |
190 | attList << todo->summary(); | 190 | attList << todo->summary(); |
191 | attList << completedString; | 191 | attList << completedString; |
192 | attList << QString::number( todo->priority() ); | 192 | attList << QString::number( todo->priority() ); |
193 | attList << alarmString; | 193 | attList << alarmString; |
194 | attList << todo->categoriesStr(); | 194 | attList << todo->categoriesStr(); |
195 | attList << todo->secrecyStr(); | 195 | attList << todo->secrecyStr(); |
196 | cSum = PhoneFormat::getCsum(attList ); | 196 | cSum = PhoneFormat::getCsum(attList ); |
197 | todo->setCsum( mProfileName, QString::number( cSum )); | 197 | todo->setCsum( mProfileName, QString::number( cSum )); |
198 | mCalendar->addTodo( todo); | 198 | mCalendar->addTodo( todo); |
199 | 199 | ||
200 | return true; | 200 | return true; |
201 | } | 201 | } |
202 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) | 202 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) |
203 | { | 203 | { |
204 | 204 | ||
205 | int id = Note->Location; | 205 | int id = Note->Location; |
206 | Event *event; | 206 | Event *event; |
207 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); | 207 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); |
208 | if ( event ) | 208 | if ( event ) |
209 | event = (Event*)event->clone(); | 209 | event = (Event*)event->clone(); |
210 | else | 210 | else |
211 | event = new Event; | 211 | event = new Event; |
212 | event->setID( mProfileName,QString::number( id ) ); | 212 | event->setID( mProfileName,QString::number( id ) ); |
213 | event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); | 213 | event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); |
214 | 214 | ||
215 | 215 | ||
216 | int i = 0; | 216 | int i = 0; |
217 | bool repeating = false; | 217 | bool repeating = false; |
218 | int repeat_dayofweek = -1; | 218 | int repeat_dayofweek = -1; |
219 | int repeat_day = -1; | 219 | int repeat_day = -1; |
220 | int repeat_weekofmonth = -1; | 220 | int repeat_weekofmonth = -1; |
221 | int repeat_month = -1; | 221 | int repeat_month = -1; |
222 | int repeat_frequency = -1; | 222 | int repeat_frequency = -1; |
223 | int rec_type = -1; | 223 | int rec_type = -1; |
224 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; | 224 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; |
225 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; | 225 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; |
226 | GSM_DateTime* dtp; | 226 | GSM_DateTime* dtp; |
227 | bool alarm = false; | 227 | bool alarm = false; |
228 | QDateTime alarmDt; | 228 | QDateTime alarmDt; |
229 | repeat_startdate.Day= 0; | 229 | repeat_startdate.Day= 0; |
230 | repeat_stopdate.Day = 0; | 230 | repeat_stopdate.Day = 0; |
231 | for (i=0;i<Note->EntriesNum;i++) { | 231 | for (i=0;i<Note->EntriesNum;i++) { |
232 | 232 | ||
233 | //qDebug(" for ev"); | 233 | //qDebug(" for ev"); |
234 | switch (Note->Entries[i].EntryType) { | 234 | switch (Note->Entries[i].EntryType) { |
235 | case CAL_START_DATETIME: | 235 | case CAL_START_DATETIME: |
236 | dtp = &Note->Entries[i].Date ; | 236 | dtp = &Note->Entries[i].Date ; |
237 | if ( dtp->Hour > 24 ) { | 237 | if ( dtp->Hour > 24 ) { |
238 | event->setFloats( true ); | 238 | event->setFloats( true ); |
239 | event->setDtStart( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); | 239 | event->setDtStart( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); |
240 | } else { | 240 | } else { |
241 | event->setDtStart (fromGSM ( dtp )); | 241 | event->setDtStart (fromGSM ( dtp )); |
242 | 242 | ||
243 | } | 243 | } |
244 | break; | 244 | break; |
245 | case CAL_END_DATETIME: | 245 | case CAL_END_DATETIME: |
246 | dtp = &Note->Entries[i].Date ; | 246 | dtp = &Note->Entries[i].Date ; |
247 | if ( dtp->Hour > 24 ) { | 247 | if ( dtp->Hour > 24 ) { |
248 | event->setFloats( true ); | 248 | event->setFloats( true ); |
249 | event->setDtEnd( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); | 249 | event->setDtEnd( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); |
250 | } else { | 250 | } else { |
251 | event->setDtEnd (fromGSM ( dtp )); | 251 | event->setDtEnd (fromGSM ( dtp )); |
252 | } | 252 | } |
253 | break; | 253 | break; |
254 | case CAL_ALARM_DATETIME: | 254 | case CAL_ALARM_DATETIME: |
255 | dtp = &Note->Entries[i].Date ; | 255 | dtp = &Note->Entries[i].Date ; |
256 | alarm = true; | 256 | alarm = true; |
257 | alarmDt = fromGSM ( dtp ); | 257 | alarmDt = fromGSM ( dtp ); |
258 | break; | 258 | break; |
259 | case CAL_SILENT_ALARM_DATETIME: | 259 | case CAL_SILENT_ALARM_DATETIME: |
260 | dtp = &Note->Entries[i].Date ; | 260 | dtp = &Note->Entries[i].Date ; |
261 | alarm = true; | 261 | alarm = true; |
262 | alarmDt = fromGSM ( dtp ); | 262 | alarmDt = fromGSM ( dtp ); |
263 | break; | 263 | break; |
264 | case CAL_RECURRANCE: | 264 | case CAL_RECURRANCE: |
265 | rec_type = Note->Entries[i].Number; | 265 | rec_type = Note->Entries[i].Number; |
266 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); | 266 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); |
267 | break; | 267 | break; |
268 | case CAL_TEXT: | 268 | case CAL_TEXT: |
269 | //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); | 269 | //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); |
270 | event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); | 270 | event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); |
271 | break; | 271 | break; |
272 | case CAL_LOCATION: | 272 | case CAL_LOCATION: |
273 | event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); | 273 | event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); |
274 | break; | 274 | break; |
275 | case CAL_PHONE: | 275 | case CAL_PHONE: |
276 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); | 276 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); |
277 | break; | 277 | break; |
278 | case CAL_PRIVATE: | 278 | case CAL_PRIVATE: |
279 | if ( Note->Entries[i].Number == 1 ) | 279 | if ( Note->Entries[i].Number == 1 ) |
280 | event->setSecrecy( Incidence::SecrecyPrivate ); | 280 | event->setSecrecy( Incidence::SecrecyPrivate ); |
281 | else | 281 | else |
282 | event->setSecrecy( Incidence::SecrecyPublic ); | 282 | event->setSecrecy( Incidence::SecrecyPublic ); |
283 | 283 | ||
284 | break; | 284 | break; |
285 | case CAL_CONTACTID: | 285 | case CAL_CONTACTID: |
286 | #if 0 | 286 | #if 0 |
287 | entry.Location = Note->Entries[i].Number; | 287 | entry.Location = Note->Entries[i].Number; |
288 | entry.MemoryType = MEM_ME; | 288 | entry.MemoryType = MEM_ME; |
289 | error=Phone->GetMemory(&s, &entry); | 289 | error=Phone->GetMemory(&s, &entry); |
290 | if (error == ERR_NONE) { | 290 | if (error == ERR_NONE) { |
291 | name = GSM_PhonebookGetEntryName(&entry); | 291 | name = GSM_PhonebookGetEntryName(&entry); |
292 | if (name != NULL) { | 292 | if (name != NULL) { |
293 | //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); | 293 | //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); |
294 | } else { | 294 | } else { |
295 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); | 295 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); |
296 | } | 296 | } |
297 | } else { | 297 | } else { |
298 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); | 298 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); |
299 | } | 299 | } |
300 | #endif | 300 | #endif |
301 | break; | 301 | break; |
302 | case CAL_REPEAT_DAYOFWEEK: | 302 | case CAL_REPEAT_DAYOFWEEK: |
303 | repeat_dayofweek = Note->Entries[i].Number; | 303 | repeat_dayofweek = Note->Entries[i].Number; |
304 | repeating = true; | 304 | repeating = true; |
305 | break; | 305 | break; |
306 | case CAL_REPEAT_DAY: | 306 | case CAL_REPEAT_DAY: |
307 | repeat_day = Note->Entries[i].Number; | 307 | repeat_day = Note->Entries[i].Number; |
308 | repeating = true; | 308 | repeating = true; |
309 | break; | 309 | break; |
310 | case CAL_REPEAT_WEEKOFMONTH: | 310 | case CAL_REPEAT_WEEKOFMONTH: |
311 | repeat_weekofmonth = Note->Entries[i].Number; | 311 | repeat_weekofmonth = Note->Entries[i].Number; |
312 | repeating = true; | 312 | repeating = true; |
313 | break; | 313 | break; |
314 | case CAL_REPEAT_MONTH: | 314 | case CAL_REPEAT_MONTH: |
315 | repeat_month = Note->Entries[i].Number; | 315 | repeat_month = Note->Entries[i].Number; |
316 | repeating = true; | 316 | repeating = true; |
317 | break; | 317 | break; |
318 | case CAL_REPEAT_FREQUENCY: | 318 | case CAL_REPEAT_FREQUENCY: |
319 | repeat_frequency = Note->Entries[i].Number; | 319 | repeat_frequency = Note->Entries[i].Number; |
320 | repeating = true; | 320 | repeating = true; |
321 | break; | 321 | break; |
322 | case CAL_REPEAT_STARTDATE: | 322 | case CAL_REPEAT_STARTDATE: |
323 | repeat_startdate = Note->Entries[i].Date; | 323 | repeat_startdate = Note->Entries[i].Date; |
324 | repeating = true; | 324 | repeating = true; |
325 | break; | 325 | break; |
326 | case CAL_REPEAT_STOPDATE: | 326 | case CAL_REPEAT_STOPDATE: |
327 | repeat_stopdate = Note->Entries[i].Date; | 327 | repeat_stopdate = Note->Entries[i].Date; |
328 | repeating = true; | 328 | repeating = true; |
329 | break; | 329 | break; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | #if 0 | 332 | #if 0 |
333 | event->setDescription( attList[4] ); | 333 | event->setDescription( attList[4] ); |
334 | bool repeating = false; | 334 | bool repeating = false; |
335 | int repeat_dayofweek = -1; | 335 | int repeat_dayofweek = -1; |
336 | int repeat_day = -1; | 336 | int repeat_day = -1; |
337 | int repeat_weekofmonth = -1; | 337 | int repeat_weekofmonth = -1; |
338 | int repeat_month = -1; | 338 | int repeat_month = -1; |
339 | int repeat_frequency = -1; | 339 | int repeat_frequency = -1; |
340 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; | 340 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; |
341 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; | 341 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; |
342 | 342 | ||
343 | #endif | 343 | #endif |
344 | 344 | ||
345 | QString recurString = "no"; | 345 | QString recurString = "no"; |
346 | if ( repeating ) { | 346 | if ( repeating && repeat_frequency != -1) { |
347 | recurString = "y"; | 347 | recurString = "y"; |
348 | if ( repeat_dayofweek >= 0 ) | 348 | if ( repeat_dayofweek >= 0 ) |
349 | recurString += "dow" + QString::number (repeat_dayofweek); | 349 | recurString += "dow" + QString::number (repeat_dayofweek); |
350 | if ( repeat_day >= 0 ) | 350 | if ( repeat_day >= 0 ) |
351 | recurString += "d" + QString::number (repeat_day); | 351 | recurString += "d" + QString::number (repeat_day); |
352 | if ( repeat_weekofmonth >= 0 ) | 352 | if ( repeat_weekofmonth >= 0 ) |
353 | recurString += "w" + QString::number (repeat_weekofmonth); | 353 | recurString += "w" + QString::number (repeat_weekofmonth); |
354 | if ( repeat_month >= 0 ) | 354 | if ( repeat_month >= 0 ) |
355 | recurString += "m" + QString::number ( repeat_month ); | 355 | recurString += "m" + QString::number ( repeat_month ); |
356 | if ( repeat_frequency >= 0 ) | 356 | if ( repeat_frequency >= 0 ) |
357 | recurString += "f" + QString::number (repeat_frequency ); | 357 | recurString += "f" + QString::number (repeat_frequency ); |
358 | 358 | ||
359 | int rtype = 0; | 359 | int rtype = 0; |
360 | // qDebug("recurs "); | 360 | // qDebug("recurs "); |
361 | QDate startDate, endDate; | 361 | QDate startDate, endDate; |
362 | if ( repeat_startdate.Day > 0 ) | 362 | if ( repeat_startdate.Day > 0 ) { |
363 | startDate = datefromGSM ( &repeat_startdate ); | 363 | startDate = datefromGSM ( &repeat_startdate ); |
364 | else | 364 | event->setDtStart(QDateTime ( startDate, event->dtStart().time())); |
365 | } else { | ||
365 | startDate = event->dtStart().date(); | 366 | startDate = event->dtStart().date(); |
367 | } | ||
366 | int freq = repeat_frequency; | 368 | int freq = repeat_frequency; |
367 | bool hasEndDate = false; | 369 | bool hasEndDate = false; |
368 | if ( repeat_stopdate.Day > 0 ) { | 370 | if ( repeat_stopdate.Day > 0 ) { |
369 | endDate = datefromGSM ( &repeat_stopdate ); | 371 | endDate = datefromGSM ( &repeat_stopdate ); |
370 | hasEndDate = true; | 372 | hasEndDate = true; |
371 | } | 373 | } |
372 | 374 | ||
373 | uint weekDaysNum = repeat_dayofweek ; | 375 | uint weekDaysNum = repeat_dayofweek ; |
374 | 376 | // 1 == monday, 7 == sunday | |
375 | QBitArray weekDays( 7 ); | 377 | QBitArray weekDays( 7 ); |
376 | int i; | 378 | int i; |
377 | int bb = 1; | 379 | int bb = 1; |
378 | for( i = 1; i <= 7; ++i ) { | 380 | for( i = 1; i <= 7; ++i ) { |
379 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); | 381 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); |
380 | bb = 2 << (i-1); | 382 | bb = 2 << (i-1); |
381 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); | 383 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); |
382 | } | 384 | } |
383 | // qDebug("next "); | 385 | // qDebug("next "); |
384 | int pos = 0; | 386 | int pos = 0; |
385 | Recurrence *r = event->recurrence(); | 387 | Recurrence *r = event->recurrence(); |
386 | /* | 388 | /* |
387 | 0 daily; | 389 | 0 daily; |
388 | 1 weekly;x | 390 | 1 weekly;x |
389 | 2 monthpos;x | 391 | 2 monthpos;x |
390 | 3 monthlyday; | 392 | 3 monthlyday; |
391 | 4 rYearlyMont | 393 | 4 rYearlyMont |
392 | bool repeating = false; | 394 | bool repeating = false; |
393 | int repeat_dayofweek = -1; | 395 | int repeat_dayofweek = -1; |
394 | int repeat_day = -1; | 396 | int repeat_day = -1; |
395 | int repeat_weekofmonth = -1; | 397 | int repeat_weekofmonth = -1; |
396 | int repeat_month = -1; | 398 | int repeat_month = -1; |
397 | int repeat_frequency = -1; | 399 | int repeat_frequency = -1; |
398 | */ | 400 | */ |
399 | int dayOfWeek = startDate.dayOfWeek(); | 401 | int dayOfWeek = startDate.dayOfWeek(); |
400 | if ( repeat_weekofmonth >= 0 ) { | 402 | if ( repeat_weekofmonth >= 0 ) { |
401 | rtype = 2; | 403 | rtype = 2; // ************************ 2 MonthlyPos |
402 | pos = repeat_weekofmonth; | 404 | pos = repeat_weekofmonth; |
403 | if ( repeat_dayofweek >= 0 ) | 405 | if ( repeat_dayofweek >= 0 ) |
404 | dayOfWeek = repeat_dayofweek; | 406 | dayOfWeek = repeat_dayofweek; |
407 | if (repeat_month > 0) { | ||
408 | if ( repeat_month != event->dtStart().date().month() ) { | ||
409 | QDate date (event->dtStart().date().year(),repeat_month,event->dtStart().date().day() ); | ||
410 | event->setDtStart(QDateTime ( date , event->dtStart().time()) ); | ||
411 | } | ||
412 | if ( freq == 1 ) | ||
413 | freq = 12; | ||
414 | } | ||
405 | } else if ( repeat_dayofweek >= 0 ) { | 415 | } else if ( repeat_dayofweek >= 0 ) { |
406 | rtype = 1; | 416 | rtype = 1;// ************************ 1 Weekly |
407 | } if ( repeat_dayofweek >= 0 ) { | 417 | } else if ( repeat_day >= 0 ) { |
408 | rtype = 1; | 418 | if ( repeat_month > 0) { |
419 | rtype = 4; | ||
420 | } else { | ||
421 | rtype = 3; | ||
422 | } | ||
423 | } else { | ||
424 | rtype = 0 ; | ||
409 | } | 425 | } |
410 | 426 | ||
411 | if ( rtype == 0 ) { | 427 | if ( rtype == 0 ) { |
412 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 428 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
413 | else r->setDaily( freq, -1 ); | 429 | else r->setDaily( freq, -1 ); |
414 | } else if ( rtype == 1 ) { | 430 | } else if ( rtype == 1 ) { |
415 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); | 431 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); |
416 | else r->setWeekly( freq, weekDays, -1 ); | 432 | else r->setWeekly( freq, weekDays, -1 ); |
417 | } else if ( rtype == 3 ) { | 433 | } else if ( rtype == 3 ) { |
418 | if ( hasEndDate ) | 434 | if ( hasEndDate ) |
419 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 435 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
420 | else | 436 | else |
421 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); | 437 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); |
422 | r->addMonthlyDay( startDate.day() ); | 438 | r->addMonthlyDay( startDate.day() ); |
423 | } else if ( rtype == 2 ) { | 439 | } else if ( rtype == 2 ) { |
424 | if ( hasEndDate ) | 440 | if ( hasEndDate ) |
425 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 441 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
426 | else | 442 | else |
427 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); | 443 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); |
428 | QBitArray days( 7 ); | 444 | QBitArray days( 7 ); |
429 | days.fill( false ); | 445 | days.fill( false ); |
430 | days.setBit( dayOfWeek - 1 ); | 446 | days.setBit( dayOfWeek - 1 ); |
431 | r->addMonthlyPos( pos, days ); | 447 | r->addMonthlyPos( pos, days ); |
432 | } else if ( rtype == 4 ) { | 448 | } else if ( rtype == 4 ) { |
433 | if ( hasEndDate ) | 449 | if ( hasEndDate ) |
434 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 450 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
435 | else | 451 | else |
436 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 452 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
437 | r->addYearlyNum( startDate.month() ); | 453 | r->addYearlyNum( startDate.month() ); |
438 | } | 454 | } |
439 | } else { | 455 | } else { |
440 | event->recurrence()->unsetRecurs(); | 456 | event->recurrence()->unsetRecurs(); |
441 | } | 457 | } |
442 | 458 | ||
443 | QStringList categoryList; | 459 | QStringList categoryList; |
444 | categoryList << getCategory( Note ); | 460 | categoryList << getCategory( Note ); |
445 | event->setCategories( categoryList ); | 461 | event->setCategories( categoryList ); |
446 | QString alarmString = "na"; | 462 | QString alarmString = "na"; |
447 | // strange 0 semms to mean: alarm enabled | 463 | // strange 0 semms to mean: alarm enabled |
448 | if ( alarm ) { | 464 | if ( alarm ) { |
449 | Alarm *alarm; | 465 | Alarm *alarm; |
450 | if ( event->alarms().count() > 0 ) | 466 | if ( event->alarms().count() > 0 ) |
451 | alarm = event->alarms().first(); | 467 | alarm = event->alarms().first(); |
452 | else { | 468 | else { |
453 | alarm = new Alarm( event ); | 469 | alarm = new Alarm( event ); |
454 | event->addAlarm( alarm ); | 470 | event->addAlarm( alarm ); |
455 | } | 471 | } |
456 | alarm->setType( Alarm::Audio ); | 472 | alarm->setType( Alarm::Audio ); |
457 | alarm->setEnabled( true ); | 473 | alarm->setEnabled( true ); |
458 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); | 474 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); |
459 | alarm->setStartOffset( -alarmOffset ); | 475 | alarm->setStartOffset( -alarmOffset ); |
460 | alarmString = QString::number( alarmOffset ); | 476 | alarmString = QString::number( alarmOffset ); |
461 | } else { | 477 | } else { |
462 | Alarm *alarm; | 478 | Alarm *alarm; |
463 | if ( event->alarms().count() > 0 ) { | 479 | if ( event->alarms().count() > 0 ) { |
464 | alarm = event->alarms().first(); | 480 | alarm = event->alarms().first(); |
465 | alarm->setType( Alarm::Audio ); | 481 | alarm->setType( Alarm::Audio ); |
466 | alarm->setStartOffset( -60*15 ); | 482 | alarm->setStartOffset( -60*15 ); |
467 | alarm->setEnabled( false ); | 483 | alarm->setEnabled( false ); |
468 | } | 484 | } |
469 | } | 485 | } |
470 | // csum ***************************************** | 486 | // csum ***************************************** |
471 | QStringList attList; | 487 | QStringList attList; |
472 | uint cSum; | 488 | uint cSum; |
473 | attList << dtToString ( event->dtStart() ); | 489 | attList << dtToString ( event->dtStart() ); |
474 | attList << dtToString ( event->dtEnd() ); | 490 | attList << dtToString ( event->dtEnd() ); |
475 | attList << QString::number( id ); | 491 | attList << QString::number( id ); |
476 | attList << event->summary(); | 492 | attList << event->summary(); |
477 | attList << event->location(); | 493 | attList << event->location(); |
478 | attList << alarmString; | 494 | attList << alarmString; |
479 | attList << recurString; | 495 | attList << recurString; |
480 | attList << event->categoriesStr(); | 496 | attList << event->categoriesStr(); |
481 | attList << event->secrecyStr(); | 497 | attList << event->secrecyStr(); |
482 | cSum = PhoneFormat::getCsum(attList ); | 498 | cSum = PhoneFormat::getCsum(attList ); |
483 | event->setCsum( mProfileName, QString::number( cSum )); | 499 | event->setCsum( mProfileName, QString::number( cSum )); |
484 | mCalendar->addEvent( event); | 500 | mCalendar->addEvent( event); |
485 | 501 | ||
486 | return true; | 502 | return true; |
487 | } | 503 | } |
488 | 504 | ||
489 | 505 | ||
490 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { | 506 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { |
491 | QDateTime dt; | 507 | QDateTime dt; |
492 | int y,m,t,h,min,sec; | 508 | int y,m,t,h,min,sec; |
493 | y = dtp->Year; | 509 | y = dtp->Year; |
494 | m = dtp->Month; | 510 | m = dtp->Month; |
495 | t = dtp->Day; | 511 | t = dtp->Day; |
496 | h = dtp->Hour; | 512 | h = dtp->Hour; |
497 | min = dtp->Minute; | 513 | min = dtp->Minute; |
498 | sec = dtp->Second; | 514 | sec = dtp->Second; |
499 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); | 515 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); |
500 | // dtp->Timezone: offset in hours | 516 | // dtp->Timezone: offset in hours |
501 | int offset = KGlobal::locale()->localTimeOffset( dt ); | 517 | int offset = KGlobal::locale()->localTimeOffset( dt ); |
502 | if ( useTz ) | 518 | if ( useTz ) |
503 | dt = dt.addSecs ( offset*60); | 519 | dt = dt.addSecs ( offset*60); |
504 | return dt; | 520 | return dt; |
505 | 521 | ||
506 | } | 522 | } |
507 | 523 | ||
508 | QString dtToString( const QDateTime& dti, bool useTZ = false ) | 524 | QString dtToString( const QDateTime& dti, bool useTZ = false ) |
509 | { | 525 | { |
510 | QString datestr; | 526 | QString datestr; |
511 | QString timestr; | 527 | QString timestr; |
512 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 528 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
513 | QDateTime dt; | 529 | QDateTime dt; |
514 | if (useTZ) | 530 | if (useTZ) |
515 | dt = dti.addSecs ( -(offset*60)); | 531 | dt = dti.addSecs ( -(offset*60)); |
516 | else | 532 | else |
517 | dt = dti; | 533 | dt = dti; |
518 | if(dt.date().isValid()){ | 534 | if(dt.date().isValid()){ |
519 | const QDate& date = dt.date(); | 535 | const QDate& date = dt.date(); |
520 | datestr.sprintf("%04d%02d%02d", | 536 | datestr.sprintf("%04d%02d%02d", |
521 | date.year(), date.month(), date.day()); | 537 | date.year(), date.month(), date.day()); |
522 | } | 538 | } |
523 | if(dt.time().isValid()){ | 539 | if(dt.time().isValid()){ |
524 | const QTime& time = dt.time(); | 540 | const QTime& time = dt.time(); |
525 | timestr.sprintf("T%02d%02d%02d", | 541 | timestr.sprintf("T%02d%02d%02d", |
526 | time.hour(), time.minute(), time.second()); | 542 | time.hour(), time.minute(), time.second()); |
527 | } | 543 | } |
528 | return datestr + timestr; | 544 | return datestr + timestr; |
529 | } | 545 | } |
530 | QDate datefromGSM ( GSM_DateTime*dtp ) { | 546 | QDate datefromGSM ( GSM_DateTime*dtp ) { |
531 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); | 547 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); |
532 | } | 548 | } |
533 | QString getCategory( GSM_CalendarEntry*Note) | 549 | QString getCategory( GSM_CalendarEntry*Note) |
534 | { | 550 | { |
535 | QString CATEGORY; | 551 | QString CATEGORY; |
536 | switch (Note->Type) { | 552 | switch (Note->Type) { |
537 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; | 553 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; |
538 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; | 554 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; |
539 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; | 555 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; |
540 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; | 556 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; |
541 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; | 557 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; |
542 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; | 558 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; |
543 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; | 559 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; |
544 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; | 560 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; |
545 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; | 561 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; |
546 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; | 562 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; |
547 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; | 563 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; |
548 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; | 564 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; |
549 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; | 565 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; |
550 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; | 566 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; |
551 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; | 567 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; |
552 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; | 568 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; |
553 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; | 569 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; |
554 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; | 570 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; |
555 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; | 571 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; |
556 | case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; | 572 | case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; |
557 | case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; | 573 | case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; |
558 | case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; | 574 | case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; |
559 | case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; | 575 | case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; |
560 | case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; | 576 | case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; |
561 | case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; | 577 | case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; |
562 | case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; | 578 | case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; |
563 | case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; | 579 | case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; |
564 | case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; | 580 | case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; |
565 | default : CATEGORY = QString(""); | 581 | default : CATEGORY = QString(""); |
566 | } | 582 | } |
567 | 583 | ||
568 | return CATEGORY; | 584 | return CATEGORY; |
569 | } | 585 | } |
570 | 586 | ||
571 | protected: | 587 | protected: |
572 | private: | 588 | private: |
573 | Calendar *mCalendar; | 589 | Calendar *mCalendar; |
574 | QString mProfileName ; | 590 | QString mProfileName ; |
575 | }; | 591 | }; |
576 | 592 | ||
577 | 593 | ||
578 | PhoneFormat::PhoneFormat() | 594 | PhoneFormat::PhoneFormat() |
579 | { | 595 | { |
580 | ; | 596 | ; |
581 | } | 597 | } |
582 | 598 | ||
583 | PhoneFormat::~PhoneFormat() | 599 | PhoneFormat::~PhoneFormat() |
584 | { | 600 | { |
585 | } | 601 | } |
586 | ulong PhoneFormat::getCsum( const QStringList & attList) | 602 | ulong PhoneFormat::getCsum( const QStringList & attList) |
587 | { | 603 | { |
588 | int max = attList.count() -1; | 604 | int max = attList.count() -1; |
589 | ulong cSum = 0; | 605 | ulong cSum = 0; |
590 | int j,k,i; | 606 | int j,k,i; |
591 | int add; | 607 | int add; |
592 | for ( i = 1; i < max ; ++i ) { | 608 | for ( i = 1; i < max ; ++i ) { |
593 | QString s = attList[i]; | 609 | QString s = attList[i]; |
594 | if ( ! s.isEmpty() ){ | 610 | if ( ! s.isEmpty() ){ |
595 | j = s.length(); | 611 | j = s.length(); |
596 | for ( k = 0; k < j; ++k ) { | 612 | for ( k = 0; k < j; ++k ) { |
597 | int mul = k +1; | 613 | int mul = k +1; |
598 | add = s[k].unicode (); | 614 | add = s[k].unicode (); |
599 | if ( k < 16 ) | 615 | if ( k < 16 ) |
600 | mul = mul * mul; | 616 | mul = mul * mul; |
601 | add = add * mul *i*i*i; | 617 | add = add * mul *i*i*i; |
602 | cSum += add; | 618 | cSum += add; |
603 | } | 619 | } |
604 | } | 620 | } |
605 | } | 621 | } |
606 | return cSum; | 622 | return cSum; |
607 | 623 | ||
608 | } | 624 | } |
609 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); | 625 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); |
610 | #include <stdlib.h> | 626 | #include <stdlib.h> |
611 | #define DEBUGMODE false | 627 | #define DEBUGMODE false |
612 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profileName, QString device,QString connection, QString model ) | 628 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profileName, QString device,QString connection, QString model ) |
613 | { | 629 | { |
614 | mProfileName = profileName; | 630 | mProfileName = profileName; |
615 | GSM_StateMachines; | 631 | GSM_StateMachines; |
616 | qDebug(" load "); | 632 | qDebug(" load "); |
617 | s.opened = false; | 633 | s.opened = false; |
618 | s.msg = NULL; | 634 | s.msg = NULL; |
619 | s.ConfigNum = 0; | 635 | s.ConfigNum = 0; |
620 | #if 0 | 636 | #if 0 |
621 | static char*cp; | 637 | static char*cp; |
622 | static INI_Section *cfg = NULL; | 638 | static INI_Section *cfg = NULL; |
623 | cfg=GSM_FindGammuRC(); | 639 | cfg=GSM_FindGammuRC(); |
624 | int i; | 640 | int i; |
625 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | 641 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { |
626 | if (cfg!=NULL) { | 642 | if (cfg!=NULL) { |
627 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); | 643 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); |
628 | if (cp) di.coding = cp; | 644 | if (cp) di.coding = cp; |
629 | 645 | ||
630 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); | 646 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); |
631 | if (s.Config[i].Localize) { | 647 | if (s.Config[i].Localize) { |
632 | s.msg=INI_ReadFile(s.Config[i].Localize, true); | 648 | s.msg=INI_ReadFile(s.Config[i].Localize, true); |
633 | } else { | 649 | } else { |
634 | #if !defined(WIN32) && defined(LOCALE_PATH) | 650 | #if !defined(WIN32) && defined(LOCALE_PATH) |
635 | locale = setlocale(LC_MESSAGES, NULL); | 651 | locale = setlocale(LC_MESSAGES, NULL); |
636 | if (locale != NULL) { | 652 | if (locale != NULL) { |
637 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", | 653 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", |
638 | LOCALE_PATH, | 654 | LOCALE_PATH, |
639 | tolower(locale[0]), | 655 | tolower(locale[0]), |
640 | tolower(locale[1])); | 656 | tolower(locale[1])); |
641 | s.msg = INI_ReadFile(locale_file, true); | 657 | s.msg = INI_ReadFile(locale_file, true); |
642 | } | 658 | } |
643 | #endif | 659 | #endif |
644 | } | 660 | } |
645 | } | 661 | } |
646 | 662 | ||
647 | /* Wanted user specific configuration? */ | 663 | /* Wanted user specific configuration? */ |
648 | 664 | ||
649 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | 665 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; |
650 | 666 | ||
651 | s.ConfigNum++; | 667 | s.ConfigNum++; |
652 | 668 | ||
653 | /* We want to use only one file descriptor for global and state machine debug output */ | 669 | /* We want to use only one file descriptor for global and state machine debug output */ |
654 | s.Config[i].UseGlobalDebugFile = true; | 670 | s.Config[i].UseGlobalDebugFile = true; |
655 | 671 | ||
656 | 672 | ||
657 | 673 | ||
658 | /* We wanted to read just user specified configuration. */ | 674 | /* We wanted to read just user specified configuration. */ |
659 | {break;} | 675 | {break;} |
660 | } | 676 | } |
661 | 677 | ||
662 | #endif | 678 | #endif |
663 | setlocale(LC_ALL, ""); | 679 | setlocale(LC_ALL, ""); |
664 | GSM_ReadConfig(NULL, &s.Config[0], 0); | 680 | GSM_ReadConfig(NULL, &s.Config[0], 0); |
665 | s.ConfigNum = 1; | 681 | s.ConfigNum = 1; |
666 | GSM_Config *cfg = &s.Config[0]; | 682 | GSM_Config *cfg = &s.Config[0]; |
667 | if ( ! connection.isEmpty() ) { | 683 | if ( ! connection.isEmpty() ) { |
668 | cfg->Connection = strdup(connection.latin1()); | 684 | cfg->Connection = strdup(connection.latin1()); |
669 | cfg->DefaultConnection = false; | 685 | cfg->DefaultConnection = false; |
670 | qDebug("Connection set %s ", cfg->Connection ); | 686 | qDebug("Connection set %s ", cfg->Connection ); |
671 | 687 | ||
672 | } | 688 | } |
673 | if ( ! device.isEmpty() ) { | 689 | if ( ! device.isEmpty() ) { |
674 | cfg->Device = strdup(device.latin1()); | 690 | cfg->Device = strdup(device.latin1()); |
675 | cfg->DefaultDevice = false; | 691 | cfg->DefaultDevice = false; |
676 | qDebug("Device set %s ", cfg->Device); | 692 | qDebug("Device set %s ", cfg->Device); |
677 | 693 | ||
678 | } | 694 | } |
679 | if ( ! model.isEmpty() ) { | 695 | if ( ! model.isEmpty() ) { |
680 | strcpy(cfg->Model,model.latin1() ); | 696 | strcpy(cfg->Model,model.latin1() ); |
681 | cfg->DefaultModel = false; | 697 | cfg->DefaultModel = false; |
682 | qDebug("Model set %s ",cfg->Model ); | 698 | qDebug("Model set %s ",cfg->Model ); |
683 | 699 | ||
684 | 700 | ||
685 | } | 701 | } |
686 | int error=GSM_InitConnection(&s,3); | 702 | int error=GSM_InitConnection(&s,3); |
687 | qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); | 703 | qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); |
688 | if ( error != ERR_NONE ) | 704 | if ( error != ERR_NONE ) |
689 | return false; | 705 | return false; |
690 | GSM_Phone_Functions*Phone; | 706 | GSM_Phone_Functions*Phone; |
691 | GSM_CalendarEntrynote; | 707 | GSM_CalendarEntrynote; |
692 | bool start = true; | 708 | bool start = true; |
693 | Phone=s.Phone.Functions; | 709 | Phone=s.Phone.Functions; |
694 | bool gshutdown = false; | 710 | bool gshutdown = false; |
695 | PhoneParser handler( calendar, profileName ); | 711 | PhoneParser handler( calendar, profileName ); |
696 | int ccc = 0; | 712 | int ccc = 0; |
697 | qDebug("Debug: only 10 calender items are downloaded "); | 713 | qDebug("Debug: only 10 calender items are downloaded "); |
698 | while (!gshutdown && ccc++ < 10) { | 714 | while (!gshutdown && ccc++ < 10) { |
699 | 715 | ||
700 | qDebug("readEvent %d ", ccc); | 716 | qDebug("readEvent %d ", ccc); |
701 | error=Phone->GetNextCalendar(&s,¬e,start); | 717 | error=Phone->GetNextCalendar(&s,¬e,start); |
702 | if (error == ERR_EMPTY) break; | 718 | if (error == ERR_EMPTY) break; |
703 | start = false; | 719 | start = false; |
704 | handler.readEvent( existingCal, ¬e ); | 720 | handler.readEvent( existingCal, ¬e ); |
705 | } | 721 | } |
706 | 722 | ||
707 | start = true; | 723 | start = true; |
708 | GSM_ToDoEntry ToDo; | 724 | GSM_ToDoEntry ToDo; |
709 | ccc = 0; | 725 | ccc = 0; |
710 | while (!gshutdown) { | 726 | while (!gshutdown) { |
711 | error = Phone->GetNextToDo(&s, &ToDo, start); | 727 | error = Phone->GetNextToDo(&s, &ToDo, start); |
712 | if (error == ERR_EMPTY) break; | 728 | if (error == ERR_EMPTY) break; |
713 | start = false; | 729 | start = false; |
714 | qDebug("ReadTodo %d ", ++ccc); | 730 | qDebug("ReadTodo %d ", ++ccc); |
715 | handler.readTodo( existingCal, &ToDo, &s); | 731 | handler.readTodo( existingCal, &ToDo, &s); |
716 | 732 | ||
717 | } | 733 | } |
718 | 734 | ||
719 | error=GSM_TerminateConnection(&s); | 735 | error=GSM_TerminateConnection(&s); |
720 | 736 | ||
721 | return true; | 737 | return true; |
722 | } | 738 | } |
723 | 739 | ||
724 | bool PhoneFormat::save( Calendar *calendar) | 740 | bool PhoneFormat::save( Calendar *calendar) |
725 | { | 741 | { |
726 | #if 0 | 742 | #if 0 |
727 | QLabel status ( i18n("Processing/adding events ..."), 0 ); | 743 | QLabel status ( i18n("Processing/adding events ..."), 0 ); |
728 | int w = status.sizeHint().width()+20 ; | 744 | int w = status.sizeHint().width()+20 ; |
729 | if ( w < 200 ) w = 200; | 745 | if ( w < 200 ) w = 200; |
730 | int h = status.sizeHint().height()+20 ; | 746 | int h = status.sizeHint().height()+20 ; |
731 | int dw = QApplication::desktop()->width(); | 747 | int dw = QApplication::desktop()->width(); |
732 | int dh = QApplication::desktop()->height(); | 748 | int dh = QApplication::desktop()->height(); |
733 | status.setCaption(i18n("Writing DTM Data") ); | 749 | status.setCaption(i18n("Writing DTM Data") ); |
734 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 750 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
735 | status.show(); | 751 | status.show(); |
736 | status.raise(); | 752 | status.raise(); |
737 | qApp->processEvents(); | 753 | qApp->processEvents(); |
738 | bool debug = DEBUGMODE; | 754 | bool debug = DEBUGMODE; |
739 | QString codec = "utf8"; | 755 | QString codec = "utf8"; |
740 | QString answer; | 756 | QString answer; |
741 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; | 757 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; |
742 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; | 758 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; |
743 | QString command; | 759 | QString command; |
744 | QPtrList<Event> er = calendar->rawEvents(); | 760 | QPtrList<Event> er = calendar->rawEvents(); |
745 | Event* ev = er.first(); | 761 | Event* ev = er.first(); |
746 | QString fileName = "/tmp/kopitempout"; | 762 | QString fileName = "/tmp/kopitempout"; |
747 | int i = 0; | 763 | int i = 0; |
748 | QString changeString = ePrefix; | 764 | QString changeString = ePrefix; |
749 | QString deleteString = ePrefix; | 765 | QString deleteString = ePrefix; |
750 | bool deleteEnt = false; | 766 | bool deleteEnt = false; |
751 | bool changeEnt = false; | 767 | bool changeEnt = false; |
752 | QString message = i18n("Processing event # "); | 768 | QString message = i18n("Processing event # "); |
753 | int procCount = 0; | 769 | int procCount = 0; |
754 | while ( ev ) { | 770 | while ( ev ) { |
755 | //qDebug("i %d ", ++i); | 771 | //qDebug("i %d ", ++i); |
756 | if ( true /*ev->zaurusStat() != -2*/ ) { | 772 | if ( true /*ev->zaurusStat() != -2*/ ) { |
757 | status.setText ( message + QString::number ( ++procCount ) ); | 773 | status.setText ( message + QString::number ( ++procCount ) ); |
758 | qApp->processEvents(); | 774 | qApp->processEvents(); |
759 | QString eString = getEventString( ev ); | 775 | QString eString = getEventString( ev ); |
760 | if (/* ev->zaurusStat() == -3 */ true) { // delete | 776 | if (/* ev->zaurusStat() == -3 */ true) { // delete |
761 | // deleting empty strings does not work. | 777 | // deleting empty strings does not work. |
762 | // we write first and x and then delete the record with the x | 778 | // we write first and x and then delete the record with the x |
763 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 779 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
764 | changeString += eString + "\n"; | 780 | changeString += eString + "\n"; |
765 | deleteString += eString + "\n"; | 781 | deleteString += eString + "\n"; |
766 | deleteEnt = true; | 782 | deleteEnt = true; |
767 | changeEnt = true; | 783 | changeEnt = true; |
768 | } | 784 | } |
769 | else if ( /*ev->zaurusId() == -1*/true ) { // add new | 785 | else if ( /*ev->zaurusId() == -1*/true ) { // add new |
770 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 786 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
771 | system ( command.utf8() ); | 787 | system ( command.utf8() ); |
772 | QFile file( fileName ); | 788 | QFile file( fileName ); |
773 | if (!file.open( IO_ReadOnly ) ) { | 789 | if (!file.open( IO_ReadOnly ) ) { |
774 | return false; | 790 | return false; |
775 | 791 | ||
776 | } | 792 | } |
777 | QTextStream ts( &file ); | 793 | QTextStream ts( &file ); |
778 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 794 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
779 | answer = ts.read(); | 795 | answer = ts.read(); |
780 | file.close(); | 796 | file.close(); |
781 | //qDebug("answer \n%s ", answer.latin1()); | 797 | //qDebug("answer \n%s ", answer.latin1()); |
782 | getNumFromRecord( answer, ev ) ; | 798 | getNumFromRecord( answer, ev ) ; |
783 | 799 | ||
784 | } | 800 | } |
785 | else { // change existing | 801 | else { // change existing |
786 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); | 802 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); |
787 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 803 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
788 | changeString += eString + "\n"; | 804 | changeString += eString + "\n"; |
789 | changeEnt = true; | 805 | changeEnt = true; |
790 | 806 | ||
791 | } | 807 | } |
792 | } | 808 | } |
793 | ev = er.next(); | 809 | ev = er.next(); |
794 | } | 810 | } |
795 | status.setText ( i18n("Changing events ...") ); | 811 | status.setText ( i18n("Changing events ...") ); |
796 | qApp->processEvents(); | 812 | qApp->processEvents(); |
797 | //qDebug("changing... "); | 813 | //qDebug("changing... "); |
798 | if ( changeEnt ) { | 814 | if ( changeEnt ) { |
799 | QFile file( fileName ); | 815 | QFile file( fileName ); |
800 | if (!file.open( IO_WriteOnly ) ) { | 816 | if (!file.open( IO_WriteOnly ) ) { |
801 | return false; | 817 | return false; |
802 | 818 | ||
803 | } | 819 | } |
804 | QTextStream ts( &file ); | 820 | QTextStream ts( &file ); |
805 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 821 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
806 | ts << changeString ; | 822 | ts << changeString ; |
807 | file.close(); | 823 | file.close(); |
808 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; | 824 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; |
809 | system ( command.latin1() ); | 825 | system ( command.latin1() ); |
810 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 826 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
811 | 827 | ||
812 | } | 828 | } |
813 | status.setText ( i18n("Deleting events ...") ); | 829 | status.setText ( i18n("Deleting events ...") ); |
814 | qApp->processEvents(); | 830 | qApp->processEvents(); |
815 | //qDebug("deleting... "); | 831 | //qDebug("deleting... "); |
816 | if ( deleteEnt ) { | 832 | if ( deleteEnt ) { |
817 | QFile file( fileName ); | 833 | QFile file( fileName ); |
818 | if (!file.open( IO_WriteOnly ) ) { | 834 | if (!file.open( IO_WriteOnly ) ) { |
819 | return false; | 835 | return false; |
820 | 836 | ||
821 | } | 837 | } |
822 | QTextStream ts( &file ); | 838 | QTextStream ts( &file ); |
823 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 839 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
824 | ts << deleteString; | 840 | ts << deleteString; |
825 | file.close(); | 841 | file.close(); |
826 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; | 842 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; |
827 | system ( command.latin1() ); | 843 | system ( command.latin1() ); |
828 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 844 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
829 | } | 845 | } |
830 | 846 | ||
831 | 847 | ||
832 | changeString = tPrefix; | 848 | changeString = tPrefix; |
833 | deleteString = tPrefix; | 849 | deleteString = tPrefix; |
834 | status.setText ( i18n("Processing todos ...") ); | 850 | status.setText ( i18n("Processing todos ...") ); |
835 | qApp->processEvents(); | 851 | qApp->processEvents(); |
836 | QPtrList<Todo> tl = calendar->rawTodos(); | 852 | QPtrList<Todo> tl = calendar->rawTodos(); |
837 | Todo* to = tl.first(); | 853 | Todo* to = tl.first(); |
838 | i = 0; | 854 | i = 0; |
839 | message = i18n("Processing todo # "); | 855 | message = i18n("Processing todo # "); |
840 | procCount = 0; | 856 | procCount = 0; |
841 | while ( to ) { | 857 | while ( to ) { |
842 | if ( true /*to->zaurusStat() != -2 */) { | 858 | if ( true /*to->zaurusStat() != -2 */) { |
843 | status.setText ( message + QString::number ( ++procCount ) ); | 859 | status.setText ( message + QString::number ( ++procCount ) ); |
844 | qApp->processEvents(); | 860 | qApp->processEvents(); |
845 | QString eString = getTodoString( to ); | 861 | QString eString = getTodoString( to ); |
846 | if ( /*to->zaurusStat() == -3*/true ) { // delete | 862 | if ( /*to->zaurusStat() == -3*/true ) { // delete |
847 | // deleting empty strings does not work. | 863 | // deleting empty strings does not work. |
848 | // we write first and x and then delete the record with the x | 864 | // we write first and x and then delete the record with the x |
849 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 865 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
850 | changeString += eString + "\n"; | 866 | changeString += eString + "\n"; |
851 | deleteString += eString + "\n"; | 867 | deleteString += eString + "\n"; |
852 | deleteEnt = true; | 868 | deleteEnt = true; |
853 | changeEnt = true; | 869 | changeEnt = true; |
854 | } | 870 | } |
855 | else if ( true /*to->zaurusId() == -1*/ ) { // add new | 871 | else if ( true /*to->zaurusId() == -1*/ ) { // add new |
856 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; | 872 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; |
857 | system ( command.utf8() ); | 873 | system ( command.utf8() ); |
858 | QFile file( fileName ); | 874 | QFile file( fileName ); |
859 | if (!file.open( IO_ReadOnly ) ) { | 875 | if (!file.open( IO_ReadOnly ) ) { |
860 | return false; | 876 | return false; |
861 | 877 | ||
862 | } | 878 | } |
863 | QTextStream ts( &file ); | 879 | QTextStream ts( &file ); |
864 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 880 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
865 | answer = ts.read(); | 881 | answer = ts.read(); |
866 | file.close(); | 882 | file.close(); |
867 | //qDebug("answer \n%s ", answer.latin1()); | 883 | //qDebug("answer \n%s ", answer.latin1()); |
868 | getNumFromRecord( answer, to ) ; | 884 | getNumFromRecord( answer, to ) ; |
869 | 885 | ||
870 | } | 886 | } |
871 | else { // change existing | 887 | else { // change existing |
872 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); | 888 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); |
873 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 889 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
874 | changeString += eString + "\n"; | 890 | changeString += eString + "\n"; |
875 | changeEnt = true; | 891 | changeEnt = true; |
876 | 892 | ||
877 | } | 893 | } |
878 | } | 894 | } |
879 | 895 | ||
880 | to = tl.next(); | 896 | to = tl.next(); |
881 | } | 897 | } |
882 | status.setText ( i18n("Changing todos ...") ); | 898 | status.setText ( i18n("Changing todos ...") ); |
883 | qApp->processEvents(); | 899 | qApp->processEvents(); |
884 | //qDebug("changing... "); | 900 | //qDebug("changing... "); |
885 | if ( changeEnt ) { | 901 | if ( changeEnt ) { |
886 | QFile file( fileName ); | 902 | QFile file( fileName ); |
887 | if (!file.open( IO_WriteOnly ) ) { | 903 | if (!file.open( IO_WriteOnly ) ) { |
888 | return false; | 904 | return false; |
889 | 905 | ||
890 | } | 906 | } |
891 | QTextStream ts( &file ); | 907 | QTextStream ts( &file ); |
892 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 908 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
893 | ts << changeString ; | 909 | ts << changeString ; |
894 | file.close(); | 910 | file.close(); |
895 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; | 911 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; |
896 | system ( command.latin1() ); | 912 | system ( command.latin1() ); |
897 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 913 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
898 | 914 | ||
899 | } | 915 | } |
900 | status.setText ( i18n("Deleting todos ...") ); | 916 | status.setText ( i18n("Deleting todos ...") ); |
901 | qApp->processEvents(); | 917 | qApp->processEvents(); |
902 | //qDebug("deleting... "); | 918 | //qDebug("deleting... "); |
903 | if ( deleteEnt ) { | 919 | if ( deleteEnt ) { |
904 | QFile file( fileName ); | 920 | QFile file( fileName ); |
905 | if (!file.open( IO_WriteOnly ) ) { | 921 | if (!file.open( IO_WriteOnly ) ) { |
906 | return false; | 922 | return false; |
907 | 923 | ||
908 | } | 924 | } |
909 | QTextStream ts( &file ); | 925 | QTextStream ts( &file ); |
910 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 926 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
911 | ts << deleteString; | 927 | ts << deleteString; |
912 | file.close(); | 928 | file.close(); |
913 | command = "db2file todo -d -c " + codec+ " < "+ fileName; | 929 | command = "db2file todo -d -c " + codec+ " < "+ fileName; |
914 | system ( command.latin1() ); | 930 | system ( command.latin1() ); |
915 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 931 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
916 | } | 932 | } |
917 | #endif | 933 | #endif |
918 | return true; | 934 | return true; |
919 | } | 935 | } |
920 | QString PhoneFormat::dtToGSM( const QDateTime& dti, bool useTZ ) | 936 | QString PhoneFormat::dtToGSM( const QDateTime& dti, bool useTZ ) |
921 | { | 937 | { |
922 | QString datestr; | 938 | QString datestr; |
923 | QString timestr; | 939 | QString timestr; |
924 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 940 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
925 | QDateTime dt; | 941 | QDateTime dt; |
926 | if (useTZ) | 942 | if (useTZ) |
927 | dt = dti.addSecs ( -(offset*60)); | 943 | dt = dti.addSecs ( -(offset*60)); |
928 | else | 944 | else |
929 | dt = dti; | 945 | dt = dti; |
930 | if(dt.date().isValid()){ | 946 | if(dt.date().isValid()){ |
931 | const QDate& date = dt.date(); | 947 | const QDate& date = dt.date(); |
932 | datestr.sprintf("%04d%02d%02d", | 948 | datestr.sprintf("%04d%02d%02d", |
933 | date.year(), date.month(), date.day()); | 949 | date.year(), date.month(), date.day()); |
934 | } | 950 | } |
935 | if(dt.time().isValid()){ | 951 | if(dt.time().isValid()){ |
936 | const QTime& time = dt.time(); | 952 | const QTime& time = dt.time(); |
937 | timestr.sprintf("T%02d%02d%02d", | 953 | timestr.sprintf("T%02d%02d%02d", |
938 | time.hour(), time.minute(), time.second()); | 954 | time.hour(), time.minute(), time.second()); |
939 | } | 955 | } |
940 | return datestr + timestr; | 956 | return datestr + timestr; |
941 | } | 957 | } |
942 | QString PhoneFormat::getEventString( Event* event ) | 958 | QString PhoneFormat::getEventString( Event* event ) |
943 | { | 959 | { |
944 | #if 0 | 960 | #if 0 |
945 | QStringList list; | 961 | QStringList list; |
946 | list.append( QString::number(event->zaurusId() ) ); | 962 | list.append( QString::number(event->zaurusId() ) ); |
947 | list.append( event->categories().join(",") ); | 963 | list.append( event->categories().join(",") ); |
948 | if ( !event->summary().isEmpty() ) | 964 | if ( !event->summary().isEmpty() ) |
949 | list.append( event->summary() ); | 965 | list.append( event->summary() ); |
950 | else | 966 | else |
951 | list.append("" ); | 967 | list.append("" ); |
952 | if ( !event->location().isEmpty() ) | 968 | if ( !event->location().isEmpty() ) |
953 | list.append( event->location() ); | 969 | list.append( event->location() ); |
954 | else | 970 | else |
955 | list.append("" ); | 971 | list.append("" ); |
956 | if ( !event->description().isEmpty() ) | 972 | if ( !event->description().isEmpty() ) |
957 | list.append( event->description() ); | 973 | list.append( event->description() ); |
958 | else | 974 | else |
959 | list.append( "" ); | 975 | list.append( "" ); |
960 | if ( event->doesFloat () ) { | 976 | if ( event->doesFloat () ) { |
961 | list.append( dtToString( QDateTime(event->dtStart().date(), QTime(0,0,0)), false )); | 977 | list.append( dtToString( QDateTime(event->dtStart().date(), QTime(0,0,0)), false )); |
962 | list.append( dtToString( QDateTime(event->dtEnd().date(),QTime(23,59,59)), false )); //6 | 978 | list.append( dtToString( QDateTime(event->dtEnd().date(),QTime(23,59,59)), false )); //6 |
963 | list.append( "1" ); | 979 | list.append( "1" ); |
964 | 980 | ||
965 | } | 981 | } |
966 | else { | 982 | else { |
967 | list.append( dtToString( event->dtStart()) ); | 983 | list.append( dtToString( event->dtStart()) ); |
968 | list.append( dtToString( event->dtEnd()) ); //6 | 984 | list.append( dtToString( event->dtEnd()) ); //6 |
969 | list.append( "0" ); | 985 | list.append( "0" ); |
970 | } | 986 | } |
971 | bool noAlarm = true; | 987 | bool noAlarm = true; |
972 | if ( event->alarms().count() > 0 ) { | 988 | if ( event->alarms().count() > 0 ) { |
973 | Alarm * al = event->alarms().first(); | 989 | Alarm * al = event->alarms().first(); |
974 | if ( al->enabled() ) { | 990 | if ( al->enabled() ) { |
975 | noAlarm = false; | 991 | noAlarm = false; |
976 | list.append( "0" ); // yes, 0 == alarm | 992 | list.append( "0" ); // yes, 0 == alarm |
977 | list.append( QString::number( al->startOffset().asSeconds()/(-60) ) ); | 993 | list.append( QString::number( al->startOffset().asSeconds()/(-60) ) ); |
978 | if ( al->type() == Alarm::Audio ) | 994 | if ( al->type() == Alarm::Audio ) |
979 | list.append( "1" ); // type audio | 995 | list.append( "1" ); // type audio |
980 | else | 996 | else |
981 | list.append( "0" ); // type silent | 997 | list.append( "0" ); // type silent |
982 | } | 998 | } |
983 | } | 999 | } |
984 | if ( noAlarm ) { | 1000 | if ( noAlarm ) { |
985 | list.append( "1" ); // yes, 1 == no alarm | 1001 | list.append( "1" ); // yes, 1 == no alarm |
986 | list.append( "0" ); // no alarm offset | 1002 | list.append( "0" ); // no alarm offset |
987 | list.append( "1" ); // type | 1003 | list.append( "1" ); // type |
988 | } | 1004 | } |
989 | // next is: 11 | 1005 | // next is: 11 |
990 | // next is: 11-16 are recurrence | 1006 | // next is: 11-16 are recurrence |
991 | Recurrence* rec = event->recurrence(); | 1007 | Recurrence* rec = event->recurrence(); |
992 | 1008 | ||
993 | bool writeEndDate = false; | 1009 | bool writeEndDate = false; |
994 | switch ( rec->doesRecur() ) | 1010 | switch ( rec->doesRecur() ) |
995 | { | 1011 | { |
996 | case Recurrence::rDaily: // 0 | 1012 | case Recurrence::rDaily: // 0 |
997 | list.append( "0" ); | 1013 | list.append( "0" ); |
998 | list.append( QString::number( rec->frequency() ));//12 | 1014 | list.append( QString::number( rec->frequency() ));//12 |
999 | list.append( "0" ); | 1015 | list.append( "0" ); |
1000 | list.append( "0" ); | 1016 | list.append( "0" ); |
1001 | writeEndDate = true; | 1017 | writeEndDate = true; |
1002 | break; | 1018 | break; |
1003 | case Recurrence::rWeekly:// 1 | 1019 | case Recurrence::rWeekly:// 1 |
1004 | list.append( "1" ); | 1020 | list.append( "1" ); |
1005 | list.append( QString::number( rec->frequency()) );//12 | 1021 | list.append( QString::number( rec->frequency()) );//12 |
1006 | list.append( "0" ); | 1022 | list.append( "0" ); |
1007 | { | 1023 | { |
1008 | int days = 0; | 1024 | int days = 0; |
1009 | QBitArray weekDays = rec->days(); | 1025 | QBitArray weekDays = rec->days(); |
1010 | int i; | 1026 | int i; |
1011 | for( i = 1; i <= 7; ++i ) { | 1027 | for( i = 1; i <= 7; ++i ) { |
1012 | if ( weekDays[i-1] ) { | 1028 | if ( weekDays[i-1] ) { |
1013 | days += 1 << (i-1); | 1029 | days += 1 << (i-1); |
1014 | } | 1030 | } |
1015 | } | 1031 | } |
1016 | list.append( QString::number( days ) ); | 1032 | list.append( QString::number( days ) ); |
1017 | } | 1033 | } |
1018 | //pending weekdays | 1034 | //pending weekdays |
1019 | writeEndDate = true; | 1035 | writeEndDate = true; |
1020 | 1036 | ||
1021 | break; | 1037 | break; |
1022 | case Recurrence::rMonthlyPos:// 2 | 1038 | case Recurrence::rMonthlyPos:// 2 |
1023 | list.append( "2" ); | 1039 | list.append( "2" ); |
1024 | list.append( QString::number( rec->frequency()) );//12 | 1040 | list.append( QString::number( rec->frequency()) );//12 |
1025 | 1041 | ||
1026 | writeEndDate = true; | 1042 | writeEndDate = true; |
1027 | { | 1043 | { |
1028 | int count = 1; | 1044 | int count = 1; |
1029 | QPtrList<Recurrence::rMonthPos> rmp; | 1045 | QPtrList<Recurrence::rMonthPos> rmp; |
1030 | rmp = rec->monthPositions(); | 1046 | rmp = rec->monthPositions(); |
1031 | if ( rmp.first()->negative ) | 1047 | if ( rmp.first()->negative ) |
1032 | count = 5 - rmp.first()->rPos - 1; | 1048 | count = 5 - rmp.first()->rPos - 1; |
1033 | else | 1049 | else |
1034 | count = rmp.first()->rPos - 1; | 1050 | count = rmp.first()->rPos - 1; |
1035 | list.append( QString::number( count ) ); | 1051 | list.append( QString::number( count ) ); |
1036 | 1052 | ||
1037 | } | 1053 | } |
1038 | 1054 | ||
1039 | list.append( "0" ); | 1055 | list.append( "0" ); |
1040 | break; | 1056 | break; |
1041 | case Recurrence::rMonthlyDay:// 3 | 1057 | case Recurrence::rMonthlyDay:// 3 |
1042 | list.append( "3" ); | 1058 | list.append( "3" ); |
1043 | list.append( QString::number( rec->frequency()) );//12 | 1059 | list.append( QString::number( rec->frequency()) );//12 |
1044 | list.append( "0" ); | 1060 | list.append( "0" ); |
1045 | list.append( "0" ); | 1061 | list.append( "0" ); |
1046 | writeEndDate = true; | 1062 | writeEndDate = true; |
1047 | break; | 1063 | break; |
1048 | case Recurrence::rYearlyMonth://4 | 1064 | case Recurrence::rYearlyMonth://4 |
1049 | list.append( "4" ); | 1065 | list.append( "4" ); |
1050 | list.append( QString::number( rec->frequency()) );//12 | 1066 | list.append( QString::number( rec->frequency()) );//12 |
1051 | list.append( "0" ); | 1067 | list.append( "0" ); |
1052 | list.append( "0" ); | 1068 | list.append( "0" ); |
1053 | writeEndDate = true; | 1069 | writeEndDate = true; |
1054 | break; | 1070 | break; |
1055 | 1071 | ||
1056 | default: | 1072 | default: |
1057 | list.append( "255" ); | 1073 | list.append( "255" ); |
1058 | list.append( QString() ); | 1074 | list.append( QString() ); |
1059 | list.append( "0" ); | 1075 | list.append( "0" ); |
1060 | list.append( QString() ); | 1076 | list.append( QString() ); |
1061 | list.append( "0" ); | 1077 | list.append( "0" ); |
1062 | list.append( "20991231T000000" ); | 1078 | list.append( "20991231T000000" ); |
1063 | break; | 1079 | break; |
1064 | } | 1080 | } |
1065 | if ( writeEndDate ) { | 1081 | if ( writeEndDate ) { |
1066 | 1082 | ||
1067 | if ( rec->endDate().isValid() ) { // 15 + 16 | 1083 | if ( rec->endDate().isValid() ) { // 15 + 16 |
1068 | list.append( "1" ); | 1084 | list.append( "1" ); |
1069 | list.append( dtToString( rec->endDate()) ); | 1085 | list.append( dtToString( rec->endDate()) ); |
1070 | } else { | 1086 | } else { |
1071 | list.append( "0" ); | 1087 | list.append( "0" ); |
1072 | list.append( "20991231T000000" ); | 1088 | list.append( "20991231T000000" ); |
1073 | } | 1089 | } |
1074 | 1090 | ||
1075 | } | 1091 | } |
1076 | if ( event->doesFloat () ) { | 1092 | if ( event->doesFloat () ) { |
1077 | list.append( dtToString( event->dtStart(), false ).left( 8 )); | 1093 | list.append( dtToString( event->dtStart(), false ).left( 8 )); |
1078 | list.append( dtToString( event->dtEnd(), false ).left( 8 )); //6 | 1094 | list.append( dtToString( event->dtEnd(), false ).left( 8 )); //6 |
1079 | 1095 | ||
1080 | } | 1096 | } |
1081 | else { | 1097 | else { |
1082 | list.append( QString() ); | 1098 | list.append( QString() ); |
1083 | list.append( QString() ); | 1099 | list.append( QString() ); |
1084 | 1100 | ||
1085 | } | 1101 | } |
1086 | if (event->dtStart().date() == event->dtEnd().date() ) | 1102 | if (event->dtStart().date() == event->dtEnd().date() ) |
1087 | list.append( "0" ); | 1103 | list.append( "0" ); |
1088 | else | 1104 | else |
1089 | list.append( "1" ); | 1105 | list.append( "1" ); |
1090 | 1106 | ||
1091 | 1107 | ||
1092 | for(QStringList::Iterator it=list.begin(); | 1108 | for(QStringList::Iterator it=list.begin(); |
1093 | it!=list.end(); ++it){ | 1109 | it!=list.end(); ++it){ |
1094 | QString& s = (*it); | 1110 | QString& s = (*it); |
1095 | s.replace(QRegExp("\""), "\"\""); | 1111 | s.replace(QRegExp("\""), "\"\""); |
1096 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ | 1112 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ |
1097 | s.prepend('\"'); | 1113 | s.prepend('\"'); |
1098 | s.append('\"'); | 1114 | s.append('\"'); |
1099 | } else if(s.isEmpty() && !s.isNull()){ | 1115 | } else if(s.isEmpty() && !s.isNull()){ |
1100 | s = "\"\""; | 1116 | s = "\"\""; |
1101 | } | 1117 | } |
1102 | } | 1118 | } |
1103 | return list.join(","); | 1119 | return list.join(","); |
1104 | #endif | 1120 | #endif |
1105 | return QString(); | 1121 | return QString(); |
1106 | 1122 | ||
1107 | } | 1123 | } |
1108 | QString PhoneFormat::getTodoString( Todo* todo ) | 1124 | QString PhoneFormat::getTodoString( Todo* todo ) |
1109 | { | 1125 | { |
1110 | #if 0 | 1126 | #if 0 |
1111 | QStringList list; | 1127 | QStringList list; |
1112 | list.append( QString::number( todo->zaurusId() ) ); | 1128 | list.append( QString::number( todo->zaurusId() ) ); |
1113 | list.append( todo->categories().join(",") ); | 1129 | list.append( todo->categories().join(",") ); |
1114 | 1130 | ||
1115 | if ( todo->hasStartDate() ) { | 1131 | if ( todo->hasStartDate() ) { |
1116 | list.append( dtToString( todo->dtStart()) ); | 1132 | list.append( dtToString( todo->dtStart()) ); |
1117 | } else | 1133 | } else |
1118 | list.append( QString() ); | 1134 | list.append( QString() ); |
1119 | 1135 | ||
1120 | if ( todo->hasDueDate() ) { | 1136 | if ( todo->hasDueDate() ) { |
1121 | QTime tim; | 1137 | QTime tim; |
1122 | if ( todo->doesFloat()) { | 1138 | if ( todo->doesFloat()) { |
1123 | list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ; | 1139 | list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ; |
1124 | } else { | 1140 | } else { |
1125 | list.append( dtToString(todo->dtDue() ) ); | 1141 | list.append( dtToString(todo->dtDue() ) ); |
1126 | } | 1142 | } |
1127 | } else | 1143 | } else |
1128 | list.append( QString() ); | 1144 | list.append( QString() ); |
1129 | 1145 | ||
1130 | if ( todo->isCompleted() ) { | 1146 | if ( todo->isCompleted() ) { |
1131 | list.append( dtToString( todo->completed()) ); | 1147 | list.append( dtToString( todo->completed()) ); |
1132 | list.append( "0" ); // yes 0 == completed | 1148 | list.append( "0" ); // yes 0 == completed |
1133 | } else { | 1149 | } else { |
1134 | list.append( dtToString( todo->completed()) ); | 1150 | list.append( dtToString( todo->completed()) ); |
1135 | list.append( "1" ); | 1151 | list.append( "1" ); |
1136 | } | 1152 | } |
1137 | list.append( QString::number( todo->priority() )); | 1153 | list.append( QString::number( todo->priority() )); |
1138 | if( ! todo->summary().isEmpty() ) | 1154 | if( ! todo->summary().isEmpty() ) |
1139 | list.append( todo->summary() ); | 1155 | list.append( todo->summary() ); |
1140 | else | 1156 | else |
1141 | list.append( "" ); | 1157 | list.append( "" ); |
1142 | if (! todo->description().isEmpty() ) | 1158 | if (! todo->description().isEmpty() ) |
1143 | list.append( todo->description() ); | 1159 | list.append( todo->description() ); |
1144 | else | 1160 | else |
1145 | list.append( "" ); | 1161 | list.append( "" ); |
1146 | for(QStringList::Iterator it=list.begin(); | 1162 | for(QStringList::Iterator it=list.begin(); |
1147 | it!=list.end(); ++it){ | 1163 | it!=list.end(); ++it){ |
1148 | QString& s = (*it); | 1164 | QString& s = (*it); |
1149 | s.replace(QRegExp("\""), "\"\""); | 1165 | s.replace(QRegExp("\""), "\"\""); |
1150 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ | 1166 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ |
1151 | s.prepend('\"'); | 1167 | s.prepend('\"'); |
1152 | s.append('\"'); | 1168 | s.append('\"'); |
1153 | } else if(s.isEmpty() && !s.isNull()){ | 1169 | } else if(s.isEmpty() && !s.isNull()){ |
1154 | s = "\"\""; | 1170 | s = "\"\""; |
1155 | } | 1171 | } |
1156 | } | 1172 | } |
1157 | return list.join(","); | 1173 | return list.join(","); |
1158 | #endif | 1174 | #endif |
1159 | return QString(); | 1175 | return QString(); |
1160 | } | 1176 | } |
1161 | 1177 | ||
1162 | 1178 | ||
1163 | QString PhoneFormat::toString( Calendar * ) | 1179 | QString PhoneFormat::toString( Calendar * ) |
1164 | { | 1180 | { |
1165 | return QString::null; | 1181 | return QString::null; |
1166 | } | 1182 | } |
1167 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) | 1183 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) |
1168 | { | 1184 | { |
1169 | return false; | 1185 | return false; |
1170 | } | 1186 | } |