-rw-r--r-- | bin/kdepim/korganizer/kopiWhatsNew.txt | 74 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 30 |
2 files changed, 93 insertions, 11 deletions
diff --git a/bin/kdepim/korganizer/kopiWhatsNew.txt b/bin/kdepim/korganizer/kopiWhatsNew.txt index 8982a9c..20de933 100644 --- a/bin/kdepim/korganizer/kopiWhatsNew.txt +++ b/bin/kdepim/korganizer/kopiWhatsNew.txt | |||
@@ -1,220 +1,294 @@ | |||
1 | Info about the changes in new versions of KO/Pi | 1 | Info about the changes in new versions of KO/Pi |
2 | and KDE-Pim/Pi | 2 | and KDE-Pim/Pi |
3 | 3 | ||
4 | ********** VERSION 1.9.4 ************ | ||
5 | |||
6 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | ||
7 | |||
8 | WARNING: | ||
9 | PLEASE BACKUP ALL YOUR DATA! | ||
10 | We have changed a lot and maybe there are some unknown problems. | ||
11 | |||
12 | SYNC HANDLING HAS CHANGED! | ||
13 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | ||
14 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | ||
15 | |||
16 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | ||
17 | If 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. | ||
18 | |||
19 | As programs are available: | ||
20 | KO/Pi (korganizer ipk) - a calendar program. | ||
21 | KA/Pi (kaddressbook ipk ) - an addressbook | ||
22 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | ||
23 | |||
24 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | ||
25 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | ||
26 | |||
27 | All the applications are installed in a "Pim" TAB. | ||
28 | If 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 | ||
29 | |||
30 | All the application are integrated. | ||
31 | Such 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. | ||
32 | |||
33 | HINT: | ||
34 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | ||
35 | |||
36 | What's new? | ||
37 | |||
38 | SYNC HANDLING HAS CHANGED! | ||
39 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | ||
40 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | ||
41 | |||
42 | New in OM/Pi: | ||
43 | When 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. | ||
44 | |||
45 | New in KO/Pi: | ||
46 | French is now available for KO/Pi. | ||
47 | Choose menu:Actions - Configure:TAB locale | ||
48 | Syncing has changed. | ||
49 | Phone sync available soon. | ||
50 | Not much changes, I cannot remember them ... | ||
51 | |||
52 | New in KA/Pi: | ||
53 | Beaming possible. | ||
54 | Sharp DTM readonly access possible( create a new DTM resource ); | ||
55 | Better searching possible. | ||
56 | Search is performed only after pressing the return key. | ||
57 | Use wildcard * to specify parts of a name. | ||
58 | |||
59 | Better 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 * . | ||
60 | |||
61 | A big improvement is the new management of the contact access. | ||
62 | In version 1.9.3, every application was using their own addressbook access data. | ||
63 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | ||
64 | That was wasting of memory, if you had several hundreds of contacts. | ||
65 | |||
66 | Now only KA/Pi accesses the addressbook. | ||
67 | If 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. | ||
68 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | ||
69 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | ||
70 | |||
71 | New in the KO/Pi alarm applet: | ||
72 | Configure your own timer popup menu! | ||
73 | (Text and minutes for timer countdown) | ||
74 | Just edit the file | ||
75 | (yourhomedir)/.kopialarmtimerrc | ||
76 | and start/stop a timer to get a new menu with the data of this file. | ||
77 | |||
4 | ********** VERSION 1.9.3 ************ | 78 | ********** VERSION 1.9.3 ************ |
5 | 1) | 79 | 1) |
6 | Now KO/Pi on Windows imports directly the calendar data of | 80 | Now KO/Pi on Windows imports directly the calendar data of |
7 | an installed Outlook. Should work with OL version >= 2000. | 81 | an installed Outlook. Should work with OL version >= 2000. |
8 | 82 | ||
9 | ********** VERSION 1.9.2 ************ | 83 | ********** VERSION 1.9.2 ************ |
10 | 1) | 84 | 1) |
11 | KDE-Pim/Pi has got a new member: | 85 | KDE-Pim/Pi has got a new member: |
12 | KmicroMail (KM/Pi) is a mail program, | 86 | KmicroMail (KM/Pi) is a mail program, |
13 | which can handle IMAP and POP mail access. | 87 | which can handle IMAP and POP mail access. |
14 | It is based on Opie-Mail v3. | 88 | It is based on Opie-Mail v3. |
15 | All dependencies to the Opie libraries ar removed, | 89 | All dependencies to the Opie libraries ar removed, |
16 | such that no additional Opie lib is needed. | 90 | such that no additional Opie lib is needed. |
17 | It is already integrated in KO/Pi and KA/Pi. | 91 | It is already integrated in KO/Pi and KA/Pi. |
18 | It it now available for the Zaurus,probably it | 92 | It it now available for the Zaurus,probably it |
19 | will be available for other platforms later. | 93 | will be available for other platforms later. |
20 | Hint: | 94 | Hint: |
21 | Create your own contact (name + email) | 95 | Create your own contact (name + email) |
22 | in KA/Pi, select this contact and choose menu: | 96 | in KA/Pi, select this contact and choose menu: |
23 | Settings - Set Who Am I. | 97 | Settings - Set Who Am I. |
24 | Now the settings of this contact are used as | 98 | Now the settings of this contact are used as |
25 | the sender data in KM/Pi. | 99 | the sender data in KM/Pi. |
26 | 2) | 100 | 2) |
27 | KDE-Pim/Pi is split up in five different | 101 | KDE-Pim/Pi is split up in five different |
28 | packages now precompiled for Sharp Zaurus: | 102 | packages now precompiled for Sharp Zaurus: |
29 | --kmicrokdelibs_1.9.2_arm.ipk | 103 | --kmicrokdelibs_1.9.2_arm.ipk |
30 | The libs are needed for any | 104 | The libs are needed for any |
31 | of the following programs: | 105 | of the following programs: |
32 | --kaddressbook_1.9.2_arm.ipk | 106 | --kaddressbook_1.9.2_arm.ipk |
33 | --kmicromail_1.9.2_arm.ipk | 107 | --kmicromail_1.9.2_arm.ipk |
34 | --korganizer_1.9.2_arm.ipk | 108 | --korganizer_1.9.2_arm.ipk |
35 | Independ from that, there is the alarm applet | 109 | Independ from that, there is the alarm applet |
36 | available for KO/Pi, which also offers | 110 | available for KO/Pi, which also offers |
37 | quick access for a new mail or | 111 | quick access for a new mail or |
38 | showing the addressbook.: | 112 | showing the addressbook.: |
39 | --korganizer-alarm_1.9.2_arm.ipk | 113 | --korganizer-alarm_1.9.2_arm.ipk |
40 | Independend means, that the alarm applet | 114 | Independend means, that the alarm applet |
41 | does not need any of the libs or programs above to run. | 115 | does not need any of the libs or programs above to run. |
42 | But it would be quite useless without these programs. | 116 | But it would be quite useless without these programs. |
43 | NOTE: | 117 | NOTE: |
44 | If you get a | 118 | If you get a |
45 | "This application depends on other programs" | 119 | "This application depends on other programs" |
46 | during installation of | 120 | during installation of |
47 | --kmicrokdelibs_1.9.2_arm.ipk | 121 | --kmicrokdelibs_1.9.2_arm.ipk |
48 | you probably do not have to care about that. | 122 | you probably do not have to care about that. |
49 | kmicrokdelibs_1.9.2 will come with some | 123 | kmicrokdelibs_1.9.2 will come with some |
50 | resource plugins, which needs additional libraries. | 124 | resource plugins, which needs additional libraries. |
51 | (E.g. libopie1, if you want to use the | 125 | (E.g. libopie1, if you want to use the |
52 | opie resource connector in KA/Pi). | 126 | opie resource connector in KA/Pi). |
53 | If you do not have this libraries installed, | 127 | If you do not have this libraries installed, |
54 | you simply cannot use the resource. | 128 | you simply cannot use the resource. |
55 | To make it clear: | 129 | To make it clear: |
56 | If the libraries are missing, the applications | 130 | If the libraries are missing, the applications |
57 | using kmicrokdelibs will start, | 131 | using kmicrokdelibs will start, |
58 | because the resources are plugins. | 132 | because the resources are plugins. |
59 | 3) | 133 | 3) |
60 | KO/Pi and friends are now installable on SD-Card! | 134 | KO/Pi and friends are now installable on SD-Card! |
61 | It is recommended to install all libs and apps | 135 | It is recommended to install all libs and apps |
62 | on the SD card or all in the internal storage. | 136 | on the SD card or all in the internal storage. |
63 | There may be problems, if this is mixed. | 137 | There may be problems, if this is mixed. |
64 | 4) | 138 | 4) |
65 | Fixed two bugs in the alarm notification on Windows. | 139 | Fixed two bugs in the alarm notification on Windows. |
66 | 5) | 140 | 5) |
67 | Great improvement! | 141 | Great improvement! |
68 | KO/Pi uses now the latest version of libical. | 142 | KO/Pi uses now the latest version of libical. |
69 | Libical is the library which actually reads | 143 | Libical is the library which actually reads |
70 | the calendar files and extract the data from it. | 144 | the calendar files and extract the data from it. |
71 | With the old version, there were problems | 145 | With the old version, there were problems |
72 | (crashes or program hangs) when licical did read | 146 | (crashes or program hangs) when licical did read |
73 | files, which were not stored from KO/Pi. | 147 | files, which were not stored from KO/Pi. |
74 | I do not know, if the new libical works perfect, | 148 | I do not know, if the new libical works perfect, |
75 | but actually it works much better than | 149 | but actually it works much better than |
76 | the old version. | 150 | the old version. |
77 | There are no problems with compatibility with | 151 | There are no problems with compatibility with |
78 | old calendar files of KO/Pi, of course! | 152 | old calendar files of KO/Pi, of course! |
79 | 6) | 153 | 6) |
80 | New in KA/Pi: | 154 | New in KA/Pi: |
81 | Opie addressbook resource connector available! | 155 | Opie addressbook resource connector available! |
82 | You will need libopie1 and the opie addressbook, | 156 | You will need libopie1 and the opie addressbook, |
83 | of course. | 157 | of course. |
84 | With the Opie addressbook resource connector, | 158 | With the Opie addressbook resource connector, |
85 | you can access the Opie addressbook readonly in KA/Pi. | 159 | you can access the Opie addressbook readonly in KA/Pi. |
86 | If you want to edit or import the data into KA/Pi, | 160 | If you want to edit or import the data into KA/Pi, |
87 | do this: | 161 | do this: |
88 | a) Create an Opie resource. | 162 | a) Create an Opie resource. |
89 | (Menu: Settings-Configure Resources). | 163 | (Menu: Settings-Configure Resources). |
90 | After configuration and restarting KA/Pi you should see | 164 | After configuration and restarting KA/Pi you should see |
91 | the Opie contacts in KA/Pi. | 165 | the Opie contacts in KA/Pi. |
92 | b) Select some or all Opie contacts. | 166 | b) Select some or all Opie contacts. |
93 | (NOTE: +++++ | 167 | (NOTE: +++++ |
94 | To know exactly, what contacts are Opie contacts, | 168 | To know exactly, what contacts are Opie contacts, |
95 | do this: Choose menu: | 169 | do this: Choose menu: |
96 | View-Modify View - TAB Fields. | 170 | View-Modify View - TAB Fields. |
97 | Select in the above list "Resource" and click | 171 | Select in the above list "Resource" and click |
98 | down arrow to add it to the "Selected fields". | 172 | down arrow to add it to the "Selected fields". |
99 | Click OK. | 173 | Click OK. |
100 | Now you have a new column "Resource" in your list, | 174 | Now you have a new column "Resource" in your list, |
101 | where you can see, what an Opie resource is. | 175 | where you can see, what an Opie resource is. |
102 | ++++ NOTE end.) | 176 | ++++ NOTE end.) |
103 | Ok, we do have now some Opie contacts seleted. | 177 | Ok, we do have now some Opie contacts seleted. |
104 | (Use SHIFT or CTRL key in order to multiple select). | 178 | (Use SHIFT or CTRL key in order to multiple select). |
105 | c) Choose menu: Edit-Copy. | 179 | c) Choose menu: Edit-Copy. |
106 | d) Choose menu: Edit-Paste. | 180 | d) Choose menu: Edit-Paste. |
107 | e) Select the resource, you want to add the contacts to. | 181 | e) Select the resource, you want to add the contacts to. |
108 | Congrats! Now you have read/write access to the copied | 182 | Congrats! Now you have read/write access to the copied |
109 | opie contacts as "real" KA/Pi contacts. | 183 | opie contacts as "real" KA/Pi contacts. |
110 | 184 | ||
111 | 185 | ||
112 | ********** VERSION 1.9.1 ************ | 186 | ********** VERSION 1.9.1 ************ |
113 | 1) | 187 | 1) |
114 | +++ IMPORTANT 1 +++ | 188 | +++ IMPORTANT 1 +++ |
115 | 189 | ||
116 | The storing place of the default calendar | 190 | The storing place of the default calendar |
117 | file has changed! | 191 | file has changed! |
118 | The default calendar file was | 192 | The default calendar file was |
119 | Applications/korganizer/mycalendar.ics | 193 | Applications/korganizer/mycalendar.ics |
120 | on Zaurus and | 194 | on Zaurus and |
121 | (yourHomeDir)/korganizer/mycalendar.ics | 195 | (yourHomeDir)/korganizer/mycalendar.ics |
122 | on Windows/Linux desktop. Now it is | 196 | on Windows/Linux desktop. Now it is |
123 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics | 197 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics |
124 | on Zaurus, Windows and Linux. | 198 | on Zaurus, Windows and Linux. |
125 | To load the old file, choose menu | 199 | To load the old file, choose menu |
126 | File-Load calendar backup. | 200 | File-Load calendar backup. |
127 | (It should be loaded automatically | 201 | (It should be loaded automatically |
128 | at startup with a warning message displayed). | 202 | at startup with a warning message displayed). |
129 | The place of the configuration file has changed too. | 203 | The place of the configuration file has changed too. |
130 | If you want to use your old KO/Pi config, | 204 | If you want to use your old KO/Pi config, |
131 | copy it to | 205 | copy it to |
132 | (yourHomeDir)/kdepim/config/korganizerrc | 206 | (yourHomeDir)/kdepim/config/korganizerrc |
133 | Please read VERSION 1.9.0 - topic 3) as well! | 207 | Please read VERSION 1.9.0 - topic 3) as well! |
134 | 208 | ||
135 | +++ IMPORTANT 2 +++ | 209 | +++ IMPORTANT 2 +++ |
136 | 210 | ||
137 | Because of the new paths, you will need | 211 | Because of the new paths, you will need |
138 | a new version of the KO/Pi alarm applet | 212 | a new version of the KO/Pi alarm applet |
139 | for Zaurus. | 213 | for Zaurus. |
140 | Use version >= 1.9.1 | 214 | Use version >= 1.9.1 |
141 | 215 | ||
142 | 2) | 216 | 2) |
143 | Now the QWhat'sThis Icon works for items | 217 | Now the QWhat'sThis Icon works for items |
144 | in the month view as well. | 218 | in the month view as well. |
145 | (See VERSION 1.7.8 Topic 1) ). | 219 | (See VERSION 1.7.8 Topic 1) ). |
146 | 3) | 220 | 3) |
147 | You can import birtsdays/anniversaries | 221 | You can import birtsdays/anniversaries |
148 | from KA/Pi into KO/Pi. | 222 | from KA/Pi into KO/Pi. |
149 | Choose menu File-Import birthdays. | 223 | Choose menu File-Import birthdays. |
150 | If you import twice, already imported items | 224 | If you import twice, already imported items |
151 | will not be imported again, if they | 225 | will not be imported again, if they |
152 | have not been changed in KO/Pi. | 226 | have not been changed in KO/Pi. |
153 | 4) | 227 | 4) |
154 | When syncing with sharp DTM, now a progress | 228 | When syncing with sharp DTM, now a progress |
155 | is shown, when the data is written back. | 229 | is shown, when the data is written back. |
156 | If there is much data in KO/Pi and no data | 230 | If there is much data in KO/Pi and no data |
157 | in DTM, that can take a long time. | 231 | in DTM, that can take a long time. |
158 | (But only for the first time ). | 232 | (But only for the first time ). |
159 | 5) | 233 | 5) |
160 | In the search dialog, you can search | 234 | In the search dialog, you can search |
161 | now for the name/email of an attendee | 235 | now for the name/email of an attendee |
162 | of an event/todo. | 236 | of an event/todo. |
163 | To get more space for displaying | 237 | To get more space for displaying |
164 | search results, the buttons | 238 | search results, the buttons |
165 | for "search" and "close" on the | 239 | for "search" and "close" on the |
166 | bottom are removed in the PDA version. | 240 | bottom are removed in the PDA version. |
167 | You have to click OK in the top right | 241 | You have to click OK in the top right |
168 | corner to do a search. | 242 | corner to do a search. |
169 | 6) | 243 | 6) |
170 | Now it is possible to disable the displaying | 244 | Now it is possible to disable the displaying |
171 | of todo items in the Allday part of the Agenda. | 245 | of todo items in the Allday part of the Agenda. |
172 | Choose Menu Action-Configure, | 246 | Choose Menu Action-Configure, |
173 | TAB Todo View, checkbox | 247 | TAB Todo View, checkbox |
174 | "Allday Agenda view shows todos" | 248 | "Allday Agenda view shows todos" |
175 | 7) | 249 | 7) |
176 | If FastLoad is enabled, now the settings and the | 250 | If FastLoad is enabled, now the settings and the |
177 | calendar data are saved, when KO/Pi is closed. | 251 | calendar data are saved, when KO/Pi is closed. |
178 | (If no Fastload is enabled, KO/Pi saves | 252 | (If no Fastload is enabled, KO/Pi saves |
179 | the data as well, of course) | 253 | the data as well, of course) |
180 | 8) | 254 | 8) |
181 | The Agenda View has a minimize-splitter now, | 255 | The Agenda View has a minimize-splitter now, |
182 | such that the height of the allday part can be | 256 | such that the height of the allday part can be |
183 | changed quickly. | 257 | changed quickly. |
184 | 258 | ||
185 | ********** VERSION 1.9.0 ************ | 259 | ********** VERSION 1.9.0 ************ |
186 | 1) | 260 | 1) |
187 | KO/Pi is now merged with the new microKDE from KA/Pi. | 261 | KO/Pi is now merged with the new microKDE from KA/Pi. |
188 | KO/Pi accesses now KA/Pi as the addressbook. | 262 | KO/Pi accesses now KA/Pi as the addressbook. |
189 | The other ddressbook-plugins are not working any longer. | 263 | The other ddressbook-plugins are not working any longer. |
190 | (It is planned, that later KA/Pi itself uses these plugins) | 264 | (It is planned, that later KA/Pi itself uses these plugins) |
191 | New versions of KO/Pi are only available | 265 | New versions of KO/Pi are only available |
192 | together with KA/Pi as the KDE-Pim/Pi package. | 266 | together with KA/Pi as the KDE-Pim/Pi package. |
193 | 2) | 267 | 2) |
194 | If you click on an attendee of a meeting in the | 268 | If you click on an attendee of a meeting in the |
195 | event viewer, a detailed summary of the | 269 | event viewer, a detailed summary of the |
196 | attendee is shown. | 270 | attendee is shown. |
197 | 3) | 271 | 3) |
198 | The place of the configuration file has changed. | 272 | The place of the configuration file has changed. |
199 | If you want to use your old KO/Pi config, copy | 273 | If you want to use your old KO/Pi config, copy |
200 | Applications/korganizer/config_korganizerrc | 274 | Applications/korganizer/config_korganizerrc |
201 | to | 275 | to |
202 | Applications/korganizer/config/korganizerrc | 276 | Applications/korganizer/config/korganizerrc |
203 | 277 | ||
204 | ********** VERSION 1.7.8 ************ | 278 | ********** VERSION 1.7.8 ************ |
205 | 1) | 279 | 1) |
206 | Now the QWhat'sThis ist working. | 280 | Now the QWhat'sThis ist working. |
207 | Enable the QWhat'sThis icon in the toolbar. | 281 | Enable the QWhat'sThis icon in the toolbar. |
208 | (You have to restart to reload the changed toolbar config). | 282 | (You have to restart to reload the changed toolbar config). |
209 | Now click on the QWhat'sThis Icon | 283 | Now click on the QWhat'sThis Icon |
210 | in the top right corner of KO/Pi. | 284 | in the top right corner of KO/Pi. |
211 | Then click on an item in the Agenda View: | 285 | Then click on an item in the Agenda View: |
212 | You will get a detailed display of the items content. | 286 | You will get a detailed display of the items content. |
213 | 2) | 287 | 2) |
214 | Some other very minor changes. | 288 | Some other very minor changes. |
215 | But I have forgotten the details ... | 289 | But I have forgotten the details ... |
216 | For that reason I start this log here: | 290 | For that reason I start this log here: |
217 | To document my changes, when I am doing it. | 291 | To document my changes, when I am doing it. |
218 | 292 | ||
219 | ********** VERSION 1.7.7 ************ | 293 | ********** VERSION 1.7.7 ************ |
220 | Stable Version of KO/Pi \ No newline at end of file | 294 | Stable Version of KO/Pi \ No newline at end of file |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 74e5cf7..1a1bcff 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,1078 +1,1086 @@ | |||
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | 35 | ||
36 | #ifndef KAB_EMBEDDED | 36 | #ifndef KAB_EMBEDDED |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qapplicaton.h> | 40 | #include <qapplicaton.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qvbox.h> | 43 | #include <qvbox.h> |
44 | #include <kabc/addresseelist.h> | 44 | #include <kabc/addresseelist.h> |
45 | #include <kabc/errorhandler.h> | 45 | #include <kabc/errorhandler.h> |
46 | #include <kabc/resource.h> | 46 | #include <kabc/resource.h> |
47 | #include <kabc/vcardconverter.h> | 47 | #include <kabc/vcardconverter.h> |
48 | #include <kapplication.h> | 48 | #include <kapplication.h> |
49 | #include <kactionclasses.h> | 49 | #include <kactionclasses.h> |
50 | #include <kcmultidialog.h> | 50 | #include <kcmultidialog.h> |
51 | #include <kdebug.h> | 51 | #include <kdebug.h> |
52 | #include <kdeversion.h> | 52 | #include <kdeversion.h> |
53 | #include <kkeydialog.h> | 53 | #include <kkeydialog.h> |
54 | #include <kmessagebox.h> | 54 | #include <kmessagebox.h> |
55 | #include <kprinter.h> | 55 | #include <kprinter.h> |
56 | #include <kprotocolinfo.h> | 56 | #include <kprotocolinfo.h> |
57 | #include <kresources/selectdialog.h> | 57 | #include <kresources/selectdialog.h> |
58 | #include <kstandarddirs.h> | 58 | #include <kstandarddirs.h> |
59 | #include <ktempfile.h> | 59 | #include <ktempfile.h> |
60 | #include <kxmlguiclient.h> | 60 | #include <kxmlguiclient.h> |
61 | #include <kaboutdata.h> | 61 | #include <kaboutdata.h> |
62 | #include <libkdepim/categoryselectdialog.h> | 62 | #include <libkdepim/categoryselectdialog.h> |
63 | 63 | ||
64 | #include "addresseeutil.h" | 64 | #include "addresseeutil.h" |
65 | #include "addresseeeditordialog.h" | 65 | #include "addresseeeditordialog.h" |
66 | #include "extensionmanager.h" | 66 | #include "extensionmanager.h" |
67 | #include "kstdaction.h" | 67 | #include "kstdaction.h" |
68 | #include "kaddressbookservice.h" | 68 | #include "kaddressbookservice.h" |
69 | #include "ldapsearchdialog.h" | 69 | #include "ldapsearchdialog.h" |
70 | #include "printing/printingwizard.h" | 70 | #include "printing/printingwizard.h" |
71 | #else // KAB_EMBEDDED | 71 | #else // KAB_EMBEDDED |
72 | 72 | ||
73 | #include <kapplication.h> | 73 | #include <kapplication.h> |
74 | #include "KDGanttMinimizeSplitter.h" | 74 | #include "KDGanttMinimizeSplitter.h" |
75 | #include "kaddressbookmain.h" | 75 | #include "kaddressbookmain.h" |
76 | #include "kactioncollection.h" | 76 | #include "kactioncollection.h" |
77 | #include "addresseedialog.h" | 77 | #include "addresseedialog.h" |
78 | //US | 78 | //US |
79 | #include <libkdepim/addresseeview.h> | 79 | #include <libkdepim/addresseeview.h> |
80 | 80 | ||
81 | #include <qapp.h> | 81 | #include <qapp.h> |
82 | #include <qmenubar.h> | 82 | #include <qmenubar.h> |
83 | //#include <qtoolbar.h> | 83 | //#include <qtoolbar.h> |
84 | #include <qmessagebox.h> | 84 | #include <qmessagebox.h> |
85 | #include <kdebug.h> | 85 | #include <kdebug.h> |
86 | #include <kiconloader.h> // needed for SmallIcon | 86 | #include <kiconloader.h> // needed for SmallIcon |
87 | #include <kresources/kcmkresources.h> | 87 | #include <kresources/kcmkresources.h> |
88 | #include <ktoolbar.h> | 88 | #include <ktoolbar.h> |
89 | 89 | ||
90 | 90 | ||
91 | //#include <qlabel.h> | 91 | //#include <qlabel.h> |
92 | 92 | ||
93 | 93 | ||
94 | #ifndef DESKTOP_VERSION | 94 | #ifndef DESKTOP_VERSION |
95 | #include <qpe/ir.h> | 95 | #include <qpe/ir.h> |
96 | #include <qtopia/qcopenvelope_qws.h> | 96 | #include <qtopia/qcopenvelope_qws.h> |
97 | #else | 97 | #else |
98 | 98 | ||
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | #endif // KAB_EMBEDDED | 101 | #endif // KAB_EMBEDDED |
102 | #include "kcmconfigs/kcmkabconfig.h" | 102 | #include "kcmconfigs/kcmkabconfig.h" |
103 | #include "kcmconfigs/kcmkdepimconfig.h" | 103 | #include "kcmconfigs/kcmkdepimconfig.h" |
104 | #include "kpimglobalprefs.h" | 104 | #include "kpimglobalprefs.h" |
105 | #include "externalapphandler.h" | 105 | #include "externalapphandler.h" |
106 | 106 | ||
107 | 107 | ||
108 | #include <kresources/selectdialog.h> | 108 | #include <kresources/selectdialog.h> |
109 | #include <kmessagebox.h> | 109 | #include <kmessagebox.h> |
110 | 110 | ||
111 | #include <picture.h> | 111 | #include <picture.h> |
112 | #include <resource.h> | 112 | #include <resource.h> |
113 | 113 | ||
114 | //US#include <qsplitter.h> | 114 | //US#include <qsplitter.h> |
115 | #include <qmap.h> | 115 | #include <qmap.h> |
116 | #include <qdir.h> | 116 | #include <qdir.h> |
117 | #include <qfile.h> | 117 | #include <qfile.h> |
118 | #include <qvbox.h> | 118 | #include <qvbox.h> |
119 | #include <qlayout.h> | 119 | #include <qlayout.h> |
120 | #include <qclipboard.h> | 120 | #include <qclipboard.h> |
121 | #include <qtextstream.h> | 121 | #include <qtextstream.h> |
122 | 122 | ||
123 | #include <libkdepim/categoryselectdialog.h> | 123 | #include <libkdepim/categoryselectdialog.h> |
124 | #include <kabc/vcardconverter.h> | 124 | #include <kabc/vcardconverter.h> |
125 | 125 | ||
126 | 126 | ||
127 | #include "addresseeutil.h" | 127 | #include "addresseeutil.h" |
128 | #include "undocmds.h" | 128 | #include "undocmds.h" |
129 | #include "addresseeeditordialog.h" | 129 | #include "addresseeeditordialog.h" |
130 | #include "viewmanager.h" | 130 | #include "viewmanager.h" |
131 | #include "details/detailsviewcontainer.h" | 131 | #include "details/detailsviewcontainer.h" |
132 | #include "kabprefs.h" | 132 | #include "kabprefs.h" |
133 | #include "xxportmanager.h" | 133 | #include "xxportmanager.h" |
134 | #include "incsearchwidget.h" | 134 | #include "incsearchwidget.h" |
135 | #include "jumpbuttonbar.h" | 135 | #include "jumpbuttonbar.h" |
136 | #include "extensionmanager.h" | 136 | #include "extensionmanager.h" |
137 | #include "addresseeconfig.h" | 137 | #include "addresseeconfig.h" |
138 | #include <kcmultidialog.h> | 138 | #include <kcmultidialog.h> |
139 | 139 | ||
140 | #ifdef _WIN32_ | 140 | #ifdef _WIN32_ |
141 | 141 | ||
142 | #include "kaimportoldialog.h" | 142 | #include "kaimportoldialog.h" |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | bool pasteWithNewUid = true; | 145 | bool pasteWithNewUid = true; |
146 | 146 | ||
147 | #ifdef KAB_EMBEDDED | 147 | #ifdef KAB_EMBEDDED |
148 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 148 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
149 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 149 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
150 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 150 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
151 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 151 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
152 | #else //KAB_EMBEDDED | 152 | #else //KAB_EMBEDDED |
153 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 153 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
154 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 154 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
155 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 155 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
156 | mReadWrite( readWrite ), mModified( false ) | 156 | mReadWrite( readWrite ), mModified( false ) |
157 | #endif //KAB_EMBEDDED | 157 | #endif //KAB_EMBEDDED |
158 | { | 158 | { |
159 | 159 | ||
160 | mExtensionBarSplitter = 0; | 160 | mExtensionBarSplitter = 0; |
161 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 161 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
162 | 162 | ||
163 | mAddressBook = KABC::StdAddressBook::self(); | 163 | mAddressBook = KABC::StdAddressBook::self(); |
164 | KABC::StdAddressBook::setAutomaticSave( false ); | 164 | KABC::StdAddressBook::setAutomaticSave( false ); |
165 | 165 | ||
166 | #ifndef KAB_EMBEDDED | 166 | #ifndef KAB_EMBEDDED |
167 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 167 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
168 | #endif //KAB_EMBEDDED | 168 | #endif //KAB_EMBEDDED |
169 | 169 | ||
170 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 170 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
171 | SLOT( addressBookChanged() ) ); | 171 | SLOT( addressBookChanged() ) ); |
172 | 172 | ||
173 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 173 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
174 | "X-Department", "KADDRESSBOOK" ); | 174 | "X-Department", "KADDRESSBOOK" ); |
175 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 175 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
176 | "X-Profession", "KADDRESSBOOK" ); | 176 | "X-Profession", "KADDRESSBOOK" ); |
177 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 177 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
178 | "X-AssistantsName", "KADDRESSBOOK" ); | 178 | "X-AssistantsName", "KADDRESSBOOK" ); |
179 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 179 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
180 | "X-ManagersName", "KADDRESSBOOK" ); | 180 | "X-ManagersName", "KADDRESSBOOK" ); |
181 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 181 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
182 | "X-SpousesName", "KADDRESSBOOK" ); | 182 | "X-SpousesName", "KADDRESSBOOK" ); |
183 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 183 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
184 | "X-Office", "KADDRESSBOOK" ); | 184 | "X-Office", "KADDRESSBOOK" ); |
185 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 185 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
186 | "X-IMAddress", "KADDRESSBOOK" ); | 186 | "X-IMAddress", "KADDRESSBOOK" ); |
187 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 187 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
188 | "X-Anniversary", "KADDRESSBOOK" ); | 188 | "X-Anniversary", "KADDRESSBOOK" ); |
189 | 189 | ||
190 | //US added this field to become compatible with Opie/qtopia addressbook | 190 | //US added this field to become compatible with Opie/qtopia addressbook |
191 | // values can be "female" or "male" or "". An empty field represents undefined. | 191 | // values can be "female" or "male" or "". An empty field represents undefined. |
192 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 192 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
193 | "X-Gender", "KADDRESSBOOK" ); | 193 | "X-Gender", "KADDRESSBOOK" ); |
194 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 194 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
195 | "X-Children", "KADDRESSBOOK" ); | 195 | "X-Children", "KADDRESSBOOK" ); |
196 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 196 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
197 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 197 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
198 | 198 | ||
199 | initGUI(); | 199 | initGUI(); |
200 | 200 | ||
201 | mIncSearchWidget->setFocus(); | 201 | mIncSearchWidget->setFocus(); |
202 | 202 | ||
203 | 203 | ||
204 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 204 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
205 | SLOT( setContactSelected( const QString& ) ) ); | 205 | SLOT( setContactSelected( const QString& ) ) ); |
206 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 206 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
207 | SLOT( executeContact( const QString& ) ) ); | 207 | SLOT( executeContact( const QString& ) ) ); |
208 | 208 | ||
209 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 209 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
210 | SLOT( deleteContacts( ) ) ); | 210 | SLOT( deleteContacts( ) ) ); |
211 | connect( mViewManager, SIGNAL( modified() ), | 211 | connect( mViewManager, SIGNAL( modified() ), |
212 | SLOT( setModified() ) ); | 212 | SLOT( setModified() ) ); |
213 | 213 | ||
214 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 214 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
215 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 215 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
216 | 216 | ||
217 | connect( mXXPortManager, SIGNAL( modified() ), | 217 | connect( mXXPortManager, SIGNAL( modified() ), |
218 | SLOT( setModified() ) ); | 218 | SLOT( setModified() ) ); |
219 | 219 | ||
220 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 220 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
221 | SLOT( incrementalSearch( const QString& ) ) ); | 221 | SLOT( incrementalSearch( const QString& ) ) ); |
222 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 222 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
223 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 223 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
224 | 224 | ||
225 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 225 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
226 | SLOT( sendMail( const QString& ) ) ); | 226 | SLOT( sendMail( const QString& ) ) ); |
227 | 227 | ||
228 | 228 | ||
229 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 229 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
230 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 230 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
231 | 231 | ||
232 | 232 | ||
233 | #ifndef KAB_EMBEDDED | 233 | #ifndef KAB_EMBEDDED |
234 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 234 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
235 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 235 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
236 | 236 | ||
237 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 237 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
238 | SLOT( browse( const QString& ) ) ); | 238 | SLOT( browse( const QString& ) ) ); |
239 | 239 | ||
240 | 240 | ||
241 | mAddressBookService = new KAddressBookService( this ); | 241 | mAddressBookService = new KAddressBookService( this ); |
242 | 242 | ||
243 | #endif //KAB_EMBEDDED | 243 | #endif //KAB_EMBEDDED |
244 | mEditorDialog = 0; | 244 | mEditorDialog = 0; |
245 | createAddresseeEditorDialog( this ); | 245 | createAddresseeEditorDialog( this ); |
246 | setModified( false ); | 246 | setModified( false ); |
247 | } | 247 | } |
248 | 248 | ||
249 | KABCore::~KABCore() | 249 | KABCore::~KABCore() |
250 | { | 250 | { |
251 | // save(); | 251 | // save(); |
252 | //saveSettings(); | 252 | //saveSettings(); |
253 | //KABPrefs::instance()->writeConfig(); | 253 | //KABPrefs::instance()->writeConfig(); |
254 | delete AddresseeConfig::instance(); | 254 | delete AddresseeConfig::instance(); |
255 | mAddressBook = 0; | 255 | mAddressBook = 0; |
256 | KABC::StdAddressBook::close(); | 256 | KABC::StdAddressBook::close(); |
257 | } | 257 | } |
258 | 258 | ||
259 | void KABCore::restoreSettings() | 259 | void KABCore::restoreSettings() |
260 | { | 260 | { |
261 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 261 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
262 | 262 | ||
263 | bool state; | 263 | bool state; |
264 | 264 | ||
265 | if (mMultipleViewsAtOnce) | 265 | if (mMultipleViewsAtOnce) |
266 | state = KABPrefs::instance()->mDetailsPageVisible; | 266 | state = KABPrefs::instance()->mDetailsPageVisible; |
267 | else | 267 | else |
268 | state = false; | 268 | state = false; |
269 | 269 | ||
270 | mActionDetails->setChecked( state ); | 270 | mActionDetails->setChecked( state ); |
271 | setDetailsVisible( state ); | 271 | setDetailsVisible( state ); |
272 | 272 | ||
273 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 273 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
274 | 274 | ||
275 | mActionJumpBar->setChecked( state ); | 275 | mActionJumpBar->setChecked( state ); |
276 | setJumpButtonBarVisible( state ); | 276 | setJumpButtonBarVisible( state ); |
277 | /*US | 277 | /*US |
278 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 278 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
279 | if ( splitterSize.count() == 0 ) { | 279 | if ( splitterSize.count() == 0 ) { |
280 | splitterSize.append( width() / 2 ); | 280 | splitterSize.append( width() / 2 ); |
281 | splitterSize.append( width() / 2 ); | 281 | splitterSize.append( width() / 2 ); |
282 | } | 282 | } |
283 | mMiniSplitter->setSizes( splitterSize ); | 283 | mMiniSplitter->setSizes( splitterSize ); |
284 | if ( mExtensionBarSplitter ) { | 284 | if ( mExtensionBarSplitter ) { |
285 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 285 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
286 | if ( splitterSize.count() == 0 ) { | 286 | if ( splitterSize.count() == 0 ) { |
287 | splitterSize.append( width() / 2 ); | 287 | splitterSize.append( width() / 2 ); |
288 | splitterSize.append( width() / 2 ); | 288 | splitterSize.append( width() / 2 ); |
289 | } | 289 | } |
290 | mExtensionBarSplitter->setSizes( splitterSize ); | 290 | mExtensionBarSplitter->setSizes( splitterSize ); |
291 | 291 | ||
292 | } | 292 | } |
293 | */ | 293 | */ |
294 | mViewManager->restoreSettings(); | 294 | mViewManager->restoreSettings(); |
295 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 295 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
296 | mExtensionManager->restoreSettings(); | 296 | mExtensionManager->restoreSettings(); |
297 | 297 | #ifdef DESKTOP_VERSION | |
298 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 298 | int wid = width(); |
299 | if ( splitterSize.count() == 0 ) { | 299 | if ( wid < 10 ) |
300 | splitterSize.append( width() / 2 ); | 300 | wid = 400; |
301 | splitterSize.append( width() / 2 ); | 301 | #else |
302 | int wid = QApplication::desktop()->width(); | ||
303 | if ( wid < 640 ) | ||
304 | wid = QApplication::desktop()->height(); | ||
305 | #endif | ||
306 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | ||
307 | if ( true /*splitterSize.count() == 0*/ ) { | ||
308 | splitterSize.append( wid / 2 ); | ||
309 | splitterSize.append( wid / 2 ); | ||
302 | } | 310 | } |
303 | mMiniSplitter->setSizes( splitterSize ); | 311 | mMiniSplitter->setSizes( splitterSize ); |
304 | if ( mExtensionBarSplitter ) { | 312 | if ( mExtensionBarSplitter ) { |
305 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 313 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
306 | if ( splitterSize.count() == 0 ) { | 314 | if ( true /*splitterSize.count() == 0*/ ) { |
307 | splitterSize.append( width() / 2 ); | 315 | splitterSize.append( wid / 2 ); |
308 | splitterSize.append( width() / 2 ); | 316 | splitterSize.append( wid / 2 ); |
309 | } | 317 | } |
310 | mExtensionBarSplitter->setSizes( splitterSize ); | 318 | mExtensionBarSplitter->setSizes( splitterSize ); |
311 | 319 | ||
312 | } | 320 | } |
313 | 321 | ||
314 | 322 | ||
315 | } | 323 | } |
316 | 324 | ||
317 | void KABCore::saveSettings() | 325 | void KABCore::saveSettings() |
318 | { | 326 | { |
319 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 327 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
320 | if ( mExtensionBarSplitter ) | 328 | if ( mExtensionBarSplitter ) |
321 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 329 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
322 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 330 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
323 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 331 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
324 | #ifndef KAB_EMBEDDED | 332 | #ifndef KAB_EMBEDDED |
325 | 333 | ||
326 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 334 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
327 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 335 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
328 | #endif //KAB_EMBEDDED | 336 | #endif //KAB_EMBEDDED |
329 | mExtensionManager->saveSettings(); | 337 | mExtensionManager->saveSettings(); |
330 | mViewManager->saveSettings(); | 338 | mViewManager->saveSettings(); |
331 | 339 | ||
332 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 340 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
333 | } | 341 | } |
334 | 342 | ||
335 | KABC::AddressBook *KABCore::addressBook() const | 343 | KABC::AddressBook *KABCore::addressBook() const |
336 | { | 344 | { |
337 | return mAddressBook; | 345 | return mAddressBook; |
338 | } | 346 | } |
339 | 347 | ||
340 | KConfig *KABCore::config() | 348 | KConfig *KABCore::config() |
341 | { | 349 | { |
342 | #ifndef KAB_EMBEDDED | 350 | #ifndef KAB_EMBEDDED |
343 | return KABPrefs::instance()->config(); | 351 | return KABPrefs::instance()->config(); |
344 | #else //KAB_EMBEDDED | 352 | #else //KAB_EMBEDDED |
345 | return KABPrefs::instance()->getConfig(); | 353 | return KABPrefs::instance()->getConfig(); |
346 | #endif //KAB_EMBEDDED | 354 | #endif //KAB_EMBEDDED |
347 | } | 355 | } |
348 | 356 | ||
349 | KActionCollection *KABCore::actionCollection() const | 357 | KActionCollection *KABCore::actionCollection() const |
350 | { | 358 | { |
351 | return mGUIClient->actionCollection(); | 359 | return mGUIClient->actionCollection(); |
352 | } | 360 | } |
353 | 361 | ||
354 | KABC::Field *KABCore::currentSearchField() const | 362 | KABC::Field *KABCore::currentSearchField() const |
355 | { | 363 | { |
356 | if (mIncSearchWidget) | 364 | if (mIncSearchWidget) |
357 | return mIncSearchWidget->currentField(); | 365 | return mIncSearchWidget->currentField(); |
358 | else | 366 | else |
359 | return 0; | 367 | return 0; |
360 | } | 368 | } |
361 | 369 | ||
362 | QStringList KABCore::selectedUIDs() const | 370 | QStringList KABCore::selectedUIDs() const |
363 | { | 371 | { |
364 | return mViewManager->selectedUids(); | 372 | return mViewManager->selectedUids(); |
365 | } | 373 | } |
366 | 374 | ||
367 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 375 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
368 | { | 376 | { |
369 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 377 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
370 | 378 | ||
371 | QPtrList<KRES::Resource> kresResources; | 379 | QPtrList<KRES::Resource> kresResources; |
372 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 380 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
373 | KABC::Resource *resource; | 381 | KABC::Resource *resource; |
374 | while ( ( resource = resIt.current() ) != 0 ) { | 382 | while ( ( resource = resIt.current() ) != 0 ) { |
375 | ++resIt; | 383 | ++resIt; |
376 | if ( !resource->readOnly() ) { | 384 | if ( !resource->readOnly() ) { |
377 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 385 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
378 | if ( res ) | 386 | if ( res ) |
379 | kresResources.append( res ); | 387 | kresResources.append( res ); |
380 | } | 388 | } |
381 | } | 389 | } |
382 | 390 | ||
383 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 391 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
384 | return static_cast<KABC::Resource*>( res ); | 392 | return static_cast<KABC::Resource*>( res ); |
385 | } | 393 | } |
386 | 394 | ||
387 | #ifndef KAB_EMBEDDED | 395 | #ifndef KAB_EMBEDDED |
388 | KAboutData *KABCore::createAboutData() | 396 | KAboutData *KABCore::createAboutData() |
389 | #else //KAB_EMBEDDED | 397 | #else //KAB_EMBEDDED |
390 | void KABCore::createAboutData() | 398 | void KABCore::createAboutData() |
391 | #endif //KAB_EMBEDDED | 399 | #endif //KAB_EMBEDDED |
392 | { | 400 | { |
393 | #ifndef KAB_EMBEDDED | 401 | #ifndef KAB_EMBEDDED |
394 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 402 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
395 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 403 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
396 | KAboutData::License_GPL_V2, | 404 | KAboutData::License_GPL_V2, |
397 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 405 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
398 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 406 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
399 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 407 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
400 | about->addAuthor( "Cornelius Schumacher", | 408 | about->addAuthor( "Cornelius Schumacher", |
401 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 409 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
402 | "schumacher@kde.org" ); | 410 | "schumacher@kde.org" ); |
403 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 411 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
404 | "mpilone@slac.com" ); | 412 | "mpilone@slac.com" ); |
405 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 413 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
406 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 414 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
407 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 415 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
408 | "michel@klaralvdalens-datakonsult.se" ); | 416 | "michel@klaralvdalens-datakonsult.se" ); |
409 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 417 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
410 | "hansen@kde.org" ); | 418 | "hansen@kde.org" ); |
411 | 419 | ||
412 | return about; | 420 | return about; |
413 | #endif //KAB_EMBEDDED | 421 | #endif //KAB_EMBEDDED |
414 | 422 | ||
415 | QString version; | 423 | QString version; |
416 | #include <../version> | 424 | #include <../version> |
417 | QMessageBox::about( this, "About KAddressbook/Pi", | 425 | QMessageBox::about( this, "About KAddressbook/Pi", |
418 | "KAddressbook/Platform-independent\n" | 426 | "KAddressbook/Platform-independent\n" |
419 | "(KA/Pi) " +version + " - " + | 427 | "(KA/Pi) " +version + " - " + |
420 | #ifdef DESKTOP_VERSION | 428 | #ifdef DESKTOP_VERSION |
421 | "Desktop Edition\n" | 429 | "Desktop Edition\n" |
422 | #else | 430 | #else |
423 | "PDA-Edition\n" | 431 | "PDA-Edition\n" |
424 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 432 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
425 | #endif | 433 | #endif |
426 | 434 | ||
427 | "(c) 2004 Ulf Schenk\n" | 435 | "(c) 2004 Ulf Schenk\n" |
428 | "(c) 2004 Lutz Rogowski\n" | 436 | "(c) 2004 Lutz Rogowski\n" |
429 | "(c) 1997-2003, The KDE PIM Team\n" | 437 | "(c) 1997-2003, The KDE PIM Team\n" |
430 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 438 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
431 | "Don Sanders Original author\n" | 439 | "Don Sanders Original author\n" |
432 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 440 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
433 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 441 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
434 | "Greg Stern DCOP interface\n" | 442 | "Greg Stern DCOP interface\n" |
435 | "Mark Westcot Contact pinning\n" | 443 | "Mark Westcot Contact pinning\n" |
436 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 444 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
437 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 445 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
438 | #ifdef _WIN32_ | 446 | #ifdef _WIN32_ |
439 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 447 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
440 | #endif | 448 | #endif |
441 | ); | 449 | ); |
442 | } | 450 | } |
443 | 451 | ||
444 | void KABCore::setContactSelected( const QString &uid ) | 452 | void KABCore::setContactSelected( const QString &uid ) |
445 | { | 453 | { |
446 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 454 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
447 | if ( !mDetails->isHidden() ) | 455 | if ( !mDetails->isHidden() ) |
448 | mDetails->setAddressee( addr ); | 456 | mDetails->setAddressee( addr ); |
449 | 457 | ||
450 | if ( !addr.isEmpty() ) { | 458 | if ( !addr.isEmpty() ) { |
451 | emit contactSelected( addr.formattedName() ); | 459 | emit contactSelected( addr.formattedName() ); |
452 | KABC::Picture pic = addr.photo(); | 460 | KABC::Picture pic = addr.photo(); |
453 | if ( pic.isIntern() ) { | 461 | if ( pic.isIntern() ) { |
454 | //US emit contactSelected( pic.data() ); | 462 | //US emit contactSelected( pic.data() ); |
455 | //US instead use: | 463 | //US instead use: |
456 | QPixmap px; | 464 | QPixmap px; |
457 | if (pic.data().isNull() != true) | 465 | if (pic.data().isNull() != true) |
458 | { | 466 | { |
459 | px.convertFromImage(pic.data()); | 467 | px.convertFromImage(pic.data()); |
460 | } | 468 | } |
461 | 469 | ||
462 | emit contactSelected( px ); | 470 | emit contactSelected( px ); |
463 | } | 471 | } |
464 | } | 472 | } |
465 | 473 | ||
466 | 474 | ||
467 | mExtensionManager->setSelectionChanged(); | 475 | mExtensionManager->setSelectionChanged(); |
468 | 476 | ||
469 | // update the actions | 477 | // update the actions |
470 | bool selected = !uid.isEmpty(); | 478 | bool selected = !uid.isEmpty(); |
471 | 479 | ||
472 | if ( mReadWrite ) { | 480 | if ( mReadWrite ) { |
473 | mActionCut->setEnabled( selected ); | 481 | mActionCut->setEnabled( selected ); |
474 | mActionPaste->setEnabled( selected ); | 482 | mActionPaste->setEnabled( selected ); |
475 | } | 483 | } |
476 | 484 | ||
477 | mActionCopy->setEnabled( selected ); | 485 | mActionCopy->setEnabled( selected ); |
478 | mActionDelete->setEnabled( selected ); | 486 | mActionDelete->setEnabled( selected ); |
479 | mActionEditAddressee->setEnabled( selected ); | 487 | mActionEditAddressee->setEnabled( selected ); |
480 | mActionMail->setEnabled( selected ); | 488 | mActionMail->setEnabled( selected ); |
481 | mActionMailVCard->setEnabled( selected ); | 489 | mActionMailVCard->setEnabled( selected ); |
482 | //if (mActionBeam) | 490 | //if (mActionBeam) |
483 | //mActionBeam->setEnabled( selected ); | 491 | //mActionBeam->setEnabled( selected ); |
484 | 492 | ||
485 | if (mActionBeamVCard) | 493 | if (mActionBeamVCard) |
486 | mActionBeamVCard->setEnabled( selected ); | 494 | mActionBeamVCard->setEnabled( selected ); |
487 | 495 | ||
488 | mActionWhoAmI->setEnabled( selected ); | 496 | mActionWhoAmI->setEnabled( selected ); |
489 | mActionCategories->setEnabled( selected ); | 497 | mActionCategories->setEnabled( selected ); |
490 | } | 498 | } |
491 | 499 | ||
492 | void KABCore::sendMail() | 500 | void KABCore::sendMail() |
493 | { | 501 | { |
494 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 502 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
495 | } | 503 | } |
496 | 504 | ||
497 | void KABCore::sendMail( const QString& emaillist ) | 505 | void KABCore::sendMail( const QString& emaillist ) |
498 | { | 506 | { |
499 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 507 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
500 | if (emaillist.contains(",") > 0) | 508 | if (emaillist.contains(",") > 0) |
501 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 509 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
502 | else | 510 | else |
503 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 511 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
504 | } | 512 | } |
505 | 513 | ||
506 | 514 | ||
507 | 515 | ||
508 | void KABCore::mailVCard() | 516 | void KABCore::mailVCard() |
509 | { | 517 | { |
510 | QStringList uids = mViewManager->selectedUids(); | 518 | QStringList uids = mViewManager->selectedUids(); |
511 | if ( !uids.isEmpty() ) | 519 | if ( !uids.isEmpty() ) |
512 | mailVCard( uids ); | 520 | mailVCard( uids ); |
513 | } | 521 | } |
514 | 522 | ||
515 | void KABCore::mailVCard( const QStringList& uids ) | 523 | void KABCore::mailVCard( const QStringList& uids ) |
516 | { | 524 | { |
517 | QStringList urls; | 525 | QStringList urls; |
518 | 526 | ||
519 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 527 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
520 | 528 | ||
521 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 529 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
522 | 530 | ||
523 | 531 | ||
524 | 532 | ||
525 | QDir().mkdir( dirName, true ); | 533 | QDir().mkdir( dirName, true ); |
526 | 534 | ||
527 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 535 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
528 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 536 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
529 | 537 | ||
530 | if ( a.isEmpty() ) | 538 | if ( a.isEmpty() ) |
531 | continue; | 539 | continue; |
532 | 540 | ||
533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 541 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
534 | 542 | ||
535 | QString fileName = dirName + "/" + name; | 543 | QString fileName = dirName + "/" + name; |
536 | 544 | ||
537 | QFile outFile(fileName); | 545 | QFile outFile(fileName); |
538 | 546 | ||
539 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 547 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
540 | KABC::VCardConverter converter; | 548 | KABC::VCardConverter converter; |
541 | QString vcard; | 549 | QString vcard; |
542 | 550 | ||
543 | converter.addresseeToVCard( a, vcard ); | 551 | converter.addresseeToVCard( a, vcard ); |
544 | 552 | ||
545 | QTextStream t( &outFile ); // use a text stream | 553 | QTextStream t( &outFile ); // use a text stream |
546 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 554 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
547 | t << vcard; | 555 | t << vcard; |
548 | 556 | ||
549 | outFile.close(); | 557 | outFile.close(); |
550 | 558 | ||
551 | urls.append( fileName ); | 559 | urls.append( fileName ); |
552 | } | 560 | } |
553 | } | 561 | } |
554 | 562 | ||
555 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 563 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
556 | 564 | ||
557 | 565 | ||
558 | /*US | 566 | /*US |
559 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 567 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
560 | QString::null, // subject | 568 | QString::null, // subject |
561 | QString::null, // body | 569 | QString::null, // body |
562 | QString::null, | 570 | QString::null, |
563 | urls ); // attachments | 571 | urls ); // attachments |
564 | */ | 572 | */ |
565 | 573 | ||
566 | } | 574 | } |
567 | 575 | ||
568 | /** | 576 | /** |
569 | Beams the "WhoAmI contact. | 577 | Beams the "WhoAmI contact. |
570 | */ | 578 | */ |
571 | void KABCore::beamMySelf() | 579 | void KABCore::beamMySelf() |
572 | { | 580 | { |
573 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 581 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
574 | if (!a.isEmpty()) | 582 | if (!a.isEmpty()) |
575 | { | 583 | { |
576 | QStringList uids; | 584 | QStringList uids; |
577 | uids << a.uid(); | 585 | uids << a.uid(); |
578 | 586 | ||
579 | beamVCard(uids); | 587 | beamVCard(uids); |
580 | } else { | 588 | } else { |
581 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 589 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
582 | 590 | ||
583 | 591 | ||
584 | } | 592 | } |
585 | } | 593 | } |
586 | 594 | ||
587 | void KABCore::beamVCard() | 595 | void KABCore::beamVCard() |
588 | { | 596 | { |
589 | QStringList uids = mViewManager->selectedUids(); | 597 | QStringList uids = mViewManager->selectedUids(); |
590 | if ( !uids.isEmpty() ) | 598 | if ( !uids.isEmpty() ) |
591 | beamVCard( uids ); | 599 | beamVCard( uids ); |
592 | } | 600 | } |
593 | 601 | ||
594 | 602 | ||
595 | void KABCore::beamVCard(const QStringList& uids) | 603 | void KABCore::beamVCard(const QStringList& uids) |
596 | { | 604 | { |
597 | /*US | 605 | /*US |
598 | QString beamFilename; | 606 | QString beamFilename; |
599 | Opie::OPimContact c; | 607 | Opie::OPimContact c; |
600 | if ( actionPersonal->isOn() ) { | 608 | if ( actionPersonal->isOn() ) { |
601 | beamFilename = addressbookPersonalVCardName(); | 609 | beamFilename = addressbookPersonalVCardName(); |
602 | if ( !QFile::exists( beamFilename ) ) | 610 | if ( !QFile::exists( beamFilename ) ) |
603 | return; // can't beam a non-existent file | 611 | return; // can't beam a non-existent file |
604 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 612 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
605 | beamFilename ); | 613 | beamFilename ); |
606 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 614 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
607 | Opie::OPimContactAccess::List allList = access->allRecords(); | 615 | Opie::OPimContactAccess::List allList = access->allRecords(); |
608 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 616 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
609 | c = *it; | 617 | c = *it; |
610 | 618 | ||
611 | delete access; | 619 | delete access; |
612 | } else { | 620 | } else { |
613 | unlink( beamfile ); // delete if exists | 621 | unlink( beamfile ); // delete if exists |
614 | mkdir("/tmp/obex/", 0755); | 622 | mkdir("/tmp/obex/", 0755); |
615 | c = m_abView -> currentEntry(); | 623 | c = m_abView -> currentEntry(); |
616 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 624 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
617 | beamfile ); | 625 | beamfile ); |
618 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 626 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
619 | access->add( c ); | 627 | access->add( c ); |
620 | access->save(); | 628 | access->save(); |
621 | delete access; | 629 | delete access; |
622 | 630 | ||
623 | beamFilename = beamfile; | 631 | beamFilename = beamfile; |
624 | } | 632 | } |
625 | 633 | ||
626 | owarn << "Beaming: " << beamFilename << oendl; | 634 | owarn << "Beaming: " << beamFilename << oendl; |
627 | */ | 635 | */ |
628 | 636 | ||
629 | #if 0 | 637 | #if 0 |
630 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 638 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
631 | 639 | ||
632 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 640 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
633 | 641 | ||
634 | QString name = "contact.vcf"; | 642 | QString name = "contact.vcf"; |
635 | 643 | ||
636 | QString fileName = dirName + "/" + name; | 644 | QString fileName = dirName + "/" + name; |
637 | #endif | 645 | #endif |
638 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | 646 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory |
639 | // | 647 | // |
640 | QString fileName = "/tmp/kapibeamfile.vcf"; | 648 | QString fileName = "/tmp/kapibeamfile.vcf"; |
641 | 649 | ||
642 | 650 | ||
643 | //QDir().mkdir( dirName, true ); | 651 | //QDir().mkdir( dirName, true ); |
644 | 652 | ||
645 | 653 | ||
646 | KABC::VCardConverter converter; | 654 | KABC::VCardConverter converter; |
647 | QString description; | 655 | QString description; |
648 | QString datastream; | 656 | QString datastream; |
649 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 657 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
650 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 658 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
651 | 659 | ||
652 | if ( a.isEmpty() ) | 660 | if ( a.isEmpty() ) |
653 | continue; | 661 | continue; |
654 | 662 | ||
655 | if (description.isEmpty()) | 663 | if (description.isEmpty()) |
656 | description = a.formattedName(); | 664 | description = a.formattedName(); |
657 | 665 | ||
658 | QString vcard; | 666 | QString vcard; |
659 | converter.addresseeToVCard( a, vcard ); | 667 | converter.addresseeToVCard( a, vcard ); |
660 | int start = 0; | 668 | int start = 0; |
661 | int next; | 669 | int next; |
662 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 670 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
663 | int semi = vcard.find(";", next); | 671 | int semi = vcard.find(";", next); |
664 | int dopp = vcard.find(":", next); | 672 | int dopp = vcard.find(":", next); |
665 | int sep; | 673 | int sep; |
666 | if ( semi < dopp && semi >= 0 ) | 674 | if ( semi < dopp && semi >= 0 ) |
667 | sep = semi ; | 675 | sep = semi ; |
668 | else | 676 | else |
669 | sep = dopp; | 677 | sep = dopp; |
670 | datastream +=vcard.mid( start, next - start); | 678 | datastream +=vcard.mid( start, next - start); |
671 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 679 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
672 | start = sep; | 680 | start = sep; |
673 | } | 681 | } |
674 | datastream += vcard.mid( start,vcard.length() ); | 682 | datastream += vcard.mid( start,vcard.length() ); |
675 | } | 683 | } |
676 | #ifndef DESKTOP_VERSION | 684 | #ifndef DESKTOP_VERSION |
677 | QFile outFile(fileName); | 685 | QFile outFile(fileName); |
678 | if ( outFile.open(IO_WriteOnly) ) { | 686 | if ( outFile.open(IO_WriteOnly) ) { |
679 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 687 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
680 | QTextStream t( &outFile ); // use a text stream | 688 | QTextStream t( &outFile ); // use a text stream |
681 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 689 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
682 | t <<datastream; | 690 | t <<datastream; |
683 | outFile.close(); | 691 | outFile.close(); |
684 | Ir *ir = new Ir( this ); | 692 | Ir *ir = new Ir( this ); |
685 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 693 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
686 | ir->send( fileName, description, "text/x-vCard" ); | 694 | ir->send( fileName, description, "text/x-vCard" ); |
687 | } else { | 695 | } else { |
688 | qDebug("Error open temp beam file "); | 696 | qDebug("Error open temp beam file "); |
689 | return; | 697 | return; |
690 | } | 698 | } |
691 | #endif | 699 | #endif |
692 | 700 | ||
693 | } | 701 | } |
694 | 702 | ||
695 | void KABCore::beamDone( Ir *ir ) | 703 | void KABCore::beamDone( Ir *ir ) |
696 | { | 704 | { |
697 | #ifndef DESKTOP_VERSION | 705 | #ifndef DESKTOP_VERSION |
698 | delete ir; | 706 | delete ir; |
699 | #endif | 707 | #endif |
700 | } | 708 | } |
701 | 709 | ||
702 | 710 | ||
703 | void KABCore::browse( const QString& url ) | 711 | void KABCore::browse( const QString& url ) |
704 | { | 712 | { |
705 | #ifndef KAB_EMBEDDED | 713 | #ifndef KAB_EMBEDDED |
706 | kapp->invokeBrowser( url ); | 714 | kapp->invokeBrowser( url ); |
707 | #else //KAB_EMBEDDED | 715 | #else //KAB_EMBEDDED |
708 | qDebug("KABCore::browse must be fixed"); | 716 | qDebug("KABCore::browse must be fixed"); |
709 | #endif //KAB_EMBEDDED | 717 | #endif //KAB_EMBEDDED |
710 | } | 718 | } |
711 | 719 | ||
712 | void KABCore::selectAllContacts() | 720 | void KABCore::selectAllContacts() |
713 | { | 721 | { |
714 | mViewManager->setSelected( QString::null, true ); | 722 | mViewManager->setSelected( QString::null, true ); |
715 | } | 723 | } |
716 | 724 | ||
717 | void KABCore::deleteContacts() | 725 | void KABCore::deleteContacts() |
718 | { | 726 | { |
719 | QStringList uidList = mViewManager->selectedUids(); | 727 | QStringList uidList = mViewManager->selectedUids(); |
720 | deleteContacts( uidList ); | 728 | deleteContacts( uidList ); |
721 | } | 729 | } |
722 | 730 | ||
723 | void KABCore::deleteContacts( const QStringList &uids ) | 731 | void KABCore::deleteContacts( const QStringList &uids ) |
724 | { | 732 | { |
725 | if ( uids.count() > 0 ) { | 733 | if ( uids.count() > 0 ) { |
726 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 734 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
727 | UndoStack::instance()->push( command ); | 735 | UndoStack::instance()->push( command ); |
728 | RedoStack::instance()->clear(); | 736 | RedoStack::instance()->clear(); |
729 | 737 | ||
730 | // now if we deleted anything, refresh | 738 | // now if we deleted anything, refresh |
731 | setContactSelected( QString::null ); | 739 | setContactSelected( QString::null ); |
732 | setModified( true ); | 740 | setModified( true ); |
733 | } | 741 | } |
734 | } | 742 | } |
735 | 743 | ||
736 | void KABCore::copyContacts() | 744 | void KABCore::copyContacts() |
737 | { | 745 | { |
738 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 746 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
739 | 747 | ||
740 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 748 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
741 | 749 | ||
742 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 750 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
743 | 751 | ||
744 | QClipboard *cb = QApplication::clipboard(); | 752 | QClipboard *cb = QApplication::clipboard(); |
745 | cb->setText( clipText ); | 753 | cb->setText( clipText ); |
746 | } | 754 | } |
747 | 755 | ||
748 | void KABCore::cutContacts() | 756 | void KABCore::cutContacts() |
749 | { | 757 | { |
750 | QStringList uidList = mViewManager->selectedUids(); | 758 | QStringList uidList = mViewManager->selectedUids(); |
751 | 759 | ||
752 | //US if ( uidList.size() > 0 ) { | 760 | //US if ( uidList.size() > 0 ) { |
753 | if ( uidList.count() > 0 ) { | 761 | if ( uidList.count() > 0 ) { |
754 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 762 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
755 | UndoStack::instance()->push( command ); | 763 | UndoStack::instance()->push( command ); |
756 | RedoStack::instance()->clear(); | 764 | RedoStack::instance()->clear(); |
757 | 765 | ||
758 | setModified( true ); | 766 | setModified( true ); |
759 | } | 767 | } |
760 | } | 768 | } |
761 | 769 | ||
762 | void KABCore::pasteContacts() | 770 | void KABCore::pasteContacts() |
763 | { | 771 | { |
764 | QClipboard *cb = QApplication::clipboard(); | 772 | QClipboard *cb = QApplication::clipboard(); |
765 | 773 | ||
766 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 774 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
767 | 775 | ||
768 | pasteContacts( list ); | 776 | pasteContacts( list ); |
769 | } | 777 | } |
770 | 778 | ||
771 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 779 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
772 | { | 780 | { |
773 | KABC::Resource *resource = requestResource( this ); | 781 | KABC::Resource *resource = requestResource( this ); |
774 | KABC::Addressee::List::Iterator it; | 782 | KABC::Addressee::List::Iterator it; |
775 | for ( it = list.begin(); it != list.end(); ++it ) | 783 | for ( it = list.begin(); it != list.end(); ++it ) |
776 | (*it).setResource( resource ); | 784 | (*it).setResource( resource ); |
777 | 785 | ||
778 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 786 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
779 | UndoStack::instance()->push( command ); | 787 | UndoStack::instance()->push( command ); |
780 | RedoStack::instance()->clear(); | 788 | RedoStack::instance()->clear(); |
781 | 789 | ||
782 | setModified( true ); | 790 | setModified( true ); |
783 | } | 791 | } |
784 | 792 | ||
785 | void KABCore::setWhoAmI() | 793 | void KABCore::setWhoAmI() |
786 | { | 794 | { |
787 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 795 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
788 | 796 | ||
789 | if ( addrList.count() > 1 ) { | 797 | if ( addrList.count() > 1 ) { |
790 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 798 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
791 | return; | 799 | return; |
792 | } | 800 | } |
793 | 801 | ||
794 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 802 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
795 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 803 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
796 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 804 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
797 | } | 805 | } |
798 | 806 | ||
799 | void KABCore::setCategories() | 807 | void KABCore::setCategories() |
800 | { | 808 | { |
801 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 809 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
802 | if ( !dlg.exec() ) | 810 | if ( !dlg.exec() ) |
803 | return; | 811 | return; |
804 | 812 | ||
805 | bool merge = false; | 813 | bool merge = false; |
806 | QString msg = i18n( "Merge with existing categories?" ); | 814 | QString msg = i18n( "Merge with existing categories?" ); |
807 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 815 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
808 | merge = true; | 816 | merge = true; |
809 | 817 | ||
810 | QStringList categories = dlg.selectedCategories(); | 818 | QStringList categories = dlg.selectedCategories(); |
811 | 819 | ||
812 | QStringList uids = mViewManager->selectedUids(); | 820 | QStringList uids = mViewManager->selectedUids(); |
813 | QStringList::Iterator it; | 821 | QStringList::Iterator it; |
814 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 822 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
815 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 823 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
816 | if ( !addr.isEmpty() ) { | 824 | if ( !addr.isEmpty() ) { |
817 | if ( !merge ) | 825 | if ( !merge ) |
818 | addr.setCategories( categories ); | 826 | addr.setCategories( categories ); |
819 | else { | 827 | else { |
820 | QStringList addrCategories = addr.categories(); | 828 | QStringList addrCategories = addr.categories(); |
821 | QStringList::Iterator catIt; | 829 | QStringList::Iterator catIt; |
822 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 830 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
823 | if ( !addrCategories.contains( *catIt ) ) | 831 | if ( !addrCategories.contains( *catIt ) ) |
824 | addrCategories.append( *catIt ); | 832 | addrCategories.append( *catIt ); |
825 | } | 833 | } |
826 | addr.setCategories( addrCategories ); | 834 | addr.setCategories( addrCategories ); |
827 | } | 835 | } |
828 | 836 | ||
829 | mAddressBook->insertAddressee( addr ); | 837 | mAddressBook->insertAddressee( addr ); |
830 | } | 838 | } |
831 | } | 839 | } |
832 | 840 | ||
833 | if ( uids.count() > 0 ) | 841 | if ( uids.count() > 0 ) |
834 | setModified( true ); | 842 | setModified( true ); |
835 | } | 843 | } |
836 | 844 | ||
837 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 845 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
838 | { | 846 | { |
839 | mIncSearchWidget->setFields( fields ); | 847 | mIncSearchWidget->setFields( fields ); |
840 | } | 848 | } |
841 | 849 | ||
842 | void KABCore::incrementalSearch( const QString& text ) | 850 | void KABCore::incrementalSearch( const QString& text ) |
843 | { | 851 | { |
844 | mViewManager->setSelected( QString::null, false ); | 852 | mViewManager->setSelected( QString::null, false ); |
845 | 853 | ||
846 | if ( !text.isEmpty() ) { | 854 | if ( !text.isEmpty() ) { |
847 | KABC::Field *field = mIncSearchWidget->currentField(); | 855 | KABC::Field *field = mIncSearchWidget->currentField(); |
848 | QString pattern = text.lower()+"*"; | 856 | QString pattern = text.lower()+"*"; |
849 | QRegExp re; | 857 | QRegExp re; |
850 | re.setWildcard(true); // most people understand these better. | 858 | re.setWildcard(true); // most people understand these better. |
851 | re.setCaseSensitive(false); | 859 | re.setCaseSensitive(false); |
852 | re.setPattern( pattern ); | 860 | re.setPattern( pattern ); |
853 | QStringList foundUids; | 861 | QStringList foundUids; |
854 | if (!re.isValid()) | 862 | if (!re.isValid()) |
855 | return; | 863 | return; |
856 | #if 1 //KDE_VERSION >= 319 | 864 | #if 1 //KDE_VERSION >= 319 |
857 | KABC::AddresseeList list( mAddressBook->allAddressees() ); | 865 | KABC::AddresseeList list( mAddressBook->allAddressees() ); |
858 | if ( field ) { | 866 | if ( field ) { |
859 | list.sortByField( field ); | 867 | list.sortByField( field ); |
860 | KABC::AddresseeList::Iterator it; | 868 | KABC::AddresseeList::Iterator it; |
861 | for ( it = list.begin(); it != list.end(); ++it ) { | 869 | for ( it = list.begin(); it != list.end(); ++it ) { |
862 | 870 | ||
863 | #if QT_VERSION >= 300 | 871 | #if QT_VERSION >= 300 |
864 | if (re.search(field->value( *it ).lower()) != -1) | 872 | if (re.search(field->value( *it ).lower()) != -1) |
865 | #else | 873 | #else |
866 | if (re.match(field->value( *it ).lower()) != -1) | 874 | if (re.match(field->value( *it ).lower()) != -1) |
867 | #endif | 875 | #endif |
868 | { | 876 | { |
869 | // if ( field->value( *it ).lower().startsWith( pattern ) ) { | 877 | // if ( field->value( *it ).lower().startsWith( pattern ) ) { |
870 | //mViewManager->setSelected( (*it).uid(), true ); | 878 | //mViewManager->setSelected( (*it).uid(), true ); |
871 | foundUids.append( (*it).uid() ); | 879 | foundUids.append( (*it).uid() ); |
872 | //return; | 880 | //return; |
873 | } | 881 | } |
874 | } | 882 | } |
875 | } else { | 883 | } else { |
876 | KABC::AddresseeList::Iterator it; | 884 | KABC::AddresseeList::Iterator it; |
877 | for ( it = list.begin(); it != list.end(); ++it ) { | 885 | for ( it = list.begin(); it != list.end(); ++it ) { |
878 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 886 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
879 | KABC::Field::List::ConstIterator fieldIt; | 887 | KABC::Field::List::ConstIterator fieldIt; |
880 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 888 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
881 | #if QT_VERSION >= 300 | 889 | #if QT_VERSION >= 300 |
882 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 890 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
883 | #else | 891 | #else |
884 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 892 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
885 | #endif | 893 | #endif |
886 | { | 894 | { |
887 | // if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 895 | // if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
888 | //mViewManager->setSelected( (*it).uid(), true ); | 896 | //mViewManager->setSelected( (*it).uid(), true ); |
889 | foundUids.append( (*it).uid() ); | 897 | foundUids.append( (*it).uid() ); |
890 | //return; | 898 | //return; |
891 | } | 899 | } |
892 | } | 900 | } |
893 | } | 901 | } |
894 | } | 902 | } |
895 | if ( foundUids.count() > 0 ) | 903 | if ( foundUids.count() > 0 ) |
896 | mViewManager->setListSelected( foundUids ); | 904 | mViewManager->setListSelected( foundUids ); |
897 | #else | 905 | #else |
898 | KABC::AddressBook::Iterator it; | 906 | KABC::AddressBook::Iterator it; |
899 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 907 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
900 | if ( field ) { | 908 | if ( field ) { |
901 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 909 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
902 | mViewManager->setSelected( (*it).uid(), true ); | 910 | mViewManager->setSelected( (*it).uid(), true ); |
903 | return; | 911 | return; |
904 | } | 912 | } |
905 | } else { | 913 | } else { |
906 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 914 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
907 | KABC::Field::List::ConstIterator fieldIt; | 915 | KABC::Field::List::ConstIterator fieldIt; |
908 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 916 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
909 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 917 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
910 | mViewManager->setSelected( (*it).uid(), true ); | 918 | mViewManager->setSelected( (*it).uid(), true ); |
911 | return; | 919 | return; |
912 | } | 920 | } |
913 | } | 921 | } |
914 | } | 922 | } |
915 | } | 923 | } |
916 | #endif | 924 | #endif |
917 | } | 925 | } |
918 | } | 926 | } |
919 | 927 | ||
920 | void KABCore::setModified() | 928 | void KABCore::setModified() |
921 | { | 929 | { |
922 | setModified( true ); | 930 | setModified( true ); |
923 | } | 931 | } |
924 | 932 | ||
925 | void KABCore::setModifiedWOrefresh() | 933 | void KABCore::setModifiedWOrefresh() |
926 | { | 934 | { |
927 | // qDebug("KABCore::setModifiedWOrefresh() "); | 935 | // qDebug("KABCore::setModifiedWOrefresh() "); |
928 | mModified = true; | 936 | mModified = true; |
929 | mActionSave->setEnabled( mModified ); | 937 | mActionSave->setEnabled( mModified ); |
930 | #ifdef DESKTOP_VERSION | 938 | #ifdef DESKTOP_VERSION |
931 | mDetails->refreshView(); | 939 | mDetails->refreshView(); |
932 | #endif | 940 | #endif |
933 | 941 | ||
934 | } | 942 | } |
935 | void KABCore::setModified( bool modified ) | 943 | void KABCore::setModified( bool modified ) |
936 | { | 944 | { |
937 | mModified = modified; | 945 | mModified = modified; |
938 | mActionSave->setEnabled( mModified ); | 946 | mActionSave->setEnabled( mModified ); |
939 | 947 | ||
940 | if ( modified ) | 948 | if ( modified ) |
941 | mJumpButtonBar->recreateButtons(); | 949 | mJumpButtonBar->recreateButtons(); |
942 | 950 | ||
943 | mViewManager->refreshView(); | 951 | mViewManager->refreshView(); |
944 | mDetails->refreshView(); | 952 | mDetails->refreshView(); |
945 | 953 | ||
946 | } | 954 | } |
947 | 955 | ||
948 | bool KABCore::modified() const | 956 | bool KABCore::modified() const |
949 | { | 957 | { |
950 | return mModified; | 958 | return mModified; |
951 | } | 959 | } |
952 | 960 | ||
953 | void KABCore::contactModified( const KABC::Addressee &addr ) | 961 | void KABCore::contactModified( const KABC::Addressee &addr ) |
954 | { | 962 | { |
955 | 963 | ||
956 | Command *command = 0; | 964 | Command *command = 0; |
957 | QString uid; | 965 | QString uid; |
958 | 966 | ||
959 | // check if it exists already | 967 | // check if it exists already |
960 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 968 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
961 | if ( origAddr.isEmpty() ) | 969 | if ( origAddr.isEmpty() ) |
962 | command = new PwNewCommand( mAddressBook, addr ); | 970 | command = new PwNewCommand( mAddressBook, addr ); |
963 | else { | 971 | else { |
964 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 972 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
965 | uid = addr.uid(); | 973 | uid = addr.uid(); |
966 | } | 974 | } |
967 | 975 | ||
968 | UndoStack::instance()->push( command ); | 976 | UndoStack::instance()->push( command ); |
969 | RedoStack::instance()->clear(); | 977 | RedoStack::instance()->clear(); |
970 | 978 | ||
971 | setModified( true ); | 979 | setModified( true ); |
972 | } | 980 | } |
973 | 981 | ||
974 | void KABCore::newContact() | 982 | void KABCore::newContact() |
975 | { | 983 | { |
976 | 984 | ||
977 | 985 | ||
978 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 986 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
979 | 987 | ||
980 | QPtrList<KRES::Resource> kresResources; | 988 | QPtrList<KRES::Resource> kresResources; |
981 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 989 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
982 | KABC::Resource *resource; | 990 | KABC::Resource *resource; |
983 | while ( ( resource = it.current() ) != 0 ) { | 991 | while ( ( resource = it.current() ) != 0 ) { |
984 | ++it; | 992 | ++it; |
985 | if ( !resource->readOnly() ) { | 993 | if ( !resource->readOnly() ) { |
986 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 994 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
987 | if ( res ) | 995 | if ( res ) |
988 | kresResources.append( res ); | 996 | kresResources.append( res ); |
989 | } | 997 | } |
990 | } | 998 | } |
991 | 999 | ||
992 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1000 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
993 | resource = static_cast<KABC::Resource*>( res ); | 1001 | resource = static_cast<KABC::Resource*>( res ); |
994 | 1002 | ||
995 | if ( resource ) { | 1003 | if ( resource ) { |
996 | KABC::Addressee addr; | 1004 | KABC::Addressee addr; |
997 | addr.setResource( resource ); | 1005 | addr.setResource( resource ); |
998 | mEditorDialog->setAddressee( addr ); | 1006 | mEditorDialog->setAddressee( addr ); |
999 | KApplication::execDialog ( mEditorDialog ); | 1007 | KApplication::execDialog ( mEditorDialog ); |
1000 | 1008 | ||
1001 | } else | 1009 | } else |
1002 | return; | 1010 | return; |
1003 | 1011 | ||
1004 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1012 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1005 | 1013 | ||
1006 | 1014 | ||
1007 | } | 1015 | } |
1008 | 1016 | ||
1009 | void KABCore::addEmail( QString aStr ) | 1017 | void KABCore::addEmail( QString aStr ) |
1010 | { | 1018 | { |
1011 | #ifndef KAB_EMBEDDED | 1019 | #ifndef KAB_EMBEDDED |
1012 | QString fullName, email; | 1020 | QString fullName, email; |
1013 | 1021 | ||
1014 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1022 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1015 | 1023 | ||
1016 | // Try to lookup the addressee matching the email address | 1024 | // Try to lookup the addressee matching the email address |
1017 | bool found = false; | 1025 | bool found = false; |
1018 | QStringList emailList; | 1026 | QStringList emailList; |
1019 | KABC::AddressBook::Iterator it; | 1027 | KABC::AddressBook::Iterator it; |
1020 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1028 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1021 | emailList = (*it).emails(); | 1029 | emailList = (*it).emails(); |
1022 | if ( emailList.contains( email ) > 0 ) { | 1030 | if ( emailList.contains( email ) > 0 ) { |
1023 | found = true; | 1031 | found = true; |
1024 | (*it).setNameFromString( fullName ); | 1032 | (*it).setNameFromString( fullName ); |
1025 | editContact( (*it).uid() ); | 1033 | editContact( (*it).uid() ); |
1026 | } | 1034 | } |
1027 | } | 1035 | } |
1028 | 1036 | ||
1029 | if ( !found ) { | 1037 | if ( !found ) { |
1030 | KABC::Addressee addr; | 1038 | KABC::Addressee addr; |
1031 | addr.setNameFromString( fullName ); | 1039 | addr.setNameFromString( fullName ); |
1032 | addr.insertEmail( email, true ); | 1040 | addr.insertEmail( email, true ); |
1033 | 1041 | ||
1034 | mAddressBook->insertAddressee( addr ); | 1042 | mAddressBook->insertAddressee( addr ); |
1035 | mViewManager->refreshView( addr.uid() ); | 1043 | mViewManager->refreshView( addr.uid() ); |
1036 | editContact( addr.uid() ); | 1044 | editContact( addr.uid() ); |
1037 | } | 1045 | } |
1038 | #else //KAB_EMBEDDED | 1046 | #else //KAB_EMBEDDED |
1039 | qDebug("KABCore::addEmail finsih method"); | 1047 | qDebug("KABCore::addEmail finsih method"); |
1040 | #endif //KAB_EMBEDDED | 1048 | #endif //KAB_EMBEDDED |
1041 | } | 1049 | } |
1042 | 1050 | ||
1043 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1051 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1044 | { | 1052 | { |
1045 | mXXPortManager->importVCard( url, showPreview ); | 1053 | mXXPortManager->importVCard( url, showPreview ); |
1046 | } | 1054 | } |
1047 | void KABCore::importFromOL() | 1055 | void KABCore::importFromOL() |
1048 | { | 1056 | { |
1049 | #ifdef _WIN32_ | 1057 | #ifdef _WIN32_ |
1050 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1058 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1051 | idgl->exec(); | 1059 | idgl->exec(); |
1052 | KABC::Addressee::List list = idgl->getAddressList(); | 1060 | KABC::Addressee::List list = idgl->getAddressList(); |
1053 | if ( list.count() > 0 ) { | 1061 | if ( list.count() > 0 ) { |
1054 | KABC::Addressee::List listNew; | 1062 | KABC::Addressee::List listNew; |
1055 | KABC::Addressee::List listExisting; | 1063 | KABC::Addressee::List listExisting; |
1056 | KABC::Addressee::List::Iterator it; | 1064 | KABC::Addressee::List::Iterator it; |
1057 | KABC::AddressBook::Iterator iter; | 1065 | KABC::AddressBook::Iterator iter; |
1058 | for ( it = list.begin(); it != list.end(); ++it ) { | 1066 | for ( it = list.begin(); it != list.end(); ++it ) { |
1059 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1067 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1060 | listNew.append( (*it) ); | 1068 | listNew.append( (*it) ); |
1061 | else | 1069 | else |
1062 | listExisting.append( (*it) ); | 1070 | listExisting.append( (*it) ); |
1063 | } | 1071 | } |
1064 | if ( listExisting.count() > 0 ) | 1072 | if ( listExisting.count() > 0 ) |
1065 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1073 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1066 | if ( listNew.count() > 0 ) { | 1074 | if ( listNew.count() > 0 ) { |
1067 | pasteWithNewUid = false; | 1075 | pasteWithNewUid = false; |
1068 | pasteContacts( listNew ); | 1076 | pasteContacts( listNew ); |
1069 | pasteWithNewUid = true; | 1077 | pasteWithNewUid = true; |
1070 | } | 1078 | } |
1071 | } | 1079 | } |
1072 | delete idgl; | 1080 | delete idgl; |
1073 | #endif | 1081 | #endif |
1074 | } | 1082 | } |
1075 | 1083 | ||
1076 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1084 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1077 | { | 1085 | { |
1078 | mXXPortManager->importVCard( vCard, showPreview ); | 1086 | mXXPortManager->importVCard( vCard, showPreview ); |