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