summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/gsmstate.h2
-rw-r--r--kaddressbook/kabcore.cpp6
-rw-r--r--libkdepim/phoneaccess.cpp12
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,676 +1,675 @@
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 */
216typedef struct { 215typedef 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 */
262typedef struct { 261typedef 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 */
283typedef struct { 282typedef 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 */
330typedef struct { 329typedef 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;
357 356
358/* -------------------------- Phone layer ---------------------------------- */ 357/* -------------------------- Phone layer ---------------------------------- */
359 358
360/** 359/**
361 * Phone requests identificators, these are used for internally identifying 360 * Phone requests identificators, these are used for internally identifying
362 * which operation is being performed. 361 * which operation is being performed.
363 */ 362 */
364typedef enum { 363typedef enum {
365 ID_None=1, 364 ID_None=1,
366 ID_GetModel, 365 ID_GetModel,
367 ID_GetFirmware, 366 ID_GetFirmware,
368 ID_EnableSecurity, 367 ID_EnableSecurity,
369 ID_GetIMEI, 368 ID_GetIMEI,
370 ID_GetDateTime, 369 ID_GetDateTime,
371 ID_GetAlarm, 370 ID_GetAlarm,
372 ID_GetMemory, 371 ID_GetMemory,
373 ID_GetMemoryStatus, 372 ID_GetMemoryStatus,
374 ID_GetSMSC, 373 ID_GetSMSC,
375 ID_GetSMSMessage, 374 ID_GetSMSMessage,
376 ID_EnableEcho, 375 ID_EnableEcho,
377 ID_EnableErrorInfo, 376 ID_EnableErrorInfo,
378 ID_SetOBEX, 377 ID_SetOBEX,
379 ID_SetUSSD, 378 ID_SetUSSD,
380 ID_GetNote, 379 ID_GetNote,
381 ID_GetSignalQuality, 380 ID_GetSignalQuality,
382 ID_GetBatteryCharge, 381 ID_GetBatteryCharge,
383 ID_GetSMSFolders, 382 ID_GetSMSFolders,
384 ID_GetSMSFolderStatus, 383 ID_GetSMSFolderStatus,
385 ID_GetSMSStatus, 384 ID_GetSMSStatus,
386 ID_AddSMSFolder, 385 ID_AddSMSFolder,
387 ID_GetNetworkInfo, 386 ID_GetNetworkInfo,
388 ID_GetRingtone, 387 ID_GetRingtone,
389 ID_DialVoice, 388 ID_DialVoice,
390 ID_GetCalendarNotesInfo, 389 ID_GetCalendarNotesInfo,
391 ID_GetCalendarNote, 390 ID_GetCalendarNote,
392 ID_GetSecurityCode, 391 ID_GetSecurityCode,
393 ID_GetWAPBookmark, 392 ID_GetWAPBookmark,
394 ID_GetBitmap, 393 ID_GetBitmap,
395 ID_SaveSMSMessage, 394 ID_SaveSMSMessage,
396 ID_CancelCall, 395 ID_CancelCall,
397 ID_SetDateTime, 396 ID_SetDateTime,
398 ID_SetAlarm, 397 ID_SetAlarm,
399 ID_DisableConnectFunc, 398 ID_DisableConnectFunc,
400 ID_EnableConnectFunc, 399 ID_EnableConnectFunc,
401 ID_AnswerCall, 400 ID_AnswerCall,
402 ID_SetBitmap, 401 ID_SetBitmap,
403 ID_SetRingtone, 402 ID_SetRingtone,
404 ID_DeleteSMSMessage, 403 ID_DeleteSMSMessage,
405 ID_DeleteCalendarNote, 404 ID_DeleteCalendarNote,
406 ID_SetPath, 405 ID_SetPath,
407 ID_SetSMSC, 406 ID_SetSMSC,
408 ID_SetProfile, 407 ID_SetProfile,
409 ID_SetMemory, 408 ID_SetMemory,
410 ID_DeleteMemory, 409 ID_DeleteMemory,
411 ID_SetCalendarNote, 410 ID_SetCalendarNote,
412 ID_SetIncomingSMS, 411 ID_SetIncomingSMS,
413 ID_SetIncomingCB, 412 ID_SetIncomingCB,
414 ID_GetCalendarNotePos, 413 ID_GetCalendarNotePos,
415 ID_Initialise, 414 ID_Initialise,
416 ID_GetConnectSet, 415 ID_GetConnectSet,
417 ID_SetWAPBookmark, 416 ID_SetWAPBookmark,
418 ID_GetLocale, 417 ID_GetLocale,
419 ID_SetLocale, 418 ID_SetLocale,
420 ID_GetCalendarSettings, 419 ID_GetCalendarSettings,
421 ID_SetCalendarSettings, 420 ID_SetCalendarSettings,
422 ID_GetGPRSPoint, 421 ID_GetGPRSPoint,
423 ID_SetGPRSPoint, 422 ID_SetGPRSPoint,
424 ID_EnableGPRSPoint, 423 ID_EnableGPRSPoint,
425 ID_DeleteWAPBookmark, 424 ID_DeleteWAPBookmark,
426 ID_Netmonitor, 425 ID_Netmonitor,
427 ID_HoldCall, 426 ID_HoldCall,
428 ID_UnholdCall, 427 ID_UnholdCall,
429 ID_ConferenceCall, 428 ID_ConferenceCall,
430 ID_SplitCall, 429 ID_SplitCall,
431 ID_TransferCall, 430 ID_TransferCall,
432 ID_SwitchCall, 431 ID_SwitchCall,
433 ID_GetManufactureMonth, 432 ID_GetManufactureMonth,
434 ID_GetProductCode, 433 ID_GetProductCode,
435 ID_GetOriginalIMEI, 434 ID_GetOriginalIMEI,
436 ID_GetHardware, 435 ID_GetHardware,
437 ID_GetPPM, 436 ID_GetPPM,
438 ID_GetSMSMode, 437 ID_GetSMSMode,
439 ID_GetSMSMemories, 438 ID_GetSMSMemories,
440 ID_GetManufacturer, 439 ID_GetManufacturer,
441 ID_SetMemoryType, 440 ID_SetMemoryType,
442 ID_SetMemoryCharset, 441 ID_SetMemoryCharset,
443 ID_GetMMSSettings, 442 ID_GetMMSSettings,
444 ID_SetSMSParameters, 443 ID_SetSMSParameters,
445 ID_GetFMStation, 444 ID_GetFMStation,
446 ID_SetFMStation, 445 ID_SetFMStation,
447 ID_GetLanguage, 446 ID_GetLanguage,
448 ID_SetFastSMSSending, 447 ID_SetFastSMSSending,
449 ID_Reset, 448 ID_Reset,
450 ID_GetToDo, 449 ID_GetToDo,
451 ID_PressKey, 450 ID_PressKey,
452 ID_DeleteAllToDo, 451 ID_DeleteAllToDo,
453 ID_SetLight, 452 ID_SetLight,
454 ID_Divert, 453 ID_Divert,
455 ID_SetToDo, 454 ID_SetToDo,
456 ID_PlayTone, 455 ID_PlayTone,
457 ID_GetChatSettings, 456 ID_GetChatSettings,
458 ID_GetSyncMLSettings, 457 ID_GetSyncMLSettings,
459 ID_GetSyncMLName, 458 ID_GetSyncMLName,
460 ID_GetSecurityStatus, 459 ID_GetSecurityStatus,
461 ID_EnterSecurityCode, 460 ID_EnterSecurityCode,
462 ID_GetProfile, 461 ID_GetProfile,
463 ID_GetRingtonesInfo, 462 ID_GetRingtonesInfo,
464 ID_MakeAuthentication, 463 ID_MakeAuthentication,
465 ID_GetSpeedDial, 464 ID_GetSpeedDial,
466 ID_ResetPhoneSettings, 465 ID_ResetPhoneSettings,
467 ID_SendDTMF, 466 ID_SendDTMF,
468 ID_GetDisplayStatus, 467 ID_GetDisplayStatus,
469 ID_SetAutoNetworkLogin, 468 ID_SetAutoNetworkLogin,
470 ID_SetConnectSet, 469 ID_SetConnectSet,
471 ID_SetMMSSettings, 470 ID_SetMMSSettings,
472 ID_GetSIMIMSI, 471 ID_GetSIMIMSI,
473 ID_GetFileInfo, 472 ID_GetFileInfo,
474 ID_FileSystemStatus, 473 ID_FileSystemStatus,
475 ID_GetFile, 474 ID_GetFile,
476 ID_AddFile, 475 ID_AddFile,
477 ID_AddFolder, 476 ID_AddFolder,
478 ID_DeleteFile, 477 ID_DeleteFile,
479#ifdef GSM_ENABLE_ALCATEL 478#ifdef GSM_ENABLE_ALCATEL
480 /* AT mode */ 479 /* AT mode */
481 ID_SetFlowControl, 480 ID_SetFlowControl,
482 ID_AlcatelConnect, 481 ID_AlcatelConnect,
483 ID_AlcatelProtocol, 482 ID_AlcatelProtocol,
484 483
485 /* Binary mode */ 484 /* Binary mode */
486 ID_AlcatelAttach, 485 ID_AlcatelAttach,
487 ID_AlcatelDetach, 486 ID_AlcatelDetach,
488 ID_AlcatelCommit, 487 ID_AlcatelCommit,
489 ID_AlcatelCommit2, 488 ID_AlcatelCommit2,
490 ID_AlcatelEnd, 489 ID_AlcatelEnd,
491 ID_AlcatelClose, 490 ID_AlcatelClose,
492 ID_AlcatelStart, 491 ID_AlcatelStart,
493 ID_AlcatelSelect1, 492 ID_AlcatelSelect1,
494 ID_AlcatelSelect2, 493 ID_AlcatelSelect2,
495 ID_AlcatelSelect3, 494 ID_AlcatelSelect3,
496 ID_AlcatelBegin1, 495 ID_AlcatelBegin1,
497 ID_AlcatelBegin2, 496 ID_AlcatelBegin2,
498 ID_AlcatelGetIds1, 497 ID_AlcatelGetIds1,
499 ID_AlcatelGetIds2, 498 ID_AlcatelGetIds2,
500 ID_AlcatelGetCategories1, 499 ID_AlcatelGetCategories1,
501 ID_AlcatelGetCategories2, 500 ID_AlcatelGetCategories2,
502 ID_AlcatelGetCategoryText1, 501 ID_AlcatelGetCategoryText1,
503 ID_AlcatelGetCategoryText2, 502 ID_AlcatelGetCategoryText2,
504 ID_AlcatelAddCategoryText1, 503 ID_AlcatelAddCategoryText1,
505 ID_AlcatelAddCategoryText2, 504 ID_AlcatelAddCategoryText2,
506 ID_AlcatelGetFields1, 505 ID_AlcatelGetFields1,
507 ID_AlcatelGetFields2, 506 ID_AlcatelGetFields2,
508 ID_AlcatelGetFieldValue1, 507 ID_AlcatelGetFieldValue1,
509 ID_AlcatelGetFieldValue2, 508 ID_AlcatelGetFieldValue2,
510 ID_AlcatelDeleteItem1, 509 ID_AlcatelDeleteItem1,
511 ID_AlcatelDeleteItem2, 510 ID_AlcatelDeleteItem2,
512 ID_AlcatelDeleteField, 511 ID_AlcatelDeleteField,
513 ID_AlcatelCreateField, 512 ID_AlcatelCreateField,
514 ID_AlcatelUpdateField, 513 ID_AlcatelUpdateField,
515#endif 514#endif
516 ID_IncomingFrame, 515 ID_IncomingFrame,
517 516
518 ID_User1, 517 ID_User1,
519 ID_User2, 518 ID_User2,
520 ID_User3, 519 ID_User3,
521 ID_User4, 520 ID_User4,
522 ID_User5, 521 ID_User5,
523 ID_User6, 522 ID_User6,
524 ID_User7, 523 ID_User7,
525 ID_User8, 524 ID_User8,
526 ID_User9, 525 ID_User9,
527 ID_User10, 526 ID_User10,
528 527
529 ID_EachFrame 528 ID_EachFrame
530} GSM_Phone_RequestID; 529} GSM_Phone_RequestID;
531 530
532/** 531/**
533 * Phone related data are stored here. 532 * Phone related data are stored here.
534 */ 533 */
535typedef struct { 534typedef struct {
536 /** 535 /**
537 * Phone IMEI (or serial number). 536 * Phone IMEI (or serial number).
538 */ 537 */
539 char IMEI[MAX_IMEI_LENGTH]; 538 char IMEI[MAX_IMEI_LENGTH];
540 /** 539 /**
541 * Phone manufacturer as reported by phone. 540 * Phone manufacturer as reported by phone.
542 */ 541 */
543 char Manufacturer[MAX_MANUFACTURER_LENGTH]; 542 char Manufacturer[MAX_MANUFACTURER_LENGTH];
544 /** 543 /**
545 * Phone model as reported by phone. 544 * Phone model as reported by phone.
546 */ 545 */
547 char Model[MAX_MODEL_LENGTH]; 546 char Model[MAX_MODEL_LENGTH];
548 /** 547 /**
549 * Model information, pointer to static @ref allmodels array. 548 * Model information, pointer to static @ref allmodels array.
550 */ 549 */
551 OnePhoneModel *ModelInfo; 550 OnePhoneModel *ModelInfo;
552 /** 551 /**
553 * Phone version as reported by phone. It doesn't have to be numerical 552 * Phone version as reported by phone. It doesn't have to be numerical
554 * at all. 553 * at all.
555 */ 554 */
556 char Version[MAX_VERSION_LENGTH]; 555 char Version[MAX_VERSION_LENGTH];
557 /** 556 /**
558 * Phone version date, might be empty for some models. 557 * Phone version date, might be empty for some models.
559 */ 558 */
560 char VerDate[MAX_VERSION_DATE_LENGTH]; 559 char VerDate[MAX_VERSION_DATE_LENGTH];
561 /** 560 /**
562 * Phone version as number, if applicable. 561 * Phone version as number, if applicable.
563 */ 562 */
564 double VerNum; 563 double VerNum;
565 /** 564 /**
566 * Cache for hardware version used by some modules. 565 * Cache for hardware version used by some modules.
567 */ 566 */
568 char HardwareCache[50]; 567 char HardwareCache[50];
569 /** 568 /**
570 * Cache for product code version used by some modules. 569 * Cache for product code version used by some modules.
571 */ 570 */
572 char ProductCodeCache[50]; 571 char ProductCodeCache[50];
573 572
574 /** 573 /**
575 * Counter used for disabling startup info on phone, see 574 * Counter used for disabling startup info on phone, see
576 * @ref GSM_Phone_Functions::ShowStartInfo . After this is 0, the startup info is hidden. 575 * @ref GSM_Phone_Functions::ShowStartInfo . After this is 0, the startup info is hidden.
577 */ 576 */
578 int StartInfoCounter; 577 int StartInfoCounter;
579 578
580 /** 579 /**
581 * Pointer to structure used internally by phone drivers. 580 * Pointer to structure used internally by phone drivers.
582 */ 581 */
583 GSM_GPRSAccessPoint*GPRSPoint; 582 GSM_GPRSAccessPoint*GPRSPoint;
584 /** 583 /**
585 * Pointer to structure used internally by phone drivers. 584 * Pointer to structure used internally by phone drivers.
586 */ 585 */
587 GSM_SpeedDial *SpeedDial; 586 GSM_SpeedDial *SpeedDial;
588 /** 587 /**
589 * Pointer to structure used internally by phone drivers. 588 * Pointer to structure used internally by phone drivers.
590 */ 589 */
591 GSM_DateTime *DateTime; 590 GSM_DateTime *DateTime;
592 /** 591 /**
593 * Pointer to structure used internally by phone drivers. 592 * Pointer to structure used internally by phone drivers.
594 */ 593 */
595 GSM_Alarm *Alarm; 594 GSM_Alarm *Alarm;
596 /** 595 /**
597 * Pointer to structure used internally by phone drivers. 596 * Pointer to structure used internally by phone drivers.
598 */ 597 */
599 GSM_MemoryEntry *Memory; 598 GSM_MemoryEntry *Memory;
600 /** 599 /**
601 * Pointer to structure used internally by phone drivers. 600 * Pointer to structure used internally by phone drivers.
602 */ 601 */
603 GSM_MemoryStatus*MemoryStatus; 602 GSM_MemoryStatus*MemoryStatus;
604 /** 603 /**
605 * Pointer to structure used internally by phone drivers. 604 * Pointer to structure used internally by phone drivers.
606 */ 605 */
607 GSM_SMSC *SMSC; 606 GSM_SMSC *SMSC;
608 /** 607 /**
609 * Pointer to structure used internally by phone drivers. 608 * Pointer to structure used internally by phone drivers.
610 */ 609 */
611 GSM_MultiSMSMessage*GetSMSMessage; 610 GSM_MultiSMSMessage*GetSMSMessage;
612 /** 611 /**
613 * Pointer to structure used internally by phone drivers. 612 * Pointer to structure used internally by phone drivers.
614 */ 613 */
615 GSM_SMSMessage *SaveSMSMessage; 614 GSM_SMSMessage *SaveSMSMessage;
616 /** 615 /**
617 * Pointer to structure used internally by phone drivers. 616 * Pointer to structure used internally by phone drivers.
618 */ 617 */
619 GSM_SMSMemoryStatus*SMSStatus; 618 GSM_SMSMemoryStatus*SMSStatus;
620 /** 619 /**
621 * Pointer to structure used internally by phone drivers. 620 * Pointer to structure used internally by phone drivers.
622 */ 621 */
623 GSM_SMSFolders *SMSFolders; 622 GSM_SMSFolders *SMSFolders;
624 /** 623 /**
625 * Used internally by phone drivers. 624 * Used internally by phone drivers.
626 */ 625 */
627 int *VoiceRecord; 626 int *VoiceRecord;
628 /** 627 /**
629 * Used internally by phone drivers. 628 * Used internally by phone drivers.
630 */ 629 */
631 int CallID; 630 int CallID;
632 /** 631 /**
633 * Pointer to structure used internally by phone drivers. 632 * Pointer to structure used internally by phone drivers.
634 */ 633 */
635 GSM_SignalQuality*SignalQuality; 634 GSM_SignalQuality*SignalQuality;
636 /** 635 /**
637 * Pointer to structure used internally by phone drivers. 636 * Pointer to structure used internally by phone drivers.
638 */ 637 */
639 GSM_BatteryCharge*BatteryCharge; 638 GSM_BatteryCharge*BatteryCharge;
640 /** 639 /**
641 * Pointer to structure used internally by phone drivers. 640 * Pointer to structure used internally by phone drivers.
642 */ 641 */
643 GSM_NetworkInfo *NetworkInfo; 642 GSM_NetworkInfo *NetworkInfo;
644 /** 643 /**
645 * Pointer to structure used internally by phone drivers. 644 * Pointer to structure used internally by phone drivers.
646 */ 645 */
647 GSM_Ringtone *Ringtone; 646 GSM_Ringtone *Ringtone;
648 /** 647 /**
649 * Pointer to structure used internally by phone drivers. 648 * Pointer to structure used internally by phone drivers.
650 */ 649 */
651 GSM_CalendarEntry*Cal; 650 GSM_CalendarEntry*Cal;
652 /** 651 /**
653 * Used internally by phone drivers. 652 * Used internally by phone drivers.
654 */ 653 */
655 unsigned char *SecurityCode; 654 unsigned char *SecurityCode;
656 /** 655 /**
657 * Pointer to structure used internally by phone drivers. 656 * Pointer to structure used internally by phone drivers.
658 */ 657 */
659 GSM_WAPBookmark *WAPBookmark; 658 GSM_WAPBookmark *WAPBookmark;
660 /** 659 /**
661 * Pointer to structure used internally by phone drivers. 660 * Pointer to structure used internally by phone drivers.
662 */ 661 */
663 GSM_MultiWAPSettings*WAPSettings; 662 GSM_MultiWAPSettings*WAPSettings;
664 /** 663 /**
665 * Pointer to structure used internally by phone drivers. 664 * Pointer to structure used internally by phone drivers.
666 */ 665 */
667 GSM_Bitmap *Bitmap; 666 GSM_Bitmap *Bitmap;
668 /** 667 /**
669 * Used internally by phone drivers. 668 * Used internally by phone drivers.
670 */ 669 */
671 unsigned char *Netmonitor; 670 unsigned char *Netmonitor;
672 /** 671 /**
673 * Pointer to structure used internally by phone drivers. 672 * Pointer to structure used internally by phone drivers.
674 */ 673 */
675 GSM_MultiCallDivert*Divert; 674 GSM_MultiCallDivert*Divert;
676 /** 675 /**
@@ -1068,512 +1067,513 @@ typedef struct {
1068 */ 1067 */
1069 GSM_Error (*SendSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); 1068 GSM_Error (*SendSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms);
1070 /** 1069 /**
1071 * Sends SMS already saved in phone. 1070 * Sends SMS already saved in phone.
1072 */ 1071 */
1073 GSM_Error (*SendSavedSMS)(GSM_StateMachine *s, int Folder, int Location); 1072 GSM_Error (*SendSavedSMS)(GSM_StateMachine *s, int Folder, int Location);
1074 GSM_Error (*SetFastSMSSending) (GSM_StateMachine *s, bool enable); 1073 GSM_Error (*SetFastSMSSending) (GSM_StateMachine *s, bool enable);
1075 /** 1074 /**
1076 * Enable/disable notification on incoming SMS. 1075 * Enable/disable notification on incoming SMS.
1077 */ 1076 */
1078 GSM_Error (*SetIncomingSMS) (GSM_StateMachine *s, bool enable); 1077 GSM_Error (*SetIncomingSMS) (GSM_StateMachine *s, bool enable);
1079 /** 1078 /**
1080 * Gets network information from phone. 1079 * Gets network information from phone.
1081 */ 1080 */
1082 GSM_Error (*SetIncomingCB) (GSM_StateMachine *s, bool enable); 1081 GSM_Error (*SetIncomingCB) (GSM_StateMachine *s, bool enable);
1083 /** 1082 /**
1084 * Returns SMS folders information. 1083 * Returns SMS folders information.
1085 */ 1084 */
1086 GSM_Error (*GetSMSFolders) (GSM_StateMachine *s, GSM_SMSFolders *folders); 1085 GSM_Error (*GetSMSFolders) (GSM_StateMachine *s, GSM_SMSFolders *folders);
1087 /** 1086 /**
1088 * Creates SMS folder. 1087 * Creates SMS folder.
1089 */ 1088 */
1090 GSM_Error (*AddSMSFolder) (GSM_StateMachine *s, unsigned char *name); 1089 GSM_Error (*AddSMSFolder) (GSM_StateMachine *s, unsigned char *name);
1091 /** 1090 /**
1092 * Deletes SMS folder. 1091 * Deletes SMS folder.
1093 */ 1092 */
1094 GSM_Error (*DeleteSMSFolder) (GSM_StateMachine *s, int ID); 1093 GSM_Error (*DeleteSMSFolder) (GSM_StateMachine *s, int ID);
1095 /** 1094 /**
1096 * Dials number and starts voice call. 1095 * Dials number and starts voice call.
1097 */ 1096 */
1098 GSM_Error (*DialVoice) (GSM_StateMachine *s, char *Number, GSM_CallShowNumber ShowNumber); 1097 GSM_Error (*DialVoice) (GSM_StateMachine *s, char *Number, GSM_CallShowNumber ShowNumber);
1099 /** 1098 /**
1100 * Accept current incoming call. 1099 * Accept current incoming call.
1101 */ 1100 */
1102 GSM_Error (*AnswerCall) (GSM_StateMachine *s, int ID, bool all); 1101 GSM_Error (*AnswerCall) (GSM_StateMachine *s, int ID, bool all);
1103 /** 1102 /**
1104 * Deny current incoming call. 1103 * Deny current incoming call.
1105 */ 1104 */
1106 GSM_Error (*CancelCall) (GSM_StateMachine *s, int ID, bool all); 1105 GSM_Error (*CancelCall) (GSM_StateMachine *s, int ID, bool all);
1107 /** 1106 /**
1108 * Holds call. 1107 * Holds call.
1109 */ 1108 */
1110 GSM_Error (*HoldCall) (GSM_StateMachine *s, int ID); 1109 GSM_Error (*HoldCall) (GSM_StateMachine *s, int ID);
1111 /** 1110 /**
1112 * Unholds call. 1111 * Unholds call.
1113 */ 1112 */
1114 GSM_Error (*UnholdCall) (GSM_StateMachine *s, int ID); 1113 GSM_Error (*UnholdCall) (GSM_StateMachine *s, int ID);
1115 /** 1114 /**
1116 * Initiates conference call. 1115 * Initiates conference call.
1117 */ 1116 */
1118 GSM_Error (*ConferenceCall) (GSM_StateMachine *s, int ID); 1117 GSM_Error (*ConferenceCall) (GSM_StateMachine *s, int ID);
1119 /** 1118 /**
1120 * Splits call. 1119 * Splits call.
1121 */ 1120 */
1122 GSM_Error (*SplitCall) (GSM_StateMachine *s, int ID); 1121 GSM_Error (*SplitCall) (GSM_StateMachine *s, int ID);
1123 /** 1122 /**
1124 * Transfers call. 1123 * Transfers call.
1125 */ 1124 */
1126 GSM_Error (*TransferCall) (GSM_StateMachine *s, int ID, bool next); 1125 GSM_Error (*TransferCall) (GSM_StateMachine *s, int ID, bool next);
1127 /** 1126 /**
1128 * Switches call. 1127 * Switches call.
1129 */ 1128 */
1130 GSM_Error (*SwitchCall) (GSM_StateMachine *s, int ID, bool next); 1129 GSM_Error (*SwitchCall) (GSM_StateMachine *s, int ID, bool next);
1131 /** 1130 /**
1132 * Gets call diverts. 1131 * Gets call diverts.
1133 */ 1132 */
1134 GSM_Error (*GetCallDivert) (GSM_StateMachine *s, GSM_MultiCallDivert *divert); 1133 GSM_Error (*GetCallDivert) (GSM_StateMachine *s, GSM_MultiCallDivert *divert);
1135 /** 1134 /**
1136 * Sets call diverts. 1135 * Sets call diverts.
1137 */ 1136 */
1138 GSM_Error (*SetCallDivert) (GSM_StateMachine *s, GSM_MultiCallDivert *divert); 1137 GSM_Error (*SetCallDivert) (GSM_StateMachine *s, GSM_MultiCallDivert *divert);
1139 /** 1138 /**
1140 * Cancels all diverts. 1139 * Cancels all diverts.
1141 */ 1140 */
1142 GSM_Error (*CancelAllDiverts) (GSM_StateMachine *s); 1141 GSM_Error (*CancelAllDiverts) (GSM_StateMachine *s);
1143 /** 1142 /**
1144 * Activates/deactivates noticing about incoming calls. 1143 * Activates/deactivates noticing about incoming calls.
1145 */ 1144 */
1146 GSM_Error (*SetIncomingCall) (GSM_StateMachine *s, bool enable); 1145 GSM_Error (*SetIncomingCall) (GSM_StateMachine *s, bool enable);
1147 /** 1146 /**
1148 * Activates/deactivates noticing about incoming USSDs (UnStructured Supplementary Services). 1147 * Activates/deactivates noticing about incoming USSDs (UnStructured Supplementary Services).
1149 */ 1148 */
1150 GSM_Error (*SetIncomingUSSD) (GSM_StateMachine *s, bool enable); 1149 GSM_Error (*SetIncomingUSSD) (GSM_StateMachine *s, bool enable);
1151 /** 1150 /**
1152 * Sends DTMF (Dual Tone Multi Frequency) tone. 1151 * Sends DTMF (Dual Tone Multi Frequency) tone.
1153 */ 1152 */
1154 GSM_Error (*SendDTMF) (GSM_StateMachine *s, char *sequence); 1153 GSM_Error (*SendDTMF) (GSM_StateMachine *s, char *sequence);
1155 /** 1154 /**
1156 * Gets ringtone from phone. 1155 * Gets ringtone from phone.
1157 */ 1156 */
1158 GSM_Error (*GetRingtone)(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone); 1157 GSM_Error (*GetRingtone)(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone);
1159 /** 1158 /**
1160 * Sets ringtone in phone. 1159 * Sets ringtone in phone.
1161 */ 1160 */
1162 GSM_Error (*SetRingtone)(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength); 1161 GSM_Error (*SetRingtone)(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength);
1163 /** 1162 /**
1164 * Acquires ringtone informaiton. 1163 * Acquires ringtone informaiton.
1165 */ 1164 */
1166 GSM_Error (*GetRingtonesInfo) (GSM_StateMachine *s, GSM_AllRingtonesInfo *Info); 1165 GSM_Error (*GetRingtonesInfo) (GSM_StateMachine *s, GSM_AllRingtonesInfo *Info);
1167 /** 1166 /**
1168 * Deletes user defined ringtones from phone. 1167 * Deletes user defined ringtones from phone.
1169 */ 1168 */
1170 GSM_Error (*DeleteUserRingtones)(GSM_StateMachine *s); 1169 GSM_Error (*DeleteUserRingtones)(GSM_StateMachine *s);
1171 /** 1170 /**
1172 * Plays tone. 1171 * Plays tone.
1173 */ 1172 */
1174 GSM_Error (*PlayTone) (GSM_StateMachine *s, int Herz, unsigned char Volume, bool start); 1173 GSM_Error (*PlayTone) (GSM_StateMachine *s, int Herz, unsigned char Volume, bool start);
1175 /** 1174 /**
1176 * Reads WAP bookmark. 1175 * Reads WAP bookmark.
1177 */ 1176 */
1178 GSM_Error (*GetWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark); 1177 GSM_Error (*GetWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
1179 /** 1178 /**
1180 * Sets WAP bookmark. 1179 * Sets WAP bookmark.
1181 */ 1180 */
1182 GSM_Error (*SetWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark); 1181 GSM_Error (*SetWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
1183 /** 1182 /**
1184 * Deletes WAP bookmark. 1183 * Deletes WAP bookmark.
1185 */ 1184 */
1186 GSM_Error (*DeleteWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark); 1185 GSM_Error (*DeleteWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
1187 /** 1186 /**
1188 * Acquires WAP settings. 1187 * Acquires WAP settings.
1189 */ 1188 */
1190 GSM_Error (*GetWAPSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings); 1189 GSM_Error (*GetWAPSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1191 /** 1190 /**
1192 * Changes WAP settings. 1191 * Changes WAP settings.
1193 */ 1192 */
1194 GSM_Error (*SetWAPSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings); 1193 GSM_Error (*SetWAPSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1195 /** 1194 /**
1196 * Acquires MMS settings. 1195 * Acquires MMS settings.
1197 */ 1196 */
1198 GSM_Error (*GetMMSSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings); 1197 GSM_Error (*GetMMSSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1199 /** 1198 /**
1200 * Changes MMS settings. 1199 * Changes MMS settings.
1201 */ 1200 */
1202 GSM_Error (*SetMMSSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings); 1201 GSM_Error (*SetMMSSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1203 /** 1202 /**
1204 * Acquires SyncML settings. 1203 * Acquires SyncML settings.
1205 */ 1204 */
1206 GSM_Error (*GetSyncMLSettings) (GSM_StateMachine *s, GSM_SyncMLSettings *settings); 1205 GSM_Error (*GetSyncMLSettings) (GSM_StateMachine *s, GSM_SyncMLSettings *settings);
1207 /** 1206 /**
1208 * Changes SyncML settings. 1207 * Changes SyncML settings.
1209 */ 1208 */
1210 GSM_Error (*SetSyncMLSettings) (GSM_StateMachine *s, GSM_SyncMLSettings *settings); 1209 GSM_Error (*SetSyncMLSettings) (GSM_StateMachine *s, GSM_SyncMLSettings *settings);
1211 /** 1210 /**
1212 * Acquires chat/presence settings. 1211 * Acquires chat/presence settings.
1213 */ 1212 */
1214 GSM_Error (*GetChatSettings) (GSM_StateMachine *s, GSM_ChatSettings *settings); 1213 GSM_Error (*GetChatSettings) (GSM_StateMachine *s, GSM_ChatSettings *settings);
1215 /** 1214 /**
1216 * Changes chat/presence settings. 1215 * Changes chat/presence settings.
1217 */ 1216 */
1218 GSM_Error (*SetChatSettings) (GSM_StateMachine *s, GSM_ChatSettings *settings); 1217 GSM_Error (*SetChatSettings) (GSM_StateMachine *s, GSM_ChatSettings *settings);
1219 /** 1218 /**
1220 * Gets bitmap. 1219 * Gets bitmap.
1221 */ 1220 */
1222 GSM_Error (*GetBitmap) (GSM_StateMachine *s, GSM_Bitmap *Bitmap); 1221 GSM_Error (*GetBitmap) (GSM_StateMachine *s, GSM_Bitmap *Bitmap);
1223 /** 1222 /**
1224 * Sets bitmap. 1223 * Sets bitmap.
1225 */ 1224 */
1226 GSM_Error (*SetBitmap) (GSM_StateMachine *s, GSM_Bitmap *Bitmap); 1225 GSM_Error (*SetBitmap) (GSM_StateMachine *s, GSM_Bitmap *Bitmap);
1227 /** 1226 /**
1228 * Gets status of ToDos (count of used entries). 1227 * Gets status of ToDos (count of used entries).
1229 */ 1228 */
1230 GSM_Error (*GetToDoStatus) (GSM_StateMachine *s, GSM_ToDoStatus *status); 1229 GSM_Error (*GetToDoStatus) (GSM_StateMachine *s, GSM_ToDoStatus *status);
1231 /** 1230 /**
1232 * Reads ToDo from phone. 1231 * Reads ToDo from phone.
1233 */ 1232 */
1234 GSM_Error (*GetToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); 1233 GSM_Error (*GetToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1235 /** 1234 /**
1236 * Reads ToDo from phone. 1235 * Reads ToDo from phone.
1237 */ 1236 */
1238 GSM_Error (*GetNextToDo)(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start); 1237 GSM_Error (*GetNextToDo)(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start);
1239 /** 1238 /**
1240 * Sets ToDo in phone. 1239 * Sets ToDo in phone.
1241 */ 1240 */
1242 GSM_Error (*SetToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); 1241 GSM_Error (*SetToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1243 /** 1242 /**
1244 * Adds ToDo in phone. 1243 * Adds ToDo in phone.
1245 */ 1244 */
1246 GSM_Error (*AddToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); 1245 GSM_Error (*AddToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1247 /** 1246 /**
1248 * Deletes ToDo entry in phone. 1247 * Deletes ToDo entry in phone.
1249 */ 1248 */
1250 GSM_Error (*DeleteToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); 1249 GSM_Error (*DeleteToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1251 /** 1250 /**
1252 * Deletes all todo entries in phone. 1251 * Deletes all todo entries in phone.
1253 */ 1252 */
1254 GSM_Error (*DeleteAllToDo) (GSM_StateMachine *s); 1253 GSM_Error (*DeleteAllToDo) (GSM_StateMachine *s);
1255 /** 1254 /**
1256 * Retrieves calendar status (number of used entries). 1255 * Retrieves calendar status (number of used entries).
1257 */ 1256 */
1258 GSM_Error (*GetCalendarStatus) (GSM_StateMachine *s, GSM_CalendarStatus *Status); 1257 GSM_Error (*GetCalendarStatus) (GSM_StateMachine *s, GSM_CalendarStatus *Status);
1259 /** 1258 /**
1260 * Retrieves calendar entry. 1259 * Retrieves calendar entry.
1261 */ 1260 */
1262 GSM_Error (*GetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); 1261 GSM_Error (*GetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note);
1263 /** 1262 /**
1264 * Retrieves calendar entry. This is useful for continuous reading of all 1263 * Retrieves calendar entry. This is useful for continuous reading of all
1265 * calendar entries. 1264 * calendar entries.
1266 */ 1265 */
1267 GSM_Error (*GetNextCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); 1266 GSM_Error (*GetNextCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start);
1268 /** 1267 /**
1269 * Sets calendar entry 1268 * Sets calendar entry
1270 */ 1269 */
1271 GSM_Error (*SetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); 1270 GSM_Error (*SetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note);
1272 /** 1271 /**
1273 * Adds calendar entry. 1272 * Adds calendar entry.
1274 */ 1273 */
1275 GSM_Error (*AddCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); 1274 GSM_Error (*AddCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note);
1276 /** 1275 /**
1277 * Deletes calendar entry. 1276 * Deletes calendar entry.
1278 */ 1277 */
1279 GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note); 1278 GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note);
1280 /** 1279 /**
1281 * Deletes all calendar entries. 1280 * Deletes all calendar entries.
1282 */ 1281 */
1283 GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s); 1282 GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s);
1284 /** 1283 /**
1285 * Reads calendar settings. 1284 * Reads calendar settings.
1286 */ 1285 */
1287 GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); 1286 GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings);
1288 /** 1287 /**
1289 * Sets calendar settings. 1288 * Sets calendar settings.
1290 */ 1289 */
1291 GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); 1290 GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings);
1292 /** 1291 /**
1293 * Gets note. 1292 * Gets note.
1294 */ 1293 */
1295 GSM_Error (*GetNextNote)(GSM_StateMachine *s, GSM_NoteEntry *Note, bool refresh); 1294 GSM_Error (*GetNextNote)(GSM_StateMachine *s, GSM_NoteEntry *Note, bool refresh);
1296 /** 1295 /**
1297 * Reads profile. 1296 * Reads profile.
1298 */ 1297 */
1299 GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); 1298 GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile);
1300 /** 1299 /**
1301 * Updates profile. 1300 * Updates profile.
1302 */ 1301 */
1303 GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); 1302 GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile);
1304 /** 1303 /**
1305 * Reads FM station. 1304 * Reads FM station.
1306 */ 1305 */
1307 GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); 1306 GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation);
1308 /** 1307 /**
1309 * Sets FM station. 1308 * Sets FM station.
1310 */ 1309 */
1311 GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); 1310 GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation);
1312 /** 1311 /**
1313 * Clears defined FM stations. 1312 * Clears defined FM stations.
1314 */ 1313 */
1315 GSM_Error (*ClearFMStations) (GSM_StateMachine *s); 1314 GSM_Error (*ClearFMStations) (GSM_StateMachine *s);
1316 /** 1315 /**
1317 * Gets next filename from filesystem. 1316 * Gets next filename from filesystem.
1318 */ 1317 */
1319 GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, bool start); 1318 GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, bool start);
1320 /** 1319 /**
1321 * Gets file part from filesystem. 1320 * Gets file part from filesystem.
1322 */ 1321 */
1323 GSM_Error (*GetFilePart)(GSM_StateMachine *s, GSM_File *File); 1322 GSM_Error (*GetFilePart)(GSM_StateMachine *s, GSM_File *File);
1324 /** 1323 /**
1325 * Adds file part to filesystem. 1324 * Adds file part to filesystem.
1326 */ 1325 */
1327 GSM_Error (*AddFilePart)(GSM_StateMachine *s, GSM_File *File, int *Pos); 1326 GSM_Error (*AddFilePart)(GSM_StateMachine *s, GSM_File *File, int *Pos);
1328 /** 1327 /**
1329 * Acquires filesystem status. 1328 * Acquires filesystem status.
1330 */ 1329 */
1331 GSM_Error (*GetFileSystemStatus)(GSM_StateMachine *s, GSM_FileSystemStatus *Status); 1330 GSM_Error (*GetFileSystemStatus)(GSM_StateMachine *s, GSM_FileSystemStatus *Status);
1332 /** 1331 /**
1333 * Deletes file from filessytem. 1332 * Deletes file from filessytem.
1334 */ 1333 */
1335 GSM_Error (*DeleteFile) (GSM_StateMachine *s, unsigned char *ID); 1334 GSM_Error (*DeleteFile) (GSM_StateMachine *s, unsigned char *ID);
1336 /** 1335 /**
1337 * Adds folder to filesystem. 1336 * Adds folder to filesystem.
1338 */ 1337 */
1339 GSM_Error (*AddFolder) (GSM_StateMachine *s, GSM_File *File); 1338 GSM_Error (*AddFolder) (GSM_StateMachine *s, GSM_File *File);
1340 /** 1339 /**
1341 * Gets GPRS access point. 1340 * Gets GPRS access point.
1342 */ 1341 */
1343 GSM_Error (*GetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point); 1342 GSM_Error (*GetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point);
1344 /** 1343 /**
1345 * Sets GPRS access point. 1344 * Sets GPRS access point.
1346 */ 1345 */
1347 GSM_Error (*SetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point); 1346 GSM_Error (*SetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point);
1348} GSM_Phone_Functions; 1347} GSM_Phone_Functions;
1349 1348
1350 extern GSM_Phone_Functions NAUTOPhone; 1349 extern GSM_Phone_Functions NAUTOPhone;
1351#ifdef GSM_ENABLE_NOKIA3320 1350#ifdef GSM_ENABLE_NOKIA3320
1352 extern GSM_Phone_Functions N3320Phone; 1351 extern GSM_Phone_Functions N3320Phone;
1353#endif 1352#endif
1354#ifdef GSM_ENABLE_NOKIA3650 1353#ifdef GSM_ENABLE_NOKIA3650
1355 extern GSM_Phone_Functions N3650Phone; 1354 extern GSM_Phone_Functions N3650Phone;
1356#endif 1355#endif
1357#ifdef GSM_ENABLE_NOKIA6110 1356#ifdef GSM_ENABLE_NOKIA6110
1358 extern GSM_Phone_Functions N6110Phone; 1357 extern GSM_Phone_Functions N6110Phone;
1359#endif 1358#endif
1360#ifdef GSM_ENABLE_NOKIA650 1359#ifdef GSM_ENABLE_NOKIA650
1361 extern GSM_Phone_Functions N650Phone; 1360 extern GSM_Phone_Functions N650Phone;
1362#endif 1361#endif
1363#ifdef GSM_ENABLE_NOKIA6510 1362#ifdef GSM_ENABLE_NOKIA6510
1364 extern GSM_Phone_Functions N6510Phone; 1363 extern GSM_Phone_Functions N6510Phone;
1365#endif 1364#endif
1366#ifdef GSM_ENABLE_NOKIA7110 1365#ifdef GSM_ENABLE_NOKIA7110
1367 extern GSM_Phone_Functions N7110Phone; 1366 extern GSM_Phone_Functions N7110Phone;
1368#endif 1367#endif
1369#ifdef GSM_ENABLE_NOKIA9210 1368#ifdef GSM_ENABLE_NOKIA9210
1370 extern GSM_Phone_Functions N9210Phone; 1369 extern GSM_Phone_Functions N9210Phone;
1371#endif 1370#endif
1372#ifdef GSM_ENABLE_ATGEN 1371#ifdef GSM_ENABLE_ATGEN
1373 extern GSM_Phone_Functions ATGENPhone; 1372 extern GSM_Phone_Functions ATGENPhone;
1374#endif 1373#endif
1375#ifdef GSM_ENABLE_ALCATEL 1374#ifdef GSM_ENABLE_ALCATEL
1376 extern GSM_Phone_Functions ALCATELPhone; 1375 extern GSM_Phone_Functions ALCATELPhone;
1377#endif 1376#endif
1378#ifdef GSM_ENABLE_OBEXGEN 1377#ifdef GSM_ENABLE_OBEXGEN
1379 extern GSM_Phone_Functions OBEXGENPhone; 1378 extern GSM_Phone_Functions OBEXGENPhone;
1380#endif 1379#endif
1381#ifdef GSM_ENABLE_MROUTERGEN 1380#ifdef GSM_ENABLE_MROUTERGEN
1382 extern GSM_Phone_Functions MROUTERGENPhone; 1381 extern GSM_Phone_Functions MROUTERGENPhone;
1383#endif 1382#endif
1384 1383
1385typedef struct { 1384typedef struct {
1386 GSM_Phone_Data Data; 1385 GSM_Phone_Data Data;
1387 GSM_Phone_Functions*Functions; 1386 GSM_Phone_Functions*Functions;
1388} GSM_Phone; 1387} GSM_Phone;
1389 1388
1390/* --------------------------- User layer ---------------------------------- */ 1389/* --------------------------- User layer ---------------------------------- */
1391 1390
1392struct _GSM_User { 1391struct _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
1404typedef enum { 1403typedef 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
1425typedef struct { 1424typedef 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
1450struct _GSM_StateMachine { 1449struct _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
1495typedef enum { 1494typedef 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 */
1554struct _OnePhoneModel { 1553struct _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
1567int smprintf(GSM_StateMachine *s, const char *format, ...); 1566int smprintf(GSM_StateMachine *s, const char *format, ...);
1568 1567
1569void GSM_OSErrorInfo(GSM_StateMachine *s, char *description); 1568void GSM_OSErrorInfo(GSM_StateMachine *s, char *description);
1570 1569
1571#ifdef GSM_ENABLE_BACKUP 1570#ifdef GSM_ENABLE_BACKUP
1572void GSM_GetPhoneFeaturesForBackup(GSM_StateMachine *s, GSM_Backup_Info *info); 1571void 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,1240 +1,1246 @@
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
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "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
161class KAex2phonePrefs : public QDialog 162class 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
201public: 202public:
202 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
203 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
204}; 205};
205 206
206bool pasteWithNewUid = true; 207bool pasteWithNewUid = true;
207 208
208#ifdef KAB_EMBEDDED 209#ifdef KAB_EMBEDDED
209KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 210KABCore::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
214KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 215KABCore::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 );
230#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
231 232
232 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
233 SLOT( addressBookChanged() ) ); 234 SLOT( addressBookChanged() ) );
234 235
235#if 0 236#if 0
236 // LP moved to addressbook init method 237 // LP moved to addressbook init method
237 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
238 "X-Department", "KADDRESSBOOK" ); 239 "X-Department", "KADDRESSBOOK" );
239 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
240 "X-Profession", "KADDRESSBOOK" ); 241 "X-Profession", "KADDRESSBOOK" );
241 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
242 "X-AssistantsName", "KADDRESSBOOK" ); 243 "X-AssistantsName", "KADDRESSBOOK" );
243 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
244 "X-ManagersName", "KADDRESSBOOK" ); 245 "X-ManagersName", "KADDRESSBOOK" );
245 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
246 "X-SpousesName", "KADDRESSBOOK" ); 247 "X-SpousesName", "KADDRESSBOOK" );
247 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
248 "X-Office", "KADDRESSBOOK" ); 249 "X-Office", "KADDRESSBOOK" );
249 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
250 "X-IMAddress", "KADDRESSBOOK" ); 251 "X-IMAddress", "KADDRESSBOOK" );
251 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
252 "X-Anniversary", "KADDRESSBOOK" ); 253 "X-Anniversary", "KADDRESSBOOK" );
253 254
254 //US added this field to become compatible with Opie/qtopia addressbook 255 //US added this field to become compatible with Opie/qtopia addressbook
255 // values can be "female" or "male" or "". An empty field represents undefined. 256 // values can be "female" or "male" or "". An empty field represents undefined.
256 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
257 "X-Gender", "KADDRESSBOOK" ); 258 "X-Gender", "KADDRESSBOOK" );
258 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
259 "X-Children", "KADDRESSBOOK" ); 260 "X-Children", "KADDRESSBOOK" );
260 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
261 "X-FreeBusyUrl", "KADDRESSBOOK" ); 262 "X-FreeBusyUrl", "KADDRESSBOOK" );
262#endif 263#endif
263 initGUI(); 264 initGUI();
264 265
265 mIncSearchWidget->setFocus(); 266 mIncSearchWidget->setFocus();
266 267
267 268
268 connect( mViewManager, SIGNAL( selected( const QString& ) ), 269 connect( mViewManager, SIGNAL( selected( const QString& ) ),
269 SLOT( setContactSelected( const QString& ) ) ); 270 SLOT( setContactSelected( const QString& ) ) );
270 connect( mViewManager, SIGNAL( executed( const QString& ) ), 271 connect( mViewManager, SIGNAL( executed( const QString& ) ),
271 SLOT( executeContact( const QString& ) ) ); 272 SLOT( executeContact( const QString& ) ) );
272 273
273 connect( mViewManager, SIGNAL( deleteRequest( ) ), 274 connect( mViewManager, SIGNAL( deleteRequest( ) ),
274 SLOT( deleteContacts( ) ) ); 275 SLOT( deleteContacts( ) ) );
275 connect( mViewManager, SIGNAL( modified() ), 276 connect( mViewManager, SIGNAL( modified() ),
276 SLOT( setModified() ) ); 277 SLOT( setModified() ) );
277 278
278 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
279 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
280 281
281 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
282 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
283 284
284 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
285 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
286 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
287 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
288 289
289 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
290 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
291 292
292 293
293 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
295 296
296 297
297#ifndef KAB_EMBEDDED 298#ifndef KAB_EMBEDDED
298 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 299 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
299 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 300 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
300 301
301 connect( mDetails, SIGNAL( browse( const QString& ) ), 302 connect( mDetails, SIGNAL( browse( const QString& ) ),
302 SLOT( browse( const QString& ) ) ); 303 SLOT( browse( const QString& ) ) );
303 304
304 305
305 mAddressBookService = new KAddressBookService( this ); 306 mAddressBookService = new KAddressBookService( this );
306 307
307#endif //KAB_EMBEDDED 308#endif //KAB_EMBEDDED
308 mEditorDialog = 0; 309 mEditorDialog = 0;
309 createAddresseeEditorDialog( this ); 310 createAddresseeEditorDialog( this );
310 setModified( false ); 311 setModified( false );
311} 312}
312 313
313KABCore::~KABCore() 314KABCore::~KABCore()
314{ 315{
315 // save(); 316 // save();
316 //saveSettings(); 317 //saveSettings();
317 //KABPrefs::instance()->writeConfig(); 318 //KABPrefs::instance()->writeConfig();
318 delete AddresseeConfig::instance(); 319 delete AddresseeConfig::instance();
319 mAddressBook = 0; 320 mAddressBook = 0;
320 KABC::StdAddressBook::close(); 321 KABC::StdAddressBook::close();
321 322
322 delete syncManager; 323 delete syncManager;
323} 324}
324 325
325void KABCore::restoreSettings() 326void KABCore::restoreSettings()
326{ 327{
327 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 328 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
328 329
329 bool state; 330 bool state;
330 331
331 if (mMultipleViewsAtOnce) 332 if (mMultipleViewsAtOnce)
332 state = KABPrefs::instance()->mDetailsPageVisible; 333 state = KABPrefs::instance()->mDetailsPageVisible;
333 else 334 else
334 state = false; 335 state = false;
335 336
336 mActionDetails->setChecked( state ); 337 mActionDetails->setChecked( state );
337 setDetailsVisible( state ); 338 setDetailsVisible( state );
338 339
339 state = KABPrefs::instance()->mJumpButtonBarVisible; 340 state = KABPrefs::instance()->mJumpButtonBarVisible;
340 341
341 mActionJumpBar->setChecked( state ); 342 mActionJumpBar->setChecked( state );
342 setJumpButtonBarVisible( state ); 343 setJumpButtonBarVisible( state );
343/*US 344/*US
344 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 345 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
345 if ( splitterSize.count() == 0 ) { 346 if ( splitterSize.count() == 0 ) {
346 splitterSize.append( width() / 2 ); 347 splitterSize.append( width() / 2 );
347 splitterSize.append( width() / 2 ); 348 splitterSize.append( width() / 2 );
348 } 349 }
349 mMiniSplitter->setSizes( splitterSize ); 350 mMiniSplitter->setSizes( splitterSize );
350 if ( mExtensionBarSplitter ) { 351 if ( mExtensionBarSplitter ) {
351 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 352 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
352 if ( splitterSize.count() == 0 ) { 353 if ( splitterSize.count() == 0 ) {
353 splitterSize.append( width() / 2 ); 354 splitterSize.append( width() / 2 );
354 splitterSize.append( width() / 2 ); 355 splitterSize.append( width() / 2 );
355 } 356 }
356 mExtensionBarSplitter->setSizes( splitterSize ); 357 mExtensionBarSplitter->setSizes( splitterSize );
357 358
358 } 359 }
359*/ 360*/
360 mViewManager->restoreSettings(); 361 mViewManager->restoreSettings();
361 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 362 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
362 mExtensionManager->restoreSettings(); 363 mExtensionManager->restoreSettings();
363#ifdef DESKTOP_VERSION 364#ifdef DESKTOP_VERSION
364 int wid = width(); 365 int wid = width();
365 if ( wid < 10 ) 366 if ( wid < 10 )
366 wid = 400; 367 wid = 400;
367#else 368#else
368 int wid = QApplication::desktop()->width(); 369 int wid = QApplication::desktop()->width();
369 if ( wid < 640 ) 370 if ( wid < 640 )
370 wid = QApplication::desktop()->height(); 371 wid = QApplication::desktop()->height();
371#endif 372#endif
372 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 373 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
373 if ( true /*splitterSize.count() == 0*/ ) { 374 if ( true /*splitterSize.count() == 0*/ ) {
374 splitterSize.append( wid / 2 ); 375 splitterSize.append( wid / 2 );
375 splitterSize.append( wid / 2 ); 376 splitterSize.append( wid / 2 );
376 } 377 }
377 mMiniSplitter->setSizes( splitterSize ); 378 mMiniSplitter->setSizes( splitterSize );
378 if ( mExtensionBarSplitter ) { 379 if ( mExtensionBarSplitter ) {
379 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 380 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
380 if ( true /*splitterSize.count() == 0*/ ) { 381 if ( true /*splitterSize.count() == 0*/ ) {
381 splitterSize.append( wid / 2 ); 382 splitterSize.append( wid / 2 );
382 splitterSize.append( wid / 2 ); 383 splitterSize.append( wid / 2 );
383 } 384 }
384 mExtensionBarSplitter->setSizes( splitterSize ); 385 mExtensionBarSplitter->setSizes( splitterSize );
385 386
386 } 387 }
387 388
388 389
389} 390}
390 391
391void KABCore::saveSettings() 392void KABCore::saveSettings()
392{ 393{
393 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 394 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
394 if ( mExtensionBarSplitter ) 395 if ( mExtensionBarSplitter )
395 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 396 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
396 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 397 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
397 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 398 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
398#ifndef KAB_EMBEDDED 399#ifndef KAB_EMBEDDED
399 400
400 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 401 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
401 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 402 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
402#endif //KAB_EMBEDDED 403#endif //KAB_EMBEDDED
403 mExtensionManager->saveSettings(); 404 mExtensionManager->saveSettings();
404 mViewManager->saveSettings(); 405 mViewManager->saveSettings();
405 406
406 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 407 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
407} 408}
408 409
409KABC::AddressBook *KABCore::addressBook() const 410KABC::AddressBook *KABCore::addressBook() const
410{ 411{
411 return mAddressBook; 412 return mAddressBook;
412} 413}
413 414
414KConfig *KABCore::config() 415KConfig *KABCore::config()
415{ 416{
416#ifndef KAB_EMBEDDED 417#ifndef KAB_EMBEDDED
417 return KABPrefs::instance()->config(); 418 return KABPrefs::instance()->config();
418#else //KAB_EMBEDDED 419#else //KAB_EMBEDDED
419 return KABPrefs::instance()->getConfig(); 420 return KABPrefs::instance()->getConfig();
420#endif //KAB_EMBEDDED 421#endif //KAB_EMBEDDED
421} 422}
422 423
423KActionCollection *KABCore::actionCollection() const 424KActionCollection *KABCore::actionCollection() const
424{ 425{
425 return mGUIClient->actionCollection(); 426 return mGUIClient->actionCollection();
426} 427}
427 428
428KABC::Field *KABCore::currentSearchField() const 429KABC::Field *KABCore::currentSearchField() const
429{ 430{
430 if (mIncSearchWidget) 431 if (mIncSearchWidget)
431 return mIncSearchWidget->currentField(); 432 return mIncSearchWidget->currentField();
432 else 433 else
433 return 0; 434 return 0;
434} 435}
435 436
436QStringList KABCore::selectedUIDs() const 437QStringList KABCore::selectedUIDs() const
437{ 438{
438 return mViewManager->selectedUids(); 439 return mViewManager->selectedUids();
439} 440}
440 441
441KABC::Resource *KABCore::requestResource( QWidget *parent ) 442KABC::Resource *KABCore::requestResource( QWidget *parent )
442{ 443{
443 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 444 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
444 445
445 QPtrList<KRES::Resource> kresResources; 446 QPtrList<KRES::Resource> kresResources;
446 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 447 QPtrListIterator<KABC::Resource> resIt( kabcResources );
447 KABC::Resource *resource; 448 KABC::Resource *resource;
448 while ( ( resource = resIt.current() ) != 0 ) { 449 while ( ( resource = resIt.current() ) != 0 ) {
449 ++resIt; 450 ++resIt;
450 if ( !resource->readOnly() ) { 451 if ( !resource->readOnly() ) {
451 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 452 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
452 if ( res ) 453 if ( res )
453 kresResources.append( res ); 454 kresResources.append( res );
454 } 455 }
455 } 456 }
456 457
457 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 458 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
458 return static_cast<KABC::Resource*>( res ); 459 return static_cast<KABC::Resource*>( res );
459} 460}
460 461
461#ifndef KAB_EMBEDDED 462#ifndef KAB_EMBEDDED
462KAboutData *KABCore::createAboutData() 463KAboutData *KABCore::createAboutData()
463#else //KAB_EMBEDDED 464#else //KAB_EMBEDDED
464void KABCore::createAboutData() 465void KABCore::createAboutData()
465#endif //KAB_EMBEDDED 466#endif //KAB_EMBEDDED
466{ 467{
467#ifndef KAB_EMBEDDED 468#ifndef KAB_EMBEDDED
468 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 469 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
469 "3.1", I18N_NOOP( "The KDE Address Book" ), 470 "3.1", I18N_NOOP( "The KDE Address Book" ),
470 KAboutData::License_GPL_V2, 471 KAboutData::License_GPL_V2,
471 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 472 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
472 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 473 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
473 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 474 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
474 about->addAuthor( "Cornelius Schumacher", 475 about->addAuthor( "Cornelius Schumacher",
475 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 476 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
476 "schumacher@kde.org" ); 477 "schumacher@kde.org" );
477 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 478 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
478 "mpilone@slac.com" ); 479 "mpilone@slac.com" );
479 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 480 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
480 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 481 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
481 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 482 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
482 "michel@klaralvdalens-datakonsult.se" ); 483 "michel@klaralvdalens-datakonsult.se" );
483 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 484 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
484 "hansen@kde.org" ); 485 "hansen@kde.org" );
485 486
486 return about; 487 return about;
487#endif //KAB_EMBEDDED 488#endif //KAB_EMBEDDED
488 489
489 QString version; 490 QString version;
490#include <../version> 491#include <../version>
491 QMessageBox::about( this, "About KAddressbook/Pi", 492 QMessageBox::about( this, "About KAddressbook/Pi",
492 "KAddressbook/Platform-independent\n" 493 "KAddressbook/Platform-independent\n"
493 "(KA/Pi) " +version + " - " + 494 "(KA/Pi) " +version + " - " +
494#ifdef DESKTOP_VERSION 495#ifdef DESKTOP_VERSION
495 "Desktop Edition\n" 496 "Desktop Edition\n"
496#else 497#else
497 "PDA-Edition\n" 498 "PDA-Edition\n"
498 "for: Zaurus 5500 / 7x0 / 8x0\n" 499 "for: Zaurus 5500 / 7x0 / 8x0\n"
499#endif 500#endif
500 501
501 "(c) 2004 Ulf Schenk\n" 502 "(c) 2004 Ulf Schenk\n"
502 "(c) 2004 Lutz Rogowski\n" 503 "(c) 2004 Lutz Rogowski\n"
503 "(c) 1997-2003, The KDE PIM Team\n" 504 "(c) 1997-2003, The KDE PIM Team\n"
504 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 505 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
505 "Don Sanders Original author\n" 506 "Don Sanders Original author\n"
506 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 507 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
507 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 508 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
508 "Greg Stern DCOP interface\n" 509 "Greg Stern DCOP interface\n"
509 "Mark Westcot Contact pinning\n" 510 "Mark Westcot Contact pinning\n"
510 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 511 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
511 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 512 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
512#ifdef _WIN32_ 513#ifdef _WIN32_
513 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 514 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
514#endif 515#endif
515 ); 516 );
516} 517}
517 518
518void KABCore::setContactSelected( const QString &uid ) 519void KABCore::setContactSelected( const QString &uid )
519{ 520{
520 KABC::Addressee addr = mAddressBook->findByUid( uid ); 521 KABC::Addressee addr = mAddressBook->findByUid( uid );
521 if ( !mDetails->isHidden() ) 522 if ( !mDetails->isHidden() )
522 mDetails->setAddressee( addr ); 523 mDetails->setAddressee( addr );
523 524
524 if ( !addr.isEmpty() ) { 525 if ( !addr.isEmpty() ) {
525 emit contactSelected( addr.formattedName() ); 526 emit contactSelected( addr.formattedName() );
526 KABC::Picture pic = addr.photo(); 527 KABC::Picture pic = addr.photo();
527 if ( pic.isIntern() ) { 528 if ( pic.isIntern() ) {
528//US emit contactSelected( pic.data() ); 529//US emit contactSelected( pic.data() );
529//US instead use: 530//US instead use:
530 QPixmap px; 531 QPixmap px;
531 if (pic.data().isNull() != true) 532 if (pic.data().isNull() != true)
532 { 533 {
533 px.convertFromImage(pic.data()); 534 px.convertFromImage(pic.data());
534 } 535 }
535 536
536 emit contactSelected( px ); 537 emit contactSelected( px );
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
567void KABCore::sendMail() 568void KABCore::sendMail()
568{ 569{
569 sendMail( mViewManager->selectedEmails().join( ", " ) ); 570 sendMail( mViewManager->selectedEmails().join( ", " ) );
570} 571}
571 572
572void KABCore::sendMail( const QString& emaillist ) 573void 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
583void KABCore::mailVCard() 584void 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
590void KABCore::mailVCard( const QStringList& uids ) 591void 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*/
646void KABCore::beamMySelf() 647void 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
662void KABCore::export2phone() 663void 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}
746void KABCore::beamVCard() 752void 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
754void KABCore::beamVCard(const QStringList& uids) 760void 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
854void KABCore::beamDone( Ir *ir ) 860void 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
862void KABCore::browse( const QString& url ) 868void 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
871void KABCore::selectAllContacts() 877void KABCore::selectAllContacts()
872{ 878{
873 mViewManager->setSelected( QString::null, true ); 879 mViewManager->setSelected( QString::null, true );
874} 880}
875 881
876void KABCore::deleteContacts() 882void KABCore::deleteContacts()
877{ 883{
878 QStringList uidList = mViewManager->selectedUids(); 884 QStringList uidList = mViewManager->selectedUids();
879 deleteContacts( uidList ); 885 deleteContacts( uidList );
880} 886}
881 887
882void KABCore::deleteContacts( const QStringList &uids ) 888void 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
895void KABCore::copyContacts() 901void 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
907void KABCore::cutContacts() 913void 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
921void KABCore::pasteContacts() 927void KABCore::pasteContacts()
922{ 928{
923 QClipboard *cb = QApplication::clipboard(); 929 QClipboard *cb = QApplication::clipboard();
924 930
925 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 931 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
926 932
927 pasteContacts( list ); 933 pasteContacts( list );
928} 934}
929 935
930void KABCore::pasteContacts( KABC::Addressee::List &list ) 936void KABCore::pasteContacts( KABC::Addressee::List &list )
931{ 937{
932 KABC::Resource *resource = requestResource( this ); 938 KABC::Resource *resource = requestResource( this );
933 KABC::Addressee::List::Iterator it; 939 KABC::Addressee::List::Iterator it;
934 for ( it = list.begin(); it != list.end(); ++it ) 940 for ( it = list.begin(); it != list.end(); ++it )
935 (*it).setResource( resource ); 941 (*it).setResource( resource );
936 942
937 PwPasteCommand *command = new PwPasteCommand( this, list ); 943 PwPasteCommand *command = new PwPasteCommand( this, list );
938 UndoStack::instance()->push( command ); 944 UndoStack::instance()->push( command );
939 RedoStack::instance()->clear(); 945 RedoStack::instance()->clear();
940 946
941 setModified( true ); 947 setModified( true );
942} 948}
943 949
944void KABCore::setWhoAmI() 950void KABCore::setWhoAmI()
945{ 951{
946 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 952 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
947 953
948 if ( addrList.count() > 1 ) { 954 if ( addrList.count() > 1 ) {
949 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 955 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
950 return; 956 return;
951 } 957 }
952 958
953 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 959 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
954 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 960 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
955 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 961 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
956} 962}
957 963
958void KABCore::setCategories() 964void KABCore::setCategories()
959{ 965{
960 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 966 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
961 if ( !dlg.exec() ) 967 if ( !dlg.exec() )
962 return; 968 return;
963 969
964 bool merge = false; 970 bool merge = false;
965 QString msg = i18n( "Merge with existing categories?" ); 971 QString msg = i18n( "Merge with existing categories?" );
966 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 972 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
967 merge = true; 973 merge = true;
968 974
969 QStringList categories = dlg.selectedCategories(); 975 QStringList categories = dlg.selectedCategories();
970 976
971 QStringList uids = mViewManager->selectedUids(); 977 QStringList uids = mViewManager->selectedUids();
972 QStringList::Iterator it; 978 QStringList::Iterator it;
973 for ( it = uids.begin(); it != uids.end(); ++it ) { 979 for ( it = uids.begin(); it != uids.end(); ++it ) {
974 KABC::Addressee addr = mAddressBook->findByUid( *it ); 980 KABC::Addressee addr = mAddressBook->findByUid( *it );
975 if ( !addr.isEmpty() ) { 981 if ( !addr.isEmpty() ) {
976 if ( !merge ) 982 if ( !merge )
977 addr.setCategories( categories ); 983 addr.setCategories( categories );
978 else { 984 else {
979 QStringList addrCategories = addr.categories(); 985 QStringList addrCategories = addr.categories();
980 QStringList::Iterator catIt; 986 QStringList::Iterator catIt;
981 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 987 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
982 if ( !addrCategories.contains( *catIt ) ) 988 if ( !addrCategories.contains( *catIt ) )
983 addrCategories.append( *catIt ); 989 addrCategories.append( *catIt );
984 } 990 }
985 addr.setCategories( addrCategories ); 991 addr.setCategories( addrCategories );
986 } 992 }
987 993
988 mAddressBook->insertAddressee( addr ); 994 mAddressBook->insertAddressee( addr );
989 } 995 }
990 } 996 }
991 997
992 if ( uids.count() > 0 ) 998 if ( uids.count() > 0 )
993 setModified( true ); 999 setModified( true );
994} 1000}
995 1001
996void KABCore::setSearchFields( const KABC::Field::List &fields ) 1002void KABCore::setSearchFields( const KABC::Field::List &fields )
997{ 1003{
998 mIncSearchWidget->setFields( fields ); 1004 mIncSearchWidget->setFields( fields );
999} 1005}
1000 1006
1001void KABCore::incrementalSearch( const QString& text ) 1007void KABCore::incrementalSearch( const QString& text )
1002{ 1008{
1003 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1009 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1004} 1010}
1005 1011
1006void KABCore::setModified() 1012void KABCore::setModified()
1007{ 1013{
1008 setModified( true ); 1014 setModified( true );
1009} 1015}
1010 1016
1011void KABCore::setModifiedWOrefresh() 1017void KABCore::setModifiedWOrefresh()
1012{ 1018{
1013 // qDebug("KABCore::setModifiedWOrefresh() "); 1019 // qDebug("KABCore::setModifiedWOrefresh() ");
1014 mModified = true; 1020 mModified = true;
1015 mActionSave->setEnabled( mModified ); 1021 mActionSave->setEnabled( mModified );
1016#ifdef DESKTOP_VERSION 1022#ifdef DESKTOP_VERSION
1017 mDetails->refreshView(); 1023 mDetails->refreshView();
1018#endif 1024#endif
1019 1025
1020} 1026}
1021void KABCore::setModified( bool modified ) 1027void KABCore::setModified( bool modified )
1022{ 1028{
1023 mModified = modified; 1029 mModified = modified;
1024 mActionSave->setEnabled( mModified ); 1030 mActionSave->setEnabled( mModified );
1025 1031
1026 if ( modified ) 1032 if ( modified )
1027 mJumpButtonBar->recreateButtons(); 1033 mJumpButtonBar->recreateButtons();
1028 1034
1029 mViewManager->refreshView(); 1035 mViewManager->refreshView();
1030 mDetails->refreshView(); 1036 mDetails->refreshView();
1031 1037
1032} 1038}
1033 1039
1034bool KABCore::modified() const 1040bool KABCore::modified() const
1035{ 1041{
1036 return mModified; 1042 return mModified;
1037} 1043}
1038 1044
1039void KABCore::contactModified( const KABC::Addressee &addr ) 1045void KABCore::contactModified( const KABC::Addressee &addr )
1040{ 1046{
1041 1047
1042 Command *command = 0; 1048 Command *command = 0;
1043 QString uid; 1049 QString uid;
1044 1050
1045 // check if it exists already 1051 // check if it exists already
1046 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1052 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1047 if ( origAddr.isEmpty() ) 1053 if ( origAddr.isEmpty() )
1048 command = new PwNewCommand( mAddressBook, addr ); 1054 command = new PwNewCommand( mAddressBook, addr );
1049 else { 1055 else {
1050 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1056 command = new PwEditCommand( mAddressBook, origAddr, addr );
1051 uid = addr.uid(); 1057 uid = addr.uid();
1052 } 1058 }
1053 1059
1054 UndoStack::instance()->push( command ); 1060 UndoStack::instance()->push( command );
1055 RedoStack::instance()->clear(); 1061 RedoStack::instance()->clear();
1056 1062
1057 setModified( true ); 1063 setModified( true );
1058} 1064}
1059 1065
1060void KABCore::newContact() 1066void KABCore::newContact()
1061{ 1067{
1062 1068
1063 1069
1064 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1070 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1065 1071
1066 QPtrList<KRES::Resource> kresResources; 1072 QPtrList<KRES::Resource> kresResources;
1067 QPtrListIterator<KABC::Resource> it( kabcResources ); 1073 QPtrListIterator<KABC::Resource> it( kabcResources );
1068 KABC::Resource *resource; 1074 KABC::Resource *resource;
1069 while ( ( resource = it.current() ) != 0 ) { 1075 while ( ( resource = it.current() ) != 0 ) {
1070 ++it; 1076 ++it;
1071 if ( !resource->readOnly() ) { 1077 if ( !resource->readOnly() ) {
1072 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1078 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1073 if ( res ) 1079 if ( res )
1074 kresResources.append( res ); 1080 kresResources.append( res );
1075 } 1081 }
1076 } 1082 }
1077 1083
1078 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1084 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1079 resource = static_cast<KABC::Resource*>( res ); 1085 resource = static_cast<KABC::Resource*>( res );
1080 1086
1081 if ( resource ) { 1087 if ( resource ) {
1082 KABC::Addressee addr; 1088 KABC::Addressee addr;
1083 addr.setResource( resource ); 1089 addr.setResource( resource );
1084 mEditorDialog->setAddressee( addr ); 1090 mEditorDialog->setAddressee( addr );
1085 KApplication::execDialog ( mEditorDialog ); 1091 KApplication::execDialog ( mEditorDialog );
1086 1092
1087 } else 1093 } else
1088 return; 1094 return;
1089 1095
1090 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1096 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1091 1097
1092 1098
1093} 1099}
1094 1100
1095void KABCore::addEmail( QString aStr ) 1101void KABCore::addEmail( QString aStr )
1096{ 1102{
1097#ifndef KAB_EMBEDDED 1103#ifndef KAB_EMBEDDED
1098 QString fullName, email; 1104 QString fullName, email;
1099 1105
1100 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1106 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1101 1107
1102 // Try to lookup the addressee matching the email address 1108 // Try to lookup the addressee matching the email address
1103 bool found = false; 1109 bool found = false;
1104 QStringList emailList; 1110 QStringList emailList;
1105 KABC::AddressBook::Iterator it; 1111 KABC::AddressBook::Iterator it;
1106 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1112 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1107 emailList = (*it).emails(); 1113 emailList = (*it).emails();
1108 if ( emailList.contains( email ) > 0 ) { 1114 if ( emailList.contains( email ) > 0 ) {
1109 found = true; 1115 found = true;
1110 (*it).setNameFromString( fullName ); 1116 (*it).setNameFromString( fullName );
1111 editContact( (*it).uid() ); 1117 editContact( (*it).uid() );
1112 } 1118 }
1113 } 1119 }
1114 1120
1115 if ( !found ) { 1121 if ( !found ) {
1116 KABC::Addressee addr; 1122 KABC::Addressee addr;
1117 addr.setNameFromString( fullName ); 1123 addr.setNameFromString( fullName );
1118 addr.insertEmail( email, true ); 1124 addr.insertEmail( email, true );
1119 1125
1120 mAddressBook->insertAddressee( addr ); 1126 mAddressBook->insertAddressee( addr );
1121 mViewManager->refreshView( addr.uid() ); 1127 mViewManager->refreshView( addr.uid() );
1122 editContact( addr.uid() ); 1128 editContact( addr.uid() );
1123 } 1129 }
1124#else //KAB_EMBEDDED 1130#else //KAB_EMBEDDED
1125 qDebug("KABCore::addEmail finsih method"); 1131 qDebug("KABCore::addEmail finsih method");
1126#endif //KAB_EMBEDDED 1132#endif //KAB_EMBEDDED
1127} 1133}
1128 1134
1129void KABCore::importVCard( const KURL &url, bool showPreview ) 1135void KABCore::importVCard( const KURL &url, bool showPreview )
1130{ 1136{
1131 mXXPortManager->importVCard( url, showPreview ); 1137 mXXPortManager->importVCard( url, showPreview );
1132} 1138}
1133void KABCore::importFromOL() 1139void KABCore::importFromOL()
1134{ 1140{
1135#ifdef _WIN32_ 1141#ifdef _WIN32_
1136 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1142 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1137 idgl->exec(); 1143 idgl->exec();
1138 KABC::Addressee::List list = idgl->getAddressList(); 1144 KABC::Addressee::List list = idgl->getAddressList();
1139 if ( list.count() > 0 ) { 1145 if ( list.count() > 0 ) {
1140 KABC::Addressee::List listNew; 1146 KABC::Addressee::List listNew;
1141 KABC::Addressee::List listExisting; 1147 KABC::Addressee::List listExisting;
1142 KABC::Addressee::List::Iterator it; 1148 KABC::Addressee::List::Iterator it;
1143 KABC::AddressBook::Iterator iter; 1149 KABC::AddressBook::Iterator iter;
1144 for ( it = list.begin(); it != list.end(); ++it ) { 1150 for ( it = list.begin(); it != list.end(); ++it ) {
1145 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1151 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1146 listNew.append( (*it) ); 1152 listNew.append( (*it) );
1147 else 1153 else
1148 listExisting.append( (*it) ); 1154 listExisting.append( (*it) );
1149 } 1155 }
1150 if ( listExisting.count() > 0 ) 1156 if ( listExisting.count() > 0 )
1151 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1157 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1152 if ( listNew.count() > 0 ) { 1158 if ( listNew.count() > 0 ) {
1153 pasteWithNewUid = false; 1159 pasteWithNewUid = false;
1154 pasteContacts( listNew ); 1160 pasteContacts( listNew );
1155 pasteWithNewUid = true; 1161 pasteWithNewUid = true;
1156 } 1162 }
1157 } 1163 }
1158 delete idgl; 1164 delete idgl;
1159#endif 1165#endif
1160} 1166}
1161 1167
1162void KABCore::importVCard( const QString &vCard, bool showPreview ) 1168void KABCore::importVCard( const QString &vCard, bool showPreview )
1163{ 1169{
1164 mXXPortManager->importVCard( vCard, showPreview ); 1170 mXXPortManager->importVCard( vCard, showPreview );
1165} 1171}
1166 1172
1167//US added a second method without defaultparameter 1173//US added a second method without defaultparameter
1168void KABCore::editContact2() { 1174void KABCore::editContact2() {
1169 editContact( QString::null ); 1175 editContact( QString::null );
1170} 1176}
1171 1177
1172void KABCore::editContact( const QString &uid ) 1178void KABCore::editContact( const QString &uid )
1173{ 1179{
1174 1180
1175 if ( mExtensionManager->isQuickEditVisible() ) 1181 if ( mExtensionManager->isQuickEditVisible() )
1176 return; 1182 return;
1177 1183
1178 // First, locate the contact entry 1184 // First, locate the contact entry
1179 QString localUID = uid; 1185 QString localUID = uid;
1180 if ( localUID.isNull() ) { 1186 if ( localUID.isNull() ) {
1181 QStringList uidList = mViewManager->selectedUids(); 1187 QStringList uidList = mViewManager->selectedUids();
1182 if ( uidList.count() > 0 ) 1188 if ( uidList.count() > 0 )
1183 localUID = *( uidList.at( 0 ) ); 1189 localUID = *( uidList.at( 0 ) );
1184 } 1190 }
1185 1191
1186 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1192 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1187 if ( !addr.isEmpty() ) { 1193 if ( !addr.isEmpty() ) {
1188 mEditorDialog->setAddressee( addr ); 1194 mEditorDialog->setAddressee( addr );
1189 KApplication::execDialog ( mEditorDialog ); 1195 KApplication::execDialog ( mEditorDialog );
1190 } 1196 }
1191} 1197}
1192 1198
1193/** 1199/**
1194 Shows or edits the detail view for the given uid. If the uid is QString::null, 1200 Shows or edits the detail view for the given uid. If the uid is QString::null,
1195 the method will try to find a selected addressee in the view. 1201 the method will try to find a selected addressee in the view.
1196 */ 1202 */
1197void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1203void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1198{ 1204{
1199 if ( mMultipleViewsAtOnce ) 1205 if ( mMultipleViewsAtOnce )
1200 { 1206 {
1201 editContact( uid ); 1207 editContact( uid );
1202 } 1208 }
1203 else 1209 else
1204 { 1210 {
1205 setDetailsVisible( true ); 1211 setDetailsVisible( true );
1206 mActionDetails->setChecked(true); 1212 mActionDetails->setChecked(true);
1207 } 1213 }
1208 1214
1209} 1215}
1210 1216
1211void KABCore::save() 1217void KABCore::save()
1212{ 1218{
1213 if (syncManager->blockSave()) 1219 if (syncManager->blockSave())
1214 return; 1220 return;
1215 if ( !mModified ) 1221 if ( !mModified )
1216 return; 1222 return;
1217 1223
1218 syncManager->setBlockSave(true); 1224 syncManager->setBlockSave(true);
1219 QString text = i18n( "There was an error while attempting to save\n the " 1225 QString text = i18n( "There was an error while attempting to save\n the "
1220 "address book. Please check that some \nother application is " 1226 "address book. Please check that some \nother application is "
1221 "not using it. " ); 1227 "not using it. " );
1222 statusMessage(i18n("Saving addressbook ... ")); 1228 statusMessage(i18n("Saving addressbook ... "));
1223#ifndef KAB_EMBEDDED 1229#ifndef KAB_EMBEDDED
1224 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1230 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1225 if ( !b || !b->save() ) { 1231 if ( !b || !b->save() ) {
1226 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1232 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1227 } 1233 }
1228#else //KAB_EMBEDDED 1234#else //KAB_EMBEDDED
1229 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1235 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1230 if ( !b || !b->save() ) { 1236 if ( !b || !b->save() ) {
1231 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1237 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1232 } 1238 }
1233#endif //KAB_EMBEDDED 1239#endif //KAB_EMBEDDED
1234 1240
1235 statusMessage(i18n("Addressbook saved!")); 1241 statusMessage(i18n("Addressbook saved!"));
1236 setModified( false ); 1242 setModified( false );
1237 syncManager->setBlockSave(false); 1243 syncManager->setBlockSave(false);
1238} 1244}
1239 1245
1240void KABCore::statusMessage(QString mess , int time ) 1246void KABCore::statusMessage(QString mess , int time )
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
35void PhoneAccess::writeConfig( QString device, QString connection, QString model ) 35void 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
136bool PhoneAccess::writeToPhone( QString fileName) 130bool 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}