-rw-r--r-- | gammu/emb/common/gsmstate.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | libkdepim/phoneaccess.cpp | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/gammu/emb/common/gsmstate.h b/gammu/emb/common/gsmstate.h index 2b4806c..f15a6a7 100644 --- a/gammu/emb/common/gsmstate.h +++ b/gammu/emb/common/gsmstate.h | |||
@@ -1,356 +1,355 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek & Michal Cihar */ | 1 | /* (c) 2002-2004 by Marcin Wiacek & Michal Cihar */ |
2 | 2 | ||
3 | #ifndef __gsm_state_h | 3 | #ifndef __gsm_state_h |
4 | #define __gsm_state_h | 4 | #define __gsm_state_h |
5 | 5 | ||
6 | #include <time.h> | 6 | #include <time.h> |
7 | 7 | ||
8 | #include "config.h" | 8 | #include "config.h" |
9 | #include "misc/cfg.h" | 9 | #include "misc/cfg.h" |
10 | 10 | ||
11 | typedef struct _GSM_StateMachine GSM_StateMachine; | 11 | typedef struct _GSM_StateMachine GSM_StateMachine; |
12 | typedef struct _GSM_User GSM_User; | 12 | typedef struct _GSM_User GSM_User; |
13 | typedef struct _OnePhoneModel OnePhoneModel; | 13 | typedef struct _OnePhoneModel OnePhoneModel; |
14 | typedef struct _GSM_Reply_FunctionGSM_Reply_Function; | 14 | typedef struct _GSM_Reply_FunctionGSM_Reply_Function; |
15 | 15 | ||
16 | #ifdef GSM_ENABLE_NOKIA3320 | 16 | #ifdef GSM_ENABLE_NOKIA3320 |
17 | # include "phone/nokia/dct4/n3320.h" | 17 | # include "phone/nokia/dct4/n3320.h" |
18 | #endif | 18 | #endif |
19 | #ifdef GSM_ENABLE_NOKIA3650 | 19 | #ifdef GSM_ENABLE_NOKIA3650 |
20 | # include "phone/nokia/dct4/n3650.h" | 20 | # include "phone/nokia/dct4/n3650.h" |
21 | #endif | 21 | #endif |
22 | #ifdef GSM_ENABLE_NOKIA650 | 22 | #ifdef GSM_ENABLE_NOKIA650 |
23 | # include "phone/nokia/dct3/n0650.h" | 23 | # include "phone/nokia/dct3/n0650.h" |
24 | #endif | 24 | #endif |
25 | #ifdef GSM_ENABLE_NOKIA6110 | 25 | #ifdef GSM_ENABLE_NOKIA6110 |
26 | # include "phone/nokia/dct3/n6110.h" | 26 | # include "phone/nokia/dct3/n6110.h" |
27 | #endif | 27 | #endif |
28 | #ifdef GSM_ENABLE_NOKIA6510 | 28 | #ifdef GSM_ENABLE_NOKIA6510 |
29 | # include "phone/nokia/dct4/n6510.h" | 29 | # include "phone/nokia/dct4/n6510.h" |
30 | #endif | 30 | #endif |
31 | #ifdef GSM_ENABLE_NOKIA7110 | 31 | #ifdef GSM_ENABLE_NOKIA7110 |
32 | # include "phone/nokia/dct3/n7110.h" | 32 | # include "phone/nokia/dct3/n7110.h" |
33 | #endif | 33 | #endif |
34 | #ifdef GSM_ENABLE_NOKIA9210 | 34 | #ifdef GSM_ENABLE_NOKIA9210 |
35 | # include "phone/nokia/dct3/n9210.h" | 35 | # include "phone/nokia/dct3/n9210.h" |
36 | #endif | 36 | #endif |
37 | #ifdef GSM_ENABLE_ATGEN | 37 | #ifdef GSM_ENABLE_ATGEN |
38 | # include "phone/at/atgen.h" | 38 | # include "phone/at/atgen.h" |
39 | #endif | 39 | #endif |
40 | #ifdef GSM_ENABLE_ALCATEL | 40 | #ifdef GSM_ENABLE_ALCATEL |
41 | # include "phone/alcatel/alcatel.h" | 41 | # include "phone/alcatel/alcatel.h" |
42 | #endif | 42 | #endif |
43 | #ifdef GSM_ENABLE_OBEXGEN | 43 | #ifdef GSM_ENABLE_OBEXGEN |
44 | # include "phone/obex/obexgen.h" | 44 | # include "phone/obex/obexgen.h" |
45 | #endif | 45 | #endif |
46 | #ifdef GSM_ENABLE_MROUTERGEN | 46 | #ifdef GSM_ENABLE_MROUTERGEN |
47 | # include "phone/symbian/mroutgen.h" | 47 | # include "phone/symbian/mroutgen.h" |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #ifndef GSM_USED_MBUS2 | 50 | #ifndef GSM_USED_MBUS2 |
51 | # undef GSM_ENABLE_MBUS2 | 51 | # undef GSM_ENABLE_MBUS2 |
52 | #endif | 52 | #endif |
53 | #ifndef GSM_USED_FBUS2 | 53 | #ifndef GSM_USED_FBUS2 |
54 | # undef GSM_ENABLE_FBUS2 | 54 | # undef GSM_ENABLE_FBUS2 |
55 | #endif | 55 | #endif |
56 | #ifndef GSM_USED_FBUS2DLR3 | 56 | #ifndef GSM_USED_FBUS2DLR3 |
57 | # undef GSM_ENABLE_FBUS2DLR3 | 57 | # undef GSM_ENABLE_FBUS2DLR3 |
58 | #endif | 58 | #endif |
59 | #ifndef GSM_USED_FBUS2DKU5 | 59 | #ifndef GSM_USED_FBUS2DKU5 |
60 | # undef GSM_ENABLE_FBUS2DKU5 | 60 | # undef GSM_ENABLE_FBUS2DKU5 |
61 | #endif | 61 | #endif |
62 | #ifndef GSM_USED_FBUS2PL2303 | 62 | #ifndef GSM_USED_FBUS2PL2303 |
63 | # undef GSM_ENABLE_FBUS2PL2303 | 63 | # undef GSM_ENABLE_FBUS2PL2303 |
64 | #endif | 64 | #endif |
65 | #ifndef GSM_USED_FBUS2BLUE | 65 | #ifndef GSM_USED_FBUS2BLUE |
66 | # undef GSM_ENABLE_FBUS2BLUE | 66 | # undef GSM_ENABLE_FBUS2BLUE |
67 | #endif | 67 | #endif |
68 | #ifndef GSM_USED_FBUS2IRDA | 68 | #ifndef GSM_USED_FBUS2IRDA |
69 | # undef GSM_ENABLE_FBUS2IRDA | 69 | # undef GSM_ENABLE_FBUS2IRDA |
70 | #endif | 70 | #endif |
71 | #ifndef GSM_USED_PHONETBLUE | 71 | #ifndef GSM_USED_PHONETBLUE |
72 | # undef GSM_ENABLE_PHONETBLUE | 72 | # undef GSM_ENABLE_PHONETBLUE |
73 | #endif | 73 | #endif |
74 | #ifndef GSM_USED_AT | 74 | #ifndef GSM_USED_AT |
75 | # undef GSM_ENABLE_AT | 75 | # undef GSM_ENABLE_AT |
76 | #endif | 76 | #endif |
77 | #ifndef GSM_USED_IRDAOBEX | 77 | #ifndef GSM_USED_IRDAOBEX |
78 | # undef GSM_ENABLE_IRDAOBEX | 78 | # undef GSM_ENABLE_IRDAOBEX |
79 | #endif | 79 | #endif |
80 | #ifndef GSM_USED_BLUEOBEX | 80 | #ifndef GSM_USED_BLUEOBEX |
81 | # undef GSM_ENABLE_BLUEOBEX | 81 | # undef GSM_ENABLE_BLUEOBEX |
82 | #endif | 82 | #endif |
83 | #ifndef GSM_USED_ALCABUS | 83 | #ifndef GSM_USED_ALCABUS |
84 | # undef GSM_ENABLE_ALCABUS | 84 | # undef GSM_ENABLE_ALCABUS |
85 | #endif | 85 | #endif |
86 | #ifndef GSM_USED_IRDAPHONET | 86 | #ifndef GSM_USED_IRDAPHONET |
87 | # undef GSM_ENABLE_IRDAPHONET | 87 | # undef GSM_ENABLE_IRDAPHONET |
88 | #endif | 88 | #endif |
89 | #ifndef GSM_USED_BLUEFBUS2 | 89 | #ifndef GSM_USED_BLUEFBUS2 |
90 | # undef GSM_ENABLE_BLUEFBUS2 | 90 | # undef GSM_ENABLE_BLUEFBUS2 |
91 | #endif | 91 | #endif |
92 | #ifndef GSM_USED_BLUEPHONET | 92 | #ifndef GSM_USED_BLUEPHONET |
93 | # undef GSM_ENABLE_BLUEPHONET | 93 | # undef GSM_ENABLE_BLUEPHONET |
94 | #endif | 94 | #endif |
95 | #ifndef GSM_USED_BLUEAT | 95 | #ifndef GSM_USED_BLUEAT |
96 | # undef GSM_ENABLE_BLUEAT | 96 | # undef GSM_ENABLE_BLUEAT |
97 | #endif | 97 | #endif |
98 | #ifndef GSM_USED_IRDAAT | 98 | #ifndef GSM_USED_IRDAAT |
99 | # undef GSM_ENABLE_IRDAAT | 99 | # undef GSM_ENABLE_IRDAAT |
100 | #endif | 100 | #endif |
101 | #ifndef GSM_USED_MROUTERBLUE | 101 | #ifndef GSM_USED_MROUTERBLUE |
102 | # undef GSM_ENABLE_MROUTERBLUE | 102 | # undef GSM_ENABLE_MROUTERBLUE |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | #if defined(GSM_ENABLE_NOKIA3320) || defined(GSM_ENABLE_NOKIA650) || defined(GSM_ENABLE_NOKIA6110) || defined(GSM_ENABLE_NOKIA7110) || defined(GSM_ENABLE_NOKIA9210) | 105 | #if defined(GSM_ENABLE_NOKIA3320) || defined(GSM_ENABLE_NOKIA650) || defined(GSM_ENABLE_NOKIA6110) || defined(GSM_ENABLE_NOKIA7110) || defined(GSM_ENABLE_NOKIA9210) |
106 | # define GSM_ENABLE_NOKIA_DCT3 | 106 | # define GSM_ENABLE_NOKIA_DCT3 |
107 | #endif | 107 | #endif |
108 | #if defined(GSM_ENABLE_NOKIA3650) || defined(GSM_ENABLE_NOKIA6510) | 108 | #if defined(GSM_ENABLE_NOKIA3650) || defined(GSM_ENABLE_NOKIA6510) |
109 | # define GSM_ENABLE_NOKIA_DCT4 | 109 | # define GSM_ENABLE_NOKIA_DCT4 |
110 | #endif | 110 | #endif |
111 | 111 | ||
112 | #include "protocol/protocol.h" | 112 | #include "protocol/protocol.h" |
113 | #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) | 113 | #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) |
114 | # include "protocol/nokia/fbus2.h" | 114 | # include "protocol/nokia/fbus2.h" |
115 | #endif | 115 | #endif |
116 | #ifdef GSM_ENABLE_MBUS2 | 116 | #ifdef GSM_ENABLE_MBUS2 |
117 | # include "protocol/nokia/mbus2.h" | 117 | # include "protocol/nokia/mbus2.h" |
118 | #endif | 118 | #endif |
119 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) | 119 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) |
120 | # include "protocol/nokia/phonet.h" | 120 | # include "protocol/nokia/phonet.h" |
121 | #endif | 121 | #endif |
122 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) | 122 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) |
123 | # include "protocol/at/at.h" | 123 | # include "protocol/at/at.h" |
124 | #endif | 124 | #endif |
125 | #ifdef GSM_ENABLE_ALCABUS | 125 | #ifdef GSM_ENABLE_ALCABUS |
126 | # include "protocol/alcatel/alcabus.h" | 126 | # include "protocol/alcatel/alcabus.h" |
127 | #endif | 127 | #endif |
128 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) | 128 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) |
129 | # include "protocol/obex/obex.h" | 129 | # include "protocol/obex/obex.h" |
130 | #endif | 130 | #endif |
131 | #if defined(GSM_ENABLE_MROUTERBLUE) | 131 | #if defined(GSM_ENABLE_MROUTERBLUE) |
132 | # include "protocol/symbian/mrouter.h" | 132 | # include "protocol/symbian/mrouter.h" |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | #define GSM_ENABLE_SERIALDEVICE | 135 | #define GSM_ENABLE_SERIALDEVICE |
136 | #ifndef GSM_USED_SERIALDEVICE | 136 | #ifndef GSM_USED_SERIALDEVICE |
137 | # undef GSM_ENABLE_SERIALDEVICE | 137 | # undef GSM_ENABLE_SERIALDEVICE |
138 | #endif | 138 | #endif |
139 | #define GSM_ENABLE_IRDADEVICE | 139 | #define GSM_ENABLE_IRDADEVICE |
140 | #ifndef GSM_USED_IRDADEVICE | 140 | #ifndef GSM_USED_IRDADEVICE |
141 | # undef GSM_ENABLE_IRDADEVICE | 141 | # undef GSM_ENABLE_IRDADEVICE |
142 | #endif | 142 | #endif |
143 | #define GSM_ENABLE_BLUETOOTHDEVICE | 143 | #define GSM_ENABLE_BLUETOOTHDEVICE |
144 | #ifndef GSM_USED_BLUETOOTHDEVICE | 144 | #ifndef GSM_USED_BLUETOOTHDEVICE |
145 | # undef GSM_ENABLE_BLUETOOTHDEVICE | 145 | # undef GSM_ENABLE_BLUETOOTHDEVICE |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | #ifdef DJGPP | 148 | #ifdef DJGPP |
149 | # undef GSM_ENABLE_IRDADEVICE | 149 | # undef GSM_ENABLE_IRDADEVICE |
150 | # undef GSM_ENABLE_IRDAPHONET | 150 | # undef GSM_ENABLE_IRDAPHONET |
151 | # undef GSM_ENABLE_IRDAOBEX | 151 | # undef GSM_ENABLE_IRDAOBEX |
152 | # undef GSM_ENABLE_IRDAAT | 152 | # undef GSM_ENABLE_IRDAAT |
153 | # undef GSM_ENABLE_FBUS2IRDA | 153 | # undef GSM_ENABLE_FBUS2IRDA |
154 | 154 | ||
155 | # undef GSM_ENABLE_BLUETOOTHDEVICE | 155 | # undef GSM_ENABLE_BLUETOOTHDEVICE |
156 | # undef GSM_ENABLE_BLUEPHONET | 156 | # undef GSM_ENABLE_BLUEPHONET |
157 | # undef GSM_ENABLE_BLUEOBEX | 157 | # undef GSM_ENABLE_BLUEOBEX |
158 | # undef GSM_ENABLE_BLUEAT | 158 | # undef GSM_ENABLE_BLUEAT |
159 | # undef GSM_ENABLE_BLUEFBUS2 | 159 | # undef GSM_ENABLE_BLUEFBUS2 |
160 | # undef GSM_ENABLE_PHONETBLUE | 160 | # undef GSM_ENABLE_PHONETBLUE |
161 | # undef GSM_ENABLE_FBUS2BLUE | 161 | # undef GSM_ENABLE_FBUS2BLUE |
162 | # undef GSM_ENABLE_MROUTERBLUE | 162 | # undef GSM_ENABLE_MROUTERBLUE |
163 | #endif | 163 | #endif |
164 | |||
165 | #ifndef WIN32 | 164 | #ifndef WIN32 |
166 | # ifdef ENABLE_LGPL | 165 | # ifdef ENABLE_LGPL |
167 | # undef GSM_ENABLE_IRDADEVICE | 166 | # undef GSM_ENABLE_IRDADEVICE |
168 | # undef GSM_ENABLE_IRDAPHONET | 167 | # undef GSM_ENABLE_IRDAPHONET |
169 | # undef GSM_ENABLE_IRDAOBEX | 168 | # undef GSM_ENABLE_IRDAOBEX |
170 | # undef GSM_ENABLE_IRDAAT | 169 | # undef GSM_ENABLE_IRDAAT |
171 | # undef GSM_ENABLE_FBUS2IRDA | 170 | # undef GSM_ENABLE_FBUS2IRDA |
172 | 171 | ||
173 | # undef GSM_ENABLE_BLUETOOTHDEVICE | 172 | # undef GSM_ENABLE_BLUETOOTHDEVICE |
174 | # undef GSM_ENABLE_BLUEPHONET | 173 | # undef GSM_ENABLE_BLUEPHONET |
175 | # undef GSM_ENABLE_BLUEOBEX | 174 | # undef GSM_ENABLE_BLUEOBEX |
176 | # undef GSM_ENABLE_BLUEAT | 175 | # undef GSM_ENABLE_BLUEAT |
177 | # undef GSM_ENABLE_BLUEFBUS2 | 176 | # undef GSM_ENABLE_BLUEFBUS2 |
178 | # undef GSM_ENABLE_PHONETBLUE | 177 | # undef GSM_ENABLE_PHONETBLUE |
179 | # undef GSM_ENABLE_FBUS2BLUE | 178 | # undef GSM_ENABLE_FBUS2BLUE |
180 | # undef GSM_ENABLE_MROUTERBLUE | 179 | # undef GSM_ENABLE_MROUTERBLUE |
181 | # endif | 180 | # endif |
182 | #endif | 181 | #endif |
183 | 182 | ||
184 | #ifdef GSM_ENABLE_SERIALDEVICE | 183 | #ifdef GSM_ENABLE_SERIALDEVICE |
185 | # include "device/serial/ser_w32.h" | 184 | # include "device/serial/ser_w32.h" |
186 | # include "device/serial/ser_unx.h" | 185 | # include "device/serial/ser_unx.h" |
187 | # include "device/serial/ser_djg.h" | 186 | # include "device/serial/ser_djg.h" |
188 | #endif | 187 | #endif |
189 | #ifdef GSM_ENABLE_IRDADEVICE | 188 | #ifdef GSM_ENABLE_IRDADEVICE |
190 | # include "device/irda/irda.h" | 189 | # include "device/irda/irda.h" |
191 | #endif | 190 | #endif |
192 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE | 191 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE |
193 | # include "device/bluetoth/bluetoth.h" | 192 | # include "device/bluetoth/bluetoth.h" |
194 | #endif | 193 | #endif |
195 | 194 | ||
196 | #include "service/gsmpbk.h" | 195 | #include "service/gsmpbk.h" |
197 | #include "service/gsmnet.h" | 196 | #include "service/gsmnet.h" |
198 | #include "service/gsmring.h" | 197 | #include "service/gsmring.h" |
199 | #include "service/gsmcal.h" | 198 | #include "service/gsmcal.h" |
200 | #include "service/gsmdata.h" | 199 | #include "service/gsmdata.h" |
201 | #include "service/gsmlogo.h" | 200 | #include "service/gsmlogo.h" |
202 | #include "service/gsmmisc.h" | 201 | #include "service/gsmmisc.h" |
203 | #include "service/gsmprof.h" | 202 | #include "service/gsmprof.h" |
204 | #include "service/gsmcall.h" | 203 | #include "service/gsmcall.h" |
205 | #include "service/sms/gsmsms.h" | 204 | #include "service/sms/gsmsms.h" |
206 | #include "service/sms/gsmems.h" | 205 | #include "service/sms/gsmems.h" |
207 | #include "service/sms/gsmmulti.h" | 206 | #include "service/sms/gsmmulti.h" |
208 | #include "service/backup/gsmback.h" | 207 | #include "service/backup/gsmback.h" |
209 | 208 | ||
210 | 209 | ||
211 | /* ------------------------- Device layer ---------------------------------- */ | 210 | /* ------------------------- Device layer ---------------------------------- */ |
212 | 211 | ||
213 | /** | 212 | /** |
214 | * Device functions, each device has to provide these. | 213 | * Device functions, each device has to provide these. |
215 | */ | 214 | */ |
216 | typedef struct { | 215 | typedef struct { |
217 | /** | 216 | /** |
218 | * Opens device. | 217 | * Opens device. |
219 | */ | 218 | */ |
220 | GSM_Error (*OpenDevice) (GSM_StateMachine *s); | 219 | GSM_Error (*OpenDevice) (GSM_StateMachine *s); |
221 | /** | 220 | /** |
222 | * Closes device. | 221 | * Closes device. |
223 | */ | 222 | */ |
224 | GSM_Error (*CloseDevice) (GSM_StateMachine *s); | 223 | GSM_Error (*CloseDevice) (GSM_StateMachine *s); |
225 | /** | 224 | /** |
226 | * Sets parity for device. | 225 | * Sets parity for device. |
227 | */ | 226 | */ |
228 | GSM_Error (*DeviceSetParity) (GSM_StateMachine *s, bool parity); | 227 | GSM_Error (*DeviceSetParity) (GSM_StateMachine *s, bool parity); |
229 | /** | 228 | /** |
230 | * Sets dtr (data to read) and rts (ready to send) flags. | 229 | * Sets dtr (data to read) and rts (ready to send) flags. |
231 | */ | 230 | */ |
232 | GSM_Error (*DeviceSetDtrRts) (GSM_StateMachine *s, bool dtr, bool rts); | 231 | GSM_Error (*DeviceSetDtrRts) (GSM_StateMachine *s, bool dtr, bool rts); |
233 | /** | 232 | /** |
234 | * Sets device speed. | 233 | * Sets device speed. |
235 | */ | 234 | */ |
236 | GSM_Error (*DeviceSetSpeed) (GSM_StateMachine *s, int speed); | 235 | GSM_Error (*DeviceSetSpeed) (GSM_StateMachine *s, int speed); |
237 | /** | 236 | /** |
238 | * Attempts to read nbytes from device. | 237 | * Attempts to read nbytes from device. |
239 | */ | 238 | */ |
240 | int (*ReadDevice) (GSM_StateMachine *s, void *buf, size_t nbytes); | 239 | int (*ReadDevice) (GSM_StateMachine *s, void *buf, size_t nbytes); |
241 | /** | 240 | /** |
242 | * Attempts to read nbytes from device. | 241 | * Attempts to read nbytes from device. |
243 | */ | 242 | */ |
244 | int (*WriteDevice) (GSM_StateMachine *s, void *buf, size_t nbytes); | 243 | int (*WriteDevice) (GSM_StateMachine *s, void *buf, size_t nbytes); |
245 | } GSM_Device_Functions; | 244 | } GSM_Device_Functions; |
246 | 245 | ||
247 | #ifdef GSM_ENABLE_SERIALDEVICE | 246 | #ifdef GSM_ENABLE_SERIALDEVICE |
248 | extern GSM_Device_Functions SerialDevice; | 247 | extern GSM_Device_Functions SerialDevice; |
249 | #endif | 248 | #endif |
250 | #ifdef GSM_ENABLE_IRDADEVICE | 249 | #ifdef GSM_ENABLE_IRDADEVICE |
251 | extern GSM_Device_Functions IrdaDevice; | 250 | extern GSM_Device_Functions IrdaDevice; |
252 | #endif | 251 | #endif |
253 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE | 252 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE |
254 | extern GSM_Device_Functions BlueToothDevice; | 253 | extern GSM_Device_Functions BlueToothDevice; |
255 | #endif | 254 | #endif |
256 | 255 | ||
257 | /** | 256 | /** |
258 | * Structure containing device specific data and pointer to device functions - | 257 | * Structure containing device specific data and pointer to device functions - |
259 | * @ref GSM_Device_Functions. The data are in a union, so you can use only | 258 | * @ref GSM_Device_Functions. The data are in a union, so you can use only |
260 | * one device at one time. | 259 | * one device at one time. |
261 | */ | 260 | */ |
262 | typedef struct { | 261 | typedef struct { |
263 | union { | 262 | union { |
264 | char fake; | 263 | char fake; |
265 | #ifdef GSM_ENABLE_SERIALDEVICE | 264 | #ifdef GSM_ENABLE_SERIALDEVICE |
266 | GSM_Device_SerialData Serial; | 265 | GSM_Device_SerialData Serial; |
267 | #endif | 266 | #endif |
268 | #ifdef GSM_ENABLE_IRDADEVICE | 267 | #ifdef GSM_ENABLE_IRDADEVICE |
269 | GSM_Device_IrdaData Irda; | 268 | GSM_Device_IrdaData Irda; |
270 | #endif | 269 | #endif |
271 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE | 270 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE |
272 | GSM_Device_BlueToothDataBlueTooth; | 271 | GSM_Device_BlueToothDataBlueTooth; |
273 | #endif | 272 | #endif |
274 | } Data; | 273 | } Data; |
275 | GSM_Device_Functions *Functions; | 274 | GSM_Device_Functions *Functions; |
276 | } GSM_Device; | 275 | } GSM_Device; |
277 | 276 | ||
278 | /* ---------------------- Protocol layer ----------------------------------- */ | 277 | /* ---------------------- Protocol layer ----------------------------------- */ |
279 | 278 | ||
280 | /** | 279 | /** |
281 | * Protocol functions, each protocol has to implement these. | 280 | * Protocol functions, each protocol has to implement these. |
282 | */ | 281 | */ |
283 | typedef struct { | 282 | typedef struct { |
284 | /** | 283 | /** |
285 | * Writes message to device. | 284 | * Writes message to device. |
286 | */ | 285 | */ |
287 | GSM_Error (*WriteMessage) (GSM_StateMachine *s, unsigned char *buffer, | 286 | GSM_Error (*WriteMessage) (GSM_StateMachine *s, unsigned char *buffer, |
288 | int length, unsigned char type); | 287 | int length, unsigned char type); |
289 | /** | 288 | /** |
290 | * This one is called when character is received from device. | 289 | * This one is called when character is received from device. |
291 | */ | 290 | */ |
292 | GSM_Error (*StateMachine) (GSM_StateMachine *s, unsigned char rx_char); | 291 | GSM_Error (*StateMachine) (GSM_StateMachine *s, unsigned char rx_char); |
293 | /** | 292 | /** |
294 | * Protocol initialisation. | 293 | * Protocol initialisation. |
295 | */ | 294 | */ |
296 | GSM_Error (*Initialise) (GSM_StateMachine *s); | 295 | GSM_Error (*Initialise) (GSM_StateMachine *s); |
297 | /** | 296 | /** |
298 | * Protocol termination. | 297 | * Protocol termination. |
299 | */ | 298 | */ |
300 | GSM_Error (*Terminate) (GSM_StateMachine *s); | 299 | GSM_Error (*Terminate) (GSM_StateMachine *s); |
301 | } GSM_Protocol_Functions; | 300 | } GSM_Protocol_Functions; |
302 | 301 | ||
303 | #ifdef GSM_ENABLE_MBUS2 | 302 | #ifdef GSM_ENABLE_MBUS2 |
304 | extern GSM_Protocol_Functions MBUS2Protocol; | 303 | extern GSM_Protocol_Functions MBUS2Protocol; |
305 | #endif | 304 | #endif |
306 | #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2PL2303) | 305 | #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2PL2303) |
307 | extern GSM_Protocol_Functions FBUS2Protocol; | 306 | extern GSM_Protocol_Functions FBUS2Protocol; |
308 | #endif | 307 | #endif |
309 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) | 308 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) |
310 | extern GSM_Protocol_Functions PHONETProtocol; | 309 | extern GSM_Protocol_Functions PHONETProtocol; |
311 | #endif | 310 | #endif |
312 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) | 311 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) |
313 | extern GSM_Protocol_Functions ATProtocol; | 312 | extern GSM_Protocol_Functions ATProtocol; |
314 | #endif | 313 | #endif |
315 | #ifdef GSM_ENABLE_ALCABUS | 314 | #ifdef GSM_ENABLE_ALCABUS |
316 | extern GSM_Protocol_Functions ALCABUSProtocol; | 315 | extern GSM_Protocol_Functions ALCABUSProtocol; |
317 | #endif | 316 | #endif |
318 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) | 317 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) |
319 | extern GSM_Protocol_Functions OBEXProtocol; | 318 | extern GSM_Protocol_Functions OBEXProtocol; |
320 | #endif | 319 | #endif |
321 | #if defined(GSM_ENABLE_MROUTERBLUE) | 320 | #if defined(GSM_ENABLE_MROUTERBLUE) |
322 | extern GSM_Protocol_Functions MROUTERProtocol; | 321 | extern GSM_Protocol_Functions MROUTERProtocol; |
323 | #endif | 322 | #endif |
324 | 323 | ||
325 | /** | 324 | /** |
326 | * Structure containing protocol specific data and pointer to protocol | 325 | * Structure containing protocol specific data and pointer to protocol |
327 | * functions - @ref GSM_Protocol_Functions. The data are in a structure, so | 326 | * functions - @ref GSM_Protocol_Functions. The data are in a structure, so |
328 | * you may use more protocols at once and switch between them. | 327 | * you may use more protocols at once and switch between them. |
329 | */ | 328 | */ |
330 | typedef struct { | 329 | typedef struct { |
331 | struct { | 330 | struct { |
332 | char fake; | 331 | char fake; |
333 | #ifdef GSM_ENABLE_MBUS2 | 332 | #ifdef GSM_ENABLE_MBUS2 |
334 | GSM_Protocol_MBUS2Data MBUS2; | 333 | GSM_Protocol_MBUS2Data MBUS2; |
335 | #endif | 334 | #endif |
336 | #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) | 335 | #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) |
337 | GSM_Protocol_FBUS2Data FBUS2; | 336 | GSM_Protocol_FBUS2Data FBUS2; |
338 | #endif | 337 | #endif |
339 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) | 338 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) |
340 | GSM_Protocol_PHONETData PHONET; | 339 | GSM_Protocol_PHONETData PHONET; |
341 | #endif | 340 | #endif |
342 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) | 341 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) |
343 | GSM_Protocol_ATData AT; | 342 | GSM_Protocol_ATData AT; |
344 | #endif | 343 | #endif |
345 | #ifdef GSM_ENABLE_ALCABUS | 344 | #ifdef GSM_ENABLE_ALCABUS |
346 | GSM_Protocol_ALCABUSDataALCABUS; | 345 | GSM_Protocol_ALCABUSDataALCABUS; |
347 | #endif | 346 | #endif |
348 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) | 347 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) |
349 | GSM_Protocol_OBEXData OBEX; | 348 | GSM_Protocol_OBEXData OBEX; |
350 | #endif | 349 | #endif |
351 | #if defined(GSM_ENABLE_MROUTERBLUE) | 350 | #if defined(GSM_ENABLE_MROUTERBLUE) |
352 | GSM_Protocol_MROUTERDataMROUTER; | 351 | GSM_Protocol_MROUTERDataMROUTER; |
353 | #endif | 352 | #endif |
354 | } Data; | 353 | } Data; |
355 | GSM_Protocol_Functions *Functions; | 354 | GSM_Protocol_Functions *Functions; |
356 | } GSM_Protocol; | 355 | } GSM_Protocol; |
@@ -1388,192 +1387,193 @@ typedef struct { | |||
1388 | } GSM_Phone; | 1387 | } GSM_Phone; |
1389 | 1388 | ||
1390 | /* --------------------------- User layer ---------------------------------- */ | 1389 | /* --------------------------- User layer ---------------------------------- */ |
1391 | 1390 | ||
1392 | struct _GSM_User { | 1391 | struct _GSM_User { |
1393 | GSM_Reply_Function *UserReplyFunctions; | 1392 | GSM_Reply_Function *UserReplyFunctions; |
1394 | 1393 | ||
1395 | void (*IncomingCall) (char *Device, GSM_Call call); | 1394 | void (*IncomingCall) (char *Device, GSM_Call call); |
1396 | void (*IncomingSMS)(char *Device, GSM_SMSMessage sms); | 1395 | void (*IncomingSMS)(char *Device, GSM_SMSMessage sms); |
1397 | void (*IncomingCB) (char *Device, GSM_CBMessage cb); | 1396 | void (*IncomingCB) (char *Device, GSM_CBMessage cb); |
1398 | void (*IncomingUSSD) (char *Device, char *Text); | 1397 | void (*IncomingUSSD) (char *Device, char *Text); |
1399 | void (*SendSMSStatus) (char *Device, int status, int MessageReference); | 1398 | void (*SendSMSStatus) (char *Device, int status, int MessageReference); |
1400 | }; | 1399 | }; |
1401 | 1400 | ||
1402 | /* --------------------------- Statemachine layer -------------------------- */ | 1401 | /* --------------------------- Statemachine layer -------------------------- */ |
1403 | 1402 | ||
1404 | typedef enum { | 1403 | typedef enum { |
1405 | GCT_MBUS2=1, | 1404 | GCT_MBUS2=1, |
1406 | GCT_FBUS2, | 1405 | GCT_FBUS2, |
1407 | GCT_FBUS2DLR3, | 1406 | GCT_FBUS2DLR3, |
1408 | GCT_FBUS2DKU5, | 1407 | GCT_FBUS2DKU5, |
1409 | GCT_FBUS2PL2303, | 1408 | GCT_FBUS2PL2303, |
1410 | GCT_FBUS2BLUE, | 1409 | GCT_FBUS2BLUE, |
1411 | GCT_FBUS2IRDA, | 1410 | GCT_FBUS2IRDA, |
1412 | GCT_PHONETBLUE, | 1411 | GCT_PHONETBLUE, |
1413 | GCT_AT, | 1412 | GCT_AT, |
1414 | GCT_MROUTERBLUE, | 1413 | GCT_MROUTERBLUE, |
1415 | 1414 | ||
1416 | GCT_IRDAOBEX, | 1415 | GCT_IRDAOBEX, |
1417 | GCT_IRDAAT, | 1416 | GCT_IRDAAT, |
1418 | GCT_IRDAPHONET, | 1417 | GCT_IRDAPHONET, |
1419 | GCT_BLUEFBUS2, | 1418 | GCT_BLUEFBUS2, |
1420 | GCT_BLUEAT, | 1419 | GCT_BLUEAT, |
1421 | GCT_BLUEPHONET, | 1420 | GCT_BLUEPHONET, |
1422 | GCT_BLUEOBEX | 1421 | GCT_BLUEOBEX |
1423 | } GSM_ConnectionType; | 1422 | } GSM_ConnectionType; |
1424 | 1423 | ||
1425 | typedef struct { | 1424 | typedef struct { |
1426 | /* Config file (or Registry or...) variables */ | 1425 | /* Config file (or Registry or...) variables */ |
1427 | char Model[50]; /* Model from config file */ | 1426 | char Model[50]; /* Model from config file */ |
1428 | char DebugLevel[50]; /* Debug level */ | 1427 | char DebugLevel[50]; /* Debug level */ |
1429 | char *Device; /* Device name from config file */ | 1428 | char *Device; /* Device name from config file */ |
1430 | char *Connection; /* Connection type as string */ | 1429 | char *Connection; /* Connection type as string */ |
1431 | char *SyncTime; /* Synchronize time on startup? */ | 1430 | char *SyncTime; /* Synchronize time on startup? */ |
1432 | char *LockDevice; /* Lock device ? (Unix) */ | 1431 | char *LockDevice; /* Lock device ? (Unix) */ |
1433 | char *DebugFile; /* Name of debug file */ | 1432 | char *DebugFile; /* Name of debug file */ |
1434 | char *Localize; /* Name of localisation file */ | 1433 | char *Localize; /* Name of localisation file */ |
1435 | char *StartInfo; /* Display something during start ? */ | 1434 | char *StartInfo; /* Display something during start ? */ |
1436 | bool UseGlobalDebugFile;/* Should we use global debug file?*/ | 1435 | bool UseGlobalDebugFile;/* Should we use global debug file?*/ |
1437 | bool DefaultModel; | 1436 | bool DefaultModel; |
1438 | bool DefaultDebugLevel; | 1437 | bool DefaultDebugLevel; |
1439 | bool DefaultDevice; | 1438 | bool DefaultDevice; |
1440 | bool DefaultConnection; | 1439 | bool DefaultConnection; |
1441 | bool DefaultSyncTime; | 1440 | bool DefaultSyncTime; |
1442 | bool DefaultLockDevice; | 1441 | bool DefaultLockDevice; |
1443 | bool DefaultDebugFile; | 1442 | bool DefaultDebugFile; |
1444 | bool DefaultLocalize; | 1443 | bool DefaultLocalize; |
1445 | bool DefaultStartInfo; | 1444 | bool DefaultStartInfo; |
1446 | } GSM_Config; | 1445 | } GSM_Config; |
1447 | 1446 | ||
1448 | #define MAX_CONFIG_NUM 5 | 1447 | #define MAX_CONFIG_NUM 5 |
1449 | 1448 | ||
1450 | struct _GSM_StateMachine { | 1449 | struct _GSM_StateMachine { |
1451 | GSM_ConnectionType ConnectionType; /* Type of connection as int */ | 1450 | GSM_ConnectionType ConnectionType; /* Type of connection as int */ |
1452 | char *LockFile; /* Lock file name for Unix */ | 1451 | char *LockFile; /* Lock file name for Unix */ |
1453 | Debug_Info di; /* Debug information */ | 1452 | Debug_Info di; /* Debug information */ |
1454 | bool opened; /* Is connection opened ? */ | 1453 | bool opened; /* Is connection opened ? */ |
1455 | GSM_Config Config[MAX_CONFIG_NUM + 1]; | 1454 | GSM_Config Config[MAX_CONFIG_NUM + 1]; |
1456 | GSM_Config *CurrentConfig; /* Config file (or Registry or...) variables */ | 1455 | GSM_Config *CurrentConfig; /* Config file (or Registry or...) variables */ |
1457 | int ConfigNum; | 1456 | int ConfigNum; |
1458 | INI_Section *msg; /* Localisation strings structure */ | 1457 | INI_Section *msg; /* Localisation strings structure */ |
1459 | int ReplyNum; /* How many times make sth. */ | 1458 | int ReplyNum; /* How many times make sth. */ |
1460 | int Speed; /* For some protocols used speed */ | 1459 | int Speed; /* For some protocols used speed */ |
1461 | 1460 | ||
1462 | GSM_Device Device; | 1461 | GSM_Device Device; |
1463 | GSM_Protocol Protocol; | 1462 | GSM_Protocol Protocol; |
1464 | GSM_Phone Phone; | 1463 | GSM_Phone Phone; |
1465 | GSM_User User; | 1464 | GSM_User User; |
1466 | }; | 1465 | }; |
1467 | 1466 | ||
1468 | /* ------------------------ Other general definitions ---------------------- */ | 1467 | /* ------------------------ Other general definitions ---------------------- */ |
1469 | 1468 | ||
1470 | GSM_Error GSM_RegisterAllPhoneModules(GSM_StateMachine *s); | 1469 | GSM_Error GSM_RegisterAllPhoneModules(GSM_StateMachine *s); |
1471 | 1470 | ||
1472 | GSM_Error GSM_InitConnection (GSM_StateMachine *s, int ReplyNum); | 1471 | GSM_Error GSM_InitConnection (GSM_StateMachine *s, int ReplyNum); |
1473 | GSM_Error GSM_TerminateConnection(GSM_StateMachine *s); | 1472 | GSM_Error GSM_TerminateConnection(GSM_StateMachine *s); |
1474 | 1473 | ||
1475 | int GSM_ReadDevice (GSM_StateMachine *s, bool wait); | 1474 | int GSM_ReadDevice (GSM_StateMachine *s, bool wait); |
1476 | 1475 | ||
1477 | GSM_Error GSM_WaitForOnce (GSM_StateMachine *s, unsigned char *buffer, | 1476 | GSM_Error GSM_WaitForOnce (GSM_StateMachine *s, unsigned char *buffer, |
1478 | int length, unsigned char type, int time); | 1477 | int length, unsigned char type, int time); |
1479 | 1478 | ||
1480 | GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer, | 1479 | GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer, |
1481 | int length, unsigned char type, int time, | 1480 | int length, unsigned char type, int time, |
1482 | GSM_Phone_RequestID request); | 1481 | GSM_Phone_RequestID request); |
1483 | 1482 | ||
1484 | GSM_Error GSM_DispatchMessage (GSM_StateMachine *s); | 1483 | GSM_Error GSM_DispatchMessage (GSM_StateMachine *s); |
1485 | 1484 | ||
1486 | INI_Section *GSM_FindGammuRC(void); | 1485 | INI_Section *GSM_FindGammuRC(void); |
1487 | 1486 | ||
1488 | bool GSM_ReadConfig (INI_Section *cfg_info, GSM_Config *cfg, int num); | 1487 | bool GSM_ReadConfig (INI_Section *cfg_info, GSM_Config *cfg, int num); |
1489 | 1488 | ||
1490 | void GSM_DumpMessageLevel2 (GSM_StateMachine *s, unsigned char *message, int messagesize, int type); | 1489 | void GSM_DumpMessageLevel2 (GSM_StateMachine *s, unsigned char *message, int messagesize, int type); |
1491 | void GSM_DumpMessageLevel3 (GSM_StateMachine *s, unsigned char *message, int messagesize, int type); | 1490 | void GSM_DumpMessageLevel3 (GSM_StateMachine *s, unsigned char *message, int messagesize, int type); |
1492 | 1491 | ||
1493 | /* ---------------------- Phone features ----------------------------------- */ | 1492 | /* ---------------------- Phone features ----------------------------------- */ |
1494 | 1493 | ||
1495 | typedef enum { | 1494 | typedef enum { |
1496 | /* n6110.c */ | 1495 | /* n6110.c */ |
1497 | F_CAL33 = 1, /* Calendar,3310 style - 10 reminders, Unicode, 3 coding types*/ | 1496 | F_CAL33 = 1, /* Calendar,3310 style - 10 reminders, Unicode, 3 coding types*/ |
1498 | F_CAL52, /* Calendar,5210 style - full Unicode, etc. */ | 1497 | F_CAL52, /* Calendar,5210 style - full Unicode, etc. */ |
1499 | F_CAL82, /* Calendar,8250 style - "normal", but with Unicode */ | 1498 | F_CAL82, /* Calendar,8250 style - "normal", but with Unicode */ |
1500 | F_RING_SM, /* Ringtones returned in SM format - 33xx */ | 1499 | F_RING_SM, /* Ringtones returned in SM format - 33xx */ |
1501 | F_NORING, /* No ringtones */ | 1500 | F_NORING, /* No ringtones */ |
1502 | F_NOPBKUNICODE, /* No phonebook in Unicode */ | 1501 | F_NOPBKUNICODE, /* No phonebook in Unicode */ |
1503 | F_NOWAP, /* No WAP */ | 1502 | F_NOWAP, /* No WAP */ |
1504 | F_NOCALLER, /* No caller groups */ | 1503 | F_NOCALLER, /* No caller groups */ |
1505 | F_NOPICTURE, /* No Picture Images */ | 1504 | F_NOPICTURE, /* No Picture Images */ |
1506 | F_NOPICTUREUNI, /* No Picture Images text in Unicode */ | 1505 | F_NOPICTUREUNI, /* No Picture Images text in Unicode */ |
1507 | F_NOSTARTUP, /* No startup logo */ | 1506 | F_NOSTARTUP, /* No startup logo */ |
1508 | F_NOCALENDAR, /* No calendar */ | 1507 | F_NOCALENDAR, /* No calendar */ |
1509 | F_NOSTARTANI, /* Startup logo is not animated */ | 1508 | F_NOSTARTANI, /* Startup logo is not animated */ |
1510 | F_POWER_BATT, /* Network and battery level get from netmonitor */ | 1509 | F_POWER_BATT, /* Network and battery level get from netmonitor */ |
1511 | F_PROFILES33, /* Phone profiles in 3310 style */ | 1510 | F_PROFILES33, /* Phone profiles in 3310 style */ |
1512 | F_PROFILES51, /* Phone profiles in 5110 style */ | 1511 | F_PROFILES51, /* Phone profiles in 5110 style */ |
1513 | F_MAGICBYTES, /* Phone can make authentication with magic bytes */ | 1512 | F_MAGICBYTES, /* Phone can make authentication with magic bytes */ |
1514 | F_NODTMF, /* Phone can't send DTMF */ | 1513 | F_NODTMF, /* Phone can't send DTMF */ |
1515 | F_DISPSTATUS, /* Phone return display status */ | 1514 | F_DISPSTATUS, /* Phone return display status */ |
1516 | F_NOCALLINFO, | 1515 | F_NOCALLINFO, |
1517 | 1516 | ||
1518 | /* n3320.c */ | 1517 | /* n3320.c */ |
1519 | F_DAYMONTH, /* Day and month reversed in pbk, when compare to GSM models*/ | 1518 | F_DAYMONTH, /* Day and month reversed in pbk, when compare to GSM models*/ |
1520 | 1519 | ||
1521 | /* n6510.c */ | 1520 | /* n6510.c */ |
1522 | F_PBK35, /* Phonebook in 3510 style with ringtones ID */ | 1521 | F_PBK35, /* Phonebook in 3510 style with ringtones ID */ |
1523 | F_PBKIMG, /* Phonebook in 7250 style with picture ID */ | 1522 | F_PBKIMG, /* Phonebook in 7250 style with picture ID */ |
1524 | F_PBKTONEGAL,/* Phonebook with selecting ringtones from gallery */ | 1523 | F_PBKTONEGAL,/* Phonebook with selecting ringtones from gallery */ |
1525 | F_PBKSMSLIST, /* Phonebook with SMS list */ | 1524 | F_PBKSMSLIST, /* Phonebook with SMS list */ |
1526 | F_PBKUSER, /* Phonebook with user ID */ | 1525 | F_PBKUSER, /* Phonebook with user ID */ |
1527 | F_RADIO, /* Phone with FM radio */ | 1526 | F_RADIO, /* Phone with FM radio */ |
1528 | F_TODO63, /* ToDo in 6310 style - 0x55 msg type */ | 1527 | F_TODO63, /* ToDo in 6310 style - 0x55 msg type */ |
1529 | F_TODO66, /* ToDo in 6610 style - like calendar, with date and other*/ | 1528 | F_TODO66, /* ToDo in 6610 style - like calendar, with date and other*/ |
1530 | F_NOMIDI, /* No ringtones in MIDI */ | 1529 | F_NOMIDI, /* No ringtones in MIDI */ |
1531 | F_BLUETOOTH, /* Bluetooth support */ | 1530 | F_BLUETOOTH, /* Bluetooth support */ |
1532 | F_NOFILESYSTEM, /* No images, ringtones, java saved in special filesystem*/ | 1531 | F_NOFILESYSTEM, /* No images, ringtones, java saved in special filesystem*/ |
1533 | F_NOMMS, /* No MMS sets in phone */ | 1532 | F_NOMMS, /* No MMS sets in phone */ |
1534 | F_NOGPRSPOINT, /* GPRS point are not useable */ | 1533 | F_NOGPRSPOINT, /* GPRS point are not useable */ |
1535 | F_CAL35, /* Calendar,3510 style - Reminder,Call,Birthday */ | 1534 | F_CAL35, /* Calendar,3510 style - Reminder,Call,Birthday */ |
1536 | F_CAL65, /* Calendar,6510 style - CBMM, method 3 */ | 1535 | F_CAL65, /* Calendar,6510 style - CBMM, method 3 */ |
1537 | F_WAPMMSPROXY, /* WAP & MMS settings contains first & second proxy */ | 1536 | F_WAPMMSPROXY, /* WAP & MMS settings contains first & second proxy */ |
1538 | 1537 | ||
1539 | /* n6510.c && n7110.c */ | 1538 | /* n6510.c && n7110.c */ |
1540 | F_VOICETAGS, /* Voice tags available */ | 1539 | F_VOICETAGS, /* Voice tags available */ |
1541 | F_CAL62, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */ | 1540 | F_CAL62, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */ |
1542 | F_NOTES, | 1541 | F_NOTES, |
1543 | 1542 | ||
1544 | /* AT modules */ | 1543 | /* AT modules */ |
1545 | F_SMSONLYSENT, /* Phone supports only sent/unsent messages */ | 1544 | F_SMSONLYSENT, /* Phone supports only sent/unsent messages */ |
1546 | F_BROKENCPBS, /* CPBS on some memories can hang phone */ | 1545 | F_BROKENCPBS, /* CPBS on some memories can hang phone */ |
1547 | F_M20SMS, /* Siemens M20 like SMS handling */ | 1546 | F_M20SMS, /* Siemens M20 like SMS handling */ |
1548 | F_SLOWWRITE, /* Use slower writing which some phone need */ | 1547 | F_SLOWWRITE, /* Use slower writing which some phone need */ |
1549 | F_SMSME900, /* SMS in ME start from location 900 - case of Sagem */ | 1548 | F_SMSME900, /* SMS in ME start from location 900 - case of Sagem */ |
1550 | F_ALCATEL /* Phone supports Alcatel protocol */ | 1549 | F_ALCATEL /* Phone supports Alcatel protocol */ |
1551 | } Feature; | 1550 | } Feature; |
1552 | 1551 | ||
1553 | /* For models table */ | 1552 | /* For models table */ |
1554 | struct _OnePhoneModel { | 1553 | struct _OnePhoneModel { |
1555 | char *model; | 1554 | char *model; |
1556 | char *number; | 1555 | char *number; |
1557 | char *irdamodel; | 1556 | char *irdamodel; |
1558 | Feature features[12]; | 1557 | Feature features[12]; |
1559 | }; | 1558 | }; |
1560 | 1559 | ||
1561 | bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature); | 1560 | bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature); |
1562 | OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel); | 1561 | OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel); |
1563 | 1562 | ||
1564 | #ifdef __GNUC__ | 1563 | #ifdef __GNUC__ |
1565 | __attribute__((format(printf, 2, 3))) | 1564 | __attribute__((format(printf, 2, 3))) |
1566 | #endif | 1565 | #endif |
1567 | int smprintf(GSM_StateMachine *s, const char *format, ...); | 1566 | int smprintf(GSM_StateMachine *s, const char *format, ...); |
1568 | 1567 | ||
1569 | void GSM_OSErrorInfo(GSM_StateMachine *s, char *description); | 1568 | void GSM_OSErrorInfo(GSM_StateMachine *s, char *description); |
1570 | 1569 | ||
1571 | #ifdef GSM_ENABLE_BACKUP | 1570 | #ifdef GSM_ENABLE_BACKUP |
1572 | void GSM_GetPhoneFeaturesForBackup(GSM_StateMachine *s, GSM_Backup_Info *info); | 1571 | void GSM_GetPhoneFeaturesForBackup(GSM_StateMachine *s, GSM_Backup_Info *info); |
1573 | #endif | 1572 | #endif |
1574 | 1573 | ||
1575 | #endif | 1574 | #endif |
1576 | 1575 | ||
1577 | /* How should editor hadle tabs in this file? Add editor commands here. | 1576 | /* How should editor hadle tabs in this file? Add editor commands here. |
1578 | * vim: noexpandtab sw=8 ts=8 sts=8: | 1577 | * vim: noexpandtab sw=8 ts=8 sts=8: |
1579 | */ | 1578 | */ |
1579 | |||
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7bec90a..b014cba 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,229 +1,230 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /*s | 24 | /*s |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qregexp.h> | ||
38 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
39 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
40 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
41 | #include <qprogressbar.h> | 42 | #include <qprogressbar.h> |
42 | #include <libkdepim/phoneaccess.h> | 43 | #include <libkdepim/phoneaccess.h> |
43 | 44 | ||
44 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
45 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
46 | #include <qdir.h> | 47 | #include <qdir.h> |
47 | #include <qfile.h> | 48 | #include <qfile.h> |
48 | #include <qapplicaton.h> | 49 | #include <qapplicaton.h> |
49 | #include <qprogressbar.h> | 50 | #include <qprogressbar.h> |
50 | #include <qlayout.h> | 51 | #include <qlayout.h> |
51 | #include <qregexp.h> | 52 | #include <qregexp.h> |
52 | #include <qvbox.h> | 53 | #include <qvbox.h> |
53 | #include <kabc/addresseelist.h> | 54 | #include <kabc/addresseelist.h> |
54 | #include <kabc/errorhandler.h> | 55 | #include <kabc/errorhandler.h> |
55 | #include <kabc/resource.h> | 56 | #include <kabc/resource.h> |
56 | #include <kabc/vcardconverter.h> | 57 | #include <kabc/vcardconverter.h> |
57 | #include <kapplication.h> | 58 | #include <kapplication.h> |
58 | #include <kactionclasses.h> | 59 | #include <kactionclasses.h> |
59 | #include <kcmultidialog.h> | 60 | #include <kcmultidialog.h> |
60 | #include <kdebug.h> | 61 | #include <kdebug.h> |
61 | #include <kdeversion.h> | 62 | #include <kdeversion.h> |
62 | #include <kkeydialog.h> | 63 | #include <kkeydialog.h> |
63 | #include <kmessagebox.h> | 64 | #include <kmessagebox.h> |
64 | #include <kprinter.h> | 65 | #include <kprinter.h> |
65 | #include <kprotocolinfo.h> | 66 | #include <kprotocolinfo.h> |
66 | #include <kresources/selectdialog.h> | 67 | #include <kresources/selectdialog.h> |
67 | #include <kstandarddirs.h> | 68 | #include <kstandarddirs.h> |
68 | #include <ktempfile.h> | 69 | #include <ktempfile.h> |
69 | #include <kxmlguiclient.h> | 70 | #include <kxmlguiclient.h> |
70 | #include <kaboutdata.h> | 71 | #include <kaboutdata.h> |
71 | #include <libkdepim/categoryselectdialog.h> | 72 | #include <libkdepim/categoryselectdialog.h> |
72 | 73 | ||
73 | #include "addresseeutil.h" | 74 | #include "addresseeutil.h" |
74 | #include "addresseeeditordialog.h" | 75 | #include "addresseeeditordialog.h" |
75 | #include "extensionmanager.h" | 76 | #include "extensionmanager.h" |
76 | #include "kstdaction.h" | 77 | #include "kstdaction.h" |
77 | #include "kaddressbookservice.h" | 78 | #include "kaddressbookservice.h" |
78 | #include "ldapsearchdialog.h" | 79 | #include "ldapsearchdialog.h" |
79 | #include "printing/printingwizard.h" | 80 | #include "printing/printingwizard.h" |
80 | #else // KAB_EMBEDDED | 81 | #else // KAB_EMBEDDED |
81 | 82 | ||
82 | #include <kapplication.h> | 83 | #include <kapplication.h> |
83 | #include "KDGanttMinimizeSplitter.h" | 84 | #include "KDGanttMinimizeSplitter.h" |
84 | #include "kaddressbookmain.h" | 85 | #include "kaddressbookmain.h" |
85 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
86 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
87 | //US | 88 | //US |
88 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
89 | 90 | ||
90 | #include <qapp.h> | 91 | #include <qapp.h> |
91 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
92 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
93 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
94 | #include <kdebug.h> | 95 | #include <kdebug.h> |
95 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
96 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
97 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
98 | 99 | ||
99 | 100 | ||
100 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
101 | 102 | ||
102 | 103 | ||
103 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
104 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
105 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
106 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
107 | #else | 108 | #else |
108 | 109 | ||
109 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
110 | #endif | 111 | #endif |
111 | 112 | ||
112 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
113 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
114 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
115 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
116 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
117 | 118 | ||
118 | 119 | ||
119 | #include <kresources/selectdialog.h> | 120 | #include <kresources/selectdialog.h> |
120 | #include <kmessagebox.h> | 121 | #include <kmessagebox.h> |
121 | 122 | ||
122 | #include <picture.h> | 123 | #include <picture.h> |
123 | #include <resource.h> | 124 | #include <resource.h> |
124 | 125 | ||
125 | //US#include <qsplitter.h> | 126 | //US#include <qsplitter.h> |
126 | #include <qmap.h> | 127 | #include <qmap.h> |
127 | #include <qdir.h> | 128 | #include <qdir.h> |
128 | #include <qfile.h> | 129 | #include <qfile.h> |
129 | #include <qvbox.h> | 130 | #include <qvbox.h> |
130 | #include <qlayout.h> | 131 | #include <qlayout.h> |
131 | #include <qclipboard.h> | 132 | #include <qclipboard.h> |
132 | #include <qtextstream.h> | 133 | #include <qtextstream.h> |
133 | 134 | ||
134 | #include <libkdepim/categoryselectdialog.h> | 135 | #include <libkdepim/categoryselectdialog.h> |
135 | #include <kabc/vcardconverter.h> | 136 | #include <kabc/vcardconverter.h> |
136 | 137 | ||
137 | 138 | ||
138 | #include "addresseeutil.h" | 139 | #include "addresseeutil.h" |
139 | #include "undocmds.h" | 140 | #include "undocmds.h" |
140 | #include "addresseeeditordialog.h" | 141 | #include "addresseeeditordialog.h" |
141 | #include "viewmanager.h" | 142 | #include "viewmanager.h" |
142 | #include "details/detailsviewcontainer.h" | 143 | #include "details/detailsviewcontainer.h" |
143 | #include "kabprefs.h" | 144 | #include "kabprefs.h" |
144 | #include "xxportmanager.h" | 145 | #include "xxportmanager.h" |
145 | #include "incsearchwidget.h" | 146 | #include "incsearchwidget.h" |
146 | #include "jumpbuttonbar.h" | 147 | #include "jumpbuttonbar.h" |
147 | #include "extensionmanager.h" | 148 | #include "extensionmanager.h" |
148 | #include "addresseeconfig.h" | 149 | #include "addresseeconfig.h" |
149 | #include <kcmultidialog.h> | 150 | #include <kcmultidialog.h> |
150 | 151 | ||
151 | #ifdef _WIN32_ | 152 | #ifdef _WIN32_ |
152 | 153 | ||
153 | #include "kaimportoldialog.h" | 154 | #include "kaimportoldialog.h" |
154 | #else | 155 | #else |
155 | #include <unistd.h> | 156 | #include <unistd.h> |
156 | #endif | 157 | #endif |
157 | // sync includes | 158 | // sync includes |
158 | #include <libkdepim/ksyncprofile.h> | 159 | #include <libkdepim/ksyncprofile.h> |
159 | #include <libkdepim/ksyncprefsdialog.h> | 160 | #include <libkdepim/ksyncprefsdialog.h> |
160 | 161 | ||
161 | class KAex2phonePrefs : public QDialog | 162 | class KAex2phonePrefs : public QDialog |
162 | { | 163 | { |
163 | public: | 164 | public: |
164 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
165 | QDialog( parent, name, true ) | 166 | QDialog( parent, name, true ) |
166 | { | 167 | { |
167 | setCaption( i18n("Export to phone options") ); | 168 | setCaption( i18n("Export to phone options") ); |
168 | QVBoxLayout* lay = new QVBoxLayout( this ); | 169 | QVBoxLayout* lay = new QVBoxLayout( this ); |
169 | lay->setSpacing( 3 ); | 170 | lay->setSpacing( 3 ); |
170 | lay->setMargin( 3 ); | 171 | lay->setMargin( 3 ); |
171 | QLabel *lab; | 172 | QLabel *lab; |
172 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
173 | lab->setAlignment (AlignHCenter ); | 174 | lab->setAlignment (AlignHCenter ); |
174 | QHBox* temphb; | 175 | QHBox* temphb; |
175 | temphb = new QHBox( this ); | 176 | temphb = new QHBox( this ); |
176 | new QLabel( i18n("I/O device: "), temphb ); | 177 | new QLabel( i18n("I/O device: "), temphb ); |
177 | mPhoneDevice = new QLineEdit( temphb); | 178 | mPhoneDevice = new QLineEdit( temphb); |
178 | lay->addWidget( temphb ); | 179 | lay->addWidget( temphb ); |
179 | temphb = new QHBox( this ); | 180 | temphb = new QHBox( this ); |
180 | new QLabel( i18n("Connection: "), temphb ); | 181 | new QLabel( i18n("Connection: "), temphb ); |
181 | mPhoneConnection = new QLineEdit( temphb); | 182 | mPhoneConnection = new QLineEdit( temphb); |
182 | lay->addWidget( temphb ); | 183 | lay->addWidget( temphb ); |
183 | temphb = new QHBox( this ); | 184 | temphb = new QHBox( this ); |
184 | new QLabel( i18n("Model(opt.): "), temphb ); | 185 | new QLabel( i18n("Model(opt.): "), temphb ); |
185 | mPhoneModel = new QLineEdit( temphb); | 186 | mPhoneModel = new QLineEdit( temphb); |
186 | lay->addWidget( temphb ); | 187 | lay->addWidget( temphb ); |
187 | mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 188 | mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
188 | lay->addWidget( mWriteToSim ); | 189 | lay->addWidget( mWriteToSim ); |
189 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
190 | lab->setAlignment (AlignHCenter ); | 191 | lab->setAlignment (AlignHCenter ); |
191 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
192 | lay->addWidget( ok ); | 193 | lay->addWidget( ok ); |
193 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
194 | lay->addWidget( cancel ); | 195 | lay->addWidget( cancel ); |
195 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
196 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
197 | resize( 220, 240 ); | 198 | resize( 220, 240 ); |
198 | 199 | ||
199 | } | 200 | } |
200 | 201 | ||
201 | public: | 202 | public: |
202 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
203 | QCheckBox* mWriteToSim; | 204 | QCheckBox* mWriteToSim; |
204 | }; | 205 | }; |
205 | 206 | ||
206 | bool pasteWithNewUid = true; | 207 | bool pasteWithNewUid = true; |
207 | 208 | ||
208 | #ifdef KAB_EMBEDDED | 209 | #ifdef KAB_EMBEDDED |
209 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 210 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
210 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 211 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
211 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 212 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
212 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 213 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
213 | #else //KAB_EMBEDDED | 214 | #else //KAB_EMBEDDED |
214 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 215 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
215 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 216 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
216 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 217 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
217 | mReadWrite( readWrite ), mModified( false ) | 218 | mReadWrite( readWrite ), mModified( false ) |
218 | #endif //KAB_EMBEDDED | 219 | #endif //KAB_EMBEDDED |
219 | { | 220 | { |
220 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 221 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
221 | // syncManager->setBlockSave(false); | 222 | // syncManager->setBlockSave(false); |
222 | mExtensionBarSplitter = 0; | 223 | mExtensionBarSplitter = 0; |
223 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 224 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
224 | 225 | ||
225 | mAddressBook = KABC::StdAddressBook::self(); | 226 | mAddressBook = KABC::StdAddressBook::self(); |
226 | KABC::StdAddressBook::setAutomaticSave( false ); | 227 | KABC::StdAddressBook::setAutomaticSave( false ); |
227 | 228 | ||
228 | #ifndef KAB_EMBEDDED | 229 | #ifndef KAB_EMBEDDED |
229 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 230 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
@@ -537,384 +538,389 @@ void KABCore::setContactSelected( const QString &uid ) | |||
537 | } | 538 | } |
538 | } | 539 | } |
539 | 540 | ||
540 | 541 | ||
541 | mExtensionManager->setSelectionChanged(); | 542 | mExtensionManager->setSelectionChanged(); |
542 | 543 | ||
543 | // update the actions | 544 | // update the actions |
544 | bool selected = !uid.isEmpty(); | 545 | bool selected = !uid.isEmpty(); |
545 | 546 | ||
546 | if ( mReadWrite ) { | 547 | if ( mReadWrite ) { |
547 | mActionCut->setEnabled( selected ); | 548 | mActionCut->setEnabled( selected ); |
548 | mActionPaste->setEnabled( selected ); | 549 | mActionPaste->setEnabled( selected ); |
549 | } | 550 | } |
550 | 551 | ||
551 | mActionCopy->setEnabled( selected ); | 552 | mActionCopy->setEnabled( selected ); |
552 | mActionDelete->setEnabled( selected ); | 553 | mActionDelete->setEnabled( selected ); |
553 | mActionEditAddressee->setEnabled( selected ); | 554 | mActionEditAddressee->setEnabled( selected ); |
554 | mActionMail->setEnabled( selected ); | 555 | mActionMail->setEnabled( selected ); |
555 | mActionMailVCard->setEnabled( selected ); | 556 | mActionMailVCard->setEnabled( selected ); |
556 | //if (mActionBeam) | 557 | //if (mActionBeam) |
557 | //mActionBeam->setEnabled( selected ); | 558 | //mActionBeam->setEnabled( selected ); |
558 | 559 | ||
559 | if (mActionBeamVCard) | 560 | if (mActionBeamVCard) |
560 | mActionBeamVCard->setEnabled( selected ); | 561 | mActionBeamVCard->setEnabled( selected ); |
561 | 562 | ||
562 | mActionExport2phone->setEnabled( selected ); | 563 | mActionExport2phone->setEnabled( selected ); |
563 | mActionWhoAmI->setEnabled( selected ); | 564 | mActionWhoAmI->setEnabled( selected ); |
564 | mActionCategories->setEnabled( selected ); | 565 | mActionCategories->setEnabled( selected ); |
565 | } | 566 | } |
566 | 567 | ||
567 | void KABCore::sendMail() | 568 | void KABCore::sendMail() |
568 | { | 569 | { |
569 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 570 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
570 | } | 571 | } |
571 | 572 | ||
572 | void KABCore::sendMail( const QString& emaillist ) | 573 | void KABCore::sendMail( const QString& emaillist ) |
573 | { | 574 | { |
574 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 575 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
575 | if (emaillist.contains(",") > 0) | 576 | if (emaillist.contains(",") > 0) |
576 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 577 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
577 | else | 578 | else |
578 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 579 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
579 | } | 580 | } |
580 | 581 | ||
581 | 582 | ||
582 | 583 | ||
583 | void KABCore::mailVCard() | 584 | void KABCore::mailVCard() |
584 | { | 585 | { |
585 | QStringList uids = mViewManager->selectedUids(); | 586 | QStringList uids = mViewManager->selectedUids(); |
586 | if ( !uids.isEmpty() ) | 587 | if ( !uids.isEmpty() ) |
587 | mailVCard( uids ); | 588 | mailVCard( uids ); |
588 | } | 589 | } |
589 | 590 | ||
590 | void KABCore::mailVCard( const QStringList& uids ) | 591 | void KABCore::mailVCard( const QStringList& uids ) |
591 | { | 592 | { |
592 | QStringList urls; | 593 | QStringList urls; |
593 | 594 | ||
594 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 595 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
595 | 596 | ||
596 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 597 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
597 | 598 | ||
598 | 599 | ||
599 | 600 | ||
600 | QDir().mkdir( dirName, true ); | 601 | QDir().mkdir( dirName, true ); |
601 | 602 | ||
602 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 603 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
603 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 604 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
604 | 605 | ||
605 | if ( a.isEmpty() ) | 606 | if ( a.isEmpty() ) |
606 | continue; | 607 | continue; |
607 | 608 | ||
608 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 609 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
609 | 610 | ||
610 | QString fileName = dirName + "/" + name; | 611 | QString fileName = dirName + "/" + name; |
611 | 612 | ||
612 | QFile outFile(fileName); | 613 | QFile outFile(fileName); |
613 | 614 | ||
614 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 615 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
615 | KABC::VCardConverter converter; | 616 | KABC::VCardConverter converter; |
616 | QString vcard; | 617 | QString vcard; |
617 | 618 | ||
618 | converter.addresseeToVCard( a, vcard ); | 619 | converter.addresseeToVCard( a, vcard ); |
619 | 620 | ||
620 | QTextStream t( &outFile ); // use a text stream | 621 | QTextStream t( &outFile ); // use a text stream |
621 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 622 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
622 | t << vcard; | 623 | t << vcard; |
623 | 624 | ||
624 | outFile.close(); | 625 | outFile.close(); |
625 | 626 | ||
626 | urls.append( fileName ); | 627 | urls.append( fileName ); |
627 | } | 628 | } |
628 | } | 629 | } |
629 | 630 | ||
630 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 631 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
631 | 632 | ||
632 | 633 | ||
633 | /*US | 634 | /*US |
634 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 635 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
635 | QString::null, // subject | 636 | QString::null, // subject |
636 | QString::null, // body | 637 | QString::null, // body |
637 | QString::null, | 638 | QString::null, |
638 | urls ); // attachments | 639 | urls ); // attachments |
639 | */ | 640 | */ |
640 | 641 | ||
641 | } | 642 | } |
642 | 643 | ||
643 | /** | 644 | /** |
644 | Beams the "WhoAmI contact. | 645 | Beams the "WhoAmI contact. |
645 | */ | 646 | */ |
646 | void KABCore::beamMySelf() | 647 | void KABCore::beamMySelf() |
647 | { | 648 | { |
648 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 649 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
649 | if (!a.isEmpty()) | 650 | if (!a.isEmpty()) |
650 | { | 651 | { |
651 | QStringList uids; | 652 | QStringList uids; |
652 | uids << a.uid(); | 653 | uids << a.uid(); |
653 | 654 | ||
654 | beamVCard(uids); | 655 | beamVCard(uids); |
655 | } else { | 656 | } else { |
656 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 657 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
657 | 658 | ||
658 | 659 | ||
659 | } | 660 | } |
660 | } | 661 | } |
661 | 662 | ||
662 | void KABCore::export2phone() | 663 | void KABCore::export2phone() |
663 | { | 664 | { |
664 | 665 | ||
665 | KAex2phonePrefs ex2phone; | 666 | KAex2phonePrefs ex2phone; |
666 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 667 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
667 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 668 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
668 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 669 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
669 | 670 | ||
670 | if ( !ex2phone.exec() ) { | 671 | if ( !ex2phone.exec() ) { |
671 | return; | 672 | return; |
672 | } | 673 | } |
673 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 674 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
674 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 675 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
675 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 676 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
676 | 677 | ||
677 | 678 | ||
678 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 679 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
679 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 680 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
680 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 681 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
681 | 682 | ||
682 | QStringList uids = mViewManager->selectedUids(); | 683 | QStringList uids = mViewManager->selectedUids(); |
683 | if ( uids.isEmpty() ) | 684 | if ( uids.isEmpty() ) |
684 | return; | 685 | return; |
685 | 686 | ||
686 | #ifdef _WIN32_ | 687 | #ifdef _WIN32_ |
687 | QString fileName = locateLocal("tmp", "tempfile.vcf"); | 688 | QString fileName = locateLocal("tmp", "tempfile.vcf"); |
688 | #else | 689 | #else |
689 | QString fileName = "/tmp/kdepimtemp.vcf"; | 690 | QString fileName = "/tmp/kdepimtemp.vcf"; |
690 | #endif | 691 | #endif |
691 | 692 | ||
692 | KABC::VCardConverter converter; | 693 | KABC::VCardConverter converter; |
693 | QString description; | 694 | QString description; |
694 | QString datastream; | 695 | QString datastream; |
695 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 696 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
696 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 697 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
697 | 698 | ||
698 | if ( a.isEmpty() ) | 699 | if ( a.isEmpty() ) |
699 | continue; | 700 | continue; |
700 | 701 | ||
701 | if (description.isEmpty()) | 702 | if (description.isEmpty()) |
702 | description = a.formattedName(); | 703 | description = a.formattedName(); |
703 | 704 | ||
704 | QString vcard; | 705 | QString vcard; |
705 | converter.addresseeToVCard( a, vcard ); | 706 | converter.addresseeToVCard( a, vcard ); |
706 | int start = 0; | 707 | int start = 0; |
707 | int next; | 708 | int next; |
708 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 709 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
709 | int semi = vcard.find(";", next); | 710 | int semi = vcard.find(";", next); |
710 | int dopp = vcard.find(":", next); | 711 | int dopp = vcard.find(":", next); |
711 | int sep; | 712 | int sep; |
712 | if ( semi < dopp && semi >= 0 ) | 713 | if ( semi < dopp && semi >= 0 ) |
713 | sep = semi ; | 714 | sep = semi ; |
714 | else | 715 | else |
715 | sep = dopp; | 716 | sep = dopp; |
716 | datastream +=vcard.mid( start, next - start); | 717 | datastream +=vcard.mid( start, next - start); |
717 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 718 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
718 | start = sep; | 719 | start = sep; |
719 | } | 720 | } |
720 | datastream += vcard.mid( start,vcard.length() ); | 721 | datastream += vcard.mid( start,vcard.length() ); |
721 | } | 722 | } |
722 | QFile outFile(fileName); | 723 | QFile outFile(fileName); |
723 | if ( outFile.open(IO_WriteOnly) ) { | 724 | if ( outFile.open(IO_WriteOnly) ) { |
724 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 725 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
725 | QTextStream t( &outFile ); // use a text stream | 726 | QTextStream t( &outFile ); // use a text stream |
726 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 727 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
727 | t <<datastream; | 728 | t <<datastream; |
728 | outFile.close(); | 729 | outFile.close(); |
730 | if ( PhoneAccess::writeToPhone( fileName ) ) | ||
731 | qDebug("Export okay "); | ||
732 | else | ||
733 | qDebug("Error export contacts "); | ||
734 | |||
729 | } else { | 735 | } else { |
730 | qDebug("Error open temp file "); | 736 | qDebug("Error open temp file "); |
731 | return; | 737 | return; |
732 | } | 738 | } |
733 | 739 | ||
734 | 740 | ||
735 | #if 0 | 741 | #if 0 |
736 | 742 | ||
737 | setCaption( i18n("Writing to phone...")); | 743 | setCaption( i18n("Writing to phone...")); |
738 | if ( PhoneFormat::writeToPhone( cal ) ) | 744 | if ( PhoneFormat::writeToPhone( cal ) ) |
739 | setCaption( i18n("Export to phone successful!")); | 745 | setCaption( i18n("Export to phone successful!")); |
740 | else | 746 | else |
741 | setCaption( i18n("Error exporting to phone!")); | 747 | setCaption( i18n("Error exporting to phone!")); |
742 | #endif | 748 | #endif |
743 | 749 | ||
744 | 750 | ||
745 | } | 751 | } |
746 | void KABCore::beamVCard() | 752 | void KABCore::beamVCard() |
747 | { | 753 | { |
748 | QStringList uids = mViewManager->selectedUids(); | 754 | QStringList uids = mViewManager->selectedUids(); |
749 | if ( !uids.isEmpty() ) | 755 | if ( !uids.isEmpty() ) |
750 | beamVCard( uids ); | 756 | beamVCard( uids ); |
751 | } | 757 | } |
752 | 758 | ||
753 | 759 | ||
754 | void KABCore::beamVCard(const QStringList& uids) | 760 | void KABCore::beamVCard(const QStringList& uids) |
755 | { | 761 | { |
756 | /*US | 762 | /*US |
757 | QString beamFilename; | 763 | QString beamFilename; |
758 | Opie::OPimContact c; | 764 | Opie::OPimContact c; |
759 | if ( actionPersonal->isOn() ) { | 765 | if ( actionPersonal->isOn() ) { |
760 | beamFilename = addressbookPersonalVCardName(); | 766 | beamFilename = addressbookPersonalVCardName(); |
761 | if ( !QFile::exists( beamFilename ) ) | 767 | if ( !QFile::exists( beamFilename ) ) |
762 | return; // can't beam a non-existent file | 768 | return; // can't beam a non-existent file |
763 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 769 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
764 | beamFilename ); | 770 | beamFilename ); |
765 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 771 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
766 | Opie::OPimContactAccess::List allList = access->allRecords(); | 772 | Opie::OPimContactAccess::List allList = access->allRecords(); |
767 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 773 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
768 | c = *it; | 774 | c = *it; |
769 | 775 | ||
770 | delete access; | 776 | delete access; |
771 | } else { | 777 | } else { |
772 | unlink( beamfile ); // delete if exists | 778 | unlink( beamfile ); // delete if exists |
773 | mkdir("/tmp/obex/", 0755); | 779 | mkdir("/tmp/obex/", 0755); |
774 | c = m_abView -> currentEntry(); | 780 | c = m_abView -> currentEntry(); |
775 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 781 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
776 | beamfile ); | 782 | beamfile ); |
777 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 783 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
778 | access->add( c ); | 784 | access->add( c ); |
779 | access->save(); | 785 | access->save(); |
780 | delete access; | 786 | delete access; |
781 | 787 | ||
782 | beamFilename = beamfile; | 788 | beamFilename = beamfile; |
783 | } | 789 | } |
784 | 790 | ||
785 | owarn << "Beaming: " << beamFilename << oendl; | 791 | owarn << "Beaming: " << beamFilename << oendl; |
786 | */ | 792 | */ |
787 | 793 | ||
788 | #if 0 | 794 | #if 0 |
789 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 795 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
790 | 796 | ||
791 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 797 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
792 | 798 | ||
793 | QString name = "contact.vcf"; | 799 | QString name = "contact.vcf"; |
794 | 800 | ||
795 | QString fileName = dirName + "/" + name; | 801 | QString fileName = dirName + "/" + name; |
796 | #endif | 802 | #endif |
797 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | 803 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory |
798 | // | 804 | // |
799 | QString fileName = "/tmp/kapibeamfile.vcf"; | 805 | QString fileName = "/tmp/kapibeamfile.vcf"; |
800 | 806 | ||
801 | 807 | ||
802 | //QDir().mkdir( dirName, true ); | 808 | //QDir().mkdir( dirName, true ); |
803 | 809 | ||
804 | 810 | ||
805 | KABC::VCardConverter converter; | 811 | KABC::VCardConverter converter; |
806 | QString description; | 812 | QString description; |
807 | QString datastream; | 813 | QString datastream; |
808 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 814 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
809 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 815 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
810 | 816 | ||
811 | if ( a.isEmpty() ) | 817 | if ( a.isEmpty() ) |
812 | continue; | 818 | continue; |
813 | 819 | ||
814 | if (description.isEmpty()) | 820 | if (description.isEmpty()) |
815 | description = a.formattedName(); | 821 | description = a.formattedName(); |
816 | 822 | ||
817 | QString vcard; | 823 | QString vcard; |
818 | converter.addresseeToVCard( a, vcard ); | 824 | converter.addresseeToVCard( a, vcard ); |
819 | int start = 0; | 825 | int start = 0; |
820 | int next; | 826 | int next; |
821 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 827 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
822 | int semi = vcard.find(";", next); | 828 | int semi = vcard.find(";", next); |
823 | int dopp = vcard.find(":", next); | 829 | int dopp = vcard.find(":", next); |
824 | int sep; | 830 | int sep; |
825 | if ( semi < dopp && semi >= 0 ) | 831 | if ( semi < dopp && semi >= 0 ) |
826 | sep = semi ; | 832 | sep = semi ; |
827 | else | 833 | else |
828 | sep = dopp; | 834 | sep = dopp; |
829 | datastream +=vcard.mid( start, next - start); | 835 | datastream +=vcard.mid( start, next - start); |
830 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 836 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
831 | start = sep; | 837 | start = sep; |
832 | } | 838 | } |
833 | datastream += vcard.mid( start,vcard.length() ); | 839 | datastream += vcard.mid( start,vcard.length() ); |
834 | } | 840 | } |
835 | #ifndef DESKTOP_VERSION | 841 | #ifndef DESKTOP_VERSION |
836 | QFile outFile(fileName); | 842 | QFile outFile(fileName); |
837 | if ( outFile.open(IO_WriteOnly) ) { | 843 | if ( outFile.open(IO_WriteOnly) ) { |
838 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 844 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
839 | QTextStream t( &outFile ); // use a text stream | 845 | QTextStream t( &outFile ); // use a text stream |
840 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 846 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
841 | t <<datastream; | 847 | t <<datastream; |
842 | outFile.close(); | 848 | outFile.close(); |
843 | Ir *ir = new Ir( this ); | 849 | Ir *ir = new Ir( this ); |
844 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 850 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
845 | ir->send( fileName, description, "text/x-vCard" ); | 851 | ir->send( fileName, description, "text/x-vCard" ); |
846 | } else { | 852 | } else { |
847 | qDebug("Error open temp beam file "); | 853 | qDebug("Error open temp beam file "); |
848 | return; | 854 | return; |
849 | } | 855 | } |
850 | #endif | 856 | #endif |
851 | 857 | ||
852 | } | 858 | } |
853 | 859 | ||
854 | void KABCore::beamDone( Ir *ir ) | 860 | void KABCore::beamDone( Ir *ir ) |
855 | { | 861 | { |
856 | #ifndef DESKTOP_VERSION | 862 | #ifndef DESKTOP_VERSION |
857 | delete ir; | 863 | delete ir; |
858 | #endif | 864 | #endif |
859 | } | 865 | } |
860 | 866 | ||
861 | 867 | ||
862 | void KABCore::browse( const QString& url ) | 868 | void KABCore::browse( const QString& url ) |
863 | { | 869 | { |
864 | #ifndef KAB_EMBEDDED | 870 | #ifndef KAB_EMBEDDED |
865 | kapp->invokeBrowser( url ); | 871 | kapp->invokeBrowser( url ); |
866 | #else //KAB_EMBEDDED | 872 | #else //KAB_EMBEDDED |
867 | qDebug("KABCore::browse must be fixed"); | 873 | qDebug("KABCore::browse must be fixed"); |
868 | #endif //KAB_EMBEDDED | 874 | #endif //KAB_EMBEDDED |
869 | } | 875 | } |
870 | 876 | ||
871 | void KABCore::selectAllContacts() | 877 | void KABCore::selectAllContacts() |
872 | { | 878 | { |
873 | mViewManager->setSelected( QString::null, true ); | 879 | mViewManager->setSelected( QString::null, true ); |
874 | } | 880 | } |
875 | 881 | ||
876 | void KABCore::deleteContacts() | 882 | void KABCore::deleteContacts() |
877 | { | 883 | { |
878 | QStringList uidList = mViewManager->selectedUids(); | 884 | QStringList uidList = mViewManager->selectedUids(); |
879 | deleteContacts( uidList ); | 885 | deleteContacts( uidList ); |
880 | } | 886 | } |
881 | 887 | ||
882 | void KABCore::deleteContacts( const QStringList &uids ) | 888 | void KABCore::deleteContacts( const QStringList &uids ) |
883 | { | 889 | { |
884 | if ( uids.count() > 0 ) { | 890 | if ( uids.count() > 0 ) { |
885 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 891 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
886 | UndoStack::instance()->push( command ); | 892 | UndoStack::instance()->push( command ); |
887 | RedoStack::instance()->clear(); | 893 | RedoStack::instance()->clear(); |
888 | 894 | ||
889 | // now if we deleted anything, refresh | 895 | // now if we deleted anything, refresh |
890 | setContactSelected( QString::null ); | 896 | setContactSelected( QString::null ); |
891 | setModified( true ); | 897 | setModified( true ); |
892 | } | 898 | } |
893 | } | 899 | } |
894 | 900 | ||
895 | void KABCore::copyContacts() | 901 | void KABCore::copyContacts() |
896 | { | 902 | { |
897 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 903 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
898 | 904 | ||
899 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 905 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
900 | 906 | ||
901 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 907 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
902 | 908 | ||
903 | QClipboard *cb = QApplication::clipboard(); | 909 | QClipboard *cb = QApplication::clipboard(); |
904 | cb->setText( clipText ); | 910 | cb->setText( clipText ); |
905 | } | 911 | } |
906 | 912 | ||
907 | void KABCore::cutContacts() | 913 | void KABCore::cutContacts() |
908 | { | 914 | { |
909 | QStringList uidList = mViewManager->selectedUids(); | 915 | QStringList uidList = mViewManager->selectedUids(); |
910 | 916 | ||
911 | //US if ( uidList.size() > 0 ) { | 917 | //US if ( uidList.size() > 0 ) { |
912 | if ( uidList.count() > 0 ) { | 918 | if ( uidList.count() > 0 ) { |
913 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 919 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
914 | UndoStack::instance()->push( command ); | 920 | UndoStack::instance()->push( command ); |
915 | RedoStack::instance()->clear(); | 921 | RedoStack::instance()->clear(); |
916 | 922 | ||
917 | setModified( true ); | 923 | setModified( true ); |
918 | } | 924 | } |
919 | } | 925 | } |
920 | 926 | ||
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index c0bd6cc..357cd39 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp | |||
@@ -1,153 +1,147 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 4 | Copyright (c) 2004 Lutz Rogowski <rogowski@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 | 22 | ||
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 <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qtextcodec.h> | 29 | #include <qtextcodec.h> |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include "phoneaccess.h" | 33 | #include "phoneaccess.h" |
34 | 34 | ||
35 | void PhoneAccess::writeConfig( QString device, QString connection, QString model ) | 35 | void PhoneAccess::writeConfig( QString device, QString connection, QString model ) |
36 | { | 36 | { |
37 | #ifdef _WIN32_ | 37 | #ifdef _WIN32_ |
38 | QString fileName = qApp->applicationDirPath () +"\\gammurc"; | 38 | QString fileName = qApp->applicationDirPath () +"\\gammurc"; |
39 | #else | 39 | #else |
40 | QString fileName = QDir::homeDirPath() +"/.gammurc"; | 40 | QString fileName = QDir::homeDirPath() +"/.gammurc"; |
41 | #endif | 41 | #endif |
42 | //qDebug("save %d ", load ); | 42 | //qDebug("save %d ", load ); |
43 | QString content; | 43 | QString content = "[gammu]\n";; |
44 | bool write = false; | 44 | bool write = false; |
45 | bool addPort = true, addConnection = true, addModel = true; | 45 | bool addPort = true, addConnection = true, addModel = true; |
46 | QFile file( fileName ); | 46 | QFile file( fileName ); |
47 | if ( QFile::exists( fileName) ) { | 47 | if ( QFile::exists( fileName) ) { |
48 | if (!file.open( IO_ReadOnly ) ) { | 48 | if (!file.open( IO_ReadOnly ) ) { |
49 | qDebug("Error: cannot open %s ", fileName.latin1() ); | 49 | qDebug("Error: cannot open %s ", fileName.latin1() ); |
50 | return; | 50 | return; |
51 | } | 51 | } |
52 | QString line; | 52 | QString line; |
53 | while ( file.readLine( line, 1024 ) > 0 ) { | 53 | while ( file.readLine( line, 1024 ) > 0 ) { |
54 | //qDebug("*%s* ", line.latin1() ); | 54 | //qDebug("*%s* ", line.latin1() ); |
55 | if ( line.left(7 ) == "[gammu]" ) { | 55 | if ( line.left(7 ) == "[gammu]" ) { |
56 | ; | 56 | ; |
57 | } else | 57 | } else |
58 | if ( line.left(4 ) == "port" ) { | 58 | if ( line.left(4 ) == "port" ) { |
59 | if ( line == "port = " + device+"\n" ) { | 59 | if ( line == "port = " + device+"\n" ) { |
60 | content += line ; | 60 | content += line ; |
61 | addPort = false; | 61 | addPort = false; |
62 | //qDebug("port found" ); | 62 | //qDebug("port found" ); |
63 | } | 63 | } |
64 | 64 | ||
65 | } else if ( line.left(5 ) == "model" ) { | 65 | } else if ( line.left(5 ) == "model" ) { |
66 | if ( line == "model = " + model +"\n") { | 66 | if ( line == "model = " + model +"\n") { |
67 | content += line ; | 67 | content += line ; |
68 | addModel = false; | 68 | addModel = false; |
69 | //qDebug("model found" ); | 69 | //qDebug("model found" ); |
70 | } | 70 | } |
71 | 71 | ||
72 | } else if ( line.left( 10 ) == "connection" ) { | 72 | } else if ( line.left( 10 ) == "connection" ) { |
73 | if ( line == "connection = " + connection +"\n") { | 73 | if ( line == "connection = " + connection +"\n") { |
74 | addConnection = false; | 74 | addConnection = false; |
75 | content += line ; | 75 | content += line ; |
76 | //qDebug("con found" ); | 76 | //qDebug("con found" ); |
77 | } | 77 | } |
78 | 78 | ||
79 | } else { | 79 | } else { |
80 | content += line ; | 80 | content += line ; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | file.close(); | 83 | file.close(); |
84 | } else { | 84 | } else { |
85 | if ( ! connection.isEmpty() ) { | 85 | if ( ! connection.isEmpty() ) { |
86 | addConnection = true; | 86 | addConnection = true; |
87 | } | 87 | } |
88 | if ( ! device.isEmpty() ) { | 88 | if ( ! device.isEmpty() ) { |
89 | addPort = true; | 89 | addPort = true; |
90 | 90 | ||
91 | } | 91 | } |
92 | if ( ! model.isEmpty() ) { | 92 | if ( ! model.isEmpty() ) { |
93 | addModel = true; | 93 | addModel = true; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | if ( addConnection ) { | 97 | if ( addConnection ) { |
98 | if ( ! write ) | ||
99 | content += "[gammu]\n"; | ||
100 | write = true; | 98 | write = true; |
101 | content += "connection = "; | 99 | content += "connection = "; |
102 | content += connection; | 100 | content += connection; |
103 | content += "\n"; | 101 | content += "\n"; |
104 | } | 102 | } |
105 | if ( addPort ) { | 103 | if ( addPort ) { |
106 | if ( ! write ) | ||
107 | content += "[gammu]\n"; | ||
108 | write = true; | 104 | write = true; |
109 | content += "port = "; | 105 | content += "port = "; |
110 | content += device; | 106 | content += device; |
111 | content += "\n"; | 107 | content += "\n"; |
112 | 108 | ||
113 | } | 109 | } |
114 | if ( addModel ) { | 110 | if ( addModel ) { |
115 | if ( ! write ) | ||
116 | content += "[gammu]\n"; | ||
117 | write = true; | 111 | write = true; |
118 | content += "model = "; | 112 | content += "model = "; |
119 | content += model; | 113 | content += model; |
120 | content += "\n"; | 114 | content += "\n"; |
121 | } | 115 | } |
122 | if ( write ) { | 116 | if ( write ) { |
123 | if (!file.open( IO_WriteOnly ) ) { | 117 | if (!file.open( IO_WriteOnly ) ) { |
124 | qDebug("Error: cannot write file %s ", fileName.latin1() ); | 118 | qDebug("Error: cannot write file %s ", fileName.latin1() ); |
125 | return; | 119 | return; |
126 | } | 120 | } |
127 | qDebug("Writing file %s ", fileName.latin1() ); | 121 | qDebug("Writing file %s ", fileName.latin1() ); |
128 | QTextStream ts( &file ); | 122 | QTextStream ts( &file ); |
129 | ts << content ; | 123 | ts << content ; |
130 | file.close(); | 124 | file.close(); |
131 | } | 125 | } |
132 | 126 | ||
133 | } | 127 | } |
134 | 128 | ||
135 | 129 | ||
136 | bool PhoneAccess::writeToPhone( QString fileName) | 130 | bool PhoneAccess::writeToPhone( QString fileName) |
137 | { | 131 | { |
138 | 132 | ||
139 | #ifdef DESKTOP_VERSION | 133 | #ifdef DESKTOP_VERSION |
140 | QString command ="./kammu --restore " + fileName ; | 134 | QString command ="./kammu --restore " + fileName ; |
141 | #else | 135 | #else |
142 | QString command ="kammu --restore " + fileName ; | 136 | QString command ="kammu --restore " + fileName ; |
143 | #endif | 137 | #endif |
144 | int ret; | 138 | int ret; |
145 | while ( (ret = system ( command.latin1())) != 0 ) { | 139 | while ( (ret = system ( command.latin1())) != 0 ) { |
146 | qDebug("Error S::command returned %d. asking users", ret); | 140 | qDebug("Error S::command returned %d. asking users", ret); |
147 | int retval = KMessageBox::warningContinueCancel(0, | 141 | int retval = KMessageBox::warningContinueCancel(0, |
148 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel")); | 142 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel")); |
149 | if ( retval != KMessageBox::Continue ) | 143 | if ( retval != KMessageBox::Continue ) |
150 | return false; | 144 | return false; |
151 | } | 145 | } |
152 | return true; | 146 | return true; |
153 | } | 147 | } |