summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt14
-rw-r--r--kabc/addressee.cpp2
-rw-r--r--kabc/picture.cpp38
-rw-r--r--kabc/vcard/ContentLine.cpp30
-rw-r--r--kabc/vcard/VCardv.cpp77
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp11
-rw-r--r--kaddressbook/details/detailsviewcontainer.h1
-rw-r--r--kaddressbook/imagewidget.cpp7
-rw-r--r--kaddressbook/kabcore.cpp9
-rw-r--r--kaddressbook/kabcore.h9
-rw-r--r--kaddressbook/viewmanager.cpp1
-rw-r--r--kde2file/abdump/main.cpp2
-rw-r--r--kde2file/caldump/main.cpp2
-rw-r--r--korganizer/kolistview.cpp16
-rw-r--r--version2
15 files changed, 133 insertions, 88 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 2fd63e7..ff87423 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,522 +1,536 @@
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.17 ************ 3********** VERSION 1.9.17 ************
4 4
5KO/Pi: 5KO/Pi:
6Fixed that tooltips were not updated after moving an item in agenda view. 6Fixed that tooltips were not updated after moving an item in agenda view.
7Fixed a bug in sorting start date for recurring events in list view.
7 8
8KA/Pi: 9KA/Pi:
9All fields search does now actually search all the (possible) fields, 10All fields search does now actually search all the (possible) fields,
10not only those listed in the contact list. 11not only those listed in the contact list.
12Made is possible to inline a picture in a vcard on the Z.
13This was only possible on the desktop, now is it possible on the Z as well.
14Fixed of missing save settings after filter configuration.
15Made saving of addressbook much faster.
16
17QWhatsThis was not working on the Z ( only black rectangle was shown).
18This is Fixed.
19
20KDE-Sync:
21Now readonly KDE resources are synced as well.
22(They are not changed in KDE itself, of course).
23
24
11 25
12********** VERSION 1.9.16 ************ 26********** VERSION 1.9.16 ************
13 27
14KO/Pi: 28KO/Pi:
15Fixed search dialog size on Z 6000 (480x640 display). 29Fixed search dialog size on Z 6000 (480x640 display).
16Added setting to hide/show time in agenda items. 30Added setting to hide/show time in agenda items.
17Added setting to hide not running todos in todo view. 31Added setting to hide not running todos in todo view.
18Added columns for start date/time in todo view. 32Added columns for start date/time in todo view.
19Replaced the solid half-hour lines in agenda view by dot lines. 33Replaced the solid half-hour lines in agenda view by dot lines.
20Added possibility of printing the What's Next View on the desktop 34Added possibility of printing the What's Next View on the desktop
21(i.e. Windows and Linux). 35(i.e. Windows and Linux).
22Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. 36Fixed a crash in KO/Pi when starting KO/Pi with What's Next view.
23Added tooltips in month view.(Tooltips only available on desktop) 37Added tooltips in month view.(Tooltips only available on desktop)
24 38
25Fixed a strange problem in KO/Pi alarm applet. 39Fixed a strange problem in KO/Pi alarm applet.
26Did not find the actual problem, 40Did not find the actual problem,
27such that now Qtopia reboots again if deinstalling the alarm applet. 41such that now Qtopia reboots again if deinstalling the alarm applet.
28But the alarm applet should work again. 42But the alarm applet should work again.
29 43
30KA/Pi: 44KA/Pi:
31Fixed the problem, that internal pictures were not saved. 45Fixed the problem, that internal pictures were not saved.
32 46
33Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. 47Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes.
34 48
35Fixed some minor problems. (Like word wrap in help text windows). 49Fixed some minor problems. (Like word wrap in help text windows).
36 50
37Fixed a compiling problem in microkde/kresources. 51Fixed a compiling problem in microkde/kresources.
38 52
39KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. 53KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM.
40This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) 54This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9)
41such that now syncing KO/Pi with Sharp DTM should work on the 55such that now syncing KO/Pi with Sharp DTM should work on the
42Zaurus C 3000 model. 56Zaurus C 3000 model.
43 57
44********** VERSION 1.9.15 ************ 58********** VERSION 1.9.15 ************
45 59
46Usebilty enhancements in KO/Pi: 60Usebilty enhancements in KO/Pi:
47When clicking on the date in a month view cell, the day view is shown. 61When clicking on the date in a month view cell, the day view is shown.
48Old behaviour was, that the "new event" dialog popped up. 62Old behaviour was, that the "new event" dialog popped up.
49 63
50Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). 64Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
51That means, you can restore the latest 65That means, you can restore the latest
52event/todo/journal you have deleted. 66event/todo/journal you have deleted.
53A journal is deleted, if you clear all the text of the journal. 67A journal is deleted, if you clear all the text of the journal.
54 68
55Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. 69Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
56 70
57KA/Pi starting in 480x640 resolution: 71KA/Pi starting in 480x640 resolution:
58Hide the filter action in toolbar 72Hide the filter action in toolbar
59and added icons for undo/delete/redo in toolbar. 73and added icons for undo/delete/redo in toolbar.
60 74
61Change in OM/Pi ViewMail dialog: 75Change in OM/Pi ViewMail dialog:
62When clicking on the "delete" icon the mail is deleted after confirmation as usual. 76When clicking on the "delete" icon the mail is deleted after confirmation as usual.
63But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). 77But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
64 78
65Fixed a crash when deleting mail-accounts in OM/Pi. 79Fixed a crash when deleting mail-accounts in OM/Pi.
66 80
67 81
68********** VERSION 1.9.14 ************ 82********** VERSION 1.9.14 ************
69 83
70Fixed some problems with the dialog sizes when switching 84Fixed some problems with the dialog sizes when switching
71portrait/landscape mode on 640x480 PDA display. 85portrait/landscape mode on 640x480 PDA display.
72 86
73Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. 87Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
74 88
75Fixed an ugly bug in KOpieMail: 89Fixed an ugly bug in KOpieMail:
76KOpieMail was not able to write files (mails) to MSDOS file system, 90KOpieMail was not able to write files (mails) to MSDOS file system,
77like on an usual preformatted SD card. That should work now. 91like on an usual preformatted SD card. That should work now.
78To save your mail data on the Sd card do the following: 92To save your mail data on the Sd card do the following:
79Create a dir on the SD card: 93Create a dir on the SD card:
80mkdir /mnt/card/localmail 94mkdir /mnt/card/localmail
81Go to your home dir: 95Go to your home dir:
82cd 96cd
83Go to kopiemail data storage dir: 97Go to kopiemail data storage dir:
84cd kdepim/apps/kopiemail 98cd kdepim/apps/kopiemail
85Create a symlink to the SD card: 99Create a symlink to the SD card:
86ls -s /mnt/card/localmail 100ls -s /mnt/card/localmail
87Now KOpieMail will store all mails on the SD card. 101Now KOpieMail will store all mails on the SD card.
88 102
89KO/Pi Monthview: 103KO/Pi Monthview:
90Now "Go to Today" selects the current month from day 1-end, 104Now "Go to Today" selects the current month from day 1-end,
91not the current date + some days. 105not the current date + some days.
92I.e. "Go to Today" shows now always 106I.e. "Go to Today" shows now always
93the current month with first day of month in the first row. 107the current month with first day of month in the first row.
94 108
95Added missing German translation. 109Added missing German translation.
96 110
97Fixed icons of executeable on Wintendo. 111Fixed icons of executeable on Wintendo.
98 112
99Added a "Show next Mail" button to the OM/Pi 113Added a "Show next Mail" button to the OM/Pi
100mail viewer such that the mail below the current mail 114mail viewer such that the mail below the current mail
101in the mail list view of the current folder 115in the mail list view of the current folder
102can be read with a single click. 116can be read with a single click.
103 117
104 118
105********** VERSION 1.9.13 ************ 119********** VERSION 1.9.13 ************
106 120
107Fixed nasty PwM/Pi file reading bug, when 121Fixed nasty PwM/Pi file reading bug, when
108the used hash algo of file is different then the global 122the used hash algo of file is different then the global
109hash algo. 123hash algo.
110 124
111Added KA/Pi support for opie mailit mailapplication. 125Added KA/Pi support for opie mailit mailapplication.
112 126
113Fixed some bugs in OM/Pi. 127Fixed some bugs in OM/Pi.
114Now character conversion tables are available for the Zaurus 128Now character conversion tables are available for the Zaurus
115to make OM/Pi working properly. 129to make OM/Pi working properly.
116To get the character conversion in OM/Pi working, please download 130To get the character conversion in OM/Pi working, please download
117at the sourceforge project site the package 131at the sourceforge project site the package
118sr-character-conversion_SharpROM_arm.ipk.zip 132sr-character-conversion_SharpROM_arm.ipk.zip
119(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) 133(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
120from the section "general files for KDE/Pim" 134from the section "general files for KDE/Pim"
121Instructions how to install this package are in a ReadMe in this file. 135Instructions how to install this package are in a ReadMe in this file.
122 136
123 137
124Fixed the orientation change problem in KA/Pi when switching 138Fixed the orientation change problem in KA/Pi when switching
125portrait/landscape mode. 139portrait/landscape mode.
126 140
127French translation available for KA/Pi and OM/Pi. 141French translation available for KA/Pi and OM/Pi.
128 142
129Fixed some problems with categories in KO/Pi in DTM sync. 143Fixed some problems with categories in KO/Pi in DTM sync.
130 144
131Added selection dialog for export to phone in KA/Pi. 145Added selection dialog for export to phone in KA/Pi.
132 146
133If in KO/Pi is an attendee selected to add to a meeting and this 147If in KO/Pi is an attendee selected to add to a meeting and this
134attendee is already in the list of attendees, this person is not added 148attendee is already in the list of attendees, this person is not added
135again. 149again.
136 150
137Some menu cleanup in KA/Pi. 151Some menu cleanup in KA/Pi.
138 152
139********** VERSION 1.9.12 ************ 153********** VERSION 1.9.12 ************
140 154
141Fix for the bug in KO/Pi What's Next view of version 1.9.11. 155Fix for the bug in KO/Pi What's Next view of version 1.9.11.
142 156
143Bugfix: Licence file is now shown again. 157Bugfix: Licence file is now shown again.
144 158
145OM/Pi now supports Unicode (utf8 charset). 159OM/Pi now supports Unicode (utf8 charset).
146Fixed some bugs in OM/Pi. 160Fixed some bugs in OM/Pi.
147 161
148KA/Pi has more German translation. 162KA/Pi has more German translation.
149 163
150 164
151********** VERSION 1.9.11 ************ 165********** VERSION 1.9.11 ************
152 166
153Fixed several problems in PWM/Pi, like 167Fixed several problems in PWM/Pi, like
154asking the user, if unsaved changed are pending 168asking the user, if unsaved changed are pending
155when closing the app. 169when closing the app.
156And PwM/Pi handles now different texts for the 170And PwM/Pi handles now different texts for the
157fields Description, Username, Password, configurable per category. 171fields Description, Username, Password, configurable per category.
158 172
159Fixed a crash in KO/Pi , when importing/loading vcs files 173Fixed a crash in KO/Pi , when importing/loading vcs files
160which have an entry with an attendee with state: 174which have an entry with an attendee with state:
161NEEDS ACTION 175NEEDS ACTION
162 176
163Fixed some problems in the German translation of OM/Pi, 177Fixed some problems in the German translation of OM/Pi,
164which makes some dialogs not fitting on the screen 178which makes some dialogs not fitting on the screen
165of the Z 5500. 179of the Z 5500.
166 180
167Fixed Qtopia crash, when disabling/deinstalling 181Fixed Qtopia crash, when disabling/deinstalling
168KO/Pi alarm applet. 182KO/Pi alarm applet.
169 183
170Implemented direct KDE<->KA/Pi sync for KA/Pi running 184Implemented direct KDE<->KA/Pi sync for KA/Pi running
171on Linux desktop. 185on Linux desktop.
172 186
173Added feature "remove sync info" to sync menu. 187Added feature "remove sync info" to sync menu.
174 188
175Tweaked the KO/Pi What's next view a bit, added 189Tweaked the KO/Pi What's next view a bit, added
176setting to hide events that are done. 190setting to hide events that are done.
177 191
178Disabled "beam receive enabled" on startup to 192Disabled "beam receive enabled" on startup to
179avoid problems if Fastload is enabled. 193avoid problems if Fastload is enabled.
180Please set "beam receive enabled", 194Please set "beam receive enabled",
181if you want to receive data via IR. 195if you want to receive data via IR.
182 196
183Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 197Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
184on Linux desktop. 198on Linux desktop.
185 199
186Made in KA/Pi scrolling possible, if details view is selected. 200Made in KA/Pi scrolling possible, if details view is selected.
187(The keyboard focus is set automatically to the search line) 201(The keyboard focus is set automatically to the search line)
188 202
189Fixed a bug in DMT sync, that a new entry in DTM was added 203Fixed a bug in DMT sync, that a new entry in DTM was added
190on every sync to Kx/Pi. 204on every sync to Kx/Pi.
191 205
192Fixed missing writing of KA/Pi categories to DMT entries when syncing. 206Fixed missing writing of KA/Pi categories to DMT entries when syncing.
193 207
194Fixed a bug in DMT sync with todos created in KO/Pi containing 208Fixed a bug in DMT sync with todos created in KO/Pi containing
195non-latin1 characters. 209non-latin1 characters.
196 210
197Rearranged package contents of Sharp-ipks and made all 211Rearranged package contents of Sharp-ipks and made all
198packages installable on SD again. 212packages installable on SD again.
199 213
200Fixed the writing of addressbook data in DTM sync. 214Fixed the writing of addressbook data in DTM sync.
201Empty fields in KA/Pi were not removed. 215Empty fields in KA/Pi were not removed.
202 216
203Added better category handling in KA/Pi: 217Added better category handling in KA/Pi:
204Added item 218Added item
205Edit Categories and 219Edit Categories and
206Manage new categories 220Manage new categories
207to the settings menu. 221to the settings menu.
208Possible to configure a view to display categories. 222Possible to configure a view to display categories.
209 223
210Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. 224Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
211 225
212Fixed displaying of "free" days and time in KO Monthview and Agendaview. 226Fixed displaying of "free" days and time in KO Monthview and Agendaview.
213 227
214... and many other bugfixes. 228... and many other bugfixes.
215 229
216********** VERSION 1.9.10 ************ 230********** VERSION 1.9.10 ************
217 231
218Many internal small bugfixes. 232Many internal small bugfixes.
219And fix of the "big" bug in KO/Pi, 233And fix of the "big" bug in KO/Pi,
220that after Syncing the appointments had an offset by several hours. 234that after Syncing the appointments had an offset by several hours.
221That was a problem with the internal timezone setting, 235That was a problem with the internal timezone setting,
222introduced by the changed timezone configuration settings. 236introduced by the changed timezone configuration settings.
223 237
224German translation for OM/Pi is now available. 238German translation for OM/Pi is now available.
225 239
226 240
227********** VERSION 1.9.9 ************ 241********** VERSION 1.9.9 ************
228 242
229KDE-Pim/Pi has a new Member! 243KDE-Pim/Pi has a new Member!
230It is called PWM/Pi (Passwordmanager/platform-independent) 244It is called PWM/Pi (Passwordmanager/platform-independent)
231and it is available for the Zaurus. 245and it is available for the Zaurus.
232It is planned, that it will be available later for Windows. 246It is planned, that it will be available later for Windows.
233(And for Linux, of course). 247(And for Linux, of course).
234It is a port of the Passwordmanager of KDE. 248It is a port of the Passwordmanager of KDE.
235It will need the MicroKDElibs to run. 249It will need the MicroKDElibs to run.
236 250
237Made loading of addressbooks in KA/Pi up to 7 times faster! 251Made loading of addressbooks in KA/Pi up to 7 times faster!
238The bigger your addressbook file, the more starting speed 252The bigger your addressbook file, the more starting speed
239will you gain. (relatively) 253will you gain. (relatively)
240 254
241The Qtopia addressbook connector is now platform independend 255The Qtopia addressbook connector is now platform independend
242as well and should work on any platform for importing/exporting 256as well and should work on any platform for importing/exporting
243Qtopia and Opie XML files. 257Qtopia and Opie XML files.
244 258
245Added a +30min feature to the timezone settings to make 259Added a +30min feature to the timezone settings to make
246KDE-Pim/Pi useable in Australia and other parts on the 260KDE-Pim/Pi useable in Australia and other parts on the
247world with strange timezones ;-) 261world with strange timezones ;-)
248 262
249German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 263German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
250 264
251It is now possible to disable the 265It is now possible to disable the
252"receive data via infrared" feature, such that syncing with 266"receive data via infrared" feature, such that syncing with
253Outlook is now possible again with Kx/Pi runing. 267Outlook is now possible again with Kx/Pi runing.
254Please disable it, before syncing Sharp DTM with Outlook. 268Please disable it, before syncing Sharp DTM with Outlook.
255For your convenience, the "receive data via infrared" feature 269For your convenience, the "receive data via infrared" feature
256is disabled automatically, if you sync Kx/Pi with DTM. 270is disabled automatically, if you sync Kx/Pi with DTM.
257You have to enable it again manually after syncing. 271You have to enable it again manually after syncing.
258Enabling this feature makes it impossible to start the 272Enabling this feature makes it impossible to start the
259Sharp DTM apps. If this feature is enabled, you will only get the 273Sharp DTM apps. If this feature is enabled, you will only get the
260alarm notification from KO/Pi and not from the Sharp calendar. 274alarm notification from KO/Pi and not from the Sharp calendar.
261This is very useful if you sync KO/Pi with Sharp DTM, 275This is very useful if you sync KO/Pi with Sharp DTM,
262because after syncing you usually would get notified about 276because after syncing you usually would get notified about
263an alarm by KO/Pi and the Sharp Calendar. 277an alarm by KO/Pi and the Sharp Calendar.
264 278
265Together with the Linux desktop version of KO/Pi 279Together with the Linux desktop version of KO/Pi
266it is now possible to sync KO/Pi on the Zaurus 280it is now possible to sync KO/Pi on the Zaurus
267with the complete KDE-desktop (3.3 or later) 281with the complete KDE-desktop (3.3 or later)
268calendar data easily. 282calendar data easily.
269That makes it possible to sync the Z with one 283That makes it possible to sync the Z with one
270click of a mouse with the KDE-Desktop. 284click of a mouse with the KDE-Desktop.
271This feature it available for all Zaurus platforms KO/Pi 285This feature it available for all Zaurus platforms KO/Pi
272is running on. 286is running on.
273The only thing needed is a running KO/Pi on Linux and 287The only thing needed is a running KO/Pi on Linux and
274a compiled version of the small 288a compiled version of the small
275KDE-Pim/Pi<->KDE-Desktop access command line program, 289KDE-Pim/Pi<->KDE-Desktop access command line program,
276which is in the KDE-Pim/Pi sources available. 290which is in the KDE-Pim/Pi sources available.
277 291
278The "KDE-desktop" syncing feature for KA/Pi will follow 292The "KDE-desktop" syncing feature for KA/Pi will follow
279in the next releases. 293in the next releases.
280 294
281Fixed the vcard export bug, which had the version 1.9.8. 295Fixed the vcard export bug, which had the version 1.9.8.
282 296
283Added missing GERMAN translation to KO/Pi. 297Added missing GERMAN translation to KO/Pi.
284Hi PsionX, could you add the missing french translation?Thx! 298Hi PsionX, could you add the missing french translation?Thx!
285 299
286Translation files for KA/Pi are available as well. 300Translation files for KA/Pi are available as well.
287GERMAN translation will be available in the next release. 301GERMAN translation will be available in the next release.
288PsionX ( yres, you again ;-) ), could you start translating 302PsionX ( yres, you again ;-) ), could you start translating
289KA/Pi? Thx! 303KA/Pi? Thx!
290 304
291You can download the version 1.9.9 at 305You can download the version 1.9.9 at
292 306
293http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 307http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
294 308
295Note: 309Note:
296To run the mail program OM/Pi you need libopenssl. 310To run the mail program OM/Pi you need libopenssl.
297A link to a download loaction is available at 311A link to a download loaction is available at
298ZSI at www.killefiz.de 312ZSI at www.killefiz.de
299 313
300 314
301********** VERSION 1.9.8 ************ 315********** VERSION 1.9.8 ************
302 316
303Fixed character decoding in OM/Pi. 317Fixed character decoding in OM/Pi.
304(e.g. German "Umlaute" were not displayed properly.) 318(e.g. German "Umlaute" were not displayed properly.)
305 319
306Made is possible to reparent todos in KO/Pi. 320Made is possible to reparent todos in KO/Pi.
307Use contextmenu or keys (look at Help-Keys + Colors) for that. 321Use contextmenu or keys (look at Help-Keys + Colors) for that.
308 322
309Added the missing Sync-Howto and WhatsNew to the packages. 323Added the missing Sync-Howto and WhatsNew to the packages.
310 324
311KO/Pi on Linux desktop can now sync with KDE desktop. 325KO/Pi on Linux desktop can now sync with KDE desktop.
312That means: When using KO/Pi on Linux desktop for syncing with 326That means: When using KO/Pi on Linux desktop for syncing with
313KDE desktop and the Zaurus, the Zaurus can be synced now 327KDE desktop and the Zaurus, the Zaurus can be synced now
314with all KDE-Calendar resources, not only with one local file. 328with all KDE-Calendar resources, not only with one local file.
315(That makes it possible to sync the Zaurus with the 329(That makes it possible to sync the Zaurus with the
316calendar data on a Kolab server) 330calendar data on a Kolab server)
317 331
318KA/Pi syncing with KDE desktop will be available in the next version. 332KA/Pi syncing with KDE desktop will be available in the next version.
319 333
320 334
321********** VERSION 1.9.7 ************ 335********** VERSION 1.9.7 ************
322 336
323KO/Pi - KA/Pi on Windows: 337KO/Pi - KA/Pi on Windows:
324Now a directory can be defined by the user, where the 338Now a directory can be defined by the user, where the
325application/config data should be saved. 339application/config data should be saved.
326 Define your desired path in the evironment variable 340 Define your desired path in the evironment variable
327 MICROKDEHOME 341 MICROKDEHOME
328 before starting KO/Pi or KA/Pi. 342 before starting KO/Pi or KA/Pi.
329 343
330An easy Kx/Pi to Kx/Pi syncing is now possible 344An easy Kx/Pi to Kx/Pi syncing is now possible
331(it is called Pi-Sync) via network. 345(it is called Pi-Sync) via network.
332Please look at the Sync Howto. 346Please look at the Sync Howto.
333 347
334Exporting of calendar data and contacts to mobile phones is now possible. 348Exporting of calendar data and contacts to mobile phones is now possible.
335The SyncHowto is updated with information howto 349The SyncHowto is updated with information howto
336access/sync mobile phones. 350access/sync mobile phones.
337Please look at the Sync Howto. 351Please look at the Sync Howto.
338 352
339Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. 353Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
340Please disable Fastload for the original contact/calendar applications 354Please disable Fastload for the original contact/calendar applications
341and close them. 355and close them.
342KO/Pi and KA/Pi must be running in order to receive the data. 356KO/Pi and KA/Pi must be running in order to receive the data.
343(KO/Pi and KA/Pi are always running if Fastload for them is enabled!) 357(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
344 358
345In the KA/Pi details view are now the preferred tel. numbers displayed on top 359In the KA/Pi details view are now the preferred tel. numbers displayed on top
346of the other data ( emails/tel.numbers/addresses) 360of the other data ( emails/tel.numbers/addresses)
347 361
348Fixed some syncing problems in KA/Pi. 362Fixed some syncing problems in KA/Pi.
349 363
350Added font settings for the KA/Pi details view. 364Added font settings for the KA/Pi details view.
351Added fields "children's name" and "gender" to KA/Pi. 365Added fields "children's name" and "gender" to KA/Pi.
352 366
353Made searching in KA/Pi better: 367Made searching in KA/Pi better:
354Now the first item in a view is selected after a search automatically and 368Now the first item in a view is selected after a search automatically and
355the views can be scrolled up/down when the search input field has the keyboard focus. 369the views can be scrolled up/down when the search input field has the keyboard focus.
356 370
357And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. 371And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi.
358 372
359 373
360********** VERSION 1.9.6 ************ 374********** VERSION 1.9.6 ************
361 375
362Changes in the external application communication on the Zaurus 376Changes in the external application communication on the Zaurus
363in order to use less RAM when the apps are running. 377in order to use less RAM when the apps are running.
364First syncing of addressbooks (KA/Pi) is possible. 378First syncing of addressbooks (KA/Pi) is possible.
365 379
366 380
367********** VERSION 1.9.5a ************ 381********** VERSION 1.9.5a ************
368 382
369Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. 383Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5.
370Fixed some small bugs. 384Fixed some small bugs.
371KA/Pi shows now the birthday in summary view. 385KA/Pi shows now the birthday in summary view.
372Now OM/Pi and KA/Pi are using the date format defined in KO/Pi 386Now OM/Pi and KA/Pi are using the date format defined in KO/Pi
373for displaying dates. 387for displaying dates.
374 388
375 389
376********** VERSION 1.9.5 ************ 390********** VERSION 1.9.5 ************
377 391
378There is still no Addressbook syncing! 392There is still no Addressbook syncing!
379 393
380New in 1.9.5: 394New in 1.9.5:
381 395
382Many bugfixes. 396Many bugfixes.
383Better searching in KA/Pi. 397Better searching in KA/Pi.
384You can configure in KA/Pi if you want to search only after 398You can configure in KA/Pi if you want to search only after
385<return> key pressed. 399<return> key pressed.
386 400
387Better mail downloading in OM/Pi. 401Better mail downloading in OM/Pi.
388 402
389First experimental alpha version of sync of KO/Pi with mobile phones. 403First experimental alpha version of sync of KO/Pi with mobile phones.
390See gammu documentation for supported phones. 404See gammu documentation for supported phones.
391You 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. 405You 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.
392Quick hint how to use: 406Quick hint how to use:
393NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! 407NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL!
394Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. 408Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp.
395Create syncprofile - mobile device 409Create syncprofile - mobile device
396Remove entry for model. (Leave empty ). 410Remove entry for model. (Leave empty ).
397Enable infrared on Zaurus and your Phone. 411Enable infrared on Zaurus and your Phone.
398Sync. 412Sync.
399To get a more detailed log, start kopi from konsole. 413To get a more detailed log, start kopi from konsole.
400 414
401********** VERSION 1.9.4 ************ 415********** VERSION 1.9.4 ************
402 416
403This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. 417This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus.
404 418
405WARNING: 419WARNING:
406PLEASE BACKUP ALL YOUR DATA! 420PLEASE BACKUP ALL YOUR DATA!
407We have changed a lot and maybe there are some unknown problems. 421We have changed a lot and maybe there are some unknown problems.
408 422
409SYNC HANDLING HAS CHANGED! 423SYNC HANDLING HAS CHANGED!
410Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 424Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
411(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 425(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
412 426
413You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. 427You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs.
414If 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. 428If 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.
415 429
416As programs are available: 430As programs are available:
417KO/Pi (korganizer ipk) - a calendar program. 431KO/Pi (korganizer ipk) - a calendar program.
418KA/Pi (kaddressbook ipk ) - an addressbook 432KA/Pi (kaddressbook ipk ) - an addressbook
419OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. 433OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support.
420 434
421An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. 435An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode.
422(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) 436(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia)
423 437
424All the applications are installed in a "Pim" TAB. 438All the applications are installed in a "Pim" TAB.
425If 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 439If 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
426 440
427All the application are integrated. 441All the application are integrated.
428Such 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. 442Such 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.
429 443
430HINT: 444HINT:
431If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. 445If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number.
432 446
433What's new? 447What's new?
434 448
435SYNC HANDLING HAS CHANGED! 449SYNC HANDLING HAS CHANGED!
436Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 450Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
437(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 451(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
438 452
439New in OM/Pi: 453New in OM/Pi:
440When 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. 454When 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.
441 455
442New in KO/Pi: 456New in KO/Pi:
443French is now available for KO/Pi. 457French is now available for KO/Pi.
444Choose menu:Actions - Configure:TAB locale 458Choose menu:Actions - Configure:TAB locale
445Syncing has changed. 459Syncing has changed.
446Phone sync available soon. 460Phone sync available soon.
447Not much changes, I cannot remember them ... 461Not much changes, I cannot remember them ...
448 462
449New in KA/Pi: 463New in KA/Pi:
450Beaming possible. 464Beaming possible.
451Sharp DTM readonly access possible( create a new DTM resource ); 465Sharp DTM readonly access possible( create a new DTM resource );
452Better searching possible. 466Better searching possible.
453Search is performed only after pressing the return key. 467Search is performed only after pressing the return key.
454Use wildcard * to specify parts of a name. 468Use wildcard * to specify parts of a name.
455 469
456Better 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 * . 470Better 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 * .
457 471
458A big improvement is the new management of the contact access. 472A big improvement is the new management of the contact access.
459In version 1.9.3, every application was using their own addressbook access data. 473In version 1.9.3, every application was using their own addressbook access data.
460That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. 474That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi.
461That was wasting of memory, if you had several hundreds of contacts. 475That was wasting of memory, if you had several hundreds of contacts.
462 476
463Now only KA/Pi accesses the addressbook. 477Now only KA/Pi accesses the addressbook.
464If 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. 478If 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.
465If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. 479If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly.
466That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. 480That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first.
467 481
468New in the KO/Pi alarm applet: 482New in the KO/Pi alarm applet:
469Configure your own timer popup menu! 483Configure your own timer popup menu!
470(Text and minutes for timer countdown) 484(Text and minutes for timer countdown)
471Just edit the file 485Just edit the file
472(yourhomedir)/.kopialarmtimerrc 486(yourhomedir)/.kopialarmtimerrc
473and start/stop a timer to get a new menu with the data of this file. 487and start/stop a timer to get a new menu with the data of this file.
474 488
475********** VERSION 1.9.3 ************ 489********** VERSION 1.9.3 ************
4761) 4901)
477Now KO/Pi on Windows imports directly the calendar data of 491Now KO/Pi on Windows imports directly the calendar data of
478an installed Outlook. Should work with OL version >= 2000. 492an installed Outlook. Should work with OL version >= 2000.
479 493
480********** VERSION 1.9.2 ************ 494********** VERSION 1.9.2 ************
4811) 4951)
482KDE-Pim/Pi has got a new member: 496KDE-Pim/Pi has got a new member:
483KmicroMail (KM/Pi) is a mail program, 497KmicroMail (KM/Pi) is a mail program,
484which can handle IMAP and POP mail access. 498which can handle IMAP and POP mail access.
485It is based on Opie-Mail v3. 499It is based on Opie-Mail v3.
486All dependencies to the Opie libraries ar removed, 500All dependencies to the Opie libraries ar removed,
487such that no additional Opie lib is needed. 501such that no additional Opie lib is needed.
488It is already integrated in KO/Pi and KA/Pi. 502It is already integrated in KO/Pi and KA/Pi.
489It it now available for the Zaurus,probably it 503It it now available for the Zaurus,probably it
490will be available for other platforms later. 504will be available for other platforms later.
491Hint: 505Hint:
492Create your own contact (name + email) 506Create your own contact (name + email)
493in KA/Pi, select this contact and choose menu: 507in KA/Pi, select this contact and choose menu:
494Settings - Set Who Am I. 508Settings - Set Who Am I.
495Now the settings of this contact are used as 509Now the settings of this contact are used as
496the sender data in KM/Pi. 510the sender data in KM/Pi.
4972) 5112)
498KDE-Pim/Pi is split up in five different 512KDE-Pim/Pi is split up in five different
499packages now precompiled for Sharp Zaurus: 513packages now precompiled for Sharp Zaurus:
500--kmicrokdelibs_1.9.2_arm.ipk 514--kmicrokdelibs_1.9.2_arm.ipk
501The libs are needed for any 515The libs are needed for any
502of the following programs: 516of the following programs:
503--kaddressbook_1.9.2_arm.ipk 517--kaddressbook_1.9.2_arm.ipk
504--kmicromail_1.9.2_arm.ipk 518--kmicromail_1.9.2_arm.ipk
505--korganizer_1.9.2_arm.ipk 519--korganizer_1.9.2_arm.ipk
506Independ from that, there is the alarm applet 520Independ from that, there is the alarm applet
507available for KO/Pi, which also offers 521available for KO/Pi, which also offers
508quick access for a new mail or 522quick access for a new mail or
509showing the addressbook.: 523showing the addressbook.:
510--korganizer-alarm_1.9.2_arm.ipk 524--korganizer-alarm_1.9.2_arm.ipk
511Independend means, that the alarm applet 525Independend means, that the alarm applet
512does not need any of the libs or programs above to run. 526does not need any of the libs or programs above to run.
513But it would be quite useless without these programs. 527But it would be quite useless without these programs.
514NOTE: 528NOTE:
515If you get a 529If you get a
516"This application depends on other programs" 530"This application depends on other programs"
517during installation of 531during installation of
518--kmicrokdelibs_1.9.2_arm.ipk 532--kmicrokdelibs_1.9.2_arm.ipk
519you probably do not have to care about that. 533you probably do not have to care about that.
520kmicrokdelibs_1.9.2 will come with some 534kmicrokdelibs_1.9.2 will come with some
521resource plugins, which needs additional libraries. 535resource plugins, which needs additional libraries.
522(E.g. libopie1, if you want to use the 536(E.g. libopie1, if you want to use the
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 3ce733d..568dfc4 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1174,964 +1174,966 @@ KURL Addressee::url() const
1174QString Addressee::urlLabel() 1174QString Addressee::urlLabel()
1175{ 1175{
1176 return i18n("URL"); 1176 return i18n("URL");
1177} 1177}
1178 1178
1179 1179
1180void Addressee::setSecrecy( const Secrecy &secrecy ) 1180void Addressee::setSecrecy( const Secrecy &secrecy )
1181{ 1181{
1182 if ( secrecy == mData->secrecy ) return; 1182 if ( secrecy == mData->secrecy ) return;
1183 detach(); 1183 detach();
1184 mData->empty = false; 1184 mData->empty = false;
1185 mData->secrecy = secrecy; 1185 mData->secrecy = secrecy;
1186} 1186}
1187 1187
1188Secrecy Addressee::secrecy() const 1188Secrecy Addressee::secrecy() const
1189{ 1189{
1190 return mData->secrecy; 1190 return mData->secrecy;
1191} 1191}
1192 1192
1193QString Addressee::secrecyLabel() 1193QString Addressee::secrecyLabel()
1194{ 1194{
1195 return i18n("Security Class"); 1195 return i18n("Security Class");
1196} 1196}
1197 1197
1198 1198
1199void Addressee::setLogo( const Picture &logo ) 1199void Addressee::setLogo( const Picture &logo )
1200{ 1200{
1201 if ( logo == mData->logo ) return; 1201 if ( logo == mData->logo ) return;
1202 detach(); 1202 detach();
1203 mData->empty = false; 1203 mData->empty = false;
1204 mData->logo = logo; 1204 mData->logo = logo;
1205} 1205}
1206 1206
1207Picture Addressee::logo() const 1207Picture Addressee::logo() const
1208{ 1208{
1209 return mData->logo; 1209 return mData->logo;
1210} 1210}
1211 1211
1212QString Addressee::logoLabel() 1212QString Addressee::logoLabel()
1213{ 1213{
1214 return i18n("Logo"); 1214 return i18n("Logo");
1215} 1215}
1216 1216
1217 1217
1218void Addressee::setPhoto( const Picture &photo ) 1218void Addressee::setPhoto( const Picture &photo )
1219{ 1219{
1220 if ( photo == mData->photo ) return; 1220 if ( photo == mData->photo ) return;
1221 detach(); 1221 detach();
1222 mData->empty = false; 1222 mData->empty = false;
1223 mData->photo = photo; 1223 mData->photo = photo;
1224} 1224}
1225 1225
1226Picture Addressee::photo() const 1226Picture Addressee::photo() const
1227{ 1227{
1228 return mData->photo; 1228 return mData->photo;
1229} 1229}
1230 1230
1231QString Addressee::photoLabel() 1231QString Addressee::photoLabel()
1232{ 1232{
1233 return i18n("Photo"); 1233 return i18n("Photo");
1234} 1234}
1235 1235
1236 1236
1237void Addressee::setSound( const Sound &sound ) 1237void Addressee::setSound( const Sound &sound )
1238{ 1238{
1239 if ( sound == mData->sound ) return; 1239 if ( sound == mData->sound ) return;
1240 detach(); 1240 detach();
1241 mData->empty = false; 1241 mData->empty = false;
1242 mData->sound = sound; 1242 mData->sound = sound;
1243} 1243}
1244 1244
1245Sound Addressee::sound() const 1245Sound Addressee::sound() const
1246{ 1246{
1247 return mData->sound; 1247 return mData->sound;
1248} 1248}
1249 1249
1250QString Addressee::soundLabel() 1250QString Addressee::soundLabel()
1251{ 1251{
1252 return i18n("Sound"); 1252 return i18n("Sound");
1253} 1253}
1254 1254
1255 1255
1256void Addressee::setAgent( const Agent &agent ) 1256void Addressee::setAgent( const Agent &agent )
1257{ 1257{
1258 if ( agent == mData->agent ) return; 1258 if ( agent == mData->agent ) return;
1259 detach(); 1259 detach();
1260 mData->empty = false; 1260 mData->empty = false;
1261 mData->agent = agent; 1261 mData->agent = agent;
1262} 1262}
1263 1263
1264Agent Addressee::agent() const 1264Agent Addressee::agent() const
1265{ 1265{
1266 return mData->agent; 1266 return mData->agent;
1267} 1267}
1268 1268
1269QString Addressee::agentLabel() 1269QString Addressee::agentLabel()
1270{ 1270{
1271 return i18n("Agent"); 1271 return i18n("Agent");
1272} 1272}
1273 1273
1274 1274
1275 1275
1276void Addressee::setNameFromString( const QString &str ) 1276void Addressee::setNameFromString( const QString &str )
1277{ 1277{
1278 setFormattedName( str ); 1278 setFormattedName( str );
1279 setName( str ); 1279 setName( str );
1280 1280
1281 static bool first = true; 1281 static bool first = true;
1282 static QStringList titles; 1282 static QStringList titles;
1283 static QStringList suffixes; 1283 static QStringList suffixes;
1284 static QStringList prefixes; 1284 static QStringList prefixes;
1285 1285
1286 if ( first ) { 1286 if ( first ) {
1287 first = false; 1287 first = false;
1288 titles += i18n( "Dr." ); 1288 titles += i18n( "Dr." );
1289 titles += i18n( "Miss" ); 1289 titles += i18n( "Miss" );
1290 titles += i18n( "Mr." ); 1290 titles += i18n( "Mr." );
1291 titles += i18n( "Mrs." ); 1291 titles += i18n( "Mrs." );
1292 titles += i18n( "Ms." ); 1292 titles += i18n( "Ms." );
1293 titles += i18n( "Prof." ); 1293 titles += i18n( "Prof." );
1294 1294
1295 suffixes += i18n( "I" ); 1295 suffixes += i18n( "I" );
1296 suffixes += i18n( "II" ); 1296 suffixes += i18n( "II" );
1297 suffixes += i18n( "III" ); 1297 suffixes += i18n( "III" );
1298 suffixes += i18n( "Jr." ); 1298 suffixes += i18n( "Jr." );
1299 suffixes += i18n( "Sr." ); 1299 suffixes += i18n( "Sr." );
1300 1300
1301 prefixes += "van"; 1301 prefixes += "van";
1302 prefixes += "von"; 1302 prefixes += "von";
1303 prefixes += "de"; 1303 prefixes += "de";
1304 1304
1305 KConfig config( locateLocal( "config", "kabcrc") ); 1305 KConfig config( locateLocal( "config", "kabcrc") );
1306 config.setGroup( "General" ); 1306 config.setGroup( "General" );
1307 titles += config.readListEntry( "Prefixes" ); 1307 titles += config.readListEntry( "Prefixes" );
1308 titles.remove( "" ); 1308 titles.remove( "" );
1309 prefixes += config.readListEntry( "Inclusions" ); 1309 prefixes += config.readListEntry( "Inclusions" );
1310 prefixes.remove( "" ); 1310 prefixes.remove( "" );
1311 suffixes += config.readListEntry( "Suffixes" ); 1311 suffixes += config.readListEntry( "Suffixes" );
1312 suffixes.remove( "" ); 1312 suffixes.remove( "" );
1313 } 1313 }
1314 1314
1315 // clear all name parts 1315 // clear all name parts
1316 setPrefix( "" ); 1316 setPrefix( "" );
1317 setGivenName( "" ); 1317 setGivenName( "" );
1318 setAdditionalName( "" ); 1318 setAdditionalName( "" );
1319 setFamilyName( "" ); 1319 setFamilyName( "" );
1320 setSuffix( "" ); 1320 setSuffix( "" );
1321 1321
1322 if ( str.isEmpty() ) 1322 if ( str.isEmpty() )
1323 return; 1323 return;
1324 1324
1325 int i = str.find(','); 1325 int i = str.find(',');
1326 if( i < 0 ) { 1326 if( i < 0 ) {
1327 QStringList parts = QStringList::split( " ", str ); 1327 QStringList parts = QStringList::split( " ", str );
1328 int leftOffset = 0; 1328 int leftOffset = 0;
1329 int rightOffset = parts.count() - 1; 1329 int rightOffset = parts.count() - 1;
1330 1330
1331 QString suffix; 1331 QString suffix;
1332 while ( rightOffset >= 0 ) { 1332 while ( rightOffset >= 0 ) {
1333 if ( suffixes.contains( parts[ rightOffset ] ) ) { 1333 if ( suffixes.contains( parts[ rightOffset ] ) ) {
1334 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); 1334 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " "));
1335 rightOffset--; 1335 rightOffset--;
1336 } else 1336 } else
1337 break; 1337 break;
1338 } 1338 }
1339 setSuffix( suffix ); 1339 setSuffix( suffix );
1340 1340
1341 if ( rightOffset < 0 ) 1341 if ( rightOffset < 0 )
1342 return; 1342 return;
1343 1343
1344 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { 1344 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) {
1345 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); 1345 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] );
1346 rightOffset--; 1346 rightOffset--;
1347 } else 1347 } else
1348 setFamilyName( parts[ rightOffset ] ); 1348 setFamilyName( parts[ rightOffset ] );
1349 1349
1350 QString prefix; 1350 QString prefix;
1351 while ( leftOffset < rightOffset ) { 1351 while ( leftOffset < rightOffset ) {
1352 if ( titles.contains( parts[ leftOffset ] ) ) { 1352 if ( titles.contains( parts[ leftOffset ] ) ) {
1353 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1353 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1354 leftOffset++; 1354 leftOffset++;
1355 } else 1355 } else
1356 break; 1356 break;
1357 } 1357 }
1358 setPrefix( prefix ); 1358 setPrefix( prefix );
1359 1359
1360 if ( leftOffset < rightOffset ) { 1360 if ( leftOffset < rightOffset ) {
1361 setGivenName( parts[ leftOffset ] ); 1361 setGivenName( parts[ leftOffset ] );
1362 leftOffset++; 1362 leftOffset++;
1363 } 1363 }
1364 1364
1365 QString additionalName; 1365 QString additionalName;
1366 while ( leftOffset < rightOffset ) { 1366 while ( leftOffset < rightOffset ) {
1367 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1367 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1368 leftOffset++; 1368 leftOffset++;
1369 } 1369 }
1370 setAdditionalName( additionalName ); 1370 setAdditionalName( additionalName );
1371 } else { 1371 } else {
1372 QString part1 = str.left( i ); 1372 QString part1 = str.left( i );
1373 QString part2 = str.mid( i + 1 ); 1373 QString part2 = str.mid( i + 1 );
1374 1374
1375 QStringList parts = QStringList::split( " ", part1 ); 1375 QStringList parts = QStringList::split( " ", part1 );
1376 int leftOffset = 0; 1376 int leftOffset = 0;
1377 int rightOffset = parts.count() - 1; 1377 int rightOffset = parts.count() - 1;
1378 1378
1379 QString suffix; 1379 QString suffix;
1380 while ( rightOffset >= 0 ) { 1380 while ( rightOffset >= 0 ) {
1381 if ( suffixes.contains( parts[ rightOffset ] ) ) { 1381 if ( suffixes.contains( parts[ rightOffset ] ) ) {
1382 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); 1382 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " "));
1383 rightOffset--; 1383 rightOffset--;
1384 } else 1384 } else
1385 break; 1385 break;
1386 } 1386 }
1387 setSuffix( suffix ); 1387 setSuffix( suffix );
1388 1388
1389 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { 1389 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) {
1390 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); 1390 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] );
1391 rightOffset--; 1391 rightOffset--;
1392 } else 1392 } else
1393 setFamilyName( parts[ rightOffset ] ); 1393 setFamilyName( parts[ rightOffset ] );
1394 1394
1395 QString prefix; 1395 QString prefix;
1396 while ( leftOffset < rightOffset ) { 1396 while ( leftOffset < rightOffset ) {
1397 if ( titles.contains( parts[ leftOffset ] ) ) { 1397 if ( titles.contains( parts[ leftOffset ] ) ) {
1398 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1398 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1399 leftOffset++; 1399 leftOffset++;
1400 } else 1400 } else
1401 break; 1401 break;
1402 } 1402 }
1403 1403
1404 parts = QStringList::split( " ", part2 ); 1404 parts = QStringList::split( " ", part2 );
1405 1405
1406 leftOffset = 0; 1406 leftOffset = 0;
1407 rightOffset = parts.count(); 1407 rightOffset = parts.count();
1408 1408
1409 while ( leftOffset < rightOffset ) { 1409 while ( leftOffset < rightOffset ) {
1410 if ( titles.contains( parts[ leftOffset ] ) ) { 1410 if ( titles.contains( parts[ leftOffset ] ) ) {
1411 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1411 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1412 leftOffset++; 1412 leftOffset++;
1413 } else 1413 } else
1414 break; 1414 break;
1415 } 1415 }
1416 setPrefix( prefix ); 1416 setPrefix( prefix );
1417 1417
1418 if ( leftOffset < rightOffset ) { 1418 if ( leftOffset < rightOffset ) {
1419 setGivenName( parts[ leftOffset ] ); 1419 setGivenName( parts[ leftOffset ] );
1420 leftOffset++; 1420 leftOffset++;
1421 } 1421 }
1422 1422
1423 QString additionalName; 1423 QString additionalName;
1424 while ( leftOffset < rightOffset ) { 1424 while ( leftOffset < rightOffset ) {
1425 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1425 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1426 leftOffset++; 1426 leftOffset++;
1427 } 1427 }
1428 setAdditionalName( additionalName ); 1428 setAdditionalName( additionalName );
1429 } 1429 }
1430} 1430}
1431 1431
1432QString Addressee::realName() const 1432QString Addressee::realName() const
1433{ 1433{
1434 if ( !formattedName().isEmpty() ) 1434 if ( !formattedName().isEmpty() )
1435 return formattedName(); 1435 return formattedName();
1436 1436
1437 QString n = assembledName(); 1437 QString n = assembledName();
1438 1438
1439 if ( n.isEmpty() ) 1439 if ( n.isEmpty() )
1440 n = name(); 1440 n = name();
1441 1441
1442 return n; 1442 return n;
1443} 1443}
1444 1444
1445QString Addressee::assembledName() const 1445QString Addressee::assembledName() const
1446{ 1446{
1447 QString name = prefix() + " " + givenName() + " " + additionalName() + " " + 1447 QString name = prefix() + " " + givenName() + " " + additionalName() + " " +
1448 familyName() + " " + suffix(); 1448 familyName() + " " + suffix();
1449 1449
1450 return name.simplifyWhiteSpace(); 1450 return name.simplifyWhiteSpace();
1451} 1451}
1452 1452
1453QString Addressee::fullEmail( const QString &email ) const 1453QString Addressee::fullEmail( const QString &email ) const
1454{ 1454{
1455 QString e; 1455 QString e;
1456 if ( email.isNull() ) { 1456 if ( email.isNull() ) {
1457 e = preferredEmail(); 1457 e = preferredEmail();
1458 } else { 1458 } else {
1459 e = email; 1459 e = email;
1460 } 1460 }
1461 if ( e.isEmpty() ) return QString::null; 1461 if ( e.isEmpty() ) return QString::null;
1462 1462
1463 QString text; 1463 QString text;
1464 if ( realName().isEmpty() ) 1464 if ( realName().isEmpty() )
1465 text = e; 1465 text = e;
1466 else 1466 else
1467 text = assembledName() + " <" + e + ">"; 1467 text = assembledName() + " <" + e + ">";
1468 1468
1469 return text; 1469 return text;
1470} 1470}
1471 1471
1472void Addressee::insertEmail( const QString &email, bool preferred ) 1472void Addressee::insertEmail( const QString &email, bool preferred )
1473{ 1473{
1474 detach(); 1474 detach();
1475 1475
1476 QStringList::Iterator it = mData->emails.find( email ); 1476 QStringList::Iterator it = mData->emails.find( email );
1477 1477
1478 if ( it != mData->emails.end() ) { 1478 if ( it != mData->emails.end() ) {
1479 if ( !preferred || it == mData->emails.begin() ) return; 1479 if ( !preferred || it == mData->emails.begin() ) return;
1480 mData->emails.remove( it ); 1480 mData->emails.remove( it );
1481 mData->emails.prepend( email ); 1481 mData->emails.prepend( email );
1482 } else { 1482 } else {
1483 if ( preferred ) { 1483 if ( preferred ) {
1484 mData->emails.prepend( email ); 1484 mData->emails.prepend( email );
1485 } else { 1485 } else {
1486 mData->emails.append( email ); 1486 mData->emails.append( email );
1487 } 1487 }
1488 } 1488 }
1489} 1489}
1490 1490
1491void Addressee::removeEmail( const QString &email ) 1491void Addressee::removeEmail( const QString &email )
1492{ 1492{
1493 detach(); 1493 detach();
1494 1494
1495 QStringList::Iterator it = mData->emails.find( email ); 1495 QStringList::Iterator it = mData->emails.find( email );
1496 if ( it == mData->emails.end() ) return; 1496 if ( it == mData->emails.end() ) return;
1497 1497
1498 mData->emails.remove( it ); 1498 mData->emails.remove( it );
1499} 1499}
1500 1500
1501QString Addressee::preferredEmail() const 1501QString Addressee::preferredEmail() const
1502{ 1502{
1503 if ( mData->emails.count() == 0 ) return QString::null; 1503 if ( mData->emails.count() == 0 ) return QString::null;
1504 else return mData->emails.first(); 1504 else return mData->emails.first();
1505} 1505}
1506 1506
1507QStringList Addressee::emails() const 1507QStringList Addressee::emails() const
1508{ 1508{
1509 return mData->emails; 1509 return mData->emails;
1510} 1510}
1511void Addressee::setEmails( const QStringList& emails ) { 1511void Addressee::setEmails( const QStringList& emails ) {
1512 detach(); 1512 detach();
1513 mData->emails = emails; 1513 mData->emails = emails;
1514} 1514}
1515void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber ) 1515void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber )
1516{ 1516{
1517 detach(); 1517 detach();
1518 mData->empty = false; 1518 mData->empty = false;
1519 1519
1520 PhoneNumber::List::Iterator it; 1520 PhoneNumber::List::Iterator it;
1521 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1521 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1522 if ( (*it).id() == phoneNumber.id() ) { 1522 if ( (*it).id() == phoneNumber.id() ) {
1523 *it = phoneNumber; 1523 *it = phoneNumber;
1524 return; 1524 return;
1525 } 1525 }
1526 } 1526 }
1527 mData->phoneNumbers.append( phoneNumber ); 1527 mData->phoneNumbers.append( phoneNumber );
1528} 1528}
1529 1529
1530void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber ) 1530void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber )
1531{ 1531{
1532 detach(); 1532 detach();
1533 1533
1534 PhoneNumber::List::Iterator it; 1534 PhoneNumber::List::Iterator it;
1535 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1535 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1536 if ( (*it).id() == phoneNumber.id() ) { 1536 if ( (*it).id() == phoneNumber.id() ) {
1537 mData->phoneNumbers.remove( it ); 1537 mData->phoneNumbers.remove( it );
1538 return; 1538 return;
1539 } 1539 }
1540 } 1540 }
1541} 1541}
1542 1542
1543PhoneNumber Addressee::phoneNumber( int type ) const 1543PhoneNumber Addressee::phoneNumber( int type ) const
1544{ 1544{
1545 PhoneNumber phoneNumber( "", type ); 1545 PhoneNumber phoneNumber( "", type );
1546 PhoneNumber::List::ConstIterator it; 1546 PhoneNumber::List::ConstIterator it;
1547 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1547 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1548 if ( matchBinaryPatternP( (*it).type(), type ) ) { 1548 if ( matchBinaryPatternP( (*it).type(), type ) ) {
1549 if ( (*it).type() & PhoneNumber::Pref ) 1549 if ( (*it).type() & PhoneNumber::Pref )
1550 return (*it); 1550 return (*it);
1551 else if ( phoneNumber.number().isEmpty() ) 1551 else if ( phoneNumber.number().isEmpty() )
1552 phoneNumber = (*it); 1552 phoneNumber = (*it);
1553 } 1553 }
1554 } 1554 }
1555 1555
1556 return phoneNumber; 1556 return phoneNumber;
1557} 1557}
1558 1558
1559PhoneNumber::List Addressee::phoneNumbers() const 1559PhoneNumber::List Addressee::phoneNumbers() const
1560{ 1560{
1561 return mData->phoneNumbers; 1561 return mData->phoneNumbers;
1562} 1562}
1563 1563
1564PhoneNumber::List Addressee::phoneNumbers( int type ) const 1564PhoneNumber::List Addressee::phoneNumbers( int type ) const
1565{ 1565{
1566 PhoneNumber::List list; 1566 PhoneNumber::List list;
1567 1567
1568 PhoneNumber::List::ConstIterator it; 1568 PhoneNumber::List::ConstIterator it;
1569 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1569 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1570 if ( matchBinaryPattern( (*it).type(), type ) ) { 1570 if ( matchBinaryPattern( (*it).type(), type ) ) {
1571 list.append( *it ); 1571 list.append( *it );
1572 } 1572 }
1573 } 1573 }
1574 return list; 1574 return list;
1575} 1575}
1576 1576
1577PhoneNumber Addressee::findPhoneNumber( const QString &id ) const 1577PhoneNumber Addressee::findPhoneNumber( const QString &id ) const
1578{ 1578{
1579 PhoneNumber::List::ConstIterator it; 1579 PhoneNumber::List::ConstIterator it;
1580 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1580 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1581 if ( (*it).id() == id ) { 1581 if ( (*it).id() == id ) {
1582 return *it; 1582 return *it;
1583 } 1583 }
1584 } 1584 }
1585 return PhoneNumber(); 1585 return PhoneNumber();
1586} 1586}
1587 1587
1588void Addressee::insertKey( const Key &key ) 1588void Addressee::insertKey( const Key &key )
1589{ 1589{
1590 detach(); 1590 detach();
1591 mData->empty = false; 1591 mData->empty = false;
1592 1592
1593 Key::List::Iterator it; 1593 Key::List::Iterator it;
1594 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1594 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1595 if ( (*it).id() == key.id() ) { 1595 if ( (*it).id() == key.id() ) {
1596 *it = key; 1596 *it = key;
1597 return; 1597 return;
1598 } 1598 }
1599 } 1599 }
1600 mData->keys.append( key ); 1600 mData->keys.append( key );
1601} 1601}
1602 1602
1603void Addressee::removeKey( const Key &key ) 1603void Addressee::removeKey( const Key &key )
1604{ 1604{
1605 detach(); 1605 detach();
1606 1606
1607 Key::List::Iterator it; 1607 Key::List::Iterator it;
1608 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1608 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1609 if ( (*it).id() == key.id() ) { 1609 if ( (*it).id() == key.id() ) {
1610 mData->keys.remove( key ); 1610 mData->keys.remove( key );
1611 return; 1611 return;
1612 } 1612 }
1613 } 1613 }
1614} 1614}
1615 1615
1616Key Addressee::key( int type, QString customTypeString ) const 1616Key Addressee::key( int type, QString customTypeString ) const
1617{ 1617{
1618 Key::List::ConstIterator it; 1618 Key::List::ConstIterator it;
1619 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1619 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1620 if ( (*it).type() == type ) { 1620 if ( (*it).type() == type ) {
1621 if ( type == Key::Custom ) { 1621 if ( type == Key::Custom ) {
1622 if ( customTypeString.isEmpty() ) { 1622 if ( customTypeString.isEmpty() ) {
1623 return *it; 1623 return *it;
1624 } else { 1624 } else {
1625 if ( (*it).customTypeString() == customTypeString ) 1625 if ( (*it).customTypeString() == customTypeString )
1626 return (*it); 1626 return (*it);
1627 } 1627 }
1628 } else { 1628 } else {
1629 return *it; 1629 return *it;
1630 } 1630 }
1631 } 1631 }
1632 } 1632 }
1633 return Key( QString(), type ); 1633 return Key( QString(), type );
1634} 1634}
1635void Addressee::setKeys( const Key::List& list ) { 1635void Addressee::setKeys( const Key::List& list ) {
1636 detach(); 1636 detach();
1637 mData->keys = list; 1637 mData->keys = list;
1638} 1638}
1639 1639
1640Key::List Addressee::keys() const 1640Key::List Addressee::keys() const
1641{ 1641{
1642 return mData->keys; 1642 return mData->keys;
1643} 1643}
1644 1644
1645Key::List Addressee::keys( int type, QString customTypeString ) const 1645Key::List Addressee::keys( int type, QString customTypeString ) const
1646{ 1646{
1647 Key::List list; 1647 Key::List list;
1648 1648
1649 Key::List::ConstIterator it; 1649 Key::List::ConstIterator it;
1650 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1650 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1651 if ( (*it).type() == type ) { 1651 if ( (*it).type() == type ) {
1652 if ( type == Key::Custom ) { 1652 if ( type == Key::Custom ) {
1653 if ( customTypeString.isEmpty() ) { 1653 if ( customTypeString.isEmpty() ) {
1654 list.append(*it); 1654 list.append(*it);
1655 } else { 1655 } else {
1656 if ( (*it).customTypeString() == customTypeString ) 1656 if ( (*it).customTypeString() == customTypeString )
1657 list.append(*it); 1657 list.append(*it);
1658 } 1658 }
1659 } else { 1659 } else {
1660 list.append(*it); 1660 list.append(*it);
1661 } 1661 }
1662 } 1662 }
1663 } 1663 }
1664 return list; 1664 return list;
1665} 1665}
1666 1666
1667Key Addressee::findKey( const QString &id ) const 1667Key Addressee::findKey( const QString &id ) const
1668{ 1668{
1669 Key::List::ConstIterator it; 1669 Key::List::ConstIterator it;
1670 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1670 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1671 if ( (*it).id() == id ) { 1671 if ( (*it).id() == id ) {
1672 return *it; 1672 return *it;
1673 } 1673 }
1674 } 1674 }
1675 return Key(); 1675 return Key();
1676} 1676}
1677 1677
1678QString Addressee::asString() const 1678QString Addressee::asString() const
1679{ 1679{
1680 return "Smith, agent Smith..."; 1680 return "Smith, agent Smith...";
1681} 1681}
1682 1682
1683void Addressee::dump() const 1683void Addressee::dump() const
1684{ 1684{
1685 return; 1685 return;
1686#if 0
1686 kdDebug(5700) << "Addressee {" << endl; 1687 kdDebug(5700) << "Addressee {" << endl;
1687 1688
1688 kdDebug(5700) << " Uid: '" << uid() << "'" << endl; 1689 kdDebug(5700) << " Uid: '" << uid() << "'" << endl;
1689 1690
1690 kdDebug(5700) << " Name: '" << name() << "'" << endl; 1691 kdDebug(5700) << " Name: '" << name() << "'" << endl;
1691 kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl; 1692 kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl;
1692 kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl; 1693 kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl;
1693 kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl; 1694 kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl;
1694 kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl; 1695 kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl;
1695 kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl; 1696 kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl;
1696 kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl; 1697 kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl;
1697 kdDebug(5700) << " NickName: '" << nickName() << "'" << endl; 1698 kdDebug(5700) << " NickName: '" << nickName() << "'" << endl;
1698 kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl; 1699 kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl;
1699 kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl; 1700 kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl;
1700 kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl; 1701 kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl;
1701 kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl; 1702 kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl;
1702 kdDebug(5700) << " Title: '" << title() << "'" << endl; 1703 kdDebug(5700) << " Title: '" << title() << "'" << endl;
1703 kdDebug(5700) << " Role: '" << role() << "'" << endl; 1704 kdDebug(5700) << " Role: '" << role() << "'" << endl;
1704 kdDebug(5700) << " Organization: '" << organization() << "'" << endl; 1705 kdDebug(5700) << " Organization: '" << organization() << "'" << endl;
1705 kdDebug(5700) << " Note: '" << note() << "'" << endl; 1706 kdDebug(5700) << " Note: '" << note() << "'" << endl;
1706 kdDebug(5700) << " ProductId: '" << productId() << "'" << endl; 1707 kdDebug(5700) << " ProductId: '" << productId() << "'" << endl;
1707 kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl; 1708 kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl;
1708 kdDebug(5700) << " SortString: '" << sortString() << "'" << endl; 1709 kdDebug(5700) << " SortString: '" << sortString() << "'" << endl;
1709 kdDebug(5700) << " Url: '" << url().url() << "'" << endl; 1710 kdDebug(5700) << " Url: '" << url().url() << "'" << endl;
1710 kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl; 1711 kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl;
1711 kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl; 1712 kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl;
1712 kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl; 1713 kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl;
1713 kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl; 1714 kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl;
1714 kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl; 1715 kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl;
1715 1716
1716 kdDebug(5700) << " Emails {" << endl; 1717 kdDebug(5700) << " Emails {" << endl;
1717 QStringList e = emails(); 1718 QStringList e = emails();
1718 QStringList::ConstIterator it; 1719 QStringList::ConstIterator it;
1719 for( it = e.begin(); it != e.end(); ++it ) { 1720 for( it = e.begin(); it != e.end(); ++it ) {
1720 kdDebug(5700) << " " << (*it) << endl; 1721 kdDebug(5700) << " " << (*it) << endl;
1721 } 1722 }
1722 kdDebug(5700) << " }" << endl; 1723 kdDebug(5700) << " }" << endl;
1723 1724
1724 kdDebug(5700) << " PhoneNumbers {" << endl; 1725 kdDebug(5700) << " PhoneNumbers {" << endl;
1725 PhoneNumber::List p = phoneNumbers(); 1726 PhoneNumber::List p = phoneNumbers();
1726 PhoneNumber::List::ConstIterator it2; 1727 PhoneNumber::List::ConstIterator it2;
1727 for( it2 = p.begin(); it2 != p.end(); ++it2 ) { 1728 for( it2 = p.begin(); it2 != p.end(); ++it2 ) {
1728 kdDebug(5700) << " Type: " << int((*it2).type()) << " Number: " << (*it2).number() << endl; 1729 kdDebug(5700) << " Type: " << int((*it2).type()) << " Number: " << (*it2).number() << endl;
1729 } 1730 }
1730 kdDebug(5700) << " }" << endl; 1731 kdDebug(5700) << " }" << endl;
1731 1732
1732 Address::List a = addresses(); 1733 Address::List a = addresses();
1733 Address::List::ConstIterator it3; 1734 Address::List::ConstIterator it3;
1734 for( it3 = a.begin(); it3 != a.end(); ++it3 ) { 1735 for( it3 = a.begin(); it3 != a.end(); ++it3 ) {
1735 (*it3).dump(); 1736 (*it3).dump();
1736 } 1737 }
1737 1738
1738 kdDebug(5700) << " Keys {" << endl; 1739 kdDebug(5700) << " Keys {" << endl;
1739 Key::List k = keys(); 1740 Key::List k = keys();
1740 Key::List::ConstIterator it4; 1741 Key::List::ConstIterator it4;
1741 for( it4 = k.begin(); it4 != k.end(); ++it4 ) { 1742 for( it4 = k.begin(); it4 != k.end(); ++it4 ) {
1742 kdDebug(5700) << " Type: " << int((*it4).type()) << 1743 kdDebug(5700) << " Type: " << int((*it4).type()) <<
1743 " Key: " << (*it4).textData() << 1744 " Key: " << (*it4).textData() <<
1744 " CustomString: " << (*it4).customTypeString() << endl; 1745 " CustomString: " << (*it4).customTypeString() << endl;
1745 } 1746 }
1746 kdDebug(5700) << " }" << endl; 1747 kdDebug(5700) << " }" << endl;
1747 1748
1748 kdDebug(5700) << "}" << endl; 1749 kdDebug(5700) << "}" << endl;
1750#endif
1749} 1751}
1750 1752
1751 1753
1752void Addressee::insertAddress( const Address &address ) 1754void Addressee::insertAddress( const Address &address )
1753{ 1755{
1754 detach(); 1756 detach();
1755 mData->empty = false; 1757 mData->empty = false;
1756 1758
1757 Address::List::Iterator it; 1759 Address::List::Iterator it;
1758 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 1760 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1759 if ( (*it).id() == address.id() ) { 1761 if ( (*it).id() == address.id() ) {
1760 *it = address; 1762 *it = address;
1761 return; 1763 return;
1762 } 1764 }
1763 } 1765 }
1764 mData->addresses.append( address ); 1766 mData->addresses.append( address );
1765} 1767}
1766 1768
1767void Addressee::removeAddress( const Address &address ) 1769void Addressee::removeAddress( const Address &address )
1768{ 1770{
1769 detach(); 1771 detach();
1770 1772
1771 Address::List::Iterator it; 1773 Address::List::Iterator it;
1772 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 1774 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1773 if ( (*it).id() == address.id() ) { 1775 if ( (*it).id() == address.id() ) {
1774 mData->addresses.remove( it ); 1776 mData->addresses.remove( it );
1775 return; 1777 return;
1776 } 1778 }
1777 } 1779 }
1778} 1780}
1779 1781
1780Address Addressee::address( int type ) const 1782Address Addressee::address( int type ) const
1781{ 1783{
1782 Address address( type ); 1784 Address address( type );
1783 Address::List::ConstIterator it; 1785 Address::List::ConstIterator it;
1784 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 1786 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1785 if ( matchBinaryPatternA( (*it).type(), type ) ) { 1787 if ( matchBinaryPatternA( (*it).type(), type ) ) {
1786 if ( (*it).type() & Address::Pref ) 1788 if ( (*it).type() & Address::Pref )
1787 return (*it); 1789 return (*it);
1788 else if ( address.isEmpty() ) 1790 else if ( address.isEmpty() )
1789 address = (*it); 1791 address = (*it);
1790 } 1792 }
1791 } 1793 }
1792 1794
1793 return address; 1795 return address;
1794} 1796}
1795 1797
1796Address::List Addressee::addresses() const 1798Address::List Addressee::addresses() const
1797{ 1799{
1798 return mData->addresses; 1800 return mData->addresses;
1799} 1801}
1800 1802
1801Address::List Addressee::addresses( int type ) const 1803Address::List Addressee::addresses( int type ) const
1802{ 1804{
1803 Address::List list; 1805 Address::List list;
1804 1806
1805 Address::List::ConstIterator it; 1807 Address::List::ConstIterator it;
1806 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 1808 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1807 if ( matchBinaryPattern( (*it).type(), type ) ) { 1809 if ( matchBinaryPattern( (*it).type(), type ) ) {
1808 list.append( *it ); 1810 list.append( *it );
1809 } 1811 }
1810 } 1812 }
1811 1813
1812 return list; 1814 return list;
1813} 1815}
1814 1816
1815Address Addressee::findAddress( const QString &id ) const 1817Address Addressee::findAddress( const QString &id ) const
1816{ 1818{
1817 Address::List::ConstIterator it; 1819 Address::List::ConstIterator it;
1818 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 1820 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1819 if ( (*it).id() == id ) { 1821 if ( (*it).id() == id ) {
1820 return *it; 1822 return *it;
1821 } 1823 }
1822 } 1824 }
1823 return Address(); 1825 return Address();
1824} 1826}
1825 1827
1826void Addressee::insertCategory( const QString &c ) 1828void Addressee::insertCategory( const QString &c )
1827{ 1829{
1828 detach(); 1830 detach();
1829 mData->empty = false; 1831 mData->empty = false;
1830 1832
1831 if ( mData->categories.contains( c ) ) return; 1833 if ( mData->categories.contains( c ) ) return;
1832 1834
1833 mData->categories.append( c ); 1835 mData->categories.append( c );
1834} 1836}
1835 1837
1836void Addressee::removeCategory( const QString &c ) 1838void Addressee::removeCategory( const QString &c )
1837{ 1839{
1838 detach(); 1840 detach();
1839 1841
1840 QStringList::Iterator it = mData->categories.find( c ); 1842 QStringList::Iterator it = mData->categories.find( c );
1841 if ( it == mData->categories.end() ) return; 1843 if ( it == mData->categories.end() ) return;
1842 1844
1843 mData->categories.remove( it ); 1845 mData->categories.remove( it );
1844} 1846}
1845 1847
1846bool Addressee::hasCategory( const QString &c ) const 1848bool Addressee::hasCategory( const QString &c ) const
1847{ 1849{
1848 return ( mData->categories.contains( c ) ); 1850 return ( mData->categories.contains( c ) );
1849} 1851}
1850 1852
1851void Addressee::setCategories( const QStringList &c ) 1853void Addressee::setCategories( const QStringList &c )
1852{ 1854{
1853 detach(); 1855 detach();
1854 mData->empty = false; 1856 mData->empty = false;
1855 1857
1856 mData->categories = c; 1858 mData->categories = c;
1857} 1859}
1858 1860
1859QStringList Addressee::categories() const 1861QStringList Addressee::categories() const
1860{ 1862{
1861 return mData->categories; 1863 return mData->categories;
1862} 1864}
1863 1865
1864void Addressee::insertCustom( const QString &app, const QString &name, 1866void Addressee::insertCustom( const QString &app, const QString &name,
1865 const QString &value ) 1867 const QString &value )
1866{ 1868{
1867 if ( value.isNull() || name.isEmpty() || app.isEmpty() ) return; 1869 if ( value.isNull() || name.isEmpty() || app.isEmpty() ) return;
1868 1870
1869 detach(); 1871 detach();
1870 mData->empty = false; 1872 mData->empty = false;
1871 1873
1872 QString qualifiedName = app + "-" + name + ":"; 1874 QString qualifiedName = app + "-" + name + ":";
1873 1875
1874 QStringList::Iterator it; 1876 QStringList::Iterator it;
1875 for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { 1877 for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) {
1876 if ( (*it).startsWith( qualifiedName ) ) { 1878 if ( (*it).startsWith( qualifiedName ) ) {
1877 (*it) = qualifiedName + value; 1879 (*it) = qualifiedName + value;
1878 return; 1880 return;
1879 } 1881 }
1880 } 1882 }
1881 mData->custom.append( qualifiedName + value ); 1883 mData->custom.append( qualifiedName + value );
1882} 1884}
1883 1885
1884void Addressee::removeCustom( const QString &app, const QString &name) 1886void Addressee::removeCustom( const QString &app, const QString &name)
1885{ 1887{
1886 detach(); 1888 detach();
1887 1889
1888 QString qualifiedName = app + "-" + name + ":"; 1890 QString qualifiedName = app + "-" + name + ":";
1889 1891
1890 QStringList::Iterator it; 1892 QStringList::Iterator it;
1891 for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { 1893 for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) {
1892 if ( (*it).startsWith( qualifiedName ) ) { 1894 if ( (*it).startsWith( qualifiedName ) ) {
1893 mData->custom.remove( it ); 1895 mData->custom.remove( it );
1894 return; 1896 return;
1895 } 1897 }
1896 } 1898 }
1897} 1899}
1898 1900
1899QString Addressee::custom( const QString &app, const QString &name ) const 1901QString Addressee::custom( const QString &app, const QString &name ) const
1900{ 1902{
1901 QString qualifiedName = app + "-" + name + ":"; 1903 QString qualifiedName = app + "-" + name + ":";
1902 QString value; 1904 QString value;
1903 1905
1904 QStringList::ConstIterator it; 1906 QStringList::ConstIterator it;
1905 for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { 1907 for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) {
1906 if ( (*it).startsWith( qualifiedName ) ) { 1908 if ( (*it).startsWith( qualifiedName ) ) {
1907 value = (*it).mid( (*it).find( ":" ) + 1 ); 1909 value = (*it).mid( (*it).find( ":" ) + 1 );
1908 break; 1910 break;
1909 } 1911 }
1910 } 1912 }
1911 1913
1912 return value; 1914 return value;
1913} 1915}
1914 1916
1915void Addressee::setCustoms( const QStringList &l ) 1917void Addressee::setCustoms( const QStringList &l )
1916{ 1918{
1917 detach(); 1919 detach();
1918 mData->empty = false; 1920 mData->empty = false;
1919 1921
1920 mData->custom = l; 1922 mData->custom = l;
1921} 1923}
1922 1924
1923QStringList Addressee::customs() const 1925QStringList Addressee::customs() const
1924{ 1926{
1925 return mData->custom; 1927 return mData->custom;
1926} 1928}
1927 1929
1928void Addressee::parseEmailAddress( const QString &rawEmail, QString &fullName, 1930void Addressee::parseEmailAddress( const QString &rawEmail, QString &fullName,
1929 QString &email) 1931 QString &email)
1930{ 1932{
1931 int startPos, endPos, len; 1933 int startPos, endPos, len;
1932 QString partA, partB, result; 1934 QString partA, partB, result;
1933 char endCh = '>'; 1935 char endCh = '>';
1934 1936
1935 startPos = rawEmail.find('<'); 1937 startPos = rawEmail.find('<');
1936 if (startPos < 0) 1938 if (startPos < 0)
1937 { 1939 {
1938 startPos = rawEmail.find('('); 1940 startPos = rawEmail.find('(');
1939 endCh = ')'; 1941 endCh = ')';
1940 } 1942 }
1941 if (startPos < 0) 1943 if (startPos < 0)
1942 { 1944 {
1943 // We couldn't find any separators, so we assume the whole string 1945 // We couldn't find any separators, so we assume the whole string
1944 // is the email address 1946 // is the email address
1945 email = rawEmail; 1947 email = rawEmail;
1946 fullName = ""; 1948 fullName = "";
1947 } 1949 }
1948 else 1950 else
1949 { 1951 {
1950 // We have a start position, try to find an end 1952 // We have a start position, try to find an end
1951 endPos = rawEmail.find(endCh, startPos+1); 1953 endPos = rawEmail.find(endCh, startPos+1);
1952 1954
1953 if (endPos < 0) 1955 if (endPos < 0)
1954 { 1956 {
1955 // We couldn't find the end of the email address. We can only 1957 // We couldn't find the end of the email address. We can only
1956 // assume the entire string is the email address. 1958 // assume the entire string is the email address.
1957 email = rawEmail; 1959 email = rawEmail;
1958 fullName = ""; 1960 fullName = "";
1959 } 1961 }
1960 else 1962 else
1961 { 1963 {
1962 // We have a start and end to the email address 1964 // We have a start and end to the email address
1963 1965
1964 // Grab the name part 1966 // Grab the name part
1965 fullName = rawEmail.left(startPos).stripWhiteSpace(); 1967 fullName = rawEmail.left(startPos).stripWhiteSpace();
1966 1968
1967 // grab the email part 1969 // grab the email part
1968 email = rawEmail.mid(startPos+1, endPos-startPos-1).stripWhiteSpace(); 1970 email = rawEmail.mid(startPos+1, endPos-startPos-1).stripWhiteSpace();
1969 1971
1970 // Check that we do not have any extra characters on the end of the 1972 // Check that we do not have any extra characters on the end of the
1971 // strings 1973 // strings
1972 len = fullName.length(); 1974 len = fullName.length();
1973 if (fullName[0]=='"' && fullName[len-1]=='"') 1975 if (fullName[0]=='"' && fullName[len-1]=='"')
1974 fullName = fullName.mid(1, len-2); 1976 fullName = fullName.mid(1, len-2);
1975 else if (fullName[0]=='<' && fullName[len-1]=='>') 1977 else if (fullName[0]=='<' && fullName[len-1]=='>')
1976 fullName = fullName.mid(1, len-2); 1978 fullName = fullName.mid(1, len-2);
1977 else if (fullName[0]=='(' && fullName[len-1]==')') 1979 else if (fullName[0]=='(' && fullName[len-1]==')')
1978 fullName = fullName.mid(1, len-2); 1980 fullName = fullName.mid(1, len-2);
1979 } 1981 }
1980 } 1982 }
1981} 1983}
1982 1984
1983void Addressee::setResource( Resource *resource ) 1985void Addressee::setResource( Resource *resource )
1984{ 1986{
1985 detach(); 1987 detach();
1986 mData->resource = resource; 1988 mData->resource = resource;
1987} 1989}
1988 1990
1989Resource *Addressee::resource() const 1991Resource *Addressee::resource() const
1990{ 1992{
1991 return mData->resource; 1993 return mData->resource;
1992} 1994}
1993 1995
1994//US 1996//US
1995QString Addressee::resourceLabel() 1997QString Addressee::resourceLabel()
1996{ 1998{
1997 return i18n("Resource"); 1999 return i18n("Resource");
1998} 2000}
1999QString Addressee::categoryLabel() 2001QString Addressee::categoryLabel()
2000{ 2002{
2001 return i18n("Category"); 2003 return i18n("Category");
2002} 2004}
2003 2005
2004void Addressee::setChanged( bool value ) 2006void Addressee::setChanged( bool value )
2005{ 2007{
2006 detach(); 2008 detach();
2007 mData->changed = value; 2009 mData->changed = value;
2008} 2010}
2009 2011
2010bool Addressee::changed() const 2012bool Addressee::changed() const
2011{ 2013{
2012 return mData->changed; 2014 return mData->changed;
2013} 2015}
2014 2016
2015void Addressee::setTagged( bool value ) 2017void Addressee::setTagged( bool value )
2016{ 2018{
2017 detach(); 2019 detach();
2018 mData->tagged = value; 2020 mData->tagged = value;
2019} 2021}
2020 2022
2021bool Addressee::tagged() const 2023bool Addressee::tagged() const
2022{ 2024{
2023 return mData->tagged; 2025 return mData->tagged;
2024} 2026}
2025 2027
2026QDataStream &KABC::operator<<( QDataStream &s, const Addressee &a ) 2028QDataStream &KABC::operator<<( QDataStream &s, const Addressee &a )
2027{ 2029{
2028 if (!a.mData) return s; 2030 if (!a.mData) return s;
2029 2031
2030 s << a.uid(); 2032 s << a.uid();
2031 2033
2032 s << a.mData->name; 2034 s << a.mData->name;
2033 s << a.mData->formattedName; 2035 s << a.mData->formattedName;
2034 s << a.mData->familyName; 2036 s << a.mData->familyName;
2035 s << a.mData->givenName; 2037 s << a.mData->givenName;
2036 s << a.mData->additionalName; 2038 s << a.mData->additionalName;
2037 s << a.mData->prefix; 2039 s << a.mData->prefix;
2038 s << a.mData->suffix; 2040 s << a.mData->suffix;
2039 s << a.mData->nickName; 2041 s << a.mData->nickName;
2040 s << a.mData->birthday; 2042 s << a.mData->birthday;
2041 s << a.mData->mailer; 2043 s << a.mData->mailer;
2042 s << a.mData->timeZone; 2044 s << a.mData->timeZone;
2043 s << a.mData->geo; 2045 s << a.mData->geo;
2044 s << a.mData->title; 2046 s << a.mData->title;
2045 s << a.mData->role; 2047 s << a.mData->role;
2046 s << a.mData->organization; 2048 s << a.mData->organization;
2047 s << a.mData->note; 2049 s << a.mData->note;
2048 s << a.mData->productId; 2050 s << a.mData->productId;
2049 s << a.mData->revision; 2051 s << a.mData->revision;
2050 s << a.mData->sortString; 2052 s << a.mData->sortString;
2051 s << a.mData->url; 2053 s << a.mData->url;
2052 s << a.mData->secrecy; 2054 s << a.mData->secrecy;
2053 s << a.mData->logo; 2055 s << a.mData->logo;
2054 s << a.mData->photo; 2056 s << a.mData->photo;
2055 s << a.mData->sound; 2057 s << a.mData->sound;
2056 s << a.mData->agent; 2058 s << a.mData->agent;
2057 s << a.mData->phoneNumbers; 2059 s << a.mData->phoneNumbers;
2058 s << a.mData->addresses; 2060 s << a.mData->addresses;
2059 s << a.mData->emails; 2061 s << a.mData->emails;
2060 s << a.mData->categories; 2062 s << a.mData->categories;
2061 s << a.mData->custom; 2063 s << a.mData->custom;
2062 s << a.mData->keys; 2064 s << a.mData->keys;
2063 return s; 2065 return s;
2064} 2066}
2065 2067
2066QDataStream &KABC::operator>>( QDataStream &s, Addressee &a ) 2068QDataStream &KABC::operator>>( QDataStream &s, Addressee &a )
2067{ 2069{
2068 if (!a.mData) return s; 2070 if (!a.mData) return s;
2069 2071
2070 s >> a.mData->uid; 2072 s >> a.mData->uid;
2071 2073
2072 s >> a.mData->name; 2074 s >> a.mData->name;
2073 s >> a.mData->formattedName; 2075 s >> a.mData->formattedName;
2074 s >> a.mData->familyName; 2076 s >> a.mData->familyName;
2075 s >> a.mData->givenName; 2077 s >> a.mData->givenName;
2076 s >> a.mData->additionalName; 2078 s >> a.mData->additionalName;
2077 s >> a.mData->prefix; 2079 s >> a.mData->prefix;
2078 s >> a.mData->suffix; 2080 s >> a.mData->suffix;
2079 s >> a.mData->nickName; 2081 s >> a.mData->nickName;
2080 s >> a.mData->birthday; 2082 s >> a.mData->birthday;
2081 s >> a.mData->mailer; 2083 s >> a.mData->mailer;
2082 s >> a.mData->timeZone; 2084 s >> a.mData->timeZone;
2083 s >> a.mData->geo; 2085 s >> a.mData->geo;
2084 s >> a.mData->title; 2086 s >> a.mData->title;
2085 s >> a.mData->role; 2087 s >> a.mData->role;
2086 s >> a.mData->organization; 2088 s >> a.mData->organization;
2087 s >> a.mData->note; 2089 s >> a.mData->note;
2088 s >> a.mData->productId; 2090 s >> a.mData->productId;
2089 s >> a.mData->revision; 2091 s >> a.mData->revision;
2090 s >> a.mData->sortString; 2092 s >> a.mData->sortString;
2091 s >> a.mData->url; 2093 s >> a.mData->url;
2092 s >> a.mData->secrecy; 2094 s >> a.mData->secrecy;
2093 s >> a.mData->logo; 2095 s >> a.mData->logo;
2094 s >> a.mData->photo; 2096 s >> a.mData->photo;
2095 s >> a.mData->sound; 2097 s >> a.mData->sound;
2096 s >> a.mData->agent; 2098 s >> a.mData->agent;
2097 s >> a.mData->phoneNumbers; 2099 s >> a.mData->phoneNumbers;
2098 s >> a.mData->addresses; 2100 s >> a.mData->addresses;
2099 s >> a.mData->emails; 2101 s >> a.mData->emails;
2100 s >> a.mData->categories; 2102 s >> a.mData->categories;
2101 s >> a.mData->custom; 2103 s >> a.mData->custom;
2102 s >> a.mData->keys; 2104 s >> a.mData->keys;
2103 2105
2104 a.mData->empty = false; 2106 a.mData->empty = false;
2105 2107
2106 return s; 2108 return s;
2107} 2109}
2108bool matchBinaryPattern( int value, int pattern ) 2110bool matchBinaryPattern( int value, int pattern )
2109{ 2111{
2110 /** 2112 /**
2111 We want to match all telephonnumbers/addresses which have the bits in the 2113 We want to match all telephonnumbers/addresses which have the bits in the
2112 pattern set. More are allowed. 2114 pattern set. More are allowed.
2113 if pattern == 0 we have a special handling, then we want only those with 2115 if pattern == 0 we have a special handling, then we want only those with
2114 exactly no bit set. 2116 exactly no bit set.
2115 */ 2117 */
2116 if ( pattern == 0 ) 2118 if ( pattern == 0 )
2117 return ( value == 0 ); 2119 return ( value == 0 );
2118 else 2120 else
2119 return ( pattern == ( pattern & value ) ); 2121 return ( pattern == ( pattern & value ) );
2120} 2122}
2121 2123
2122bool matchBinaryPatternP( int value, int pattern ) 2124bool matchBinaryPatternP( int value, int pattern )
2123{ 2125{
2124 2126
2125 if ( pattern == 0 ) 2127 if ( pattern == 0 )
2126 return ( value == 0 ); 2128 return ( value == 0 );
2127 else 2129 else
2128 return ( (pattern |PhoneNumber::Pref ) == ( value |PhoneNumber::Pref ) ); 2130 return ( (pattern |PhoneNumber::Pref ) == ( value |PhoneNumber::Pref ) );
2129} 2131}
2130bool matchBinaryPatternA( int value, int pattern ) 2132bool matchBinaryPatternA( int value, int pattern )
2131{ 2133{
2132 2134
2133 if ( pattern == 0 ) 2135 if ( pattern == 0 )
2134 return ( value == 0 ); 2136 return ( value == 0 );
2135 else 2137 else
2136 return ( (pattern | Address::Pref) == ( value | Address::Pref ) ); 2138 return ( (pattern | Address::Pref) == ( value | Address::Pref ) );
2137} 2139}
diff --git a/kabc/picture.cpp b/kabc/picture.cpp
index 6a34b98..57aa297 100644
--- a/kabc/picture.cpp
+++ b/kabc/picture.cpp
@@ -1,141 +1,167 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include "picture.h" 28#include "picture.h"
29 29
30using namespace KABC; 30using namespace KABC;
31 31
32Picture::Picture() 32Picture::Picture()
33 : mIntern( false ) 33 : mIntern( false )
34{ 34{
35 mUndefined = true; 35 mUndefined = true;
36} 36}
37 37
38Picture::Picture( const QString &url ) 38Picture::Picture( const QString &url )
39 : mUrl( url ), mIntern( false ) 39 : mUrl( url ), mIntern( false )
40{ 40{
41 mUndefined = false; 41 mUndefined = false;
42} 42}
43 43
44Picture::Picture( const QImage &data ) 44Picture::Picture( const QImage &data )
45 : mData( data ), mIntern( true ) 45 : mData( data ), mIntern( true )
46{ 46{
47 mUndefined = false; 47 mUndefined = false;
48} 48}
49 49
50Picture::~Picture() 50Picture::~Picture()
51{ 51{
52} 52}
53 53
54bool Picture::operator==( const Picture &p ) const 54bool Picture::operator==( const Picture &p ) const
55{ 55{
56 if ( mIntern != p.mIntern ) return false; 56 //qDebug("compare PIC ");
57 57 if ( mUndefined && p.mUndefined ) {
58 //qDebug("compare PIC true 1 ");
59 return true;
60 }
61 if ( mUndefined || p.mUndefined ) {
62 //qDebug("compare PIC false 1");
63 return false;
64 }
65 // now we should deal with two defined pics!
66 if ( mIntern != p.mIntern ) {
67 //qDebug("compare PIC false 2");
68 return false;
69 }
58 if ( mIntern ) { 70 if ( mIntern ) {
59 if ( mData != p.mData ) 71 //qDebug("mIntern ");
72 if ( mData.isNull() && p.mData.isNull() ) {
73 //qDebug("compare PIC true 2 ");
74 return true;
75 }
76 if ( mData.isNull() || p.mData.isNull() ){
77 //qDebug("compare PIC false 3-1");
78
79 return false;
80 }
81 if ( mData != p.mData ) {
82 //qDebug("compare PIC false 3");
60 return false; 83 return false;
84 }
61 } else { 85 } else {
62 if ( mUrl != p.mUrl ) 86 if ( mUrl != p.mUrl ) {
63 return false; 87 //qDebug("compare PIC false 4");
88 return false;
89 }
64 } 90 }
65 91 //qDebug("compare PIC true ");
66 return true; 92 return true;
67} 93}
68 94
69bool Picture::operator!=( const Picture &p ) const 95bool Picture::operator!=( const Picture &p ) const
70{ 96{
71 return !( p == *this ); 97 return !( p == *this );
72} 98}
73 99
74void Picture::setUrl( const QString &url ) 100void Picture::setUrl( const QString &url )
75{ 101{
76 mUrl = url; 102 mUrl = url;
77 mIntern = false; 103 mIntern = false;
78 mUndefined = false; 104 mUndefined = false;
79} 105}
80 106
81void Picture::setData( const QImage &data ) 107void Picture::setData( const QImage &data )
82{ 108{
83 mData = data; 109 mData = data;
84 mIntern = true; 110 mIntern = true;
85 mUndefined = false; 111 mUndefined = false;
86} 112}
87 113
88void Picture::setType( const QString &type ) 114void Picture::setType( const QString &type )
89{ 115{
90 mType = type; 116 mType = type;
91} 117}
92 118
93bool Picture::isIntern() const 119bool Picture::isIntern() const
94{ 120{
95 return mIntern; 121 return mIntern;
96} 122}
97 123
98QString Picture::url() const 124QString Picture::url() const
99{ 125{
100 return mUrl; 126 return mUrl;
101} 127}
102 128
103QImage Picture::data() const 129QImage Picture::data() const
104{ 130{
105 return mData; 131 return mData;
106} 132}
107QPixmap Picture::pixmap() const 133QPixmap Picture::pixmap() const
108{ 134{
109 QPixmap p; 135 QPixmap p;
110 p.convertFromImage ( mData ); 136 p.convertFromImage ( mData );
111 return p; 137 return p;
112} 138}
113 139
114QString Picture::type() const 140QString Picture::type() const
115{ 141{
116 return mType; 142 return mType;
117} 143}
118bool Picture::undefined() const 144bool Picture::undefined() const
119{ 145{
120 return mUndefined; 146 return mUndefined;
121} 147}
122 148
123 149
124QString Picture::asString() const 150QString Picture::asString() const
125{ 151{
126 if ( mIntern ) 152 if ( mIntern )
127 return "intern picture"; 153 return "intern picture";
128 else 154 else
129 return mUrl; 155 return mUrl;
130} 156}
131 157
132QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture ) 158QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture )
133{ 159{
134 return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData; 160 return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData;
135} 161}
136 162
137QDataStream &KABC::operator>>( QDataStream &s, Picture &picture ) 163QDataStream &KABC::operator>>( QDataStream &s, Picture &picture )
138{ 164{
139 s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData; 165 s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData;
140 return s; 166 return s;
141} 167}
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp
index c368172..2f88cde 100644
--- a/kabc/vcard/ContentLine.cpp
+++ b/kabc/vcard/ContentLine.cpp
@@ -1,321 +1,349 @@
1/* 1/*
2 libvcard - vCard parsing library for vCard version 3.0 2 libvcard - vCard parsing library for vCard version 3.0
3 3
4 Copyright (C) 1999 Rik Hemsley rik@kde.org 4 Copyright (C) 1999 Rik Hemsley rik@kde.org
5 5
6 Permission is hereby granted, free of charge, to any person obtaining a copy 6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to 7 of this software and associated documentation files (the "Software"), to
8 deal in the Software without restriction, including without limitation the 8 deal in the Software without restriction, including without limitation the
9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 sell copies of the Software, and to permit persons to whom the Software is 10 sell copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions: 11 furnished to do so, subject to the following conditions:
12 12
13 The above copyright notice and this permission notice shall be included in 13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software. 14 all copies or substantial portions of the Software.
15 15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*/ 22*/
23 23
24#include <qcstring.h> 24#include <qcstring.h>
25#include <qstrlist.h> 25#include <qstrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27 27
28#include <kdebug.h> 28#include <kdebug.h>
29 29
30#include <VCardAdrParam.h> 30#include <VCardAdrParam.h>
31#include <VCardAgentParam.h> 31#include <VCardAgentParam.h>
32#include <VCardDateParam.h> 32#include <VCardDateParam.h>
33#include <VCardEmailParam.h> 33#include <VCardEmailParam.h>
34#include <VCardImageParam.h> 34#include <VCardImageParam.h>
35#include <VCardSourceParam.h> 35#include <VCardSourceParam.h>
36#include <VCardTelParam.h> 36#include <VCardTelParam.h>
37#include <VCardTextBinParam.h> 37#include <VCardTextBinParam.h>
38#include <VCardTextParam.h> 38#include <VCardTextParam.h>
39 39
40#include <VCardAdrValue.h> 40#include <VCardAdrValue.h>
41#include <VCardAgentValue.h> 41#include <VCardAgentValue.h>
42#include <VCardDateValue.h> 42#include <VCardDateValue.h>
43#include <VCardImageValue.h> 43#include <VCardImageValue.h>
44#include <VCardTextValue.h> 44#include <VCardTextValue.h>
45#include <VCardTextBinValue.h> 45#include <VCardTextBinValue.h>
46#include <VCardLangValue.h> 46#include <VCardLangValue.h>
47#include <VCardNValue.h> 47#include <VCardNValue.h>
48#include <VCardURIValue.h> 48#include <VCardURIValue.h>
49#include <VCardSoundValue.h> 49#include <VCardSoundValue.h>
50#include <VCardClassValue.h> 50#include <VCardClassValue.h>
51#include <VCardFloatValue.h> 51#include <VCardFloatValue.h>
52#include <VCardOrgValue.h> 52#include <VCardOrgValue.h>
53#include <VCardTelValue.h> 53#include <VCardTelValue.h>
54#include <VCardTextListValue.h> 54#include <VCardTextListValue.h>
55#include <VCardUTCValue.h> 55#include <VCardUTCValue.h>
56#include <VCardGeoValue.h> 56#include <VCardGeoValue.h>
57 57
58#include <VCardRToken.h> 58#include <VCardRToken.h>
59#include <VCardContentLine.h> 59#include <VCardContentLine.h>
60 60
61#include <VCardEntity.h> 61#include <VCardEntity.h>
62#include <VCardEnum.h> 62#include <VCardEnum.h>
63#include <VCardDefines.h> 63#include <VCardDefines.h>
64 64
65using namespace VCARD; 65using namespace VCARD;
66 66
67ContentLine::ContentLine() 67ContentLine::ContentLine()
68 :Entity(), 68 :Entity(),
69 value_(0), 69 value_(0),
70 paramType_( ParamUnknown ), 70 paramType_( ParamUnknown ),
71 valueType_( ValueUnknown ), 71 valueType_( ValueUnknown ),
72 entityType_( EntityUnknown ) 72 entityType_( EntityUnknown )
73{ 73{
74 paramList_.setAutoDelete( TRUE ); 74 paramList_.setAutoDelete( TRUE );
75} 75}
76 76
77ContentLine::ContentLine(const ContentLine & x) 77ContentLine::ContentLine(const ContentLine & x)
78 :Entity(x), 78 :Entity(x),
79 group_ (x.group_), 79 group_ (x.group_),
80 name_ (x.name_), 80 name_ (x.name_),
81 /*US paramList_(x.paramList_),*/ 81 /*US paramList_(x.paramList_),*/
82 value_(x.value_->clone()), 82 value_(x.value_->clone()),
83 paramType_(x.paramType_), 83 paramType_(x.paramType_),
84 valueType_(x.valueType_), 84 valueType_(x.valueType_),
85 entityType_(x.entityType_) 85 entityType_(x.entityType_)
86{ 86{
87 paramList_.setAutoDelete( TRUE ); 87 paramList_.setAutoDelete( TRUE );
88 88
89 89
90 ParamListIterator it(x.paramList_); 90 ParamListIterator it(x.paramList_);
91 for (; it.current(); ++it) 91 for (; it.current(); ++it)
92 { 92 {
93 Param *p = new Param; 93 Param *p = new Param;
94 p->setName( it.current()->name() ); 94 p->setName( it.current()->name() );
95 p->setValue( it.current()->value() ); 95 p->setValue( it.current()->value() );
96 paramList_.append(p); 96 paramList_.append(p);
97 } 97 }
98 98
99} 99}
100 100
101ContentLine::ContentLine(const QCString & s) 101ContentLine::ContentLine(const QCString & s)
102 :Entity(s), 102 :Entity(s),
103 value_(0), 103 value_(0),
104 paramType_( ParamUnknown ), 104 paramType_( ParamUnknown ),
105 valueType_( ValueUnknown ), 105 valueType_( ValueUnknown ),
106 entityType_( EntityUnknown ) 106 entityType_( EntityUnknown )
107{ 107{
108 paramList_.setAutoDelete( TRUE ); 108 paramList_.setAutoDelete( TRUE );
109} 109}
110 110
111 ContentLine & 111 ContentLine &
112ContentLine::operator = (ContentLine & x) 112ContentLine::operator = (ContentLine & x)
113{ 113{
114 if (*this == x) return *this; 114 if (*this == x) return *this;
115 115
116 ParamListIterator it(x.paramList_); 116 ParamListIterator it(x.paramList_);
117 for (; it.current(); ++it) 117 for (; it.current(); ++it)
118 { 118 {
119 Param *p = new Param; 119 Param *p = new Param;
120 p->setName( it.current()->name() ); 120 p->setName( it.current()->name() );
121 p->setValue( it.current()->value() ); 121 p->setValue( it.current()->value() );
122 paramList_.append(p); 122 paramList_.append(p);
123 } 123 }
124 124
125 value_ = x.value_->clone(); 125 value_ = x.value_->clone();
126 126
127 Entity::operator = (x); 127 Entity::operator = (x);
128 return *this; 128 return *this;
129} 129}
130 130
131 ContentLine & 131 ContentLine &
132ContentLine::operator = (const QCString & s) 132ContentLine::operator = (const QCString & s)
133{ 133{
134 Entity::operator = (s); 134 Entity::operator = (s);
135 delete value_; 135 delete value_;
136 value_ = 0; 136 value_ = 0;
137 return *this; 137 return *this;
138} 138}
139 139
140 bool 140 bool
141ContentLine::operator == (ContentLine & x) 141ContentLine::operator == (ContentLine & x)
142{ 142{
143 x.parse(); 143 x.parse();
144 144
145 QPtrListIterator<Param> it(x.paramList()); 145 QPtrListIterator<Param> it(x.paramList());
146 146
147 if (!paramList_.find(it.current())) 147 if (!paramList_.find(it.current()))
148 return false; 148 return false;
149 149
150 return true; 150 return true;
151} 151}
152 152
153ContentLine::~ContentLine() 153ContentLine::~ContentLine()
154{ 154{
155 delete value_; 155 delete value_;
156 value_ = 0; 156 value_ = 0;
157} 157}
158 158
159 void 159 void
160ContentLine::_parse() 160ContentLine::_parse()
161{ 161{
162 vDebug("parse"); 162 vDebug("parse");
163 163
164 // Unqote newlines 164 // Unqote newlines
165 strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" ); 165 strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" );
166 166
167 int split = strRep_.find(':'); 167 int split = strRep_.find(':');
168 168
169 if (split == -1) { // invalid content line 169 if (split == -1) { // invalid content line
170 vDebug("No ':'"); 170 vDebug("No ':'");
171 return; 171 return;
172 } 172 }
173 173
174 QCString firstPart(strRep_.left(split)); 174 QCString firstPart(strRep_.left(split));
175 QCString valuePart(strRep_.mid(split + 1)); 175 QCString valuePart(strRep_.mid(split + 1));
176 176
177 split = firstPart.find('.'); 177 split = firstPart.find('.');
178 178
179 if (split != -1) { 179 if (split != -1) {
180 group_ = firstPart.left(split); 180 group_ = firstPart.left(split);
181 firstPart= firstPart.mid(split + 1); 181 firstPart= firstPart.mid(split + 1);
182 } 182 }
183 183
184 vDebug("Group == " + group_); 184 vDebug("Group == " + group_);
185 vDebug("firstPart == " + firstPart); 185 vDebug("firstPart == " + firstPart);
186 vDebug("valuePart == " + valuePart); 186 vDebug("valuePart == " + valuePart);
187 187
188 // Now we have the group, the name and param list together and the value. 188 // Now we have the group, the name and param list together and the value.
189 189
190 QStrList l; 190 QStrList l;
191 191
192 RTokenise(firstPart, ";", l); 192 RTokenise(firstPart, ";", l);
193 193
194 if (l.count() == 0) {// invalid - no name ! 194 if (l.count() == 0) {// invalid - no name !
195 vDebug("No name for this content line !"); 195 vDebug("No name for this content line !");
196 return; 196 return;
197 } 197 }
198 198
199 name_ = l.at(0); 199 name_ = l.at(0);
200 200
201 // Now we have the name, so the rest of 'l' is the params. 201 // Now we have the name, so the rest of 'l' is the params.
202 // Remove the name part. 202 // Remove the name part.
203 l.remove(0u); 203 l.remove(0u);
204 204
205 entityType_= EntityNameToEntityType(name_); 205 entityType_= EntityNameToEntityType(name_);
206 paramType_= EntityTypeToParamType(entityType_); 206 paramType_= EntityTypeToParamType(entityType_);
207 207
208 unsigned int i = 0; 208 unsigned int i = 0;
209 209
210 // For each parameter, create a new parameter of the correct type. 210 // For each parameter, create a new parameter of the correct type.
211 211
212 QStrListIterator it(l); 212 QStrListIterator it(l);
213 213
214 for (; it.current(); ++it, i++) { 214 for (; it.current(); ++it, i++) {
215 215
216 QCString str = *it; 216 QCString str = *it;
217 217
218 split = str.find("="); 218 split = str.find("=");
219 if (split < 0 ) { 219 if (split < 0 ) {
220 vDebug("No '=' in paramter."); 220 vDebug("No '=' in paramter.");
221 continue; 221 continue;
222 } 222 }
223 223
224 QCString paraName = str.left(split); 224 QCString paraName = str.left(split);
225 QCString paraValue = str.mid(split + 1); 225 QCString paraValue = str.mid(split + 1);
226 226
227 QStrList paraValues; 227 QStrList paraValues;
228 RTokenise(paraValue, ",", paraValues); 228 RTokenise(paraValue, ",", paraValues);
229 229
230 QStrListIterator it2( paraValues ); 230 QStrListIterator it2( paraValues );
231 231
232 for(; it2.current(); ++it2) { 232 for(; it2.current(); ++it2) {
233 233
234 Param *p = new Param; 234 Param *p = new Param;
235 p->setName( paraName ); 235 p->setName( paraName );
236 p->setValue( *it2 ); 236 p->setValue( *it2 );
237 237
238 paramList_.append(p); 238 paramList_.append(p);
239 } 239 }
240 } 240 }
241 241
242 // Create a new value of the correct type. 242 // Create a new value of the correct type.
243 243
244 valueType_ = EntityTypeToValueType(entityType_); 244 valueType_ = EntityTypeToValueType(entityType_);
245 245
246 //kdDebug(5710) << "valueType: " << valueType_ << endl; 246 //kdDebug(5710) << "valueType: " << valueType_ << endl;
247 247
248 switch (valueType_) { 248 switch (valueType_) {
249 249
250 case ValueSound: value_ = new SoundValue;break; 250 case ValueSound: value_ = new SoundValue;break;
251 case ValueAgent: value_ = new AgentValue;break; 251 case ValueAgent: value_ = new AgentValue;break;
252 case ValueAddress: value_ = new AdrValue; break; 252 case ValueAddress: value_ = new AdrValue; break;
253 case ValueTel: value_ = new TelValue; break; 253 case ValueTel: value_ = new TelValue; break;
254 case ValueTextBin: value_ = new TextBinValue;break; 254 case ValueTextBin: value_ = new TextBinValue;break;
255 case ValueOrg: value_ = new OrgValue; break; 255 case ValueOrg: value_ = new OrgValue; break;
256 case ValueN: value_ = new NValue; break; 256 case ValueN: value_ = new NValue; break;
257 case ValueUTC: value_ = new UTCValue; break; 257 case ValueUTC: value_ = new UTCValue; break;
258 case ValueURI: value_ = new URIValue; break; 258 case ValueURI: value_ = new URIValue; break;
259 case ValueClass: value_ = new ClassValue;break; 259 case ValueClass: value_ = new ClassValue;break;
260 case ValueFloat: value_ = new FloatValue;break; 260 case ValueFloat: value_ = new FloatValue;break;
261 case ValueImage: value_ = new ImageValue;break; 261 case ValueImage: value_ = new ImageValue;break;
262 case ValueDate: value_ = new DateValue; break; 262 case ValueDate: value_ = new DateValue; break;
263 case ValueTextList: value_ = new TextListValue;break; 263 case ValueTextList: value_ = new TextListValue;break;
264 case ValueGeo: value_ = new GeoValue; break; 264 case ValueGeo: value_ = new GeoValue; break;
265 case ValueText: 265 case ValueText:
266 case ValueUnknown: 266 case ValueUnknown:
267 default: value_ = new TextValue; break; 267 default: value_ = new TextValue; break;
268 } 268 }
269 269
270 *value_ = valuePart; 270 *value_ = valuePart;
271} 271}
272 272
273 void 273 void
274ContentLine::_assemble() 274ContentLine::_assemble()
275{ 275{
276 //strRep_.truncate(0);
277 QString line;
278 if (!group_.isEmpty())
279 line = group_ + '.';
280 line += name_;
281 ParamListIterator it(paramList_);
282 for (; it.current(); ++it)
283 line += ";" + it.current()->asString();
284
285 if (value_ != 0)
286 line += ":" + value_->asString();
287
288 line = line.replace( QRegExp( "\n" ), "\\n" );
289
290 // Fold lines longer than 72 chars
291 const int maxLen = 72;
292 uint cursor = 0;
293 QString cut;
294 while( line.length() > ( cursor + 1 ) * maxLen ) {
295 cut += line.mid( cursor * maxLen, maxLen );
296 cut += "\r\n ";
297 ++cursor;
298 }
299 cut += line.mid( cursor * maxLen );
300 strRep_ = cut.latin1();
301 //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
302#if 0
276 vDebug("Assemble (argl) - my name is \"" + name_ + "\""); 303 vDebug("Assemble (argl) - my name is \"" + name_ + "\"");
277 strRep_.truncate(0); 304 strRep_.truncate(0);
278 305
279 QCString line; 306 QCString line;
280 307
281 if (!group_.isEmpty()) 308 if (!group_.isEmpty())
282 line += group_ + '.'; 309 line += group_ + '.';
283 310
284 line += name_; 311 line += name_;
285 312
286 vDebug("Adding parameters"); 313 vDebug("Adding parameters");
287 ParamListIterator it(paramList_); 314 ParamListIterator it(paramList_);
288 315
289 for (; it.current(); ++it) 316 for (; it.current(); ++it)
290 line += ";" + it.current()->asString(); 317 line += ";" + it.current()->asString();
291 318
292 vDebug("Adding value"); 319 vDebug("Adding value");
293 if (value_ != 0) 320 if (value_ != 0)
294 line += ":" + value_->asString(); 321 line += ":" + value_->asString();
295 else 322 else
296 vDebug("No value"); 323 vDebug("No value");
297 324
298 // Quote newlines 325 // Quote newlines
299 line = line.replace( QRegExp( "\n" ), "\\n" ); 326 line = line.replace( QRegExp( "\n" ), "\\n" );
300 327
301 // Fold lines longer than 72 chars 328 // Fold lines longer than 72 chars
302 const int maxLen = 72; 329 const int maxLen = 72;
303 uint cursor = 0; 330 uint cursor = 0;
304 while( line.length() > ( cursor + 1 ) * maxLen ) { 331 while( line.length() > ( cursor + 1 ) * maxLen ) {
305 strRep_ += line.mid( cursor * maxLen, maxLen ); 332 strRep_ += line.mid( cursor * maxLen, maxLen );
306 strRep_ += "\r\n "; 333 strRep_ += "\r\n ";
307 ++cursor; 334 ++cursor;
308 } 335 }
309 strRep_ += line.mid( cursor * maxLen ); 336 strRep_ += line.mid( cursor * maxLen );
310 //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); 337 qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
338#endif
311} 339}
312 340
313 void 341 void
314ContentLine::clear() 342ContentLine::clear()
315{ 343{
316 group_.truncate(0); 344 group_.truncate(0);
317 name_.truncate(0); 345 name_.truncate(0);
318 paramList_.clear(); 346 paramList_.clear();
319 delete value_; 347 delete value_;
320 value_ = 0; 348 value_ = 0;
321} 349}
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp
index bc80707..49bfe43 100644
--- a/kabc/vcard/VCardv.cpp
+++ b/kabc/vcard/VCardv.cpp
@@ -1,299 +1,294 @@
1/* 1/*
2 libvcard - vCard parsing library for vCard version 3.0 2 libvcard - vCard parsing library for vCard version 3.0
3 3
4 Copyright (C) 1998 Rik Hemsley rik@kde.org 4 Copyright (C) 1998 Rik Hemsley rik@kde.org
5 5
6 Permission is hereby granted, free of charge, to any person obtaining a copy 6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to 7 of this software and associated documentation files (the "Software"), to
8 deal in the Software without restriction, including without limitation the 8 deal in the Software without restriction, including without limitation the
9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 sell copies of the Software, and to permit persons to whom the Software is 10 sell copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions: 11 furnished to do so, subject to the following conditions:
12 12
13 The above copyright notice and this permission notice shall be included in 13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software. 14 all copies or substantial portions of the Software.
15 15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*/ 22*/
23 23
24#include <qcstring.h> 24#include <qcstring.h>
25#include <qstrlist.h> 25#include <qstrlist.h>
26#include <qstringlist.h>
27#include <qstring.h>
28#include <qvaluelist.h>
26 29
27#include <VCardEntity.h> 30#include <VCardEntity.h>
28#include <VCardVCard.h> 31#include <VCardVCard.h>
29#include <VCardContentLine.h> 32#include <VCardContentLine.h>
30#include <VCardRToken.h> 33#include <VCardRToken.h>
31 34
32#include <VCardDefines.h> 35#include <VCardDefines.h>
33 36
34using namespace VCARD; 37using namespace VCARD;
35 38
36VCard::VCard() 39VCard::VCard()
37 :Entity() 40 :Entity()
38{ 41{
39 contentLineList_.setAutoDelete( TRUE ); 42 contentLineList_.setAutoDelete( TRUE );
40} 43}
41 44
42VCard::VCard(const VCard & x) 45VCard::VCard(const VCard & x)
43 :Entity(x), 46 :Entity(x),
44 group_(x.group_) 47 group_(x.group_)
45{ 48{
46 contentLineList_.setAutoDelete( TRUE ); 49 contentLineList_.setAutoDelete( TRUE );
47 50
48 QPtrListIterator<ContentLine> it(x.contentLineList_); 51 QPtrListIterator<ContentLine> it(x.contentLineList_);
49 for (; it.current(); ++it) { 52 for (; it.current(); ++it) {
50 ContentLine * c = new ContentLine(*it.current()); 53 ContentLine * c = new ContentLine(*it.current());
51 contentLineList_.append(c); 54 contentLineList_.append(c);
52 } 55 }
53 56
54} 57}
55 58
56VCard::VCard(const QCString & s) 59VCard::VCard(const QCString & s)
57 :Entity(s) 60 :Entity(s)
58{ 61{
59 contentLineList_.setAutoDelete( TRUE ); 62 contentLineList_.setAutoDelete( TRUE );
60} 63}
61 64
62 VCard & 65 VCard &
63VCard::operator = (VCard & x) 66VCard::operator = (VCard & x)
64{ 67{
65 if (*this == x) return *this; 68 if (*this == x) return *this;
66 69
67 group_ = x.group(); 70 group_ = x.group();
68 QPtrListIterator<ContentLine> it(x.contentLineList_); 71 QPtrListIterator<ContentLine> it(x.contentLineList_);
69 for (; it.current(); ++it) { 72 for (; it.current(); ++it) {
70 ContentLine * c = new ContentLine(*it.current()); 73 ContentLine * c = new ContentLine(*it.current());
71 contentLineList_.append(c); 74 contentLineList_.append(c);
72 } 75 }
73 76
74 Entity::operator = (x); 77 Entity::operator = (x);
75 return *this; 78 return *this;
76} 79}
77 80
78 VCard & 81 VCard &
79VCard::operator = (const QCString & s) 82VCard::operator = (const QCString & s)
80{ 83{
81 Entity::operator = (s); 84 Entity::operator = (s);
82 return *this; 85 return *this;
83} 86}
84 87
85 bool 88 bool
86VCard::operator == (VCard & x) 89VCard::operator == (VCard & x)
87{ 90{
88 x.parse(); 91 x.parse();
89 return false; 92 return false;
90} 93}
91 94
92VCard::~VCard() 95VCard::~VCard()
93{ 96{
94} 97}
95 98
96 void 99 void
97VCard::_parse() 100VCard::_parse()
98{ 101{
99 vDebug("parse() called"); 102
100 QStrList l; 103 QStringList l;
104 QStrList sl;
101 105
102 RTokenise(strRep_, "\r\n", l); 106 RTokenise(strRep_, "\r\n", sl);
103 107
104 if (l.count() < 3) { // Invalid VCARD ! 108 if (sl.count() < 3) { // Invalid VCARD !
105 vDebug("Invalid vcard"); 109 //qDebug("invalid vcard ");
106 return; 110 return;
107 } 111 }
108 112 l = QStringList::fromStrList( sl );
109 // Get the first line 113 // Get the first line
110 QCString beginLine = QCString(l.at(0)).stripWhiteSpace(); 114 QString beginLine = l[0].stripWhiteSpace();
111
112 vDebug("Begin line == \"" + beginLine + "\"");
113 115
114 // Remove extra blank lines 116 // Remove extra blank lines
115 while (QCString(l.last()).isEmpty()) 117 while (l.last().isEmpty())
116 l.remove(l.last()); 118 l.remove(l.last());
117 119
118 // Now we know this is the last line 120 // Now we know this is the last line
119 QCString endLine = l.last(); 121 QString endLine = l.last();
120 122
121 // Trash the first and last lines as we have seen them. 123 // Trash the first and last lines as we have seen them.
122 l.remove(0u); 124 l.remove(l.first());
123 l.remove(l.last()); 125 l.remove(l.last());
124 126
125 /////////////////////////////////////////////////////////////// 127 ///////////////////////////////////////////////////////////////
126 // FIRST LINE 128 // FIRST LINE
127 129
128 int split = beginLine.find(':'); 130 int split = beginLine.find(':');
129 131
130 if (split == -1) { // invalid, no BEGIN 132 if (split == -1) { // invalid, no BEGIN
131 vDebug("No split"); 133 vDebug("No split");
132 return; 134 return;
133 } 135 }
134 136
135 QCString firstPart(beginLine.left(split)); 137 QString firstPart(beginLine.left(split));
136 QCString valuePart(beginLine.mid(split + 1)); 138 QString valuePart(beginLine.mid(split + 1));
137 139
138 split = firstPart.find('.'); 140 split = firstPart.find('.');
139 141
140 if (split != -1) { 142 if (split != -1) {
141 group_ = firstPart.left(split); 143 group_ = firstPart.left(split);
142 firstPart= firstPart.right(firstPart.length() - split - 1); 144 firstPart= firstPart.right(firstPart.length() - split - 1);
143 } 145 }
144 146
145 if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN ! 147 if (firstPart.left(5) != "BEGIN" ) { // No BEGIN !
146 vDebug("No BEGIN"); 148 qDebug("no BEGIN in vcard ");
147 return; 149 return;
148 } 150 }
149 151
150 if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard ! 152 if (valuePart.left(5) != "VCARD") { // Not a vcard !
151 vDebug("No VCARD"); 153 qDebug("not a VCARD ");
152 return; 154 return;
153 } 155 }
154 156
155 /////////////////////////////////////////////////////////////// 157 ///////////////////////////////////////////////////////////////
156 // CONTENT LINES 158 // CONTENT LINES
157 // 159 //
158 vDebug("Content lines"); 160 vDebug("Content lines");
159 161
160 // Handle folded lines. 162 // Handle folded lines.
161 163
162 QStrList refolded; 164 QStringList refolded;
163
164 QStrListIterator it(l);
165 165
166 QCString cur;
167 166
168 for (; it.current(); ++it) { 167 QStringList::Iterator it = l.begin();
169 168
170 cur = it.current(); 169 QString cur;
171 170
171 for (; it != l.end(); ++it) {
172 cur = (*it);
172 ++it; 173 ++it;
173 174 while ( it!= l.end() && (*it).at(0) == ' '&& (*it).length()!= 1) {
174 while ( 175 cur += (*it) ;
175 it.current() &&
176 it.current()[0] == ' '&&
177 strlen(it.current()) != 1)
178 {
179 cur += it.current() + 1;
180 ++it; 176 ++it;
181 } 177 }
182
183 --it; 178 --it;
184
185 refolded.append(cur); 179 refolded.append(cur);
186 } 180 }
187 181 QStringList::Iterator it2 = refolded.begin();
188 QStrListIterator it2(refolded); 182 for (; it2 != refolded.end(); ++it2) {
189 183 ContentLine * cl = new ContentLine(QCString((*it2).latin1()));
190 for (; it2.current(); ++it2) {
191 vDebug("New contentline using \"" + QCString(it2.current()) + "\"");
192 ContentLine * cl = new ContentLine(it2.current());
193
194 cl->parse(); 184 cl->parse();
195 if (cl->value() == 0) 185 if (cl->value() == 0)
196 { 186 {
197 qDebug("Content line could not be parsed. Discarded: %s", it2.current()); 187 qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1());
198 delete cl; 188 delete cl;
199 } 189 }
200 else 190 else
201 contentLineList_.append(cl); 191 contentLineList_.append(cl);
202 } 192 }
203 193
204 /////////////////////////////////////////////////////////////// 194 ///////////////////////////////////////////////////////////////
205 // LAST LINE 195 // LAST LINE
206 196
197
198 // LR: sorry, but the remaining code in this method makes no sense
199
200#if 0
207 split = endLine.find(':'); 201 split = endLine.find(':');
208 202
209 if (split == -1) // invalid, no END 203 if (split == -1) // invalid, no END
210 return; 204 return;
211 205
212 firstPart = endLine.left(split); 206 firstPart = endLine.left(split);
213 valuePart = endLine.right(firstPart.length() - split - 1); 207 valuePart = endLine.right(firstPart.length() - split - 1);
214 208
215 split = firstPart.find('.'); 209 split = firstPart.find('.');
216 210
217 if (split != -1) { 211 if (split != -1) {
218 group_ = firstPart.left(split); 212 group_ = firstPart.left(split);
219 firstPart= firstPart.right(firstPart.length() - split - 1); 213 firstPart= firstPart.right(firstPart.length() - split - 1);
220 } 214 }
221 215
222 if (qstricmp(firstPart, "END") != 0) // No END ! 216 if (qstricmp(firstPart, "END") != 0) // No END !
223 return; 217 return;
224 218
225 if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! 219 if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard !
226 return; 220 return;
221#endif
227} 222}
228 223
229 void 224 void
230VCard::_assemble() 225VCard::_assemble()
231{ 226{
232 vDebug("Assembling vcard"); 227 vDebug("Assembling vcard");
233 strRep_ = "BEGIN:VCARD\r\n"; 228 strRep_ = "BEGIN:VCARD\r\n";
234 strRep_ += "VERSION:3.0\r\n"; 229 strRep_ += "VERSION:3.0\r\n";
235 230
236 QPtrListIterator<ContentLine> it(contentLineList_); 231 QPtrListIterator<ContentLine> it(contentLineList_);
237 232
238 for (; it.current(); ++it) 233 for (; it.current(); ++it)
239 strRep_ += it.current()->asString() + "\r\n"; 234 strRep_ += it.current()->asString() + "\r\n";
240 235
241 strRep_ += "END:VCARD\r\n"; 236 strRep_ += "END:VCARD\r\n";
242} 237}
243 238
244 bool 239 bool
245VCard::has(EntityType t) 240VCard::has(EntityType t)
246{ 241{
247 parse(); 242 parse();
248 return contentLine(t) == 0 ? false : true; 243 return contentLine(t) == 0 ? false : true;
249} 244}
250 245
251 bool 246 bool
252VCard::has(const QCString & s) 247VCard::has(const QCString & s)
253{ 248{
254 parse(); 249 parse();
255 return contentLine(s) == 0 ? false : true; 250 return contentLine(s) == 0 ? false : true;
256} 251}
257 252
258 void 253 void
259VCard::add(const ContentLine & cl) 254VCard::add(const ContentLine & cl)
260{ 255{
261 parse(); 256 parse();
262 ContentLine * c = new ContentLine(cl); 257 ContentLine * c = new ContentLine(cl);
263 contentLineList_.append(c); 258 contentLineList_.append(c);
264} 259}
265 260
266 void 261 void
267VCard::add(const QCString & s) 262VCard::add(const QCString & s)
268{ 263{
269 parse(); 264 parse();
270 ContentLine * c = new ContentLine(s); 265 ContentLine * c = new ContentLine(s);
271 contentLineList_.append(c); 266 contentLineList_.append(c);
272} 267}
273 268
274 ContentLine * 269 ContentLine *
275VCard::contentLine(EntityType t) 270VCard::contentLine(EntityType t)
276{ 271{
277 parse(); 272 parse();
278 QPtrListIterator<ContentLine> it(contentLineList_); 273 QPtrListIterator<ContentLine> it(contentLineList_);
279 274
280 for (; it.current(); ++it) 275 for (; it.current(); ++it)
281 if (it.current()->entityType() == t) 276 if (it.current()->entityType() == t)
282 return it.current(); 277 return it.current();
283 278
284 return 0; 279 return 0;
285} 280}
286 281
287 ContentLine * 282 ContentLine *
288VCard::contentLine(const QCString & s) 283VCard::contentLine(const QCString & s)
289{ 284{
290 parse(); 285 parse();
291 QPtrListIterator<ContentLine> it(contentLineList_); 286 QPtrListIterator<ContentLine> it(contentLineList_);
292 287
293 for (; it.current(); ++it) 288 for (; it.current(); ++it)
294 if (it.current()->entityType() == EntityNameToEntityType(s)) 289 if (it.current()->entityType() == EntityNameToEntityType(s))
295 return it.current(); 290 return it.current();
296 291
297 return 0; 292 return 0;
298} 293}
299 294
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index ceffc77..229cce0 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -1,169 +1,160 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> 3 Copyright (c) 1996-2002 Mirko Boehm <mirko@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#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29 29
30#include <kapplication.h> 30#include <kapplication.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kdialog.h> 32#include <kdialog.h>
33 33
34#include "look_basic.h" 34#include "look_basic.h"
35//#include "look_details.h" 35//#include "look_details.h"
36#include "look_html.h" 36#include "look_html.h"
37 37
38#ifdef KAB_EMBEDDED 38#ifdef KAB_EMBEDDED
39#include "kabprefs.h" 39#include "kabprefs.h"
40#endif //KAB_EMBEDDED 40#endif //KAB_EMBEDDED
41 41
42 42
43#include "detailsviewcontainer.h" 43#include "detailsviewcontainer.h"
44 44
45ViewContainer::ViewContainer( QWidget *parent, const char* name ) 45ViewContainer::ViewContainer( QWidget *parent, const char* name )
46 : QWidget( parent, name ), mCurrentLook( 0 ) 46 : QWidget( parent, name ), mCurrentLook( 0 )
47{ 47{
48 QBoxLayout *topLayout = new QVBoxLayout( this ); 48 QBoxLayout *topLayout = new QVBoxLayout( this );
49 //topLayout->setMargin( KDialog::marginHint() ); 49 //topLayout->setMargin( KDialog::marginHint() );
50 //topLayout->setSpacing( KDialog::spacingHint() ); 50 //topLayout->setSpacing( KDialog::spacingHint() );
51 topLayout->setMargin( 0 ); 51 topLayout->setMargin( 0 );
52 topLayout->setSpacing( 0 ); 52 topLayout->setSpacing( 0 );
53 53
54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); 54 QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
55 55
56 QLabel *label = new QLabel( i18n("Style:"), this ); 56 QLabel *label = new QLabel( i18n("Style:"), this );
57 styleLayout->addWidget( label ); 57 styleLayout->addWidget( label );
58 58
59 mStyleCombo = new QComboBox( this ); 59 mStyleCombo = new QComboBox( this );
60 styleLayout->addWidget( mStyleCombo ); 60 styleLayout->addWidget( mStyleCombo );
61 61
62 QFrame *frameRuler = new QFrame( this ); 62 QFrame *frameRuler = new QFrame( this );
63//US frameRuler->setFrameShape( QFrame::HLine ); 63//US frameRuler->setFrameShape( QFrame::HLine );
64//US frameRuler->setFrameShadow( QFrame::Sunken ); 64//US frameRuler->setFrameShadow( QFrame::Sunken );
65//US topLayout->addWidget( frameRuler ); 65//US topLayout->addWidget( frameRuler );
66 66
67 mDetailsStack = new QWidgetStack( this ); 67 mDetailsStack = new QWidgetStack( this );
68 topLayout->addWidget( mDetailsStack, 1 ); 68 topLayout->addWidget( mDetailsStack, 1 );
69 69
70 registerLooks(); 70 registerLooks();
71 71
72#if 1 72#if 1
73 // Hide detailed view selection combo box, because we currently have 73 // Hide detailed view selection combo box, because we currently have
74 // only one. Reenable it when there are more detailed views. 74 // only one. Reenable it when there are more detailed views.
75 label->hide(); 75 label->hide();
76 mStyleCombo->hide(); 76 mStyleCombo->hide();
77 frameRuler->hide(); 77 frameRuler->hide();
78#endif 78#endif
79} 79}
80 80
81KABBasicLook *ViewContainer::currentLook() 81KABBasicLook *ViewContainer::currentLook()
82{ 82{
83 return mCurrentLook; 83 return mCurrentLook;
84} 84}
85 85
86void ViewContainer::registerLooks() 86void ViewContainer::registerLooks()
87{ 87{
88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); 88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); 89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
90 mStyleCombo->clear(); 90 mStyleCombo->clear();
91 91
92 for ( uint i = 0; i < mLookFactories.count(); ++i ) 92 for ( uint i = 0; i < mLookFactories.count(); ++i )
93 mStyleCombo->insertItem( mLookFactories.at( i )->description() ); 93 mStyleCombo->insertItem( mLookFactories.at( i )->description() );
94 94
95 if ( !mLookFactories.isEmpty() ) 95 if ( !mLookFactories.isEmpty() )
96 slotStyleSelected( 0 ); 96 slotStyleSelected( 0 );
97} 97}
98 98
99void ViewContainer::slotStyleSelected( int index ) 99void ViewContainer::slotStyleSelected( int index )
100{ 100{
101#ifndef KAB_EMBEDDED 101#ifndef KAB_EMBEDDED
102 KConfig *config = kapp->config(); 102 KConfig *config = kapp->config();
103#else //KAB_EMBEDDED 103#else //KAB_EMBEDDED
104 //US I hope I got the same config object as above expected. 104 //US I hope I got the same config object as above expected.
105 KConfig *config = KABPrefs::instance()->getConfig(); 105 KConfig *config = KABPrefs::instance()->getConfig();
106#endif //KAB_EMBEDDED 106#endif //KAB_EMBEDDED
107 KABC::Addressee addr; 107 KABC::Addressee addr;
108 108
109 if ( index >= 0 && index < mStyleCombo->count() ) { 109 if ( index >= 0 && index < mStyleCombo->count() ) {
110 if ( mCurrentLook != 0 ) { 110 if ( mCurrentLook != 0 ) {
111 mCurrentLook->saveSettings( config ); 111 mCurrentLook->saveSettings( config );
112 addr = mCurrentLook->addressee(); 112 addr = mCurrentLook->addressee();
113 113
114 delete mCurrentLook; 114 delete mCurrentLook;
115 mCurrentLook = 0; 115 mCurrentLook = 0;
116 } 116 }
117 117
118 KABLookFactory *factory = mLookFactories.at( index ); 118 KABLookFactory *factory = mLookFactories.at( index );
119 119
120 mCurrentLook = factory->create(); 120 mCurrentLook = factory->create();
121 mDetailsStack->raiseWidget( mCurrentLook ); 121 mDetailsStack->raiseWidget( mCurrentLook );
122 122
123 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, 123 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
124 SIGNAL( sendEmail( const QString& ) ) ); 124 SIGNAL( sendEmail( const QString& ) ) );
125 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, 125 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
126 SIGNAL( browse( const QString& ) ) ); 126 SIGNAL( browse( const QString& ) ) );
127 } 127 }
128 128
129 mCurrentLook->restoreSettings( config ); 129 mCurrentLook->restoreSettings( config );
130 mCurrentLook->setAddressee( addr ); 130 mCurrentLook->setAddressee( addr );
131} 131}
132void ViewContainer::refreshView()
133{
134 if ( mCurrentLook ) {
135 mCurrentLook->setAddressee( mCurrentAddressee );
136 }
137}
138 132
139void ViewContainer::setAddressee( const KABC::Addressee& addressee ) 133void ViewContainer::setAddressee( const KABC::Addressee& addressee )
140{ 134{
141 if ( mCurrentLook != 0 ) { 135 if ( mCurrentLook != 0 ) {
142 if ( addressee == mCurrentAddressee )
143 return;
144 else {
145 mCurrentAddressee = addressee; 136 mCurrentAddressee = addressee;
146 mCurrentLook->setAddressee( mCurrentAddressee ); 137 mCurrentLook->setAddressee( mCurrentAddressee );
147 } 138
148 } 139 }
149} 140}
150 141
151KABC::Addressee ViewContainer::addressee() 142KABC::Addressee ViewContainer::addressee()
152{ 143{
153 static KABC::Addressee empty; // do not use! 144 static KABC::Addressee empty; // do not use!
154 145
155 if ( !mCurrentLook ) 146 if ( !mCurrentLook )
156 return empty; 147 return empty;
157 else 148 else
158 return mCurrentLook->addressee(); 149 return mCurrentLook->addressee();
159} 150}
160 151
161void ViewContainer::setReadOnly( bool state ) 152void ViewContainer::setReadOnly( bool state )
162{ 153{
163 if ( mCurrentLook ) 154 if ( mCurrentLook )
164 mCurrentLook->setReadOnly( state ); 155 mCurrentLook->setReadOnly( state );
165} 156}
166 157
167#ifndef KAB_EMBEDDED 158#ifndef KAB_EMBEDDED
168#include "detailsviewcontainer.moc" 159#include "detailsviewcontainer.moc"
169#endif //KAB_EMBEDDED 160#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h
index b561d12..667f0cb 100644
--- a/kaddressbook/details/detailsviewcontainer.h
+++ b/kaddressbook/details/detailsviewcontainer.h
@@ -1,103 +1,102 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> 3 Copyright (c) 1996-2002 Mirko Boehm <mirko@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 DETAILSVIEWCONTAINER_H 24#ifndef DETAILSVIEWCONTAINER_H
25#define DETAILSVIEWCONTAINER_H 25#define DETAILSVIEWCONTAINER_H
26 26
27#include <qptrlist.h> 27#include <qptrlist.h>
28 28
29#include "look_basic.h" 29#include "look_basic.h"
30 30
31class QComboBox; 31class QComboBox;
32class QWidgetStack; 32class QWidgetStack;
33 33
34class ViewContainer : public QWidget 34class ViewContainer : public QWidget
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 37
38 public: 38 public:
39 ViewContainer( QWidget *parent = 0, const char* name = 0 ); 39 ViewContainer( QWidget *parent = 0, const char* name = 0 );
40 40
41 /** 41 /**
42 Return the look currently selected. If there is none, it 42 Return the look currently selected. If there is none, it
43 returns zero. Do not use this pointer to store a reference 43 returns zero. Do not use this pointer to store a reference
44 to a look, the user might select another one (e.g., create 44 to a look, the user might select another one (e.g., create
45 a new object) at any time. 45 a new object) at any time.
46 */ 46 */
47 KABBasicLook *currentLook(); 47 KABBasicLook *currentLook();
48 void refreshView();
49 /** 48 /**
50 Return the contact currently displayed. 49 Return the contact currently displayed.
51 */ 50 */
52 KABC::Addressee addressee(); 51 KABC::Addressee addressee();
53 52
54 public slots: 53 public slots:
55 /** 54 /**
56 Set the contact currently displayed. 55 Set the contact currently displayed.
57 */ 56 */
58 void setAddressee( const KABC::Addressee& addressee ); 57 void setAddressee( const KABC::Addressee& addressee );
59 58
60 /** 59 /**
61 Set read-write state. 60 Set read-write state.
62 */ 61 */
63 void setReadOnly( bool state ); 62 void setReadOnly( bool state );
64 63
65 signals: 64 signals:
66 /** 65 /**
67 The contact has been changed. 66 The contact has been changed.
68 */ 67 */
69 void addresseeChanged(); 68 void addresseeChanged();
70 69
71 /** 70 /**
72 The user acticated the email address displayed. This may happen 71 The user acticated the email address displayed. This may happen
73 by, for example, clicking on the displayed mailto-URL. 72 by, for example, clicking on the displayed mailto-URL.
74 */ 73 */
75 void sendEmail( const QString& ); 74 void sendEmail( const QString& );
76 75
77 /** 76 /**
78 The user activated one of the displayed HTTP URLs. For example 77 The user activated one of the displayed HTTP URLs. For example
79 by clicking on the displayed homepage address. 78 by clicking on the displayed homepage address.
80 */ 79 */
81 void browse( const QString& ); 80 void browse( const QString& );
82 81
83 protected: 82 protected:
84 /** 83 /**
85 A style has been selected. Overloaded from base class. 84 A style has been selected. Overloaded from base class.
86 */ 85 */
87 void slotStyleSelected( int ); 86 void slotStyleSelected( int );
88 87
89 /** 88 /**
90 Register the available looks. 89 Register the available looks.
91 */ 90 */
92 void registerLooks(); 91 void registerLooks();
93 92
94 private: 93 private:
95 KABC::Addressee mCurrentAddressee; 94 KABC::Addressee mCurrentAddressee;
96 KABBasicLook *mCurrentLook; 95 KABBasicLook *mCurrentLook;
97 QPtrList<KABLookFactory> mLookFactories; 96 QPtrList<KABLookFactory> mLookFactories;
98 97
99 QComboBox *mStyleCombo; 98 QComboBox *mStyleCombo;
100 QWidgetStack *mDetailsStack; 99 QWidgetStack *mDetailsStack;
101}; 100};
102 101
103#endif 102#endif
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 49d456b..48370e3 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -1,299 +1,294 @@
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#include <kabc/picture.h> 24#include <kabc/picture.h>
25 25
26#ifndef KAB_EMBEDDED 26#ifndef KAB_EMBEDDED
27#include <kaccelmanager.h> 27#include <kaccelmanager.h>
28#include <kio/netaccess.h> 28#include <kio/netaccess.h>
29#include <kimageio.h> 29#include <kimageio.h>
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kdialog.h> 33#include <kdialog.h>
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kurlrequester.h> 36#include <kurlrequester.h>
37#include <kurl.h> 37#include <kurl.h>
38 38
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qgroupbox.h> 40#include <qgroupbox.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qlayout.h> 42#include <qlayout.h>
43#include <qpixmap.h> 43#include <qpixmap.h>
44#include <qapplication.h> 44#include <qapplication.h>
45 45
46#include "imagewidget.h" 46#include "imagewidget.h"
47 47
48ImageWidget::ImageWidget( QWidget *parent, const char *name ) 48ImageWidget::ImageWidget( QWidget *parent, const char *name )
49 : QWidget( parent, name ) 49 : QWidget( parent, name )
50{ 50{
51 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), 51 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(),
52 KDialog::spacingHint() ); 52 KDialog::spacingHint() );
53 53
54 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); 54 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
55 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, 55 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2,
56 KDialog::spacingHint() ); 56 KDialog::spacingHint() );
57 boxLayout->setRowStretch( 2, 1 ); 57 boxLayout->setRowStretch( 2, 1 );
58 58
59 mPhotoLabel = new QLabel( photoBox ); 59 mPhotoLabel = new QLabel( photoBox );
60 int fac = 9; 60 int fac = 9;
61 if ( QApplication::desktop()->width() > 320 ) 61 if ( QApplication::desktop()->width() > 320 )
62 fac = 6; 62 fac = 6;
63 mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); 63 mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac );
64 mPhotoLabel->setScaledContents( true ); 64 mPhotoLabel->setScaledContents( true );
65 mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 65 mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
66 boxLayout->addMultiCellWidget( mPhotoLabel, 0, 2, 0, 0 ); 66 boxLayout->addMultiCellWidget( mPhotoLabel, 0, 2, 0, 0 );
67 67
68 mPhotoUrl = new KURLRequester( photoBox ); 68 mPhotoUrl = new KURLRequester( photoBox );
69#ifndef KAB_EMBEDDED 69#ifndef KAB_EMBEDDED
70 mPhotoUrl->setFilter( KImageIO::pattern() ); 70 mPhotoUrl->setFilter( KImageIO::pattern() );
71#else //KAB_EMBEDDED 71#else //KAB_EMBEDDED
72//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); 72//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???");
73#endif //KAB_EMBEDDED 73#endif //KAB_EMBEDDED
74 74
75 75
76 boxLayout->addWidget( mPhotoUrl, 0, 1 ); 76 boxLayout->addWidget( mPhotoUrl, 0, 1 );
77 77
78 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox ); 78 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox );
79 mUsePhotoUrl->setEnabled( false ); 79 mUsePhotoUrl->setEnabled( false );
80 boxLayout->addWidget( mUsePhotoUrl, 1, 1 ); 80 boxLayout->addWidget( mUsePhotoUrl, 1, 1 );
81 81
82 topLayout->addWidget( photoBox, 0, 0 ); 82 topLayout->addWidget( photoBox, 0, 0 );
83 83
84 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); 84 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
85 boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); 85 boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() );
86 boxLayout->setRowStretch( 2, 1 ); 86 boxLayout->setRowStretch( 2, 1 );
87 87
88 mLogoLabel = new QLabel( logoBox ); 88 mLogoLabel = new QLabel( logoBox );
89 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); 89 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac );
90 mLogoLabel->setScaledContents( true ); 90 mLogoLabel->setScaledContents( true );
91 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 91 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
92 boxLayout->addMultiCellWidget( mLogoLabel, 0, 2, 0, 0 ); 92 boxLayout->addMultiCellWidget( mLogoLabel, 0, 2, 0, 0 );
93 93
94 mLogoUrl = new KURLRequester( logoBox ); 94 mLogoUrl = new KURLRequester( logoBox );
95#ifndef KAB_EMBEDDED 95#ifndef KAB_EMBEDDED
96 mLogoUrl->setFilter( KImageIO::pattern() ); 96 mLogoUrl->setFilter( KImageIO::pattern() );
97#else //KAB_EMBEDDED 97#else //KAB_EMBEDDED
98//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); 98//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2");
99#endif //KAB_EMBEDDED 99#endif //KAB_EMBEDDED
100 boxLayout->addWidget( mLogoUrl, 0, 1 ); 100 boxLayout->addWidget( mLogoUrl, 0, 1 );
101 101
102 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox ); 102 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox );
103 mUseLogoUrl->setEnabled( false ); 103 mUseLogoUrl->setEnabled( false );
104 boxLayout->addWidget( mUseLogoUrl, 1, 1 ); 104 boxLayout->addWidget( mUseLogoUrl, 1, 1 );
105 105
106 topLayout->addWidget( logoBox, 1, 0 ); 106 topLayout->addWidget( logoBox, 1, 0 );
107 107
108 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), 108 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ),
109 SIGNAL( changed() ) ); 109 SIGNAL( changed() ) );
110 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 110 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
111 SLOT( loadPhoto() ) ); 111 SLOT( loadPhoto() ) );
112 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 112 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
113 SIGNAL( changed() ) ); 113 SIGNAL( changed() ) );
114 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 114 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
115 SLOT( updateGUI() ) ); 115 SLOT( updateGUI() ) );
116 connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), 116 connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ),
117 SIGNAL( changed() ) ); 117 SIGNAL( changed() ) );
118 118
119 connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), 119 connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ),
120 SIGNAL( changed() ) ); 120 SIGNAL( changed() ) );
121 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 121 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
122 SLOT( loadLogo() ) ); 122 SLOT( loadLogo() ) );
123 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 123 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
124 SIGNAL( changed() ) ); 124 SIGNAL( changed() ) );
125 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 125 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
126 SLOT( updateGUI() ) ); 126 SLOT( updateGUI() ) );
127 connect( mUseLogoUrl, SIGNAL( toggled( bool ) ), 127 connect( mUseLogoUrl, SIGNAL( toggled( bool ) ),
128 SIGNAL( changed() ) ); 128 SIGNAL( changed() ) );
129 129
130#ifndef KAB_EMBEDDED 130#ifndef KAB_EMBEDDED
131 KAcceleratorManager::manage( this ); 131 KAcceleratorManager::manage( this );
132#endif //KAB_EMBEDDED 132#endif //KAB_EMBEDDED
133 133
134#ifndef DESKTOP_VERSION
135 mUsePhotoUrl->setChecked( true );
136 mUseLogoUrl->setChecked( true );
137#endif
138} 134}
139 135
140ImageWidget::~ImageWidget() 136ImageWidget::~ImageWidget()
141{ 137{
142} 138}
143 139
144void ImageWidget::setPhoto( const KABC::Picture &photo ) 140void ImageWidget::setPhoto( const KABC::Picture &photo )
145{ 141{
146 bool blocked = signalsBlocked(); 142 bool blocked = signalsBlocked();
147 blockSignals( true ); 143 blockSignals( true );
148 144
149 if ( photo.isIntern() ) { 145 if ( photo.isIntern() ) {
150//US 146//US
151//US mPhotoLabel->setPixmap( photo.data() ); 147//US mPhotoLabel->setPixmap( photo.data() );
152 if (photo.data().isNull() != true) 148 if (photo.data().isNull() != true)
153 { 149 {
154 QPixmap pm; 150 QPixmap pm;
155 pm.convertFromImage(photo.data()); 151 pm.convertFromImage(photo.data());
156 152
157 mPhotoLabel->setPixmap( pm ); 153 mPhotoLabel->setPixmap( pm );
158 } 154 }
159 155
160 mUsePhotoUrl->setChecked( false ); 156 mUsePhotoUrl->setChecked( false );
161 } else { 157 } else {
162 mPhotoUrl->setURL( photo.url() ); 158 mPhotoUrl->setURL( photo.url() );
163 if ( !photo.url().isEmpty() ) 159 if ( !photo.url().isEmpty() )
164 mUsePhotoUrl->setChecked( true ); 160 mUsePhotoUrl->setChecked( true );
165 loadPhoto(); 161 loadPhoto();
166 } 162 }
167 163
168 blockSignals( blocked ); 164 blockSignals( blocked );
169} 165}
170 166
171KABC::Picture ImageWidget::photo() const 167KABC::Picture ImageWidget::photo() const
172{ 168{
173 KABC::Picture photo; 169 KABC::Picture photo;
174 170
175 if ( mUsePhotoUrl->isChecked() ) 171 if ( mUsePhotoUrl->isChecked() )
176 photo.setUrl( mPhotoUrl->url() ); 172 photo.setUrl( mPhotoUrl->url() );
177 else { 173 else {
178 QPixmap *px = mPhotoLabel->pixmap(); 174 QPixmap *px = mPhotoLabel->pixmap();
179 if ( px ) { 175 if ( px ) {
180#ifndef KAB_EMBEDDED 176#ifndef KAB_EMBEDDED
181 if ( px->height() > px->width() ) 177 if ( px->height() > px->width() )
182 photo.setData( px->convertToImage().scaleHeight( 140 ) ); 178 photo.setData( px->convertToImage().scaleHeight( 140 ) );
183 else 179 else
184 photo.setData( px->convertToImage().scaleWidth( 100 ) ); 180 photo.setData( px->convertToImage().scaleWidth( 100 ) );
185#else //KAB_EMBEDDED 181#else //KAB_EMBEDDED
186//US add teh nullcheck 182//US add teh nullcheck
187 if (px->isNull() != true ) 183 if (px->isNull() != true )
188 photo.setData( px->convertToImage() ); 184 photo.setData( px->convertToImage() );
189#endif //KAB_EMBEDDED 185#endif //KAB_EMBEDDED
190 186
191 photo.setType( "PNG" ); 187 photo.setType( "PNG" );
192 } 188 }
193 } 189 }
194 190
195 return photo; 191 return photo;
196} 192}
197 193
198void ImageWidget::setLogo( const KABC::Picture &logo ) 194void ImageWidget::setLogo( const KABC::Picture &logo )
199{ 195{
200 bool blocked = signalsBlocked(); 196 bool blocked = signalsBlocked();
201 blockSignals( true ); 197 blockSignals( true );
202 198
203 if ( logo.isIntern() ) { 199 if ( logo.isIntern() ) {
204//US 200//US
205//US mLogoLabel->setPixmap( logo.data() ); 201//US mLogoLabel->setPixmap( logo.data() );
206 if (logo.data().isNull() != true) 202 if (logo.data().isNull() != true)
207 { 203 {
208 QPixmap pm; 204 QPixmap pm;
209 pm.convertFromImage(logo.data()); 205 pm.convertFromImage(logo.data());
210 mLogoLabel->setPixmap( pm ); 206 mLogoLabel->setPixmap( pm );
211 } 207 }
212 mUseLogoUrl->setChecked( false ); 208 mUseLogoUrl->setChecked( false );
213 } else { 209 } else {
214 mLogoUrl->setURL( logo.url() ); 210 mLogoUrl->setURL( logo.url() );
215 if ( !logo.url().isEmpty() ) 211 if ( !logo.url().isEmpty() )
216 mUseLogoUrl->setChecked( true ); 212 mUseLogoUrl->setChecked( true );
217 loadLogo(); 213 loadLogo();
218 } 214 }
219 215
220 blockSignals( blocked ); 216 blockSignals( blocked );
221} 217}
222 218
223KABC::Picture ImageWidget::logo() const 219KABC::Picture ImageWidget::logo() const
224{ 220{
225 KABC::Picture logo; 221 KABC::Picture logo;
226 222
227 if ( mUseLogoUrl->isChecked() ) 223 if ( mUseLogoUrl->isChecked() )
228 logo.setUrl( mLogoUrl->url() ); 224 logo.setUrl( mLogoUrl->url() );
229 else { 225 else {
230 QPixmap *px = mLogoLabel->pixmap(); 226 QPixmap *px = mLogoLabel->pixmap();
231 if ( px ) { 227 if ( px ) {
232#ifndef KAB_EMBEDDED 228#ifndef KAB_EMBEDDED
233 if ( px->height() > px->width() ) 229 if ( px->height() > px->width() )
234 logo.setData( px->convertToImage().scaleHeight( 140 ) ); 230 logo.setData( px->convertToImage().scaleHeight( 140 ) );
235 else 231 else
236 logo.setData( px->convertToImage().scaleWidth( 100 ) ); 232 logo.setData( px->convertToImage().scaleWidth( 100 ) );
237#else //KAB_EMBEDDED 233#else //KAB_EMBEDDED
238 logo.setData( px->convertToImage() ); 234 logo.setData( px->convertToImage() );
239#endif //KAB_EMBEDDED 235#endif //KAB_EMBEDDED
240 236
241 logo.setType( "PNG" ); 237 logo.setType( "PNG" );
242 238
243 } 239 }
244 } 240 }
245 241
246 return logo; 242 return logo;
247} 243}
248 244
249void ImageWidget::loadPhoto() 245void ImageWidget::loadPhoto()
250{ 246{
251 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); 247 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) );
252} 248}
253 249
254void ImageWidget::loadLogo() 250void ImageWidget::loadLogo()
255{ 251{
256 mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); 252 mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) );
257} 253}
258 254
259void ImageWidget::updateGUI() 255void ImageWidget::updateGUI()
260{ 256{
261 KURLRequester *ptr = (KURLRequester*)sender(); 257 KURLRequester *ptr = (KURLRequester*)sender();
262 258
263#ifdef DESKTOP_VERSION 259
264 if ( ptr == mPhotoUrl ) 260 if ( ptr == mPhotoUrl )
265 mUsePhotoUrl->setEnabled( true ); 261 mUsePhotoUrl->setEnabled( true );
266 else if ( ptr == mLogoUrl ) 262 else if ( ptr == mLogoUrl )
267 mUseLogoUrl->setEnabled( true ); 263 mUseLogoUrl->setEnabled( true );
268#endif
269} 264}
270 265
271QPixmap ImageWidget::loadPixmap( const KURL &url ) 266QPixmap ImageWidget::loadPixmap( const KURL &url )
272{ 267{
273 QString tempFile; 268 QString tempFile;
274 QPixmap pixmap; 269 QPixmap pixmap;
275 270
276 if ( url.isEmpty() ) 271 if ( url.isEmpty() )
277 return pixmap; 272 return pixmap;
278 273
279 if ( url.isLocalFile() ) 274 if ( url.isLocalFile() )
280 pixmap = QPixmap( url.path() ); 275 pixmap = QPixmap( url.path() );
281 else 276 else
282 { 277 {
283#ifndef KAB_EMBEDDED 278#ifndef KAB_EMBEDDED
284 if ( KIO::NetAccess::download( url, tempFile ) ) { 279 if ( KIO::NetAccess::download( url, tempFile ) ) {
285 pixmap = QPixmap( tempFile ); 280 pixmap = QPixmap( tempFile );
286 KIO::NetAccess::removeTempFile( tempFile ); 281 KIO::NetAccess::removeTempFile( tempFile );
287 } 282 }
288#else //KAB_EMBEDDED 283#else //KAB_EMBEDDED
289 qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed"); 284 qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed");
290#endif //KAB_EMBEDDED 285#endif //KAB_EMBEDDED
291 286
292 } 287 }
293 288
294 return pixmap; 289 return pixmap;
295} 290}
296 291
297#ifndef KAB_EMBEDDED 292#ifndef KAB_EMBEDDED
298#include "imagewidget.moc" 293#include "imagewidget.moc"
299#endif //KAB_EMBEDDED 294#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f6bdda4..e14e579 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -617,2188 +617,2183 @@ void KABCore::createAboutData()
617 "KAddressbook/Platform-independent\n" 617 "KAddressbook/Platform-independent\n"
618 "(KA/Pi) " +version + " - " + 618 "(KA/Pi) " +version + " - " +
619#ifdef DESKTOP_VERSION 619#ifdef DESKTOP_VERSION
620 "Desktop Edition\n" 620 "Desktop Edition\n"
621#else 621#else
622 "PDA-Edition\n" 622 "PDA-Edition\n"
623 "for: Zaurus 5500 / 7x0 / 8x0\n" 623 "for: Zaurus 5500 / 7x0 / 8x0\n"
624#endif 624#endif
625 625
626 "(c) 2004 Ulf Schenk\n" 626 "(c) 2004 Ulf Schenk\n"
627 "(c) 2004 Lutz Rogowski\n" 627 "(c) 2004 Lutz Rogowski\n"
628 "(c) 1997-2003, The KDE PIM Team\n" 628 "(c) 1997-2003, The KDE PIM Team\n"
629 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 629 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
630 "Don Sanders Original author\n" 630 "Don Sanders Original author\n"
631 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 631 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
632 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 632 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
633 "Greg Stern DCOP interface\n" 633 "Greg Stern DCOP interface\n"
634 "Mark Westcot Contact pinning\n" 634 "Mark Westcot Contact pinning\n"
635 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 635 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
636 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 636 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
637#ifdef _WIN32_ 637#ifdef _WIN32_
638 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 638 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
639#endif 639#endif
640 ); 640 );
641} 641}
642 642
643void KABCore::setContactSelected( const QString &uid ) 643void KABCore::setContactSelected( const QString &uid )
644{ 644{
645 KABC::Addressee addr = mAddressBook->findByUid( uid ); 645 KABC::Addressee addr = mAddressBook->findByUid( uid );
646 if ( !mDetails->isHidden() ) 646 if ( !mDetails->isHidden() )
647 mDetails->setAddressee( addr ); 647 mDetails->setAddressee( addr );
648 648
649 if ( !addr.isEmpty() ) { 649 if ( !addr.isEmpty() ) {
650 emit contactSelected( addr.formattedName() ); 650 emit contactSelected( addr.formattedName() );
651 KABC::Picture pic = addr.photo(); 651 KABC::Picture pic = addr.photo();
652 if ( pic.isIntern() ) { 652 if ( pic.isIntern() ) {
653//US emit contactSelected( pic.data() ); 653//US emit contactSelected( pic.data() );
654//US instead use: 654//US instead use:
655 QPixmap px; 655 QPixmap px;
656 if (pic.data().isNull() != true) 656 if (pic.data().isNull() != true)
657 { 657 {
658 px.convertFromImage(pic.data()); 658 px.convertFromImage(pic.data());
659 } 659 }
660 660
661 emit contactSelected( px ); 661 emit contactSelected( px );
662 } 662 }
663 } 663 }
664 664
665 665
666 mExtensionManager->setSelectionChanged(); 666 mExtensionManager->setSelectionChanged();
667 667
668 // update the actions 668 // update the actions
669 bool selected = !uid.isEmpty(); 669 bool selected = !uid.isEmpty();
670 670
671 if ( mReadWrite ) { 671 if ( mReadWrite ) {
672 mActionCut->setEnabled( selected ); 672 mActionCut->setEnabled( selected );
673 mActionPaste->setEnabled( selected ); 673 mActionPaste->setEnabled( selected );
674 } 674 }
675 675
676 mActionCopy->setEnabled( selected ); 676 mActionCopy->setEnabled( selected );
677 mActionDelete->setEnabled( selected ); 677 mActionDelete->setEnabled( selected );
678 mActionEditAddressee->setEnabled( selected ); 678 mActionEditAddressee->setEnabled( selected );
679 mActionMail->setEnabled( selected ); 679 mActionMail->setEnabled( selected );
680 mActionMailVCard->setEnabled( selected ); 680 mActionMailVCard->setEnabled( selected );
681 //if (mActionBeam) 681 //if (mActionBeam)
682 //mActionBeam->setEnabled( selected ); 682 //mActionBeam->setEnabled( selected );
683 mActionWhoAmI->setEnabled( selected ); 683 mActionWhoAmI->setEnabled( selected );
684} 684}
685 685
686void KABCore::sendMail() 686void KABCore::sendMail()
687{ 687{
688 sendMail( mViewManager->selectedEmails().join( ", " ) ); 688 sendMail( mViewManager->selectedEmails().join( ", " ) );
689} 689}
690 690
691void KABCore::sendMail( const QString& emaillist ) 691void KABCore::sendMail( const QString& emaillist )
692{ 692{
693 // 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>;... "
694 if (emaillist.contains(",") > 0) 694 if (emaillist.contains(",") > 0)
695 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 695 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
696 else 696 else
697 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 697 ExternalAppHandler::instance()->mailToOneContact( emaillist );
698} 698}
699 699
700 700
701 701
702void KABCore::mailVCard() 702void KABCore::mailVCard()
703{ 703{
704 QStringList uids = mViewManager->selectedUids(); 704 QStringList uids = mViewManager->selectedUids();
705 if ( !uids.isEmpty() ) 705 if ( !uids.isEmpty() )
706 mailVCard( uids ); 706 mailVCard( uids );
707} 707}
708 708
709void KABCore::mailVCard( const QStringList& uids ) 709void KABCore::mailVCard( const QStringList& uids )
710{ 710{
711 QStringList urls; 711 QStringList urls;
712 712
713// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 713// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
714 714
715 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 715 QString dirName = "/tmp/" + KApplication::randomString( 8 );
716 716
717 717
718 718
719 QDir().mkdir( dirName, true ); 719 QDir().mkdir( dirName, true );
720 720
721 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 721 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
722 KABC::Addressee a = mAddressBook->findByUid( *it ); 722 KABC::Addressee a = mAddressBook->findByUid( *it );
723 723
724 if ( a.isEmpty() ) 724 if ( a.isEmpty() )
725 continue; 725 continue;
726 726
727 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 727 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
728 728
729 QString fileName = dirName + "/" + name; 729 QString fileName = dirName + "/" + name;
730 730
731 QFile outFile(fileName); 731 QFile outFile(fileName);
732 732
733 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 733 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
734 KABC::VCardConverter converter; 734 KABC::VCardConverter converter;
735 QString vcard; 735 QString vcard;
736 736
737 converter.addresseeToVCard( a, vcard ); 737 converter.addresseeToVCard( a, vcard );
738 738
739 QTextStream t( &outFile ); // use a text stream 739 QTextStream t( &outFile ); // use a text stream
740 t.setEncoding( QTextStream::UnicodeUTF8 ); 740 t.setEncoding( QTextStream::UnicodeUTF8 );
741 t << vcard; 741 t << vcard;
742 742
743 outFile.close(); 743 outFile.close();
744 744
745 urls.append( fileName ); 745 urls.append( fileName );
746 } 746 }
747 } 747 }
748 748
749 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 749 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
750 750
751 751
752/*US 752/*US
753 kapp->invokeMailer( QString::null, QString::null, QString::null, 753 kapp->invokeMailer( QString::null, QString::null, QString::null,
754 QString::null, // subject 754 QString::null, // subject
755 QString::null, // body 755 QString::null, // body
756 QString::null, 756 QString::null,
757 urls ); // attachments 757 urls ); // attachments
758*/ 758*/
759 759
760} 760}
761 761
762/** 762/**
763 Beams the "WhoAmI contact. 763 Beams the "WhoAmI contact.
764*/ 764*/
765void KABCore::beamMySelf() 765void KABCore::beamMySelf()
766{ 766{
767 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 767 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
768 if (!a.isEmpty()) 768 if (!a.isEmpty())
769 { 769 {
770 QStringList uids; 770 QStringList uids;
771 uids << a.uid(); 771 uids << a.uid();
772 772
773 beamVCard(uids); 773 beamVCard(uids);
774 } else { 774 } else {
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" ) ); 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" ) );
776 776
777 777
778 } 778 }
779} 779}
780void KABCore::updateMainWindow() 780void KABCore::updateMainWindow()
781{ 781{
782 782
783 mMainWindow->showMaximized(); 783 mMainWindow->showMaximized();
784 mMainWindow->update(); 784 mMainWindow->update();
785} 785}
786void KABCore::resizeEvent(QResizeEvent* e ) 786void KABCore::resizeEvent(QResizeEvent* e )
787{ 787{
788 if ( !mMiniSplitter ) 788 if ( !mMiniSplitter )
789 return; 789 return;
790 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 790 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
791 if ( QApplication::desktop()->width() >= 480 ) { 791 if ( QApplication::desktop()->width() >= 480 ) {
792 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 792 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
793 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 793 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
794 mMiniSplitter->setOrientation( Qt::Horizontal); 794 mMiniSplitter->setOrientation( Qt::Horizontal);
795 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 795 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
796 if ( QApplication::desktop()->width() <= 640 ) { 796 if ( QApplication::desktop()->width() <= 640 ) {
797 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 797 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
798 mViewManager->getFilterAction()->setComboWidth( 150 ); 798 mViewManager->getFilterAction()->setComboWidth( 150 );
799 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 799 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
800 } 800 }
801 } 801 }
802 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 802 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
803 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 803 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
804 mMiniSplitter->setOrientation( Qt::Vertical ); 804 mMiniSplitter->setOrientation( Qt::Vertical );
805 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 805 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
806 if ( QApplication::desktop()->width() <= 640 ) { 806 if ( QApplication::desktop()->width() <= 640 ) {
807 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 807 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
808 mMainWindow->showMinimized(); 808 mMainWindow->showMinimized();
809 mViewManager->getFilterAction()->setComboWidth( 0 ); 809 mViewManager->getFilterAction()->setComboWidth( 0 );
810 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 810 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
811 } 811 }
812 } 812 }
813 } 813 }
814 } 814 }
815 815
816} 816}
817void KABCore::export2phone() 817void KABCore::export2phone()
818{ 818{
819 819
820 QStringList uids; 820 QStringList uids;
821 XXPortSelectDialog dlg( this, false, this ); 821 XXPortSelectDialog dlg( this, false, this );
822 if ( dlg.exec() ) 822 if ( dlg.exec() )
823 uids = dlg.uids(); 823 uids = dlg.uids();
824 else 824 else
825 return; 825 return;
826 if ( uids.isEmpty() ) 826 if ( uids.isEmpty() )
827 return; 827 return;
828 // qDebug("count %d ", uids.count()); 828 // qDebug("count %d ", uids.count());
829 829
830 KAex2phonePrefs ex2phone; 830 KAex2phonePrefs ex2phone;
831 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 831 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
832 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 832 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
833 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 833 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
834 834
835 if ( !ex2phone.exec() ) { 835 if ( !ex2phone.exec() ) {
836 return; 836 return;
837 } 837 }
838 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 838 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
839 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 839 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
840 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 840 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
841 841
842 842
843 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 843 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
844 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 844 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
845 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 845 KPimGlobalPrefs::instance()->mEx2PhoneModel );
846 846
847 QString fileName = getPhoneFile(); 847 QString fileName = getPhoneFile();
848 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 848 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
849 return; 849 return;
850 850
851 message(i18n("Exporting to phone...")); 851 message(i18n("Exporting to phone..."));
852 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 852 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
853 853
854} 854}
855QString KABCore::getPhoneFile() 855QString KABCore::getPhoneFile()
856{ 856{
857#ifdef DESKTOP_VERSION 857#ifdef DESKTOP_VERSION
858 return locateLocal("tmp", "phonefile.vcf"); 858 return locateLocal("tmp", "phonefile.vcf");
859#else 859#else
860 return "/tmp/phonefile.vcf"; 860 return "/tmp/phonefile.vcf";
861#endif 861#endif
862 862
863} 863}
864void KABCore::writeToPhone( ) 864void KABCore::writeToPhone( )
865{ 865{
866 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 866 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
867 message(i18n("Export to phone finished!")); 867 message(i18n("Export to phone finished!"));
868 else 868 else
869 qDebug(i18n("Error exporting to phone")); 869 qDebug(i18n("Error exporting to phone"));
870} 870}
871void KABCore::beamVCard() 871void KABCore::beamVCard()
872{ 872{
873 QStringList uids; 873 QStringList uids;
874 XXPortSelectDialog dlg( this, false, this ); 874 XXPortSelectDialog dlg( this, false, this );
875 if ( dlg.exec() ) 875 if ( dlg.exec() )
876 uids = dlg.uids(); 876 uids = dlg.uids();
877 else 877 else
878 return; 878 return;
879 if ( uids.isEmpty() ) 879 if ( uids.isEmpty() )
880 return; 880 return;
881 beamVCard( uids ); 881 beamVCard( uids );
882} 882}
883 883
884 884
885void KABCore::beamVCard(const QStringList& uids) 885void KABCore::beamVCard(const QStringList& uids)
886{ 886{
887 887
888 // LR: we should use the /tmp dir on the Zaurus, 888 // LR: we should use the /tmp dir on the Zaurus,
889 // because: /tmp = RAM, (HOME)/kdepim = flash memory 889 // because: /tmp = RAM, (HOME)/kdepim = flash memory
890 890
891#ifdef DESKTOP_VERSION 891#ifdef DESKTOP_VERSION
892 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 892 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
893#else 893#else
894 QString fileName = "/tmp/kapibeamfile.vcf"; 894 QString fileName = "/tmp/kapibeamfile.vcf";
895#endif 895#endif
896 896
897 KABC::VCardConverter converter; 897 KABC::VCardConverter converter;
898 QString description; 898 QString description;
899 QString datastream; 899 QString datastream;
900 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 900 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
901 KABC::Addressee a = mAddressBook->findByUid( *it ); 901 KABC::Addressee a = mAddressBook->findByUid( *it );
902 902
903 if ( a.isEmpty() ) 903 if ( a.isEmpty() )
904 continue; 904 continue;
905 905
906 if (description.isEmpty()) 906 if (description.isEmpty())
907 description = a.formattedName(); 907 description = a.formattedName();
908 908
909 QString vcard; 909 QString vcard;
910 converter.addresseeToVCard( a, vcard ); 910 converter.addresseeToVCard( a, vcard );
911 int start = 0; 911 int start = 0;
912 int next; 912 int next;
913 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 913 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
914 int semi = vcard.find(";", next); 914 int semi = vcard.find(";", next);
915 int dopp = vcard.find(":", next); 915 int dopp = vcard.find(":", next);
916 int sep; 916 int sep;
917 if ( semi < dopp && semi >= 0 ) 917 if ( semi < dopp && semi >= 0 )
918 sep = semi ; 918 sep = semi ;
919 else 919 else
920 sep = dopp; 920 sep = dopp;
921 datastream +=vcard.mid( start, next - start); 921 datastream +=vcard.mid( start, next - start);
922 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 922 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
923 start = sep; 923 start = sep;
924 } 924 }
925 datastream += vcard.mid( start,vcard.length() ); 925 datastream += vcard.mid( start,vcard.length() );
926 } 926 }
927#ifndef DESKTOP_VERSION 927#ifndef DESKTOP_VERSION
928 QFile outFile(fileName); 928 QFile outFile(fileName);
929 if ( outFile.open(IO_WriteOnly) ) { 929 if ( outFile.open(IO_WriteOnly) ) {
930 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 930 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
931 QTextStream t( &outFile ); // use a text stream 931 QTextStream t( &outFile ); // use a text stream
932 //t.setEncoding( QTextStream::UnicodeUTF8 ); 932 //t.setEncoding( QTextStream::UnicodeUTF8 );
933 t.setEncoding( QTextStream::Latin1 ); 933 t.setEncoding( QTextStream::Latin1 );
934 t <<datastream.latin1(); 934 t <<datastream.latin1();
935 outFile.close(); 935 outFile.close();
936 Ir *ir = new Ir( this ); 936 Ir *ir = new Ir( this );
937 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 937 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
938 ir->send( fileName, description, "text/x-vCard" ); 938 ir->send( fileName, description, "text/x-vCard" );
939 } else { 939 } else {
940 qDebug("Error open temp beam file "); 940 qDebug("Error open temp beam file ");
941 return; 941 return;
942 } 942 }
943#endif 943#endif
944 944
945} 945}
946 946
947void KABCore::beamDone( Ir *ir ) 947void KABCore::beamDone( Ir *ir )
948{ 948{
949#ifndef DESKTOP_VERSION 949#ifndef DESKTOP_VERSION
950 delete ir; 950 delete ir;
951#endif 951#endif
952 topLevelWidget()->raise(); 952 topLevelWidget()->raise();
953 message( i18n("Beaming finished!") ); 953 message( i18n("Beaming finished!") );
954} 954}
955 955
956 956
957void KABCore::browse( const QString& url ) 957void KABCore::browse( const QString& url )
958{ 958{
959#ifndef KAB_EMBEDDED 959#ifndef KAB_EMBEDDED
960 kapp->invokeBrowser( url ); 960 kapp->invokeBrowser( url );
961#else //KAB_EMBEDDED 961#else //KAB_EMBEDDED
962 qDebug("KABCore::browse must be fixed"); 962 qDebug("KABCore::browse must be fixed");
963#endif //KAB_EMBEDDED 963#endif //KAB_EMBEDDED
964} 964}
965 965
966void KABCore::selectAllContacts() 966void KABCore::selectAllContacts()
967{ 967{
968 mViewManager->setSelected( QString::null, true ); 968 mViewManager->setSelected( QString::null, true );
969} 969}
970 970
971void KABCore::deleteContacts() 971void KABCore::deleteContacts()
972{ 972{
973 QStringList uidList = mViewManager->selectedUids(); 973 QStringList uidList = mViewManager->selectedUids();
974 deleteContacts( uidList ); 974 deleteContacts( uidList );
975} 975}
976 976
977void KABCore::deleteContacts( const QStringList &uids ) 977void KABCore::deleteContacts( const QStringList &uids )
978{ 978{
979 if ( uids.count() > 0 ) { 979 if ( uids.count() > 0 ) {
980 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 980 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
981 UndoStack::instance()->push( command ); 981 UndoStack::instance()->push( command );
982 RedoStack::instance()->clear(); 982 RedoStack::instance()->clear();
983 983
984 // now if we deleted anything, refresh 984 // now if we deleted anything, refresh
985 setContactSelected( QString::null ); 985 setContactSelected( QString::null );
986 setModified( true ); 986 setModified( true );
987 } 987 }
988} 988}
989 989
990void KABCore::copyContacts() 990void KABCore::copyContacts()
991{ 991{
992 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 992 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
993 993
994 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 994 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
995 995
996 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 996 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
997 997
998 QClipboard *cb = QApplication::clipboard(); 998 QClipboard *cb = QApplication::clipboard();
999 cb->setText( clipText ); 999 cb->setText( clipText );
1000} 1000}
1001 1001
1002void KABCore::cutContacts() 1002void KABCore::cutContacts()
1003{ 1003{
1004 QStringList uidList = mViewManager->selectedUids(); 1004 QStringList uidList = mViewManager->selectedUids();
1005 1005
1006//US if ( uidList.size() > 0 ) { 1006//US if ( uidList.size() > 0 ) {
1007 if ( uidList.count() > 0 ) { 1007 if ( uidList.count() > 0 ) {
1008 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1008 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1009 UndoStack::instance()->push( command ); 1009 UndoStack::instance()->push( command );
1010 RedoStack::instance()->clear(); 1010 RedoStack::instance()->clear();
1011 1011
1012 setModified( true ); 1012 setModified( true );
1013 } 1013 }
1014} 1014}
1015 1015
1016void KABCore::pasteContacts() 1016void KABCore::pasteContacts()
1017{ 1017{
1018 QClipboard *cb = QApplication::clipboard(); 1018 QClipboard *cb = QApplication::clipboard();
1019 1019
1020 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1020 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1021 1021
1022 pasteContacts( list ); 1022 pasteContacts( list );
1023} 1023}
1024 1024
1025void KABCore::pasteContacts( KABC::Addressee::List &list ) 1025void KABCore::pasteContacts( KABC::Addressee::List &list )
1026{ 1026{
1027 KABC::Resource *resource = requestResource( this ); 1027 KABC::Resource *resource = requestResource( this );
1028 KABC::Addressee::List::Iterator it; 1028 KABC::Addressee::List::Iterator it;
1029 for ( it = list.begin(); it != list.end(); ++it ) 1029 for ( it = list.begin(); it != list.end(); ++it )
1030 (*it).setResource( resource ); 1030 (*it).setResource( resource );
1031 1031
1032 PwPasteCommand *command = new PwPasteCommand( this, list ); 1032 PwPasteCommand *command = new PwPasteCommand( this, list );
1033 UndoStack::instance()->push( command ); 1033 UndoStack::instance()->push( command );
1034 RedoStack::instance()->clear(); 1034 RedoStack::instance()->clear();
1035 1035
1036 setModified( true ); 1036 setModified( true );
1037} 1037}
1038 1038
1039void KABCore::setWhoAmI() 1039void KABCore::setWhoAmI()
1040{ 1040{
1041 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1041 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1042 1042
1043 if ( addrList.count() > 1 ) { 1043 if ( addrList.count() > 1 ) {
1044 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1044 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1045 return; 1045 return;
1046 } 1046 }
1047 1047
1048 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1048 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1049 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1049 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1050 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1050 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1051} 1051}
1052void KABCore::editCategories() 1052void KABCore::editCategories()
1053{ 1053{
1054 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1054 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1055 dlg.exec(); 1055 dlg.exec();
1056} 1056}
1057void KABCore::setCategories() 1057void KABCore::setCategories()
1058{ 1058{
1059 1059
1060 QStringList uids; 1060 QStringList uids;
1061 XXPortSelectDialog dlgx( this, false, this ); 1061 XXPortSelectDialog dlgx( this, false, this );
1062 if ( dlgx.exec() ) 1062 if ( dlgx.exec() )
1063 uids = dlgx.uids(); 1063 uids = dlgx.uids();
1064 else 1064 else
1065 return; 1065 return;
1066 if ( uids.isEmpty() ) 1066 if ( uids.isEmpty() )
1067 return; 1067 return;
1068 // qDebug("count %d ", uids.count()); 1068 // qDebug("count %d ", uids.count());
1069 1069
1070 1070
1071 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1071 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1072 if ( !dlg.exec() ) { 1072 if ( !dlg.exec() ) {
1073 message( i18n("Setting categories cancelled") ); 1073 message( i18n("Setting categories cancelled") );
1074 return; 1074 return;
1075 } 1075 }
1076 bool merge = false; 1076 bool merge = false;
1077 QString msg = i18n( "Merge with existing categories?" ); 1077 QString msg = i18n( "Merge with existing categories?" );
1078 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1078 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1079 merge = true; 1079 merge = true;
1080 1080
1081 message( i18n("Setting categories ... please wait!") ); 1081 message( i18n("Setting categories ... please wait!") );
1082 QStringList categories = dlg.selectedCategories(); 1082 QStringList categories = dlg.selectedCategories();
1083 1083
1084 //QStringList uids = mViewManager->selectedUids(); 1084 //QStringList uids = mViewManager->selectedUids();
1085 QStringList::Iterator it; 1085 QStringList::Iterator it;
1086 for ( it = uids.begin(); it != uids.end(); ++it ) { 1086 for ( it = uids.begin(); it != uids.end(); ++it ) {
1087 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1087 KABC::Addressee addr = mAddressBook->findByUid( *it );
1088 if ( !addr.isEmpty() ) { 1088 if ( !addr.isEmpty() ) {
1089 if ( !merge ) 1089 if ( !merge )
1090 addr.setCategories( categories ); 1090 addr.setCategories( categories );
1091 else { 1091 else {
1092 QStringList addrCategories = addr.categories(); 1092 QStringList addrCategories = addr.categories();
1093 QStringList::Iterator catIt; 1093 QStringList::Iterator catIt;
1094 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1094 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1095 if ( !addrCategories.contains( *catIt ) ) 1095 if ( !addrCategories.contains( *catIt ) )
1096 addrCategories.append( *catIt ); 1096 addrCategories.append( *catIt );
1097 } 1097 }
1098 addr.setCategories( addrCategories ); 1098 addr.setCategories( addrCategories );
1099 } 1099 }
1100 mAddressBook->insertAddressee( addr ); 1100 mAddressBook->insertAddressee( addr );
1101 } 1101 }
1102 } 1102 }
1103 1103
1104 if ( uids.count() > 0 ) 1104 if ( uids.count() > 0 )
1105 setModified( true ); 1105 setModified( true );
1106 message( i18n("Setting categories completed!") ); 1106 message( i18n("Setting categories completed!") );
1107} 1107}
1108 1108
1109void KABCore::setSearchFields( const KABC::Field::List &fields ) 1109void KABCore::setSearchFields( const KABC::Field::List &fields )
1110{ 1110{
1111 mIncSearchWidget->setFields( fields ); 1111 mIncSearchWidget->setFields( fields );
1112} 1112}
1113 1113
1114void KABCore::incrementalSearch( const QString& text ) 1114void KABCore::incrementalSearch( const QString& text )
1115{ 1115{
1116 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1116 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1117} 1117}
1118 1118
1119void KABCore::setModified() 1119void KABCore::setModified()
1120{ 1120{
1121 setModified( true ); 1121 setModified( true );
1122} 1122}
1123 1123
1124void KABCore::setModifiedWOrefresh() 1124void KABCore::setModifiedWOrefresh()
1125{ 1125{
1126 // qDebug("KABCore::setModifiedWOrefresh() "); 1126 // qDebug("KABCore::setModifiedWOrefresh() ");
1127 mModified = true; 1127 mModified = true;
1128 mActionSave->setEnabled( mModified ); 1128 mActionSave->setEnabled( mModified );
1129#ifdef DESKTOP_VERSION 1129
1130 mDetails->refreshView();
1131#endif
1132 1130
1133} 1131}
1134void KABCore::setModified( bool modified ) 1132void KABCore::setModified( bool modified )
1135{ 1133{
1136 mModified = modified; 1134 mModified = modified;
1137 mActionSave->setEnabled( mModified ); 1135 mActionSave->setEnabled( mModified );
1138 1136
1139 if ( modified ) 1137 if ( modified )
1140 mJumpButtonBar->recreateButtons(); 1138 mJumpButtonBar->recreateButtons();
1141 1139
1142 mViewManager->refreshView(); 1140 mViewManager->refreshView();
1143 mDetails->refreshView();
1144 1141
1145} 1142}
1146 1143
1147bool KABCore::modified() const 1144bool KABCore::modified() const
1148{ 1145{
1149 return mModified; 1146 return mModified;
1150} 1147}
1151 1148
1152void KABCore::contactModified( const KABC::Addressee &addr ) 1149void KABCore::contactModified( const KABC::Addressee &addr )
1153{ 1150{
1154 1151
1155 Command *command = 0; 1152 Command *command = 0;
1156 QString uid; 1153 QString uid;
1157 1154
1158 // check if it exists already 1155 // check if it exists already
1159 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1156 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1160 if ( origAddr.isEmpty() ) 1157 if ( origAddr.isEmpty() )
1161 command = new PwNewCommand( mAddressBook, addr ); 1158 command = new PwNewCommand( mAddressBook, addr );
1162 else { 1159 else {
1163 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1160 command = new PwEditCommand( mAddressBook, origAddr, addr );
1164 uid = addr.uid(); 1161 uid = addr.uid();
1165 } 1162 }
1166 1163
1167 UndoStack::instance()->push( command ); 1164 UndoStack::instance()->push( command );
1168 RedoStack::instance()->clear(); 1165 RedoStack::instance()->clear();
1169 1166 mDetails->setAddressee( addr );
1170 setModified( true ); 1167 setModified( true );
1171} 1168}
1172 1169
1173void KABCore::newContact() 1170void KABCore::newContact()
1174{ 1171{
1175 1172
1176 1173
1177 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1174 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1178 1175
1179 QPtrList<KRES::Resource> kresResources; 1176 QPtrList<KRES::Resource> kresResources;
1180 QPtrListIterator<KABC::Resource> it( kabcResources ); 1177 QPtrListIterator<KABC::Resource> it( kabcResources );
1181 KABC::Resource *resource; 1178 KABC::Resource *resource;
1182 while ( ( resource = it.current() ) != 0 ) { 1179 while ( ( resource = it.current() ) != 0 ) {
1183 ++it; 1180 ++it;
1184 if ( !resource->readOnly() ) { 1181 if ( !resource->readOnly() ) {
1185 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1182 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1186 if ( res ) 1183 if ( res )
1187 kresResources.append( res ); 1184 kresResources.append( res );
1188 } 1185 }
1189 } 1186 }
1190 1187
1191 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1188 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1192 resource = static_cast<KABC::Resource*>( res ); 1189 resource = static_cast<KABC::Resource*>( res );
1193 1190
1194 if ( resource ) { 1191 if ( resource ) {
1195 KABC::Addressee addr; 1192 KABC::Addressee addr;
1196 addr.setResource( resource ); 1193 addr.setResource( resource );
1197 mEditorDialog->setAddressee( addr ); 1194 mEditorDialog->setAddressee( addr );
1198 KApplication::execDialog ( mEditorDialog ); 1195 KApplication::execDialog ( mEditorDialog );
1199 1196
1200 } else 1197 } else
1201 return; 1198 return;
1202 1199
1203 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1200 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1204 1201
1205 1202
1206} 1203}
1207 1204
1208void KABCore::addEmail( QString aStr ) 1205void KABCore::addEmail( QString aStr )
1209{ 1206{
1210#ifndef KAB_EMBEDDED 1207#ifndef KAB_EMBEDDED
1211 QString fullName, email; 1208 QString fullName, email;
1212 1209
1213 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1210 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1214 1211
1215 // Try to lookup the addressee matching the email address 1212 // Try to lookup the addressee matching the email address
1216 bool found = false; 1213 bool found = false;
1217 QStringList emailList; 1214 QStringList emailList;
1218 KABC::AddressBook::Iterator it; 1215 KABC::AddressBook::Iterator it;
1219 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1216 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1220 emailList = (*it).emails(); 1217 emailList = (*it).emails();
1221 if ( emailList.contains( email ) > 0 ) { 1218 if ( emailList.contains( email ) > 0 ) {
1222 found = true; 1219 found = true;
1223 (*it).setNameFromString( fullName ); 1220 (*it).setNameFromString( fullName );
1224 editContact( (*it).uid() ); 1221 editContact( (*it).uid() );
1225 } 1222 }
1226 } 1223 }
1227 1224
1228 if ( !found ) { 1225 if ( !found ) {
1229 KABC::Addressee addr; 1226 KABC::Addressee addr;
1230 addr.setNameFromString( fullName ); 1227 addr.setNameFromString( fullName );
1231 addr.insertEmail( email, true ); 1228 addr.insertEmail( email, true );
1232 1229
1233 mAddressBook->insertAddressee( addr ); 1230 mAddressBook->insertAddressee( addr );
1234 mViewManager->refreshView( addr.uid() ); 1231 mViewManager->refreshView( addr.uid() );
1235 editContact( addr.uid() ); 1232 editContact( addr.uid() );
1236 } 1233 }
1237#else //KAB_EMBEDDED 1234#else //KAB_EMBEDDED
1238 qDebug("KABCore::addEmail finsih method"); 1235 qDebug("KABCore::addEmail finsih method");
1239#endif //KAB_EMBEDDED 1236#endif //KAB_EMBEDDED
1240} 1237}
1241 1238
1242void KABCore::importVCard( const KURL &url, bool showPreview ) 1239void KABCore::importVCard( const KURL &url, bool showPreview )
1243{ 1240{
1244 mXXPortManager->importVCard( url, showPreview ); 1241 mXXPortManager->importVCard( url, showPreview );
1245} 1242}
1246void KABCore::importFromOL() 1243void KABCore::importFromOL()
1247{ 1244{
1248#ifdef _WIN32_ 1245#ifdef _WIN32_
1249 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1246 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1250 idgl->exec(); 1247 idgl->exec();
1251 KABC::Addressee::List list = idgl->getAddressList(); 1248 KABC::Addressee::List list = idgl->getAddressList();
1252 if ( list.count() > 0 ) { 1249 if ( list.count() > 0 ) {
1253 KABC::Addressee::List listNew; 1250 KABC::Addressee::List listNew;
1254 KABC::Addressee::List listExisting; 1251 KABC::Addressee::List listExisting;
1255 KABC::Addressee::List::Iterator it; 1252 KABC::Addressee::List::Iterator it;
1256 KABC::AddressBook::Iterator iter; 1253 KABC::AddressBook::Iterator iter;
1257 for ( it = list.begin(); it != list.end(); ++it ) { 1254 for ( it = list.begin(); it != list.end(); ++it ) {
1258 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1255 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1259 listNew.append( (*it) ); 1256 listNew.append( (*it) );
1260 else 1257 else
1261 listExisting.append( (*it) ); 1258 listExisting.append( (*it) );
1262 } 1259 }
1263 if ( listExisting.count() > 0 ) 1260 if ( listExisting.count() > 0 )
1264 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1261 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1265 if ( listNew.count() > 0 ) { 1262 if ( listNew.count() > 0 ) {
1266 pasteWithNewUid = false; 1263 pasteWithNewUid = false;
1267 pasteContacts( listNew ); 1264 pasteContacts( listNew );
1268 pasteWithNewUid = true; 1265 pasteWithNewUid = true;
1269 } 1266 }
1270 } 1267 }
1271 delete idgl; 1268 delete idgl;
1272#endif 1269#endif
1273} 1270}
1274 1271
1275void KABCore::importVCard( const QString &vCard, bool showPreview ) 1272void KABCore::importVCard( const QString &vCard, bool showPreview )
1276{ 1273{
1277 mXXPortManager->importVCard( vCard, showPreview ); 1274 mXXPortManager->importVCard( vCard, showPreview );
1278} 1275}
1279 1276
1280//US added a second method without defaultparameter 1277//US added a second method without defaultparameter
1281void KABCore::editContact2() { 1278void KABCore::editContact2() {
1282 editContact( QString::null ); 1279 editContact( QString::null );
1283} 1280}
1284 1281
1285void KABCore::editContact( const QString &uid ) 1282void KABCore::editContact( const QString &uid )
1286{ 1283{
1287 1284
1288 if ( mExtensionManager->isQuickEditVisible() ) 1285 if ( mExtensionManager->isQuickEditVisible() )
1289 return; 1286 return;
1290 1287
1291 // First, locate the contact entry 1288 // First, locate the contact entry
1292 QString localUID = uid; 1289 QString localUID = uid;
1293 if ( localUID.isNull() ) { 1290 if ( localUID.isNull() ) {
1294 QStringList uidList = mViewManager->selectedUids(); 1291 QStringList uidList = mViewManager->selectedUids();
1295 if ( uidList.count() > 0 ) 1292 if ( uidList.count() > 0 )
1296 localUID = *( uidList.at( 0 ) ); 1293 localUID = *( uidList.at( 0 ) );
1297 } 1294 }
1298 1295
1299 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1296 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1300 if ( !addr.isEmpty() ) { 1297 if ( !addr.isEmpty() ) {
1301 mEditorDialog->setAddressee( addr ); 1298 mEditorDialog->setAddressee( addr );
1302 KApplication::execDialog ( mEditorDialog ); 1299 KApplication::execDialog ( mEditorDialog );
1303 } 1300 }
1304} 1301}
1305 1302
1306/** 1303/**
1307 Shows or edits the detail view for the given uid. If the uid is QString::null, 1304 Shows or edits the detail view for the given uid. If the uid is QString::null,
1308 the method will try to find a selected addressee in the view. 1305 the method will try to find a selected addressee in the view.
1309 */ 1306 */
1310void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1307void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1311{ 1308{
1312 if ( mMultipleViewsAtOnce ) 1309 if ( mMultipleViewsAtOnce )
1313 { 1310 {
1314 editContact( uid ); 1311 editContact( uid );
1315 } 1312 }
1316 else 1313 else
1317 { 1314 {
1318 setDetailsVisible( true ); 1315 setDetailsVisible( true );
1319 mActionDetails->setChecked(true); 1316 mActionDetails->setChecked(true);
1320 } 1317 }
1321 1318
1322} 1319}
1323 1320
1324void KABCore::save() 1321void KABCore::save()
1325{ 1322{
1326 if (syncManager->blockSave()) 1323 if (syncManager->blockSave())
1327 return; 1324 return;
1328 if ( !mModified ) 1325 if ( !mModified )
1329 return; 1326 return;
1330 1327
1331 syncManager->setBlockSave(true); 1328 syncManager->setBlockSave(true);
1332 QString text = i18n( "There was an error while attempting to save\n the " 1329 QString text = i18n( "There was an error while attempting to save\n the "
1333 "address book. Please check that some \nother application is " 1330 "address book. Please check that some \nother application is "
1334 "not using it. " ); 1331 "not using it. " );
1335 message(i18n("Saving addressbook ... ")); 1332 message(i18n("Saving addressbook ... "));
1336#ifndef KAB_EMBEDDED 1333#ifndef KAB_EMBEDDED
1337 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1334 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1338 if ( !b || !b->save() ) { 1335 if ( !b || !b->save() ) {
1339 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1336 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1340 } 1337 }
1341#else //KAB_EMBEDDED 1338#else //KAB_EMBEDDED
1342 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1339 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1343 if ( !b || !b->save() ) { 1340 if ( !b || !b->save() ) {
1344 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1341 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1345 } 1342 }
1346#endif //KAB_EMBEDDED 1343#endif //KAB_EMBEDDED
1347 1344
1348 message(i18n("Addressbook saved!")); 1345 message(i18n("Addressbook saved!"));
1349 setModified( false ); 1346 setModified( false );
1350 syncManager->setBlockSave(false); 1347 syncManager->setBlockSave(false);
1351} 1348}
1352 1349
1353 1350
1354void KABCore::undo() 1351void KABCore::undo()
1355{ 1352{
1356 UndoStack::instance()->undo(); 1353 UndoStack::instance()->undo();
1357 1354
1358 // Refresh the view 1355 // Refresh the view
1359 mViewManager->refreshView(); 1356 mViewManager->refreshView();
1360} 1357}
1361 1358
1362void KABCore::redo() 1359void KABCore::redo()
1363{ 1360{
1364 RedoStack::instance()->redo(); 1361 RedoStack::instance()->redo();
1365 1362
1366 // Refresh the view 1363 // Refresh the view
1367 mViewManager->refreshView(); 1364 mViewManager->refreshView();
1368} 1365}
1369 1366
1370void KABCore::setJumpButtonBarVisible( bool visible ) 1367void KABCore::setJumpButtonBarVisible( bool visible )
1371{ 1368{
1372 if (mMultipleViewsAtOnce) 1369 if (mMultipleViewsAtOnce)
1373 { 1370 {
1374 if ( visible ) 1371 if ( visible )
1375 mJumpButtonBar->show(); 1372 mJumpButtonBar->show();
1376 else 1373 else
1377 mJumpButtonBar->hide(); 1374 mJumpButtonBar->hide();
1378 } 1375 }
1379 else 1376 else
1380 { 1377 {
1381 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1378 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1382 if (mViewManager->isVisible()) 1379 if (mViewManager->isVisible())
1383 { 1380 {
1384 if ( visible ) 1381 if ( visible )
1385 mJumpButtonBar->show(); 1382 mJumpButtonBar->show();
1386 else 1383 else
1387 mJumpButtonBar->hide(); 1384 mJumpButtonBar->hide();
1388 } 1385 }
1389 else 1386 else
1390 { 1387 {
1391 mJumpButtonBar->hide(); 1388 mJumpButtonBar->hide();
1392 } 1389 }
1393 } 1390 }
1394} 1391}
1395 1392
1396 1393
1397void KABCore::setDetailsToState() 1394void KABCore::setDetailsToState()
1398{ 1395{
1399 setDetailsVisible( mActionDetails->isChecked() ); 1396 setDetailsVisible( mActionDetails->isChecked() );
1400} 1397}
1401void KABCore::setDetailsToggle() 1398void KABCore::setDetailsToggle()
1402{ 1399{
1403 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1400 mActionDetails->setChecked( !mActionDetails->isChecked() );
1404 setDetailsToState(); 1401 setDetailsToState();
1405} 1402}
1406 1403
1407 1404
1408 1405
1409void KABCore::setDetailsVisible( bool visible ) 1406void KABCore::setDetailsVisible( bool visible )
1410{ 1407{
1411 if (visible && mDetails->isHidden()) 1408 if (visible && mDetails->isHidden())
1412 { 1409 {
1413 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1410 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1414 if ( addrList.count() > 0 ) 1411 if ( addrList.count() > 0 )
1415 mDetails->setAddressee( addrList[ 0 ] ); 1412 mDetails->setAddressee( addrList[ 0 ] );
1416 } 1413 }
1417 1414
1418 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1415 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1419 // the listview and the detailview. We do that by changing the splitbar size. 1416 // the listview and the detailview. We do that by changing the splitbar size.
1420 if (mMultipleViewsAtOnce) 1417 if (mMultipleViewsAtOnce)
1421 { 1418 {
1422 if ( visible ) 1419 if ( visible )
1423 mDetails->show(); 1420 mDetails->show();
1424 else 1421 else
1425 mDetails->hide(); 1422 mDetails->hide();
1426 } 1423 }
1427 else 1424 else
1428 { 1425 {
1429 if ( visible ) { 1426 if ( visible ) {
1430 mViewManager->hide(); 1427 mViewManager->hide();
1431 mDetails->show(); 1428 mDetails->show();
1432 mIncSearchWidget->setFocus(); 1429 mIncSearchWidget->setFocus();
1433 } 1430 }
1434 else { 1431 else {
1435 mViewManager->show(); 1432 mViewManager->show();
1436 mDetails->hide(); 1433 mDetails->hide();
1437 mViewManager->setFocusAV(); 1434 mViewManager->setFocusAV();
1438 } 1435 }
1439 setJumpButtonBarVisible( !visible ); 1436 setJumpButtonBarVisible( !visible );
1440 } 1437 }
1441 1438
1442} 1439}
1443 1440
1444void KABCore::extensionChanged( int id ) 1441void KABCore::extensionChanged( int id )
1445{ 1442{
1446 //change the details view only for non desktop systems 1443 //change the details view only for non desktop systems
1447#ifndef DESKTOP_VERSION 1444#ifndef DESKTOP_VERSION
1448 1445
1449 if (id == 0) 1446 if (id == 0)
1450 { 1447 {
1451 //the user disabled the extension. 1448 //the user disabled the extension.
1452 1449
1453 if (mMultipleViewsAtOnce) 1450 if (mMultipleViewsAtOnce)
1454 { // enable detailsview again 1451 { // enable detailsview again
1455 setDetailsVisible( true ); 1452 setDetailsVisible( true );
1456 mActionDetails->setChecked( true ); 1453 mActionDetails->setChecked( true );
1457 } 1454 }
1458 else 1455 else
1459 { //go back to the listview 1456 { //go back to the listview
1460 setDetailsVisible( false ); 1457 setDetailsVisible( false );
1461 mActionDetails->setChecked( false ); 1458 mActionDetails->setChecked( false );
1462 mActionDetails->setEnabled(true); 1459 mActionDetails->setEnabled(true);
1463 } 1460 }
1464 1461
1465 } 1462 }
1466 else 1463 else
1467 { 1464 {
1468 //the user enabled the extension. 1465 //the user enabled the extension.
1469 setDetailsVisible( false ); 1466 setDetailsVisible( false );
1470 mActionDetails->setChecked( false ); 1467 mActionDetails->setChecked( false );
1471 1468
1472 if (!mMultipleViewsAtOnce) 1469 if (!mMultipleViewsAtOnce)
1473 { 1470 {
1474 mActionDetails->setEnabled(false); 1471 mActionDetails->setEnabled(false);
1475 } 1472 }
1476 1473
1477 mExtensionManager->setSelectionChanged(); 1474 mExtensionManager->setSelectionChanged();
1478 1475
1479 } 1476 }
1480 1477
1481#endif// DESKTOP_VERSION 1478#endif// DESKTOP_VERSION
1482 1479
1483} 1480}
1484 1481
1485 1482
1486void KABCore::extensionModified( const KABC::Addressee::List &list ) 1483void KABCore::extensionModified( const KABC::Addressee::List &list )
1487{ 1484{
1488 1485
1489 if ( list.count() != 0 ) { 1486 if ( list.count() != 0 ) {
1490 KABC::Addressee::List::ConstIterator it; 1487 KABC::Addressee::List::ConstIterator it;
1491 for ( it = list.begin(); it != list.end(); ++it ) 1488 for ( it = list.begin(); it != list.end(); ++it )
1492 mAddressBook->insertAddressee( *it ); 1489 mAddressBook->insertAddressee( *it );
1493 if ( list.count() > 1 ) 1490 if ( list.count() > 1 )
1494 setModified(); 1491 setModified();
1495 else 1492 else
1496 setModifiedWOrefresh(); 1493 setModifiedWOrefresh();
1497 } 1494 }
1498 if ( list.count() == 0 ) 1495 if ( list.count() == 0 )
1499 mViewManager->refreshView(); 1496 mViewManager->refreshView();
1500 else 1497 else
1501 mViewManager->refreshView( list[ 0 ].uid() ); 1498 mViewManager->refreshView( list[ 0 ].uid() );
1502 1499
1503 1500
1504 1501
1505} 1502}
1506 1503
1507QString KABCore::getNameByPhone( const QString &phone ) 1504QString KABCore::getNameByPhone( const QString &phone )
1508{ 1505{
1509#ifndef KAB_EMBEDDED 1506#ifndef KAB_EMBEDDED
1510 QRegExp r( "[/*/-/ ]" ); 1507 QRegExp r( "[/*/-/ ]" );
1511 QString localPhone( phone ); 1508 QString localPhone( phone );
1512 1509
1513 bool found = false; 1510 bool found = false;
1514 QString ownerName = ""; 1511 QString ownerName = "";
1515 KABC::AddressBook::Iterator iter; 1512 KABC::AddressBook::Iterator iter;
1516 KABC::PhoneNumber::List::Iterator phoneIter; 1513 KABC::PhoneNumber::List::Iterator phoneIter;
1517 KABC::PhoneNumber::List phoneList; 1514 KABC::PhoneNumber::List phoneList;
1518 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1515 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1519 phoneList = (*iter).phoneNumbers(); 1516 phoneList = (*iter).phoneNumbers();
1520 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1517 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1521 ++phoneIter) { 1518 ++phoneIter) {
1522 // Get rid of separator chars so just the numbers are compared. 1519 // Get rid of separator chars so just the numbers are compared.
1523 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1520 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1524 ownerName = (*iter).formattedName(); 1521 ownerName = (*iter).formattedName();
1525 found = true; 1522 found = true;
1526 } 1523 }
1527 } 1524 }
1528 } 1525 }
1529 1526
1530 return ownerName; 1527 return ownerName;
1531#else //KAB_EMBEDDED 1528#else //KAB_EMBEDDED
1532 qDebug("KABCore::getNameByPhone finsih method"); 1529 qDebug("KABCore::getNameByPhone finsih method");
1533 return ""; 1530 return "";
1534#endif //KAB_EMBEDDED 1531#endif //KAB_EMBEDDED
1535 1532
1536} 1533}
1537 1534
1538void KABCore::openConfigDialog() 1535void KABCore::openConfigDialog()
1539{ 1536{
1540 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1537 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1541 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1538 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1542 ConfigureDialog->addModule(kabcfg ); 1539 ConfigureDialog->addModule(kabcfg );
1543 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1540 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1544 ConfigureDialog->addModule(kdelibcfg ); 1541 ConfigureDialog->addModule(kdelibcfg );
1545 1542
1546 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1543 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1547 this, SLOT( configurationChanged() ) ); 1544 this, SLOT( configurationChanged() ) );
1548 connect( ConfigureDialog, SIGNAL( okClicked() ), 1545 connect( ConfigureDialog, SIGNAL( okClicked() ),
1549 this, SLOT( configurationChanged() ) ); 1546 this, SLOT( configurationChanged() ) );
1550 saveSettings(); 1547 saveSettings();
1551#ifndef DESKTOP_VERSION 1548#ifndef DESKTOP_VERSION
1552 ConfigureDialog->showMaximized(); 1549 ConfigureDialog->showMaximized();
1553#endif 1550#endif
1554 if ( ConfigureDialog->exec() ) 1551 if ( ConfigureDialog->exec() )
1555 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1552 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1556 delete ConfigureDialog; 1553 delete ConfigureDialog;
1557} 1554}
1558 1555
1559void KABCore::openLDAPDialog() 1556void KABCore::openLDAPDialog()
1560{ 1557{
1561#ifndef KAB_EMBEDDED 1558#ifndef KAB_EMBEDDED
1562 if ( !mLdapSearchDialog ) { 1559 if ( !mLdapSearchDialog ) {
1563 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1560 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1564 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1561 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1565 SLOT( refreshView() ) ); 1562 SLOT( refreshView() ) );
1566 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1563 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1567 SLOT( setModified() ) ); 1564 SLOT( setModified() ) );
1568 } else 1565 } else
1569 mLdapSearchDialog->restoreSettings(); 1566 mLdapSearchDialog->restoreSettings();
1570 1567
1571 if ( mLdapSearchDialog->isOK() ) 1568 if ( mLdapSearchDialog->isOK() )
1572 mLdapSearchDialog->exec(); 1569 mLdapSearchDialog->exec();
1573#else //KAB_EMBEDDED 1570#else //KAB_EMBEDDED
1574 qDebug("KABCore::openLDAPDialog() finsih method"); 1571 qDebug("KABCore::openLDAPDialog() finsih method");
1575#endif //KAB_EMBEDDED 1572#endif //KAB_EMBEDDED
1576} 1573}
1577 1574
1578void KABCore::print() 1575void KABCore::print()
1579{ 1576{
1580#ifndef KAB_EMBEDDED 1577#ifndef KAB_EMBEDDED
1581 KPrinter printer; 1578 KPrinter printer;
1582 if ( !printer.setup( this ) ) 1579 if ( !printer.setup( this ) )
1583 return; 1580 return;
1584 1581
1585 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1582 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1586 mViewManager->selectedUids(), this ); 1583 mViewManager->selectedUids(), this );
1587 1584
1588 wizard.exec(); 1585 wizard.exec();
1589#else //KAB_EMBEDDED 1586#else //KAB_EMBEDDED
1590 qDebug("KABCore::print() finsih method"); 1587 qDebug("KABCore::print() finsih method");
1591#endif //KAB_EMBEDDED 1588#endif //KAB_EMBEDDED
1592 1589
1593} 1590}
1594 1591
1595 1592
1596void KABCore::addGUIClient( KXMLGUIClient *client ) 1593void KABCore::addGUIClient( KXMLGUIClient *client )
1597{ 1594{
1598 if ( mGUIClient ) 1595 if ( mGUIClient )
1599 mGUIClient->insertChildClient( client ); 1596 mGUIClient->insertChildClient( client );
1600 else 1597 else
1601 KMessageBox::error( this, "no KXMLGUICLient"); 1598 KMessageBox::error( this, "no KXMLGUICLient");
1602} 1599}
1603 1600
1604 1601
1605void KABCore::configurationChanged() 1602void KABCore::configurationChanged()
1606{ 1603{
1607 mExtensionManager->reconfigure(); 1604 mExtensionManager->reconfigure();
1608} 1605}
1609 1606
1610void KABCore::addressBookChanged() 1607void KABCore::addressBookChanged()
1611{ 1608{
1612/*US 1609/*US
1613 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1610 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1614 while ( it.current() ) { 1611 while ( it.current() ) {
1615 if ( it.current()->dirty() ) { 1612 if ( it.current()->dirty() ) {
1616 QString text = i18n( "Data has been changed externally. Unsaved " 1613 QString text = i18n( "Data has been changed externally. Unsaved "
1617 "changes will be lost." ); 1614 "changes will be lost." );
1618 KMessageBox::information( this, text ); 1615 KMessageBox::information( this, text );
1619 } 1616 }
1620 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1617 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1621 ++it; 1618 ++it;
1622 } 1619 }
1623*/ 1620*/
1624 if (mEditorDialog) 1621 if (mEditorDialog)
1625 { 1622 {
1626 if (mEditorDialog->dirty()) 1623 if (mEditorDialog->dirty())
1627 { 1624 {
1628 QString text = i18n( "Data has been changed externally. Unsaved " 1625 QString text = i18n( "Data has been changed externally. Unsaved "
1629 "changes will be lost." ); 1626 "changes will be lost." );
1630 KMessageBox::information( this, text ); 1627 KMessageBox::information( this, text );
1631 } 1628 }
1632 QString currentuid = mEditorDialog->addressee().uid(); 1629 QString currentuid = mEditorDialog->addressee().uid();
1633 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1630 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1634 } 1631 }
1635 mViewManager->refreshView(); 1632 mViewManager->refreshView();
1636// mDetails->refreshView();
1637 1633
1638 1634
1639} 1635}
1640 1636
1641AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1637AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1642 const char *name ) 1638 const char *name )
1643{ 1639{
1644 1640
1645 if ( mEditorDialog == 0 ) { 1641 if ( mEditorDialog == 0 ) {
1646 mEditorDialog = new AddresseeEditorDialog( this, parent, 1642 mEditorDialog = new AddresseeEditorDialog( this, parent,
1647 name ? name : "editorDialog" ); 1643 name ? name : "editorDialog" );
1648 1644
1649 1645
1650 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1646 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1651 SLOT( contactModified( const KABC::Addressee& ) ) ); 1647 SLOT( contactModified( const KABC::Addressee& ) ) );
1652 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1648 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1653 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1649 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1654 } 1650 }
1655 1651
1656 return mEditorDialog; 1652 return mEditorDialog;
1657} 1653}
1658 1654
1659void KABCore::slotEditorDestroyed( const QString &uid ) 1655void KABCore::slotEditorDestroyed( const QString &uid )
1660{ 1656{
1661 //mEditorDict.remove( uid ); 1657 //mEditorDict.remove( uid );
1662} 1658}
1663 1659
1664void KABCore::initGUI() 1660void KABCore::initGUI()
1665{ 1661{
1666#ifndef KAB_EMBEDDED 1662#ifndef KAB_EMBEDDED
1667 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1663 QHBoxLayout *topLayout = new QHBoxLayout( this );
1668 topLayout->setSpacing( KDialogBase::spacingHint() ); 1664 topLayout->setSpacing( KDialogBase::spacingHint() );
1669 1665
1670 mExtensionBarSplitter = new QSplitter( this ); 1666 mExtensionBarSplitter = new QSplitter( this );
1671 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1667 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1672 1668
1673 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1669 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1674 1670
1675 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1671 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1676 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1672 mIncSearchWidget = new IncSearchWidget( viewSpace );
1677 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1673 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1678 SLOT( incrementalSearch( const QString& ) ) ); 1674 SLOT( incrementalSearch( const QString& ) ) );
1679 1675
1680 mViewManager = new ViewManager( this, viewSpace ); 1676 mViewManager = new ViewManager( this, viewSpace );
1681 viewSpace->setStretchFactor( mViewManager, 1 ); 1677 viewSpace->setStretchFactor( mViewManager, 1 );
1682 1678
1683 mDetails = new ViewContainer( mDetailsSplitter ); 1679 mDetails = new ViewContainer( mDetailsSplitter );
1684 1680
1685 mJumpButtonBar = new JumpButtonBar( this, this ); 1681 mJumpButtonBar = new JumpButtonBar( this, this );
1686 1682
1687 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1683 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1688 1684
1689 topLayout->addWidget( mExtensionBarSplitter ); 1685 topLayout->addWidget( mExtensionBarSplitter );
1690 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1686 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1691 topLayout->addWidget( mJumpButtonBar ); 1687 topLayout->addWidget( mJumpButtonBar );
1692 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1688 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1693 1689
1694 mXXPortManager = new XXPortManager( this, this ); 1690 mXXPortManager = new XXPortManager( this, this );
1695 1691
1696#else //KAB_EMBEDDED 1692#else //KAB_EMBEDDED
1697 //US initialize viewMenu before settingup viewmanager. 1693 //US initialize viewMenu before settingup viewmanager.
1698 // Viewmanager needs this menu to plugin submenues. 1694 // Viewmanager needs this menu to plugin submenues.
1699 viewMenu = new QPopupMenu( this ); 1695 viewMenu = new QPopupMenu( this );
1700 settingsMenu = new QPopupMenu( this ); 1696 settingsMenu = new QPopupMenu( this );
1701 //filterMenu = new QPopupMenu( this ); 1697 //filterMenu = new QPopupMenu( this );
1702 ImportMenu = new QPopupMenu( this ); 1698 ImportMenu = new QPopupMenu( this );
1703 ExportMenu = new QPopupMenu( this ); 1699 ExportMenu = new QPopupMenu( this );
1704 syncMenu = new QPopupMenu( this ); 1700 syncMenu = new QPopupMenu( this );
1705 changeMenu= new QPopupMenu( this ); 1701 changeMenu= new QPopupMenu( this );
1706 beamMenu= new QPopupMenu( this ); 1702 beamMenu= new QPopupMenu( this );
1707 1703
1708//US since we have no splitter for the embedded system, setup 1704//US since we have no splitter for the embedded system, setup
1709// a layout with two frames. One left and one right. 1705// a layout with two frames. One left and one right.
1710 1706
1711 QBoxLayout *topLayout; 1707 QBoxLayout *topLayout;
1712 1708
1713 // = new QHBoxLayout( this ); 1709 // = new QHBoxLayout( this );
1714// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1710// QBoxLayout *topLayout = (QBoxLayout*)layout();
1715 1711
1716// QWidget *mainBox = new QWidget( this ); 1712// QWidget *mainBox = new QWidget( this );
1717// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1713// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1718 1714
1719#ifdef DESKTOP_VERSION 1715#ifdef DESKTOP_VERSION
1720 topLayout = new QHBoxLayout( this ); 1716 topLayout = new QHBoxLayout( this );
1721 1717
1722 1718
1723 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1719 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1724 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1720 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1725 1721
1726 topLayout->addWidget(mMiniSplitter ); 1722 topLayout->addWidget(mMiniSplitter );
1727 1723
1728 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1724 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1729 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1725 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1730 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1726 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1731 mDetails = new ViewContainer( mMiniSplitter ); 1727 mDetails = new ViewContainer( mMiniSplitter );
1732 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1728 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1733#else 1729#else
1734 if ( QApplication::desktop()->width() > 480 ) { 1730 if ( QApplication::desktop()->width() > 480 ) {
1735 topLayout = new QHBoxLayout( this ); 1731 topLayout = new QHBoxLayout( this );
1736 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1732 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1737 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1733 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1738 } else { 1734 } else {
1739 1735
1740 topLayout = new QHBoxLayout( this ); 1736 topLayout = new QHBoxLayout( this );
1741 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1737 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1742 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1738 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1743 } 1739 }
1744 1740
1745 topLayout->addWidget(mMiniSplitter ); 1741 topLayout->addWidget(mMiniSplitter );
1746 mViewManager = new ViewManager( this, mMiniSplitter ); 1742 mViewManager = new ViewManager( this, mMiniSplitter );
1747 mDetails = new ViewContainer( mMiniSplitter ); 1743 mDetails = new ViewContainer( mMiniSplitter );
1748 1744
1749 1745
1750 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1746 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1751#endif 1747#endif
1752 //eh->hide(); 1748 //eh->hide();
1753 // topLayout->addWidget(mExtensionManager ); 1749 // topLayout->addWidget(mExtensionManager );
1754 1750
1755 1751
1756/*US 1752/*US
1757#ifndef KAB_NOSPLITTER 1753#ifndef KAB_NOSPLITTER
1758 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1754 QHBoxLayout *topLayout = new QHBoxLayout( this );
1759//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1755//US topLayout->setSpacing( KDialogBase::spacingHint() );
1760 topLayout->setSpacing( 10 ); 1756 topLayout->setSpacing( 10 );
1761 1757
1762 mDetailsSplitter = new QSplitter( this ); 1758 mDetailsSplitter = new QSplitter( this );
1763 1759
1764 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1760 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1765 1761
1766 mViewManager = new ViewManager( this, viewSpace ); 1762 mViewManager = new ViewManager( this, viewSpace );
1767 viewSpace->setStretchFactor( mViewManager, 1 ); 1763 viewSpace->setStretchFactor( mViewManager, 1 );
1768 1764
1769 mDetails = new ViewContainer( mDetailsSplitter ); 1765 mDetails = new ViewContainer( mDetailsSplitter );
1770 1766
1771 topLayout->addWidget( mDetailsSplitter ); 1767 topLayout->addWidget( mDetailsSplitter );
1772 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1768 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1773#else //KAB_NOSPLITTER 1769#else //KAB_NOSPLITTER
1774 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1770 QHBoxLayout *topLayout = new QHBoxLayout( this );
1775//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1771//US topLayout->setSpacing( KDialogBase::spacingHint() );
1776 topLayout->setSpacing( 10 ); 1772 topLayout->setSpacing( 10 );
1777 1773
1778// mDetailsSplitter = new QSplitter( this ); 1774// mDetailsSplitter = new QSplitter( this );
1779 1775
1780 QVBox *viewSpace = new QVBox( this ); 1776 QVBox *viewSpace = new QVBox( this );
1781 1777
1782 mViewManager = new ViewManager( this, viewSpace ); 1778 mViewManager = new ViewManager( this, viewSpace );
1783 viewSpace->setStretchFactor( mViewManager, 1 ); 1779 viewSpace->setStretchFactor( mViewManager, 1 );
1784 1780
1785 mDetails = new ViewContainer( this ); 1781 mDetails = new ViewContainer( this );
1786 1782
1787 topLayout->addWidget( viewSpace ); 1783 topLayout->addWidget( viewSpace );
1788// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1784// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1789 topLayout->addWidget( mDetails ); 1785 topLayout->addWidget( mDetails );
1790#endif //KAB_NOSPLITTER 1786#endif //KAB_NOSPLITTER
1791*/ 1787*/
1792 1788
1793 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1789 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1794 syncManager->setBlockSave(false); 1790 syncManager->setBlockSave(false);
1795 1791
1796 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1792 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1797 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1793 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1798 QString sync_file = sentSyncFile(); 1794 QString sync_file = sentSyncFile();
1799 qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1795 qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1800 syncManager->setDefaultFileName( sync_file ); 1796 syncManager->setDefaultFileName( sync_file );
1801 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1797 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1802 1798
1803#endif //KAB_EMBEDDED 1799#endif //KAB_EMBEDDED
1804 initActions(); 1800 initActions();
1805 1801
1806#ifdef KAB_EMBEDDED 1802#ifdef KAB_EMBEDDED
1807 addActionsManually(); 1803 addActionsManually();
1808 //US make sure the export and import menues are initialized before creating the xxPortManager. 1804 //US make sure the export and import menues are initialized before creating the xxPortManager.
1809 mXXPortManager = new XXPortManager( this, this ); 1805 mXXPortManager = new XXPortManager( this, this );
1810 1806
1811 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1807 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1812 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1808 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1813 // mActionQuit->plug ( mMainWindow->toolBar()); 1809 // mActionQuit->plug ( mMainWindow->toolBar());
1814 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1810 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1815 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1811 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1816 // mIncSearchWidget->hide(); 1812 // mIncSearchWidget->hide();
1817 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1813 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1818 SLOT( incrementalSearch( const QString& ) ) ); 1814 SLOT( incrementalSearch( const QString& ) ) );
1819 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1815 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1820 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1816 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1821 1817
1822 mJumpButtonBar = new JumpButtonBar( this, this ); 1818 mJumpButtonBar = new JumpButtonBar( this, this );
1823 1819
1824 topLayout->addWidget( mJumpButtonBar ); 1820 topLayout->addWidget( mJumpButtonBar );
1825//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1821//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1826 1822
1827// mMainWindow->getIconToolBar()->raise(); 1823// mMainWindow->getIconToolBar()->raise();
1828 1824
1829#endif //KAB_EMBEDDED 1825#endif //KAB_EMBEDDED
1830 1826
1831} 1827}
1832void KABCore::initActions() 1828void KABCore::initActions()
1833{ 1829{
1834//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1830//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1835 1831
1836#ifndef KAB_EMBEDDED 1832#ifndef KAB_EMBEDDED
1837 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1833 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1838 SLOT( clipboardDataChanged() ) ); 1834 SLOT( clipboardDataChanged() ) );
1839#endif //KAB_EMBEDDED 1835#endif //KAB_EMBEDDED
1840 1836
1841 // file menu 1837 // file menu
1842 if ( mIsPart ) { 1838 if ( mIsPart ) {
1843 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1839 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1844 SLOT( sendMail() ), actionCollection(), 1840 SLOT( sendMail() ), actionCollection(),
1845 "kaddressbook_mail" ); 1841 "kaddressbook_mail" );
1846 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1842 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1847 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1843 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1848 1844
1849 } else { 1845 } else {
1850 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1846 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1851 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1847 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1852 } 1848 }
1853 1849
1854 1850
1855 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1851 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1856 SLOT( save() ), actionCollection(), "file_sync" ); 1852 SLOT( save() ), actionCollection(), "file_sync" );
1857 1853
1858 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1854 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1859 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1855 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1860 1856
1861 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1857 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1862 this, SLOT( mailVCard() ), 1858 this, SLOT( mailVCard() ),
1863 actionCollection(), "file_mail_vcard"); 1859 actionCollection(), "file_mail_vcard");
1864 1860
1865 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1861 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1866 SLOT( export2phone() ), actionCollection(), 1862 SLOT( export2phone() ), actionCollection(),
1867 "kaddressbook_ex2phone" ); 1863 "kaddressbook_ex2phone" );
1868 1864
1869 mActionBeamVCard = 0; 1865 mActionBeamVCard = 0;
1870 mActionBeam = 0; 1866 mActionBeam = 0;
1871 1867
1872#ifndef DESKTOP_VERSION 1868#ifndef DESKTOP_VERSION
1873 if ( Ir::supported() ) { 1869 if ( Ir::supported() ) {
1874 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1870 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1875 SLOT( beamVCard() ), actionCollection(), 1871 SLOT( beamVCard() ), actionCollection(),
1876 "kaddressbook_beam_vcard" ); 1872 "kaddressbook_beam_vcard" );
1877 1873
1878 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1874 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1879 SLOT( beamMySelf() ), actionCollection(), 1875 SLOT( beamMySelf() ), actionCollection(),
1880 "kaddressbook_beam_myself" ); 1876 "kaddressbook_beam_myself" );
1881 } 1877 }
1882#endif 1878#endif
1883 1879
1884 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1880 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1885 this, SLOT( editContact2() ), 1881 this, SLOT( editContact2() ),
1886 actionCollection(), "file_properties" ); 1882 actionCollection(), "file_properties" );
1887 1883
1888#ifdef KAB_EMBEDDED 1884#ifdef KAB_EMBEDDED
1889 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1885 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1890 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1886 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1891 mMainWindow, SLOT( exit() ), 1887 mMainWindow, SLOT( exit() ),
1892 actionCollection(), "quit" ); 1888 actionCollection(), "quit" );
1893#endif //KAB_EMBEDDED 1889#endif //KAB_EMBEDDED
1894 1890
1895 // edit menu 1891 // edit menu
1896 if ( mIsPart ) { 1892 if ( mIsPart ) {
1897 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1893 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1898 SLOT( copyContacts() ), actionCollection(), 1894 SLOT( copyContacts() ), actionCollection(),
1899 "kaddressbook_copy" ); 1895 "kaddressbook_copy" );
1900 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1896 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1901 SLOT( cutContacts() ), actionCollection(), 1897 SLOT( cutContacts() ), actionCollection(),
1902 "kaddressbook_cut" ); 1898 "kaddressbook_cut" );
1903 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1899 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1904 SLOT( pasteContacts() ), actionCollection(), 1900 SLOT( pasteContacts() ), actionCollection(),
1905 "kaddressbook_paste" ); 1901 "kaddressbook_paste" );
1906 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1902 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1907 SLOT( selectAllContacts() ), actionCollection(), 1903 SLOT( selectAllContacts() ), actionCollection(),
1908 "kaddressbook_select_all" ); 1904 "kaddressbook_select_all" );
1909 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1905 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1910 SLOT( undo() ), actionCollection(), 1906 SLOT( undo() ), actionCollection(),
1911 "kaddressbook_undo" ); 1907 "kaddressbook_undo" );
1912 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1908 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1913 this, SLOT( redo() ), actionCollection(), 1909 this, SLOT( redo() ), actionCollection(),
1914 "kaddressbook_redo" ); 1910 "kaddressbook_redo" );
1915 } else { 1911 } else {
1916 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1912 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1917 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1913 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1918 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1914 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1919 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1915 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1920 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1916 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1921 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1917 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1922 } 1918 }
1923 1919
1924 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1920 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1925 Key_Delete, this, SLOT( deleteContacts() ), 1921 Key_Delete, this, SLOT( deleteContacts() ),
1926 actionCollection(), "edit_delete" ); 1922 actionCollection(), "edit_delete" );
1927 1923
1928 mActionUndo->setEnabled( false ); 1924 mActionUndo->setEnabled( false );
1929 mActionRedo->setEnabled( false ); 1925 mActionRedo->setEnabled( false );
1930 1926
1931 // settings menu 1927 // settings menu
1932#ifdef KAB_EMBEDDED 1928#ifdef KAB_EMBEDDED
1933//US special menuentry to configure the addressbook resources. On KDE 1929//US special menuentry to configure the addressbook resources. On KDE
1934// you do that through the control center !!! 1930// you do that through the control center !!!
1935 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1931 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1936 SLOT( configureResources() ), actionCollection(), 1932 SLOT( configureResources() ), actionCollection(),
1937 "kaddressbook_configure_resources" ); 1933 "kaddressbook_configure_resources" );
1938#endif //KAB_EMBEDDED 1934#endif //KAB_EMBEDDED
1939 1935
1940 if ( mIsPart ) { 1936 if ( mIsPart ) {
1941 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1937 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1942 SLOT( openConfigDialog() ), actionCollection(), 1938 SLOT( openConfigDialog() ), actionCollection(),
1943 "kaddressbook_configure" ); 1939 "kaddressbook_configure" );
1944 1940
1945 //US not implemented yet 1941 //US not implemented yet
1946 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1942 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1947 // this, SLOT( configureKeyBindings() ), actionCollection(), 1943 // this, SLOT( configureKeyBindings() ), actionCollection(),
1948 // "kaddressbook_configure_shortcuts" ); 1944 // "kaddressbook_configure_shortcuts" );
1949#ifdef KAB_EMBEDDED 1945#ifdef KAB_EMBEDDED
1950 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1946 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1951 mActionConfigureToolbars->setEnabled( false ); 1947 mActionConfigureToolbars->setEnabled( false );
1952#endif //KAB_EMBEDDED 1948#endif //KAB_EMBEDDED
1953 1949
1954 } else { 1950 } else {
1955 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1951 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1956 1952
1957 //US not implemented yet 1953 //US not implemented yet
1958 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1954 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1959 } 1955 }
1960 1956
1961 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1957 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1962 actionCollection(), "options_show_jump_bar" ); 1958 actionCollection(), "options_show_jump_bar" );
1963 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1959 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1964 1960
1965 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1961 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1966 actionCollection(), "options_show_details" ); 1962 actionCollection(), "options_show_details" );
1967 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1963 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1968 1964
1969 1965
1970 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1966 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1971 SLOT( toggleBeamReceive() ), actionCollection(), 1967 SLOT( toggleBeamReceive() ), actionCollection(),
1972 "kaddressbook_beam_rec" ); 1968 "kaddressbook_beam_rec" );
1973 1969
1974 1970
1975 // misc 1971 // misc
1976 // only enable LDAP lookup if we can handle the protocol 1972 // only enable LDAP lookup if we can handle the protocol
1977#ifndef KAB_EMBEDDED 1973#ifndef KAB_EMBEDDED
1978 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1974 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1979 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1975 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1980 this, SLOT( openLDAPDialog() ), actionCollection(), 1976 this, SLOT( openLDAPDialog() ), actionCollection(),
1981 "ldap_lookup" ); 1977 "ldap_lookup" );
1982 } 1978 }
1983#else //KAB_EMBEDDED 1979#else //KAB_EMBEDDED
1984 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1980 //qDebug("KABCore::initActions() LDAP has to be implemented");
1985#endif //KAB_EMBEDDED 1981#endif //KAB_EMBEDDED
1986 1982
1987 1983
1988 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1984 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1989 SLOT( setWhoAmI() ), actionCollection(), 1985 SLOT( setWhoAmI() ), actionCollection(),
1990 "set_personal" ); 1986 "set_personal" );
1991 1987
1992 1988
1993 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1989 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1994 SLOT( setCategories() ), actionCollection(), 1990 SLOT( setCategories() ), actionCollection(),
1995 "edit_set_categories" ); 1991 "edit_set_categories" );
1996 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, 1992 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
1997 SLOT( editCategories() ), actionCollection(), 1993 SLOT( editCategories() ), actionCollection(),
1998 "edit__categories" ); 1994 "edit__categories" );
1999 1995
2000 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1996 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2001 SLOT( removeVoice() ), actionCollection(), 1997 SLOT( removeVoice() ), actionCollection(),
2002 "remove_voice" ); 1998 "remove_voice" );
2003 1999
2004 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2000 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2005 SLOT( manageCategories() ), actionCollection(), 2001 SLOT( manageCategories() ), actionCollection(),
2006 "remove_voice" ); 2002 "remove_voice" );
2007 2003
2008 2004
2009 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2005 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2010 SLOT( importFromOL() ), actionCollection(), 2006 SLOT( importFromOL() ), actionCollection(),
2011 "import_OL" ); 2007 "import_OL" );
2012#ifdef KAB_EMBEDDED 2008#ifdef KAB_EMBEDDED
2013 mActionLicence = new KAction( i18n( "Licence" ), 0, 2009 mActionLicence = new KAction( i18n( "Licence" ), 0,
2014 this, SLOT( showLicence() ), actionCollection(), 2010 this, SLOT( showLicence() ), actionCollection(),
2015 "licence_about_data" ); 2011 "licence_about_data" );
2016 mActionFaq = new KAction( i18n( "Faq" ), 0, 2012 mActionFaq = new KAction( i18n( "Faq" ), 0,
2017 this, SLOT( faq() ), actionCollection(), 2013 this, SLOT( faq() ), actionCollection(),
2018 "faq_about_data" ); 2014 "faq_about_data" );
2019 mActionWN = new KAction( i18n( "What's New?" ), 0, 2015 mActionWN = new KAction( i18n( "What's New?" ), 0,
2020 this, SLOT( whatsnew() ), actionCollection(), 2016 this, SLOT( whatsnew() ), actionCollection(),
2021 "wn" ); 2017 "wn" );
2022 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2018 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2023 this, SLOT( synchowto() ), actionCollection(), 2019 this, SLOT( synchowto() ), actionCollection(),
2024 "sync" ); 2020 "sync" );
2025 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2021 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2026 this, SLOT( kdesynchowto() ), actionCollection(), 2022 this, SLOT( kdesynchowto() ), actionCollection(),
2027 "kdesync" ); 2023 "kdesync" );
2028 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2024 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2029 this, SLOT( multisynchowto() ), actionCollection(), 2025 this, SLOT( multisynchowto() ), actionCollection(),
2030 "multisync" ); 2026 "multisync" );
2031 2027
2032 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2028 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2033 this, SLOT( createAboutData() ), actionCollection(), 2029 this, SLOT( createAboutData() ), actionCollection(),
2034 "kaddressbook_about_data" ); 2030 "kaddressbook_about_data" );
2035#endif //KAB_EMBEDDED 2031#endif //KAB_EMBEDDED
2036 2032
2037 clipboardDataChanged(); 2033 clipboardDataChanged();
2038 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2034 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2039 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2035 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2040} 2036}
2041 2037
2042//US we need this function, to plug all actions into the correct menues. 2038//US we need this function, to plug all actions into the correct menues.
2043// KDE uses a XML format to plug the actions, but we work her without this overhead. 2039// KDE uses a XML format to plug the actions, but we work her without this overhead.
2044void KABCore::addActionsManually() 2040void KABCore::addActionsManually()
2045{ 2041{
2046//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2042//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2047 2043
2048#ifdef KAB_EMBEDDED 2044#ifdef KAB_EMBEDDED
2049 QPopupMenu *fileMenu = new QPopupMenu( this ); 2045 QPopupMenu *fileMenu = new QPopupMenu( this );
2050 QPopupMenu *editMenu = new QPopupMenu( this ); 2046 QPopupMenu *editMenu = new QPopupMenu( this );
2051 QPopupMenu *helpMenu = new QPopupMenu( this ); 2047 QPopupMenu *helpMenu = new QPopupMenu( this );
2052 2048
2053 KToolBar* tb = mMainWindow->toolBar(); 2049 KToolBar* tb = mMainWindow->toolBar();
2054 2050
2055#ifndef DESKTOP_VERSION 2051#ifndef DESKTOP_VERSION
2056 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2052 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2057#endif 2053#endif
2058 QMenuBar* mb = mMainWindow->menuBar(); 2054 QMenuBar* mb = mMainWindow->menuBar();
2059 2055
2060 //US setup menubar. 2056 //US setup menubar.
2061 //Disable the following block if you do not want to have a menubar. 2057 //Disable the following block if you do not want to have a menubar.
2062 mb->insertItem( i18n("&File"), fileMenu ); 2058 mb->insertItem( i18n("&File"), fileMenu );
2063 mb->insertItem( i18n("&Edit"), editMenu ); 2059 mb->insertItem( i18n("&Edit"), editMenu );
2064 mb->insertItem( i18n("&View"), viewMenu ); 2060 mb->insertItem( i18n("&View"), viewMenu );
2065 mb->insertItem( i18n("&Settings"), settingsMenu ); 2061 mb->insertItem( i18n("&Settings"), settingsMenu );
2066 mb->insertItem( i18n("Synchronize"), syncMenu ); 2062 mb->insertItem( i18n("Synchronize"), syncMenu );
2067 //mb->insertItem( i18n("&Change"), changeMenu ); 2063 //mb->insertItem( i18n("&Change"), changeMenu );
2068 mb->insertItem( i18n("&Help"), helpMenu ); 2064 mb->insertItem( i18n("&Help"), helpMenu );
2069 mIncSearchWidget = new IncSearchWidget( tb ); 2065 mIncSearchWidget = new IncSearchWidget( tb );
2070 // tb->insertWidget(-1, 0, mIncSearchWidget); 2066 // tb->insertWidget(-1, 0, mIncSearchWidget);
2071#ifndef DESKTOP_VERSION 2067#ifndef DESKTOP_VERSION
2072 } else { 2068 } else {
2073 //US setup toolbar 2069 //US setup toolbar
2074 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2070 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2075 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2071 QPopupMenu *popupBarTB = new QPopupMenu( this );
2076 menuBarTB->insertItem( "ME", popupBarTB); 2072 menuBarTB->insertItem( "ME", popupBarTB);
2077 tb->insertWidget(-1, 0, menuBarTB); 2073 tb->insertWidget(-1, 0, menuBarTB);
2078 mIncSearchWidget = new IncSearchWidget( tb ); 2074 mIncSearchWidget = new IncSearchWidget( tb );
2079 2075
2080 tb->enableMoving(false); 2076 tb->enableMoving(false);
2081 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2077 popupBarTB->insertItem( i18n("&File"), fileMenu );
2082 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2078 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2083 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2079 popupBarTB->insertItem( i18n("&View"), viewMenu );
2084 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2080 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2085 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2081 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2086 mViewManager->getFilterAction()->plug ( popupBarTB); 2082 mViewManager->getFilterAction()->plug ( popupBarTB);
2087 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2083 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2088 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2084 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2089 if (QApplication::desktop()->width() > 320 ) { 2085 if (QApplication::desktop()->width() > 320 ) {
2090 // mViewManager->getFilterAction()->plug ( tb); 2086 // mViewManager->getFilterAction()->plug ( tb);
2091 } 2087 }
2092 } 2088 }
2093#endif 2089#endif
2094 // mActionQuit->plug ( mMainWindow->toolBar()); 2090 // mActionQuit->plug ( mMainWindow->toolBar());
2095 2091
2096 2092
2097 2093
2098 //US Now connect the actions with the menue entries. 2094 //US Now connect the actions with the menue entries.
2099 mActionPrint->plug( fileMenu ); 2095 mActionPrint->plug( fileMenu );
2100 mActionMail->plug( fileMenu ); 2096 mActionMail->plug( fileMenu );
2101 fileMenu->insertSeparator(); 2097 fileMenu->insertSeparator();
2102 2098
2103 mActionNewContact->plug( fileMenu ); 2099 mActionNewContact->plug( fileMenu );
2104 mActionNewContact->plug( tb ); 2100 mActionNewContact->plug( tb );
2105 2101
2106 mActionEditAddressee->plug( fileMenu ); 2102 mActionEditAddressee->plug( fileMenu );
2107 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2103 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2108 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2104 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2109 mActionEditAddressee->plug( tb ); 2105 mActionEditAddressee->plug( tb );
2110 2106
2111 fileMenu->insertSeparator(); 2107 fileMenu->insertSeparator();
2112 mActionSave->plug( fileMenu ); 2108 mActionSave->plug( fileMenu );
2113 fileMenu->insertItem( "&Import", ImportMenu ); 2109 fileMenu->insertItem( "&Import", ImportMenu );
2114 fileMenu->insertItem( "&Export", ExportMenu ); 2110 fileMenu->insertItem( "&Export", ExportMenu );
2115 fileMenu->insertItem( i18n("&Change"), changeMenu ); 2111 fileMenu->insertItem( i18n("&Change"), changeMenu );
2116#ifndef DESKTOP_VERSION 2112#ifndef DESKTOP_VERSION
2117 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2113 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2118#endif 2114#endif
2119 2115
2120 fileMenu->insertSeparator(); 2116 fileMenu->insertSeparator();
2121 mActionMailVCard->plug( fileMenu ); 2117 mActionMailVCard->plug( fileMenu );
2122#ifndef DESKTOP_VERSION 2118#ifndef DESKTOP_VERSION
2123 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2119 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2124 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2120 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2125 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2121 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2126#endif 2122#endif
2127 fileMenu->insertSeparator(); 2123 fileMenu->insertSeparator();
2128 mActionQuit->plug( fileMenu ); 2124 mActionQuit->plug( fileMenu );
2129#ifdef _WIN32_ 2125#ifdef _WIN32_
2130 mActionImportOL->plug( ImportMenu ); 2126 mActionImportOL->plug( ImportMenu );
2131#endif 2127#endif
2132 // edit menu 2128 // edit menu
2133 mActionUndo->plug( editMenu ); 2129 mActionUndo->plug( editMenu );
2134 mActionRedo->plug( editMenu ); 2130 mActionRedo->plug( editMenu );
2135 editMenu->insertSeparator(); 2131 editMenu->insertSeparator();
2136 mActionCut->plug( editMenu ); 2132 mActionCut->plug( editMenu );
2137 mActionCopy->plug( editMenu ); 2133 mActionCopy->plug( editMenu );
2138 mActionPaste->plug( editMenu ); 2134 mActionPaste->plug( editMenu );
2139 mActionDelete->plug( editMenu ); 2135 mActionDelete->plug( editMenu );
2140 editMenu->insertSeparator(); 2136 editMenu->insertSeparator();
2141 mActionSelectAll->plug( editMenu ); 2137 mActionSelectAll->plug( editMenu );
2142 2138
2143 mActionRemoveVoice->plug( changeMenu ); 2139 mActionRemoveVoice->plug( changeMenu );
2144 // settings menu 2140 // settings menu
2145//US special menuentry to configure the addressbook resources. On KDE 2141//US special menuentry to configure the addressbook resources. On KDE
2146// you do that through the control center !!! 2142// you do that through the control center !!!
2147 mActionConfigResources->plug( settingsMenu ); 2143 mActionConfigResources->plug( settingsMenu );
2148 settingsMenu->insertSeparator(); 2144 settingsMenu->insertSeparator();
2149 2145
2150 mActionConfigKAddressbook->plug( settingsMenu ); 2146 mActionConfigKAddressbook->plug( settingsMenu );
2151 2147
2152 if ( mIsPart ) { 2148 if ( mIsPart ) {
2153 //US not implemented yet 2149 //US not implemented yet
2154 //mActionConfigShortcuts->plug( settingsMenu ); 2150 //mActionConfigShortcuts->plug( settingsMenu );
2155 //mActionConfigureToolbars->plug( settingsMenu ); 2151 //mActionConfigureToolbars->plug( settingsMenu );
2156 2152
2157 } else { 2153 } else {
2158 //US not implemented yet 2154 //US not implemented yet
2159 //mActionKeyBindings->plug( settingsMenu ); 2155 //mActionKeyBindings->plug( settingsMenu );
2160 } 2156 }
2161 2157
2162 settingsMenu->insertSeparator(); 2158 settingsMenu->insertSeparator();
2163 2159
2164 mActionJumpBar->plug( settingsMenu ); 2160 mActionJumpBar->plug( settingsMenu );
2165 mActionDetails->plug( settingsMenu ); 2161 mActionDetails->plug( settingsMenu );
2166 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2162 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2167 mActionDetails->plug( tb ); 2163 mActionDetails->plug( tb );
2168 settingsMenu->insertSeparator(); 2164 settingsMenu->insertSeparator();
2169#ifndef DESKTOP_VERSION 2165#ifndef DESKTOP_VERSION
2170 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2166 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2171#endif 2167#endif
2172 settingsMenu->insertSeparator(); 2168 settingsMenu->insertSeparator();
2173 2169
2174 mActionWhoAmI->plug( settingsMenu ); 2170 mActionWhoAmI->plug( settingsMenu );
2175 mActionEditCategories->plug( settingsMenu ); 2171 mActionEditCategories->plug( settingsMenu );
2176 mActionEditCategories->plug( changeMenu ); 2172 mActionEditCategories->plug( changeMenu );
2177 mActionCategories->plug( changeMenu ); 2173 mActionCategories->plug( changeMenu );
2178 mActionManageCategories->plug( changeMenu ); 2174 mActionManageCategories->plug( changeMenu );
2179 2175
2180 mActionCategories->plug( settingsMenu ); 2176 mActionCategories->plug( settingsMenu );
2181 mActionManageCategories->plug( settingsMenu ); 2177 mActionManageCategories->plug( settingsMenu );
2182 2178
2183 2179
2184 mActionWN->plug( helpMenu ); 2180 mActionWN->plug( helpMenu );
2185 mActionSyncHowto->plug( helpMenu ); 2181 mActionSyncHowto->plug( helpMenu );
2186 mActionKdeSyncHowto->plug( helpMenu ); 2182 mActionKdeSyncHowto->plug( helpMenu );
2187 mActionMultiSyncHowto->plug( helpMenu ); 2183 mActionMultiSyncHowto->plug( helpMenu );
2188 mActionFaq->plug( helpMenu ); 2184 mActionFaq->plug( helpMenu );
2189 mActionLicence->plug( helpMenu ); 2185 mActionLicence->plug( helpMenu );
2190 mActionAboutKAddressbook->plug( helpMenu ); 2186 mActionAboutKAddressbook->plug( helpMenu );
2191 2187
2192 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2188 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2193 2189
2194 mActionSave->plug( tb ); 2190 mActionSave->plug( tb );
2195 mViewManager->getFilterAction()->plug ( tb); 2191 mViewManager->getFilterAction()->plug ( tb);
2196 //LR hide filteraction on started in 480x640 2192 //LR hide filteraction on started in 480x640
2197 if (QApplication::desktop()->width() == 480 ) { 2193 if (QApplication::desktop()->width() == 480 ) {
2198 mViewManager->getFilterAction()->setComboWidth( 0 ); 2194 mViewManager->getFilterAction()->setComboWidth( 0 );
2199 } 2195 }
2200 mActionUndo->plug( tb ); 2196 mActionUndo->plug( tb );
2201 mActionDelete->plug( tb ); 2197 mActionDelete->plug( tb );
2202 mActionRedo->plug( tb ); 2198 mActionRedo->plug( tb );
2203 } else { 2199 } else {
2204 mActionSave->plug( tb ); 2200 mActionSave->plug( tb );
2205 tb->enableMoving(false); 2201 tb->enableMoving(false);
2206 } 2202 }
2207 //mActionQuit->plug ( tb ); 2203 //mActionQuit->plug ( tb );
2208 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2204 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2209 2205
2210 //US link the searchwidget first to this. 2206 //US link the searchwidget first to this.
2211 // The real linkage to the toolbar happens later. 2207 // The real linkage to the toolbar happens later.
2212//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2208//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2213//US tb->insertItem( mIncSearchWidget ); 2209//US tb->insertItem( mIncSearchWidget );
2214/*US 2210/*US
2215 mIncSearchWidget = new IncSearchWidget( tb ); 2211 mIncSearchWidget = new IncSearchWidget( tb );
2216 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2212 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2217 SLOT( incrementalSearch( const QString& ) ) ); 2213 SLOT( incrementalSearch( const QString& ) ) );
2218 2214
2219 mJumpButtonBar = new JumpButtonBar( this, this ); 2215 mJumpButtonBar = new JumpButtonBar( this, this );
2220 2216
2221//US topLayout->addWidget( mJumpButtonBar ); 2217//US topLayout->addWidget( mJumpButtonBar );
2222 this->layout()->add( mJumpButtonBar ); 2218 this->layout()->add( mJumpButtonBar );
2223*/ 2219*/
2224 2220
2225#endif //KAB_EMBEDDED 2221#endif //KAB_EMBEDDED
2226 2222
2227 mActionExport2phone->plug( ExportMenu ); 2223 mActionExport2phone->plug( ExportMenu );
2228 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2224 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2229 syncManager->fillSyncMenu(); 2225 syncManager->fillSyncMenu();
2230 2226
2231} 2227}
2232void KABCore::showLicence() 2228void KABCore::showLicence()
2233{ 2229{
2234 KApplication::showLicence(); 2230 KApplication::showLicence();
2235} 2231}
2236 2232
2237void KABCore::manageCategories( ) 2233void KABCore::manageCategories( )
2238{ 2234{
2239 KABCatPrefs* cp = new KABCatPrefs(); 2235 KABCatPrefs* cp = new KABCatPrefs();
2240 cp->show(); 2236 cp->show();
2241 int w =cp->sizeHint().width() ; 2237 int w =cp->sizeHint().width() ;
2242 int h = cp->sizeHint().height() ; 2238 int h = cp->sizeHint().height() ;
2243 int dw = QApplication::desktop()->width(); 2239 int dw = QApplication::desktop()->width();
2244 int dh = QApplication::desktop()->height(); 2240 int dh = QApplication::desktop()->height();
2245 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2241 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2246 if ( !cp->exec() ) { 2242 if ( !cp->exec() ) {
2247 delete cp; 2243 delete cp;
2248 return; 2244 return;
2249 } 2245 }
2250 int count = 0; 2246 int count = 0;
2251 message( i18n("Please wait, processing categories...")); 2247 message( i18n("Please wait, processing categories..."));
2252 if ( cp->addCat() ) { 2248 if ( cp->addCat() ) {
2253 KABC::AddressBook::Iterator it; 2249 KABC::AddressBook::Iterator it;
2254 QStringList catList = KABPrefs::instance()->mCustomCategories; 2250 QStringList catList = KABPrefs::instance()->mCustomCategories;
2255 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2251 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2256 QStringList catIncList = (*it).categories(); 2252 QStringList catIncList = (*it).categories();
2257 int i; 2253 int i;
2258 for( i = 0; i< catIncList.count(); ++i ) { 2254 for( i = 0; i< catIncList.count(); ++i ) {
2259 if ( !catList.contains (catIncList[i])) { 2255 if ( !catList.contains (catIncList[i])) {
2260 catList.append( catIncList[i] ); 2256 catList.append( catIncList[i] );
2261 //qDebug("add cat %s ", catIncList[i].latin1()); 2257 //qDebug("add cat %s ", catIncList[i].latin1());
2262 ++count; 2258 ++count;
2263 } 2259 }
2264 } 2260 }
2265 } 2261 }
2266 catList.sort(); 2262 catList.sort();
2267 KABPrefs::instance()->mCustomCategories = catList; 2263 KABPrefs::instance()->mCustomCategories = catList;
2268 KABPrefs::instance()->writeConfig(); 2264 KABPrefs::instance()->writeConfig();
2269 message(QString::number( count )+ i18n(" categories added to list! ")); 2265 message(QString::number( count )+ i18n(" categories added to list! "));
2270 } else { 2266 } else {
2271 QStringList catList = KABPrefs::instance()->mCustomCategories; 2267 QStringList catList = KABPrefs::instance()->mCustomCategories;
2272 QStringList catIncList; 2268 QStringList catIncList;
2273 QStringList newCatList; 2269 QStringList newCatList;
2274 KABC::AddressBook::Iterator it; 2270 KABC::AddressBook::Iterator it;
2275 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2271 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2276 QStringList catIncList = (*it).categories(); 2272 QStringList catIncList = (*it).categories();
2277 int i; 2273 int i;
2278 if ( catIncList.count() ) { 2274 if ( catIncList.count() ) {
2279 newCatList.clear(); 2275 newCatList.clear();
2280 for( i = 0; i< catIncList.count(); ++i ) { 2276 for( i = 0; i< catIncList.count(); ++i ) {
2281 if ( catList.contains (catIncList[i])) { 2277 if ( catList.contains (catIncList[i])) {
2282 newCatList.append( catIncList[i] ); 2278 newCatList.append( catIncList[i] );
2283 } 2279 }
2284 } 2280 }
2285 newCatList.sort(); 2281 newCatList.sort();
2286 (*it).setCategories( newCatList ); 2282 (*it).setCategories( newCatList );
2287 mAddressBook->insertAddressee( (*it) ); 2283 mAddressBook->insertAddressee( (*it) );
2288 } 2284 }
2289 } 2285 }
2290 setModified( true ); 2286 setModified( true );
2291 mViewManager->refreshView(); 2287 mViewManager->refreshView();
2292 mDetails->refreshView();
2293 message( i18n("Removing categories done!")); 2288 message( i18n("Removing categories done!"));
2294 } 2289 }
2295 delete cp; 2290 delete cp;
2296} 2291}
2297void KABCore::removeVoice() 2292void KABCore::removeVoice()
2298{ 2293{
2299 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 ) 2294 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 )
2300 return; 2295 return;
2301 KABC::Addressee::List list; 2296 KABC::Addressee::List list;
2302 XXPortSelectDialog dlg( this, false, this ); 2297 XXPortSelectDialog dlg( this, false, this );
2303 if ( dlg.exec() ) 2298 if ( dlg.exec() )
2304 list = dlg.contacts(); 2299 list = dlg.contacts();
2305 else 2300 else
2306 return; 2301 return;
2307 KABC::Addressee::List::Iterator it; 2302 KABC::Addressee::List::Iterator it;
2308 for ( it = list.begin(); it != list.end(); ++it ) { 2303 for ( it = list.begin(); it != list.end(); ++it ) {
2309 if ( (*it).removeVoice() ) 2304 if ( (*it).removeVoice() )
2310 contactModified((*it) ); 2305 contactModified((*it) );
2311 } 2306 }
2312} 2307}
2313 2308
2314 2309
2315 2310
2316void KABCore::clipboardDataChanged() 2311void KABCore::clipboardDataChanged()
2317{ 2312{
2318 2313
2319 if ( mReadWrite ) 2314 if ( mReadWrite )
2320 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2315 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2321 2316
2322} 2317}
2323 2318
2324void KABCore::updateActionMenu() 2319void KABCore::updateActionMenu()
2325{ 2320{
2326 UndoStack *undo = UndoStack::instance(); 2321 UndoStack *undo = UndoStack::instance();
2327 RedoStack *redo = RedoStack::instance(); 2322 RedoStack *redo = RedoStack::instance();
2328 2323
2329 if ( undo->isEmpty() ) 2324 if ( undo->isEmpty() )
2330 mActionUndo->setText( i18n( "Undo" ) ); 2325 mActionUndo->setText( i18n( "Undo" ) );
2331 else 2326 else
2332 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2327 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2333 2328
2334 mActionUndo->setEnabled( !undo->isEmpty() ); 2329 mActionUndo->setEnabled( !undo->isEmpty() );
2335 2330
2336 if ( !redo->top() ) 2331 if ( !redo->top() )
2337 mActionRedo->setText( i18n( "Redo" ) ); 2332 mActionRedo->setText( i18n( "Redo" ) );
2338 else 2333 else
2339 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2334 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2340 2335
2341 mActionRedo->setEnabled( !redo->isEmpty() ); 2336 mActionRedo->setEnabled( !redo->isEmpty() );
2342} 2337}
2343 2338
2344void KABCore::configureKeyBindings() 2339void KABCore::configureKeyBindings()
2345{ 2340{
2346#ifndef KAB_EMBEDDED 2341#ifndef KAB_EMBEDDED
2347 KKeyDialog::configure( actionCollection(), true ); 2342 KKeyDialog::configure( actionCollection(), true );
2348#else //KAB_EMBEDDED 2343#else //KAB_EMBEDDED
2349 qDebug("KABCore::configureKeyBindings() not implemented"); 2344 qDebug("KABCore::configureKeyBindings() not implemented");
2350#endif //KAB_EMBEDDED 2345#endif //KAB_EMBEDDED
2351} 2346}
2352 2347
2353#ifdef KAB_EMBEDDED 2348#ifdef KAB_EMBEDDED
2354void KABCore::configureResources() 2349void KABCore::configureResources()
2355{ 2350{
2356 KRES::KCMKResources dlg( this, "" , 0 ); 2351 KRES::KCMKResources dlg( this, "" , 0 );
2357 2352
2358 if ( !dlg.exec() ) 2353 if ( !dlg.exec() )
2359 return; 2354 return;
2360 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2355 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2361} 2356}
2362#endif //KAB_EMBEDDED 2357#endif //KAB_EMBEDDED
2363 2358
2364 2359
2365/* this method will be called through the QCop interface from Ko/Pi to select addresses 2360/* this method will be called through the QCop interface from Ko/Pi to select addresses
2366 * for the attendees list of an event. 2361 * for the attendees list of an event.
2367 */ 2362 */
2368void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2363void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2369{ 2364{
2370 QStringList nameList; 2365 QStringList nameList;
2371 QStringList emailList; 2366 QStringList emailList;
2372 QStringList uidList; 2367 QStringList uidList;
2373 2368
2374 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2369 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2375 uint i=0; 2370 uint i=0;
2376 for (i=0; i < list.count(); i++) 2371 for (i=0; i < list.count(); i++)
2377 { 2372 {
2378 nameList.append(list[i].realName()); 2373 nameList.append(list[i].realName());
2379 emailList.append(list[i].preferredEmail()); 2374 emailList.append(list[i].preferredEmail());
2380 uidList.append(list[i].uid()); 2375 uidList.append(list[i].uid());
2381 } 2376 }
2382 2377
2383 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2378 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2384 2379
2385} 2380}
2386 2381
2387/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2382/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2388 * to put them into the calendar. 2383 * to put them into the calendar.
2389 */ 2384 */
2390void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2385void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2391{ 2386{
2392 // qDebug("KABCore::requestForBirthdayList"); 2387 // qDebug("KABCore::requestForBirthdayList");
2393 QStringList birthdayList; 2388 QStringList birthdayList;
2394 QStringList anniversaryList; 2389 QStringList anniversaryList;
2395 QStringList realNameList; 2390 QStringList realNameList;
2396 QStringList preferredEmailList; 2391 QStringList preferredEmailList;
2397 QStringList assembledNameList; 2392 QStringList assembledNameList;
2398 QStringList uidList; 2393 QStringList uidList;
2399 2394
2400 KABC::AddressBook::Iterator it; 2395 KABC::AddressBook::Iterator it;
2401 2396
2402 int count = 0; 2397 int count = 0;
2403 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2398 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2404 ++count; 2399 ++count;
2405 } 2400 }
2406 QProgressBar bar(count,0 ); 2401 QProgressBar bar(count,0 );
2407 int w = 300; 2402 int w = 300;
2408 if ( QApplication::desktop()->width() < 320 ) 2403 if ( QApplication::desktop()->width() < 320 )
2409 w = 220; 2404 w = 220;
2410 int h = bar.sizeHint().height() ; 2405 int h = bar.sizeHint().height() ;
2411 int dw = QApplication::desktop()->width(); 2406 int dw = QApplication::desktop()->width();
2412 int dh = QApplication::desktop()->height(); 2407 int dh = QApplication::desktop()->height();
2413 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2408 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2414 bar.show(); 2409 bar.show();
2415 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2410 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2416 qApp->processEvents(); 2411 qApp->processEvents();
2417 2412
2418 QDate bday; 2413 QDate bday;
2419 QString anni; 2414 QString anni;
2420 QString formattedbday; 2415 QString formattedbday;
2421 2416
2422 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2417 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2423 { 2418 {
2424 if ( ! bar.isVisible() ) 2419 if ( ! bar.isVisible() )
2425 return; 2420 return;
2426 bar.setProgress( count++ ); 2421 bar.setProgress( count++ );
2427 qApp->processEvents(); 2422 qApp->processEvents();
2428 bday = (*it).birthday().date(); 2423 bday = (*it).birthday().date();
2429 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2424 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2430 2425
2431 if ( bday.isValid() || !anni.isEmpty()) 2426 if ( bday.isValid() || !anni.isEmpty())
2432 { 2427 {
2433 if (bday.isValid()) 2428 if (bday.isValid())
2434 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2429 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2435 else 2430 else
2436 formattedbday = "NOTVALID"; 2431 formattedbday = "NOTVALID";
2437 if (anni.isEmpty()) 2432 if (anni.isEmpty())
2438 anni = "INVALID"; 2433 anni = "INVALID";
2439 2434
2440 birthdayList.append(formattedbday); 2435 birthdayList.append(formattedbday);
2441 anniversaryList.append(anni); //should be ISODate 2436 anniversaryList.append(anni); //should be ISODate
2442 realNameList.append((*it).realName()); 2437 realNameList.append((*it).realName());
2443 preferredEmailList.append((*it).preferredEmail()); 2438 preferredEmailList.append((*it).preferredEmail());
2444 assembledNameList.append((*it).assembledName()); 2439 assembledNameList.append((*it).assembledName());
2445 uidList.append((*it).uid()); 2440 uidList.append((*it).uid());
2446 2441
2447 //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() ); 2442 //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() );
2448 } 2443 }
2449 } 2444 }
2450 2445
2451 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2446 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2452 2447
2453} 2448}
2454 2449
2455/* this method will be called through the QCop interface from other apps to show details of a contact. 2450/* this method will be called through the QCop interface from other apps to show details of a contact.
2456 */ 2451 */
2457void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2452void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2458{ 2453{
2459 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2454 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2460 2455
2461 QString foundUid = QString::null; 2456 QString foundUid = QString::null;
2462 if ( ! uid.isEmpty() ) { 2457 if ( ! uid.isEmpty() ) {
2463 Addressee adrr = mAddressBook->findByUid( uid ); 2458 Addressee adrr = mAddressBook->findByUid( uid );
2464 if ( !adrr.isEmpty() ) { 2459 if ( !adrr.isEmpty() ) {
2465 foundUid = uid; 2460 foundUid = uid;
2466 } 2461 }
2467 if ( email == "sendbacklist" ) { 2462 if ( email == "sendbacklist" ) {
2468 //qDebug("ssssssssssssssssssssssend "); 2463 //qDebug("ssssssssssssssssssssssend ");
2469 QStringList nameList; 2464 QStringList nameList;
2470 QStringList emailList; 2465 QStringList emailList;
2471 QStringList uidList; 2466 QStringList uidList;
2472 nameList.append(adrr.realName()); 2467 nameList.append(adrr.realName());
2473 emailList = adrr.emails(); 2468 emailList = adrr.emails();
2474 uidList.append( adrr.preferredEmail()); 2469 uidList.append( adrr.preferredEmail());
2475 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2470 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2476 return; 2471 return;
2477 } 2472 }
2478 2473
2479 } 2474 }
2480 2475
2481 if ( email == "sendbacklist" ) 2476 if ( email == "sendbacklist" )
2482 return; 2477 return;
2483 if (foundUid.isEmpty()) 2478 if (foundUid.isEmpty())
2484 { 2479 {
2485 //find the uid of the person first 2480 //find the uid of the person first
2486 Addressee::List namelist; 2481 Addressee::List namelist;
2487 Addressee::List emaillist; 2482 Addressee::List emaillist;
2488 2483
2489 if (!name.isEmpty()) 2484 if (!name.isEmpty())
2490 namelist = mAddressBook->findByName( name ); 2485 namelist = mAddressBook->findByName( name );
2491 2486
2492 if (!email.isEmpty()) 2487 if (!email.isEmpty())
2493 emaillist = mAddressBook->findByEmail( email ); 2488 emaillist = mAddressBook->findByEmail( email );
2494 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2489 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2495 //check if we have a match in Namelist and Emaillist 2490 //check if we have a match in Namelist and Emaillist
2496 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2491 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2497 foundUid = emaillist[0].uid(); 2492 foundUid = emaillist[0].uid();
2498 } 2493 }
2499 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2494 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2500 foundUid = namelist[0].uid(); 2495 foundUid = namelist[0].uid();
2501 else 2496 else
2502 { 2497 {
2503 for (int i = 0; i < namelist.count(); i++) 2498 for (int i = 0; i < namelist.count(); i++)
2504 { 2499 {
2505 for (int j = 0; j < emaillist.count(); j++) 2500 for (int j = 0; j < emaillist.count(); j++)
2506 { 2501 {
2507 if (namelist[i] == emaillist[j]) 2502 if (namelist[i] == emaillist[j])
2508 { 2503 {
2509 foundUid = namelist[i].uid(); 2504 foundUid = namelist[i].uid();
2510 } 2505 }
2511 } 2506 }
2512 } 2507 }
2513 } 2508 }
2514 } 2509 }
2515 else 2510 else
2516 { 2511 {
2517 foundUid = uid; 2512 foundUid = uid;
2518 } 2513 }
2519 2514
2520 if (!foundUid.isEmpty()) 2515 if (!foundUid.isEmpty())
2521 { 2516 {
2522 2517
2523 // raise Ka/Pi if it is in the background 2518 // raise Ka/Pi if it is in the background
2524#ifndef DESKTOP_VERSION 2519#ifndef DESKTOP_VERSION
2525#ifndef KORG_NODCOP 2520#ifndef KORG_NODCOP
2526 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2521 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2527#endif 2522#endif
2528#endif 2523#endif
2529 2524
2530 mMainWindow->showMaximized(); 2525 mMainWindow->showMaximized();
2531 mMainWindow-> raise(); 2526 mMainWindow-> raise();
2532 2527
2533 mViewManager->setSelected( "", false); 2528 mViewManager->setSelected( "", false);
2534 mViewManager->refreshView( "" ); 2529 mViewManager->refreshView( "" );
2535 mViewManager->setSelected( foundUid, true ); 2530 mViewManager->setSelected( foundUid, true );
2536 mViewManager->refreshView( foundUid ); 2531 mViewManager->refreshView( foundUid );
2537 2532
2538 if ( !mMultipleViewsAtOnce ) 2533 if ( !mMultipleViewsAtOnce )
2539 { 2534 {
2540 setDetailsVisible( true ); 2535 setDetailsVisible( true );
2541 mActionDetails->setChecked(true); 2536 mActionDetails->setChecked(true);
2542 } 2537 }
2543 } 2538 }
2544} 2539}
2545 2540
2546void KABCore::whatsnew() 2541void KABCore::whatsnew()
2547{ 2542{
2548 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2543 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2549} 2544}
2550void KABCore::synchowto() 2545void KABCore::synchowto()
2551{ 2546{
2552 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2547 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2553} 2548}
2554void KABCore::kdesynchowto() 2549void KABCore::kdesynchowto()
2555{ 2550{
2556 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2551 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2557} 2552}
2558void KABCore::multisynchowto() 2553void KABCore::multisynchowto()
2559{ 2554{
2560 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2555 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2561} 2556}
2562void KABCore::faq() 2557void KABCore::faq()
2563{ 2558{
2564 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2559 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2565} 2560}
2566 2561
2567#include <libkcal/syncdefines.h> 2562#include <libkcal/syncdefines.h>
2568 2563
2569KABC::Addressee KABCore::getLastSyncAddressee() 2564KABC::Addressee KABCore::getLastSyncAddressee()
2570{ 2565{
2571 Addressee lse; 2566 Addressee lse;
2572 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2567 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2573 2568
2574 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2569 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2575 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2570 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2576 if (lse.isEmpty()) { 2571 if (lse.isEmpty()) {
2577 qDebug("Creating new last-syncAddressee "); 2572 qDebug("Creating new last-syncAddressee ");
2578 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2573 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2579 QString sum = ""; 2574 QString sum = "";
2580 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2575 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2581 sum = "E: "; 2576 sum = "E: ";
2582 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2577 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2583 lse.setRevision( mLastAddressbookSync ); 2578 lse.setRevision( mLastAddressbookSync );
2584 lse.setCategories( i18n("SyncEvent") ); 2579 lse.setCategories( i18n("SyncEvent") );
2585 mAddressBook->insertAddressee( lse ); 2580 mAddressBook->insertAddressee( lse );
2586 } 2581 }
2587 return lse; 2582 return lse;
2588} 2583}
2589int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2584int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2590{ 2585{
2591 2586
2592 //void setZaurusId(int id); 2587 //void setZaurusId(int id);
2593 // int zaurusId() const; 2588 // int zaurusId() const;
2594 // void setZaurusUid(int id); 2589 // void setZaurusUid(int id);
2595 // int zaurusUid() const; 2590 // int zaurusUid() const;
2596 // void setZaurusStat(int id); 2591 // void setZaurusStat(int id);
2597 // int zaurusStat() const; 2592 // int zaurusStat() const;
2598 // 0 equal 2593 // 0 equal
2599 // 1 take local 2594 // 1 take local
2600 // 2 take remote 2595 // 2 take remote
2601 // 3 cancel 2596 // 3 cancel
2602 QDateTime lastSync = mLastAddressbookSync; 2597 QDateTime lastSync = mLastAddressbookSync;
2603 QDateTime localMod = local->revision(); 2598 QDateTime localMod = local->revision();
2604 QDateTime remoteMod = remote->revision(); 2599 QDateTime remoteMod = remote->revision();
2605 2600
2606 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2601 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2607 2602
2608 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2603 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2609 bool remCh, locCh; 2604 bool remCh, locCh;
2610 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2605 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2611 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2606 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2612 locCh = ( localMod > mLastAddressbookSync ); 2607 locCh = ( localMod > mLastAddressbookSync );
2613 if ( !remCh && ! locCh ) { 2608 if ( !remCh && ! locCh ) {
2614 //qDebug("both not changed "); 2609 //qDebug("both not changed ");
2615 lastSync = localMod.addDays(1); 2610 lastSync = localMod.addDays(1);
2616 if ( mode <= SYNC_PREF_ASK ) 2611 if ( mode <= SYNC_PREF_ASK )
2617 return 0; 2612 return 0;
2618 } else { 2613 } else {
2619 if ( locCh ) { 2614 if ( locCh ) {
2620 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2615 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2621 lastSync = localMod.addDays( -1 ); 2616 lastSync = localMod.addDays( -1 );
2622 if ( !remCh ) 2617 if ( !remCh )
2623 remoteMod =( lastSync.addDays( -1 ) ); 2618 remoteMod =( lastSync.addDays( -1 ) );
2624 } else { 2619 } else {
2625 //qDebug(" not loc changed "); 2620 //qDebug(" not loc changed ");
2626 lastSync = localMod.addDays( 1 ); 2621 lastSync = localMod.addDays( 1 );
2627 if ( remCh ) { 2622 if ( remCh ) {
2628 //qDebug("rem changed "); 2623 //qDebug("rem changed ");
2629 remoteMod =( lastSync.addDays( 1 ) ); 2624 remoteMod =( lastSync.addDays( 1 ) );
2630 } 2625 }
2631 2626
2632 } 2627 }
2633 } 2628 }
2634 full = true; 2629 full = true;
2635 if ( mode < SYNC_PREF_ASK ) 2630 if ( mode < SYNC_PREF_ASK )
2636 mode = SYNC_PREF_ASK; 2631 mode = SYNC_PREF_ASK;
2637 } else { 2632 } else {
2638 if ( localMod == remoteMod ) 2633 if ( localMod == remoteMod )
2639 return 0; 2634 return 0;
2640 2635
2641 } 2636 }
2642 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); 2637 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec());
2643 //qDebug("lastsync %s ", lastSync.toString().latin1() ); 2638 //qDebug("lastsync %s ", lastSync.toString().latin1() );
2644 //full = true; //debug only 2639 //full = true; //debug only
2645 if ( full ) { 2640 if ( full ) {
2646 bool equ = ( (*local) == (*remote) ); 2641 bool equ = ( (*local) == (*remote) );
2647 if ( equ ) { 2642 if ( equ ) {
2648 //qDebug("equal "); 2643 //qDebug("equal ");
2649 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2644 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2650 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2645 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2651 } 2646 }
2652 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2647 if ( mode < SYNC_PREF_FORCE_LOCAL )
2653 return 0; 2648 return 0;
2654 2649
2655 }//else //debug only 2650 }//else //debug only
2656 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2651 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2657 } 2652 }
2658 int result; 2653 int result;
2659 bool localIsNew; 2654 bool localIsNew;
2660 //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() ); 2655 //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() );
2661 2656
2662 if ( full && mode < SYNC_PREF_NEWEST ) 2657 if ( full && mode < SYNC_PREF_NEWEST )
2663 mode = SYNC_PREF_ASK; 2658 mode = SYNC_PREF_ASK;
2664 2659
2665 switch( mode ) { 2660 switch( mode ) {
2666 case SYNC_PREF_LOCAL: 2661 case SYNC_PREF_LOCAL:
2667 if ( lastSync > remoteMod ) 2662 if ( lastSync > remoteMod )
2668 return 1; 2663 return 1;
2669 if ( lastSync > localMod ) 2664 if ( lastSync > localMod )
2670 return 2; 2665 return 2;
2671 return 1; 2666 return 1;
2672 break; 2667 break;
2673 case SYNC_PREF_REMOTE: 2668 case SYNC_PREF_REMOTE:
2674 if ( lastSync > remoteMod ) 2669 if ( lastSync > remoteMod )
2675 return 1; 2670 return 1;
2676 if ( lastSync > localMod ) 2671 if ( lastSync > localMod )
2677 return 2; 2672 return 2;
2678 return 2; 2673 return 2;
2679 break; 2674 break;
2680 case SYNC_PREF_NEWEST: 2675 case SYNC_PREF_NEWEST:
2681 if ( localMod > remoteMod ) 2676 if ( localMod > remoteMod )
2682 return 1; 2677 return 1;
2683 else 2678 else
2684 return 2; 2679 return 2;
2685 break; 2680 break;
2686 case SYNC_PREF_ASK: 2681 case SYNC_PREF_ASK:
2687 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2682 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2688 if ( lastSync > remoteMod ) 2683 if ( lastSync > remoteMod )
2689 return 1; 2684 return 1;
2690 if ( lastSync > localMod ) 2685 if ( lastSync > localMod )
2691 return 2; 2686 return 2;
2692 localIsNew = localMod >= remoteMod; 2687 localIsNew = localMod >= remoteMod;
2693 //qDebug("conflict! ************************************** "); 2688 //qDebug("conflict! ************************************** ");
2694 { 2689 {
2695 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2690 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2696 result = acd.executeD(localIsNew); 2691 result = acd.executeD(localIsNew);
2697 return result; 2692 return result;
2698 } 2693 }
2699 break; 2694 break;
2700 case SYNC_PREF_FORCE_LOCAL: 2695 case SYNC_PREF_FORCE_LOCAL:
2701 return 1; 2696 return 1;
2702 break; 2697 break;
2703 case SYNC_PREF_FORCE_REMOTE: 2698 case SYNC_PREF_FORCE_REMOTE:
2704 return 2; 2699 return 2;
2705 break; 2700 break;
2706 2701
2707 default: 2702 default:
2708 // SYNC_PREF_TAKE_BOTH not implemented 2703 // SYNC_PREF_TAKE_BOTH not implemented
2709 break; 2704 break;
2710 } 2705 }
2711 return 0; 2706 return 0;
2712} 2707}
2713 2708
2714 2709
2715bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2710bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2716{ 2711{
2717 bool syncOK = true; 2712 bool syncOK = true;
2718 int addedAddressee = 0; 2713 int addedAddressee = 0;
2719 int addedAddresseeR = 0; 2714 int addedAddresseeR = 0;
2720 int deletedAddresseeR = 0; 2715 int deletedAddresseeR = 0;
2721 int deletedAddresseeL = 0; 2716 int deletedAddresseeL = 0;
2722 int changedLocal = 0; 2717 int changedLocal = 0;
2723 int changedRemote = 0; 2718 int changedRemote = 0;
2724 2719
2725 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2720 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2726 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2721 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2727 2722
2728 //QPtrList<Addressee> el = local->rawAddressees(); 2723 //QPtrList<Addressee> el = local->rawAddressees();
2729 Addressee addresseeR; 2724 Addressee addresseeR;
2730 QString uid; 2725 QString uid;
2731 int take; 2726 int take;
2732 Addressee addresseeL; 2727 Addressee addresseeL;
2733 Addressee addresseeRSync; 2728 Addressee addresseeRSync;
2734 Addressee addresseeLSync; 2729 Addressee addresseeLSync;
2735 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2730 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2736 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2731 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2737 bool fullDateRange = false; 2732 bool fullDateRange = false;
2738 local->resetTempSyncStat(); 2733 local->resetTempSyncStat();
2739 mLastAddressbookSync = QDateTime::currentDateTime(); 2734 mLastAddressbookSync = QDateTime::currentDateTime();
2740 if ( syncManager->syncWithDesktop() ) { 2735 if ( syncManager->syncWithDesktop() ) {
2741 // remote->removeSyncInfo( QString());//remove all info 2736 // remote->removeSyncInfo( QString());//remove all info
2742 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 2737 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
2743 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; 2738 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
2744 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); 2739 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
2745 } else { 2740 } else {
2746 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 2741 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
2747 } 2742 }
2748 } 2743 }
2749 QDateTime modifiedCalendar = mLastAddressbookSync; 2744 QDateTime modifiedCalendar = mLastAddressbookSync;
2750 addresseeLSync = getLastSyncAddressee(); 2745 addresseeLSync = getLastSyncAddressee();
2751 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2746 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
2752 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2747 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2753 if ( !addresseeR.isEmpty() ) { 2748 if ( !addresseeR.isEmpty() ) {
2754 addresseeRSync = addresseeR; 2749 addresseeRSync = addresseeR;
2755 remote->removeAddressee(addresseeR ); 2750 remote->removeAddressee(addresseeR );
2756 2751
2757 } else { 2752 } else {
2758 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2753 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2759 addresseeRSync = addresseeLSync ; 2754 addresseeRSync = addresseeLSync ;
2760 } else { 2755 } else {
2761 //qDebug("FULLDATE 1"); 2756 //qDebug("FULLDATE 1");
2762 fullDateRange = true; 2757 fullDateRange = true;
2763 Addressee newAdd; 2758 Addressee newAdd;
2764 addresseeRSync = newAdd; 2759 addresseeRSync = newAdd;
2765 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2760 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2766 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2761 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2767 addresseeRSync.setRevision( mLastAddressbookSync ); 2762 addresseeRSync.setRevision( mLastAddressbookSync );
2768 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2763 addresseeRSync.setCategories( i18n("SyncAddressee") );
2769 } 2764 }
2770 } 2765 }
2771 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2766 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2772 // qDebug("FULLDATE 2"); 2767 // qDebug("FULLDATE 2");
2773 fullDateRange = true; 2768 fullDateRange = true;
2774 } 2769 }
2775 if ( ! fullDateRange ) { 2770 if ( ! fullDateRange ) {
2776 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2771 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2777 2772
2778 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2773 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2779 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2774 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2780 fullDateRange = true; 2775 fullDateRange = true;
2781 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2776 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2782 } 2777 }
2783 } 2778 }
2784 // fullDateRange = true; // debug only! 2779 // fullDateRange = true; // debug only!
2785 if ( fullDateRange ) 2780 if ( fullDateRange )
2786 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2781 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2787 else 2782 else
2788 mLastAddressbookSync = addresseeLSync.revision(); 2783 mLastAddressbookSync = addresseeLSync.revision();
2789 // for resyncing if own file has changed 2784 // for resyncing if own file has changed
2790 // PENDING fixme later when implemented 2785 // PENDING fixme later when implemented
2791#if 0 2786#if 0
2792 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2787 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2793 mLastAddressbookSync = loadedFileVersion; 2788 mLastAddressbookSync = loadedFileVersion;
2794 qDebug("setting mLastAddressbookSync "); 2789 qDebug("setting mLastAddressbookSync ");
2795 } 2790 }
2796#endif 2791#endif
2797 2792
2798 //qDebug("*************************** "); 2793 //qDebug("*************************** ");
2799 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2794 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2800 QStringList er = remote->uidList(); 2795 QStringList er = remote->uidList();
2801 Addressee inR ;//= er.first(); 2796 Addressee inR ;//= er.first();
2802 Addressee inL; 2797 Addressee inL;
2803 2798
2804 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2799 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c7c12ff..85ffbdb 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,516 +1,515 @@
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.
100 */
101 void saveSettings();
102 99
103 /** 100 /**
104 Returns a pointer to the StdAddressBook of the application. 101 Returns a pointer to the StdAddressBook of the application.
105 */ 102 */
106 KABC::AddressBook *addressBook() const; 103 KABC::AddressBook *addressBook() const;
107 104
108 /** 105 /**
109 Returns a pointer to the KConfig object of the application. 106 Returns a pointer to the KConfig object of the application.
110 */ 107 */
111 static KConfig *config(); 108 static KConfig *config();
112 109
113 /** 110 /**
114 Returns a pointer to the global KActionCollection object. So 111 Returns a pointer to the global KActionCollection object. So
115 other classes can register their actions easily. 112 other classes can register their actions easily.
116 */ 113 */
117 KActionCollection *actionCollection() const; 114 KActionCollection *actionCollection() const;
118 115
119 /** 116 /**
120 Returns the current search field of the Incremental Search Widget. 117 Returns the current search field of the Incremental Search Widget.
121 */ 118 */
122 KABC::Field *currentSearchField() const; 119 KABC::Field *currentSearchField() const;
123 120
124 /** 121 /**
125 Returns the uid list of the currently selected contacts. 122 Returns the uid list of the currently selected contacts.
126 */ 123 */
127 QStringList selectedUIDs() const; 124 QStringList selectedUIDs() const;
128 125
129 /** 126 /**
130 Displays the ResourceSelectDialog and returns the selected 127 Displays the ResourceSelectDialog and returns the selected
131 resource or a null pointer if no resource was selected by 128 resource or a null pointer if no resource was selected by
132 the user. 129 the user.
133 */ 130 */
134 KABC::Resource *requestResource( QWidget *parent ); 131 KABC::Resource *requestResource( QWidget *parent );
135 132
136#ifndef KAB_EMBEDDED 133#ifndef KAB_EMBEDDED
137 static KAboutData *createAboutData(); 134 static KAboutData *createAboutData();
138#endif //KAB_EMBEDDED 135#endif //KAB_EMBEDDED
139 136
140#ifdef KAB_EMBEDDED 137#ifdef KAB_EMBEDDED
141 inline QPopupMenu* getImportMenu() { return ImportMenu;} 138 inline QPopupMenu* getImportMenu() { return ImportMenu;}
142 inline QPopupMenu* getExportMenu() { return ExportMenu;} 139 inline QPopupMenu* getExportMenu() { return ExportMenu;}
143#endif //KAB_EMBEDDED 140#endif //KAB_EMBEDDED
144 141
145 public slots: 142 public slots:
146#ifdef KAB_EMBEDDED 143#ifdef KAB_EMBEDDED
147 void createAboutData(); 144 void createAboutData();
148#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
149 void setDetailsToggle(); 146 void setDetailsToggle();
150 147
151 void showLicence(); 148 void showLicence();
152 void faq(); 149 void faq();
153 void whatsnew() ; 150 void whatsnew() ;
154 void synchowto() ; 151 void synchowto() ;
155 void multisynchowto() ; 152 void multisynchowto() ;
156 void kdesynchowto() ; 153 void kdesynchowto() ;
157 void writeToPhone(); 154 void writeToPhone();
158 155
159 /** 156 /**
160 Is called whenever a contact is selected in the view. 157 Is called whenever a contact is selected in the view.
161 */ 158 */
162 void setContactSelected( const QString &uid ); 159 void setContactSelected( const QString &uid );
163 160
164 /** 161 /**
165 Opens the preferred mail composer with all selected contacts as 162 Opens the preferred mail composer with all selected contacts as
166 arguments. 163 arguments.
167 */ 164 */
168 void sendMail(); 165 void sendMail();
169 166
170 /** 167 /**
171 Opens the preferred mail composer with the given contacts as 168 Opens the preferred mail composer with the given contacts as
172 arguments. 169 arguments.
173 */ 170 */
174 void sendMail( const QString& email ); 171 void sendMail( const QString& email );
175 172
176 173
177 void mailVCard(); 174 void mailVCard();
178 void mailVCard(const QStringList& uids); 175 void mailVCard(const QStringList& uids);
179 176
180 /** 177 /**
181 Beams the "WhoAmI contact. 178 Beams the "WhoAmI contact.
182 */ 179 */
183 void beamMySelf(); 180 void beamMySelf();
184 181
185 void beamVCard(); 182 void beamVCard();
186 void export2phone(); 183 void export2phone();
187 void beamVCard(const QStringList& uids); 184 void beamVCard(const QStringList& uids);
188 void beamDone( Ir *ir ); 185 void beamDone( Ir *ir );
189 186
190 187
191 /** 188 /**
192 Starts the preferred web browser with the given URL as argument. 189 Starts the preferred web browser with the given URL as argument.
193 */ 190 */
194 void browse( const QString& url ); 191 void browse( const QString& url );
195 192
196 /** 193 /**
197 Select all contacts in the view. 194 Select all contacts in the view.
198 */ 195 */
199 void selectAllContacts(); 196 void selectAllContacts();
200 197
201 /** 198 /**
202 Deletes all selected contacts from the address book. 199 Deletes all selected contacts from the address book.
203 */ 200 */
204 void deleteContacts(); 201 void deleteContacts();
205 202
206 /** 203 /**
207 Deletes given contacts from the address book. 204 Deletes given contacts from the address book.
208 205
209 @param uids The uids of the contacts, which shall be deleted. 206 @param uids The uids of the contacts, which shall be deleted.
210 */ 207 */
211 void deleteContacts( const QStringList &uids ); 208 void deleteContacts( const QStringList &uids );
212 209
213 /** 210 /**
214 Copys the selected contacts into clipboard for later pasting. 211 Copys the selected contacts into clipboard for later pasting.
215 */ 212 */
216 void copyContacts(); 213 void copyContacts();
217 214
218 /** 215 /**
219 Cuts the selected contacts and stores them for later pasting. 216 Cuts the selected contacts and stores them for later pasting.
220 */ 217 */
221 void cutContacts(); 218 void cutContacts();
222 219
223 /** 220 /**
224 Paste contacts from clipboard into the address book. 221 Paste contacts from clipboard into the address book.
225 */ 222 */
226 void pasteContacts(); 223 void pasteContacts();
227 224
228 /** 225 /**
229 Paste given contacts into the address book. 226 Paste given contacts into the address book.
230 227
231 @param list The list of addressee, which shall be pasted. 228 @param list The list of addressee, which shall be pasted.
232 */ 229 */
233 void pasteContacts( KABC::Addressee::List &list ); 230 void pasteContacts( KABC::Addressee::List &list );
234 231
235 /** 232 /**
236 Sets the whoAmI contact, that is used by many other programs to 233 Sets the whoAmI contact, that is used by many other programs to
237 get personal information about the current user. 234 get personal information about the current user.
238 */ 235 */
239 void setWhoAmI(); 236 void setWhoAmI();
240 237
241 /** 238 /**
242 Displays the category dialog and applies the result to all 239 Displays the category dialog and applies the result to all
243 selected contacts. 240 selected contacts.
244 */ 241 */
245 void setCategories(); 242 void setCategories();
246 void manageCategories(); 243 void manageCategories();
247 void editCategories(); 244 void editCategories();
248 245
249 /** 246 /**
250 Sets the field list of the Incremental Search Widget. 247 Sets the field list of the Incremental Search Widget.
251 */ 248 */
252 void setSearchFields( const KABC::Field::List &fields ); 249 void setSearchFields( const KABC::Field::List &fields );
253 250
254 /** 251 /**
255 Search with the current search field for a contact, that matches 252 Search with the current search field for a contact, that matches
256 the given text, and selects it in the view. 253 the given text, and selects it in the view.
257 */ 254 */
258 void incrementalSearch( const QString& text ); 255 void incrementalSearch( const QString& text );
259 256
260 /** 257 /**
261 Marks the address book as modified. 258 Marks the address book as modified.
262 */ 259 */
263 void setModified(); 260 void setModified();
264 /** 261 /**
265 Marks the address book as modified without refreshing the view. 262 Marks the address book as modified without refreshing the view.
266 */ 263 */
267 void setModifiedWOrefresh(); 264 void setModifiedWOrefresh();
268 265
269 /** 266 /**
270 Marks the address book as modified concerning the argument. 267 Marks the address book as modified concerning the argument.
271 */ 268 */
272 void setModified( bool modified ); 269 void setModified( bool modified );
273 270
274 /** 271 /**
275 Returns whether the address book is modified. 272 Returns whether the address book is modified.
276 */ 273 */
277 bool modified() const; 274 bool modified() const;
278 275
279 /** 276 /**
280 Called whenever an contact is modified in the contact editor 277 Called whenever an contact is modified in the contact editor
281 dialog or the quick edit. 278 dialog or the quick edit.
282 */ 279 */
283 void contactModified( const KABC::Addressee &addr ); 280 void contactModified( const KABC::Addressee &addr );
284 281
285 /** 282 /**
286 DCOP METHODS. 283 DCOP METHODS.
287 */ 284 */
288 void addEmail( QString addr ); 285 void addEmail( QString addr );
289 void importVCard( const KURL& url, bool showPreview ); 286 void importVCard( const KURL& url, bool showPreview );
290 void importVCard( const QString& vCard, bool showPreview ); 287 void importVCard( const QString& vCard, bool showPreview );
291 void newContact(); 288 void newContact();
292 QString getNameByPhone( const QString& phone ); 289 QString getNameByPhone( const QString& phone );
293 /** 290 /**
294 END DCOP METHODS 291 END DCOP METHODS
295 */ 292 */
296 293
297 /** 294 /**
298 Saves the contents of the AddressBook back to disk. 295 Saves the contents of the AddressBook back to disk.
299 */ 296 */
300 void save(); 297 void save();
301 298
302 /** 299 /**
303 Undos the last command using the undo stack. 300 Undos the last command using the undo stack.
304 */ 301 */
305 void undo(); 302 void undo();
306 303
307 /** 304 /**
308 Redos the last command that was undone, using the redo stack. 305 Redos the last command that was undone, using the redo stack.
309 */ 306 */
310 void redo(); 307 void redo();
311 308
312 /** 309 /**
313 Shows the edit dialog for the given uid. If the uid is QString::null, 310 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. 311 the method will try to find a selected addressee in the view.
315 */ 312 */
316 void editContact( const QString &uid /*US = QString::null*/ ); 313 void editContact( const QString &uid /*US = QString::null*/ );
317//US added a second method without defaultparameter 314//US added a second method without defaultparameter
318 void editContact2(); 315 void editContact2();
319 316
320 /** 317 /**
321 Shows or edits the detail view for the given uid. If the uid is QString::null, 318 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. 319 the method will try to find a selected addressee in the view.
323 */ 320 */
324 void executeContact( const QString &uid /*US = QString::null*/ ); 321 void executeContact( const QString &uid /*US = QString::null*/ );
325 322
326 /** 323 /**
327 Launches the configuration dialog. 324 Launches the configuration dialog.
328 */ 325 */
329 void openConfigDialog(); 326 void openConfigDialog();
330 327
331 /** 328 /**
332 Launches the ldap search dialog. 329 Launches the ldap search dialog.
333 */ 330 */
334 void openLDAPDialog(); 331 void openLDAPDialog();
335 332
336 /** 333 /**
337 Creates a KAddressBookPrinter, which will display the print 334 Creates a KAddressBookPrinter, which will display the print
338 dialog and do the printing. 335 dialog and do the printing.
339 */ 336 */
340 void print(); 337 void print();
341 338
342 /** 339 /**
343 Registers a new GUI client, so plugins can register its actions. 340 Registers a new GUI client, so plugins can register its actions.
344 */ 341 */
345 void addGUIClient( KXMLGUIClient *client ); 342 void addGUIClient( KXMLGUIClient *client );
346 343
347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 344 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); 345 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); 346 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
350 347
351 348
352 signals: 349 signals:
353 void contactSelected( const QString &name ); 350 void contactSelected( const QString &name );
354 void contactSelected( const QPixmap &pixmap ); 351 void contactSelected( const QPixmap &pixmap );
355 public slots: 352 public slots:
356 void recieve(QString cmsg ); 353 void recieve(QString cmsg );
357 void getFile( bool success ); 354 void getFile( bool success );
358 void syncFileRequest(); 355 void syncFileRequest();
359 void setDetailsVisible( bool visible ); 356 void setDetailsVisible( bool visible );
360 void setDetailsToState(); 357 void setDetailsToState();
361 // void slotSyncMenu( int ); 358
359 void saveSettings();
360
362 private slots: 361 private slots:
363 void updateToolBar(); 362 void updateToolBar();
364 void updateMainWindow(); 363 void updateMainWindow();
365 void receive( const QCString& cmsg, const QByteArray& data ); 364 void receive( const QCString& cmsg, const QByteArray& data );
366 void toggleBeamReceive( ); 365 void toggleBeamReceive( );
367 void disableBR(bool); 366 void disableBR(bool);
368 void setJumpButtonBarVisible( bool visible ); 367 void setJumpButtonBarVisible( bool visible );
369 void setCaptionBack(); 368 void setCaptionBack();
370 void importFromOL(); 369 void importFromOL();
371 void extensionModified( const KABC::Addressee::List &list ); 370 void extensionModified( const KABC::Addressee::List &list );
372 void extensionChanged( int id ); 371 void extensionChanged( int id );
373 void clipboardDataChanged(); 372 void clipboardDataChanged();
374 void updateActionMenu(); 373 void updateActionMenu();
375 void configureKeyBindings(); 374 void configureKeyBindings();
376 void removeVoice(); 375 void removeVoice();
377#ifdef KAB_EMBEDDED 376#ifdef KAB_EMBEDDED
378 void configureResources(); 377 void configureResources();
379#endif //KAB_EMBEDDED 378#endif //KAB_EMBEDDED
380 379
381 void slotEditorDestroyed( const QString &uid ); 380 void slotEditorDestroyed( const QString &uid );
382 void configurationChanged(); 381 void configurationChanged();
383 void addressBookChanged(); 382 void addressBookChanged();
384 383
385 private: 384 private:
386 void resizeEvent(QResizeEvent* e ); 385 void resizeEvent(QResizeEvent* e );
387 bool mBRdisabled; 386 bool mBRdisabled;
388#ifndef DESKTOP_VERSION 387#ifndef DESKTOP_VERSION
389 QCopChannel* infrared; 388 QCopChannel* infrared;
390#endif 389#endif
391 QTimer *mMessageTimer; 390 QTimer *mMessageTimer;
392 void initGUI(); 391 void initGUI();
393 void initActions(); 392 void initActions();
394 QString getPhoneFile(); 393 QString getPhoneFile();
395 394
396 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 395 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
397 const char *name = 0 ); 396 const char *name = 0 );
398 397
399 KXMLGUIClient *mGUIClient; 398 KXMLGUIClient *mGUIClient;
400 399
401 KABC::AddressBook *mAddressBook; 400 KABC::AddressBook *mAddressBook;
402 401
403 ViewManager *mViewManager; 402 ViewManager *mViewManager;
404 // QSplitter *mDetailsSplitter; 403 // QSplitter *mDetailsSplitter;
405 KDGanttMinimizeSplitter *mExtensionBarSplitter; 404 KDGanttMinimizeSplitter *mExtensionBarSplitter;
406 ViewContainer *mDetails; 405 ViewContainer *mDetails;
407 KDGanttMinimizeSplitter* mMiniSplitter; 406 KDGanttMinimizeSplitter* mMiniSplitter;
408 XXPortManager *mXXPortManager; 407 XXPortManager *mXXPortManager;
409 JumpButtonBar *mJumpButtonBar; 408 JumpButtonBar *mJumpButtonBar;
410 IncSearchWidget *mIncSearchWidget; 409 IncSearchWidget *mIncSearchWidget;
411 ExtensionManager *mExtensionManager; 410 ExtensionManager *mExtensionManager;
412 411
413 KCMultiDialog *mConfigureDialog; 412 KCMultiDialog *mConfigureDialog;
414 413
415#ifndef KAB_EMBEDDED 414#ifndef KAB_EMBEDDED
416 LDAPSearchDialog *mLdapSearchDialog; 415 LDAPSearchDialog *mLdapSearchDialog;
417#endif //KAB_EMBEDDED 416#endif //KAB_EMBEDDED
418 // QDict<AddresseeEditorDialog> mEditorDict; 417 // QDict<AddresseeEditorDialog> mEditorDict;
419 AddresseeEditorDialog *mEditorDialog; 418 AddresseeEditorDialog *mEditorDialog;
420 bool mReadWrite; 419 bool mReadWrite;
421 bool mModified; 420 bool mModified;
422 bool mIsPart; 421 bool mIsPart;
423 bool mMultipleViewsAtOnce; 422 bool mMultipleViewsAtOnce;
424 423
425 424
426 //US file menu 425 //US file menu
427 KAction *mActionMail; 426 KAction *mActionMail;
428 KAction *mActionBeam; 427 KAction *mActionBeam;
429 KToggleAction *mActionBR; 428 KToggleAction *mActionBR;
430 KAction *mActionExport2phone; 429 KAction *mActionExport2phone;
431 KAction* mActionPrint; 430 KAction* mActionPrint;
432 KAction* mActionNewContact; 431 KAction* mActionNewContact;
433 KAction *mActionSave; 432 KAction *mActionSave;
434 KAction *mActionEditAddressee; 433 KAction *mActionEditAddressee;
435 KAction *mActionMailVCard; 434 KAction *mActionMailVCard;
436 KAction *mActionBeamVCard; 435 KAction *mActionBeamVCard;
437 436
438 KAction *mActionQuit; 437 KAction *mActionQuit;
439 438
440 //US edit menu 439 //US edit menu
441 KAction *mActionCopy; 440 KAction *mActionCopy;
442 KAction *mActionCut; 441 KAction *mActionCut;
443 KAction *mActionPaste; 442 KAction *mActionPaste;
444 KAction *mActionSelectAll; 443 KAction *mActionSelectAll;
445 KAction *mActionUndo; 444 KAction *mActionUndo;
446 KAction *mActionRedo; 445 KAction *mActionRedo;
447 KAction *mActionDelete; 446 KAction *mActionDelete;
448 447
449 //US settings menu 448 //US settings menu
450 KAction *mActionConfigResources; 449 KAction *mActionConfigResources;
451 KAction *mActionConfigKAddressbook; 450 KAction *mActionConfigKAddressbook;
452 KAction *mActionConfigShortcuts; 451 KAction *mActionConfigShortcuts;
453 KAction *mActionConfigureToolbars; 452 KAction *mActionConfigureToolbars;
454 KAction *mActionKeyBindings; 453 KAction *mActionKeyBindings;
455 KToggleAction *mActionJumpBar; 454 KToggleAction *mActionJumpBar;
456 KToggleAction *mActionDetails; 455 KToggleAction *mActionDetails;
457 KAction *mActionWhoAmI; 456 KAction *mActionWhoAmI;
458 KAction *mActionCategories; 457 KAction *mActionCategories;
459 KAction *mActionEditCategories; 458 KAction *mActionEditCategories;
460 KAction *mActionManageCategories; 459 KAction *mActionManageCategories;
461 KAction *mActionAboutKAddressbook; 460 KAction *mActionAboutKAddressbook;
462 KAction *mActionLicence; 461 KAction *mActionLicence;
463 KAction *mActionFaq; 462 KAction *mActionFaq;
464 KAction *mActionWN; 463 KAction *mActionWN;
465 KAction *mActionSyncHowto; 464 KAction *mActionSyncHowto;
466 KAction *mActionKdeSyncHowto; 465 KAction *mActionKdeSyncHowto;
467 KAction *mActionMultiSyncHowto; 466 KAction *mActionMultiSyncHowto;
468 467
469 KAction *mActionDeleteView; 468 KAction *mActionDeleteView;
470 469
471 QPopupMenu *viewMenu; 470 QPopupMenu *viewMenu;
472 QPopupMenu *filterMenu; 471 QPopupMenu *filterMenu;
473 QPopupMenu *settingsMenu; 472 QPopupMenu *settingsMenu;
474 QPopupMenu *changeMenu; 473 QPopupMenu *changeMenu;
475 QPopupMenu *beamMenu; 474 QPopupMenu *beamMenu;
476//US QAction *mActionSave; 475//US QAction *mActionSave;
477 QPopupMenu *ImportMenu; 476 QPopupMenu *ImportMenu;
478 QPopupMenu *ExportMenu; 477 QPopupMenu *ExportMenu;
479 //LR additional methods 478 //LR additional methods
480 KAction *mActionRemoveVoice; 479 KAction *mActionRemoveVoice;
481 KAction * mActionImportOL; 480 KAction * mActionImportOL;
482 481
483#ifndef KAB_EMBEDDED 482#ifndef KAB_EMBEDDED
484 KAddressBookService *mAddressBookService; 483 KAddressBookService *mAddressBookService;
485#endif //KAB_EMBEDDED 484#endif //KAB_EMBEDDED
486 485
487 class KABCorePrivate; 486 class KABCorePrivate;
488 KABCorePrivate *d; 487 KABCorePrivate *d;
489 //US bool mBlockSaveFlag; 488 //US bool mBlockSaveFlag;
490 489
491#ifdef KAB_EMBEDDED 490#ifdef KAB_EMBEDDED
492 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 491 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
493#endif //KAB_EMBEDDED 492#endif //KAB_EMBEDDED
494 493
495 //this are the overwritten callbackmethods from the syncinterface 494 //this are the overwritten callbackmethods from the syncinterface
496 virtual bool sync(KSyncManager* manager, QString filename, int mode); 495 virtual bool sync(KSyncManager* manager, QString filename, int mode);
497 virtual bool syncExternal(KSyncManager* manager, QString resource); 496 virtual bool syncExternal(KSyncManager* manager, QString resource);
498 virtual void removeSyncInfo( QString syncProfile); 497 virtual void removeSyncInfo( QString syncProfile);
499 bool syncPhone(); 498 bool syncPhone();
500 void message( QString m ); 499 void message( QString m );
501 500
502 // LR ******************************* 501 // LR *******************************
503 // sync stuff! 502 // sync stuff!
504 QString sentSyncFile(); 503 QString sentSyncFile();
505 QPopupMenu *syncMenu; 504 QPopupMenu *syncMenu;
506 KSyncManager* syncManager; 505 KSyncManager* syncManager;
507 int mGlobalSyncMode; 506 int mGlobalSyncMode;
508 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 507 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
509 KABC::Addressee getLastSyncAddressee(); 508 KABC::Addressee getLastSyncAddressee();
510 QDateTime mLastAddressbookSync; 509 QDateTime mLastAddressbookSync;
511 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 510 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
512 // ********************* 511 // *********************
513 512
514}; 513};
515 514
516#endif 515#endif
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 33bef5a..59bddd9 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -96,630 +96,631 @@ void ViewManager::scrollDOWN()
96 if ( mActiveView ) 96 if ( mActiveView )
97 mActiveView->scrollDOWN(); 97 mActiveView->scrollDOWN();
98} 98}
99void ViewManager::restoreSettings() 99void ViewManager::restoreSettings()
100{ 100{
101 mViewNameList = KABPrefs::instance()->mViewNames; 101 mViewNameList = KABPrefs::instance()->mViewNames;
102 QString activeViewName = KABPrefs::instance()->mCurrentView; 102 QString activeViewName = KABPrefs::instance()->mCurrentView;
103 103
104 mActionSelectView->setItems( mViewNameList ); 104 mActionSelectView->setItems( mViewNameList );
105 105
106 // Filter 106 // Filter
107 mFilterList = Filter::restore( mCore->config(), "Filter" ); 107 mFilterList = Filter::restore( mCore->config(), "Filter" );
108 mActionSelectFilter->setItems( filterNames() ); 108 mActionSelectFilter->setItems( filterNames() );
109 mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); 109 mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter );
110 int cw = 150; 110 int cw = 150;
111 if (QApplication::desktop()->width() == 480 ) 111 if (QApplication::desktop()->width() == 480 )
112 cw = 0; 112 cw = 0;
113 mActionSelectFilter->setComboWidth( cw ); 113 mActionSelectFilter->setComboWidth( cw );
114 // Tell the views to reread their config, since they may have 114 // Tell the views to reread their config, since they may have
115 // been modified by global settings 115 // been modified by global settings
116 QString _oldgroup = mCore->config()->group(); 116 QString _oldgroup = mCore->config()->group();
117 117
118 QDictIterator<KAddressBookView> it( mViewDict ); 118 QDictIterator<KAddressBookView> it( mViewDict );
119 for ( it.toFirst(); it.current(); ++it ) { 119 for ( it.toFirst(); it.current(); ++it ) {
120 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 120 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
121 it.current()->readConfig( mCore->config() ); 121 it.current()->readConfig( mCore->config() );
122 } 122 }
123 setActiveView( activeViewName ); 123 setActiveView( activeViewName );
124 124
125 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 125 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
126} 126}
127 127
128void ViewManager::saveSettings() 128void ViewManager::saveSettings()
129{ 129{
130 QString _oldgroup = mCore->config()->group(); 130 QString _oldgroup = mCore->config()->group();
131 131
132 QDictIterator<KAddressBookView> it( mViewDict ); 132 QDictIterator<KAddressBookView> it( mViewDict );
133 for ( it.toFirst(); it.current(); ++it ) { 133 for ( it.toFirst(); it.current(); ++it ) {
134 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 134 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
135#ifdef DESKTOP_VERSION 135#ifdef DESKTOP_VERSION
136 (*it)->writeConfig( mCore->config() ); 136 (*it)->writeConfig( mCore->config() );
137#else 137#else
138 (*it).writeConfig( mCore->config() ); 138 (*it).writeConfig( mCore->config() );
139#endif 139#endif
140 } 140 }
141 141
142 Filter::save( mCore->config(), "Filter", mFilterList ); 142 Filter::save( mCore->config(), "Filter", mFilterList );
143 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); 143 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
144 144
145 // write the view name list 145 // write the view name list
146 KABPrefs::instance()->mViewNames = mViewNameList; 146 KABPrefs::instance()->mViewNames = mViewNameList;
147 KABPrefs::instance()->mCurrentView = mActiveView->caption(); 147 KABPrefs::instance()->mCurrentView = mActiveView->caption();
148 148
149} 149}
150 150
151QStringList ViewManager::selectedUids() const 151QStringList ViewManager::selectedUids() const
152{ 152{
153 if ( mActiveView ) 153 if ( mActiveView )
154 return mActiveView->selectedUids(); 154 return mActiveView->selectedUids();
155 else 155 else
156 return QStringList(); 156 return QStringList();
157} 157}
158 158
159QStringList ViewManager::selectedEmails() const 159QStringList ViewManager::selectedEmails() const
160{ 160{
161 if ( mActiveView ) 161 if ( mActiveView )
162 return mActiveView->selectedEmails(); 162 return mActiveView->selectedEmails();
163 else 163 else
164 return QStringList(); 164 return QStringList();
165} 165}
166 166
167KABC::Addressee::List ViewManager::selectedAddressees() const 167KABC::Addressee::List ViewManager::selectedAddressees() const
168{ 168{
169 KABC::Addressee::List list; 169 KABC::Addressee::List list;
170 if ( mActiveView ) { 170 if ( mActiveView ) {
171 QStringList uids = mActiveView->selectedUids(); 171 QStringList uids = mActiveView->selectedUids();
172 QStringList::Iterator it; 172 QStringList::Iterator it;
173 for ( it = uids.begin(); it != uids.end(); ++it ) { 173 for ( it = uids.begin(); it != uids.end(); ++it ) {
174 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 174 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
175 if ( !addr.isEmpty() ) 175 if ( !addr.isEmpty() )
176 list.append( addr ); 176 list.append( addr );
177 } 177 }
178 } 178 }
179 179
180 return list; 180 return list;
181} 181}
182//US added another method with no parameter, since my moc compiler does not support default parameters. 182//US added another method with no parameter, since my moc compiler does not support default parameters.
183void ViewManager::setSelected() 183void ViewManager::setSelected()
184{ 184{
185 setSelected( QString::null, true ); 185 setSelected( QString::null, true );
186} 186}
187 187
188void ViewManager::setSelected( const QString &uid, bool selected ) 188void ViewManager::setSelected( const QString &uid, bool selected )
189{ 189{
190 if ( mActiveView ) 190 if ( mActiveView )
191 mActiveView->setSelected( uid, selected ); 191 mActiveView->setSelected( uid, selected );
192} 192}
193 193
194void ViewManager::setListSelected(QStringList list) 194void ViewManager::setListSelected(QStringList list)
195{ 195{
196 int i, count = list.count(); 196 int i, count = list.count();
197 for ( i = 0; i < count;++i ) 197 for ( i = 0; i < count;++i )
198 setSelected( list[i], true ); 198 setSelected( list[i], true );
199 199
200} 200}
201void ViewManager::unloadViews() 201void ViewManager::unloadViews()
202{ 202{
203 mViewDict.clear(); 203 mViewDict.clear();
204 mActiveView = 0; 204 mActiveView = 0;
205} 205}
206 206
207void ViewManager::setActiveView( const QString &name ) 207void ViewManager::setActiveView( const QString &name )
208{ 208{
209 KAddressBookView *view = 0; 209 KAddressBookView *view = 0;
210 210
211 // Check that this isn't the same as the current active view 211 // Check that this isn't the same as the current active view
212 if ( mActiveView && ( mActiveView->caption() == name ) ) 212 if ( mActiveView && ( mActiveView->caption() == name ) )
213 return; 213 return;
214 214
215 // At this point we know the view that should be active is not 215 // At this point we know the view that should be active is not
216 // currently active. We will try to find the new on in the list. If 216 // currently active. We will try to find the new on in the list. If
217 // we can't find it, it means it hasn't been instantiated, so we will 217 // we can't find it, it means it hasn't been instantiated, so we will
218 // create it on demand. 218 // create it on demand.
219 219
220 view = mViewDict.find( name ); 220 view = mViewDict.find( name );
221 221
222 // Check if we found the view. If we didn't, then we need to create it 222 // Check if we found the view. If we didn't, then we need to create it
223 if ( view == 0 ) { 223 if ( view == 0 ) {
224 KConfig *config = mCore->config(); 224 KConfig *config = mCore->config();
225 225
226 KConfigGroupSaver saver( config, name ); 226 KConfigGroupSaver saver( config, name );
227 227
228 QString type = config->readEntry( "Type", "Table" ); 228 QString type = config->readEntry( "Type", "Table" );
229 229
230 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; 230 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;
231 231
232 ViewFactory *factory = mViewFactoryDict.find( type ); 232 ViewFactory *factory = mViewFactoryDict.find( type );
233 if ( factory ) 233 if ( factory )
234 view = factory->view( mCore->addressBook(), mViewWidgetStack ); 234 view = factory->view( mCore->addressBook(), mViewWidgetStack );
235 235
236 if ( view ) { 236 if ( view ) {
237 view->setCaption( name ); 237 view->setCaption( name );
238 mViewDict.insert( name, view ); 238 mViewDict.insert( name, view );
239//US my version needs an int as second parameter to addWidget 239//US my version needs an int as second parameter to addWidget
240 mViewWidgetStack->addWidget( view, -1 ); 240 mViewWidgetStack->addWidget( view, -1 );
241 view->readConfig( config ); 241 view->readConfig( config );
242 242
243 // The manager just relays the signals 243 // The manager just relays the signals
244 connect( view, SIGNAL( selected( const QString& ) ), 244 connect( view, SIGNAL( selected( const QString& ) ),
245 SIGNAL( selected( const QString & ) ) ); 245 SIGNAL( selected( const QString & ) ) );
246 connect( view, SIGNAL( executed( const QString& ) ), 246 connect( view, SIGNAL( executed( const QString& ) ),
247 SIGNAL( executed( const QString& ) ) ); 247 SIGNAL( executed( const QString& ) ) );
248 248
249 connect( view, SIGNAL( deleteRequest( ) ), 249 connect( view, SIGNAL( deleteRequest( ) ),
250 SIGNAL( deleteRequest( ) ) ); 250 SIGNAL( deleteRequest( ) ) );
251 251
252 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); 252 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) );
253 connect( view, SIGNAL( dropped( QDropEvent* ) ), 253 connect( view, SIGNAL( dropped( QDropEvent* ) ),
254 SLOT( dropped( QDropEvent* ) ) ); 254 SLOT( dropped( QDropEvent* ) ) );
255 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); 255 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) );
256 } 256 }
257 } 257 }
258 258
259 // If we found or created the view, raise it and refresh it 259 // If we found or created the view, raise it and refresh it
260 if ( view ) { 260 if ( view ) {
261 mActiveView = view; 261 mActiveView = view;
262 mViewWidgetStack->raiseWidget( view ); 262 mViewWidgetStack->raiseWidget( view );
263 // Set the proper filter in the view. By setting the combo 263 // Set the proper filter in the view. By setting the combo
264 // box, the activated slot will be called, which will push 264 // box, the activated slot will be called, which will push
265 // the filter to the view and refresh it. 265 // the filter to the view and refresh it.
266 266
267 if ( view->defaultFilterType() == KAddressBookView::None ) { 267 if ( view->defaultFilterType() == KAddressBookView::None ) {
268 268
269 mActionSelectFilter->setCurrentItem( 0 ); 269 mActionSelectFilter->setCurrentItem( 0 );
270 setActiveFilter( 0 ); 270 setActiveFilter( 0 );
271 } else if ( view->defaultFilterType() == KAddressBookView::Active ) { 271 } else if ( view->defaultFilterType() == KAddressBookView::Active ) {
272 setActiveFilter( mActionSelectFilter->currentItem() ); 272 setActiveFilter( mActionSelectFilter->currentItem() );
273 } else { 273 } else {
274 uint pos = filterPosition( view->defaultFilterName() ); 274 uint pos = filterPosition( view->defaultFilterName() );
275 mActionSelectFilter->setCurrentItem( pos ); 275 mActionSelectFilter->setCurrentItem( pos );
276 setActiveFilter( pos ); 276 setActiveFilter( pos );
277 } 277 }
278//US qDebug("ViewManager::setActiveView 6" ); 278//US qDebug("ViewManager::setActiveView 6" );
279 279
280 // Update the inc search widget to show the fields in the new active 280 // Update the inc search widget to show the fields in the new active
281 // view. 281 // view.
282 mCore->setSearchFields( mActiveView->fields() ); 282 mCore->setSearchFields( mActiveView->fields() );
283 283
284//US performance optimization. setActiveFilter calls also mActiveView->refresh() 284//US performance optimization. setActiveFilter calls also mActiveView->refresh()
285//US mActiveView->refresh(); 285//US mActiveView->refresh();
286 286
287 } 287 }
288 else 288 else
289 { 289 {
290 qDebug("ViewManager::setActiveView: unable to find view" ); 290 qDebug("ViewManager::setActiveView: unable to find view" );
291 kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; 291 kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n";
292 } 292 }
293} 293}
294 294
295//US added another method with no parameter, since my moc compiler does not support default parameters. 295//US added another method with no parameter, since my moc compiler does not support default parameters.
296void ViewManager::refreshView() 296void ViewManager::refreshView()
297{ 297{
298 refreshView( QString::null ); 298 refreshView( QString::null );
299} 299}
300 300
301void ViewManager::refreshView( const QString &uid ) 301void ViewManager::refreshView( const QString &uid )
302{ 302{
303 if ( mActiveView ) 303 if ( mActiveView )
304 mActiveView->refresh( uid ); 304 mActiveView->refresh( uid );
305} 305}
306 306
307void ViewManager::setFocusAV() 307void ViewManager::setFocusAV()
308{ 308{
309 if ( mActiveView ) 309 if ( mActiveView )
310 mActiveView->setFocusAV(); 310 mActiveView->setFocusAV();
311} 311}
312void ViewManager::editView() 312void ViewManager::editView()
313{ 313{
314 if ( !mActiveView ) 314 if ( !mActiveView )
315 return; 315 return;
316 316
317 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); 317 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() );
318 ViewConfigureWidget *wdg = 0; 318 ViewConfigureWidget *wdg = 0;
319 ViewConfigureDialog* dlg = 0; 319 ViewConfigureDialog* dlg = 0;
320 if ( factory ) { 320 if ( factory ) {
321 // Save the filters so the dialog has the latest set 321 // Save the filters so the dialog has the latest set
322 Filter::save( mCore->config(), "Filter", mFilterList ); 322 Filter::save( mCore->config(), "Filter", mFilterList );
323 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); 323 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" );
324 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); 324 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" );
325 } else { 325 } else {
326 qDebug("ViewManager::editView()::cannot find viewfactory "); 326 qDebug("ViewManager::editView()::cannot find viewfactory ");
327 return; 327 return;
328 } 328 }
329 if ( wdg ) { 329 if ( wdg ) {
330 dlg->setWidget( wdg ); 330 dlg->setWidget( wdg );
331 331
332#ifndef DESKTOP_VERSION 332#ifndef DESKTOP_VERSION
333 //dlg.setMaximumSize( 640, 480 ); 333 //dlg.setMaximumSize( 640, 480 );
334 //dlg->setGeometry( 40,40, 400, 300); 334 //dlg->setGeometry( 40,40, 400, 300);
335 dlg->showMaximized(); 335 dlg->showMaximized();
336#endif 336#endif
337 337
338 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); 338 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() );
339 339
340 dlg->restoreSettings( mCore->config() ); 340 dlg->restoreSettings( mCore->config() );
341 341
342 if ( dlg->exec() ) { 342 if ( dlg->exec() ) {
343 dlg->saveSettings( mCore->config() ); 343 dlg->saveSettings( mCore->config() );
344 mActiveView->readConfig( mCore->config() ); 344 mActiveView->readConfig( mCore->config() );
345 345
346 // Set the proper filter in the view. By setting the combo 346 // Set the proper filter in the view. By setting the combo
347 // box, the activated slot will be called, which will push 347 // box, the activated slot will be called, which will push
348 // the filter to the view and refresh it. 348 // the filter to the view and refresh it.
349 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { 349 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) {
350 mActionSelectFilter->setCurrentItem( 0 ); 350 mActionSelectFilter->setCurrentItem( 0 );
351 setActiveFilter( 0 ); 351 setActiveFilter( 0 );
352 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { 352 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) {
353 setActiveFilter( mActionSelectFilter->currentItem() ); 353 setActiveFilter( mActionSelectFilter->currentItem() );
354 } else { 354 } else {
355 uint pos = filterPosition( mActiveView->defaultFilterName() ); 355 uint pos = filterPosition( mActiveView->defaultFilterName() );
356 mActionSelectFilter->setCurrentItem( pos ); 356 mActionSelectFilter->setCurrentItem( pos );
357 setActiveFilter( pos ); 357 setActiveFilter( pos );
358 } 358 }
359 mCore->setSearchFields( mActiveView->fields() ); 359 mCore->setSearchFields( mActiveView->fields() );
360//US performance optimization. setActiveFilter calls also mActiveView->refresh() 360//US performance optimization. setActiveFilter calls also mActiveView->refresh()
361//US mActiveView->refresh(); 361//US mActiveView->refresh();
362 362
363 363
364 //US this is a bugfix, that we get notified if we change a views configuration 364 //US this is a bugfix, that we get notified if we change a views configuration
365 emit modified(); 365 emit modified();
366 366
367 } 367 }
368 368
369 } 369 }
370 delete dlg; 370 delete dlg;
371} 371}
372 372
373void ViewManager::deleteView() 373void ViewManager::deleteView()
374{ 374{
375 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) 375 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" )
376 .arg( mActiveView->caption() ); 376 .arg( mActiveView->caption() );
377 QString caption = i18n( "Confirm Delete" ); 377 QString caption = i18n( "Confirm Delete" );
378 378
379 379
380 if (QMessageBox::information( this, caption, 380 if (QMessageBox::information( this, caption,
381 text, 381 text,
382 i18n("Yes!"), i18n("No"), 0, 0 ) == 0) 382 i18n("Yes!"), i18n("No"), 0, 0 ) == 0)
383 { 383 {
384 mViewNameList.remove( mActiveView->caption() ); 384 mViewNameList.remove( mActiveView->caption() );
385 385
386 // remove the view from the config file 386 // remove the view from the config file
387 KConfig *config = mCore->config(); 387 KConfig *config = mCore->config();
388 config->deleteGroup( mActiveView->caption() ); 388 config->deleteGroup( mActiveView->caption() );
389 389
390 mViewDict.remove( mActiveView->caption() ); 390 mViewDict.remove( mActiveView->caption() );
391 mActiveView = 0; 391 mActiveView = 0;
392 392
393 // we are in an invalid state now, but that should be fixed after 393 // we are in an invalid state now, but that should be fixed after
394 // we emit the signal 394 // we emit the signal
395 mActionSelectView->setItems( mViewNameList ); 395 mActionSelectView->setItems( mViewNameList );
396 if ( mViewNameList.count() > 0 ) { 396 if ( mViewNameList.count() > 0 ) {
397 mActionSelectView->setCurrentItem( 0 ); 397 mActionSelectView->setCurrentItem( 0 );
398 setActiveView( mViewNameList[ 0 ] ); 398 setActiveView( mViewNameList[ 0 ] );
399 } 399 }
400 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 400 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
401 } 401 }
402} 402}
403 403
404void ViewManager::addView() 404void ViewManager::addView()
405{ 405{
406 AddViewDialog dialog( &mViewFactoryDict, this ); 406 AddViewDialog dialog( &mViewFactoryDict, this );
407 407
408 if ( dialog.exec() ) { 408 if ( dialog.exec() ) {
409 QString newName = dialog.viewName(); 409 QString newName = dialog.viewName();
410 QString type = dialog.viewType(); 410 QString type = dialog.viewType();
411 411
412 // Check for name conflicts 412 // Check for name conflicts
413 bool firstConflict = true; 413 bool firstConflict = true;
414 int numTries = 1; 414 int numTries = 1;
415 while ( mViewNameList.contains( newName ) > 0 ) { 415 while ( mViewNameList.contains( newName ) > 0 ) {
416 if ( !firstConflict ) { 416 if ( !firstConflict ) {
417 newName = newName.left( newName.length() - 4 ); 417 newName = newName.left( newName.length() - 4 );
418 firstConflict = false; 418 firstConflict = false;
419 } 419 }
420 420
421 newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries ); 421 newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries );
422 numTries++; 422 numTries++;
423 } 423 }
424 424
425 // Add the new one to the list 425 // Add the new one to the list
426 mViewNameList.append( newName ); 426 mViewNameList.append( newName );
427 427
428 // write the view to the config file, 428 // write the view to the config file,
429 KConfig *config = mCore->config(); 429 KConfig *config = mCore->config();
430 430
431 config->deleteGroup( newName ); 431 config->deleteGroup( newName );
432 432
433 KConfigGroupSaver saver( config, newName ); 433 KConfigGroupSaver saver( config, newName );
434 434
435 config->writeEntry( "Type", type ); 435 config->writeEntry( "Type", type );
436 436
437 // try to set the active view 437 // try to set the active view
438 mActionSelectView->setItems( mViewNameList ); 438 mActionSelectView->setItems( mViewNameList );
439 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) ); 439 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) );
440 setActiveView( newName ); 440 setActiveView( newName );
441 441
442 editView(); 442 editView();
443 443
444 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 444 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
445 } 445 }
446} 446}
447 447
448void ViewManager::createViewFactories() 448void ViewManager::createViewFactories()
449{ 449{
450#ifndef KAB_EMBEDDED 450#ifndef KAB_EMBEDDED
451 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" ); 451 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" );
452 KTrader::OfferList::ConstIterator it; 452 KTrader::OfferList::ConstIterator it;
453 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 453 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
454 if ( !(*it)->hasServiceType( "KAddressBook/View" ) ) 454 if ( !(*it)->hasServiceType( "KAddressBook/View" ) )
455 continue; 455 continue;
456 456
457 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); 457 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
458 458
459 if ( !factory ) { 459 if ( !factory ) {
460 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl; 460 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl;
461 continue; 461 continue;
462 } 462 }
463 463
464 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory ); 464 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory );
465 465
466 if ( !viewFactory ) { 466 if ( !viewFactory ) {
467 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl; 467 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl;
468 continue; 468 continue;
469 } 469 }
470 470
471 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 471 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
472 } 472 }
473 473
474#else //KAB_EMBEDDED 474#else //KAB_EMBEDDED
475 ViewFactory* viewFactory = new IconViewFactory(); 475 ViewFactory* viewFactory = new IconViewFactory();
476 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 476 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
477// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 477// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
478 478
479 viewFactory = new TableViewFactory(); 479 viewFactory = new TableViewFactory();
480 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 480 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
481// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 481// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
482 482
483 viewFactory = new CardViewFactory(); 483 viewFactory = new CardViewFactory();
484 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 484 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
485// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 485// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
486 486
487#endif //KAB_EMBEDDED 487#endif //KAB_EMBEDDED
488 488
489} 489}
490 490
491void ViewManager::dropped( QDropEvent *e ) 491void ViewManager::dropped( QDropEvent *e )
492{ 492{
493 kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl; 493 kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl;
494 494
495#ifndef KAB_EMBEDDED 495#ifndef KAB_EMBEDDED
496 496
497 QString clipText, vcards; 497 QString clipText, vcards;
498 KURL::List urls; 498 KURL::List urls;
499 499
500 if ( KURLDrag::decode( e, urls) ) { 500 if ( KURLDrag::decode( e, urls) ) {
501 KURL::List::Iterator it = urls.begin(); 501 KURL::List::Iterator it = urls.begin();
502 int c = urls.count(); 502 int c = urls.count();
503 if ( c > 1 ) { 503 if ( c > 1 ) {
504 QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); 504 QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c );
505 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { 505 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) {
506 for ( ; it != urls.end(); ++it ) 506 for ( ; it != urls.end(); ++it )
507 emit urlDropped( *it ); 507 emit urlDropped( *it );
508 } 508 }
509 } else if ( c == 1 ) 509 } else if ( c == 1 )
510 emit urlDropped( *it ); 510 emit urlDropped( *it );
511 } else if ( KVCardDrag::decode( e, vcards ) ) { 511 } else if ( KVCardDrag::decode( e, vcards ) ) {
512 KABC::Addressee addr; 512 KABC::Addressee addr;
513 KABC::VCardConverter converter; 513 KABC::VCardConverter converter;
514 QStringList list = QStringList::split( "\r\n\r\n", vcards ); 514 QStringList list = QStringList::split( "\r\n\r\n", vcards );
515 QStringList::Iterator it; 515 QStringList::Iterator it;
516 for ( it = list.begin(); it != list.end(); ++it ) { 516 for ( it = list.begin(); it != list.end(); ++it ) {
517 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { 517 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) {
518 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); 518 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() );
519 if ( a.isEmpty() ) { 519 if ( a.isEmpty() ) {
520 mCore->addressBook()->insertAddressee( addr ); 520 mCore->addressBook()->insertAddressee( addr );
521 emit modified(); 521 emit modified();
522 } 522 }
523 } 523 }
524 } 524 }
525 525
526 mActiveView->refresh(); 526 mActiveView->refresh();
527 } 527 }
528#else //KAB_EMBEDDED 528#else //KAB_EMBEDDED
529qDebug("ViewManager::dropped() has to be changed!!" ); 529qDebug("ViewManager::dropped() has to be changed!!" );
530#endif //KAB_EMBEDDED 530#endif //KAB_EMBEDDED
531 531
532} 532}
533 533
534void ViewManager::startDrag() 534void ViewManager::startDrag()
535{ 535{
536 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; 536 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
537 537
538#ifndef KAB_EMBEDDED 538#ifndef KAB_EMBEDDED
539 539
540 // Get the list of all the selected addressees 540 // Get the list of all the selected addressees
541 KABC::Addressee::List addrList; 541 KABC::Addressee::List addrList;
542 QStringList uidList = selectedUids(); 542 QStringList uidList = selectedUids();
543 QStringList::Iterator iter; 543 QStringList::Iterator iter;
544 for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) 544 for ( iter = uidList.begin(); iter != uidList.end(); ++iter )
545 addrList.append( mCore->addressBook()->findByUid( *iter ) ); 545 addrList.append( mCore->addressBook()->findByUid( *iter ) );
546 546
547 KMultipleDrag *drag = new KMultipleDrag( this ); 547 KMultipleDrag *drag = new KMultipleDrag( this );
548 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); 548 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
549 KABC::Addressee::List::Iterator it; 549 KABC::Addressee::List::Iterator it;
550 QStringList vcards; 550 QStringList vcards;
551 for ( it = addrList.begin(); it != addrList.end(); ++it ) { 551 for ( it = addrList.begin(); it != addrList.end(); ++it ) {
552 QString vcard = QString::null; 552 QString vcard = QString::null;
553 KABC::VCardConverter converter; 553 KABC::VCardConverter converter;
554 if ( converter.addresseeToVCard( *it, vcard ) ) 554 if ( converter.addresseeToVCard( *it, vcard ) )
555 vcards.append( vcard ); 555 vcards.append( vcard );
556 } 556 }
557 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); 557 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
558 558
559 drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); 559 drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
560 drag->dragCopy(); 560 drag->dragCopy();
561 561
562#else //KAB_EMBEDDED 562#else //KAB_EMBEDDED
563qDebug("ViewManager::startDrag() has to be changed!!" ); 563qDebug("ViewManager::startDrag() has to be changed!!" );
564#endif //KAB_EMBEDDED 564#endif //KAB_EMBEDDED
565 565
566} 566}
567void ViewManager::doSearch( const QString& s,KABC::Field *field ) 567void ViewManager::doSearch( const QString& s,KABC::Field *field )
568{ 568{
569 if ( mActiveView ) 569 if ( mActiveView )
570 mActiveView->doSearch( s, field ); 570 mActiveView->doSearch( s, field );
571 571
572} 572}
573void ViewManager::setActiveFilter( int index ) 573void ViewManager::setActiveFilter( int index )
574{ 574{
575 Filter currentFilter; 575 Filter currentFilter;
576 576
577 if ( ( index - 1 ) < 0 ) 577 if ( ( index - 1 ) < 0 )
578 currentFilter = Filter(); 578 currentFilter = Filter();
579 else 579 else
580 currentFilter = mFilterList[ index - 1 ]; 580 currentFilter = mFilterList[ index - 1 ];
581 581
582 // Check if we have a view. Since the filter combo is created before 582 // Check if we have a view. Since the filter combo is created before
583 // the view, this slot could be called before there is a valid view. 583 // the view, this slot could be called before there is a valid view.
584 if ( mActiveView ) { 584 if ( mActiveView ) {
585 mActiveView->setFilter( currentFilter ); 585 mActiveView->setFilter( currentFilter );
586 mActiveView->refresh(); 586 mActiveView->refresh();
587 emit selected( QString::null ); 587 emit selected( QString::null );
588 } 588 }
589} 589}
590 590
591void ViewManager::configureFilters() 591void ViewManager::configureFilters()
592{ 592{
593 FilterDialog dlg( this ); 593 FilterDialog dlg( this );
594 594
595 dlg.setFilters( mFilterList ); 595 dlg.setFilters( mFilterList );
596 596
597 if ( dlg.exec() ) 597 if ( dlg.exec() )
598 mFilterList = dlg.filters(); 598 mFilterList = dlg.filters();
599 599
600 uint pos = mActionSelectFilter->currentItem(); 600 uint pos = mActionSelectFilter->currentItem();
601 mActionSelectFilter->setItems( filterNames() ); 601 mActionSelectFilter->setItems( filterNames() );
602 mActionSelectFilter->setCurrentItem( pos ); 602 mActionSelectFilter->setCurrentItem( pos );
603 setActiveFilter( pos ); 603 setActiveFilter( pos );
604 int cw = 150; 604 int cw = 150;
605 if (QApplication::desktop()->width() == 480 ) 605 if (QApplication::desktop()->width() == 480 )
606 cw = 0; 606 cw = 0;
607 mActionSelectFilter->setComboWidth( cw ); 607 mActionSelectFilter->setComboWidth( cw );
608 saveSettings();
608} 609}
609 610
610QStringList ViewManager::filterNames() const 611QStringList ViewManager::filterNames() const
611{ 612{
612 QStringList names( i18n( "No Filter" ) ); 613 QStringList names( i18n( "No Filter" ) );
613 614
614 Filter::List::ConstIterator it; 615 Filter::List::ConstIterator it;
615 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 616 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
616 names.append( (*it).name() ); 617 names.append( (*it).name() );
617 618
618 return names; 619 return names;
619} 620}
620 621
621int ViewManager::filterPosition( const QString &name ) const 622int ViewManager::filterPosition( const QString &name ) const
622{ 623{
623 int pos = 0; 624 int pos = 0;
624 625
625 Filter::List::ConstIterator it; 626 Filter::List::ConstIterator it;
626 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) 627 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
627 if ( name == (*it).name() ) 628 if ( name == (*it).name() )
628 return pos + 1; 629 return pos + 1;
629 630
630 return 0; 631 return 0;
631} 632}
632 633
633void ViewManager::initActions() 634void ViewManager::initActions()
634{ 635{
635//US <ActionList name="view_loadedviews"/> 636//US <ActionList name="view_loadedviews"/>
636//US <Separator/> 637//US <Separator/>
637 638
638#ifdef KAB_EMBEDDED 639#ifdef KAB_EMBEDDED
639 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); 640 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
640 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); 641 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
641 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); 642 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
642#endif //KAB_EMBEDDED 643#endif //KAB_EMBEDDED
643 644
644 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); 645 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
645#if KDE_VERSION >= 309 646#if KDE_VERSION >= 309
646 mActionSelectView->setMenuAccelsEnabled( false ); 647 mActionSelectView->setMenuAccelsEnabled( false );
647#endif 648#endif
648 connect( mActionSelectView, SIGNAL( activated( const QString& ) ), 649 connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
649 SLOT( setActiveView( const QString& ) ) ); 650 SLOT( setActiveView( const QString& ) ) );
650 651
651 652
652#ifdef KAB_EMBEDDED 653#ifdef KAB_EMBEDDED
653 mActionSelectView->plug(viewmenu); 654 mActionSelectView->plug(viewmenu);
654 viewmenu->insertSeparator(); 655 viewmenu->insertSeparator();
655#endif //KAB_EMBEDDED 656#endif //KAB_EMBEDDED
656 657
657 KAction *action; 658 KAction *action;
658 659
659 action = new KAction( i18n( "Modify View..." ), "configure", 0, this, 660 action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
660 SLOT( editView() ), mCore->actionCollection(), "view_modify" ); 661 SLOT( editView() ), mCore->actionCollection(), "view_modify" );
661#ifndef KAB_EMBEDDED 662#ifndef KAB_EMBEDDED
662 action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); 663 action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) );
663#else //KAB_EMBEDDED 664#else //KAB_EMBEDDED
664 action->plug(viewmenu); 665 action->plug(viewmenu);
665#endif //KAB_EMBEDDED 666#endif //KAB_EMBEDDED
666 667
667 action = new KAction( i18n( "Add View..." ), "window_new", 0, this, 668 action = new KAction( i18n( "Add View..." ), "window_new", 0, this,
668 SLOT( addView() ), mCore->actionCollection(), "view_add" ); 669 SLOT( addView() ), mCore->actionCollection(), "view_add" );
669#ifndef KAB_EMBEDDED 670#ifndef KAB_EMBEDDED
670 action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); 671 action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) );
671#else //KAB_EMBEDDED 672#else //KAB_EMBEDDED
672 action->plug(viewmenu); 673 action->plug(viewmenu);
673#endif //KAB_EMBEDDED 674#endif //KAB_EMBEDDED
674 675
675 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, 676 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0,
676 this, SLOT( deleteView() ), 677 this, SLOT( deleteView() ),
677 mCore->actionCollection(), "view_delete" ); 678 mCore->actionCollection(), "view_delete" );
678#ifndef KAB_EMBEDDED 679#ifndef KAB_EMBEDDED
679 mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); 680 mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) );
680#else //KAB_EMBEDDED 681#else //KAB_EMBEDDED
681 mActionDeleteView->plug(viewmenu); 682 mActionDeleteView->plug(viewmenu);
682 viewmenu->insertSeparator(); 683 viewmenu->insertSeparator();
683#endif //KAB_EMBEDDED 684#endif //KAB_EMBEDDED
684 685
685#ifndef KAB_EMBEDDED 686#ifndef KAB_EMBEDDED
686 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 687 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
687 SLOT( refreshView(const QString &) ), mCore->actionCollection(), 688 SLOT( refreshView(const QString &) ), mCore->actionCollection(),
688 "view_refresh" ); 689 "view_refresh" );
689 action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); 690 action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) );
690#else //KAB_EMBEDDED 691#else //KAB_EMBEDDED
691 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 692 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
692 SLOT( refreshView()), mCore->actionCollection(), 693 SLOT( refreshView()), mCore->actionCollection(),
693 "view_refresh" ); 694 "view_refresh" );
694 action->plug(viewmenu); 695 action->plug(viewmenu);
695 viewmenu->insertSeparator(); 696 viewmenu->insertSeparator();
696#endif //KAB_EMBEDDED 697#endif //KAB_EMBEDDED
697 698
698 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, 699 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
699 SLOT( configureFilters() ), mCore->actionCollection(), 700 SLOT( configureFilters() ), mCore->actionCollection(),
700 "options_edit_filters" ); 701 "options_edit_filters" );
701 702
702 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); 703 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" );
703#if KDE_VERSION >= 309 704#if KDE_VERSION >= 309
704 mActionSelectFilter->setMenuAccelsEnabled( false ); 705 mActionSelectFilter->setMenuAccelsEnabled( false );
705#endif 706#endif
706 connect( mActionSelectFilter, SIGNAL( activated( int ) ), 707 connect( mActionSelectFilter, SIGNAL( activated( int ) ),
707 SLOT( setActiveFilter( int ) ) ); 708 SLOT( setActiveFilter( int ) ) );
708 709
709#ifdef KAB_EMBEDDED 710#ifdef KAB_EMBEDDED
710 action->plug(settingsmenu); 711 action->plug(settingsmenu);
711 mActionSelectFilter->plug(viewmenu); 712 mActionSelectFilter->plug(viewmenu);
712#endif //KAB_EMBEDDED 713#endif //KAB_EMBEDDED
713 714
714} 715}
715 716
716void ViewManager::initGUI() 717void ViewManager::initGUI()
717{ 718{
718 QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); 719 QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 );
719 mViewWidgetStack = new QWidgetStack( this ); 720 mViewWidgetStack = new QWidgetStack( this );
720 layout->addWidget( mViewWidgetStack ); 721 layout->addWidget( mViewWidgetStack );
721} 722}
722 723
723#ifndef KAB_EMBEDDED 724#ifndef KAB_EMBEDDED
724#include "viewmanager.moc" 725#include "viewmanager.moc"
725#endif //KAB_EMBEDDED 726#endif //KAB_EMBEDDED
diff --git a/kde2file/abdump/main.cpp b/kde2file/abdump/main.cpp
index 1ee64f5..9ad78e5 100644
--- a/kde2file/abdump/main.cpp
+++ b/kde2file/abdump/main.cpp
@@ -1,195 +1,193 @@
1/******************************************************************************* 1/*******************************************************************************
2 * main.cpp * 2 * main.cpp *
3 * * 3 * *
4 * 4 *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 * * 10 * *
11 * This program is distributed in the hope that it will be useful, * 11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. * 14 * GNU General Public License for more details. *
15 * * 15 * *
16 * You should have received a copy of the GNU General Public License * 16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software * 17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 * * 19 * *
20 * As a special exception, permission is given to link this program * 20 * As a special exception, permission is given to link this program *
21 * with any edition of Qt, and distribute the resulting executable, * 21 * with any edition of Qt, and distribute the resulting executable, *
22 * without including the source code for Qt in the source distribution. * 22 * without including the source code for Qt in the source distribution. *
23 * * 23 * *
24 ******************************************************************************/ 24 ******************************************************************************/
25 25
26#include <kcmdlineargs.h> 26#include <kcmdlineargs.h>
27#include <kaboutdata.h> 27#include <kaboutdata.h>
28#include <klocale.h> 28#include <klocale.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#include <kconfig.h> 30#include <kconfig.h>
31#include <kstandarddirs.h> 31#include <kstandarddirs.h>
32#include <kdebug.h> 32#include <kdebug.h>
33 33
34#include <kabc/addressbook.h> 34#include <kabc/addressbook.h>
35#include <kabc/stdaddressbook.h> 35#include <kabc/stdaddressbook.h>
36#include <kabc/resource.h> 36#include <kabc/resource.h>
37#include <kabc/vcardconverter.h> 37#include <kabc/vcardconverter.h>
38 38
39#include <qdatetime.h> 39#include <qdatetime.h>
40#include <qfile.h> 40#include <qfile.h>
41#include <qdir.h> 41#include <qdir.h>
42#include <qapplication.h> 42#include <qapplication.h>
43 43
44#include <stdlib.h> 44#include <stdlib.h>
45#include <iostream> 45#include <iostream>
46 46
47using namespace std; 47using namespace std;
48 48
49static const char progName[] = "kdecalendar"; 49static const char progName[] = "kdecalendar";
50static const char progDisplay[] = "KDE_Addressbook"; 50static const char progDisplay[] = "KDE_Addressbook";
51static const char progVersion[] = "33.1/3"; 51static const char progVersion[] = "33.1/3";
52static const char progDesc[] = "A command line interface to KDE addressbooks"; 52static const char progDesc[] = "A command line interface to KDE addressbooks";
53 53
54 54
55static KCmdLineOptions options[] = 55static KCmdLineOptions options[] =
56 { 56 {
57 { "dump", 57 { "dump",
58 I18N_NOOP( "Dumps addressbook" ), 0 }, 58 I18N_NOOP( "Dumps addressbook" ), 0 },
59 { "read", 59 { "read",
60 I18N_NOOP( "Reads addressbook" ), 0 }, 60 I18N_NOOP( "Reads addressbook" ), 0 },
61 KCmdLineLastOption 61 KCmdLineLastOption
62 }; 62 };
63 63
64int main( int argc, char *argv[] ) 64int main( int argc, char *argv[] )
65{ 65{
66 KAboutData aboutData( 66 KAboutData aboutData(
67 progName, // internal program name 67 progName, // internal program name
68 I18N_NOOP( progDisplay ), // displayable program name. 68 I18N_NOOP( progDisplay ), // displayable program name.
69 progVersion, // version string 69 progVersion, // version string
70 I18N_NOOP( progDesc ), // short porgram description 70 I18N_NOOP( progDesc ), // short porgram description
71 KAboutData::License_GPL, // license type 71 KAboutData::License_GPL, // license type
72 "(c) 2004, Lutz Rogowski", // copyright statement 72 "(c) 2004, Lutz Rogowski", // copyright statement
73 0, // any free form text 73 0, // any free form text
74 "", // program home page address 74 "", // program home page address
75 "bugs.kde.org" // bug report email address 75 "bugs.kde.org" // bug report email address
76 ); 76 );
77 77
78 78
79 // KCmdLineArgs::init() final 'true' argument indicates no commandline options 79 // KCmdLineArgs::init() final 'true' argument indicates no commandline options
80 // for QApplication/KApplication (no KDE or Qt options) 80 // for QApplication/KApplication (no KDE or Qt options)
81 KCmdLineArgs::init( argc, argv, &aboutData, true ); 81 KCmdLineArgs::init( argc, argv, &aboutData, true );
82 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. 82 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
83 83
84 KInstance ins ( progName ); 84 KInstance ins ( progName );
85 85
86 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 86 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
87 87
88 bool read = false; 88 bool read = false;
89 if ( args->isSet( "read" ) ) { 89 if ( args->isSet( "read" ) ) {
90 read = true; 90 read = true;
91 qDebug("read "); 91 qDebug("read ");
92 } 92 }
93 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; 93 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf";
94 94
95 KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self(); 95 KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self();
96 standardAddressBook->setAutomaticSave( false ); 96 standardAddressBook->setAutomaticSave( false );
97 qDebug("************************************* "); 97 qDebug("************************************* ");
98 qDebug("***************kdeABdump************* "); 98 qDebug("***************kdeABdump************* ");
99 qDebug("************************************* "); 99 qDebug("************************************* ");
100 if ( !read ) { 100 if ( !read ) {
101 KABC::AddressBook::Iterator it; 101 KABC::AddressBook::Iterator it;
102 KABC::VCardConverter converter; 102 KABC::VCardConverter converter;
103 QString datastream; 103 QString datastream;
104 for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) { 104 for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) {
105 if ( (*it).isEmpty() || ! (*it).resource() ) 105 if ( (*it).isEmpty() || ! (*it).resource() )
106 continue; 106 continue;
107 if ( (*it).resource()->readOnly() )
108 continue;
109 KABC::Addressee a = ( *it ); 107 KABC::Addressee a = ( *it );
110 QString vcard = converter.createVCard( a ); 108 QString vcard = converter.createVCard( a );
111 vcard += QString("\r\n"); 109 vcard += QString("\r\n");
112 datastream += vcard; 110 datastream += vcard;
113 } 111 }
114 QFile outFile(fileName); 112 QFile outFile(fileName);
115 if ( outFile.open(IO_WriteOnly) ) { 113 if ( outFile.open(IO_WriteOnly) ) {
116 QTextStream t( &outFile ); // use a text stream 114 QTextStream t( &outFile ); // use a text stream
117 t.setEncoding( QTextStream::UnicodeUTF8 ); 115 t.setEncoding( QTextStream::UnicodeUTF8 );
118 t <<datastream; 116 t <<datastream;
119 t << "\r\n\r\n"; 117 t << "\r\n\r\n";
120 outFile.close(); 118 outFile.close();
121 } 119 }
122 } else { 120 } else {
123 //Addressee::List aList;//parseVCards( const QString& vcard ); 121 //Addressee::List aList;//parseVCards( const QString& vcard );
124 KABC::Addressee::List list; 122 KABC::Addressee::List list;
125 int added = 0, changedC = 0, deleted = 0; 123 int added = 0, changedC = 0, deleted = 0;
126 QFile file( fileName ); 124 QFile file( fileName );
127 if ( file.open( IO_ReadOnly ) ) { 125 if ( file.open( IO_ReadOnly ) ) {
128 QTextStream t( &file ); // use a text stream 126 QTextStream t( &file ); // use a text stream
129 t.setEncoding( QTextStream::UnicodeUTF8 ); 127 t.setEncoding( QTextStream::UnicodeUTF8 );
130 QString data; 128 QString data;
131 data = t.read(); 129 data = t.read();
132 file.close(); 130 file.close();
133 KABC::VCardConverter converter; 131 KABC::VCardConverter converter;
134 list = converter.parseVCards( data ); 132 list = converter.parseVCards( data );
135 qDebug("kdeABdump::file has %d entries", list.count()); 133 qDebug("kdeABdump::file has %d entries", list.count());
136 134
137 KABC::Addressee::List::Iterator it; 135 KABC::Addressee::List::Iterator it;
138 for ( it = list.begin();it != list.end();++it) { 136 for ( it = list.begin();it != list.end();++it) {
139 (*it).setChanged( true ); 137 (*it).setChanged( true );
140 bool changed = ((*it).custom( "KADDRESSBOOK", "X-ExternalID" ) == "changed"); 138 bool changed = ((*it).custom( "KADDRESSBOOK", "X-ExternalID" ) == "changed");
141 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); 139 (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
142 //qDebug("ext %s ", (*it).custom( "KADDRESSBOOK", "X-ExternalID" ).latin1()); 140 //qDebug("ext %s ", (*it).custom( "KADDRESSBOOK", "X-ExternalID" ).latin1());
143 if ( changed ) { 141 if ( changed ) {
144 //qDebug("changed Addressee found! "); 142 //qDebug("changed Addressee found! ");
145 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); 143 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() );
146 if ( ! std.isEmpty() ) 144 if ( ! std.isEmpty() )
147 (*it).setResource(std.resource()); 145 (*it).setResource(std.resource());
148 standardAddressBook->insertAddressee( (*it) ); 146 standardAddressBook->insertAddressee( (*it) );
149 ++changedC; 147 ++changedC;
150 } else { 148 } else {
151 //maybe added? 149 //maybe added?
152 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); 150 KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() );
153 if ( std.isEmpty() ) { 151 if ( std.isEmpty() ) {
154 standardAddressBook->insertAddressee( (*it) ); 152 standardAddressBook->insertAddressee( (*it) );
155 ++added; 153 ++added;
156 } 154 }
157 } 155 }
158 } 156 }
159 KABC::AddressBook::Iterator itA = standardAddressBook->begin(); 157 KABC::AddressBook::Iterator itA = standardAddressBook->begin();
160 KABC::AddressBook::Iterator it2 ; 158 KABC::AddressBook::Iterator it2 ;
161 while ( itA != standardAddressBook->end() ) { 159 while ( itA != standardAddressBook->end() ) {
162 bool found = false; 160 bool found = false;
163 KABC::Addressee::List::Iterator itL; 161 KABC::Addressee::List::Iterator itL;
164 for ( itL = list.begin();itL != list.end();++itL) { 162 for ( itL = list.begin();itL != list.end();++itL) {
165 if ( (*itL).uid() == (*itA).uid() ) { 163 if ( (*itL).uid() == (*itA).uid() ) {
166 found = true; 164 found = true;
167 break; 165 break;
168 } 166 }
169 } 167 }
170 if ( !found ) { 168 if ( !found ) {
171 it2 = itA; 169 it2 = itA;
172 ++itA; 170 ++itA;
173 standardAddressBook->removeAddressee( it2 ); 171 standardAddressBook->removeAddressee( it2 );
174 ++deleted; 172 ++deleted;
175 } else { 173 } else {
176 ++itA; 174 ++itA;
177 } 175 }
178 } 176 }
179 177
180 //standardAddressBook->saveAll(); 178 //standardAddressBook->saveAll();
181 standardAddressBook->setAutomaticSave( true ); 179 standardAddressBook->setAutomaticSave( true );
182 qDebug("************************************* "); 180 qDebug("************************************* ");
183 qDebug("*************kdeABdump*************** "); 181 qDebug("*************kdeABdump*************** ");
184 qDebug("************************************* "); 182 qDebug("************************************* ");
185 qDebug("Addressbook entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", changedC,deleted, added, fileName.latin1()); 183 qDebug("Addressbook entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", changedC,deleted, added, fileName.latin1());
186 } else 184 } else
187 qDebug("error open file "); 185 qDebug("error open file ");
188 } 186 }
189 187
190 delete standardAddressBook; 188 delete standardAddressBook;
191 //KABC::StdAddressBook::close(); 189 //KABC::StdAddressBook::close();
192 //StdAddressBook::mSelf = 0; 190 //StdAddressBook::mSelf = 0;
193 qDebug("ente "); 191 qDebug("ente ");
194 return 0; 192 return 0;
195} 193}
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp
index be1735b..08ccafb 100644
--- a/kde2file/caldump/main.cpp
+++ b/kde2file/caldump/main.cpp
@@ -1,253 +1,253 @@
1/******************************************************************************* 1/*******************************************************************************
2 * main.cpp * 2 * main.cpp *
3 * * 3 * *
4 * 4 *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 * * 10 * *
11 * This program is distributed in the hope that it will be useful, * 11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. * 14 * GNU General Public License for more details. *
15 * * 15 * *
16 * You should have received a copy of the GNU General Public License * 16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software * 17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 * * 19 * *
20 * As a special exception, permission is given to link this program * 20 * As a special exception, permission is given to link this program *
21 * with any edition of Qt, and distribute the resulting executable, * 21 * with any edition of Qt, and distribute the resulting executable, *
22 * without including the source code for Qt in the source distribution. * 22 * without including the source code for Qt in the source distribution. *
23 * * 23 * *
24 ******************************************************************************/ 24 ******************************************************************************/
25 25
26#ifdef HAVE_CONFIG_H 26#ifdef HAVE_CONFIG_H
27#include "config.h" 27#include "config.h"
28#endif 28#endif
29 29
30#if TIME_WITH_SYS_TIME 30#if TIME_WITH_SYS_TIME
31# include <sys/time.h> 31# include <sys/time.h>
32# include <time.h> 32# include <time.h>
33#else 33#else
34# if HAVE_SYS_TIME_H 34# if HAVE_SYS_TIME_H
35# include <sys/time.h> 35# include <sys/time.h>
36# else 36# else
37# include <time.h> 37# include <time.h>
38# endif 38# endif
39#endif 39#endif
40 40
41#include <kcmdlineargs.h> 41#include <kcmdlineargs.h>
42#include <kaboutdata.h> 42#include <kaboutdata.h>
43#include <klocale.h> 43#include <klocale.h>
44#include <kglobal.h> 44#include <kglobal.h>
45#include <kconfig.h> 45#include <kconfig.h>
46#include <kstandarddirs.h> 46#include <kstandarddirs.h>
47#include <kdebug.h> 47#include <kdebug.h>
48 48
49#include <libkcal/calformat.h> 49#include <libkcal/calformat.h>
50#include <libkcal/calendarresources.h> 50#include <libkcal/calendarresources.h>
51#include <libkcal/resourcelocal.h> 51#include <libkcal/resourcelocal.h>
52#include <libkcal/filestorage.h> 52#include <libkcal/filestorage.h>
53#include <libkcal/icalformat.h> 53#include <libkcal/icalformat.h>
54 54
55#include <qdatetime.h> 55#include <qdatetime.h>
56#include <qfile.h> 56#include <qfile.h>
57#include <qdir.h> 57#include <qdir.h>
58#include <qapplication.h> 58#include <qapplication.h>
59 59
60#include <stdlib.h> 60#include <stdlib.h>
61#include <iostream> 61#include <iostream>
62 62
63using namespace KCal; 63using namespace KCal;
64using namespace std; 64using namespace std;
65 65
66static const char progName[] = "kdecalendar"; 66static const char progName[] = "kdecalendar";
67static const char progDisplay[] = "KDE_Calendar"; 67static const char progDisplay[] = "KDE_Calendar";
68static const char progVersion[] = "33.1/3"; 68static const char progVersion[] = "33.1/3";
69static const char progDesc[] = "A command line interface to KDE calendars"; 69static const char progDesc[] = "A command line interface to KDE calendars";
70 70
71 71
72static KCmdLineOptions options[] = 72static KCmdLineOptions options[] =
73 { 73 {
74 { "dump", 74 { "dump",
75 I18N_NOOP( "Dumps calendar" ), 0 }, 75 I18N_NOOP( "Dumps calendar" ), 0 },
76 { "read", 76 { "read",
77 I18N_NOOP( "Reads calendar" ), 0 }, 77 I18N_NOOP( "Reads calendar" ), 0 },
78 KCmdLineLastOption 78 KCmdLineLastOption
79 }; 79 };
80 80
81int main( int argc, char *argv[] ) 81int main( int argc, char *argv[] )
82{ 82{
83 KAboutData aboutData( 83 KAboutData aboutData(
84 progName, // internal program name 84 progName, // internal program name
85 I18N_NOOP( progDisplay ), // displayable program name. 85 I18N_NOOP( progDisplay ), // displayable program name.
86 progVersion, // version string 86 progVersion, // version string
87 I18N_NOOP( progDesc ), // short porgram description 87 I18N_NOOP( progDesc ), // short porgram description
88 KAboutData::License_GPL, // license type 88 KAboutData::License_GPL, // license type
89 "(c) 2004, Lutz Rogowski", // copyright statement 89 "(c) 2004, Lutz Rogowski", // copyright statement
90 0, // any free form text 90 0, // any free form text
91 "", // program home page address 91 "", // program home page address
92 "bugs.kde.org" // bug report email address 92 "bugs.kde.org" // bug report email address
93 ); 93 );
94 94
95 95
96 // KCmdLineArgs::init() final 'true' argument indicates no commandline options 96 // KCmdLineArgs::init() final 'true' argument indicates no commandline options
97 // for QApplication/KApplication (no KDE or Qt options) 97 // for QApplication/KApplication (no KDE or Qt options)
98 KCmdLineArgs::init( argc, argv, &aboutData, true ); 98 KCmdLineArgs::init( argc, argv, &aboutData, true );
99 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. 99 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
100 100
101 KInstance ins ( progName ); 101 KInstance ins ( progName );
102 102
103 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 103 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
104 104
105 bool read = false; 105 bool read = false;
106 if ( args->isSet( "read" ) ) { 106 if ( args->isSet( "read" ) ) {
107 read = true; 107 read = true;
108 qDebug("read "); 108 qDebug("read ");
109 } 109 }
110 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; 110 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
111 CalendarResources *calendarResource = 0; 111 CalendarResources *calendarResource = 0;
112 CalendarLocal *localCalendar = 0; 112 CalendarLocal *localCalendar = 0;
113 KConfig c( locate( "config", "korganizerrc" ) ); 113 KConfig c( locate( "config", "korganizerrc" ) );
114 c.setGroup( "Time & Date" ); 114 c.setGroup( "Time & Date" );
115 QString tz = c.readEntry( "TimeZoneId" ); 115 QString tz = c.readEntry( "TimeZoneId" );
116 calendarResource = new CalendarResources( tz ); 116 calendarResource = new CalendarResources( tz );
117 calendarResource->readConfig(); 117 calendarResource->readConfig();
118 calendarResource->load(); 118 calendarResource->load();
119 qDebug("************************************* "); 119 qDebug("************************************* ");
120 qDebug("**************kdecaldump************* "); 120 qDebug("**************kdecaldump************* ");
121 qDebug("************************************* "); 121 qDebug("************************************* ");
122 qDebug("Using timezone ID: %s", calendarResource->timeZoneId().latin1()); 122 qDebug("Using timezone ID: %s", calendarResource->timeZoneId().latin1());
123 123
124 if ( !read ) { 124 if ( !read ) {
125 localCalendar = new CalendarLocal(); 125 localCalendar = new CalendarLocal();
126 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 126 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
127 KCal::Incidence::List allInc = calendarResource->rawIncidences(); 127 KCal::Incidence::List allInc = calendarResource->rawIncidences();
128 Incidence::List::ConstIterator it; 128 Incidence::List::ConstIterator it;
129 int num = 0; 129 int num = 0;
130 for( it = allInc.begin(); it != allInc.end(); ++it ) { 130 for( it = allInc.begin(); it != allInc.end(); ++it ) {
131 ResourceCalendar * re = calendarResource->resource( (*it) ); 131 ResourceCalendar * re = calendarResource->resource( (*it) );
132 if ( re && !re->readOnly() ) { 132 if ( re && /*!re->readOnly() now readonly syncing possible */) {
133 ++num; 133 ++num;
134 Incidence* cl = (*it)->clone(); 134 Incidence* cl = (*it)->clone();
135 cl->setLastModified( (*it)->lastModified() ); 135 cl->setLastModified( (*it)->lastModified() );
136 if ( cl->type() == "Journal" ) 136 if ( cl->type() == "Journal" )
137 localCalendar->addJournal( (Journal *) cl ); 137 localCalendar->addJournal( (Journal *) cl );
138 else if ( cl->type() == "Todo" ) 138 else if ( cl->type() == "Todo" )
139 localCalendar->addTodo( (Todo *) cl ); 139 localCalendar->addTodo( (Todo *) cl );
140 else if ( cl->type() == "Event" ) 140 else if ( cl->type() == "Event" )
141 localCalendar->addEvent( (Event *) cl ); 141 localCalendar->addEvent( (Event *) cl );
142 } 142 }
143 } 143 }
144 144
145 FileStorage* storage = new FileStorage( calendarResource ); 145 FileStorage* storage = new FileStorage( calendarResource );
146 storage->setFileName( fileName ); 146 storage->setFileName( fileName );
147 storage->setSaveFormat( new ICalFormat() ); 147 storage->setSaveFormat( new ICalFormat() );
148 storage->save(); 148 storage->save();
149 delete storage; 149 delete storage;
150 qDebug("************************************* "); 150 qDebug("************************************* ");
151 qDebug("************kdecaldump*************** "); 151 qDebug("************kdecaldump*************** ");
152 qDebug("************************************* "); 152 qDebug("************************************* ");
153 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1()); 153 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1());
154 154
155 } else { 155 } else {
156 qDebug("************load"); 156 qDebug("************load");
157 localCalendar = new CalendarLocal(); 157 localCalendar = new CalendarLocal();
158 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 158 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
159 FileStorage* storage = new FileStorage( localCalendar ); 159 FileStorage* storage = new FileStorage( localCalendar );
160 storage->setFileName( fileName ); 160 storage->setFileName( fileName );
161 int num = 0; 161 int num = 0;
162 int del = 0; 162 int del = 0;
163 int add = 0; 163 int add = 0;
164 if ( storage->load() ) { 164 if ( storage->load() ) {
165 qDebug("***********loaded!"); 165 qDebug("***********loaded!");
166 KCal::Incidence::List newInc = localCalendar->rawIncidences(); 166 KCal::Incidence::List newInc = localCalendar->rawIncidences();
167 Incidence::List::ConstIterator it; 167 Incidence::List::ConstIterator it;
168 for( it = newInc.begin(); it != newInc.end(); ++it ) { 168 for( it = newInc.begin(); it != newInc.end(); ++it ) {
169 if ( (*it)->pilotId() > 1 ) { //changed 169 if ( (*it)->pilotId() > 1 ) { //changed
170 qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1()); 170 qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1());
171 Incidence *incOld = calendarResource->incidence( (*it)->uid() ); 171 Incidence *incOld = calendarResource->incidence( (*it)->uid() );
172 ResourceCalendar * res = 0; 172 ResourceCalendar * res = 0;
173 if ( incOld ) 173 if ( incOld )
174 res = calendarResource->resource( incOld ); 174 res = calendarResource->resource( incOld );
175 if ( res ) { 175 if ( res ) {
176 Incidence* cl = (*it)->clone(); 176 Incidence* cl = (*it)->clone();
177 cl->setPilotId( incOld->pilotId() ); 177 cl->setPilotId( incOld->pilotId() );
178 ++num; 178 ++num;
179 if ( incOld->type() == "Journal" ) 179 if ( incOld->type() == "Journal" )
180 calendarResource->deleteJournal( (Journal *) incOld ); 180 calendarResource->deleteJournal( (Journal *) incOld );
181 else if ( incOld->type() == "Todo" ) 181 else if ( incOld->type() == "Todo" )
182 calendarResource->deleteTodo( (Todo *) incOld ); 182 calendarResource->deleteTodo( (Todo *) incOld );
183 else if ( incOld->type() == "Event" ) 183 else if ( incOld->type() == "Event" )
184 calendarResource->deleteEvent( (Event *) incOld ); 184 calendarResource->deleteEvent( (Event *) incOld );
185 qDebug("*********change incidence %s ",cl->summary().latin1()); 185 qDebug("*********change incidence %s ",cl->summary().latin1());
186 if ( cl->type() == "Journal" ) 186 if ( cl->type() == "Journal" )
187 calendarResource->addJournal( (Journal *) cl, res ); 187 calendarResource->addJournal( (Journal *) cl, res );
188 else if ( cl->type() == "Todo" ) 188 else if ( cl->type() == "Todo" )
189 calendarResource->addTodo( (Todo *) cl, res ); 189 calendarResource->addTodo( (Todo *) cl, res );
190 else if ( cl->type() == "Event" ) 190 else if ( cl->type() == "Event" )
191 calendarResource->addEvent( (Event *) cl, res ); 191 calendarResource->addEvent( (Event *) cl, res );
192 192
193 } else { 193 } else {
194 Incidence* cl = (*it)->clone(); 194 Incidence* cl = (*it)->clone();
195 qDebug("*********add incidence %s ",cl->summary().latin1()); 195 qDebug("*********add incidence %s ",cl->summary().latin1());
196 calendarResource->addIncidence( cl ); 196 calendarResource->addIncidence( cl );
197 ++add; 197 ++add;
198 } 198 }
199 } else { // maybe added 199 } else { // maybe added
200 Incidence *incOld = calendarResource->incidence( (*it)->uid() ); 200 Incidence *incOld = calendarResource->incidence( (*it)->uid() );
201 if ( !incOld ) { //added 201 if ( !incOld ) { //added
202 Incidence* cl = (*it)->clone(); 202 Incidence* cl = (*it)->clone();
203 qDebug("*********add incidence %s ",cl->summary().latin1()); 203 qDebug("*********add incidence %s ",cl->summary().latin1());
204 calendarResource->addIncidence( cl ); 204 calendarResource->addIncidence( cl );
205 ++add; 205 ++add;
206 } 206 }
207 } 207 }
208 } 208 }
209 KCal::Incidence::List allInc = calendarResource->rawIncidences(); 209 KCal::Incidence::List allInc = calendarResource->rawIncidences();
210 210
211 for( it = allInc.begin(); it != allInc.end(); ++it ) { 211 for( it = allInc.begin(); it != allInc.end(); ++it ) {
212 ResourceCalendar * re = calendarResource->resource( (*it) ); 212 ResourceCalendar * re = calendarResource->resource( (*it) );
213 if ( re && !re->readOnly() ) { 213 if ( re && !re->readOnly() ) {
214 Incidence* cl = localCalendar->incidence( (*it)->uid() ); 214 Incidence* cl = localCalendar->incidence( (*it)->uid() );
215 if ( !cl ) { 215 if ( !cl ) {
216 ++del; 216 ++del;
217 cl = (*it); 217 cl = (*it);
218 if ( cl->type() == "Journal" ) 218 if ( cl->type() == "Journal" )
219 calendarResource->deleteJournal( (Journal *) cl ); 219 calendarResource->deleteJournal( (Journal *) cl );
220 else if ( cl->type() == "Todo" ) 220 else if ( cl->type() == "Todo" )
221 calendarResource->deleteTodo( (Todo *) cl ); 221 calendarResource->deleteTodo( (Todo *) cl );
222 else if ( cl->type() == "Event" ) 222 else if ( cl->type() == "Event" )
223 calendarResource->deleteEvent( (Event *) cl ); 223 calendarResource->deleteEvent( (Event *) cl );
224 //QDateTime lm = cl->lastModified(); 224 //QDateTime lm = cl->lastModified();
225 //cl->setResources( (*it)->resources() ); 225 //cl->setResources( (*it)->resources() );
226 //cl->setLastModified(lm); 226 //cl->setLastModified(lm);
227 } 227 }
228 } 228 }
229 } 229 }
230 230
231 calendarResource->save(); 231 calendarResource->save();
232 qDebug("************************************* "); 232 qDebug("************************************* ");
233 qDebug("************kdecaldump*************** "); 233 qDebug("************kdecaldump*************** ");
234 qDebug("************************************* "); 234 qDebug("************************************* ");
235 qDebug("Calendar entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", num,del, add, fileName.latin1()); 235 qDebug("Calendar entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", num,del, add, fileName.latin1());
236 236
237 } else 237 } else
238 qDebug("ERROR loading file %s",fileName.latin1() ); 238 qDebug("ERROR loading file %s",fileName.latin1() );
239 239
240 } 240 }
241 241
242 if ( localCalendar ) { 242 if ( localCalendar ) {
243 localCalendar->close(); 243 localCalendar->close();
244 delete localCalendar; 244 delete localCalendar;
245 } 245 }
246 if ( calendarResource ) { 246 if ( calendarResource ) {
247 calendarResource->close(); 247 calendarResource->close();
248 delete calendarResource; 248 delete calendarResource;
249 } 249 }
250 250
251 qDebug("ente "); 251 qDebug("ente ");
252 return 0; 252 return 0;
253} 253}
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 3d4acb7..f8bfc8b 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,625 +1,627 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qregexp.h> 35#include <qregexp.h>
36 36
37#include <klocale.h> 37#include <klocale.h>
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kiconloader.h> 39#include <kiconloader.h>
40#include <kglobal.h> 40#include <kglobal.h>
41 41
42#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
43#include <libkcal/calendar.h> 43#include <libkcal/calendar.h>
44#include <libkcal/calendarlocal.h> 44#include <libkcal/calendarlocal.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46#include <libkcal/vcalformat.h> 46#include <libkcal/vcalformat.h>
47#include <libkcal/recurrence.h> 47#include <libkcal/recurrence.h>
48#include <libkcal/filestorage.h> 48#include <libkcal/filestorage.h>
49#include <libkdepim/categoryselectdialog.h> 49#include <libkdepim/categoryselectdialog.h>
50#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
51#include <qpe/qpeapplication.h> 51#include <qpe/qpeapplication.h>
52#else 52#else
53#include <qapplication.h> 53#include <qapplication.h>
54#endif 54#endif
55 55
56#ifndef KORG_NOPRINTER 56#ifndef KORG_NOPRINTER
57#include "calprinter.h" 57#include "calprinter.h"
58#endif 58#endif
59#include "koglobals.h" 59#include "koglobals.h"
60#include "koprefs.h" 60#include "koprefs.h"
61#include "kfiledialog.h" 61#include "kfiledialog.h"
62 62
63#include "kolistview.h" 63#include "kolistview.h"
64 64
65ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 65ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
66{ 66{
67 mItem = item; 67 mItem = item;
68 mDate = date; 68 mDate = date;
69} 69}
70 70
71ListItemVisitor::~ListItemVisitor() 71ListItemVisitor::~ListItemVisitor()
72{ 72{
73} 73}
74 74
75bool ListItemVisitor::visit(Event *e) 75bool ListItemVisitor::visit(Event *e)
76{ 76{
77 77
78 bool ok = false; 78 bool ok = false;
79 QString start, end; 79 QString start, end;
80 QDate ds, de;
80 if ( e->doesRecur() ) { 81 if ( e->doesRecur() ) {
81 QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 82 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
82 if ( ok ) { 83 if ( ok ) {
83 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 84 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
84 start = KGlobal::locale()->formatDate(d,true); 85 start = KGlobal::locale()->formatDate(ds,true);
85 end = KGlobal::locale()->formatDate(d.addDays( days),true); 86 de = ds.addDays( days);
87 end = KGlobal::locale()->formatDate(de,true);
86 } 88 }
87 89
88 } 90 }
89 if ( ! ok ) { 91 if ( ! ok ) {
90 start =e->dtStartDateStr(); 92 start =e->dtStartDateStr();
91 end = e->dtEndDateStr(); 93 end = e->dtEndDateStr();
94 ds = e->dtStart().date();
95 de = e->dtEnd().date();
92 } 96 }
93 mItem->setText(0,e->summary()); 97 mItem->setText(0,e->summary());
94 mItem->setText(1,start); 98 mItem->setText(1,start);
95 mItem->setText(2,e->dtStartTimeStr()); 99 mItem->setText(2,e->dtStartTimeStr());
96 mItem->setText(3,end); 100 mItem->setText(3,end);
97 mItem->setText(4,e->dtEndTimeStr()); 101 mItem->setText(4,e->dtEndTimeStr());
98 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 102 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
99 mItem->setText(6, e->recurrence()->recurrenceText()); 103 mItem->setText(6, e->recurrence()->recurrenceText());
100 mItem->setText(7,"---"); 104 mItem->setText(7,"---");
101 mItem->setText(8,"---"); 105 mItem->setText(8,"---");
102 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 106 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
103 mItem->setText(10,e->categoriesStr()); 107 mItem->setText(10,e->categoriesStr());
104 108
105 QString key; 109 QString key;
106 QDate d = e->dtStart().date();
107 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 110 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
108 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); 111 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
109 mItem->setSortKey(1,key); 112 mItem->setSortKey(1,key);
110 113
111 d = e->dtEnd().date();
112 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 114 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
113 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); 115 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
114 mItem->setSortKey(3,key); 116 mItem->setSortKey(3,key);
115 117
116 return true; 118 return true;
117} 119}
118 120
119bool ListItemVisitor::visit(Todo *t) 121bool ListItemVisitor::visit(Todo *t)
120{ 122{
121 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 123 mItem->setText(0,i18n("To-Do: %1").arg(t->summary()));
122 if (t->hasStartDate()) { 124 if (t->hasStartDate()) {
123 mItem->setText(1,t->dtStartDateStr()); 125 mItem->setText(1,t->dtStartDateStr());
124 if (t->doesFloat()) { 126 if (t->doesFloat()) {
125 mItem->setText(2,"---"); 127 mItem->setText(2,"---");
126 } else { 128 } else {
127 mItem->setText(2,t->dtStartTimeStr()); 129 mItem->setText(2,t->dtStartTimeStr());
128 } 130 }
129 } else { 131 } else {
130 mItem->setText(1,"---"); 132 mItem->setText(1,"---");
131 mItem->setText(2,"---"); 133 mItem->setText(2,"---");
132 } 134 }
133 mItem->setText(3,"---"); 135 mItem->setText(3,"---");
134 mItem->setText(4,"---"); 136 mItem->setText(4,"---");
135 mItem->setText(5,"---"); 137 mItem->setText(5,"---");
136 mItem->setText(6,"---"); 138 mItem->setText(6,"---");
137 if (t->hasDueDate()) { 139 if (t->hasDueDate()) {
138 mItem->setText(7,t->dtDueDateStr()); 140 mItem->setText(7,t->dtDueDateStr());
139 if (t->doesFloat()) { 141 if (t->doesFloat()) {
140 mItem->setText(8,"---"); 142 mItem->setText(8,"---");
141 } else { 143 } else {
142 mItem->setText(8,t->dtDueTimeStr()); 144 mItem->setText(8,t->dtDueTimeStr());
143 } 145 }
144 } else { 146 } else {
145 mItem->setText(7,"---"); 147 mItem->setText(7,"---");
146 mItem->setText(8,"---"); 148 mItem->setText(8,"---");
147 } 149 }
148 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 150 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
149 mItem->setText(10,t->categoriesStr()); 151 mItem->setText(10,t->categoriesStr());
150 152
151 QString key; 153 QString key;
152 QDate d; 154 QDate d;
153 if (t->hasDueDate()) { 155 if (t->hasDueDate()) {
154 d = t->dtDue().date(); 156 d = t->dtDue().date();
155 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 157 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
156 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 158 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
157 mItem->setSortKey(7,key); 159 mItem->setSortKey(7,key);
158 } 160 }
159 if ( t->hasStartDate() ) { 161 if ( t->hasStartDate() ) {
160 d = t->dtStart().date(); 162 d = t->dtStart().date();
161 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 163 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
162 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 164 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
163 mItem->setSortKey(1,key); 165 mItem->setSortKey(1,key);
164 } 166 }
165 return true; 167 return true;
166} 168}
167 169
168bool ListItemVisitor::visit(Journal * j) 170bool ListItemVisitor::visit(Journal * j)
169{ 171{
170 QString des = j->description().left(50); 172 QString des = j->description().left(50);
171 des = des.simplifyWhiteSpace (); 173 des = des.simplifyWhiteSpace ();
172 des.replace (QRegExp ("\\n"),"" ); 174 des.replace (QRegExp ("\\n"),"" );
173 des.replace (QRegExp ("\\r"),"" ); 175 des.replace (QRegExp ("\\r"),"" );
174 mItem->setText(0,i18n("Journal")+": "+des.left(25)); 176 mItem->setText(0,i18n("Journal")+": "+des.left(25));
175 mItem->setText(1,j->dtStartDateStr()); 177 mItem->setText(1,j->dtStartDateStr());
176 mItem->setText(2,"---"); 178 mItem->setText(2,"---");
177 mItem->setText(3,"---"); 179 mItem->setText(3,"---");
178 mItem->setText(4,"---"); 180 mItem->setText(4,"---");
179 mItem->setText(5,"---"); 181 mItem->setText(5,"---");
180 mItem->setText(6,"---"); 182 mItem->setText(6,"---");
181 mItem->setText(7,j->dtStartDateStr()); 183 mItem->setText(7,j->dtStartDateStr());
182 mItem->setText(8,"---"); 184 mItem->setText(8,"---");
183 mItem->setText(9,"---"); 185 mItem->setText(9,"---");
184 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 186 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
185 187
186 QString key; 188 QString key;
187 QDate d = j->dtStart().date(); 189 QDate d = j->dtStart().date();
188 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 190 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
189 mItem->setSortKey(1,key); 191 mItem->setSortKey(1,key);
190 mItem->setSortKey(7,key); 192 mItem->setSortKey(7,key);
191 193
192 return true; 194 return true;
193} 195}
194 196
195KOListView::KOListView(Calendar *calendar, QWidget *parent, 197KOListView::KOListView(Calendar *calendar, QWidget *parent,
196 const char *name) 198 const char *name)
197 : KOEventView(calendar, parent, name) 199 : KOEventView(calendar, parent, name)
198{ 200{
199 mActiveItem = 0; 201 mActiveItem = 0;
200 mListView = new KOListViewListView(this); 202 mListView = new KOListViewListView(this);
201 mListView->addColumn(i18n("Summary")); 203 mListView->addColumn(i18n("Summary"));
202 mListView->addColumn(i18n("Start Date")); 204 mListView->addColumn(i18n("Start Date"));
203 mListView->addColumn(i18n("Start Time")); 205 mListView->addColumn(i18n("Start Time"));
204 mListView->addColumn(i18n("End Date")); 206 mListView->addColumn(i18n("End Date"));
205 mListView->addColumn(i18n("End Time")); 207 mListView->addColumn(i18n("End Time"));
206 mListView->addColumn(i18n("Alarm")); // alarm set? 208 mListView->addColumn(i18n("Alarm")); // alarm set?
207 mListView->addColumn(i18n("Recurs")); // recurs? 209 mListView->addColumn(i18n("Recurs")); // recurs?
208 mListView->addColumn(i18n("Due Date")); 210 mListView->addColumn(i18n("Due Date"));
209 mListView->addColumn(i18n("Due Time")); 211 mListView->addColumn(i18n("Due Time"));
210 mListView->addColumn(i18n("Cancelled")); 212 mListView->addColumn(i18n("Cancelled"));
211 mListView->addColumn(i18n("Categories")); 213 mListView->addColumn(i18n("Categories"));
212 214
213 mListView->setColumnAlignment(0,AlignLeft); 215 mListView->setColumnAlignment(0,AlignLeft);
214 mListView->setColumnAlignment(1,AlignLeft); 216 mListView->setColumnAlignment(1,AlignLeft);
215 mListView->setColumnAlignment(2,AlignHCenter); 217 mListView->setColumnAlignment(2,AlignHCenter);
216 mListView->setColumnAlignment(3,AlignLeft); 218 mListView->setColumnAlignment(3,AlignLeft);
217 mListView->setColumnAlignment(4,AlignHCenter); 219 mListView->setColumnAlignment(4,AlignHCenter);
218 mListView->setColumnAlignment(5,AlignLeft); 220 mListView->setColumnAlignment(5,AlignLeft);
219 mListView->setColumnAlignment(6,AlignLeft); 221 mListView->setColumnAlignment(6,AlignLeft);
220 mListView->setColumnAlignment(7,AlignLeft); 222 mListView->setColumnAlignment(7,AlignLeft);
221 mListView->setColumnAlignment(8,AlignLeft); 223 mListView->setColumnAlignment(8,AlignLeft);
222 mListView->setColumnAlignment(9,AlignLeft); 224 mListView->setColumnAlignment(9,AlignLeft);
223 mListView->setColumnAlignment(10,AlignLeft); 225 mListView->setColumnAlignment(10,AlignLeft);
224 226
225 int iii = 0; 227 int iii = 0;
226 for ( iii = 0; iii< 10 ; ++iii ) 228 for ( iii = 0; iii< 10 ; ++iii )
227 mListView->setColumnWidthMode( iii, QListView::Manual ); 229 mListView->setColumnWidthMode( iii, QListView::Manual );
228 230
229 QBoxLayout *layoutTop = new QVBoxLayout(this); 231 QBoxLayout *layoutTop = new QVBoxLayout(this);
230 layoutTop->addWidget(mListView); 232 layoutTop->addWidget(mListView);
231 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 233 mListView->setFont ( KOPrefs::instance()->mListViewFont );
232 mPopupMenu = eventPopup(); 234 mPopupMenu = eventPopup();
233 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 235 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
234 i18n("Select all"),this, 236 i18n("Select all"),this,
235 SLOT(allSelection()),true); 237 SLOT(allSelection()),true);
236 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 238 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
237 i18n("Deselect All"),this, 239 i18n("Deselect All"),this,
238 SLOT(clearSelection()),true); 240 SLOT(clearSelection()),true);
239 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 241 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
240 i18n("Delete all selected"),this, 242 i18n("Delete all selected"),this,
241 SLOT(deleteAll()),true); 243 SLOT(deleteAll()),true);
242 mPopupMenu->insertSeparator(); 244 mPopupMenu->insertSeparator();
243 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 245 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
244 i18n("Save selected to file..."),this, 246 i18n("Save selected to file..."),this,
245 SLOT(saveToFile()),true); 247 SLOT(saveToFile()),true);
246 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 248 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
247 i18n("Save Journal/Description..."),this, 249 i18n("Save Journal/Description..."),this,
248 SLOT(saveDescriptionToFile()),true); 250 SLOT(saveDescriptionToFile()),true);
249 mPopupMenu->insertSeparator(); 251 mPopupMenu->insertSeparator();
250 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 252 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
251 i18n("Add Categ. to selected..."),this, 253 i18n("Add Categ. to selected..."),this,
252 SLOT(addCat()),true); 254 SLOT(addCat()),true);
253 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 255 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
254 i18n("Set Categ. for selected..."),this, 256 i18n("Set Categ. for selected..."),this,
255 SLOT(setCat()),true); 257 SLOT(setCat()),true);
256 mPopupMenu->insertSeparator(); 258 mPopupMenu->insertSeparator();
257 259
258 260
259#ifndef DESKTOP_VERSION 261#ifndef DESKTOP_VERSION
260 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 262 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
261 i18n("Beam selected via IR"),this, 263 i18n("Beam selected via IR"),this,
262 SLOT(beamSelected()),true); 264 SLOT(beamSelected()),true);
263#endif 265#endif
264 /* 266 /*
265 mPopupMenu = new QPopupMenu; 267 mPopupMenu = new QPopupMenu;
266 mPopupMenu->insertItem(i18n("Edit Event"), this, 268 mPopupMenu->insertItem(i18n("Edit Event"), this,
267 SLOT (editEvent())); 269 SLOT (editEvent()));
268 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 270 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
269 SLOT (deleteEvent())); 271 SLOT (deleteEvent()));
270 mPopupMenu->insertSeparator(); 272 mPopupMenu->insertSeparator();
271 mPopupMenu->insertItem(i18n("Show Dates"), this, 273 mPopupMenu->insertItem(i18n("Show Dates"), this,
272 SLOT(showDates())); 274 SLOT(showDates()));
273 mPopupMenu->insertItem(i18n("Hide Dates"), this, 275 mPopupMenu->insertItem(i18n("Hide Dates"), this,
274 SLOT(hideDates())); 276 SLOT(hideDates()));
275 */ 277 */
276 QObject::connect(mListView,SIGNAL( newEvent()), 278 QObject::connect(mListView,SIGNAL( newEvent()),
277 this,SIGNAL(signalNewEvent())); 279 this,SIGNAL(signalNewEvent()));
278 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 280 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
279 this,SLOT(defaultItemAction(QListViewItem *))); 281 this,SLOT(defaultItemAction(QListViewItem *)));
280 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 282 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
281 const QPoint &, int )), 283 const QPoint &, int )),
282 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 284 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
283 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 285 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
284 SLOT(processSelectionChange(QListViewItem *))); 286 SLOT(processSelectionChange(QListViewItem *)));
285 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 287 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
286 SIGNAL(showIncidenceSignal(Incidence *)) ); 288 SIGNAL(showIncidenceSignal(Incidence *)) );
287 289
288 readSettings(KOGlobals::config(),"KOListView Layout"); 290 readSettings(KOGlobals::config(),"KOListView Layout");
289} 291}
290 292
291KOListView::~KOListView() 293KOListView::~KOListView()
292{ 294{
293 delete mPopupMenu; 295 delete mPopupMenu;
294} 296}
295 297
296void KOListView::updateList() 298void KOListView::updateList()
297{ 299{
298 // qDebug(" KOListView::updateList() "); 300 // qDebug(" KOListView::updateList() ");
299 301
300} 302}
301 303
302void KOListView::addCat( ) 304void KOListView::addCat( )
303{ 305{
304 setCategories( false ); 306 setCategories( false );
305} 307}
306void KOListView::setCat() 308void KOListView::setCat()
307{ 309{
308 setCategories( true ); 310 setCategories( true );
309} 311}
310void KOListView::setCategories( bool removeOld ) 312void KOListView::setCategories( bool removeOld )
311{ 313{
312 314
313 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 315 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
314 if (! csd->exec()) { 316 if (! csd->exec()) {
315 delete csd; 317 delete csd;
316 return; 318 return;
317 } 319 }
318 QStringList catList = csd->selectedCategories(); 320 QStringList catList = csd->selectedCategories();
319 delete csd; 321 delete csd;
320 // if ( catList.count() == 0 ) 322 // if ( catList.count() == 0 )
321 // return; 323 // return;
322 catList.sort(); 324 catList.sort();
323 QString categoriesStr = catList.join(","); 325 QString categoriesStr = catList.join(",");
324 int i; 326 int i;
325 QStringList itemList; 327 QStringList itemList;
326 QPtrList<KOListViewItem> sel ; 328 QPtrList<KOListViewItem> sel ;
327 QListViewItem *qitem = mListView->firstChild (); 329 QListViewItem *qitem = mListView->firstChild ();
328 while ( qitem ) { 330 while ( qitem ) {
329 if ( qitem->isSelected() ) { 331 if ( qitem->isSelected() ) {
330 sel.append(((KOListViewItem *)qitem)); 332 sel.append(((KOListViewItem *)qitem));
331 } 333 }
332 qitem = qitem->nextSibling(); 334 qitem = qitem->nextSibling();
333 } 335 }
334 KOListViewItem * item, *temp; 336 KOListViewItem * item, *temp;
335 item = sel.first(); 337 item = sel.first();
336 Incidence* inc; 338 Incidence* inc;
337 while ( item ) { 339 while ( item ) {
338 inc = item->data(); 340 inc = item->data();
339 if ( removeOld ) { 341 if ( removeOld ) {
340 inc->setCategories( categoriesStr ); 342 inc->setCategories( categoriesStr );
341 } else { 343 } else {
342 itemList = QStringList::split (",", inc->categoriesStr() ); 344 itemList = QStringList::split (",", inc->categoriesStr() );
343 for( i = 0; i< catList.count(); ++i ) { 345 for( i = 0; i< catList.count(); ++i ) {
344 if ( !itemList.contains (catList[i])) 346 if ( !itemList.contains (catList[i]))
345 itemList.append( catList[i] ); 347 itemList.append( catList[i] );
346 } 348 }
347 itemList.sort(); 349 itemList.sort();
348 inc->setCategories( itemList.join(",") ); 350 inc->setCategories( itemList.join(",") );
349 } 351 }
350 temp = item; 352 temp = item;
351 item = sel.next(); 353 item = sel.next();
352 mUidDict.remove( inc->uid() ); 354 mUidDict.remove( inc->uid() );
353 delete temp;; 355 delete temp;;
354 addIncidence( inc ); 356 addIncidence( inc );
355 } 357 }
356} 358}
357 359
358void KOListView::beamSelected() 360void KOListView::beamSelected()
359{ 361{
360 int icount = 0; 362 int icount = 0;
361 QPtrList<Incidence> delSel ; 363 QPtrList<Incidence> delSel ;
362 QListViewItem *item = mListView->firstChild (); 364 QListViewItem *item = mListView->firstChild ();
363 while ( item ) { 365 while ( item ) {
364 if ( item->isSelected() ) { 366 if ( item->isSelected() ) {
365 delSel.append(((KOListViewItem *)item)->data()); 367 delSel.append(((KOListViewItem *)item)->data());
366 ++icount; 368 ++icount;
367 } 369 }
368 370
369 item = item->nextSibling(); 371 item = item->nextSibling();
370 } 372 }
371 if ( icount ) { 373 if ( icount ) {
372 emit beamIncidenceList( delSel ); 374 emit beamIncidenceList( delSel );
373 return; 375 return;
374 QString fn ; 376 QString fn ;
375 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 377 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
376 QString mes; 378 QString mes;
377 bool createbup = true; 379 bool createbup = true;
378 if ( createbup ) { 380 if ( createbup ) {
379 QString description = "\n"; 381 QString description = "\n";
380 CalendarLocal* cal = new CalendarLocal(); 382 CalendarLocal* cal = new CalendarLocal();
381 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 383 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
382 Incidence *incidence = delSel.first(); 384 Incidence *incidence = delSel.first();
383 while ( incidence ) { 385 while ( incidence ) {
384 Incidence *in = incidence->clone(); 386 Incidence *in = incidence->clone();
385 description += in->summary() + "\n"; 387 description += in->summary() + "\n";
386 cal->addIncidence( in ); 388 cal->addIncidence( in );
387 incidence = delSel.next(); 389 incidence = delSel.next();
388 } 390 }
389 FileStorage storage( cal, fn, new VCalFormat ); 391 FileStorage storage( cal, fn, new VCalFormat );
390 storage.save(); 392 storage.save();
391 delete cal; 393 delete cal;
392 mes = i18n("KO/Pi: Ready for beaming"); 394 mes = i18n("KO/Pi: Ready for beaming");
393 topLevelWidget()->setCaption(mes); 395 topLevelWidget()->setCaption(mes);
394 396
395#ifndef DESKTOP_VERSION 397#ifndef DESKTOP_VERSION
396 Ir *ir = new Ir( this ); 398 Ir *ir = new Ir( this );
397 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 399 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
398 ir->send( fn, description, "text/x-vCalendar" ); 400 ir->send( fn, description, "text/x-vCalendar" );
399#endif 401#endif
400 } 402 }
401 } 403 }
402} 404}
403void KOListView::beamDone( Ir *ir ) 405void KOListView::beamDone( Ir *ir )
404{ 406{
405#ifndef DESKTOP_VERSION 407#ifndef DESKTOP_VERSION
406 delete ir; 408 delete ir;
407#endif 409#endif
408 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 410 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
409} 411}
410 412
411void KOListView::saveDescriptionToFile() 413void KOListView::saveDescriptionToFile()
412{ 414{
413 415
414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 416 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
415 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 417 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
416 i18n("Continue"), i18n("Cancel"), 0, 418 i18n("Continue"), i18n("Cancel"), 0,
417 0, 1 ); 419 0, 1 );
418 if ( result != 0 ) { 420 if ( result != 0 ) {
419 return; 421 return;
420 } 422 }
421 int icount = 0; 423 int icount = 0;
422 QPtrList<Incidence> delSel ; 424 QPtrList<Incidence> delSel ;
423 QListViewItem *item = mListView->firstChild (); 425 QListViewItem *item = mListView->firstChild ();
424 while ( item ) { 426 while ( item ) {
425 if ( item->isSelected() ) { 427 if ( item->isSelected() ) {
426 delSel.append(((KOListViewItem *)item)->data()); 428 delSel.append(((KOListViewItem *)item)->data());
427 ++icount; 429 ++icount;
428 } 430 }
429 431
430 item = item->nextSibling(); 432 item = item->nextSibling();
431 } 433 }
432 if ( icount ) { 434 if ( icount ) {
433 QString fn = KOPrefs::instance()->mLastSaveFile; 435 QString fn = KOPrefs::instance()->mLastSaveFile;
434 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 436 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
435 437
436 if ( fn == "" ) 438 if ( fn == "" )
437 return; 439 return;
438 QFileInfo info; 440 QFileInfo info;
439 info.setFile( fn ); 441 info.setFile( fn );
440 QString mes; 442 QString mes;
441 bool createbup = true; 443 bool createbup = true;
442 if ( info. exists() ) { 444 if ( info. exists() ) {
443 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 445 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
444 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 446 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
445 i18n("Overwrite!"), i18n("Cancel"), 0, 447 i18n("Overwrite!"), i18n("Cancel"), 0,
446 0, 1 ); 448 0, 1 );
447 if ( result != 0 ) { 449 if ( result != 0 ) {
448 createbup = false; 450 createbup = false;
449 } 451 }
450 } 452 }
451 if ( createbup ) { 453 if ( createbup ) {
452 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 454 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
453 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 455 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
454 Incidence *incidence = delSel.first(); 456 Incidence *incidence = delSel.first();
455 icount = 0; 457 icount = 0;
456 while ( incidence ) { 458 while ( incidence ) {
457 if ( incidence->type() == "Journal" ) { 459 if ( incidence->type() == "Journal" ) {
458 text += "\n************************************\n"; 460 text += "\n************************************\n";
459 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 461 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
460 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 462 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
461 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 463 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
462 ++icount; 464 ++icount;
463 465
464 } else { 466 } else {
465 if ( !incidence->description().isEmpty() ) { 467 if ( !incidence->description().isEmpty() ) {
466 text += "\n************************************\n"; 468 text += "\n************************************\n";
467 if ( incidence->type() == "Todo" ) 469 if ( incidence->type() == "Todo" )
468 text += i18n("To-Do: "); 470 text += i18n("To-Do: ");
469 text += incidence->summary(); 471 text += incidence->summary();
470 if ( incidence->hasStartDate() ) 472 if ( incidence->hasStartDate() )
471 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 473 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
472 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 474 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
473 if ( !incidence->location().isEmpty() ) 475 if ( !incidence->location().isEmpty() )
474 text += "\n" +i18n("Location: ") + incidence->location(); 476 text += "\n" +i18n("Location: ") + incidence->location();
475 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 477 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
476 ++icount; 478 ++icount;
477 479
478 } 480 }
479 } 481 }
480 incidence = delSel.next(); 482 incidence = delSel.next();
481 } 483 }
482 QFile file( fn ); 484 QFile file( fn );
483 if (!file.open( IO_WriteOnly ) ) { 485 if (!file.open( IO_WriteOnly ) ) {
484 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 486 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
485 return; 487 return;
486 } 488 }
487 QTextStream ts( &file ); 489 QTextStream ts( &file );
488 ts << text; 490 ts << text;
489 file.close(); 491 file.close();
490 //qDebug("%s ", text.latin1()); 492 //qDebug("%s ", text.latin1());
491 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 493 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
492 KOPrefs::instance()->mLastSaveFile = fn; 494 KOPrefs::instance()->mLastSaveFile = fn;
493 topLevelWidget()->setCaption(mes); 495 topLevelWidget()->setCaption(mes);
494 } 496 }
495 } 497 }
496} 498}
497void KOListView::saveToFile() 499void KOListView::saveToFile()
498{ 500{
499 501
500 int icount = 0; 502 int icount = 0;
501 QPtrList<Incidence> delSel ; 503 QPtrList<Incidence> delSel ;
502 QListViewItem *item = mListView->firstChild (); 504 QListViewItem *item = mListView->firstChild ();
503 while ( item ) { 505 while ( item ) {
504 if ( item->isSelected() ) { 506 if ( item->isSelected() ) {
505 delSel.append(((KOListViewItem *)item)->data()); 507 delSel.append(((KOListViewItem *)item)->data());
506 ++icount; 508 ++icount;
507 } 509 }
508 510
509 item = item->nextSibling(); 511 item = item->nextSibling();
510 } 512 }
511 if ( icount ) { 513 if ( icount ) {
512 QString fn = KOPrefs::instance()->mLastSaveFile; 514 QString fn = KOPrefs::instance()->mLastSaveFile;
513 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 515 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
514 516
515 if ( fn == "" ) 517 if ( fn == "" )
516 return; 518 return;
517 QFileInfo info; 519 QFileInfo info;
518 info.setFile( fn ); 520 info.setFile( fn );
519 QString mes; 521 QString mes;
520 bool createbup = true; 522 bool createbup = true;
521 if ( info. exists() ) { 523 if ( info. exists() ) {
522 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 524 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
523 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 525 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
524 i18n("Overwrite!"), i18n("Cancel"), 0, 526 i18n("Overwrite!"), i18n("Cancel"), 0,
525 0, 1 ); 527 0, 1 );
526 if ( result != 0 ) { 528 if ( result != 0 ) {
527 createbup = false; 529 createbup = false;
528 } 530 }
529 } 531 }
530 if ( createbup ) { 532 if ( createbup ) {
531 CalendarLocal cal; 533 CalendarLocal cal;
532 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 534 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
533 Incidence *incidence = delSel.first(); 535 Incidence *incidence = delSel.first();
534 while ( incidence ) { 536 while ( incidence ) {
535 cal.addIncidence( incidence->clone() ); 537 cal.addIncidence( incidence->clone() );
536 incidence = delSel.next(); 538 incidence = delSel.next();
537 } 539 }
538 ICalFormat format; 540 ICalFormat format;
539 format.save( &cal, fn ); 541 format.save( &cal, fn );
540 mes = i18n("KO/Pi:Saved %1").arg(fn ); 542 mes = i18n("KO/Pi:Saved %1").arg(fn );
541 KOPrefs::instance()->mLastSaveFile = fn; 543 KOPrefs::instance()->mLastSaveFile = fn;
542 topLevelWidget()->setCaption(mes); 544 topLevelWidget()->setCaption(mes);
543 } 545 }
544 } 546 }
545} 547}
546void KOListView::deleteAll() 548void KOListView::deleteAll()
547{ 549{
548 int icount = 0; 550 int icount = 0;
549 QPtrList<Incidence> delSel ; 551 QPtrList<Incidence> delSel ;
550 QListViewItem *item = mListView->firstChild (); 552 QListViewItem *item = mListView->firstChild ();
551 while ( item ) { 553 while ( item ) {
552 if ( item->isSelected() ) { 554 if ( item->isSelected() ) {
553 delSel.append(((KOListViewItem *)item)->data()); 555 delSel.append(((KOListViewItem *)item)->data());
554 ++icount; 556 ++icount;
555 } 557 }
556 558
557 item = item->nextSibling(); 559 item = item->nextSibling();
558 } 560 }
559 if ( icount ) { 561 if ( icount ) {
560 Incidence *incidence = delSel.first(); 562 Incidence *incidence = delSel.first();
561 Incidence *toDelete; 563 Incidence *toDelete;
562 KOPrefs *p = KOPrefs::instance(); 564 KOPrefs *p = KOPrefs::instance();
563 bool confirm = p->mConfirm; 565 bool confirm = p->mConfirm;
564 QString mess; 566 QString mess;
565 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 567 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
566 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 568 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
567 p->mConfirm = false; 569 p->mConfirm = false;
568 int delCounter = 0; 570 int delCounter = 0;
569 QDialog dia ( this, "p-dialog", true ); 571 QDialog dia ( this, "p-dialog", true );
570 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 572 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
571 QVBoxLayout lay( &dia ); 573 QVBoxLayout lay( &dia );
572 lay.setMargin(7); 574 lay.setMargin(7);
573 lay.setSpacing(7); 575 lay.setSpacing(7);
574 lay.addWidget( &lab); 576 lay.addWidget( &lab);
575 QProgressBar bar( icount, &dia ); 577 QProgressBar bar( icount, &dia );
576 lay.addWidget( &bar); 578 lay.addWidget( &bar);
577 int w = 220; 579 int w = 220;
578 int h = 50; 580 int h = 50;
579 int dw = QApplication::desktop()->width(); 581 int dw = QApplication::desktop()->width();
580 int dh = QApplication::desktop()->height(); 582 int dh = QApplication::desktop()->height();
581 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 583 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
582 //dia.resize( 240,50 ); 584 //dia.resize( 240,50 );
583 dia.show(); 585 dia.show();
584 586
585 while ( incidence ) { 587 while ( incidence ) {
586 bar.setProgress( delCounter ); 588 bar.setProgress( delCounter );
587 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 589 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
588 dia.setCaption( mess ); 590 dia.setCaption( mess );
589 qApp->processEvents(); 591 qApp->processEvents();
590 toDelete = (incidence); 592 toDelete = (incidence);
591 incidence = delSel.next(); 593 incidence = delSel.next();
592 emit deleteIncidenceSignal(toDelete ); 594 emit deleteIncidenceSignal(toDelete );
593 if ( dia.result() != 0 ) 595 if ( dia.result() != 0 )
594 break; 596 break;
595 597
596 } 598 }
597 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 599 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
598 topLevelWidget ()->setCaption( mess ); 600 topLevelWidget ()->setCaption( mess );
599 p->mConfirm = confirm; 601 p->mConfirm = confirm;
600 } 602 }
601 } 603 }
602 604
603 605
604} 606}
605int KOListView::maxDatesHint() 607int KOListView::maxDatesHint()
606{ 608{
607 return 0; 609 return 0;
608} 610}
609 611
610int KOListView::currentDateCount() 612int KOListView::currentDateCount()
611{ 613{
612 return 0; 614 return 0;
613} 615}
614 616
615QPtrList<Incidence> KOListView::selectedIncidences() 617QPtrList<Incidence> KOListView::selectedIncidences()
616{ 618{
617 QPtrList<Incidence> eventList; 619 QPtrList<Incidence> eventList;
618 QListViewItem *item = mListView->firstChild (); 620 QListViewItem *item = mListView->firstChild ();
619 while ( item ) { 621 while ( item ) {
620 if ( item->isSelected() ) { 622 if ( item->isSelected() ) {
621 eventList.append(((KOListViewItem *)item)->data()); 623 eventList.append(((KOListViewItem *)item)->data());
622 } 624 }
623 625
624 item = item->nextSibling(); 626 item = item->nextSibling();
625 } 627 }
diff --git a/version b/version
index 65eb8d1..d8563ed 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "1.9.16"; version = "1.9.17";