summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-28 12:14:23 (UTC)
committer zautrix <zautrix>2004-10-28 12:14:23 (UTC)
commit2a5dfaf6f91534043ab9baa172b077c5ccef63ae (patch) (unidiff)
treead8a5a7dfb9c67707d255d97a063e006958b6796
parentaf21c3d45173ece8492850b8c2c5019e7c25d59c (diff)
downloadkdepimpi-2a5dfaf6f91534043ab9baa172b077c5ccef63ae.zip
kdepimpi-2a5dfaf6f91534043ab9baa172b077c5ccef63ae.tar.gz
kdepimpi-2a5dfaf6f91534043ab9baa172b077c5ccef63ae.tar.bz2
compile fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--kaddressbook/kabcore.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 41b3e45..c61a322 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,516 +1,520 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 1.9.11 ************ 3********** VERSION 1.9.11 ************
4 4
5Fixed several problems in PWM/Pi, like 5Fixed several problems in PWM/Pi, like
6asking the user, if unsaved changed are pending 6asking the user, if unsaved changed are pending
7when closing the app. 7when closing the app.
8 8
9Fixed a crash in KO/Pi , when importing/loading vcs files 9Fixed a crash in KO/Pi , when importing/loading vcs files
10which have an entry with an attendee with state: 10which have an entry with an attendee with state:
11NEEDS ACTION 11NEEDS ACTION
12 12
13Fixed some problems in the German translation of OM/Pi, 13Fixed some problems in the German translation of OM/Pi,
14which makes some dialogs not fitting on the screen 14which makes some dialogs not fitting on the screen
15of the Z 5500. 15of the Z 5500.
16 16
17Fixed Qtopia crash, when disabling/deinstalling 17Fixed Qtopia crash, when disabling/deinstalling
18KO/Pi alarm applet. 18KO/Pi alarm applet.
19 19
20Implemented direct KDE<->KA/Pi sync for KA/Pi running 20Implemented direct KDE<->KA/Pi sync for KA/Pi running
21on Linux desktop. 21on Linux desktop.
22 22
23Added "remove sync info" to sync menu. 23Added "remove sync info" to sync menu.
24 24
25Tweaked the KO/Pi What's next view a bit, added 25Tweaked the KO/Pi What's next view a bit, added
26setting to hide events that are done. 26setting to hide events that are done.
27 27
28Disabled "beam receive enabled" on startup to 28Disabled "beam receive enabled" on startup to
29avoid problems if Fastload is enabled. 29avoid problems if Fastload is enabled.
30Please set "beam receive enabled", 30Please set "beam receive enabled",
31if you want to receive data via IR. 31if you want to receive data via IR.
32 32
33Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 33Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
34on Linux desktop. 34on Linux desktop.
35 35
36Made in KA/Pi scrolling possible, if details view is selected. 36Made in KA/Pi scrolling possible, if details view is selected.
37(The keyboard focus is set automatically to the search line)
38
39Fixed a bug in DMT sync, that a new entry in DTM was added
40on every sync to Kx/Pi.
37 41
38 42
39 43
40 44
41********** VERSION 1.9.10 ************ 45********** VERSION 1.9.10 ************
42 46
43Many internal small bugfixes. 47Many internal small bugfixes.
44And fix of the "big" bug in KO/Pi, 48And fix of the "big" bug in KO/Pi,
45that after Syncing the appointments had an offset by several hours. 49that after Syncing the appointments had an offset by several hours.
46That was a problem with the internal timezone setting, 50That was a problem with the internal timezone setting,
47introduced by the changed timezone configuration settings. 51introduced by the changed timezone configuration settings.
48 52
49German translation for OM/Pi is now available. 53German translation for OM/Pi is now available.
50 54
51 55
52********** VERSION 1.9.9 ************ 56********** VERSION 1.9.9 ************
53 57
54KDE-Pim/Pi has a new Member! 58KDE-Pim/Pi has a new Member!
55It is called PWM/Pi (Passwordmanager/platform-independent) 59It is called PWM/Pi (Passwordmanager/platform-independent)
56and it is available for the Zaurus. 60and it is available for the Zaurus.
57It is planned, that it will be available later for Windows. 61It is planned, that it will be available later for Windows.
58(And for Linux, of course). 62(And for Linux, of course).
59It is a port of the Passwordmanager of KDE. 63It is a port of the Passwordmanager of KDE.
60It will need the MicroKDElibs to run. 64It will need the MicroKDElibs to run.
61 65
62Made loading of addressbooks in KA/Pi up to 7 times faster! 66Made loading of addressbooks in KA/Pi up to 7 times faster!
63The bigger your addressbook file, the more starting speed 67The bigger your addressbook file, the more starting speed
64will you gain. (relatively) 68will you gain. (relatively)
65 69
66The Qtopia addressbook connector is now platform independend 70The Qtopia addressbook connector is now platform independend
67as well and should work on any platform for importing/exporting 71as well and should work on any platform for importing/exporting
68Qtopia and Opie XML files. 72Qtopia and Opie XML files.
69 73
70Added a +30min feature to the timezone settings to make 74Added a +30min feature to the timezone settings to make
71KDE-Pim/Pi useable in Australia and other parts on the 75KDE-Pim/Pi useable in Australia and other parts on the
72world with strange timezones ;-) 76world with strange timezones ;-)
73 77
74German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 78German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
75 79
76It is now possible to disable the 80It is now possible to disable the
77"receive data via infrared" feature, such that syncing with 81"receive data via infrared" feature, such that syncing with
78Outlook is now possible again with Kx/Pi runing. 82Outlook is now possible again with Kx/Pi runing.
79Please disable it, before syncing Sharp DTM with Outlook. 83Please disable it, before syncing Sharp DTM with Outlook.
80For your convenience, the "receive data via infrared" feature 84For your convenience, the "receive data via infrared" feature
81is disabled automatically, if you sync Kx/Pi with DTM. 85is disabled automatically, if you sync Kx/Pi with DTM.
82You have to enable it again manually after syncing. 86You have to enable it again manually after syncing.
83Enabling this feature makes it impossible to start the 87Enabling this feature makes it impossible to start the
84Sharp DTM apps. If this feature is enabled, you will only get the 88Sharp DTM apps. If this feature is enabled, you will only get the
85alarm notification from KO/Pi and not from the Sharp calendar. 89alarm notification from KO/Pi and not from the Sharp calendar.
86This is very useful if you sync KO/Pi with Sharp DTM, 90This is very useful if you sync KO/Pi with Sharp DTM,
87because after syncing you usually would get notified about 91because after syncing you usually would get notified about
88an alarm by KO/Pi and the Sharp Calendar. 92an alarm by KO/Pi and the Sharp Calendar.
89 93
90Together with the Linux desktop version of KO/Pi 94Together with the Linux desktop version of KO/Pi
91it is now possible to sync KO/Pi on the Zaurus 95it is now possible to sync KO/Pi on the Zaurus
92with the complete KDE-desktop (3.3 or later) 96with the complete KDE-desktop (3.3 or later)
93calendar data easily. 97calendar data easily.
94That makes it possible to sync the Z with one 98That makes it possible to sync the Z with one
95click of a mouse with the KDE-Desktop. 99click of a mouse with the KDE-Desktop.
96This feature it available for all Zaurus platforms KO/Pi 100This feature it available for all Zaurus platforms KO/Pi
97is running on. 101is running on.
98The only thing needed is a running KO/Pi on Linux and 102The only thing needed is a running KO/Pi on Linux and
99a compiled version of the small 103a compiled version of the small
100KDE-Pim/Pi<->KDE-Desktop access command line program, 104KDE-Pim/Pi<->KDE-Desktop access command line program,
101which is in the KDE-Pim/Pi sources available. 105which is in the KDE-Pim/Pi sources available.
102 106
103The "KDE-desktop" syncing feature for KA/Pi will follow 107The "KDE-desktop" syncing feature for KA/Pi will follow
104in the next releases. 108in the next releases.
105 109
106Fixed the vcard export bug, which had the version 1.9.8. 110Fixed the vcard export bug, which had the version 1.9.8.
107 111
108Added missing GERMAN translation to KO/Pi. 112Added missing GERMAN translation to KO/Pi.
109Hi PsionX, could you add the missing french translation?Thx! 113Hi PsionX, could you add the missing french translation?Thx!
110 114
111Translation files for KA/Pi are available as well. 115Translation files for KA/Pi are available as well.
112GERMAN translation will be available in the next release. 116GERMAN translation will be available in the next release.
113PsionX ( yres, you again ;-) ), could you start translating 117PsionX ( yres, you again ;-) ), could you start translating
114KA/Pi? Thx! 118KA/Pi? Thx!
115 119
116You can download the version 1.9.9 at 120You can download the version 1.9.9 at
117 121
118http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 122http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
119 123
120Note: 124Note:
121To run the mail program OM/Pi you need libopenssl. 125To run the mail program OM/Pi you need libopenssl.
122A link to a download loaction is available at 126A link to a download loaction is available at
123ZSI at www.killefiz.de 127ZSI at www.killefiz.de
124 128
125 129
126********** VERSION 1.9.8 ************ 130********** VERSION 1.9.8 ************
127 131
128Fixed character decoding in OM/Pi. 132Fixed character decoding in OM/Pi.
129(e.g. German "Umlaute" were not displayed properly.) 133(e.g. German "Umlaute" were not displayed properly.)
130 134
131Made is possible to reparent todos in KO/Pi. 135Made is possible to reparent todos in KO/Pi.
132Use contextmenu or keys (look at Help-Keys + Colors) for that. 136Use contextmenu or keys (look at Help-Keys + Colors) for that.
133 137
134Added the missing Sync-Howto and WhatsNew to the packages. 138Added the missing Sync-Howto and WhatsNew to the packages.
135 139
136KO/Pi on Linux desktop can now sync with KDE desktop. 140KO/Pi on Linux desktop can now sync with KDE desktop.
137That means: When using KO/Pi on Linux desktop for syncing with 141That means: When using KO/Pi on Linux desktop for syncing with
138KDE desktop and the Zaurus, the Zaurus can be synced now 142KDE desktop and the Zaurus, the Zaurus can be synced now
139with all KDE-Calendar resources, not only with one local file. 143with all KDE-Calendar resources, not only with one local file.
140(That makes it possible to sync the Zaurus with the 144(That makes it possible to sync the Zaurus with the
141calendar data on a Kolab server) 145calendar data on a Kolab server)
142 146
143KA/Pi syncing with KDE desktop will be available in the next version. 147KA/Pi syncing with KDE desktop will be available in the next version.
144 148
145 149
146********** VERSION 1.9.7 ************ 150********** VERSION 1.9.7 ************
147 151
148KO/Pi - KA/Pi on Windows: 152KO/Pi - KA/Pi on Windows:
149Now a directory can be defined by the user, where the 153Now a directory can be defined by the user, where the
150application/config data should be saved. 154application/config data should be saved.
151 Define your desired path in the evironment variable 155 Define your desired path in the evironment variable
152 MICROKDEHOME 156 MICROKDEHOME
153 before starting KO/Pi or KA/Pi. 157 before starting KO/Pi or KA/Pi.
154 158
155An easy Kx/Pi to Kx/Pi syncing is now possible 159An easy Kx/Pi to Kx/Pi syncing is now possible
156(it is called Pi-Sync) via network. 160(it is called Pi-Sync) via network.
157Please look at the Sync Howto. 161Please look at the Sync Howto.
158 162
159Exporting of calendar data and contacts to mobile phones is now possible. 163Exporting of calendar data and contacts to mobile phones is now possible.
160The SyncHowto is updated with information howto 164The SyncHowto is updated with information howto
161access/sync mobile phones. 165access/sync mobile phones.
162Please look at the Sync Howto. 166Please look at the Sync Howto.
163 167
164Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. 168Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
165Please disable Fastload for the original contact/calendar applications 169Please disable Fastload for the original contact/calendar applications
166and close them. 170and close them.
167KO/Pi and KA/Pi must be running in order to receive the data. 171KO/Pi and KA/Pi must be running in order to receive the data.
168(KO/Pi and KA/Pi are always running if Fastload for them is enabled!) 172(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
169 173
170In the KA/Pi details view are now the preferred tel. numbers displayed on top 174In the KA/Pi details view are now the preferred tel. numbers displayed on top
171of the other data ( emails/tel.numbers/addresses) 175of the other data ( emails/tel.numbers/addresses)
172 176
173Fixed some syncing problems in KA/Pi. 177Fixed some syncing problems in KA/Pi.
174 178
175Added font settings for the KA/Pi details view. 179Added font settings for the KA/Pi details view.
176Added fields "children's name" and "gender" to KA/Pi. 180Added fields "children's name" and "gender" to KA/Pi.
177 181
178Made searching in KA/Pi better: 182Made searching in KA/Pi better:
179Now the first item in a view is selected after a search automatically and 183Now the first item in a view is selected after a search automatically and
180the views can be scrolled up/down when the search input field has the keyboard focus. 184the views can be scrolled up/down when the search input field has the keyboard focus.
181 185
182And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. 186And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi.
183 187
184 188
185********** VERSION 1.9.6 ************ 189********** VERSION 1.9.6 ************
186 190
187Changes in the external application communication on the Zaurus 191Changes in the external application communication on the Zaurus
188in order to use less RAM when the apps are running. 192in order to use less RAM when the apps are running.
189First syncing of addressbooks (KA/Pi) is possible. 193First syncing of addressbooks (KA/Pi) is possible.
190 194
191 195
192********** VERSION 1.9.5a ************ 196********** VERSION 1.9.5a ************
193 197
194Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. 198Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5.
195Fixed some small bugs. 199Fixed some small bugs.
196KA/Pi shows now the birthday in summary view. 200KA/Pi shows now the birthday in summary view.
197Now OM/Pi and KA/Pi are using the date format defined in KO/Pi 201Now OM/Pi and KA/Pi are using the date format defined in KO/Pi
198for displaying dates. 202for displaying dates.
199 203
200 204
201********** VERSION 1.9.5 ************ 205********** VERSION 1.9.5 ************
202 206
203There is still no Addressbook syncing! 207There is still no Addressbook syncing!
204 208
205New in 1.9.5: 209New in 1.9.5:
206 210
207Many bugfixes. 211Many bugfixes.
208Better searching in KA/Pi. 212Better searching in KA/Pi.
209You can configure in KA/Pi if you want to search only after 213You can configure in KA/Pi if you want to search only after
210<return> key pressed. 214<return> key pressed.
211 215
212Better mail downloading in OM/Pi. 216Better mail downloading in OM/Pi.
213 217
214First experimental alpha version of sync of KO/Pi with mobile phones. 218First experimental alpha version of sync of KO/Pi with mobile phones.
215See gammu documentation for supported phones. 219See gammu documentation for supported phones.
216You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. 220You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp.
217Quick hint how to use: 221Quick hint how to use:
218NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! 222NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL!
219Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. 223Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp.
220Create syncprofile - mobile device 224Create syncprofile - mobile device
221Remove entry for model. (Leave empty ). 225Remove entry for model. (Leave empty ).
222Enable infrared on Zaurus and your Phone. 226Enable infrared on Zaurus and your Phone.
223Sync. 227Sync.
224To get a more detailed log, start kopi from konsole. 228To get a more detailed log, start kopi from konsole.
225 229
226********** VERSION 1.9.4 ************ 230********** VERSION 1.9.4 ************
227 231
228This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. 232This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus.
229 233
230WARNING: 234WARNING:
231PLEASE BACKUP ALL YOUR DATA! 235PLEASE BACKUP ALL YOUR DATA!
232We have changed a lot and maybe there are some unknown problems. 236We have changed a lot and maybe there are some unknown problems.
233 237
234SYNC HANDLING HAS CHANGED! 238SYNC HANDLING HAS CHANGED!
235Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 239Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
236(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 240(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
237 241
238You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. 242You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs.
239If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. 243If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well.
240 244
241As programs are available: 245As programs are available:
242KO/Pi (korganizer ipk) - a calendar program. 246KO/Pi (korganizer ipk) - a calendar program.
243KA/Pi (kaddressbook ipk ) - an addressbook 247KA/Pi (kaddressbook ipk ) - an addressbook
244OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. 248OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support.
245 249
246An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. 250An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode.
247(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) 251(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia)
248 252
249All the applications are installed in a "Pim" TAB. 253All the applications are installed in a "Pim" TAB.
250If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk 254If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk
251 255
252All the application are integrated. 256All the application are integrated.
253Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. 257Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail.
254 258
255HINT: 259HINT:
256If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. 260If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number.
257 261
258What's new? 262What's new?
259 263
260SYNC HANDLING HAS CHANGED! 264SYNC HANDLING HAS CHANGED!
261Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 265Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
262(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 266(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
263 267
264New in OM/Pi: 268New in OM/Pi:
265When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. 269When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails.
266 270
267New in KO/Pi: 271New in KO/Pi:
268French is now available for KO/Pi. 272French is now available for KO/Pi.
269Choose menu:Actions - Configure:TAB locale 273Choose menu:Actions - Configure:TAB locale
270Syncing has changed. 274Syncing has changed.
271Phone sync available soon. 275Phone sync available soon.
272Not much changes, I cannot remember them ... 276Not much changes, I cannot remember them ...
273 277
274New in KA/Pi: 278New in KA/Pi:
275Beaming possible. 279Beaming possible.
276Sharp DTM readonly access possible( create a new DTM resource ); 280Sharp DTM readonly access possible( create a new DTM resource );
277Better searching possible. 281Better searching possible.
278Search is performed only after pressing the return key. 282Search is performed only after pressing the return key.
279Use wildcard * to specify parts of a name. 283Use wildcard * to specify parts of a name.
280 284
281Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . 285Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * .
282 286
283A big improvement is the new management of the contact access. 287A big improvement is the new management of the contact access.
284In version 1.9.3, every application was using their own addressbook access data. 288In version 1.9.3, every application was using their own addressbook access data.
285That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. 289That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi.
286That was wasting of memory, if you had several hundreds of contacts. 290That was wasting of memory, if you had several hundreds of contacts.
287 291
288Now only KA/Pi accesses the addressbook. 292Now only KA/Pi accesses the addressbook.
289If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. 293If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them.
290If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. 294If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly.
291That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. 295That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first.
292 296
293New in the KO/Pi alarm applet: 297New in the KO/Pi alarm applet:
294Configure your own timer popup menu! 298Configure your own timer popup menu!
295(Text and minutes for timer countdown) 299(Text and minutes for timer countdown)
296Just edit the file 300Just edit the file
297(yourhomedir)/.kopialarmtimerrc 301(yourhomedir)/.kopialarmtimerrc
298and start/stop a timer to get a new menu with the data of this file. 302and start/stop a timer to get a new menu with the data of this file.
299 303
300********** VERSION 1.9.3 ************ 304********** VERSION 1.9.3 ************
3011) 3051)
302Now KO/Pi on Windows imports directly the calendar data of 306Now KO/Pi on Windows imports directly the calendar data of
303an installed Outlook. Should work with OL version >= 2000. 307an installed Outlook. Should work with OL version >= 2000.
304 308
305********** VERSION 1.9.2 ************ 309********** VERSION 1.9.2 ************
3061) 3101)
307KDE-Pim/Pi has got a new member: 311KDE-Pim/Pi has got a new member:
308KmicroMail (KM/Pi) is a mail program, 312KmicroMail (KM/Pi) is a mail program,
309which can handle IMAP and POP mail access. 313which can handle IMAP and POP mail access.
310It is based on Opie-Mail v3. 314It is based on Opie-Mail v3.
311All dependencies to the Opie libraries ar removed, 315All dependencies to the Opie libraries ar removed,
312such that no additional Opie lib is needed. 316such that no additional Opie lib is needed.
313It is already integrated in KO/Pi and KA/Pi. 317It is already integrated in KO/Pi and KA/Pi.
314It it now available for the Zaurus,probably it 318It it now available for the Zaurus,probably it
315will be available for other platforms later. 319will be available for other platforms later.
316Hint: 320Hint:
317Create your own contact (name + email) 321Create your own contact (name + email)
318in KA/Pi, select this contact and choose menu: 322in KA/Pi, select this contact and choose menu:
319Settings - Set Who Am I. 323Settings - Set Who Am I.
320Now the settings of this contact are used as 324Now the settings of this contact are used as
321the sender data in KM/Pi. 325the sender data in KM/Pi.
3222) 3262)
323KDE-Pim/Pi is split up in five different 327KDE-Pim/Pi is split up in five different
324packages now precompiled for Sharp Zaurus: 328packages now precompiled for Sharp Zaurus:
325--kmicrokdelibs_1.9.2_arm.ipk 329--kmicrokdelibs_1.9.2_arm.ipk
326The libs are needed for any 330The libs are needed for any
327of the following programs: 331of the following programs:
328--kaddressbook_1.9.2_arm.ipk 332--kaddressbook_1.9.2_arm.ipk
329--kmicromail_1.9.2_arm.ipk 333--kmicromail_1.9.2_arm.ipk
330--korganizer_1.9.2_arm.ipk 334--korganizer_1.9.2_arm.ipk
331Independ from that, there is the alarm applet 335Independ from that, there is the alarm applet
332available for KO/Pi, which also offers 336available for KO/Pi, which also offers
333quick access for a new mail or 337quick access for a new mail or
334showing the addressbook.: 338showing the addressbook.:
335--korganizer-alarm_1.9.2_arm.ipk 339--korganizer-alarm_1.9.2_arm.ipk
336Independend means, that the alarm applet 340Independend means, that the alarm applet
337does not need any of the libs or programs above to run. 341does not need any of the libs or programs above to run.
338But it would be quite useless without these programs. 342But it would be quite useless without these programs.
339NOTE: 343NOTE:
340If you get a 344If you get a
341"This application depends on other programs" 345"This application depends on other programs"
342during installation of 346during installation of
343--kmicrokdelibs_1.9.2_arm.ipk 347--kmicrokdelibs_1.9.2_arm.ipk
344you probably do not have to care about that. 348you probably do not have to care about that.
345kmicrokdelibs_1.9.2 will come with some 349kmicrokdelibs_1.9.2 will come with some
346resource plugins, which needs additional libraries. 350resource plugins, which needs additional libraries.
347(E.g. libopie1, if you want to use the 351(E.g. libopie1, if you want to use the
348opie resource connector in KA/Pi). 352opie resource connector in KA/Pi).
349If you do not have this libraries installed, 353If you do not have this libraries installed,
350you simply cannot use the resource. 354you simply cannot use the resource.
351To make it clear: 355To make it clear:
352If the libraries are missing, the applications 356If the libraries are missing, the applications
353using kmicrokdelibs will start, 357using kmicrokdelibs will start,
354because the resources are plugins. 358because the resources are plugins.
3553) 3593)
356KO/Pi and friends are now installable on SD-Card! 360KO/Pi and friends are now installable on SD-Card!
357It is recommended to install all libs and apps 361It is recommended to install all libs and apps
358on the SD card or all in the internal storage. 362on the SD card or all in the internal storage.
359There may be problems, if this is mixed. 363There may be problems, if this is mixed.
3604) 3644)
361Fixed two bugs in the alarm notification on Windows. 365Fixed two bugs in the alarm notification on Windows.
3625) 3665)
363Great improvement! 367Great improvement!
364KO/Pi uses now the latest version of libical. 368KO/Pi uses now the latest version of libical.
365Libical is the library which actually reads 369Libical is the library which actually reads
366the calendar files and extract the data from it. 370the calendar files and extract the data from it.
367With the old version, there were problems 371With the old version, there were problems
368(crashes or program hangs) when licical did read 372(crashes or program hangs) when licical did read
369files, which were not stored from KO/Pi. 373files, which were not stored from KO/Pi.
370I do not know, if the new libical works perfect, 374I do not know, if the new libical works perfect,
371but actually it works much better than 375but actually it works much better than
372the old version. 376the old version.
373There are no problems with compatibility with 377There are no problems with compatibility with
374old calendar files of KO/Pi, of course! 378old calendar files of KO/Pi, of course!
3756) 3796)
376New in KA/Pi: 380New in KA/Pi:
377Opie addressbook resource connector available! 381Opie addressbook resource connector available!
378You will need libopie1 and the opie addressbook, 382You will need libopie1 and the opie addressbook,
379of course. 383of course.
380With the Opie addressbook resource connector, 384With the Opie addressbook resource connector,
381you can access the Opie addressbook readonly in KA/Pi. 385you can access the Opie addressbook readonly in KA/Pi.
382If you want to edit or import the data into KA/Pi, 386If you want to edit or import the data into KA/Pi,
383do this: 387do this:
384a) Create an Opie resource. 388a) Create an Opie resource.
385 (Menu: Settings-Configure Resources). 389 (Menu: Settings-Configure Resources).
386After configuration and restarting KA/Pi you should see 390After configuration and restarting KA/Pi you should see
387the Opie contacts in KA/Pi. 391the Opie contacts in KA/Pi.
388b) Select some or all Opie contacts. 392b) Select some or all Opie contacts.
389(NOTE: +++++ 393(NOTE: +++++
390To know exactly, what contacts are Opie contacts, 394To know exactly, what contacts are Opie contacts,
391do this: Choose menu: 395do this: Choose menu:
392View-Modify View - TAB Fields. 396View-Modify View - TAB Fields.
393Select in the above list "Resource" and click 397Select in the above list "Resource" and click
394down arrow to add it to the "Selected fields". 398down arrow to add it to the "Selected fields".
395Click OK. 399Click OK.
396Now you have a new column "Resource" in your list, 400Now you have a new column "Resource" in your list,
397where you can see, what an Opie resource is. 401where you can see, what an Opie resource is.
398++++ NOTE end.) 402++++ NOTE end.)
399Ok, we do have now some Opie contacts seleted. 403Ok, we do have now some Opie contacts seleted.
400(Use SHIFT or CTRL key in order to multiple select). 404(Use SHIFT or CTRL key in order to multiple select).
401c) Choose menu: Edit-Copy. 405c) Choose menu: Edit-Copy.
402d) Choose menu: Edit-Paste. 406d) Choose menu: Edit-Paste.
403e) Select the resource, you want to add the contacts to. 407e) Select the resource, you want to add the contacts to.
404Congrats! Now you have read/write access to the copied 408Congrats! Now you have read/write access to the copied
405opie contacts as "real" KA/Pi contacts. 409opie contacts as "real" KA/Pi contacts.
406 410
407 411
408********** VERSION 1.9.1 ************ 412********** VERSION 1.9.1 ************
4091) 4131)
410 +++ IMPORTANT 1 +++ 414 +++ IMPORTANT 1 +++
411 415
412The storing place of the default calendar 416The storing place of the default calendar
413file has changed! 417file has changed!
414The default calendar file was 418The default calendar file was
415Applications/korganizer/mycalendar.ics 419Applications/korganizer/mycalendar.ics
416on Zaurus and 420on Zaurus and
417(yourHomeDir)/korganizer/mycalendar.ics 421(yourHomeDir)/korganizer/mycalendar.ics
418on Windows/Linux desktop. Now it is 422on Windows/Linux desktop. Now it is
419(yourHomeDir)/kdepim/korganizer/mycalendar.ics 423(yourHomeDir)/kdepim/korganizer/mycalendar.ics
420on Zaurus, Windows and Linux. 424on Zaurus, Windows and Linux.
421To load the old file, choose menu 425To load the old file, choose menu
422File-Load calendar backup. 426File-Load calendar backup.
423(It should be loaded automatically 427(It should be loaded automatically
424at startup with a warning message displayed). 428at startup with a warning message displayed).
425The place of the configuration file has changed too. 429The place of the configuration file has changed too.
426If you want to use your old KO/Pi config, 430If you want to use your old KO/Pi config,
427copy it to 431copy it to
428(yourHomeDir)/kdepim/config/korganizerrc 432(yourHomeDir)/kdepim/config/korganizerrc
429Please read VERSION 1.9.0 - topic 3) as well! 433Please read VERSION 1.9.0 - topic 3) as well!
430 434
431 +++ IMPORTANT 2 +++ 435 +++ IMPORTANT 2 +++
432 436
433Because of the new paths, you will need 437Because of the new paths, you will need
434a new version of the KO/Pi alarm applet 438a new version of the KO/Pi alarm applet
435for Zaurus. 439for Zaurus.
436Use version >= 1.9.1 440Use version >= 1.9.1
437 441
4382) 4422)
439Now the QWhat'sThis Icon works for items 443Now the QWhat'sThis Icon works for items
440in the month view as well. 444in the month view as well.
441(See VERSION 1.7.8 Topic 1) ). 445(See VERSION 1.7.8 Topic 1) ).
4423) 4463)
443You can import birtsdays/anniversaries 447You can import birtsdays/anniversaries
444from KA/Pi into KO/Pi. 448from KA/Pi into KO/Pi.
445Choose menu File-Import birthdays. 449Choose menu File-Import birthdays.
446If you import twice, already imported items 450If you import twice, already imported items
447will not be imported again, if they 451will not be imported again, if they
448have not been changed in KO/Pi. 452have not been changed in KO/Pi.
4494) 4534)
450When syncing with sharp DTM, now a progress 454When syncing with sharp DTM, now a progress
451is shown, when the data is written back. 455is shown, when the data is written back.
452If there is much data in KO/Pi and no data 456If there is much data in KO/Pi and no data
453in DTM, that can take a long time. 457in DTM, that can take a long time.
454(But only for the first time ). 458(But only for the first time ).
4555) 4595)
456In the search dialog, you can search 460In the search dialog, you can search
457now for the name/email of an attendee 461now for the name/email of an attendee
458of an event/todo. 462of an event/todo.
459To get more space for displaying 463To get more space for displaying
460search results, the buttons 464search results, the buttons
461for "search" and "close" on the 465for "search" and "close" on the
462bottom are removed in the PDA version. 466bottom are removed in the PDA version.
463You have to click OK in the top right 467You have to click OK in the top right
464corner to do a search. 468corner to do a search.
4656) 4696)
466Now it is possible to disable the displaying 470Now it is possible to disable the displaying
467of todo items in the Allday part of the Agenda. 471of todo items in the Allday part of the Agenda.
468Choose Menu Action-Configure, 472Choose Menu Action-Configure,
469TAB Todo View, checkbox 473TAB Todo View, checkbox
470"Allday Agenda view shows todos" 474"Allday Agenda view shows todos"
4717) 4757)
472If FastLoad is enabled, now the settings and the 476If FastLoad is enabled, now the settings and the
473calendar data are saved, when KO/Pi is closed. 477calendar data are saved, when KO/Pi is closed.
474(If no Fastload is enabled, KO/Pi saves 478(If no Fastload is enabled, KO/Pi saves
475the data as well, of course) 479the data as well, of course)
4768) 4808)
477The Agenda View has a minimize-splitter now, 481The Agenda View has a minimize-splitter now,
478such that the height of the allday part can be 482such that the height of the allday part can be
479changed quickly. 483changed quickly.
480 484
481********** VERSION 1.9.0 ************ 485********** VERSION 1.9.0 ************
4821) 4861)
483KO/Pi is now merged with the new microKDE from KA/Pi. 487KO/Pi is now merged with the new microKDE from KA/Pi.
484KO/Pi accesses now KA/Pi as the addressbook. 488KO/Pi accesses now KA/Pi as the addressbook.
485The other ddressbook-plugins are not working any longer. 489The other ddressbook-plugins are not working any longer.
486(It is planned, that later KA/Pi itself uses these plugins) 490(It is planned, that later KA/Pi itself uses these plugins)
487New versions of KO/Pi are only available 491New versions of KO/Pi are only available
488together with KA/Pi as the KDE-Pim/Pi package. 492together with KA/Pi as the KDE-Pim/Pi package.
4892) 4932)
490If you click on an attendee of a meeting in the 494If you click on an attendee of a meeting in the
491event viewer, a detailed summary of the 495event viewer, a detailed summary of the
492attendee is shown. 496attendee is shown.
4933) 4973)
494The place of the configuration file has changed. 498The place of the configuration file has changed.
495If you want to use your old KO/Pi config, copy 499If you want to use your old KO/Pi config, copy
496Applications/korganizer/config_korganizerrc 500Applications/korganizer/config_korganizerrc
497to 501to
498Applications/korganizer/config/korganizerrc 502Applications/korganizer/config/korganizerrc
499 503
500********** VERSION 1.7.8 ************ 504********** VERSION 1.7.8 ************
5011) 5051)
502Now the QWhat'sThis ist working. 506Now the QWhat'sThis ist working.
503Enable the QWhat'sThis icon in the toolbar. 507Enable the QWhat'sThis icon in the toolbar.
504(You have to restart to reload the changed toolbar config). 508(You have to restart to reload the changed toolbar config).
505Now click on the QWhat'sThis Icon 509Now click on the QWhat'sThis Icon
506in the top right corner of KO/Pi. 510in the top right corner of KO/Pi.
507Then click on an item in the Agenda View: 511Then click on an item in the Agenda View:
508You will get a detailed display of the items content. 512You will get a detailed display of the items content.
5092) 5132)
510Some other very minor changes. 514Some other very minor changes.
511But I have forgotten the details ... 515But I have forgotten the details ...
512For that reason I start this log here: 516For that reason I start this log here:
513To document my changes, when I am doing it. 517To document my changes, when I am doing it.
514 518
515********** VERSION 1.7.7 ************ 519********** VERSION 1.7.7 ************
516Stable Version of KO/Pi \ No newline at end of file 520Stable Version of KO/Pi \ No newline at end of file
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index c75b4bc..9ef97c9 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -690,2290 +690,2290 @@ void KABCore::mailVCard( const QStringList& uids )
690 690
691 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 691 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
692 692
693 QString fileName = dirName + "/" + name; 693 QString fileName = dirName + "/" + name;
694 694
695 QFile outFile(fileName); 695 QFile outFile(fileName);
696 696
697 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 697 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
698 KABC::VCardConverter converter; 698 KABC::VCardConverter converter;
699 QString vcard; 699 QString vcard;
700 700
701 converter.addresseeToVCard( a, vcard ); 701 converter.addresseeToVCard( a, vcard );
702 702
703 QTextStream t( &outFile ); // use a text stream 703 QTextStream t( &outFile ); // use a text stream
704 t.setEncoding( QTextStream::UnicodeUTF8 ); 704 t.setEncoding( QTextStream::UnicodeUTF8 );
705 t << vcard; 705 t << vcard;
706 706
707 outFile.close(); 707 outFile.close();
708 708
709 urls.append( fileName ); 709 urls.append( fileName );
710 } 710 }
711 } 711 }
712 712
713 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 713 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
714 714
715 715
716/*US 716/*US
717 kapp->invokeMailer( QString::null, QString::null, QString::null, 717 kapp->invokeMailer( QString::null, QString::null, QString::null,
718 QString::null, // subject 718 QString::null, // subject
719 QString::null, // body 719 QString::null, // body
720 QString::null, 720 QString::null,
721 urls ); // attachments 721 urls ); // attachments
722*/ 722*/
723 723
724} 724}
725 725
726/** 726/**
727 Beams the "WhoAmI contact. 727 Beams the "WhoAmI contact.
728*/ 728*/
729void KABCore::beamMySelf() 729void KABCore::beamMySelf()
730{ 730{
731 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 731 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
732 if (!a.isEmpty()) 732 if (!a.isEmpty())
733 { 733 {
734 QStringList uids; 734 QStringList uids;
735 uids << a.uid(); 735 uids << a.uid();
736 736
737 beamVCard(uids); 737 beamVCard(uids);
738 } else { 738 } else {
739 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 739 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
740 740
741 741
742 } 742 }
743} 743}
744 744
745void KABCore::export2phone() 745void KABCore::export2phone()
746{ 746{
747 747
748 KAex2phonePrefs ex2phone; 748 KAex2phonePrefs ex2phone;
749 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 749 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
750 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 750 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
751 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 751 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
752 752
753 if ( !ex2phone.exec() ) { 753 if ( !ex2phone.exec() ) {
754 return; 754 return;
755 } 755 }
756 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 756 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
757 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 757 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
758 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 758 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
759 759
760 760
761 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 761 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
762 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 762 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
763 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 763 KPimGlobalPrefs::instance()->mEx2PhoneModel );
764 764
765 QStringList uids = mViewManager->selectedUids(); 765 QStringList uids = mViewManager->selectedUids();
766 if ( uids.isEmpty() ) 766 if ( uids.isEmpty() )
767 return; 767 return;
768 768
769 QString fileName = getPhoneFile(); 769 QString fileName = getPhoneFile();
770 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 770 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
771 return; 771 return;
772 772
773 message(i18n("Exporting to phone...")); 773 message(i18n("Exporting to phone..."));
774 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 774 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
775 775
776} 776}
777QString KABCore::getPhoneFile() 777QString KABCore::getPhoneFile()
778{ 778{
779#ifdef DESKTOP_VERSION 779#ifdef DESKTOP_VERSION
780 return locateLocal("tmp", "phonefile.vcf"); 780 return locateLocal("tmp", "phonefile.vcf");
781#else 781#else
782 return "/tmp/phonefile.vcf"; 782 return "/tmp/phonefile.vcf";
783#endif 783#endif
784 784
785} 785}
786void KABCore::writeToPhone( ) 786void KABCore::writeToPhone( )
787{ 787{
788 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 788 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
789 message(i18n("Export to phone finished!")); 789 message(i18n("Export to phone finished!"));
790 else 790 else
791 qDebug(i18n("Error exporting to phone")); 791 qDebug(i18n("Error exporting to phone"));
792} 792}
793void KABCore::beamVCard() 793void KABCore::beamVCard()
794{ 794{
795 QStringList uids = mViewManager->selectedUids(); 795 QStringList uids = mViewManager->selectedUids();
796 if ( !uids.isEmpty() ) 796 if ( !uids.isEmpty() )
797 beamVCard( uids ); 797 beamVCard( uids );
798} 798}
799 799
800 800
801void KABCore::beamVCard(const QStringList& uids) 801void KABCore::beamVCard(const QStringList& uids)
802{ 802{
803 803
804 // LR: we should use the /tmp dir on the Zaurus, 804 // LR: we should use the /tmp dir on the Zaurus,
805 // because: /tmp = RAM, (HOME)/kdepim = flash memory 805 // because: /tmp = RAM, (HOME)/kdepim = flash memory
806 806
807#ifdef DESKTOP_VERSION 807#ifdef DESKTOP_VERSION
808 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 808 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
809#else 809#else
810 QString fileName = "/tmp/kapibeamfile.vcf"; 810 QString fileName = "/tmp/kapibeamfile.vcf";
811#endif 811#endif
812 812
813 KABC::VCardConverter converter; 813 KABC::VCardConverter converter;
814 QString description; 814 QString description;
815 QString datastream; 815 QString datastream;
816 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 816 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
817 KABC::Addressee a = mAddressBook->findByUid( *it ); 817 KABC::Addressee a = mAddressBook->findByUid( *it );
818 818
819 if ( a.isEmpty() ) 819 if ( a.isEmpty() )
820 continue; 820 continue;
821 821
822 if (description.isEmpty()) 822 if (description.isEmpty())
823 description = a.formattedName(); 823 description = a.formattedName();
824 824
825 QString vcard; 825 QString vcard;
826 converter.addresseeToVCard( a, vcard ); 826 converter.addresseeToVCard( a, vcard );
827 int start = 0; 827 int start = 0;
828 int next; 828 int next;
829 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 829 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
830 int semi = vcard.find(";", next); 830 int semi = vcard.find(";", next);
831 int dopp = vcard.find(":", next); 831 int dopp = vcard.find(":", next);
832 int sep; 832 int sep;
833 if ( semi < dopp && semi >= 0 ) 833 if ( semi < dopp && semi >= 0 )
834 sep = semi ; 834 sep = semi ;
835 else 835 else
836 sep = dopp; 836 sep = dopp;
837 datastream +=vcard.mid( start, next - start); 837 datastream +=vcard.mid( start, next - start);
838 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 838 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
839 start = sep; 839 start = sep;
840 } 840 }
841 datastream += vcard.mid( start,vcard.length() ); 841 datastream += vcard.mid( start,vcard.length() );
842 } 842 }
843#ifndef DESKTOP_VERSION 843#ifndef DESKTOP_VERSION
844 QFile outFile(fileName); 844 QFile outFile(fileName);
845 if ( outFile.open(IO_WriteOnly) ) { 845 if ( outFile.open(IO_WriteOnly) ) {
846 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 846 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
847 QTextStream t( &outFile ); // use a text stream 847 QTextStream t( &outFile ); // use a text stream
848 //t.setEncoding( QTextStream::UnicodeUTF8 ); 848 //t.setEncoding( QTextStream::UnicodeUTF8 );
849 t.setEncoding( QTextStream::Latin1 ); 849 t.setEncoding( QTextStream::Latin1 );
850 t <<datastream.latin1(); 850 t <<datastream.latin1();
851 outFile.close(); 851 outFile.close();
852 Ir *ir = new Ir( this ); 852 Ir *ir = new Ir( this );
853 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 853 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
854 ir->send( fileName, description, "text/x-vCard" ); 854 ir->send( fileName, description, "text/x-vCard" );
855 } else { 855 } else {
856 qDebug("Error open temp beam file "); 856 qDebug("Error open temp beam file ");
857 return; 857 return;
858 } 858 }
859#endif 859#endif
860 860
861} 861}
862 862
863void KABCore::beamDone( Ir *ir ) 863void KABCore::beamDone( Ir *ir )
864{ 864{
865#ifndef DESKTOP_VERSION 865#ifndef DESKTOP_VERSION
866 delete ir; 866 delete ir;
867#endif 867#endif
868 topLevelWidget()->raise(); 868 topLevelWidget()->raise();
869 message( i18n("Beaming finished!") ); 869 message( i18n("Beaming finished!") );
870} 870}
871 871
872 872
873void KABCore::browse( const QString& url ) 873void KABCore::browse( const QString& url )
874{ 874{
875#ifndef KAB_EMBEDDED 875#ifndef KAB_EMBEDDED
876 kapp->invokeBrowser( url ); 876 kapp->invokeBrowser( url );
877#else //KAB_EMBEDDED 877#else //KAB_EMBEDDED
878 qDebug("KABCore::browse must be fixed"); 878 qDebug("KABCore::browse must be fixed");
879#endif //KAB_EMBEDDED 879#endif //KAB_EMBEDDED
880} 880}
881 881
882void KABCore::selectAllContacts() 882void KABCore::selectAllContacts()
883{ 883{
884 mViewManager->setSelected( QString::null, true ); 884 mViewManager->setSelected( QString::null, true );
885} 885}
886 886
887void KABCore::deleteContacts() 887void KABCore::deleteContacts()
888{ 888{
889 QStringList uidList = mViewManager->selectedUids(); 889 QStringList uidList = mViewManager->selectedUids();
890 deleteContacts( uidList ); 890 deleteContacts( uidList );
891} 891}
892 892
893void KABCore::deleteContacts( const QStringList &uids ) 893void KABCore::deleteContacts( const QStringList &uids )
894{ 894{
895 if ( uids.count() > 0 ) { 895 if ( uids.count() > 0 ) {
896 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 896 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
897 UndoStack::instance()->push( command ); 897 UndoStack::instance()->push( command );
898 RedoStack::instance()->clear(); 898 RedoStack::instance()->clear();
899 899
900 // now if we deleted anything, refresh 900 // now if we deleted anything, refresh
901 setContactSelected( QString::null ); 901 setContactSelected( QString::null );
902 setModified( true ); 902 setModified( true );
903 } 903 }
904} 904}
905 905
906void KABCore::copyContacts() 906void KABCore::copyContacts()
907{ 907{
908 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 908 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
909 909
910 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 910 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
911 911
912 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 912 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
913 913
914 QClipboard *cb = QApplication::clipboard(); 914 QClipboard *cb = QApplication::clipboard();
915 cb->setText( clipText ); 915 cb->setText( clipText );
916} 916}
917 917
918void KABCore::cutContacts() 918void KABCore::cutContacts()
919{ 919{
920 QStringList uidList = mViewManager->selectedUids(); 920 QStringList uidList = mViewManager->selectedUids();
921 921
922//US if ( uidList.size() > 0 ) { 922//US if ( uidList.size() > 0 ) {
923 if ( uidList.count() > 0 ) { 923 if ( uidList.count() > 0 ) {
924 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 924 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
925 UndoStack::instance()->push( command ); 925 UndoStack::instance()->push( command );
926 RedoStack::instance()->clear(); 926 RedoStack::instance()->clear();
927 927
928 setModified( true ); 928 setModified( true );
929 } 929 }
930} 930}
931 931
932void KABCore::pasteContacts() 932void KABCore::pasteContacts()
933{ 933{
934 QClipboard *cb = QApplication::clipboard(); 934 QClipboard *cb = QApplication::clipboard();
935 935
936 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 936 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
937 937
938 pasteContacts( list ); 938 pasteContacts( list );
939} 939}
940 940
941void KABCore::pasteContacts( KABC::Addressee::List &list ) 941void KABCore::pasteContacts( KABC::Addressee::List &list )
942{ 942{
943 KABC::Resource *resource = requestResource( this ); 943 KABC::Resource *resource = requestResource( this );
944 KABC::Addressee::List::Iterator it; 944 KABC::Addressee::List::Iterator it;
945 for ( it = list.begin(); it != list.end(); ++it ) 945 for ( it = list.begin(); it != list.end(); ++it )
946 (*it).setResource( resource ); 946 (*it).setResource( resource );
947 947
948 PwPasteCommand *command = new PwPasteCommand( this, list ); 948 PwPasteCommand *command = new PwPasteCommand( this, list );
949 UndoStack::instance()->push( command ); 949 UndoStack::instance()->push( command );
950 RedoStack::instance()->clear(); 950 RedoStack::instance()->clear();
951 951
952 setModified( true ); 952 setModified( true );
953} 953}
954 954
955void KABCore::setWhoAmI() 955void KABCore::setWhoAmI()
956{ 956{
957 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 957 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
958 958
959 if ( addrList.count() > 1 ) { 959 if ( addrList.count() > 1 ) {
960 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 960 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
961 return; 961 return;
962 } 962 }
963 963
964 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 964 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
965 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 965 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
966 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 966 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
967} 967}
968 968
969void KABCore::setCategories() 969void KABCore::setCategories()
970{ 970{
971 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 971 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
972 if ( !dlg.exec() ) 972 if ( !dlg.exec() )
973 return; 973 return;
974 974
975 bool merge = false; 975 bool merge = false;
976 QString msg = i18n( "Merge with existing categories?" ); 976 QString msg = i18n( "Merge with existing categories?" );
977 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 977 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
978 merge = true; 978 merge = true;
979 979
980 QStringList categories = dlg.selectedCategories(); 980 QStringList categories = dlg.selectedCategories();
981 981
982 QStringList uids = mViewManager->selectedUids(); 982 QStringList uids = mViewManager->selectedUids();
983 QStringList::Iterator it; 983 QStringList::Iterator it;
984 for ( it = uids.begin(); it != uids.end(); ++it ) { 984 for ( it = uids.begin(); it != uids.end(); ++it ) {
985 KABC::Addressee addr = mAddressBook->findByUid( *it ); 985 KABC::Addressee addr = mAddressBook->findByUid( *it );
986 if ( !addr.isEmpty() ) { 986 if ( !addr.isEmpty() ) {
987 if ( !merge ) 987 if ( !merge )
988 addr.setCategories( categories ); 988 addr.setCategories( categories );
989 else { 989 else {
990 QStringList addrCategories = addr.categories(); 990 QStringList addrCategories = addr.categories();
991 QStringList::Iterator catIt; 991 QStringList::Iterator catIt;
992 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 992 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
993 if ( !addrCategories.contains( *catIt ) ) 993 if ( !addrCategories.contains( *catIt ) )
994 addrCategories.append( *catIt ); 994 addrCategories.append( *catIt );
995 } 995 }
996 addr.setCategories( addrCategories ); 996 addr.setCategories( addrCategories );
997 } 997 }
998 998
999 mAddressBook->insertAddressee( addr ); 999 mAddressBook->insertAddressee( addr );
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 if ( uids.count() > 0 ) 1003 if ( uids.count() > 0 )
1004 setModified( true ); 1004 setModified( true );
1005} 1005}
1006 1006
1007void KABCore::setSearchFields( const KABC::Field::List &fields ) 1007void KABCore::setSearchFields( const KABC::Field::List &fields )
1008{ 1008{
1009 mIncSearchWidget->setFields( fields ); 1009 mIncSearchWidget->setFields( fields );
1010} 1010}
1011 1011
1012void KABCore::incrementalSearch( const QString& text ) 1012void KABCore::incrementalSearch( const QString& text )
1013{ 1013{
1014 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1014 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1015} 1015}
1016 1016
1017void KABCore::setModified() 1017void KABCore::setModified()
1018{ 1018{
1019 setModified( true ); 1019 setModified( true );
1020} 1020}
1021 1021
1022void KABCore::setModifiedWOrefresh() 1022void KABCore::setModifiedWOrefresh()
1023{ 1023{
1024 // qDebug("KABCore::setModifiedWOrefresh() "); 1024 // qDebug("KABCore::setModifiedWOrefresh() ");
1025 mModified = true; 1025 mModified = true;
1026 mActionSave->setEnabled( mModified ); 1026 mActionSave->setEnabled( mModified );
1027#ifdef DESKTOP_VERSION 1027#ifdef DESKTOP_VERSION
1028 mDetails->refreshView(); 1028 mDetails->refreshView();
1029#endif 1029#endif
1030 1030
1031} 1031}
1032void KABCore::setModified( bool modified ) 1032void KABCore::setModified( bool modified )
1033{ 1033{
1034 mModified = modified; 1034 mModified = modified;
1035 mActionSave->setEnabled( mModified ); 1035 mActionSave->setEnabled( mModified );
1036 1036
1037 if ( modified ) 1037 if ( modified )
1038 mJumpButtonBar->recreateButtons(); 1038 mJumpButtonBar->recreateButtons();
1039 1039
1040 mViewManager->refreshView(); 1040 mViewManager->refreshView();
1041 mDetails->refreshView(); 1041 mDetails->refreshView();
1042 1042
1043} 1043}
1044 1044
1045bool KABCore::modified() const 1045bool KABCore::modified() const
1046{ 1046{
1047 return mModified; 1047 return mModified;
1048} 1048}
1049 1049
1050void KABCore::contactModified( const KABC::Addressee &addr ) 1050void KABCore::contactModified( const KABC::Addressee &addr )
1051{ 1051{
1052 1052
1053 Command *command = 0; 1053 Command *command = 0;
1054 QString uid; 1054 QString uid;
1055 1055
1056 // check if it exists already 1056 // check if it exists already
1057 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1057 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1058 if ( origAddr.isEmpty() ) 1058 if ( origAddr.isEmpty() )
1059 command = new PwNewCommand( mAddressBook, addr ); 1059 command = new PwNewCommand( mAddressBook, addr );
1060 else { 1060 else {
1061 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1061 command = new PwEditCommand( mAddressBook, origAddr, addr );
1062 uid = addr.uid(); 1062 uid = addr.uid();
1063 } 1063 }
1064 1064
1065 UndoStack::instance()->push( command ); 1065 UndoStack::instance()->push( command );
1066 RedoStack::instance()->clear(); 1066 RedoStack::instance()->clear();
1067 1067
1068 setModified( true ); 1068 setModified( true );
1069} 1069}
1070 1070
1071void KABCore::newContact() 1071void KABCore::newContact()
1072{ 1072{
1073 1073
1074 1074
1075 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1075 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1076 1076
1077 QPtrList<KRES::Resource> kresResources; 1077 QPtrList<KRES::Resource> kresResources;
1078 QPtrListIterator<KABC::Resource> it( kabcResources ); 1078 QPtrListIterator<KABC::Resource> it( kabcResources );
1079 KABC::Resource *resource; 1079 KABC::Resource *resource;
1080 while ( ( resource = it.current() ) != 0 ) { 1080 while ( ( resource = it.current() ) != 0 ) {
1081 ++it; 1081 ++it;
1082 if ( !resource->readOnly() ) { 1082 if ( !resource->readOnly() ) {
1083 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1083 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1084 if ( res ) 1084 if ( res )
1085 kresResources.append( res ); 1085 kresResources.append( res );
1086 } 1086 }
1087 } 1087 }
1088 1088
1089 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1089 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1090 resource = static_cast<KABC::Resource*>( res ); 1090 resource = static_cast<KABC::Resource*>( res );
1091 1091
1092 if ( resource ) { 1092 if ( resource ) {
1093 KABC::Addressee addr; 1093 KABC::Addressee addr;
1094 addr.setResource( resource ); 1094 addr.setResource( resource );
1095 mEditorDialog->setAddressee( addr ); 1095 mEditorDialog->setAddressee( addr );
1096 KApplication::execDialog ( mEditorDialog ); 1096 KApplication::execDialog ( mEditorDialog );
1097 1097
1098 } else 1098 } else
1099 return; 1099 return;
1100 1100
1101 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1101 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1102 1102
1103 1103
1104} 1104}
1105 1105
1106void KABCore::addEmail( QString aStr ) 1106void KABCore::addEmail( QString aStr )
1107{ 1107{
1108#ifndef KAB_EMBEDDED 1108#ifndef KAB_EMBEDDED
1109 QString fullName, email; 1109 QString fullName, email;
1110 1110
1111 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1111 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1112 1112
1113 // Try to lookup the addressee matching the email address 1113 // Try to lookup the addressee matching the email address
1114 bool found = false; 1114 bool found = false;
1115 QStringList emailList; 1115 QStringList emailList;
1116 KABC::AddressBook::Iterator it; 1116 KABC::AddressBook::Iterator it;
1117 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1117 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1118 emailList = (*it).emails(); 1118 emailList = (*it).emails();
1119 if ( emailList.contains( email ) > 0 ) { 1119 if ( emailList.contains( email ) > 0 ) {
1120 found = true; 1120 found = true;
1121 (*it).setNameFromString( fullName ); 1121 (*it).setNameFromString( fullName );
1122 editContact( (*it).uid() ); 1122 editContact( (*it).uid() );
1123 } 1123 }
1124 } 1124 }
1125 1125
1126 if ( !found ) { 1126 if ( !found ) {
1127 KABC::Addressee addr; 1127 KABC::Addressee addr;
1128 addr.setNameFromString( fullName ); 1128 addr.setNameFromString( fullName );
1129 addr.insertEmail( email, true ); 1129 addr.insertEmail( email, true );
1130 1130
1131 mAddressBook->insertAddressee( addr ); 1131 mAddressBook->insertAddressee( addr );
1132 mViewManager->refreshView( addr.uid() ); 1132 mViewManager->refreshView( addr.uid() );
1133 editContact( addr.uid() ); 1133 editContact( addr.uid() );
1134 } 1134 }
1135#else //KAB_EMBEDDED 1135#else //KAB_EMBEDDED
1136 qDebug("KABCore::addEmail finsih method"); 1136 qDebug("KABCore::addEmail finsih method");
1137#endif //KAB_EMBEDDED 1137#endif //KAB_EMBEDDED
1138} 1138}
1139 1139
1140void KABCore::importVCard( const KURL &url, bool showPreview ) 1140void KABCore::importVCard( const KURL &url, bool showPreview )
1141{ 1141{
1142 mXXPortManager->importVCard( url, showPreview ); 1142 mXXPortManager->importVCard( url, showPreview );
1143} 1143}
1144void KABCore::importFromOL() 1144void KABCore::importFromOL()
1145{ 1145{
1146#ifdef _WIN32_ 1146#ifdef _WIN32_
1147 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1147 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1148 idgl->exec(); 1148 idgl->exec();
1149 KABC::Addressee::List list = idgl->getAddressList(); 1149 KABC::Addressee::List list = idgl->getAddressList();
1150 if ( list.count() > 0 ) { 1150 if ( list.count() > 0 ) {
1151 KABC::Addressee::List listNew; 1151 KABC::Addressee::List listNew;
1152 KABC::Addressee::List listExisting; 1152 KABC::Addressee::List listExisting;
1153 KABC::Addressee::List::Iterator it; 1153 KABC::Addressee::List::Iterator it;
1154 KABC::AddressBook::Iterator iter; 1154 KABC::AddressBook::Iterator iter;
1155 for ( it = list.begin(); it != list.end(); ++it ) { 1155 for ( it = list.begin(); it != list.end(); ++it ) {
1156 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1156 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1157 listNew.append( (*it) ); 1157 listNew.append( (*it) );
1158 else 1158 else
1159 listExisting.append( (*it) ); 1159 listExisting.append( (*it) );
1160 } 1160 }
1161 if ( listExisting.count() > 0 ) 1161 if ( listExisting.count() > 0 )
1162 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1162 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1163 if ( listNew.count() > 0 ) { 1163 if ( listNew.count() > 0 ) {
1164 pasteWithNewUid = false; 1164 pasteWithNewUid = false;
1165 pasteContacts( listNew ); 1165 pasteContacts( listNew );
1166 pasteWithNewUid = true; 1166 pasteWithNewUid = true;
1167 } 1167 }
1168 } 1168 }
1169 delete idgl; 1169 delete idgl;
1170#endif 1170#endif
1171} 1171}
1172 1172
1173void KABCore::importVCard( const QString &vCard, bool showPreview ) 1173void KABCore::importVCard( const QString &vCard, bool showPreview )
1174{ 1174{
1175 mXXPortManager->importVCard( vCard, showPreview ); 1175 mXXPortManager->importVCard( vCard, showPreview );
1176} 1176}
1177 1177
1178//US added a second method without defaultparameter 1178//US added a second method without defaultparameter
1179void KABCore::editContact2() { 1179void KABCore::editContact2() {
1180 editContact( QString::null ); 1180 editContact( QString::null );
1181} 1181}
1182 1182
1183void KABCore::editContact( const QString &uid ) 1183void KABCore::editContact( const QString &uid )
1184{ 1184{
1185 1185
1186 if ( mExtensionManager->isQuickEditVisible() ) 1186 if ( mExtensionManager->isQuickEditVisible() )
1187 return; 1187 return;
1188 1188
1189 // First, locate the contact entry 1189 // First, locate the contact entry
1190 QString localUID = uid; 1190 QString localUID = uid;
1191 if ( localUID.isNull() ) { 1191 if ( localUID.isNull() ) {
1192 QStringList uidList = mViewManager->selectedUids(); 1192 QStringList uidList = mViewManager->selectedUids();
1193 if ( uidList.count() > 0 ) 1193 if ( uidList.count() > 0 )
1194 localUID = *( uidList.at( 0 ) ); 1194 localUID = *( uidList.at( 0 ) );
1195 } 1195 }
1196 1196
1197 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1197 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1198 if ( !addr.isEmpty() ) { 1198 if ( !addr.isEmpty() ) {
1199 mEditorDialog->setAddressee( addr ); 1199 mEditorDialog->setAddressee( addr );
1200 KApplication::execDialog ( mEditorDialog ); 1200 KApplication::execDialog ( mEditorDialog );
1201 } 1201 }
1202} 1202}
1203 1203
1204/** 1204/**
1205 Shows or edits the detail view for the given uid. If the uid is QString::null, 1205 Shows or edits the detail view for the given uid. If the uid is QString::null,
1206 the method will try to find a selected addressee in the view. 1206 the method will try to find a selected addressee in the view.
1207 */ 1207 */
1208void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1208void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1209{ 1209{
1210 if ( mMultipleViewsAtOnce ) 1210 if ( mMultipleViewsAtOnce )
1211 { 1211 {
1212 editContact( uid ); 1212 editContact( uid );
1213 } 1213 }
1214 else 1214 else
1215 { 1215 {
1216 setDetailsVisible( true ); 1216 setDetailsVisible( true );
1217 mActionDetails->setChecked(true); 1217 mActionDetails->setChecked(true);
1218 } 1218 }
1219 1219
1220} 1220}
1221 1221
1222void KABCore::save() 1222void KABCore::save()
1223{ 1223{
1224 if (syncManager->blockSave()) 1224 if (syncManager->blockSave())
1225 return; 1225 return;
1226 if ( !mModified ) 1226 if ( !mModified )
1227 return; 1227 return;
1228 1228
1229 syncManager->setBlockSave(true); 1229 syncManager->setBlockSave(true);
1230 QString text = i18n( "There was an error while attempting to save\n the " 1230 QString text = i18n( "There was an error while attempting to save\n the "
1231 "address book. Please check that some \nother application is " 1231 "address book. Please check that some \nother application is "
1232 "not using it. " ); 1232 "not using it. " );
1233 message(i18n("Saving addressbook ... ")); 1233 message(i18n("Saving addressbook ... "));
1234#ifndef KAB_EMBEDDED 1234#ifndef KAB_EMBEDDED
1235 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1235 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1236 if ( !b || !b->save() ) { 1236 if ( !b || !b->save() ) {
1237 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1237 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1238 } 1238 }
1239#else //KAB_EMBEDDED 1239#else //KAB_EMBEDDED
1240 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1240 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1241 if ( !b || !b->save() ) { 1241 if ( !b || !b->save() ) {
1242 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1242 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1243 } 1243 }
1244#endif //KAB_EMBEDDED 1244#endif //KAB_EMBEDDED
1245 1245
1246 message(i18n("Addressbook saved!")); 1246 message(i18n("Addressbook saved!"));
1247 setModified( false ); 1247 setModified( false );
1248 syncManager->setBlockSave(false); 1248 syncManager->setBlockSave(false);
1249} 1249}
1250 1250
1251 1251
1252void KABCore::undo() 1252void KABCore::undo()
1253{ 1253{
1254 UndoStack::instance()->undo(); 1254 UndoStack::instance()->undo();
1255 1255
1256 // Refresh the view 1256 // Refresh the view
1257 mViewManager->refreshView(); 1257 mViewManager->refreshView();
1258} 1258}
1259 1259
1260void KABCore::redo() 1260void KABCore::redo()
1261{ 1261{
1262 RedoStack::instance()->redo(); 1262 RedoStack::instance()->redo();
1263 1263
1264 // Refresh the view 1264 // Refresh the view
1265 mViewManager->refreshView(); 1265 mViewManager->refreshView();
1266} 1266}
1267 1267
1268void KABCore::setJumpButtonBarVisible( bool visible ) 1268void KABCore::setJumpButtonBarVisible( bool visible )
1269{ 1269{
1270 if (mMultipleViewsAtOnce) 1270 if (mMultipleViewsAtOnce)
1271 { 1271 {
1272 if ( visible ) 1272 if ( visible )
1273 mJumpButtonBar->show(); 1273 mJumpButtonBar->show();
1274 else 1274 else
1275 mJumpButtonBar->hide(); 1275 mJumpButtonBar->hide();
1276 } 1276 }
1277 else 1277 else
1278 { 1278 {
1279 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1279 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1280 if (mViewManager->isVisible()) 1280 if (mViewManager->isVisible())
1281 { 1281 {
1282 if ( visible ) 1282 if ( visible )
1283 mJumpButtonBar->show(); 1283 mJumpButtonBar->show();
1284 else 1284 else
1285 mJumpButtonBar->hide(); 1285 mJumpButtonBar->hide();
1286 } 1286 }
1287 else 1287 else
1288 { 1288 {
1289 mJumpButtonBar->hide(); 1289 mJumpButtonBar->hide();
1290 } 1290 }
1291 } 1291 }
1292} 1292}
1293 1293
1294 1294
1295void KABCore::setDetailsToState() 1295void KABCore::setDetailsToState()
1296{ 1296{
1297 setDetailsVisible( mActionDetails->isChecked() ); 1297 setDetailsVisible( mActionDetails->isChecked() );
1298} 1298}
1299void KABCore::setDetailsToggle() 1299void KABCore::setDetailsToggle()
1300{ 1300{
1301 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1301 mActionDetails->setChecked( !mActionDetails->isChecked() );
1302 setDetailsToState(); 1302 setDetailsToState();
1303} 1303}
1304 1304
1305 1305
1306 1306
1307void KABCore::setDetailsVisible( bool visible ) 1307void KABCore::setDetailsVisible( bool visible )
1308{ 1308{
1309 if (visible && mDetails->isHidden()) 1309 if (visible && mDetails->isHidden())
1310 { 1310 {
1311 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1311 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1312 if ( addrList.count() > 0 ) 1312 if ( addrList.count() > 0 )
1313 mDetails->setAddressee( addrList[ 0 ] ); 1313 mDetails->setAddressee( addrList[ 0 ] );
1314 } 1314 }
1315 1315
1316 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1316 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1317 // the listview and the detailview. We do that by changing the splitbar size. 1317 // the listview and the detailview. We do that by changing the splitbar size.
1318 if (mMultipleViewsAtOnce) 1318 if (mMultipleViewsAtOnce)
1319 { 1319 {
1320 if ( visible ) 1320 if ( visible )
1321 mDetails->show(); 1321 mDetails->show();
1322 else 1322 else
1323 mDetails->hide(); 1323 mDetails->hide();
1324 } 1324 }
1325 else 1325 else
1326 { 1326 {
1327 if ( visible ) { 1327 if ( visible ) {
1328 mViewManager->hide(); 1328 mViewManager->hide();
1329 mDetails->show(); 1329 mDetails->show();
1330 mIncSearchWidget->setFocus(); 1330 mIncSearchWidget->setFocus();
1331 } 1331 }
1332 else { 1332 else {
1333 mViewManager->show(); 1333 mViewManager->show();
1334 mDetails->hide(); 1334 mDetails->hide();
1335 mViewManager->setFocusAV(); 1335 mViewManager->setFocusAV();
1336 } 1336 }
1337 setJumpButtonBarVisible( !visible ); 1337 setJumpButtonBarVisible( !visible );
1338 } 1338 }
1339 1339
1340} 1340}
1341 1341
1342void KABCore::extensionChanged( int id ) 1342void KABCore::extensionChanged( int id )
1343{ 1343{
1344 //change the details view only for non desktop systems 1344 //change the details view only for non desktop systems
1345#ifndef DESKTOP_VERSION 1345#ifndef DESKTOP_VERSION
1346 1346
1347 if (id == 0) 1347 if (id == 0)
1348 { 1348 {
1349 //the user disabled the extension. 1349 //the user disabled the extension.
1350 1350
1351 if (mMultipleViewsAtOnce) 1351 if (mMultipleViewsAtOnce)
1352 { // enable detailsview again 1352 { // enable detailsview again
1353 setDetailsVisible( true ); 1353 setDetailsVisible( true );
1354 mActionDetails->setChecked( true ); 1354 mActionDetails->setChecked( true );
1355 } 1355 }
1356 else 1356 else
1357 { //go back to the listview 1357 { //go back to the listview
1358 setDetailsVisible( false ); 1358 setDetailsVisible( false );
1359 mActionDetails->setChecked( false ); 1359 mActionDetails->setChecked( false );
1360 mActionDetails->setEnabled(true); 1360 mActionDetails->setEnabled(true);
1361 } 1361 }
1362 1362
1363 } 1363 }
1364 else 1364 else
1365 { 1365 {
1366 //the user enabled the extension. 1366 //the user enabled the extension.
1367 setDetailsVisible( false ); 1367 setDetailsVisible( false );
1368 mActionDetails->setChecked( false ); 1368 mActionDetails->setChecked( false );
1369 1369
1370 if (!mMultipleViewsAtOnce) 1370 if (!mMultipleViewsAtOnce)
1371 { 1371 {
1372 mActionDetails->setEnabled(false); 1372 mActionDetails->setEnabled(false);
1373 } 1373 }
1374 1374
1375 mExtensionManager->setSelectionChanged(); 1375 mExtensionManager->setSelectionChanged();
1376 1376
1377 } 1377 }
1378 1378
1379#endif// DESKTOP_VERSION 1379#endif// DESKTOP_VERSION
1380 1380
1381} 1381}
1382 1382
1383 1383
1384void KABCore::extensionModified( const KABC::Addressee::List &list ) 1384void KABCore::extensionModified( const KABC::Addressee::List &list )
1385{ 1385{
1386 1386
1387 if ( list.count() != 0 ) { 1387 if ( list.count() != 0 ) {
1388 KABC::Addressee::List::ConstIterator it; 1388 KABC::Addressee::List::ConstIterator it;
1389 for ( it = list.begin(); it != list.end(); ++it ) 1389 for ( it = list.begin(); it != list.end(); ++it )
1390 mAddressBook->insertAddressee( *it ); 1390 mAddressBook->insertAddressee( *it );
1391 if ( list.count() > 1 ) 1391 if ( list.count() > 1 )
1392 setModified(); 1392 setModified();
1393 else 1393 else
1394 setModifiedWOrefresh(); 1394 setModifiedWOrefresh();
1395 } 1395 }
1396 if ( list.count() == 0 ) 1396 if ( list.count() == 0 )
1397 mViewManager->refreshView(); 1397 mViewManager->refreshView();
1398 else 1398 else
1399 mViewManager->refreshView( list[ 0 ].uid() ); 1399 mViewManager->refreshView( list[ 0 ].uid() );
1400 1400
1401 1401
1402 1402
1403} 1403}
1404 1404
1405QString KABCore::getNameByPhone( const QString &phone ) 1405QString KABCore::getNameByPhone( const QString &phone )
1406{ 1406{
1407#ifndef KAB_EMBEDDED 1407#ifndef KAB_EMBEDDED
1408 QRegExp r( "[/*/-/ ]" ); 1408 QRegExp r( "[/*/-/ ]" );
1409 QString localPhone( phone ); 1409 QString localPhone( phone );
1410 1410
1411 bool found = false; 1411 bool found = false;
1412 QString ownerName = ""; 1412 QString ownerName = "";
1413 KABC::AddressBook::Iterator iter; 1413 KABC::AddressBook::Iterator iter;
1414 KABC::PhoneNumber::List::Iterator phoneIter; 1414 KABC::PhoneNumber::List::Iterator phoneIter;
1415 KABC::PhoneNumber::List phoneList; 1415 KABC::PhoneNumber::List phoneList;
1416 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1416 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1417 phoneList = (*iter).phoneNumbers(); 1417 phoneList = (*iter).phoneNumbers();
1418 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1418 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1419 ++phoneIter) { 1419 ++phoneIter) {
1420 // Get rid of separator chars so just the numbers are compared. 1420 // Get rid of separator chars so just the numbers are compared.
1421 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1421 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1422 ownerName = (*iter).formattedName(); 1422 ownerName = (*iter).formattedName();
1423 found = true; 1423 found = true;
1424 } 1424 }
1425 } 1425 }
1426 } 1426 }
1427 1427
1428 return ownerName; 1428 return ownerName;
1429#else //KAB_EMBEDDED 1429#else //KAB_EMBEDDED
1430 qDebug("KABCore::getNameByPhone finsih method"); 1430 qDebug("KABCore::getNameByPhone finsih method");
1431 return ""; 1431 return "";
1432#endif //KAB_EMBEDDED 1432#endif //KAB_EMBEDDED
1433 1433
1434} 1434}
1435 1435
1436void KABCore::openConfigDialog() 1436void KABCore::openConfigDialog()
1437{ 1437{
1438 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1438 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1439 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1439 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1440 ConfigureDialog->addModule(kabcfg ); 1440 ConfigureDialog->addModule(kabcfg );
1441 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1441 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1442 ConfigureDialog->addModule(kdelibcfg ); 1442 ConfigureDialog->addModule(kdelibcfg );
1443 1443
1444 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1444 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1445 this, SLOT( configurationChanged() ) ); 1445 this, SLOT( configurationChanged() ) );
1446 connect( ConfigureDialog, SIGNAL( okClicked() ), 1446 connect( ConfigureDialog, SIGNAL( okClicked() ),
1447 this, SLOT( configurationChanged() ) ); 1447 this, SLOT( configurationChanged() ) );
1448 saveSettings(); 1448 saveSettings();
1449#ifndef DESKTOP_VERSION 1449#ifndef DESKTOP_VERSION
1450 ConfigureDialog->showMaximized(); 1450 ConfigureDialog->showMaximized();
1451#endif 1451#endif
1452 if ( ConfigureDialog->exec() ) 1452 if ( ConfigureDialog->exec() )
1453 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1453 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1454 delete ConfigureDialog; 1454 delete ConfigureDialog;
1455} 1455}
1456 1456
1457void KABCore::openLDAPDialog() 1457void KABCore::openLDAPDialog()
1458{ 1458{
1459#ifndef KAB_EMBEDDED 1459#ifndef KAB_EMBEDDED
1460 if ( !mLdapSearchDialog ) { 1460 if ( !mLdapSearchDialog ) {
1461 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1461 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1462 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1462 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1463 SLOT( refreshView() ) ); 1463 SLOT( refreshView() ) );
1464 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1464 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1465 SLOT( setModified() ) ); 1465 SLOT( setModified() ) );
1466 } else 1466 } else
1467 mLdapSearchDialog->restoreSettings(); 1467 mLdapSearchDialog->restoreSettings();
1468 1468
1469 if ( mLdapSearchDialog->isOK() ) 1469 if ( mLdapSearchDialog->isOK() )
1470 mLdapSearchDialog->exec(); 1470 mLdapSearchDialog->exec();
1471#else //KAB_EMBEDDED 1471#else //KAB_EMBEDDED
1472 qDebug("KABCore::openLDAPDialog() finsih method"); 1472 qDebug("KABCore::openLDAPDialog() finsih method");
1473#endif //KAB_EMBEDDED 1473#endif //KAB_EMBEDDED
1474} 1474}
1475 1475
1476void KABCore::print() 1476void KABCore::print()
1477{ 1477{
1478#ifndef KAB_EMBEDDED 1478#ifndef KAB_EMBEDDED
1479 KPrinter printer; 1479 KPrinter printer;
1480 if ( !printer.setup( this ) ) 1480 if ( !printer.setup( this ) )
1481 return; 1481 return;
1482 1482
1483 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1483 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1484 mViewManager->selectedUids(), this ); 1484 mViewManager->selectedUids(), this );
1485 1485
1486 wizard.exec(); 1486 wizard.exec();
1487#else //KAB_EMBEDDED 1487#else //KAB_EMBEDDED
1488 qDebug("KABCore::print() finsih method"); 1488 qDebug("KABCore::print() finsih method");
1489#endif //KAB_EMBEDDED 1489#endif //KAB_EMBEDDED
1490 1490
1491} 1491}
1492 1492
1493 1493
1494void KABCore::addGUIClient( KXMLGUIClient *client ) 1494void KABCore::addGUIClient( KXMLGUIClient *client )
1495{ 1495{
1496 if ( mGUIClient ) 1496 if ( mGUIClient )
1497 mGUIClient->insertChildClient( client ); 1497 mGUIClient->insertChildClient( client );
1498 else 1498 else
1499 KMessageBox::error( this, "no KXMLGUICLient"); 1499 KMessageBox::error( this, "no KXMLGUICLient");
1500} 1500}
1501 1501
1502 1502
1503void KABCore::configurationChanged() 1503void KABCore::configurationChanged()
1504{ 1504{
1505 mExtensionManager->reconfigure(); 1505 mExtensionManager->reconfigure();
1506} 1506}
1507 1507
1508void KABCore::addressBookChanged() 1508void KABCore::addressBookChanged()
1509{ 1509{
1510/*US 1510/*US
1511 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1511 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1512 while ( it.current() ) { 1512 while ( it.current() ) {
1513 if ( it.current()->dirty() ) { 1513 if ( it.current()->dirty() ) {
1514 QString text = i18n( "Data has been changed externally. Unsaved " 1514 QString text = i18n( "Data has been changed externally. Unsaved "
1515 "changes will be lost." ); 1515 "changes will be lost." );
1516 KMessageBox::information( this, text ); 1516 KMessageBox::information( this, text );
1517 } 1517 }
1518 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1518 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1519 ++it; 1519 ++it;
1520 } 1520 }
1521*/ 1521*/
1522 if (mEditorDialog) 1522 if (mEditorDialog)
1523 { 1523 {
1524 if (mEditorDialog->dirty()) 1524 if (mEditorDialog->dirty())
1525 { 1525 {
1526 QString text = i18n( "Data has been changed externally. Unsaved " 1526 QString text = i18n( "Data has been changed externally. Unsaved "
1527 "changes will be lost." ); 1527 "changes will be lost." );
1528 KMessageBox::information( this, text ); 1528 KMessageBox::information( this, text );
1529 } 1529 }
1530 QString currentuid = mEditorDialog->addressee().uid(); 1530 QString currentuid = mEditorDialog->addressee().uid();
1531 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1531 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1532 } 1532 }
1533 mViewManager->refreshView(); 1533 mViewManager->refreshView();
1534// mDetails->refreshView(); 1534// mDetails->refreshView();
1535 1535
1536 1536
1537} 1537}
1538 1538
1539AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1539AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1540 const char *name ) 1540 const char *name )
1541{ 1541{
1542 1542
1543 if ( mEditorDialog == 0 ) { 1543 if ( mEditorDialog == 0 ) {
1544 mEditorDialog = new AddresseeEditorDialog( this, parent, 1544 mEditorDialog = new AddresseeEditorDialog( this, parent,
1545 name ? name : "editorDialog" ); 1545 name ? name : "editorDialog" );
1546 1546
1547 1547
1548 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1548 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1549 SLOT( contactModified( const KABC::Addressee& ) ) ); 1549 SLOT( contactModified( const KABC::Addressee& ) ) );
1550 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1550 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1551 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1551 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1552 } 1552 }
1553 1553
1554 return mEditorDialog; 1554 return mEditorDialog;
1555} 1555}
1556 1556
1557void KABCore::slotEditorDestroyed( const QString &uid ) 1557void KABCore::slotEditorDestroyed( const QString &uid )
1558{ 1558{
1559 //mEditorDict.remove( uid ); 1559 //mEditorDict.remove( uid );
1560} 1560}
1561 1561
1562void KABCore::initGUI() 1562void KABCore::initGUI()
1563{ 1563{
1564#ifndef KAB_EMBEDDED 1564#ifndef KAB_EMBEDDED
1565 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1565 QHBoxLayout *topLayout = new QHBoxLayout( this );
1566 topLayout->setSpacing( KDialogBase::spacingHint() ); 1566 topLayout->setSpacing( KDialogBase::spacingHint() );
1567 1567
1568 mExtensionBarSplitter = new QSplitter( this ); 1568 mExtensionBarSplitter = new QSplitter( this );
1569 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1569 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1570 1570
1571 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1571 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1572 1572
1573 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1573 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1574 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1574 mIncSearchWidget = new IncSearchWidget( viewSpace );
1575 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1575 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1576 SLOT( incrementalSearch( const QString& ) ) ); 1576 SLOT( incrementalSearch( const QString& ) ) );
1577 1577
1578 mViewManager = new ViewManager( this, viewSpace ); 1578 mViewManager = new ViewManager( this, viewSpace );
1579 viewSpace->setStretchFactor( mViewManager, 1 ); 1579 viewSpace->setStretchFactor( mViewManager, 1 );
1580 1580
1581 mDetails = new ViewContainer( mDetailsSplitter ); 1581 mDetails = new ViewContainer( mDetailsSplitter );
1582 1582
1583 mJumpButtonBar = new JumpButtonBar( this, this ); 1583 mJumpButtonBar = new JumpButtonBar( this, this );
1584 1584
1585 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1585 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1586 1586
1587 topLayout->addWidget( mExtensionBarSplitter ); 1587 topLayout->addWidget( mExtensionBarSplitter );
1588 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1588 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1589 topLayout->addWidget( mJumpButtonBar ); 1589 topLayout->addWidget( mJumpButtonBar );
1590 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1590 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1591 1591
1592 mXXPortManager = new XXPortManager( this, this ); 1592 mXXPortManager = new XXPortManager( this, this );
1593 1593
1594#else //KAB_EMBEDDED 1594#else //KAB_EMBEDDED
1595 //US initialize viewMenu before settingup viewmanager. 1595 //US initialize viewMenu before settingup viewmanager.
1596 // Viewmanager needs this menu to plugin submenues. 1596 // Viewmanager needs this menu to plugin submenues.
1597 viewMenu = new QPopupMenu( this ); 1597 viewMenu = new QPopupMenu( this );
1598 settingsMenu = new QPopupMenu( this ); 1598 settingsMenu = new QPopupMenu( this );
1599 //filterMenu = new QPopupMenu( this ); 1599 //filterMenu = new QPopupMenu( this );
1600 ImportMenu = new QPopupMenu( this ); 1600 ImportMenu = new QPopupMenu( this );
1601 ExportMenu = new QPopupMenu( this ); 1601 ExportMenu = new QPopupMenu( this );
1602 syncMenu = new QPopupMenu( this ); 1602 syncMenu = new QPopupMenu( this );
1603 changeMenu= new QPopupMenu( this ); 1603 changeMenu= new QPopupMenu( this );
1604 1604
1605//US since we have no splitter for the embedded system, setup 1605//US since we have no splitter for the embedded system, setup
1606// a layout with two frames. One left and one right. 1606// a layout with two frames. One left and one right.
1607 1607
1608 QBoxLayout *topLayout; 1608 QBoxLayout *topLayout;
1609 1609
1610 // = new QHBoxLayout( this ); 1610 // = new QHBoxLayout( this );
1611// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1611// QBoxLayout *topLayout = (QBoxLayout*)layout();
1612 1612
1613// QWidget *mainBox = new QWidget( this ); 1613// QWidget *mainBox = new QWidget( this );
1614// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1614// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1615 1615
1616#ifdef DESKTOP_VERSION 1616#ifdef DESKTOP_VERSION
1617 topLayout = new QHBoxLayout( this ); 1617 topLayout = new QHBoxLayout( this );
1618 1618
1619 1619
1620 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1620 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1621 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1621 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1622 1622
1623 topLayout->addWidget(mMiniSplitter ); 1623 topLayout->addWidget(mMiniSplitter );
1624 1624
1625 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1625 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1626 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1626 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1627 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1627 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1628 mDetails = new ViewContainer( mMiniSplitter ); 1628 mDetails = new ViewContainer( mMiniSplitter );
1629 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1629 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1630#else 1630#else
1631 if ( QApplication::desktop()->width() > 480 ) { 1631 if ( QApplication::desktop()->width() > 480 ) {
1632 topLayout = new QHBoxLayout( this ); 1632 topLayout = new QHBoxLayout( this );
1633 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1633 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1634 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1634 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1635 } else { 1635 } else {
1636 1636
1637 topLayout = new QHBoxLayout( this ); 1637 topLayout = new QHBoxLayout( this );
1638 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1638 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1639 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1639 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1640 } 1640 }
1641 1641
1642 topLayout->addWidget(mMiniSplitter ); 1642 topLayout->addWidget(mMiniSplitter );
1643 mViewManager = new ViewManager( this, mMiniSplitter ); 1643 mViewManager = new ViewManager( this, mMiniSplitter );
1644 mDetails = new ViewContainer( mMiniSplitter ); 1644 mDetails = new ViewContainer( mMiniSplitter );
1645 1645
1646 1646
1647 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1647 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1648#endif 1648#endif
1649 //eh->hide(); 1649 //eh->hide();
1650 // topLayout->addWidget(mExtensionManager ); 1650 // topLayout->addWidget(mExtensionManager );
1651 1651
1652 1652
1653/*US 1653/*US
1654#ifndef KAB_NOSPLITTER 1654#ifndef KAB_NOSPLITTER
1655 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1655 QHBoxLayout *topLayout = new QHBoxLayout( this );
1656//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1656//US topLayout->setSpacing( KDialogBase::spacingHint() );
1657 topLayout->setSpacing( 10 ); 1657 topLayout->setSpacing( 10 );
1658 1658
1659 mDetailsSplitter = new QSplitter( this ); 1659 mDetailsSplitter = new QSplitter( this );
1660 1660
1661 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1661 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1662 1662
1663 mViewManager = new ViewManager( this, viewSpace ); 1663 mViewManager = new ViewManager( this, viewSpace );
1664 viewSpace->setStretchFactor( mViewManager, 1 ); 1664 viewSpace->setStretchFactor( mViewManager, 1 );
1665 1665
1666 mDetails = new ViewContainer( mDetailsSplitter ); 1666 mDetails = new ViewContainer( mDetailsSplitter );
1667 1667
1668 topLayout->addWidget( mDetailsSplitter ); 1668 topLayout->addWidget( mDetailsSplitter );
1669 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1669 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1670#else //KAB_NOSPLITTER 1670#else //KAB_NOSPLITTER
1671 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1671 QHBoxLayout *topLayout = new QHBoxLayout( this );
1672//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1672//US topLayout->setSpacing( KDialogBase::spacingHint() );
1673 topLayout->setSpacing( 10 ); 1673 topLayout->setSpacing( 10 );
1674 1674
1675// mDetailsSplitter = new QSplitter( this ); 1675// mDetailsSplitter = new QSplitter( this );
1676 1676
1677 QVBox *viewSpace = new QVBox( this ); 1677 QVBox *viewSpace = new QVBox( this );
1678 1678
1679 mViewManager = new ViewManager( this, viewSpace ); 1679 mViewManager = new ViewManager( this, viewSpace );
1680 viewSpace->setStretchFactor( mViewManager, 1 ); 1680 viewSpace->setStretchFactor( mViewManager, 1 );
1681 1681
1682 mDetails = new ViewContainer( this ); 1682 mDetails = new ViewContainer( this );
1683 1683
1684 topLayout->addWidget( viewSpace ); 1684 topLayout->addWidget( viewSpace );
1685// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1685// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1686 topLayout->addWidget( mDetails ); 1686 topLayout->addWidget( mDetails );
1687#endif //KAB_NOSPLITTER 1687#endif //KAB_NOSPLITTER
1688*/ 1688*/
1689 1689
1690 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1690 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1691 syncManager->setBlockSave(false); 1691 syncManager->setBlockSave(false);
1692 1692
1693 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1693 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1694 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1694 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1695 syncManager->setDefaultFileName( sentSyncFile()); 1695 syncManager->setDefaultFileName( sentSyncFile());
1696 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1696 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1697 1697
1698#endif //KAB_EMBEDDED 1698#endif //KAB_EMBEDDED
1699 initActions(); 1699 initActions();
1700 1700
1701#ifdef KAB_EMBEDDED 1701#ifdef KAB_EMBEDDED
1702 addActionsManually(); 1702 addActionsManually();
1703 //US make sure the export and import menues are initialized before creating the xxPortManager. 1703 //US make sure the export and import menues are initialized before creating the xxPortManager.
1704 mXXPortManager = new XXPortManager( this, this ); 1704 mXXPortManager = new XXPortManager( this, this );
1705 1705
1706 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1706 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1707 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1707 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1708 // mActionQuit->plug ( mMainWindow->toolBar()); 1708 // mActionQuit->plug ( mMainWindow->toolBar());
1709 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1709 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1710 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1710 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1711 // mIncSearchWidget->hide(); 1711 // mIncSearchWidget->hide();
1712 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1712 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1713 SLOT( incrementalSearch( const QString& ) ) ); 1713 SLOT( incrementalSearch( const QString& ) ) );
1714 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1714 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1715 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1715 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1716 1716
1717 mJumpButtonBar = new JumpButtonBar( this, this ); 1717 mJumpButtonBar = new JumpButtonBar( this, this );
1718 1718
1719 topLayout->addWidget( mJumpButtonBar ); 1719 topLayout->addWidget( mJumpButtonBar );
1720//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1720//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1721 1721
1722// mMainWindow->getIconToolBar()->raise(); 1722// mMainWindow->getIconToolBar()->raise();
1723 1723
1724#endif //KAB_EMBEDDED 1724#endif //KAB_EMBEDDED
1725 1725
1726} 1726}
1727void KABCore::initActions() 1727void KABCore::initActions()
1728{ 1728{
1729//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1729//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1730 1730
1731#ifndef KAB_EMBEDDED 1731#ifndef KAB_EMBEDDED
1732 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1732 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1733 SLOT( clipboardDataChanged() ) ); 1733 SLOT( clipboardDataChanged() ) );
1734#endif //KAB_EMBEDDED 1734#endif //KAB_EMBEDDED
1735 1735
1736 // file menu 1736 // file menu
1737 if ( mIsPart ) { 1737 if ( mIsPart ) {
1738 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1738 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1739 SLOT( sendMail() ), actionCollection(), 1739 SLOT( sendMail() ), actionCollection(),
1740 "kaddressbook_mail" ); 1740 "kaddressbook_mail" );
1741 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1741 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1742 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1742 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1743 1743
1744 } else { 1744 } else {
1745 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1745 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1746 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1746 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1747 } 1747 }
1748 1748
1749 1749
1750 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1750 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1751 SLOT( save() ), actionCollection(), "file_sync" ); 1751 SLOT( save() ), actionCollection(), "file_sync" );
1752 1752
1753 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1753 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1754 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1754 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1755 1755
1756 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1756 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1757 this, SLOT( mailVCard() ), 1757 this, SLOT( mailVCard() ),
1758 actionCollection(), "file_mail_vcard"); 1758 actionCollection(), "file_mail_vcard");
1759 1759
1760 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, 1760 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this,
1761 SLOT( export2phone() ), actionCollection(), 1761 SLOT( export2phone() ), actionCollection(),
1762 "kaddressbook_ex2phone" ); 1762 "kaddressbook_ex2phone" );
1763 1763
1764 mActionBeamVCard = 0; 1764 mActionBeamVCard = 0;
1765 mActionBeam = 0; 1765 mActionBeam = 0;
1766 1766
1767#ifndef DESKTOP_VERSION 1767#ifndef DESKTOP_VERSION
1768 if ( Ir::supported() ) { 1768 if ( Ir::supported() ) {
1769 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1769 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1770 SLOT( beamVCard() ), actionCollection(), 1770 SLOT( beamVCard() ), actionCollection(),
1771 "kaddressbook_beam_vcard" ); 1771 "kaddressbook_beam_vcard" );
1772 1772
1773 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1773 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1774 SLOT( beamMySelf() ), actionCollection(), 1774 SLOT( beamMySelf() ), actionCollection(),
1775 "kaddressbook_beam_myself" ); 1775 "kaddressbook_beam_myself" );
1776 } 1776 }
1777#endif 1777#endif
1778 1778
1779 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1779 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1780 this, SLOT( editContact2() ), 1780 this, SLOT( editContact2() ),
1781 actionCollection(), "file_properties" ); 1781 actionCollection(), "file_properties" );
1782 1782
1783#ifdef KAB_EMBEDDED 1783#ifdef KAB_EMBEDDED
1784 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1784 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1785 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1785 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1786 mMainWindow, SLOT( exit() ), 1786 mMainWindow, SLOT( exit() ),
1787 actionCollection(), "quit" ); 1787 actionCollection(), "quit" );
1788#endif //KAB_EMBEDDED 1788#endif //KAB_EMBEDDED
1789 1789
1790 // edit menu 1790 // edit menu
1791 if ( mIsPart ) { 1791 if ( mIsPart ) {
1792 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1792 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1793 SLOT( copyContacts() ), actionCollection(), 1793 SLOT( copyContacts() ), actionCollection(),
1794 "kaddressbook_copy" ); 1794 "kaddressbook_copy" );
1795 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1795 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1796 SLOT( cutContacts() ), actionCollection(), 1796 SLOT( cutContacts() ), actionCollection(),
1797 "kaddressbook_cut" ); 1797 "kaddressbook_cut" );
1798 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1798 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1799 SLOT( pasteContacts() ), actionCollection(), 1799 SLOT( pasteContacts() ), actionCollection(),
1800 "kaddressbook_paste" ); 1800 "kaddressbook_paste" );
1801 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1801 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1802 SLOT( selectAllContacts() ), actionCollection(), 1802 SLOT( selectAllContacts() ), actionCollection(),
1803 "kaddressbook_select_all" ); 1803 "kaddressbook_select_all" );
1804 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1804 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1805 SLOT( undo() ), actionCollection(), 1805 SLOT( undo() ), actionCollection(),
1806 "kaddressbook_undo" ); 1806 "kaddressbook_undo" );
1807 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1807 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1808 this, SLOT( redo() ), actionCollection(), 1808 this, SLOT( redo() ), actionCollection(),
1809 "kaddressbook_redo" ); 1809 "kaddressbook_redo" );
1810 } else { 1810 } else {
1811 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1811 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1812 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1812 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1813 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1813 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1814 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1814 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1815 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1815 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1816 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1816 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1817 } 1817 }
1818 1818
1819 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1819 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1820 Key_Delete, this, SLOT( deleteContacts() ), 1820 Key_Delete, this, SLOT( deleteContacts() ),
1821 actionCollection(), "edit_delete" ); 1821 actionCollection(), "edit_delete" );
1822 1822
1823 mActionUndo->setEnabled( false ); 1823 mActionUndo->setEnabled( false );
1824 mActionRedo->setEnabled( false ); 1824 mActionRedo->setEnabled( false );
1825 1825
1826 // settings menu 1826 // settings menu
1827#ifdef KAB_EMBEDDED 1827#ifdef KAB_EMBEDDED
1828//US special menuentry to configure the addressbook resources. On KDE 1828//US special menuentry to configure the addressbook resources. On KDE
1829// you do that through the control center !!! 1829// you do that through the control center !!!
1830 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1830 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1831 SLOT( configureResources() ), actionCollection(), 1831 SLOT( configureResources() ), actionCollection(),
1832 "kaddressbook_configure_resources" ); 1832 "kaddressbook_configure_resources" );
1833#endif //KAB_EMBEDDED 1833#endif //KAB_EMBEDDED
1834 1834
1835 if ( mIsPart ) { 1835 if ( mIsPart ) {
1836 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1836 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1837 SLOT( openConfigDialog() ), actionCollection(), 1837 SLOT( openConfigDialog() ), actionCollection(),
1838 "kaddressbook_configure" ); 1838 "kaddressbook_configure" );
1839 1839
1840 //US not implemented yet 1840 //US not implemented yet
1841 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1841 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1842 // this, SLOT( configureKeyBindings() ), actionCollection(), 1842 // this, SLOT( configureKeyBindings() ), actionCollection(),
1843 // "kaddressbook_configure_shortcuts" ); 1843 // "kaddressbook_configure_shortcuts" );
1844#ifdef KAB_EMBEDDED 1844#ifdef KAB_EMBEDDED
1845 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1845 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1846 mActionConfigureToolbars->setEnabled( false ); 1846 mActionConfigureToolbars->setEnabled( false );
1847#endif //KAB_EMBEDDED 1847#endif //KAB_EMBEDDED
1848 1848
1849 } else { 1849 } else {
1850 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1850 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1851 1851
1852 //US not implemented yet 1852 //US not implemented yet
1853 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1853 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1854 } 1854 }
1855 1855
1856 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1856 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1857 actionCollection(), "options_show_jump_bar" ); 1857 actionCollection(), "options_show_jump_bar" );
1858 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1858 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1859 1859
1860 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1860 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1861 actionCollection(), "options_show_details" ); 1861 actionCollection(), "options_show_details" );
1862 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1862 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1863 1863
1864 1864
1865 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1865 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1866 SLOT( toggleBeamReceive() ), actionCollection(), 1866 SLOT( toggleBeamReceive() ), actionCollection(),
1867 "kaddressbook_beam_rec" ); 1867 "kaddressbook_beam_rec" );
1868 1868
1869 1869
1870 // misc 1870 // misc
1871 // only enable LDAP lookup if we can handle the protocol 1871 // only enable LDAP lookup if we can handle the protocol
1872#ifndef KAB_EMBEDDED 1872#ifndef KAB_EMBEDDED
1873 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1873 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1874 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1874 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1875 this, SLOT( openLDAPDialog() ), actionCollection(), 1875 this, SLOT( openLDAPDialog() ), actionCollection(),
1876 "ldap_lookup" ); 1876 "ldap_lookup" );
1877 } 1877 }
1878#else //KAB_EMBEDDED 1878#else //KAB_EMBEDDED
1879 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1879 //qDebug("KABCore::initActions() LDAP has to be implemented");
1880#endif //KAB_EMBEDDED 1880#endif //KAB_EMBEDDED
1881 1881
1882 1882
1883 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1883 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1884 SLOT( setWhoAmI() ), actionCollection(), 1884 SLOT( setWhoAmI() ), actionCollection(),
1885 "set_personal" ); 1885 "set_personal" );
1886 1886
1887 1887
1888 1888
1889 1889
1890 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1890 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1891 SLOT( setCategories() ), actionCollection(), 1891 SLOT( setCategories() ), actionCollection(),
1892 "edit_set_categories" ); 1892 "edit_set_categories" );
1893 1893
1894 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1894 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1895 SLOT( removeVoice() ), actionCollection(), 1895 SLOT( removeVoice() ), actionCollection(),
1896 "remove_voice" ); 1896 "remove_voice" );
1897 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1897 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1898 SLOT( importFromOL() ), actionCollection(), 1898 SLOT( importFromOL() ), actionCollection(),
1899 "import_OL" ); 1899 "import_OL" );
1900#ifdef KAB_EMBEDDED 1900#ifdef KAB_EMBEDDED
1901 mActionLicence = new KAction( i18n( "Licence" ), 0, 1901 mActionLicence = new KAction( i18n( "Licence" ), 0,
1902 this, SLOT( showLicence() ), actionCollection(), 1902 this, SLOT( showLicence() ), actionCollection(),
1903 "licence_about_data" ); 1903 "licence_about_data" );
1904 mActionFaq = new KAction( i18n( "Faq" ), 0, 1904 mActionFaq = new KAction( i18n( "Faq" ), 0,
1905 this, SLOT( faq() ), actionCollection(), 1905 this, SLOT( faq() ), actionCollection(),
1906 "faq_about_data" ); 1906 "faq_about_data" );
1907 mActionWN = new KAction( i18n( "What's New?" ), 0, 1907 mActionWN = new KAction( i18n( "What's New?" ), 0,
1908 this, SLOT( whatsnew() ), actionCollection(), 1908 this, SLOT( whatsnew() ), actionCollection(),
1909 "wn" ); 1909 "wn" );
1910 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1910 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1911 this, SLOT( synchowto() ), actionCollection(), 1911 this, SLOT( synchowto() ), actionCollection(),
1912 "sync" ); 1912 "sync" );
1913 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 1913 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1914 this, SLOT( kdesynchowto() ), actionCollection(), 1914 this, SLOT( kdesynchowto() ), actionCollection(),
1915 "kdesync" ); 1915 "kdesync" );
1916 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 1916 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1917 this, SLOT( multisynchowto() ), actionCollection(), 1917 this, SLOT( multisynchowto() ), actionCollection(),
1918 "multisync" ); 1918 "multisync" );
1919 1919
1920 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1920 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1921 this, SLOT( createAboutData() ), actionCollection(), 1921 this, SLOT( createAboutData() ), actionCollection(),
1922 "kaddressbook_about_data" ); 1922 "kaddressbook_about_data" );
1923#endif //KAB_EMBEDDED 1923#endif //KAB_EMBEDDED
1924 1924
1925 clipboardDataChanged(); 1925 clipboardDataChanged();
1926 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1926 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1927 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1927 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1928} 1928}
1929 1929
1930//US we need this function, to plug all actions into the correct menues. 1930//US we need this function, to plug all actions into the correct menues.
1931// KDE uses a XML format to plug the actions, but we work her without this overhead. 1931// KDE uses a XML format to plug the actions, but we work her without this overhead.
1932void KABCore::addActionsManually() 1932void KABCore::addActionsManually()
1933{ 1933{
1934//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1934//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1935 1935
1936#ifdef KAB_EMBEDDED 1936#ifdef KAB_EMBEDDED
1937 QPopupMenu *fileMenu = new QPopupMenu( this ); 1937 QPopupMenu *fileMenu = new QPopupMenu( this );
1938 QPopupMenu *editMenu = new QPopupMenu( this ); 1938 QPopupMenu *editMenu = new QPopupMenu( this );
1939 QPopupMenu *helpMenu = new QPopupMenu( this ); 1939 QPopupMenu *helpMenu = new QPopupMenu( this );
1940 1940
1941 KToolBar* tb = mMainWindow->toolBar(); 1941 KToolBar* tb = mMainWindow->toolBar();
1942 1942
1943#ifndef DESKTOP_VERSION 1943#ifndef DESKTOP_VERSION
1944 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 1944 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
1945#endif 1945#endif
1946 QMenuBar* mb = mMainWindow->menuBar(); 1946 QMenuBar* mb = mMainWindow->menuBar();
1947 1947
1948 //US setup menubar. 1948 //US setup menubar.
1949 //Disable the following block if you do not want to have a menubar. 1949 //Disable the following block if you do not want to have a menubar.
1950 mb->insertItem( "&File", fileMenu ); 1950 mb->insertItem( "&File", fileMenu );
1951 mb->insertItem( "&Edit", editMenu ); 1951 mb->insertItem( "&Edit", editMenu );
1952 mb->insertItem( "&View", viewMenu ); 1952 mb->insertItem( "&View", viewMenu );
1953 mb->insertItem( "&Settings", settingsMenu ); 1953 mb->insertItem( "&Settings", settingsMenu );
1954 mb->insertItem( i18n("Synchronize"), syncMenu ); 1954 mb->insertItem( i18n("Synchronize"), syncMenu );
1955 mb->insertItem( "&Change selected", changeMenu ); 1955 mb->insertItem( "&Change selected", changeMenu );
1956 mb->insertItem( "&Help", helpMenu ); 1956 mb->insertItem( "&Help", helpMenu );
1957 mIncSearchWidget = new IncSearchWidget( tb ); 1957 mIncSearchWidget = new IncSearchWidget( tb );
1958 // tb->insertWidget(-1, 0, mIncSearchWidget); 1958 // tb->insertWidget(-1, 0, mIncSearchWidget);
1959#ifndef DESKTOP_VERSION 1959#ifndef DESKTOP_VERSION
1960 } else { 1960 } else {
1961 //US setup toolbar 1961 //US setup toolbar
1962 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 1962 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1963 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1963 QPopupMenu *popupBarTB = new QPopupMenu( this );
1964 menuBarTB->insertItem( "ME", popupBarTB); 1964 menuBarTB->insertItem( "ME", popupBarTB);
1965 tb->insertWidget(-1, 0, menuBarTB); 1965 tb->insertWidget(-1, 0, menuBarTB);
1966 mIncSearchWidget = new IncSearchWidget( tb ); 1966 mIncSearchWidget = new IncSearchWidget( tb );
1967 1967
1968 tb->enableMoving(false); 1968 tb->enableMoving(false);
1969 popupBarTB->insertItem( "&File", fileMenu ); 1969 popupBarTB->insertItem( "&File", fileMenu );
1970 popupBarTB->insertItem( "&Edit", editMenu ); 1970 popupBarTB->insertItem( "&Edit", editMenu );
1971 popupBarTB->insertItem( "&View", viewMenu ); 1971 popupBarTB->insertItem( "&View", viewMenu );
1972 popupBarTB->insertItem( "&Settings", settingsMenu ); 1972 popupBarTB->insertItem( "&Settings", settingsMenu );
1973 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 1973 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1974 mViewManager->getFilterAction()->plug ( popupBarTB); 1974 mViewManager->getFilterAction()->plug ( popupBarTB);
1975 popupBarTB->insertItem( "&Change selected", changeMenu ); 1975 popupBarTB->insertItem( "&Change selected", changeMenu );
1976 popupBarTB->insertItem( "&Help", helpMenu ); 1976 popupBarTB->insertItem( "&Help", helpMenu );
1977 if (QApplication::desktop()->width() > 320 ) { 1977 if (QApplication::desktop()->width() > 320 ) {
1978 // mViewManager->getFilterAction()->plug ( tb); 1978 // mViewManager->getFilterAction()->plug ( tb);
1979 } 1979 }
1980 } 1980 }
1981#endif 1981#endif
1982 // mActionQuit->plug ( mMainWindow->toolBar()); 1982 // mActionQuit->plug ( mMainWindow->toolBar());
1983 1983
1984 1984
1985 1985
1986 //US Now connect the actions with the menue entries. 1986 //US Now connect the actions with the menue entries.
1987 mActionPrint->plug( fileMenu ); 1987 mActionPrint->plug( fileMenu );
1988 mActionMail->plug( fileMenu ); 1988 mActionMail->plug( fileMenu );
1989 fileMenu->insertSeparator(); 1989 fileMenu->insertSeparator();
1990 1990
1991 mActionNewContact->plug( fileMenu ); 1991 mActionNewContact->plug( fileMenu );
1992 mActionNewContact->plug( tb ); 1992 mActionNewContact->plug( tb );
1993 1993
1994 mActionEditAddressee->plug( fileMenu ); 1994 mActionEditAddressee->plug( fileMenu );
1995 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1995 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1996 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1996 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1997 mActionEditAddressee->plug( tb ); 1997 mActionEditAddressee->plug( tb );
1998 1998
1999 fileMenu->insertSeparator(); 1999 fileMenu->insertSeparator();
2000 mActionSave->plug( fileMenu ); 2000 mActionSave->plug( fileMenu );
2001 fileMenu->insertItem( "&Import", ImportMenu ); 2001 fileMenu->insertItem( "&Import", ImportMenu );
2002 fileMenu->insertItem( "&Export", ExportMenu ); 2002 fileMenu->insertItem( "&Export", ExportMenu );
2003 fileMenu->insertSeparator(); 2003 fileMenu->insertSeparator();
2004 mActionMailVCard->plug( fileMenu ); 2004 mActionMailVCard->plug( fileMenu );
2005#ifndef DESKTOP_VERSION 2005#ifndef DESKTOP_VERSION
2006 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2006 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
2007 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2007 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
2008#endif 2008#endif
2009 fileMenu->insertSeparator(); 2009 fileMenu->insertSeparator();
2010 mActionQuit->plug( fileMenu ); 2010 mActionQuit->plug( fileMenu );
2011#ifdef _WIN32_ 2011#ifdef _WIN32_
2012 mActionImportOL->plug( ImportMenu ); 2012 mActionImportOL->plug( ImportMenu );
2013#endif 2013#endif
2014 // edit menu 2014 // edit menu
2015 mActionUndo->plug( editMenu ); 2015 mActionUndo->plug( editMenu );
2016 mActionRedo->plug( editMenu ); 2016 mActionRedo->plug( editMenu );
2017 editMenu->insertSeparator(); 2017 editMenu->insertSeparator();
2018 mActionCut->plug( editMenu ); 2018 mActionCut->plug( editMenu );
2019 mActionCopy->plug( editMenu ); 2019 mActionCopy->plug( editMenu );
2020 mActionPaste->plug( editMenu ); 2020 mActionPaste->plug( editMenu );
2021 mActionDelete->plug( editMenu ); 2021 mActionDelete->plug( editMenu );
2022 editMenu->insertSeparator(); 2022 editMenu->insertSeparator();
2023 mActionSelectAll->plug( editMenu ); 2023 mActionSelectAll->plug( editMenu );
2024 2024
2025 mActionRemoveVoice->plug( changeMenu ); 2025 mActionRemoveVoice->plug( changeMenu );
2026 // settings menu 2026 // settings menu
2027//US special menuentry to configure the addressbook resources. On KDE 2027//US special menuentry to configure the addressbook resources. On KDE
2028// you do that through the control center !!! 2028// you do that through the control center !!!
2029 mActionConfigResources->plug( settingsMenu ); 2029 mActionConfigResources->plug( settingsMenu );
2030 settingsMenu->insertSeparator(); 2030 settingsMenu->insertSeparator();
2031 2031
2032 mActionConfigKAddressbook->plug( settingsMenu ); 2032 mActionConfigKAddressbook->plug( settingsMenu );
2033 2033
2034 if ( mIsPart ) { 2034 if ( mIsPart ) {
2035 //US not implemented yet 2035 //US not implemented yet
2036 //mActionConfigShortcuts->plug( settingsMenu ); 2036 //mActionConfigShortcuts->plug( settingsMenu );
2037 //mActionConfigureToolbars->plug( settingsMenu ); 2037 //mActionConfigureToolbars->plug( settingsMenu );
2038 2038
2039 } else { 2039 } else {
2040 //US not implemented yet 2040 //US not implemented yet
2041 //mActionKeyBindings->plug( settingsMenu ); 2041 //mActionKeyBindings->plug( settingsMenu );
2042 } 2042 }
2043 2043
2044 settingsMenu->insertSeparator(); 2044 settingsMenu->insertSeparator();
2045 2045
2046 mActionJumpBar->plug( settingsMenu ); 2046 mActionJumpBar->plug( settingsMenu );
2047 mActionDetails->plug( settingsMenu ); 2047 mActionDetails->plug( settingsMenu );
2048 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2048 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2049 mActionDetails->plug( tb ); 2049 mActionDetails->plug( tb );
2050 settingsMenu->insertSeparator(); 2050 settingsMenu->insertSeparator();
2051 mActionBR->plug(settingsMenu ); 2051 mActionBR->plug(settingsMenu );
2052 settingsMenu->insertSeparator(); 2052 settingsMenu->insertSeparator();
2053 2053
2054 mActionWhoAmI->plug( settingsMenu ); 2054 mActionWhoAmI->plug( settingsMenu );
2055 mActionCategories->plug( settingsMenu ); 2055 mActionCategories->plug( settingsMenu );
2056 2056
2057 2057
2058 mActionWN->plug( helpMenu ); 2058 mActionWN->plug( helpMenu );
2059 mActionSyncHowto->plug( helpMenu ); 2059 mActionSyncHowto->plug( helpMenu );
2060 mActionKdeSyncHowto->plug( helpMenu ); 2060 mActionKdeSyncHowto->plug( helpMenu );
2061 mActionMultiSyncHowto->plug( helpMenu ); 2061 mActionMultiSyncHowto->plug( helpMenu );
2062 mActionFaq->plug( helpMenu ); 2062 mActionFaq->plug( helpMenu );
2063 mActionLicence->plug( helpMenu ); 2063 mActionLicence->plug( helpMenu );
2064 mActionAboutKAddressbook->plug( helpMenu ); 2064 mActionAboutKAddressbook->plug( helpMenu );
2065 2065
2066 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2066 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2067 2067
2068 mActionSave->plug( tb ); 2068 mActionSave->plug( tb );
2069 mViewManager->getFilterAction()->plug ( tb); 2069 mViewManager->getFilterAction()->plug ( tb);
2070 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2070 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2071 mActionUndo->plug( tb ); 2071 mActionUndo->plug( tb );
2072 mActionDelete->plug( tb ); 2072 mActionDelete->plug( tb );
2073 mActionRedo->plug( tb ); 2073 mActionRedo->plug( tb );
2074 } 2074 }
2075 } else { 2075 } else {
2076 mActionSave->plug( tb ); 2076 mActionSave->plug( tb );
2077 tb->enableMoving(false); 2077 tb->enableMoving(false);
2078 } 2078 }
2079 //mActionQuit->plug ( tb ); 2079 //mActionQuit->plug ( tb );
2080 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2080 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2081 2081
2082 //US link the searchwidget first to this. 2082 //US link the searchwidget first to this.
2083 // The real linkage to the toolbar happens later. 2083 // The real linkage to the toolbar happens later.
2084//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2084//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2085//US tb->insertItem( mIncSearchWidget ); 2085//US tb->insertItem( mIncSearchWidget );
2086/*US 2086/*US
2087 mIncSearchWidget = new IncSearchWidget( tb ); 2087 mIncSearchWidget = new IncSearchWidget( tb );
2088 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2088 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2089 SLOT( incrementalSearch( const QString& ) ) ); 2089 SLOT( incrementalSearch( const QString& ) ) );
2090 2090
2091 mJumpButtonBar = new JumpButtonBar( this, this ); 2091 mJumpButtonBar = new JumpButtonBar( this, this );
2092 2092
2093//US topLayout->addWidget( mJumpButtonBar ); 2093//US topLayout->addWidget( mJumpButtonBar );
2094 this->layout()->add( mJumpButtonBar ); 2094 this->layout()->add( mJumpButtonBar );
2095*/ 2095*/
2096 2096
2097#endif //KAB_EMBEDDED 2097#endif //KAB_EMBEDDED
2098 2098
2099 mActionExport2phone->plug( ExportMenu ); 2099 mActionExport2phone->plug( ExportMenu );
2100 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2100 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2101 syncManager->fillSyncMenu(); 2101 syncManager->fillSyncMenu();
2102 2102
2103} 2103}
2104void KABCore::showLicence() 2104void KABCore::showLicence()
2105{ 2105{
2106 KApplication::showLicence(); 2106 KApplication::showLicence();
2107} 2107}
2108void KABCore::removeVoice() 2108void KABCore::removeVoice()
2109{ 2109{
2110 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2110 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2111 return; 2111 return;
2112 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2112 KABC::Addressee::List list = mViewManager->selectedAddressees();
2113 KABC::Addressee::List::Iterator it; 2113 KABC::Addressee::List::Iterator it;
2114 for ( it = list.begin(); it != list.end(); ++it ) { 2114 for ( it = list.begin(); it != list.end(); ++it ) {
2115 2115
2116 if ( (*it).removeVoice() ) 2116 if ( (*it).removeVoice() )
2117 contactModified((*it) ); 2117 contactModified((*it) );
2118 } 2118 }
2119} 2119}
2120 2120
2121 2121
2122 2122
2123void KABCore::clipboardDataChanged() 2123void KABCore::clipboardDataChanged()
2124{ 2124{
2125 2125
2126 if ( mReadWrite ) 2126 if ( mReadWrite )
2127 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2127 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2128 2128
2129} 2129}
2130 2130
2131void KABCore::updateActionMenu() 2131void KABCore::updateActionMenu()
2132{ 2132{
2133 UndoStack *undo = UndoStack::instance(); 2133 UndoStack *undo = UndoStack::instance();
2134 RedoStack *redo = RedoStack::instance(); 2134 RedoStack *redo = RedoStack::instance();
2135 2135
2136 if ( undo->isEmpty() ) 2136 if ( undo->isEmpty() )
2137 mActionUndo->setText( i18n( "Undo" ) ); 2137 mActionUndo->setText( i18n( "Undo" ) );
2138 else 2138 else
2139 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2139 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2140 2140
2141 mActionUndo->setEnabled( !undo->isEmpty() ); 2141 mActionUndo->setEnabled( !undo->isEmpty() );
2142 2142
2143 if ( !redo->top() ) 2143 if ( !redo->top() )
2144 mActionRedo->setText( i18n( "Redo" ) ); 2144 mActionRedo->setText( i18n( "Redo" ) );
2145 else 2145 else
2146 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2146 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2147 2147
2148 mActionRedo->setEnabled( !redo->isEmpty() ); 2148 mActionRedo->setEnabled( !redo->isEmpty() );
2149} 2149}
2150 2150
2151void KABCore::configureKeyBindings() 2151void KABCore::configureKeyBindings()
2152{ 2152{
2153#ifndef KAB_EMBEDDED 2153#ifndef KAB_EMBEDDED
2154 KKeyDialog::configure( actionCollection(), true ); 2154 KKeyDialog::configure( actionCollection(), true );
2155#else //KAB_EMBEDDED 2155#else //KAB_EMBEDDED
2156 qDebug("KABCore::configureKeyBindings() not implemented"); 2156 qDebug("KABCore::configureKeyBindings() not implemented");
2157#endif //KAB_EMBEDDED 2157#endif //KAB_EMBEDDED
2158} 2158}
2159 2159
2160#ifdef KAB_EMBEDDED 2160#ifdef KAB_EMBEDDED
2161void KABCore::configureResources() 2161void KABCore::configureResources()
2162{ 2162{
2163 KRES::KCMKResources dlg( this, "" , 0 ); 2163 KRES::KCMKResources dlg( this, "" , 0 );
2164 2164
2165 if ( !dlg.exec() ) 2165 if ( !dlg.exec() )
2166 return; 2166 return;
2167 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2167 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2168} 2168}
2169#endif //KAB_EMBEDDED 2169#endif //KAB_EMBEDDED
2170 2170
2171 2171
2172/* this method will be called through the QCop interface from Ko/Pi to select addresses 2172/* this method will be called through the QCop interface from Ko/Pi to select addresses
2173 * for the attendees list of an event. 2173 * for the attendees list of an event.
2174 */ 2174 */
2175void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2175void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2176{ 2176{
2177 QStringList nameList; 2177 QStringList nameList;
2178 QStringList emailList; 2178 QStringList emailList;
2179 QStringList uidList; 2179 QStringList uidList;
2180 2180
2181 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2181 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2182 uint i=0; 2182 uint i=0;
2183 for (i=0; i < list.count(); i++) 2183 for (i=0; i < list.count(); i++)
2184 { 2184 {
2185 nameList.append(list[i].realName()); 2185 nameList.append(list[i].realName());
2186 emailList.append(list[i].preferredEmail()); 2186 emailList.append(list[i].preferredEmail());
2187 uidList.append(list[i].uid()); 2187 uidList.append(list[i].uid());
2188 } 2188 }
2189 2189
2190 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2190 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2191 2191
2192} 2192}
2193 2193
2194/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2194/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2195 * to put them into the calendar. 2195 * to put them into the calendar.
2196 */ 2196 */
2197void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2197void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2198{ 2198{
2199 // qDebug("KABCore::requestForBirthdayList"); 2199 // qDebug("KABCore::requestForBirthdayList");
2200 QStringList birthdayList; 2200 QStringList birthdayList;
2201 QStringList anniversaryList; 2201 QStringList anniversaryList;
2202 QStringList realNameList; 2202 QStringList realNameList;
2203 QStringList preferredEmailList; 2203 QStringList preferredEmailList;
2204 QStringList assembledNameList; 2204 QStringList assembledNameList;
2205 QStringList uidList; 2205 QStringList uidList;
2206 2206
2207 KABC::AddressBook::Iterator it; 2207 KABC::AddressBook::Iterator it;
2208 2208
2209 int count = 0; 2209 int count = 0;
2210 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2210 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2211 ++count; 2211 ++count;
2212 } 2212 }
2213 QProgressBar bar(count,0 ); 2213 QProgressBar bar(count,0 );
2214 int w = 300; 2214 int w = 300;
2215 if ( QApplication::desktop()->width() < 320 ) 2215 if ( QApplication::desktop()->width() < 320 )
2216 w = 220; 2216 w = 220;
2217 int h = bar.sizeHint().height() ; 2217 int h = bar.sizeHint().height() ;
2218 int dw = QApplication::desktop()->width(); 2218 int dw = QApplication::desktop()->width();
2219 int dh = QApplication::desktop()->height(); 2219 int dh = QApplication::desktop()->height();
2220 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2220 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2221 bar.show(); 2221 bar.show();
2222 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2222 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2223 qApp->processEvents(); 2223 qApp->processEvents();
2224 2224
2225 QDate bday; 2225 QDate bday;
2226 QString anni; 2226 QString anni;
2227 QString formattedbday; 2227 QString formattedbday;
2228 2228
2229 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2229 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2230 { 2230 {
2231 if ( ! bar.isVisible() ) 2231 if ( ! bar.isVisible() )
2232 return; 2232 return;
2233 bar.setProgress( count++ ); 2233 bar.setProgress( count++ );
2234 qApp->processEvents(); 2234 qApp->processEvents();
2235 bday = (*it).birthday().date(); 2235 bday = (*it).birthday().date();
2236 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2236 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2237 2237
2238 if ( bday.isValid() || !anni.isEmpty()) 2238 if ( bday.isValid() || !anni.isEmpty())
2239 { 2239 {
2240 if (bday.isValid()) 2240 if (bday.isValid())
2241 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2241 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2242 else 2242 else
2243 formattedbday = "NOTVALID"; 2243 formattedbday = "NOTVALID";
2244 if (anni.isEmpty()) 2244 if (anni.isEmpty())
2245 anni = "INVALID"; 2245 anni = "INVALID";
2246 2246
2247 birthdayList.append(formattedbday); 2247 birthdayList.append(formattedbday);
2248 anniversaryList.append(anni); //should be ISODate 2248 anniversaryList.append(anni); //should be ISODate
2249 realNameList.append((*it).realName()); 2249 realNameList.append((*it).realName());
2250 preferredEmailList.append((*it).preferredEmail()); 2250 preferredEmailList.append((*it).preferredEmail());
2251 assembledNameList.append((*it).assembledName()); 2251 assembledNameList.append((*it).assembledName());
2252 uidList.append((*it).uid()); 2252 uidList.append((*it).uid());
2253 2253
2254 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2254 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2255 } 2255 }
2256 } 2256 }
2257 2257
2258 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2258 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2259 2259
2260} 2260}
2261 2261
2262/* this method will be called through the QCop interface from other apps to show details of a contact. 2262/* this method will be called through the QCop interface from other apps to show details of a contact.
2263 */ 2263 */
2264void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2264void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2265{ 2265{
2266 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2266 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2267 2267
2268 QString foundUid = QString::null; 2268 QString foundUid = QString::null;
2269 if ( ! uid.isEmpty() ) { 2269 if ( ! uid.isEmpty() ) {
2270 Addressee adrr = mAddressBook->findByUid( uid ); 2270 Addressee adrr = mAddressBook->findByUid( uid );
2271 if ( !adrr.isEmpty() ) { 2271 if ( !adrr.isEmpty() ) {
2272 foundUid = uid; 2272 foundUid = uid;
2273 } 2273 }
2274 if ( email == "sendbacklist" ) { 2274 if ( email == "sendbacklist" ) {
2275 //qDebug("ssssssssssssssssssssssend "); 2275 //qDebug("ssssssssssssssssssssssend ");
2276 QStringList nameList; 2276 QStringList nameList;
2277 QStringList emailList; 2277 QStringList emailList;
2278 QStringList uidList; 2278 QStringList uidList;
2279 nameList.append(adrr.realName()); 2279 nameList.append(adrr.realName());
2280 emailList = adrr.emails(); 2280 emailList = adrr.emails();
2281 uidList.append( adrr.preferredEmail()); 2281 uidList.append( adrr.preferredEmail());
2282 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2282 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2283 return; 2283 return;
2284 } 2284 }
2285 2285
2286 } 2286 }
2287 2287
2288 if ( email == "sendbacklist" ) 2288 if ( email == "sendbacklist" )
2289 return; 2289 return;
2290 if (foundUid.isEmpty()) 2290 if (foundUid.isEmpty())
2291 { 2291 {
2292 //find the uid of the person first 2292 //find the uid of the person first
2293 Addressee::List namelist; 2293 Addressee::List namelist;
2294 Addressee::List emaillist; 2294 Addressee::List emaillist;
2295 2295
2296 if (!name.isEmpty()) 2296 if (!name.isEmpty())
2297 namelist = mAddressBook->findByName( name ); 2297 namelist = mAddressBook->findByName( name );
2298 2298
2299 if (!email.isEmpty()) 2299 if (!email.isEmpty())
2300 emaillist = mAddressBook->findByEmail( email ); 2300 emaillist = mAddressBook->findByEmail( email );
2301 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2301 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2302 //check if we have a match in Namelist and Emaillist 2302 //check if we have a match in Namelist and Emaillist
2303 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2303 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2304 foundUid = emaillist[0].uid(); 2304 foundUid = emaillist[0].uid();
2305 } 2305 }
2306 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2306 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2307 foundUid = namelist[0].uid(); 2307 foundUid = namelist[0].uid();
2308 else 2308 else
2309 { 2309 {
2310 for (int i = 0; i < namelist.count(); i++) 2310 for (int i = 0; i < namelist.count(); i++)
2311 { 2311 {
2312 for (int j = 0; j < emaillist.count(); j++) 2312 for (int j = 0; j < emaillist.count(); j++)
2313 { 2313 {
2314 if (namelist[i] == emaillist[j]) 2314 if (namelist[i] == emaillist[j])
2315 { 2315 {
2316 foundUid = namelist[i].uid(); 2316 foundUid = namelist[i].uid();
2317 } 2317 }
2318 } 2318 }
2319 } 2319 }
2320 } 2320 }
2321 } 2321 }
2322 else 2322 else
2323 { 2323 {
2324 foundUid = uid; 2324 foundUid = uid;
2325 } 2325 }
2326 2326
2327 if (!foundUid.isEmpty()) 2327 if (!foundUid.isEmpty())
2328 { 2328 {
2329 2329
2330 // raise Ka/Pi if it is in the background 2330 // raise Ka/Pi if it is in the background
2331#ifndef DESKTOP_VERSION 2331#ifndef DESKTOP_VERSION
2332#ifndef KORG_NODCOP 2332#ifndef KORG_NODCOP
2333 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2333 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2334#endif 2334#endif
2335#endif 2335#endif
2336 2336
2337 mMainWindow->showMaximized(); 2337 mMainWindow->showMaximized();
2338 mMainWindow-> raise(); 2338 mMainWindow-> raise();
2339 2339
2340 mViewManager->setSelected( "", false); 2340 mViewManager->setSelected( "", false);
2341 mViewManager->refreshView( "" ); 2341 mViewManager->refreshView( "" );
2342 mViewManager->setSelected( foundUid, true ); 2342 mViewManager->setSelected( foundUid, true );
2343 mViewManager->refreshView( foundUid ); 2343 mViewManager->refreshView( foundUid );
2344 2344
2345 if ( !mMultipleViewsAtOnce ) 2345 if ( !mMultipleViewsAtOnce )
2346 { 2346 {
2347 setDetailsVisible( true ); 2347 setDetailsVisible( true );
2348 mActionDetails->setChecked(true); 2348 mActionDetails->setChecked(true);
2349 } 2349 }
2350 } 2350 }
2351} 2351}
2352 2352
2353void KABCore::whatsnew() 2353void KABCore::whatsnew()
2354{ 2354{
2355 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2355 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2356} 2356}
2357void KABCore::synchowto() 2357void KABCore::synchowto()
2358{ 2358{
2359 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2359 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2360} 2360}
2361void KABCore::kdesynchowto() 2361void KABCore::kdesynchowto()
2362{ 2362{
2363 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2363 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2364} 2364}
2365void KABCore::multisynchowto() 2365void KABCore::multisynchowto()
2366{ 2366{
2367 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2367 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2368} 2368}
2369void KABCore::faq() 2369void KABCore::faq()
2370{ 2370{
2371 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2371 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2372} 2372}
2373 2373
2374#include <libkcal/syncdefines.h> 2374#include <libkcal/syncdefines.h>
2375 2375
2376KABC::Addressee KABCore::getLastSyncAddressee() 2376KABC::Addressee KABCore::getLastSyncAddressee()
2377{ 2377{
2378 Addressee lse; 2378 Addressee lse;
2379 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2379 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2380 2380
2381 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2381 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2382 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2382 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2383 if (lse.isEmpty()) { 2383 if (lse.isEmpty()) {
2384 qDebug("Creating new last-syncAddressee "); 2384 qDebug("Creating new last-syncAddressee ");
2385 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2385 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2386 QString sum = ""; 2386 QString sum = "";
2387 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2387 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2388 sum = "E: "; 2388 sum = "E: ";
2389 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2389 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2390 lse.setRevision( mLastAddressbookSync ); 2390 lse.setRevision( mLastAddressbookSync );
2391 lse.setCategories( i18n("SyncEvent") ); 2391 lse.setCategories( i18n("SyncEvent") );
2392 mAddressBook->insertAddressee( lse ); 2392 mAddressBook->insertAddressee( lse );
2393 } 2393 }
2394 return lse; 2394 return lse;
2395} 2395}
2396int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2396int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2397{ 2397{
2398 2398
2399 //void setZaurusId(int id); 2399 //void setZaurusId(int id);
2400 // int zaurusId() const; 2400 // int zaurusId() const;
2401 // void setZaurusUid(int id); 2401 // void setZaurusUid(int id);
2402 // int zaurusUid() const; 2402 // int zaurusUid() const;
2403 // void setZaurusStat(int id); 2403 // void setZaurusStat(int id);
2404 // int zaurusStat() const; 2404 // int zaurusStat() const;
2405 // 0 equal 2405 // 0 equal
2406 // 1 take local 2406 // 1 take local
2407 // 2 take remote 2407 // 2 take remote
2408 // 3 cancel 2408 // 3 cancel
2409 QDateTime lastSync = mLastAddressbookSync; 2409 QDateTime lastSync = mLastAddressbookSync;
2410 QDateTime localMod = local->revision(); 2410 QDateTime localMod = local->revision();
2411 QDateTime remoteMod = remote->revision(); 2411 QDateTime remoteMod = remote->revision();
2412 2412
2413 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2413 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2414 2414
2415 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2415 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2416 bool remCh, locCh; 2416 bool remCh, locCh;
2417 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2417 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2418 2418
2419 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2419 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2420 locCh = ( localMod > mLastAddressbookSync ); 2420 locCh = ( localMod > mLastAddressbookSync );
2421 if ( !remCh && ! locCh ) { 2421 if ( !remCh && ! locCh ) {
2422 //qDebug("both not changed "); 2422 //qDebug("both not changed ");
2423 lastSync = localMod.addDays(1); 2423 lastSync = localMod.addDays(1);
2424 if ( mode <= SYNC_PREF_ASK ) 2424 if ( mode <= SYNC_PREF_ASK )
2425 return 0; 2425 return 0;
2426 } else { 2426 } else {
2427 if ( locCh ) { 2427 if ( locCh ) {
2428 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2428 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2429 lastSync = localMod.addDays( -1 ); 2429 lastSync = localMod.addDays( -1 );
2430 if ( !remCh ) 2430 if ( !remCh )
2431 remoteMod =( lastSync.addDays( -1 ) ); 2431 remoteMod =( lastSync.addDays( -1 ) );
2432 } else { 2432 } else {
2433 //qDebug(" not loc changed "); 2433 //qDebug(" not loc changed ");
2434 lastSync = localMod.addDays( 1 ); 2434 lastSync = localMod.addDays( 1 );
2435 if ( remCh ) 2435 if ( remCh )
2436 remoteMod =( lastSync.addDays( 1 ) ); 2436 remoteMod =( lastSync.addDays( 1 ) );
2437 2437
2438 } 2438 }
2439 } 2439 }
2440 full = true; 2440 full = true;
2441 if ( mode < SYNC_PREF_ASK ) 2441 if ( mode < SYNC_PREF_ASK )
2442 mode = SYNC_PREF_ASK; 2442 mode = SYNC_PREF_ASK;
2443 } else { 2443 } else {
2444 if ( localMod == remoteMod ) 2444 if ( localMod == remoteMod )
2445 return 0; 2445 return 0;
2446 2446
2447 } 2447 }
2448 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 2448 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
2449 2449
2450 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); 2450 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
2451 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 2451 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
2452 //full = true; //debug only 2452 //full = true; //debug only
2453 if ( full ) { 2453 if ( full ) {
2454 bool equ = ( (*local) == (*remote) ); 2454 bool equ = ( (*local) == (*remote) );
2455 if ( equ ) { 2455 if ( equ ) {
2456 //qDebug("equal "); 2456 //qDebug("equal ");
2457 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2457 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2458 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2458 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2459 } 2459 }
2460 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2460 if ( mode < SYNC_PREF_FORCE_LOCAL )
2461 return 0; 2461 return 0;
2462 2462
2463 }//else //debug only 2463 }//else //debug only
2464 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2464 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2465 } 2465 }
2466 int result; 2466 int result;
2467 bool localIsNew; 2467 bool localIsNew;
2468 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2468 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
2469 2469
2470 if ( full && mode < SYNC_PREF_NEWEST ) 2470 if ( full && mode < SYNC_PREF_NEWEST )
2471 mode = SYNC_PREF_ASK; 2471 mode = SYNC_PREF_ASK;
2472 2472
2473 switch( mode ) { 2473 switch( mode ) {
2474 case SYNC_PREF_LOCAL: 2474 case SYNC_PREF_LOCAL:
2475 if ( lastSync > remoteMod ) 2475 if ( lastSync > remoteMod )
2476 return 1; 2476 return 1;
2477 if ( lastSync > localMod ) 2477 if ( lastSync > localMod )
2478 return 2; 2478 return 2;
2479 return 1; 2479 return 1;
2480 break; 2480 break;
2481 case SYNC_PREF_REMOTE: 2481 case SYNC_PREF_REMOTE:
2482 if ( lastSync > remoteMod ) 2482 if ( lastSync > remoteMod )
2483 return 1; 2483 return 1;
2484 if ( lastSync > localMod ) 2484 if ( lastSync > localMod )
2485 return 2; 2485 return 2;
2486 return 2; 2486 return 2;
2487 break; 2487 break;
2488 case SYNC_PREF_NEWEST: 2488 case SYNC_PREF_NEWEST:
2489 if ( localMod > remoteMod ) 2489 if ( localMod > remoteMod )
2490 return 1; 2490 return 1;
2491 else 2491 else
2492 return 2; 2492 return 2;
2493 break; 2493 break;
2494 case SYNC_PREF_ASK: 2494 case SYNC_PREF_ASK:
2495 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2495 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2496 if ( lastSync > remoteMod ) 2496 if ( lastSync > remoteMod )
2497 return 1; 2497 return 1;
2498 if ( lastSync > localMod ) 2498 if ( lastSync > localMod )
2499 return 2; 2499 return 2;
2500 localIsNew = localMod >= remoteMod; 2500 localIsNew = localMod >= remoteMod;
2501 //qDebug("conflict! ************************************** "); 2501 //qDebug("conflict! ************************************** ");
2502 { 2502 {
2503 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2503 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2504 result = acd.executeD(localIsNew); 2504 result = acd.executeD(localIsNew);
2505 return result; 2505 return result;
2506 } 2506 }
2507 break; 2507 break;
2508 case SYNC_PREF_FORCE_LOCAL: 2508 case SYNC_PREF_FORCE_LOCAL:
2509 return 1; 2509 return 1;
2510 break; 2510 break;
2511 case SYNC_PREF_FORCE_REMOTE: 2511 case SYNC_PREF_FORCE_REMOTE:
2512 return 2; 2512 return 2;
2513 break; 2513 break;
2514 2514
2515 default: 2515 default:
2516 // SYNC_PREF_TAKE_BOTH not implemented 2516 // SYNC_PREF_TAKE_BOTH not implemented
2517 break; 2517 break;
2518 } 2518 }
2519 return 0; 2519 return 0;
2520} 2520}
2521 2521
2522 2522
2523bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2523bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2524{ 2524{
2525 bool syncOK = true; 2525 bool syncOK = true;
2526 int addedAddressee = 0; 2526 int addedAddressee = 0;
2527 int addedAddresseeR = 0; 2527 int addedAddresseeR = 0;
2528 int deletedAddresseeR = 0; 2528 int deletedAddresseeR = 0;
2529 int deletedAddresseeL = 0; 2529 int deletedAddresseeL = 0;
2530 int changedLocal = 0; 2530 int changedLocal = 0;
2531 int changedRemote = 0; 2531 int changedRemote = 0;
2532 2532
2533 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2533 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2534 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2534 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2535 2535
2536 //QPtrList<Addressee> el = local->rawAddressees(); 2536 //QPtrList<Addressee> el = local->rawAddressees();
2537 Addressee addresseeR; 2537 Addressee addresseeR;
2538 QString uid; 2538 QString uid;
2539 int take; 2539 int take;
2540 Addressee addresseeL; 2540 Addressee addresseeL;
2541 Addressee addresseeRSync; 2541 Addressee addresseeRSync;
2542 Addressee addresseeLSync; 2542 Addressee addresseeLSync;
2543 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2543 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2544 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2544 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2545 bool fullDateRange = false; 2545 bool fullDateRange = false;
2546 local->resetTempSyncStat(); 2546 local->resetTempSyncStat();
2547 mLastAddressbookSync = QDateTime::currentDateTime(); 2547 mLastAddressbookSync = QDateTime::currentDateTime();
2548 if ( syncManager->syncWithDesktop() ) { 2548 if ( syncManager->syncWithDesktop() ) {
2549 // remote->removeSyncInfo( QString());//remove all info 2549 // remote->removeSyncInfo( QString());//remove all info
2550 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 2550 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
2551 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; 2551 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
2552 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); 2552 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
2553 } else { 2553 } else {
2554 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 2554 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
2555 } 2555 }
2556 } 2556 }
2557 QDateTime modifiedCalendar = mLastAddressbookSync; 2557 QDateTime modifiedCalendar = mLastAddressbookSync;
2558 addresseeLSync = getLastSyncAddressee(); 2558 addresseeLSync = getLastSyncAddressee();
2559 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2559 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
2560 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2560 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2561 if ( !addresseeR.isEmpty() ) { 2561 if ( !addresseeR.isEmpty() ) {
2562 addresseeRSync = addresseeR; 2562 addresseeRSync = addresseeR;
2563 remote->removeAddressee(addresseeR ); 2563 remote->removeAddressee(addresseeR );
2564 2564
2565 } else { 2565 } else {
2566 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2566 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2567 addresseeRSync = addresseeLSync ; 2567 addresseeRSync = addresseeLSync ;
2568 } else { 2568 } else {
2569 qDebug("FULLDATE 1"); 2569 qDebug("FULLDATE 1");
2570 fullDateRange = true; 2570 fullDateRange = true;
2571 Addressee newAdd; 2571 Addressee newAdd;
2572 addresseeRSync = newAdd; 2572 addresseeRSync = newAdd;
2573 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2573 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2574 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2574 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2575 addresseeRSync.setRevision( mLastAddressbookSync ); 2575 addresseeRSync.setRevision( mLastAddressbookSync );
2576 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2576 addresseeRSync.setCategories( i18n("SyncAddressee") );
2577 } 2577 }
2578 } 2578 }
2579 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2579 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2580 qDebug("FULLDATE 2"); 2580 qDebug("FULLDATE 2");
2581 fullDateRange = true; 2581 fullDateRange = true;
2582 } 2582 }
2583 if ( ! fullDateRange ) { 2583 if ( ! fullDateRange ) {
2584 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2584 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2585 2585
2586 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2586 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2587 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2587 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2588 fullDateRange = true; 2588 fullDateRange = true;
2589 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2589 qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2590 } 2590 }
2591 } 2591 }
2592 // fullDateRange = true; // debug only! 2592 // fullDateRange = true; // debug only!
2593 if ( fullDateRange ) 2593 if ( fullDateRange )
2594 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2594 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2595 else 2595 else
2596 mLastAddressbookSync = addresseeLSync.revision(); 2596 mLastAddressbookSync = addresseeLSync.revision();
2597 // for resyncing if own file has changed 2597 // for resyncing if own file has changed
2598 // PENDING fixme later when implemented 2598 // PENDING fixme later when implemented
2599#if 0 2599#if 0
2600 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2600 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2601 mLastAddressbookSync = loadedFileVersion; 2601 mLastAddressbookSync = loadedFileVersion;
2602 qDebug("setting mLastAddressbookSync "); 2602 qDebug("setting mLastAddressbookSync ");
2603 } 2603 }
2604#endif 2604#endif
2605 2605
2606 //qDebug("*************************** "); 2606 //qDebug("*************************** ");
2607 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2607 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2608 QStringList er = remote->uidList(); 2608 QStringList er = remote->uidList();
2609 Addressee inR ;//= er.first(); 2609 Addressee inR ;//= er.first();
2610 Addressee inL; 2610 Addressee inL;
2611 2611
2612 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2612 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2613 2613
2614 int modulo = (er.count()/10)+1; 2614 int modulo = (er.count()/10)+1;
2615 int incCounter = 0; 2615 int incCounter = 0;
2616 while ( incCounter < er.count()) { 2616 while ( incCounter < er.count()) {
2617 if (syncManager->isProgressBarCanceled()) 2617 if (syncManager->isProgressBarCanceled())
2618 return false; 2618 return false;
2619 if ( incCounter % modulo == 0 ) 2619 if ( incCounter % modulo == 0 )
2620 syncManager->showProgressBar(incCounter); 2620 syncManager->showProgressBar(incCounter);
2621 2621
2622 uid = er[ incCounter ]; 2622 uid = er[ incCounter ];
2623 bool skipIncidence = false; 2623 bool skipIncidence = false;
2624 if ( uid.left(19) == QString("last-syncAddressee-") ) 2624 if ( uid.left(19) == QString("last-syncAddressee-") )
2625 skipIncidence = true; 2625 skipIncidence = true;
2626 QString idS,OidS; 2626 QString idS,OidS;
2627 qApp->processEvents(); 2627 qApp->processEvents();
2628 if ( !skipIncidence ) { 2628 if ( !skipIncidence ) {
2629 inL = local->findByUid( uid ); 2629 inL = local->findByUid( uid );
2630 inR = remote->findByUid( uid ); 2630 inR = remote->findByUid( uid );
2631 //inL.setResource( 0 ); 2631 //inL.setResource( 0 );
2632 //inR.setResource( 0 ); 2632 //inR.setResource( 0 );
2633 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2633 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2634 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2634 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2635 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { 2635 if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
2636 //qDebug("take %d %s ", take, inL.summary().latin1()); 2636 //qDebug("take %d %s ", take, inL.summary().latin1());
2637 if ( take == 3 ) 2637 if ( take == 3 )
2638 return false; 2638 return false;
2639 if ( take == 1 ) {// take local ********************** 2639 if ( take == 1 ) {// take local **********************
2640 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2640 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2641 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2641 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2642 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2642 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2643 local->insertAddressee( inL, false ); 2643 local->insertAddressee( inL, false );
2644 idS = inR.externalUID(); 2644 idS = inR.externalUID();
2645 OidS = inR.originalExternalUID(); 2645 OidS = inR.originalExternalUID();
2646 } 2646 }
2647 else 2647 else
2648 idS = inR.IDStr(); 2648 idS = inR.IDStr();
2649 remote->removeAddressee( inR ); 2649 remote->removeAddressee( inR );
2650 inR = inL; 2650 inR = inL;
2651 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2651 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2652 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2652 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2653 inR.setOriginalExternalUID( OidS ); 2653 inR.setOriginalExternalUID( OidS );
2654 inR.setExternalUID( idS ); 2654 inR.setExternalUID( idS );
2655 if ( syncManager->syncWithDesktop() ) 2655 if ( syncManager->syncWithDesktop() )
2656 inR.setIDStr("changed" ); 2656 inR.setIDStr("changed" );
2657 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); 2657 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" );
2658 } else { 2658 } else {
2659 inR.setIDStr( idS ); 2659 inR.setIDStr( idS );
2660 } 2660 }
2661 inR.setResource( 0 ); 2661 inR.setResource( 0 );
2662 remote->insertAddressee( inR , false); 2662 remote->insertAddressee( inR , false);
2663 ++changedRemote; 2663 ++changedRemote;
2664 } else { // take == 2 take remote ********************** 2664 } else { // take == 2 take remote **********************
2665 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2665 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2666 if ( inR.revision().date().year() < 2004 ) 2666 if ( inR.revision().date().year() < 2004 )
2667 inR.setRevision( modifiedCalendar ); 2667 inR.setRevision( modifiedCalendar );
2668 } 2668 }
2669 idS = inL.IDStr(); 2669 idS = inL.IDStr();
2670 local->removeAddressee( inL ); 2670 local->removeAddressee( inL );
2671 inL = inR; 2671 inL = inR;
2672 inL.setIDStr( idS ); 2672 inL.setIDStr( idS );
2673 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2673 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2674 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2674 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2675 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2675 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2676 } 2676 }
2677 inL.setResource( 0 ); 2677 inL.setResource( 0 );
2678 local->insertAddressee( inL , false ); 2678 local->insertAddressee( inL , false );
2679 ++changedLocal; 2679 ++changedLocal;
2680 } 2680 }
2681 } 2681 }
2682 } 2682 }
2683 } else { // no conflict ********** add or delete remote 2683 } else { // no conflict ********** add or delete remote
2684 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2684 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2685 QString des = addresseeLSync.note(); 2685 QString des = addresseeLSync.note();
2686 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 2686 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2687 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2687 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2688 remote->insertAddressee( inR, false ); 2688 remote->insertAddressee( inR, false );
2689 ++deletedAddresseeR; 2689 ++deletedAddresseeR;
2690 } else { 2690 } else {
2691 inR.setRevision( modifiedCalendar ); 2691 inR.setRevision( modifiedCalendar );
2692 remote->insertAddressee( inR, false ); 2692 remote->insertAddressee( inR, false );
2693 inL = inR; 2693 inL = inR;
2694 inL.setIDStr( ":" ); 2694 inL.setIDStr( ":" );
2695 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2695 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2696 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2696 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2697 inL.setResource( 0 ); 2697 inL.setResource( 0 );
2698 local->insertAddressee( inL , false); 2698 local->insertAddressee( inL , false);
2699 ++addedAddressee; 2699 ++addedAddressee;
2700 } 2700 }
2701 } else { 2701 } else {
2702 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 2702 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
2703 inR.setRevision( modifiedCalendar ); 2703 inR.setRevision( modifiedCalendar );
2704 remote->insertAddressee( inR, false ); 2704 remote->insertAddressee( inR, false );
2705 inR.setResource( 0 ); 2705 inR.setResource( 0 );
2706 local->insertAddressee( inR, false ); 2706 local->insertAddressee( inR, false );
2707 ++addedAddressee; 2707 ++addedAddressee;
2708 } else { 2708 } else {
2709 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 2709 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
2710 remote->removeAddressee( inR ); 2710 remote->removeAddressee( inR );
2711 ++deletedAddresseeR; 2711 ++deletedAddresseeR;
2712 } 2712 }
2713 } 2713 }
2714 } 2714 }
2715 } 2715 }
2716 ++incCounter; 2716 ++incCounter;
2717 } 2717 }
2718 er.clear(); 2718 er.clear();
2719 QStringList el = local->uidList(); 2719 QStringList el = local->uidList();
2720 modulo = (el.count()/10)+1; 2720 modulo = (el.count()/10)+1;
2721 2721
2722 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 2722 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2723 incCounter = 0; 2723 incCounter = 0;
2724 while ( incCounter < el.count()) { 2724 while ( incCounter < el.count()) {
2725 qApp->processEvents(); 2725 qApp->processEvents();
2726 if (syncManager->isProgressBarCanceled()) 2726 if (syncManager->isProgressBarCanceled())
2727 return false; 2727 return false;
2728 if ( incCounter % modulo == 0 ) 2728 if ( incCounter % modulo == 0 )
2729 syncManager->showProgressBar(incCounter); 2729 syncManager->showProgressBar(incCounter);
2730 uid = el[ incCounter ]; 2730 uid = el[ incCounter ];
2731 bool skipIncidence = false; 2731 bool skipIncidence = false;
2732 if ( uid.left(19) == QString("last-syncAddressee-") ) 2732 if ( uid.left(19) == QString("last-syncAddressee-") )
2733 skipIncidence = true; 2733 skipIncidence = true;
2734 if ( !skipIncidence ) { 2734 if ( !skipIncidence ) {
2735 inL = local->findByUid( uid ); 2735 inL = local->findByUid( uid );
2736 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2736 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2737 inR = remote->findByUid( uid ); 2737 inR = remote->findByUid( uid );
2738 if ( inR.isEmpty() ) { / no conflict ********** add or delete local 2738 if ( inR.isEmpty() ) { // no conflict ********** add or delete local
2739 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2739 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2740 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2740 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2741 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2741 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2742 local->removeAddressee( inL ); 2742 local->removeAddressee( inL );
2743 ++deletedAddresseeL; 2743 ++deletedAddresseeL;
2744 } else { 2744 } else {
2745 if ( ! syncManager->mWriteBackExistingOnly ) { 2745 if ( ! syncManager->mWriteBackExistingOnly ) {
2746 inL.removeID(mCurrentSyncDevice ); 2746 inL.removeID(mCurrentSyncDevice );
2747 ++addedAddresseeR; 2747 ++addedAddresseeR;
2748 inL.setRevision( modifiedCalendar ); 2748 inL.setRevision( modifiedCalendar );
2749 local->insertAddressee( inL, false ); 2749 local->insertAddressee( inL, false );
2750 inR = inL; 2750 inR = inL;
2751 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2751 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2752 inR.setResource( 0 ); 2752 inR.setResource( 0 );
2753 remote->insertAddressee( inR, false ); 2753 remote->insertAddressee( inR, false );
2754 } 2754 }
2755 } 2755 }
2756 } else { 2756 } else {
2757 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2757 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2758 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2758 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2759 local->removeAddressee( inL ); 2759 local->removeAddressee( inL );
2760 ++deletedAddresseeL; 2760 ++deletedAddresseeL;
2761 } else { 2761 } else {
2762 if ( ! syncManager->mWriteBackExistingOnly ) { 2762 if ( ! syncManager->mWriteBackExistingOnly ) {
2763 ++addedAddresseeR; 2763 ++addedAddresseeR;
2764 inL.setRevision( modifiedCalendar ); 2764 inL.setRevision( modifiedCalendar );
2765 local->insertAddressee( inL, false ); 2765 local->insertAddressee( inL, false );
2766 inR = inL; 2766 inR = inL;
2767 inR.setIDStr( ":" ); 2767 inR.setIDStr( ":" );
2768 inR.setResource( 0 ); 2768 inR.setResource( 0 );
2769 remote->insertAddressee( inR, false ); 2769 remote->insertAddressee( inR, false );
2770 } 2770 }
2771 } 2771 }
2772 } 2772 }
2773 } 2773 }
2774 } 2774 }
2775 } 2775 }
2776 ++incCounter; 2776 ++incCounter;
2777 } 2777 }
2778 el.clear(); 2778 el.clear();
2779 syncManager->hideProgressBar(); 2779 syncManager->hideProgressBar();
2780 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2780 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2781 // get rid of micro seconds 2781 // get rid of micro seconds
2782 QTime t = mLastAddressbookSync.time(); 2782 QTime t = mLastAddressbookSync.time();
2783 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2783 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2784 addresseeLSync.setRevision( mLastAddressbookSync ); 2784 addresseeLSync.setRevision( mLastAddressbookSync );
2785 addresseeRSync.setRevision( mLastAddressbookSync ); 2785 addresseeRSync.setRevision( mLastAddressbookSync );
2786 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2786 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2787 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2787 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2788 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2788 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2789 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2789 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2790 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2790 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2791 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2791 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2792 addresseeRSync.setNote( "" ) ; 2792 addresseeRSync.setNote( "" ) ;
2793 addresseeLSync.setNote( "" ); 2793 addresseeLSync.setNote( "" );
2794 2794
2795 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2795 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2796 remote->insertAddressee( addresseeRSync, false ); 2796 remote->insertAddressee( addresseeRSync, false );
2797 local->insertAddressee( addresseeLSync, false ); 2797 local->insertAddressee( addresseeLSync, false );
2798 QString mes; 2798 QString mes;
2799 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2799 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2800 qDebug( mes ); 2800 qDebug( mes );
2801 if ( syncManager->mShowSyncSummary ) { 2801 if ( syncManager->mShowSyncSummary ) {
2802 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 2802 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
2803 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 2803 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
2804 qDebug("cancelled "); 2804 qDebug("cancelled ");
2805 return false; 2805 return false;
2806 } 2806 }
2807 } 2807 }
2808 return syncOK; 2808 return syncOK;
2809} 2809}
2810 2810
2811 2811
2812//this is a overwritten callbackmethods from the syncinterface 2812//this is a overwritten callbackmethods from the syncinterface
2813bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2813bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2814{ 2814{
2815 2815
2816 //pending prepare addresseeview for output 2816 //pending prepare addresseeview for output
2817 //pending detect, if remote file has REV field. if not switch to external sync 2817 //pending detect, if remote file has REV field. if not switch to external sync
2818 mGlobalSyncMode = SYNC_MODE_NORMAL; 2818 mGlobalSyncMode = SYNC_MODE_NORMAL;
2819 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2819 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2820 2820
2821 AddressBook abLocal(filename,"syncContact"); 2821 AddressBook abLocal(filename,"syncContact");
2822 bool syncOK = false; 2822 bool syncOK = false;
2823 if ( abLocal.load() ) { 2823 if ( abLocal.load() ) {
2824 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2824 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2825 bool external = false; 2825 bool external = false;
2826 bool isXML = false; 2826 bool isXML = false;
2827 if ( filename.right(4) == ".xml") { 2827 if ( filename.right(4) == ".xml") {
2828 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2828 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2829 isXML = true; 2829 isXML = true;
2830 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2830 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2831 } else { 2831 } else {
2832 external = !manager->mIsKapiFile; 2832 external = !manager->mIsKapiFile;
2833 if ( external ) { 2833 if ( external ) {
2834 qDebug("Setting vcf mode to external "); 2834 qDebug("Setting vcf mode to external ");
2835 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2835 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2836 AddressBook::Iterator it; 2836 AddressBook::Iterator it;
2837 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2837 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2838 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2838 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2839 (*it).computeCsum( mCurrentSyncDevice ); 2839 (*it).computeCsum( mCurrentSyncDevice );
2840 } 2840 }
2841 } 2841 }
2842 } 2842 }
2843 //AddressBook::Iterator it; 2843 //AddressBook::Iterator it;
2844 //QStringList vcards; 2844 //QStringList vcards;
2845 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2845 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2846 // qDebug("Name %s ", (*it).familyName().latin1()); 2846 // qDebug("Name %s ", (*it).familyName().latin1());
2847 //} 2847 //}
2848 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2848 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2849 if ( syncOK ) { 2849 if ( syncOK ) {
2850 if ( syncManager->mWriteBackFile ) 2850 if ( syncManager->mWriteBackFile )
2851 { 2851 {
2852 if ( external ) 2852 if ( external )
2853 abLocal.removeSyncAddressees( !isXML); 2853 abLocal.removeSyncAddressees( !isXML);
2854 qDebug("Saving remote AB "); 2854 qDebug("Saving remote AB ");
2855 if ( ! abLocal.saveAB()) 2855 if ( ! abLocal.saveAB())
2856 qDebug("Error writing back AB to file "); 2856 qDebug("Error writing back AB to file ");
2857 if ( external ) { 2857 if ( external ) {
2858 // afterwrite processing 2858 // afterwrite processing
2859 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 2859 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
2860 } 2860 }
2861 } 2861 }
2862 } 2862 }
2863 setModified(); 2863 setModified();
2864 2864
2865 } 2865 }
2866 if ( syncOK ) 2866 if ( syncOK )
2867 mViewManager->refreshView(); 2867 mViewManager->refreshView();
2868 return syncOK; 2868 return syncOK;
2869 2869
2870} 2870}
2871void KABCore::removeSyncInfo( QString syncProfile) 2871void KABCore::removeSyncInfo( QString syncProfile)
2872{ 2872{
2873 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 2873 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
2874 mAddressBook->removeSyncInfo( syncProfile ); 2874 mAddressBook->removeSyncInfo( syncProfile );
2875 setModified(); 2875 setModified();
2876} 2876}
2877 2877
2878 2878
2879//this is a overwritten callbackmethods from the syncinterface 2879//this is a overwritten callbackmethods from the syncinterface
2880bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2880bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2881{ 2881{
2882 if ( resource == "phone" ) 2882 if ( resource == "phone" )
2883 return syncPhone(); 2883 return syncPhone();
2884 disableBR( true ); 2884 disableBR( true );
2885 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2885 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2886 2886
2887 AddressBook abLocal( resource,"syncContact"); 2887 AddressBook abLocal( resource,"syncContact");
2888 bool syncOK = false; 2888 bool syncOK = false;
2889 if ( abLocal.load() ) { 2889 if ( abLocal.load() ) {
2890 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2890 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2891 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2891 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2892 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 2892 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
2893 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2893 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2894 if ( syncOK ) { 2894 if ( syncOK ) {
2895 if ( syncManager->mWriteBackFile ) { 2895 if ( syncManager->mWriteBackFile ) {
2896 abLocal.removeSyncAddressees( false ); 2896 abLocal.removeSyncAddressees( false );
2897 abLocal.saveAB(); 2897 abLocal.saveAB();
2898 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 2898 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
2899 } 2899 }
2900 } else 2900 } else
2901 message( i18n("Sync cancelled or failed.") ); 2901 message( i18n("Sync cancelled or failed.") );
2902 setModified(); 2902 setModified();
2903 } 2903 }
2904 if ( syncOK ) 2904 if ( syncOK )
2905 mViewManager->refreshView(); 2905 mViewManager->refreshView();
2906 disableBR( false ); 2906 disableBR( false );
2907 return syncOK; 2907 return syncOK;
2908 2908
2909} 2909}
2910void KABCore::message( QString m ) 2910void KABCore::message( QString m )
2911{ 2911{
2912 topLevelWidget()->setCaption( m ); 2912 topLevelWidget()->setCaption( m );
2913 mMessageTimer->start( 15000, true ); 2913 mMessageTimer->start( 15000, true );
2914} 2914}
2915bool KABCore::syncPhone() 2915bool KABCore::syncPhone()
2916{ 2916{
2917 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2917 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2918 QString fileName = getPhoneFile(); 2918 QString fileName = getPhoneFile();
2919 if ( !PhoneAccess::readFromPhone( fileName) ) { 2919 if ( !PhoneAccess::readFromPhone( fileName) ) {
2920 message(i18n("Phone access failed!")); 2920 message(i18n("Phone access failed!"));
2921 return false; 2921 return false;
2922 } 2922 }
2923 AddressBook abLocal( fileName,"syncContact"); 2923 AddressBook abLocal( fileName,"syncContact");
2924 bool syncOK = false; 2924 bool syncOK = false;
2925 { 2925 {
2926 abLocal.importFromFile( fileName ); 2926 abLocal.importFromFile( fileName );
2927 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2927 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2928 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2928 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2929 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2929 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2930 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2930 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2931 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2931 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2932 if ( syncOK ) { 2932 if ( syncOK ) {
2933 if ( syncManager->mWriteBackFile ) { 2933 if ( syncManager->mWriteBackFile ) {
2934 abLocal.removeSyncAddressees( true ); 2934 abLocal.removeSyncAddressees( true );
2935 abLocal.saveABphone( fileName ); 2935 abLocal.saveABphone( fileName );
2936 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 2936 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
2937 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 2937 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2938 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 2938 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
2939 } 2939 }
2940 } 2940 }
2941 setModified(); 2941 setModified();
2942 } 2942 }
2943 if ( syncOK ) 2943 if ( syncOK )
2944 mViewManager->refreshView(); 2944 mViewManager->refreshView();
2945 return syncOK; 2945 return syncOK;
2946} 2946}
2947void KABCore::getFile( bool success ) 2947void KABCore::getFile( bool success )
2948{ 2948{
2949 if ( ! success ) { 2949 if ( ! success ) {
2950 message( i18n("Error receiving file. Nothing changed!") ); 2950 message( i18n("Error receiving file. Nothing changed!") );
2951 return; 2951 return;
2952 } 2952 }
2953 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 2953 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
2954 if ( count ) 2954 if ( count )
2955 setModified( true ); 2955 setModified( true );
2956 message( i18n("Pi-Sync successful!") ); 2956 message( i18n("Pi-Sync successful!") );
2957 mViewManager->refreshView(); 2957 mViewManager->refreshView();
2958} 2958}
2959void KABCore::syncFileRequest() 2959void KABCore::syncFileRequest()
2960{ 2960{
2961 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 2961 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
2962 syncManager->slotSyncMenu( 999 ); 2962 syncManager->slotSyncMenu( 999 );
2963 } 2963 }
2964 mAddressBook->export2File( sentSyncFile() ); 2964 mAddressBook->export2File( sentSyncFile() );
2965} 2965}
2966QString KABCore::sentSyncFile() 2966QString KABCore::sentSyncFile()
2967{ 2967{
2968#ifdef DESKTOP_VERSION 2968#ifdef DESKTOP_VERSION
2969 return locateLocal( "tmp", "copysyncab.vcf" ); 2969 return locateLocal( "tmp", "copysyncab.vcf" );
2970#else 2970#else
2971 return QString( "/tmp/copysyncab.vcf" ); 2971 return QString( "/tmp/copysyncab.vcf" );
2972#endif 2972#endif
2973} 2973}
2974 2974
2975void KABCore::setCaptionBack() 2975void KABCore::setCaptionBack()
2976{ 2976{
2977 mMessageTimer->stop(); 2977 mMessageTimer->stop();
2978 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2978 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2979} 2979}