author | zautrix <zautrix> | 2004-09-08 15:08:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-08 15:08:13 (UTC) |
commit | 83570b43ee0d53737007031161c2694824351089 (patch) (unidiff) | |
tree | 986fca69a9daf0632fbbfd3f144960858e0ebd84 | |
parent | a1bf91640d9719694b3cfb027b0b53988480f041 (diff) | |
download | kdepimpi-83570b43ee0d53737007031161c2694824351089.zip kdepimpi-83570b43ee0d53737007031161c2694824351089.tar.gz kdepimpi-83570b43ee0d53737007031161c2694824351089.tar.bz2 |
Fix for the Z
-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,2154 +1,2162 @@ | |||
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 ); |
1079 | } | 1087 | } |
1080 | 1088 | ||
1081 | //US added a second method without defaultparameter | 1089 | //US added a second method without defaultparameter |
1082 | void KABCore::editContact2() { | 1090 | void KABCore::editContact2() { |
1083 | editContact( QString::null ); | 1091 | editContact( QString::null ); |
1084 | } | 1092 | } |
1085 | 1093 | ||
1086 | void KABCore::editContact( const QString &uid ) | 1094 | void KABCore::editContact( const QString &uid ) |
1087 | { | 1095 | { |
1088 | 1096 | ||
1089 | if ( mExtensionManager->isQuickEditVisible() ) | 1097 | if ( mExtensionManager->isQuickEditVisible() ) |
1090 | return; | 1098 | return; |
1091 | 1099 | ||
1092 | // First, locate the contact entry | 1100 | // First, locate the contact entry |
1093 | QString localUID = uid; | 1101 | QString localUID = uid; |
1094 | if ( localUID.isNull() ) { | 1102 | if ( localUID.isNull() ) { |
1095 | QStringList uidList = mViewManager->selectedUids(); | 1103 | QStringList uidList = mViewManager->selectedUids(); |
1096 | if ( uidList.count() > 0 ) | 1104 | if ( uidList.count() > 0 ) |
1097 | localUID = *( uidList.at( 0 ) ); | 1105 | localUID = *( uidList.at( 0 ) ); |
1098 | } | 1106 | } |
1099 | 1107 | ||
1100 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1108 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1101 | if ( !addr.isEmpty() ) { | 1109 | if ( !addr.isEmpty() ) { |
1102 | mEditorDialog->setAddressee( addr ); | 1110 | mEditorDialog->setAddressee( addr ); |
1103 | KApplication::execDialog ( mEditorDialog ); | 1111 | KApplication::execDialog ( mEditorDialog ); |
1104 | } | 1112 | } |
1105 | } | 1113 | } |
1106 | 1114 | ||
1107 | /** | 1115 | /** |
1108 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1116 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1109 | the method will try to find a selected addressee in the view. | 1117 | the method will try to find a selected addressee in the view. |
1110 | */ | 1118 | */ |
1111 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1119 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1112 | { | 1120 | { |
1113 | if ( mMultipleViewsAtOnce ) | 1121 | if ( mMultipleViewsAtOnce ) |
1114 | { | 1122 | { |
1115 | editContact( uid ); | 1123 | editContact( uid ); |
1116 | } | 1124 | } |
1117 | else | 1125 | else |
1118 | { | 1126 | { |
1119 | setDetailsVisible( true ); | 1127 | setDetailsVisible( true ); |
1120 | mActionDetails->setChecked(true); | 1128 | mActionDetails->setChecked(true); |
1121 | } | 1129 | } |
1122 | 1130 | ||
1123 | } | 1131 | } |
1124 | 1132 | ||
1125 | void KABCore::save() | 1133 | void KABCore::save() |
1126 | { | 1134 | { |
1127 | if ( !mModified ) | 1135 | if ( !mModified ) |
1128 | return; | 1136 | return; |
1129 | QString text = i18n( "There was an error while attempting to save\n the " | 1137 | QString text = i18n( "There was an error while attempting to save\n the " |
1130 | "address book. Please check that some \nother application is " | 1138 | "address book. Please check that some \nother application is " |
1131 | "not using it. " ); | 1139 | "not using it. " ); |
1132 | statusMessage(i18n("Saving addressbook ... ")); | 1140 | statusMessage(i18n("Saving addressbook ... ")); |
1133 | #ifndef KAB_EMBEDDED | 1141 | #ifndef KAB_EMBEDDED |
1134 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1142 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1135 | if ( !b || !b->save() ) { | 1143 | if ( !b || !b->save() ) { |
1136 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1144 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1137 | } | 1145 | } |
1138 | #else //KAB_EMBEDDED | 1146 | #else //KAB_EMBEDDED |
1139 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1147 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1140 | if ( !b || !b->save() ) { | 1148 | if ( !b || !b->save() ) { |
1141 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1149 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1142 | } | 1150 | } |
1143 | #endif //KAB_EMBEDDED | 1151 | #endif //KAB_EMBEDDED |
1144 | 1152 | ||
1145 | statusMessage(i18n("Addressbook saved!")); | 1153 | statusMessage(i18n("Addressbook saved!")); |
1146 | setModified( false ); | 1154 | setModified( false ); |
1147 | } | 1155 | } |
1148 | 1156 | ||
1149 | void KABCore::statusMessage(QString mess , int time ) | 1157 | void KABCore::statusMessage(QString mess , int time ) |
1150 | { | 1158 | { |
1151 | //topLevelWidget()->setCaption( mess ); | 1159 | //topLevelWidget()->setCaption( mess ); |
1152 | // pending setting timer to revome message | 1160 | // pending setting timer to revome message |
1153 | } | 1161 | } |
1154 | void KABCore::undo() | 1162 | void KABCore::undo() |
1155 | { | 1163 | { |
1156 | UndoStack::instance()->undo(); | 1164 | UndoStack::instance()->undo(); |
1157 | 1165 | ||
1158 | // Refresh the view | 1166 | // Refresh the view |
1159 | mViewManager->refreshView(); | 1167 | mViewManager->refreshView(); |
1160 | } | 1168 | } |
1161 | 1169 | ||
1162 | void KABCore::redo() | 1170 | void KABCore::redo() |
1163 | { | 1171 | { |
1164 | RedoStack::instance()->redo(); | 1172 | RedoStack::instance()->redo(); |
1165 | 1173 | ||
1166 | // Refresh the view | 1174 | // Refresh the view |
1167 | mViewManager->refreshView(); | 1175 | mViewManager->refreshView(); |
1168 | } | 1176 | } |
1169 | 1177 | ||
1170 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1178 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1171 | { | 1179 | { |
1172 | if (mMultipleViewsAtOnce) | 1180 | if (mMultipleViewsAtOnce) |
1173 | { | 1181 | { |
1174 | if ( visible ) | 1182 | if ( visible ) |
1175 | mJumpButtonBar->show(); | 1183 | mJumpButtonBar->show(); |
1176 | else | 1184 | else |
1177 | mJumpButtonBar->hide(); | 1185 | mJumpButtonBar->hide(); |
1178 | } | 1186 | } |
1179 | else | 1187 | else |
1180 | { | 1188 | { |
1181 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1189 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1182 | if (mViewManager->isVisible()) | 1190 | if (mViewManager->isVisible()) |
1183 | { | 1191 | { |
1184 | if ( visible ) | 1192 | if ( visible ) |
1185 | mJumpButtonBar->show(); | 1193 | mJumpButtonBar->show(); |
1186 | else | 1194 | else |
1187 | mJumpButtonBar->hide(); | 1195 | mJumpButtonBar->hide(); |
1188 | } | 1196 | } |
1189 | else | 1197 | else |
1190 | { | 1198 | { |
1191 | mJumpButtonBar->hide(); | 1199 | mJumpButtonBar->hide(); |
1192 | } | 1200 | } |
1193 | } | 1201 | } |
1194 | } | 1202 | } |
1195 | 1203 | ||
1196 | 1204 | ||
1197 | void KABCore::setDetailsToState() | 1205 | void KABCore::setDetailsToState() |
1198 | { | 1206 | { |
1199 | setDetailsVisible( mActionDetails->isChecked() ); | 1207 | setDetailsVisible( mActionDetails->isChecked() ); |
1200 | } | 1208 | } |
1201 | 1209 | ||
1202 | 1210 | ||
1203 | 1211 | ||
1204 | void KABCore::setDetailsVisible( bool visible ) | 1212 | void KABCore::setDetailsVisible( bool visible ) |
1205 | { | 1213 | { |
1206 | if (visible && mDetails->isHidden()) | 1214 | if (visible && mDetails->isHidden()) |
1207 | { | 1215 | { |
1208 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1216 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1209 | if ( addrList.count() > 0 ) | 1217 | if ( addrList.count() > 0 ) |
1210 | mDetails->setAddressee( addrList[ 0 ] ); | 1218 | mDetails->setAddressee( addrList[ 0 ] ); |
1211 | } | 1219 | } |
1212 | 1220 | ||
1213 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1221 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1214 | // the listview and the detailview. We do that by changing the splitbar size. | 1222 | // the listview and the detailview. We do that by changing the splitbar size. |
1215 | if (mMultipleViewsAtOnce) | 1223 | if (mMultipleViewsAtOnce) |
1216 | { | 1224 | { |
1217 | if ( visible ) | 1225 | if ( visible ) |
1218 | mDetails->show(); | 1226 | mDetails->show(); |
1219 | else | 1227 | else |
1220 | mDetails->hide(); | 1228 | mDetails->hide(); |
1221 | } | 1229 | } |
1222 | else | 1230 | else |
1223 | { | 1231 | { |
1224 | if ( visible ) { | 1232 | if ( visible ) { |
1225 | mViewManager->hide(); | 1233 | mViewManager->hide(); |
1226 | mDetails->show(); | 1234 | mDetails->show(); |
1227 | } | 1235 | } |
1228 | else { | 1236 | else { |
1229 | mViewManager->show(); | 1237 | mViewManager->show(); |
1230 | mDetails->hide(); | 1238 | mDetails->hide(); |
1231 | } | 1239 | } |
1232 | setJumpButtonBarVisible( !visible ); | 1240 | setJumpButtonBarVisible( !visible ); |
1233 | } | 1241 | } |
1234 | 1242 | ||
1235 | } | 1243 | } |
1236 | 1244 | ||
1237 | void KABCore::extensionChanged( int id ) | 1245 | void KABCore::extensionChanged( int id ) |
1238 | { | 1246 | { |
1239 | //change the details view only for non desktop systems | 1247 | //change the details view only for non desktop systems |
1240 | #ifndef DESKTOP_VERSION | 1248 | #ifndef DESKTOP_VERSION |
1241 | 1249 | ||
1242 | if (id == 0) | 1250 | if (id == 0) |
1243 | { | 1251 | { |
1244 | //the user disabled the extension. | 1252 | //the user disabled the extension. |
1245 | 1253 | ||
1246 | if (mMultipleViewsAtOnce) | 1254 | if (mMultipleViewsAtOnce) |
1247 | { // enable detailsview again | 1255 | { // enable detailsview again |
1248 | setDetailsVisible( true ); | 1256 | setDetailsVisible( true ); |
1249 | mActionDetails->setChecked( true ); | 1257 | mActionDetails->setChecked( true ); |
1250 | } | 1258 | } |
1251 | else | 1259 | else |
1252 | { //go back to the listview | 1260 | { //go back to the listview |
1253 | setDetailsVisible( false ); | 1261 | setDetailsVisible( false ); |
1254 | mActionDetails->setChecked( false ); | 1262 | mActionDetails->setChecked( false ); |
1255 | mActionDetails->setEnabled(true); | 1263 | mActionDetails->setEnabled(true); |
1256 | } | 1264 | } |
1257 | 1265 | ||
1258 | } | 1266 | } |
1259 | else | 1267 | else |
1260 | { | 1268 | { |
1261 | //the user enabled the extension. | 1269 | //the user enabled the extension. |
1262 | setDetailsVisible( false ); | 1270 | setDetailsVisible( false ); |
1263 | mActionDetails->setChecked( false ); | 1271 | mActionDetails->setChecked( false ); |
1264 | 1272 | ||
1265 | if (!mMultipleViewsAtOnce) | 1273 | if (!mMultipleViewsAtOnce) |
1266 | { | 1274 | { |
1267 | mActionDetails->setEnabled(false); | 1275 | mActionDetails->setEnabled(false); |
1268 | } | 1276 | } |
1269 | 1277 | ||
1270 | mExtensionManager->setSelectionChanged(); | 1278 | mExtensionManager->setSelectionChanged(); |
1271 | 1279 | ||
1272 | } | 1280 | } |
1273 | 1281 | ||
1274 | #endif// DESKTOP_VERSION | 1282 | #endif// DESKTOP_VERSION |
1275 | 1283 | ||
1276 | } | 1284 | } |
1277 | 1285 | ||
1278 | 1286 | ||
1279 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1287 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1280 | { | 1288 | { |
1281 | 1289 | ||
1282 | if ( list.count() != 0 ) { | 1290 | if ( list.count() != 0 ) { |
1283 | KABC::Addressee::List::ConstIterator it; | 1291 | KABC::Addressee::List::ConstIterator it; |
1284 | for ( it = list.begin(); it != list.end(); ++it ) | 1292 | for ( it = list.begin(); it != list.end(); ++it ) |
1285 | mAddressBook->insertAddressee( *it ); | 1293 | mAddressBook->insertAddressee( *it ); |
1286 | if ( list.count() > 1 ) | 1294 | if ( list.count() > 1 ) |
1287 | setModified(); | 1295 | setModified(); |
1288 | else | 1296 | else |
1289 | setModifiedWOrefresh(); | 1297 | setModifiedWOrefresh(); |
1290 | } | 1298 | } |
1291 | if ( list.count() == 0 ) | 1299 | if ( list.count() == 0 ) |
1292 | mViewManager->refreshView(); | 1300 | mViewManager->refreshView(); |
1293 | else | 1301 | else |
1294 | mViewManager->refreshView( list[ 0 ].uid() ); | 1302 | mViewManager->refreshView( list[ 0 ].uid() ); |
1295 | 1303 | ||
1296 | 1304 | ||
1297 | 1305 | ||
1298 | } | 1306 | } |
1299 | 1307 | ||
1300 | QString KABCore::getNameByPhone( const QString &phone ) | 1308 | QString KABCore::getNameByPhone( const QString &phone ) |
1301 | { | 1309 | { |
1302 | #ifndef KAB_EMBEDDED | 1310 | #ifndef KAB_EMBEDDED |
1303 | QRegExp r( "[/*/-/ ]" ); | 1311 | QRegExp r( "[/*/-/ ]" ); |
1304 | QString localPhone( phone ); | 1312 | QString localPhone( phone ); |
1305 | 1313 | ||
1306 | bool found = false; | 1314 | bool found = false; |
1307 | QString ownerName = ""; | 1315 | QString ownerName = ""; |
1308 | KABC::AddressBook::Iterator iter; | 1316 | KABC::AddressBook::Iterator iter; |
1309 | KABC::PhoneNumber::List::Iterator phoneIter; | 1317 | KABC::PhoneNumber::List::Iterator phoneIter; |
1310 | KABC::PhoneNumber::List phoneList; | 1318 | KABC::PhoneNumber::List phoneList; |
1311 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1319 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1312 | phoneList = (*iter).phoneNumbers(); | 1320 | phoneList = (*iter).phoneNumbers(); |
1313 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1321 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1314 | ++phoneIter) { | 1322 | ++phoneIter) { |
1315 | // Get rid of separator chars so just the numbers are compared. | 1323 | // Get rid of separator chars so just the numbers are compared. |
1316 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1324 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1317 | ownerName = (*iter).formattedName(); | 1325 | ownerName = (*iter).formattedName(); |
1318 | found = true; | 1326 | found = true; |
1319 | } | 1327 | } |
1320 | } | 1328 | } |
1321 | } | 1329 | } |
1322 | 1330 | ||
1323 | return ownerName; | 1331 | return ownerName; |
1324 | #else //KAB_EMBEDDED | 1332 | #else //KAB_EMBEDDED |
1325 | qDebug("KABCore::getNameByPhone finsih method"); | 1333 | qDebug("KABCore::getNameByPhone finsih method"); |
1326 | return ""; | 1334 | return ""; |
1327 | #endif //KAB_EMBEDDED | 1335 | #endif //KAB_EMBEDDED |
1328 | 1336 | ||
1329 | } | 1337 | } |
1330 | 1338 | ||
1331 | void KABCore::openConfigDialog() | 1339 | void KABCore::openConfigDialog() |
1332 | { | 1340 | { |
1333 | KABPrefs* kab_prefs = KABPrefs::instance(); | 1341 | KABPrefs* kab_prefs = KABPrefs::instance(); |
1334 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); | 1342 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); |
1335 | 1343 | ||
1336 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1344 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1337 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1345 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1338 | ConfigureDialog->addModule(kabcfg ); | 1346 | ConfigureDialog->addModule(kabcfg ); |
1339 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1347 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1340 | ConfigureDialog->addModule(kdelibcfg ); | 1348 | ConfigureDialog->addModule(kdelibcfg ); |
1341 | 1349 | ||
1342 | 1350 | ||
1343 | 1351 | ||
1344 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1352 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1345 | this, SLOT( configurationChanged() ) ); | 1353 | this, SLOT( configurationChanged() ) ); |
1346 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1354 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1347 | this, SLOT( configurationChanged() ) ); | 1355 | this, SLOT( configurationChanged() ) ); |
1348 | saveSettings(); | 1356 | saveSettings(); |
1349 | #ifndef DESKTOP_VERSION | 1357 | #ifndef DESKTOP_VERSION |
1350 | ConfigureDialog->showMaximized(); | 1358 | ConfigureDialog->showMaximized(); |
1351 | #endif | 1359 | #endif |
1352 | if ( ConfigureDialog->exec() ) | 1360 | if ( ConfigureDialog->exec() ) |
1353 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1361 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1354 | delete ConfigureDialog; | 1362 | delete ConfigureDialog; |
1355 | } | 1363 | } |
1356 | 1364 | ||
1357 | void KABCore::openLDAPDialog() | 1365 | void KABCore::openLDAPDialog() |
1358 | { | 1366 | { |
1359 | #ifndef KAB_EMBEDDED | 1367 | #ifndef KAB_EMBEDDED |
1360 | if ( !mLdapSearchDialog ) { | 1368 | if ( !mLdapSearchDialog ) { |
1361 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1369 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1362 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1370 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1363 | SLOT( refreshView() ) ); | 1371 | SLOT( refreshView() ) ); |
1364 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1372 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1365 | SLOT( setModified() ) ); | 1373 | SLOT( setModified() ) ); |
1366 | } else | 1374 | } else |
1367 | mLdapSearchDialog->restoreSettings(); | 1375 | mLdapSearchDialog->restoreSettings(); |
1368 | 1376 | ||
1369 | if ( mLdapSearchDialog->isOK() ) | 1377 | if ( mLdapSearchDialog->isOK() ) |
1370 | mLdapSearchDialog->exec(); | 1378 | mLdapSearchDialog->exec(); |
1371 | #else //KAB_EMBEDDED | 1379 | #else //KAB_EMBEDDED |
1372 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1380 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1373 | #endif //KAB_EMBEDDED | 1381 | #endif //KAB_EMBEDDED |
1374 | } | 1382 | } |
1375 | 1383 | ||
1376 | void KABCore::print() | 1384 | void KABCore::print() |
1377 | { | 1385 | { |
1378 | #ifndef KAB_EMBEDDED | 1386 | #ifndef KAB_EMBEDDED |
1379 | KPrinter printer; | 1387 | KPrinter printer; |
1380 | if ( !printer.setup( this ) ) | 1388 | if ( !printer.setup( this ) ) |
1381 | return; | 1389 | return; |
1382 | 1390 | ||
1383 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1391 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1384 | mViewManager->selectedUids(), this ); | 1392 | mViewManager->selectedUids(), this ); |
1385 | 1393 | ||
1386 | wizard.exec(); | 1394 | wizard.exec(); |
1387 | #else //KAB_EMBEDDED | 1395 | #else //KAB_EMBEDDED |
1388 | qDebug("KABCore::print() finsih method"); | 1396 | qDebug("KABCore::print() finsih method"); |
1389 | #endif //KAB_EMBEDDED | 1397 | #endif //KAB_EMBEDDED |
1390 | 1398 | ||
1391 | } | 1399 | } |
1392 | 1400 | ||
1393 | 1401 | ||
1394 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1402 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1395 | { | 1403 | { |
1396 | if ( mGUIClient ) | 1404 | if ( mGUIClient ) |
1397 | mGUIClient->insertChildClient( client ); | 1405 | mGUIClient->insertChildClient( client ); |
1398 | else | 1406 | else |
1399 | KMessageBox::error( this, "no KXMLGUICLient"); | 1407 | KMessageBox::error( this, "no KXMLGUICLient"); |
1400 | } | 1408 | } |
1401 | 1409 | ||
1402 | 1410 | ||
1403 | void KABCore::configurationChanged() | 1411 | void KABCore::configurationChanged() |
1404 | { | 1412 | { |
1405 | mExtensionManager->reconfigure(); | 1413 | mExtensionManager->reconfigure(); |
1406 | } | 1414 | } |
1407 | 1415 | ||
1408 | void KABCore::addressBookChanged() | 1416 | void KABCore::addressBookChanged() |
1409 | { | 1417 | { |
1410 | /*US | 1418 | /*US |
1411 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1419 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1412 | while ( it.current() ) { | 1420 | while ( it.current() ) { |
1413 | if ( it.current()->dirty() ) { | 1421 | if ( it.current()->dirty() ) { |
1414 | QString text = i18n( "Data has been changed externally. Unsaved " | 1422 | QString text = i18n( "Data has been changed externally. Unsaved " |
1415 | "changes will be lost." ); | 1423 | "changes will be lost." ); |
1416 | KMessageBox::information( this, text ); | 1424 | KMessageBox::information( this, text ); |
1417 | } | 1425 | } |
1418 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1426 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1419 | ++it; | 1427 | ++it; |
1420 | } | 1428 | } |
1421 | */ | 1429 | */ |
1422 | if (mEditorDialog) | 1430 | if (mEditorDialog) |
1423 | { | 1431 | { |
1424 | if (mEditorDialog->dirty()) | 1432 | if (mEditorDialog->dirty()) |
1425 | { | 1433 | { |
1426 | QString text = i18n( "Data has been changed externally. Unsaved " | 1434 | QString text = i18n( "Data has been changed externally. Unsaved " |
1427 | "changes will be lost." ); | 1435 | "changes will be lost." ); |
1428 | KMessageBox::information( this, text ); | 1436 | KMessageBox::information( this, text ); |
1429 | } | 1437 | } |
1430 | QString currentuid = mEditorDialog->addressee().uid(); | 1438 | QString currentuid = mEditorDialog->addressee().uid(); |
1431 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1439 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1432 | } | 1440 | } |
1433 | mViewManager->refreshView(); | 1441 | mViewManager->refreshView(); |
1434 | // mDetails->refreshView(); | 1442 | // mDetails->refreshView(); |
1435 | 1443 | ||
1436 | 1444 | ||
1437 | } | 1445 | } |
1438 | 1446 | ||
1439 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1447 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1440 | const char *name ) | 1448 | const char *name ) |
1441 | { | 1449 | { |
1442 | 1450 | ||
1443 | if ( mEditorDialog == 0 ) { | 1451 | if ( mEditorDialog == 0 ) { |
1444 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1452 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1445 | name ? name : "editorDialog" ); | 1453 | name ? name : "editorDialog" ); |
1446 | 1454 | ||
1447 | 1455 | ||
1448 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1456 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1449 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1457 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1450 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1458 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1451 | // SLOT( slotEditorDestroyed( const QString& ) ) ); | 1459 | // SLOT( slotEditorDestroyed( const QString& ) ) ); |
1452 | } | 1460 | } |
1453 | 1461 | ||
1454 | return mEditorDialog; | 1462 | return mEditorDialog; |
1455 | } | 1463 | } |
1456 | 1464 | ||
1457 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1465 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1458 | { | 1466 | { |
1459 | //mEditorDict.remove( uid ); | 1467 | //mEditorDict.remove( uid ); |
1460 | } | 1468 | } |
1461 | 1469 | ||
1462 | void KABCore::initGUI() | 1470 | void KABCore::initGUI() |
1463 | { | 1471 | { |
1464 | #ifndef KAB_EMBEDDED | 1472 | #ifndef KAB_EMBEDDED |
1465 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1473 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1466 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1474 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1467 | 1475 | ||
1468 | mExtensionBarSplitter = new QSplitter( this ); | 1476 | mExtensionBarSplitter = new QSplitter( this ); |
1469 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1477 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1470 | 1478 | ||
1471 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1479 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1472 | 1480 | ||
1473 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1481 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1474 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1482 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1475 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1483 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1476 | SLOT( incrementalSearch( const QString& ) ) ); | 1484 | SLOT( incrementalSearch( const QString& ) ) ); |
1477 | 1485 | ||
1478 | mViewManager = new ViewManager( this, viewSpace ); | 1486 | mViewManager = new ViewManager( this, viewSpace ); |
1479 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1487 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1480 | 1488 | ||
1481 | mDetails = new ViewContainer( mDetailsSplitter ); | 1489 | mDetails = new ViewContainer( mDetailsSplitter ); |
1482 | 1490 | ||
1483 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1491 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1484 | 1492 | ||
1485 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1493 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1486 | 1494 | ||
1487 | topLayout->addWidget( mExtensionBarSplitter ); | 1495 | topLayout->addWidget( mExtensionBarSplitter ); |
1488 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1496 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1489 | topLayout->addWidget( mJumpButtonBar ); | 1497 | topLayout->addWidget( mJumpButtonBar ); |
1490 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1498 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1491 | 1499 | ||
1492 | mXXPortManager = new XXPortManager( this, this ); | 1500 | mXXPortManager = new XXPortManager( this, this ); |
1493 | 1501 | ||
1494 | #else //KAB_EMBEDDED | 1502 | #else //KAB_EMBEDDED |
1495 | //US initialize viewMenu before settingup viewmanager. | 1503 | //US initialize viewMenu before settingup viewmanager. |
1496 | // Viewmanager needs this menu to plugin submenues. | 1504 | // Viewmanager needs this menu to plugin submenues. |
1497 | viewMenu = new QPopupMenu( this ); | 1505 | viewMenu = new QPopupMenu( this ); |
1498 | settingsMenu = new QPopupMenu( this ); | 1506 | settingsMenu = new QPopupMenu( this ); |
1499 | //filterMenu = new QPopupMenu( this ); | 1507 | //filterMenu = new QPopupMenu( this ); |
1500 | ImportMenu = new QPopupMenu( this ); | 1508 | ImportMenu = new QPopupMenu( this ); |
1501 | ExportMenu = new QPopupMenu( this ); | 1509 | ExportMenu = new QPopupMenu( this ); |
1502 | 1510 | ||
1503 | changeMenu= new QPopupMenu( this ); | 1511 | changeMenu= new QPopupMenu( this ); |
1504 | 1512 | ||
1505 | //US since we have no splitter for the embedded system, setup | 1513 | //US since we have no splitter for the embedded system, setup |
1506 | // a layout with two frames. One left and one right. | 1514 | // a layout with two frames. One left and one right. |
1507 | 1515 | ||
1508 | QBoxLayout *topLayout; | 1516 | QBoxLayout *topLayout; |
1509 | 1517 | ||
1510 | // = new QHBoxLayout( this ); | 1518 | // = new QHBoxLayout( this ); |
1511 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1519 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1512 | 1520 | ||
1513 | // QWidget *mainBox = new QWidget( this ); | 1521 | // QWidget *mainBox = new QWidget( this ); |
1514 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1522 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1515 | 1523 | ||
1516 | #ifdef DESKTOP_VERSION | 1524 | #ifdef DESKTOP_VERSION |
1517 | topLayout = new QHBoxLayout( this ); | 1525 | topLayout = new QHBoxLayout( this ); |
1518 | 1526 | ||
1519 | 1527 | ||
1520 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1528 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1521 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1529 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1522 | 1530 | ||
1523 | topLayout->addWidget(mMiniSplitter ); | 1531 | topLayout->addWidget(mMiniSplitter ); |
1524 | 1532 | ||
1525 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1533 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1526 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1534 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1527 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1535 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1528 | mDetails = new ViewContainer( mMiniSplitter ); | 1536 | mDetails = new ViewContainer( mMiniSplitter ); |
1529 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1537 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1530 | #else | 1538 | #else |
1531 | if ( QApplication::desktop()->width() > 480 ) { | 1539 | if ( QApplication::desktop()->width() > 480 ) { |
1532 | topLayout = new QHBoxLayout( this ); | 1540 | topLayout = new QHBoxLayout( this ); |
1533 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1541 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1534 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1542 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1535 | } else { | 1543 | } else { |
1536 | 1544 | ||
1537 | topLayout = new QHBoxLayout( this ); | 1545 | topLayout = new QHBoxLayout( this ); |
1538 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1546 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1539 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1547 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1540 | } | 1548 | } |
1541 | 1549 | ||
1542 | topLayout->addWidget(mMiniSplitter ); | 1550 | topLayout->addWidget(mMiniSplitter ); |
1543 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1551 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1544 | mDetails = new ViewContainer( mMiniSplitter ); | 1552 | mDetails = new ViewContainer( mMiniSplitter ); |
1545 | 1553 | ||
1546 | 1554 | ||
1547 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1555 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1548 | #endif | 1556 | #endif |
1549 | //eh->hide(); | 1557 | //eh->hide(); |
1550 | // topLayout->addWidget(mExtensionManager ); | 1558 | // topLayout->addWidget(mExtensionManager ); |
1551 | 1559 | ||
1552 | 1560 | ||
1553 | /*US | 1561 | /*US |
1554 | #ifndef KAB_NOSPLITTER | 1562 | #ifndef KAB_NOSPLITTER |
1555 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1563 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1556 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1564 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1557 | topLayout->setSpacing( 10 ); | 1565 | topLayout->setSpacing( 10 ); |
1558 | 1566 | ||
1559 | mDetailsSplitter = new QSplitter( this ); | 1567 | mDetailsSplitter = new QSplitter( this ); |
1560 | 1568 | ||
1561 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1569 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1562 | 1570 | ||
1563 | mViewManager = new ViewManager( this, viewSpace ); | 1571 | mViewManager = new ViewManager( this, viewSpace ); |
1564 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1572 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1565 | 1573 | ||
1566 | mDetails = new ViewContainer( mDetailsSplitter ); | 1574 | mDetails = new ViewContainer( mDetailsSplitter ); |
1567 | 1575 | ||
1568 | topLayout->addWidget( mDetailsSplitter ); | 1576 | topLayout->addWidget( mDetailsSplitter ); |
1569 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1577 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1570 | #else //KAB_NOSPLITTER | 1578 | #else //KAB_NOSPLITTER |
1571 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1579 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1572 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1580 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1573 | topLayout->setSpacing( 10 ); | 1581 | topLayout->setSpacing( 10 ); |
1574 | 1582 | ||
1575 | // mDetailsSplitter = new QSplitter( this ); | 1583 | // mDetailsSplitter = new QSplitter( this ); |
1576 | 1584 | ||
1577 | QVBox *viewSpace = new QVBox( this ); | 1585 | QVBox *viewSpace = new QVBox( this ); |
1578 | 1586 | ||
1579 | mViewManager = new ViewManager( this, viewSpace ); | 1587 | mViewManager = new ViewManager( this, viewSpace ); |
1580 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1588 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1581 | 1589 | ||
1582 | mDetails = new ViewContainer( this ); | 1590 | mDetails = new ViewContainer( this ); |
1583 | 1591 | ||
1584 | topLayout->addWidget( viewSpace ); | 1592 | topLayout->addWidget( viewSpace ); |
1585 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1593 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1586 | topLayout->addWidget( mDetails ); | 1594 | topLayout->addWidget( mDetails ); |
1587 | #endif //KAB_NOSPLITTER | 1595 | #endif //KAB_NOSPLITTER |
1588 | */ | 1596 | */ |
1589 | 1597 | ||
1590 | 1598 | ||
1591 | #endif //KAB_EMBEDDED | 1599 | #endif //KAB_EMBEDDED |
1592 | initActions(); | 1600 | initActions(); |
1593 | 1601 | ||
1594 | #ifdef KAB_EMBEDDED | 1602 | #ifdef KAB_EMBEDDED |
1595 | addActionsManually(); | 1603 | addActionsManually(); |
1596 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1604 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1597 | mXXPortManager = new XXPortManager( this, this ); | 1605 | mXXPortManager = new XXPortManager( this, this ); |
1598 | 1606 | ||
1599 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1607 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1600 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1608 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1601 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1609 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1602 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1610 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1603 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1611 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1604 | // mIncSearchWidget->hide(); | 1612 | // mIncSearchWidget->hide(); |
1605 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1613 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1606 | SLOT( incrementalSearch( const QString& ) ) ); | 1614 | SLOT( incrementalSearch( const QString& ) ) ); |
1607 | 1615 | ||
1608 | 1616 | ||
1609 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1617 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1610 | 1618 | ||
1611 | topLayout->addWidget( mJumpButtonBar ); | 1619 | topLayout->addWidget( mJumpButtonBar ); |
1612 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1620 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1613 | 1621 | ||
1614 | // mMainWindow->getIconToolBar()->raise(); | 1622 | // mMainWindow->getIconToolBar()->raise(); |
1615 | 1623 | ||
1616 | #endif //KAB_EMBEDDED | 1624 | #endif //KAB_EMBEDDED |
1617 | 1625 | ||
1618 | } | 1626 | } |
1619 | void KABCore::initActions() | 1627 | void KABCore::initActions() |
1620 | { | 1628 | { |
1621 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1629 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1622 | 1630 | ||
1623 | #ifndef KAB_EMBEDDED | 1631 | #ifndef KAB_EMBEDDED |
1624 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1632 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1625 | SLOT( clipboardDataChanged() ) ); | 1633 | SLOT( clipboardDataChanged() ) ); |
1626 | #endif //KAB_EMBEDDED | 1634 | #endif //KAB_EMBEDDED |
1627 | 1635 | ||
1628 | // file menu | 1636 | // file menu |
1629 | if ( mIsPart ) { | 1637 | if ( mIsPart ) { |
1630 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1638 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1631 | SLOT( sendMail() ), actionCollection(), | 1639 | SLOT( sendMail() ), actionCollection(), |
1632 | "kaddressbook_mail" ); | 1640 | "kaddressbook_mail" ); |
1633 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1641 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1634 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1642 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1635 | 1643 | ||
1636 | } else { | 1644 | } else { |
1637 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1645 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1638 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1646 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1639 | } | 1647 | } |
1640 | 1648 | ||
1641 | 1649 | ||
1642 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1650 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1643 | SLOT( save() ), actionCollection(), "file_sync" ); | 1651 | SLOT( save() ), actionCollection(), "file_sync" ); |
1644 | 1652 | ||
1645 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1653 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1646 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1654 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1647 | 1655 | ||
1648 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1656 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1649 | this, SLOT( mailVCard() ), | 1657 | this, SLOT( mailVCard() ), |
1650 | actionCollection(), "file_mail_vcard"); | 1658 | actionCollection(), "file_mail_vcard"); |
1651 | 1659 | ||
1652 | mActionBeamVCard = 0; | 1660 | mActionBeamVCard = 0; |
1653 | mActionBeam = 0; | 1661 | mActionBeam = 0; |
1654 | 1662 | ||
1655 | #ifndef DESKTOP_VERSION | 1663 | #ifndef DESKTOP_VERSION |
1656 | if ( Ir::supported() ) { | 1664 | if ( Ir::supported() ) { |
1657 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1665 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1658 | SLOT( beamVCard() ), actionCollection(), | 1666 | SLOT( beamVCard() ), actionCollection(), |
1659 | "kaddressbook_beam_vcard" ); | 1667 | "kaddressbook_beam_vcard" ); |
1660 | 1668 | ||
1661 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1669 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1662 | SLOT( beamMySelf() ), actionCollection(), | 1670 | SLOT( beamMySelf() ), actionCollection(), |
1663 | "kaddressbook_beam_myself" ); | 1671 | "kaddressbook_beam_myself" ); |
1664 | } | 1672 | } |
1665 | #endif | 1673 | #endif |
1666 | 1674 | ||
1667 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1675 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1668 | this, SLOT( editContact2() ), | 1676 | this, SLOT( editContact2() ), |
1669 | actionCollection(), "file_properties" ); | 1677 | actionCollection(), "file_properties" ); |
1670 | 1678 | ||
1671 | #ifdef KAB_EMBEDDED | 1679 | #ifdef KAB_EMBEDDED |
1672 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1680 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1673 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1681 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1674 | mMainWindow, SLOT( exit() ), | 1682 | mMainWindow, SLOT( exit() ), |
1675 | actionCollection(), "quit" ); | 1683 | actionCollection(), "quit" ); |
1676 | #endif //KAB_EMBEDDED | 1684 | #endif //KAB_EMBEDDED |
1677 | 1685 | ||
1678 | // edit menu | 1686 | // edit menu |
1679 | if ( mIsPart ) { | 1687 | if ( mIsPart ) { |
1680 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1688 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1681 | SLOT( copyContacts() ), actionCollection(), | 1689 | SLOT( copyContacts() ), actionCollection(), |
1682 | "kaddressbook_copy" ); | 1690 | "kaddressbook_copy" ); |
1683 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1691 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1684 | SLOT( cutContacts() ), actionCollection(), | 1692 | SLOT( cutContacts() ), actionCollection(), |
1685 | "kaddressbook_cut" ); | 1693 | "kaddressbook_cut" ); |
1686 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1694 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1687 | SLOT( pasteContacts() ), actionCollection(), | 1695 | SLOT( pasteContacts() ), actionCollection(), |
1688 | "kaddressbook_paste" ); | 1696 | "kaddressbook_paste" ); |
1689 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1697 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1690 | SLOT( selectAllContacts() ), actionCollection(), | 1698 | SLOT( selectAllContacts() ), actionCollection(), |
1691 | "kaddressbook_select_all" ); | 1699 | "kaddressbook_select_all" ); |
1692 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1700 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1693 | SLOT( undo() ), actionCollection(), | 1701 | SLOT( undo() ), actionCollection(), |
1694 | "kaddressbook_undo" ); | 1702 | "kaddressbook_undo" ); |
1695 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1703 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1696 | this, SLOT( redo() ), actionCollection(), | 1704 | this, SLOT( redo() ), actionCollection(), |
1697 | "kaddressbook_redo" ); | 1705 | "kaddressbook_redo" ); |
1698 | } else { | 1706 | } else { |
1699 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1707 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1700 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1708 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1701 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1709 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1702 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1710 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1703 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1711 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1704 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1712 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1705 | } | 1713 | } |
1706 | 1714 | ||
1707 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1715 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1708 | Key_Delete, this, SLOT( deleteContacts() ), | 1716 | Key_Delete, this, SLOT( deleteContacts() ), |
1709 | actionCollection(), "edit_delete" ); | 1717 | actionCollection(), "edit_delete" ); |
1710 | 1718 | ||
1711 | mActionUndo->setEnabled( false ); | 1719 | mActionUndo->setEnabled( false ); |
1712 | mActionRedo->setEnabled( false ); | 1720 | mActionRedo->setEnabled( false ); |
1713 | 1721 | ||
1714 | // settings menu | 1722 | // settings menu |
1715 | #ifdef KAB_EMBEDDED | 1723 | #ifdef KAB_EMBEDDED |
1716 | //US special menuentry to configure the addressbook resources. On KDE | 1724 | //US special menuentry to configure the addressbook resources. On KDE |
1717 | // you do that through the control center !!! | 1725 | // you do that through the control center !!! |
1718 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1726 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1719 | SLOT( configureResources() ), actionCollection(), | 1727 | SLOT( configureResources() ), actionCollection(), |
1720 | "kaddressbook_configure_resources" ); | 1728 | "kaddressbook_configure_resources" ); |
1721 | #endif //KAB_EMBEDDED | 1729 | #endif //KAB_EMBEDDED |
1722 | 1730 | ||
1723 | if ( mIsPart ) { | 1731 | if ( mIsPart ) { |
1724 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1732 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1725 | SLOT( openConfigDialog() ), actionCollection(), | 1733 | SLOT( openConfigDialog() ), actionCollection(), |
1726 | "kaddressbook_configure" ); | 1734 | "kaddressbook_configure" ); |
1727 | 1735 | ||
1728 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1736 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1729 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1737 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1730 | "kaddressbook_configure_shortcuts" ); | 1738 | "kaddressbook_configure_shortcuts" ); |
1731 | #ifdef KAB_EMBEDDED | 1739 | #ifdef KAB_EMBEDDED |
1732 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1740 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1733 | mActionConfigureToolbars->setEnabled( false ); | 1741 | mActionConfigureToolbars->setEnabled( false ); |
1734 | #endif //KAB_EMBEDDED | 1742 | #endif //KAB_EMBEDDED |
1735 | 1743 | ||
1736 | } else { | 1744 | } else { |
1737 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1745 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1738 | 1746 | ||
1739 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1747 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1740 | } | 1748 | } |
1741 | 1749 | ||
1742 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1750 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1743 | actionCollection(), "options_show_jump_bar" ); | 1751 | actionCollection(), "options_show_jump_bar" ); |
1744 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1752 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1745 | 1753 | ||
1746 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1754 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1747 | actionCollection(), "options_show_details" ); | 1755 | actionCollection(), "options_show_details" ); |
1748 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1756 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1749 | 1757 | ||
1750 | // misc | 1758 | // misc |
1751 | // only enable LDAP lookup if we can handle the protocol | 1759 | // only enable LDAP lookup if we can handle the protocol |
1752 | #ifndef KAB_EMBEDDED | 1760 | #ifndef KAB_EMBEDDED |
1753 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1761 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1754 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1762 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1755 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1763 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1756 | "ldap_lookup" ); | 1764 | "ldap_lookup" ); |
1757 | } | 1765 | } |
1758 | #else //KAB_EMBEDDED | 1766 | #else //KAB_EMBEDDED |
1759 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1767 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1760 | #endif //KAB_EMBEDDED | 1768 | #endif //KAB_EMBEDDED |
1761 | 1769 | ||
1762 | 1770 | ||
1763 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1771 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1764 | SLOT( setWhoAmI() ), actionCollection(), | 1772 | SLOT( setWhoAmI() ), actionCollection(), |
1765 | "set_personal" ); | 1773 | "set_personal" ); |
1766 | 1774 | ||
1767 | 1775 | ||
1768 | 1776 | ||
1769 | 1777 | ||
1770 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1778 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1771 | SLOT( setCategories() ), actionCollection(), | 1779 | SLOT( setCategories() ), actionCollection(), |
1772 | "edit_set_categories" ); | 1780 | "edit_set_categories" ); |
1773 | 1781 | ||
1774 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1782 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1775 | SLOT( removeVoice() ), actionCollection(), | 1783 | SLOT( removeVoice() ), actionCollection(), |
1776 | "remove_voice" ); | 1784 | "remove_voice" ); |
1777 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1785 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1778 | SLOT( importFromOL() ), actionCollection(), | 1786 | SLOT( importFromOL() ), actionCollection(), |
1779 | "import_OL" ); | 1787 | "import_OL" ); |
1780 | #ifdef KAB_EMBEDDED | 1788 | #ifdef KAB_EMBEDDED |
1781 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1789 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1782 | this, SLOT( showLicence() ), actionCollection(), | 1790 | this, SLOT( showLicence() ), actionCollection(), |
1783 | "licence_about_data" ); | 1791 | "licence_about_data" ); |
1784 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1792 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1785 | this, SLOT( faq() ), actionCollection(), | 1793 | this, SLOT( faq() ), actionCollection(), |
1786 | "faq_about_data" ); | 1794 | "faq_about_data" ); |
1787 | 1795 | ||
1788 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1796 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1789 | this, SLOT( createAboutData() ), actionCollection(), | 1797 | this, SLOT( createAboutData() ), actionCollection(), |
1790 | "kaddressbook_about_data" ); | 1798 | "kaddressbook_about_data" ); |
1791 | #endif //KAB_EMBEDDED | 1799 | #endif //KAB_EMBEDDED |
1792 | 1800 | ||
1793 | clipboardDataChanged(); | 1801 | clipboardDataChanged(); |
1794 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1802 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1795 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1803 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1796 | } | 1804 | } |
1797 | 1805 | ||
1798 | //US we need this function, to plug all actions into the correct menues. | 1806 | //US we need this function, to plug all actions into the correct menues. |
1799 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1807 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1800 | void KABCore::addActionsManually() | 1808 | void KABCore::addActionsManually() |
1801 | { | 1809 | { |
1802 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1810 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1803 | 1811 | ||
1804 | #ifdef KAB_EMBEDDED | 1812 | #ifdef KAB_EMBEDDED |
1805 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1813 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1806 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1814 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1807 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1815 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1808 | 1816 | ||
1809 | KToolBar* tb = mMainWindow->toolBar(); | 1817 | KToolBar* tb = mMainWindow->toolBar(); |
1810 | 1818 | ||
1811 | #ifdef DESKTOP_VERSION | 1819 | #ifdef DESKTOP_VERSION |
1812 | QMenuBar* mb = mMainWindow->menuBar(); | 1820 | QMenuBar* mb = mMainWindow->menuBar(); |
1813 | 1821 | ||
1814 | //US setup menubar. | 1822 | //US setup menubar. |
1815 | //Disable the following block if you do not want to have a menubar. | 1823 | //Disable the following block if you do not want to have a menubar. |
1816 | mb->insertItem( "&File", fileMenu ); | 1824 | mb->insertItem( "&File", fileMenu ); |
1817 | mb->insertItem( "&Edit", editMenu ); | 1825 | mb->insertItem( "&Edit", editMenu ); |
1818 | mb->insertItem( "&View", viewMenu ); | 1826 | mb->insertItem( "&View", viewMenu ); |
1819 | mb->insertItem( "&Settings", settingsMenu ); | 1827 | mb->insertItem( "&Settings", settingsMenu ); |
1820 | mb->insertItem( "&Change selected", changeMenu ); | 1828 | mb->insertItem( "&Change selected", changeMenu ); |
1821 | mb->insertItem( "&Help", helpMenu ); | 1829 | mb->insertItem( "&Help", helpMenu ); |
1822 | mIncSearchWidget = new IncSearchWidget( tb ); | 1830 | mIncSearchWidget = new IncSearchWidget( tb ); |
1823 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1831 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1824 | 1832 | ||
1825 | #else | 1833 | #else |
1826 | //US setup toolbar | 1834 | //US setup toolbar |
1827 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1835 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1828 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1836 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1829 | menuBarTB->insertItem( "ME", popupBarTB); | 1837 | menuBarTB->insertItem( "ME", popupBarTB); |
1830 | tb->insertWidget(-1, 0, menuBarTB); | 1838 | tb->insertWidget(-1, 0, menuBarTB); |
1831 | mIncSearchWidget = new IncSearchWidget( tb ); | 1839 | mIncSearchWidget = new IncSearchWidget( tb ); |
1832 | 1840 | ||
1833 | tb->enableMoving(false); | 1841 | tb->enableMoving(false); |
1834 | popupBarTB->insertItem( "&File", fileMenu ); | 1842 | popupBarTB->insertItem( "&File", fileMenu ); |
1835 | popupBarTB->insertItem( "&Edit", editMenu ); | 1843 | popupBarTB->insertItem( "&Edit", editMenu ); |
1836 | popupBarTB->insertItem( "&View", viewMenu ); | 1844 | popupBarTB->insertItem( "&View", viewMenu ); |
1837 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1845 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1838 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1846 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1839 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1847 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1840 | popupBarTB->insertItem( "&Help", helpMenu ); | 1848 | popupBarTB->insertItem( "&Help", helpMenu ); |
1841 | if (QApplication::desktop()->width() > 320 ) { | 1849 | if (QApplication::desktop()->width() > 320 ) { |
1842 | // mViewManager->getFilterAction()->plug ( tb); | 1850 | // mViewManager->getFilterAction()->plug ( tb); |
1843 | } | 1851 | } |
1844 | #endif | 1852 | #endif |
1845 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1853 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1846 | 1854 | ||
1847 | 1855 | ||
1848 | 1856 | ||
1849 | //US Now connect the actions with the menue entries. | 1857 | //US Now connect the actions with the menue entries. |
1850 | mActionPrint->plug( fileMenu ); | 1858 | mActionPrint->plug( fileMenu ); |
1851 | mActionMail->plug( fileMenu ); | 1859 | mActionMail->plug( fileMenu ); |
1852 | fileMenu->insertSeparator(); | 1860 | fileMenu->insertSeparator(); |
1853 | 1861 | ||
1854 | mActionNewContact->plug( fileMenu ); | 1862 | mActionNewContact->plug( fileMenu ); |
1855 | mActionNewContact->plug( tb ); | 1863 | mActionNewContact->plug( tb ); |
1856 | 1864 | ||
1857 | mActionEditAddressee->plug( fileMenu ); | 1865 | mActionEditAddressee->plug( fileMenu ); |
1858 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1866 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1859 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1867 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1860 | mActionEditAddressee->plug( tb ); | 1868 | mActionEditAddressee->plug( tb ); |
1861 | 1869 | ||
1862 | fileMenu->insertSeparator(); | 1870 | fileMenu->insertSeparator(); |
1863 | mActionSave->plug( fileMenu ); | 1871 | mActionSave->plug( fileMenu ); |
1864 | fileMenu->insertItem( "&Import", ImportMenu ); | 1872 | fileMenu->insertItem( "&Import", ImportMenu ); |
1865 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1873 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1866 | fileMenu->insertSeparator(); | 1874 | fileMenu->insertSeparator(); |
1867 | mActionMailVCard->plug( fileMenu ); | 1875 | mActionMailVCard->plug( fileMenu ); |
1868 | #ifndef DESKTOP_VERSION | 1876 | #ifndef DESKTOP_VERSION |
1869 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1877 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1870 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1878 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1871 | #endif | 1879 | #endif |
1872 | fileMenu->insertSeparator(); | 1880 | fileMenu->insertSeparator(); |
1873 | mActionQuit->plug( fileMenu ); | 1881 | mActionQuit->plug( fileMenu ); |
1874 | #ifdef _WIN32_ | 1882 | #ifdef _WIN32_ |
1875 | mActionImportOL->plug( ImportMenu ); | 1883 | mActionImportOL->plug( ImportMenu ); |
1876 | #endif | 1884 | #endif |
1877 | // edit menu | 1885 | // edit menu |
1878 | mActionUndo->plug( editMenu ); | 1886 | mActionUndo->plug( editMenu ); |
1879 | mActionRedo->plug( editMenu ); | 1887 | mActionRedo->plug( editMenu ); |
1880 | editMenu->insertSeparator(); | 1888 | editMenu->insertSeparator(); |
1881 | mActionCut->plug( editMenu ); | 1889 | mActionCut->plug( editMenu ); |
1882 | mActionCopy->plug( editMenu ); | 1890 | mActionCopy->plug( editMenu ); |
1883 | mActionPaste->plug( editMenu ); | 1891 | mActionPaste->plug( editMenu ); |
1884 | mActionDelete->plug( editMenu ); | 1892 | mActionDelete->plug( editMenu ); |
1885 | editMenu->insertSeparator(); | 1893 | editMenu->insertSeparator(); |
1886 | mActionSelectAll->plug( editMenu ); | 1894 | mActionSelectAll->plug( editMenu ); |
1887 | 1895 | ||
1888 | mActionRemoveVoice->plug( changeMenu ); | 1896 | mActionRemoveVoice->plug( changeMenu ); |
1889 | // settings menu | 1897 | // settings menu |
1890 | //US special menuentry to configure the addressbook resources. On KDE | 1898 | //US special menuentry to configure the addressbook resources. On KDE |
1891 | // you do that through the control center !!! | 1899 | // you do that through the control center !!! |
1892 | mActionConfigResources->plug( settingsMenu ); | 1900 | mActionConfigResources->plug( settingsMenu ); |
1893 | settingsMenu->insertSeparator(); | 1901 | settingsMenu->insertSeparator(); |
1894 | 1902 | ||
1895 | mActionConfigKAddressbook->plug( settingsMenu ); | 1903 | mActionConfigKAddressbook->plug( settingsMenu ); |
1896 | 1904 | ||
1897 | if ( mIsPart ) { | 1905 | if ( mIsPart ) { |
1898 | mActionConfigShortcuts->plug( settingsMenu ); | 1906 | mActionConfigShortcuts->plug( settingsMenu ); |
1899 | mActionConfigureToolbars->plug( settingsMenu ); | 1907 | mActionConfigureToolbars->plug( settingsMenu ); |
1900 | 1908 | ||
1901 | } else { | 1909 | } else { |
1902 | mActionKeyBindings->plug( settingsMenu ); | 1910 | mActionKeyBindings->plug( settingsMenu ); |
1903 | } | 1911 | } |
1904 | 1912 | ||
1905 | settingsMenu->insertSeparator(); | 1913 | settingsMenu->insertSeparator(); |
1906 | 1914 | ||
1907 | mActionJumpBar->plug( settingsMenu ); | 1915 | mActionJumpBar->plug( settingsMenu ); |
1908 | mActionDetails->plug( settingsMenu ); | 1916 | mActionDetails->plug( settingsMenu ); |
1909 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 1917 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1910 | mActionDetails->plug( tb ); | 1918 | mActionDetails->plug( tb ); |
1911 | settingsMenu->insertSeparator(); | 1919 | settingsMenu->insertSeparator(); |
1912 | 1920 | ||
1913 | mActionWhoAmI->plug( settingsMenu ); | 1921 | mActionWhoAmI->plug( settingsMenu ); |
1914 | mActionCategories->plug( settingsMenu ); | 1922 | mActionCategories->plug( settingsMenu ); |
1915 | 1923 | ||
1916 | mActionLicence->plug( helpMenu ); | 1924 | mActionLicence->plug( helpMenu ); |
1917 | mActionFaq->plug( helpMenu ); | 1925 | mActionFaq->plug( helpMenu ); |
1918 | mActionAboutKAddressbook->plug( helpMenu ); | 1926 | mActionAboutKAddressbook->plug( helpMenu ); |
1919 | 1927 | ||
1920 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 1928 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1921 | 1929 | ||
1922 | mActionSave->plug( tb ); | 1930 | mActionSave->plug( tb ); |
1923 | mViewManager->getFilterAction()->plug ( tb); | 1931 | mViewManager->getFilterAction()->plug ( tb); |
1924 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 1932 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1925 | mActionUndo->plug( tb ); | 1933 | mActionUndo->plug( tb ); |
1926 | mActionDelete->plug( tb ); | 1934 | mActionDelete->plug( tb ); |
1927 | mActionRedo->plug( tb ); | 1935 | mActionRedo->plug( tb ); |
1928 | } | 1936 | } |
1929 | } | 1937 | } |
1930 | //mActionQuit->plug ( tb ); | 1938 | //mActionQuit->plug ( tb ); |
1931 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1939 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1932 | 1940 | ||
1933 | //US link the searchwidget first to this. | 1941 | //US link the searchwidget first to this. |
1934 | // The real linkage to the toolbar happens later. | 1942 | // The real linkage to the toolbar happens later. |
1935 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1943 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1936 | //US tb->insertItem( mIncSearchWidget ); | 1944 | //US tb->insertItem( mIncSearchWidget ); |
1937 | /*US | 1945 | /*US |
1938 | mIncSearchWidget = new IncSearchWidget( tb ); | 1946 | mIncSearchWidget = new IncSearchWidget( tb ); |
1939 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1947 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1940 | SLOT( incrementalSearch( const QString& ) ) ); | 1948 | SLOT( incrementalSearch( const QString& ) ) ); |
1941 | 1949 | ||
1942 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1950 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1943 | 1951 | ||
1944 | //US topLayout->addWidget( mJumpButtonBar ); | 1952 | //US topLayout->addWidget( mJumpButtonBar ); |
1945 | this->layout()->add( mJumpButtonBar ); | 1953 | this->layout()->add( mJumpButtonBar ); |
1946 | */ | 1954 | */ |
1947 | 1955 | ||
1948 | #endif //KAB_EMBEDDED | 1956 | #endif //KAB_EMBEDDED |
1949 | } | 1957 | } |
1950 | void KABCore::showLicence() | 1958 | void KABCore::showLicence() |
1951 | { | 1959 | { |
1952 | KApplication::showLicence(); | 1960 | KApplication::showLicence(); |
1953 | } | 1961 | } |
1954 | void KABCore::removeVoice() | 1962 | void KABCore::removeVoice() |
1955 | { | 1963 | { |
1956 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 1964 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
1957 | return; | 1965 | return; |
1958 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1966 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1959 | KABC::Addressee::List::Iterator it; | 1967 | KABC::Addressee::List::Iterator it; |
1960 | for ( it = list.begin(); it != list.end(); ++it ) { | 1968 | for ( it = list.begin(); it != list.end(); ++it ) { |
1961 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1969 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1962 | PhoneNumber::List::Iterator phoneIt; | 1970 | PhoneNumber::List::Iterator phoneIt; |
1963 | bool found = false; | 1971 | bool found = false; |
1964 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1972 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1965 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1973 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1966 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1974 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1967 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1975 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1968 | (*it).insertPhoneNumber( (*phoneIt) ); | 1976 | (*it).insertPhoneNumber( (*phoneIt) ); |
1969 | found = true; | 1977 | found = true; |
1970 | } | 1978 | } |
1971 | } | 1979 | } |
1972 | 1980 | ||
1973 | } | 1981 | } |
1974 | if ( found ) | 1982 | if ( found ) |
1975 | contactModified((*it) ); | 1983 | contactModified((*it) ); |
1976 | } | 1984 | } |
1977 | } | 1985 | } |
1978 | 1986 | ||
1979 | 1987 | ||
1980 | 1988 | ||
1981 | void KABCore::clipboardDataChanged() | 1989 | void KABCore::clipboardDataChanged() |
1982 | { | 1990 | { |
1983 | 1991 | ||
1984 | if ( mReadWrite ) | 1992 | if ( mReadWrite ) |
1985 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1993 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1986 | 1994 | ||
1987 | } | 1995 | } |
1988 | 1996 | ||
1989 | void KABCore::updateActionMenu() | 1997 | void KABCore::updateActionMenu() |
1990 | { | 1998 | { |
1991 | UndoStack *undo = UndoStack::instance(); | 1999 | UndoStack *undo = UndoStack::instance(); |
1992 | RedoStack *redo = RedoStack::instance(); | 2000 | RedoStack *redo = RedoStack::instance(); |
1993 | 2001 | ||
1994 | if ( undo->isEmpty() ) | 2002 | if ( undo->isEmpty() ) |
1995 | mActionUndo->setText( i18n( "Undo" ) ); | 2003 | mActionUndo->setText( i18n( "Undo" ) ); |
1996 | else | 2004 | else |
1997 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2005 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1998 | 2006 | ||
1999 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2007 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2000 | 2008 | ||
2001 | if ( !redo->top() ) | 2009 | if ( !redo->top() ) |
2002 | mActionRedo->setText( i18n( "Redo" ) ); | 2010 | mActionRedo->setText( i18n( "Redo" ) ); |
2003 | else | 2011 | else |
2004 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2012 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2005 | 2013 | ||
2006 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2014 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2007 | } | 2015 | } |
2008 | 2016 | ||
2009 | void KABCore::configureKeyBindings() | 2017 | void KABCore::configureKeyBindings() |
2010 | { | 2018 | { |
2011 | #ifndef KAB_EMBEDDED | 2019 | #ifndef KAB_EMBEDDED |
2012 | KKeyDialog::configure( actionCollection(), true ); | 2020 | KKeyDialog::configure( actionCollection(), true ); |
2013 | #else //KAB_EMBEDDED | 2021 | #else //KAB_EMBEDDED |
2014 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2022 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2015 | #endif //KAB_EMBEDDED | 2023 | #endif //KAB_EMBEDDED |
2016 | } | 2024 | } |
2017 | 2025 | ||
2018 | #ifdef KAB_EMBEDDED | 2026 | #ifdef KAB_EMBEDDED |
2019 | void KABCore::configureResources() | 2027 | void KABCore::configureResources() |
2020 | { | 2028 | { |
2021 | KRES::KCMKResources dlg( this, "" , 0 ); | 2029 | KRES::KCMKResources dlg( this, "" , 0 ); |
2022 | 2030 | ||
2023 | if ( !dlg.exec() ) | 2031 | if ( !dlg.exec() ) |
2024 | return; | 2032 | return; |
2025 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2033 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2026 | } | 2034 | } |
2027 | #endif //KAB_EMBEDDED | 2035 | #endif //KAB_EMBEDDED |
2028 | 2036 | ||
2029 | 2037 | ||
2030 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2038 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2031 | * for the attendees list of an event. | 2039 | * for the attendees list of an event. |
2032 | */ | 2040 | */ |
2033 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2041 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2034 | { | 2042 | { |
2035 | QStringList nameList; | 2043 | QStringList nameList; |
2036 | QStringList emailList; | 2044 | QStringList emailList; |
2037 | QStringList uidList; | 2045 | QStringList uidList; |
2038 | 2046 | ||
2039 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2047 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2040 | uint i=0; | 2048 | uint i=0; |
2041 | for (i=0; i < list.count(); i++) | 2049 | for (i=0; i < list.count(); i++) |
2042 | { | 2050 | { |
2043 | nameList.append(list[i].realName()); | 2051 | nameList.append(list[i].realName()); |
2044 | emailList.append(list[i].preferredEmail()); | 2052 | emailList.append(list[i].preferredEmail()); |
2045 | uidList.append(list[i].uid()); | 2053 | uidList.append(list[i].uid()); |
2046 | } | 2054 | } |
2047 | 2055 | ||
2048 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2056 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2049 | 2057 | ||
2050 | } | 2058 | } |
2051 | 2059 | ||
2052 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2060 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2053 | */ | 2061 | */ |
2054 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2062 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2055 | { | 2063 | { |
2056 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2064 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2057 | 2065 | ||
2058 | QString foundUid = QString::null; | 2066 | QString foundUid = QString::null; |
2059 | if ( ! uid.isEmpty() ) { | 2067 | if ( ! uid.isEmpty() ) { |
2060 | Addressee adrr = mAddressBook->findByUid( uid ); | 2068 | Addressee adrr = mAddressBook->findByUid( uid ); |
2061 | if ( !adrr.isEmpty() ) { | 2069 | if ( !adrr.isEmpty() ) { |
2062 | foundUid = uid; | 2070 | foundUid = uid; |
2063 | } | 2071 | } |
2064 | if ( email == "sendbacklist" ) { | 2072 | if ( email == "sendbacklist" ) { |
2065 | //qDebug("ssssssssssssssssssssssend "); | 2073 | //qDebug("ssssssssssssssssssssssend "); |
2066 | QStringList nameList; | 2074 | QStringList nameList; |
2067 | QStringList emailList; | 2075 | QStringList emailList; |
2068 | QStringList uidList; | 2076 | QStringList uidList; |
2069 | nameList.append(adrr.realName()); | 2077 | nameList.append(adrr.realName()); |
2070 | emailList = adrr.emails(); | 2078 | emailList = adrr.emails(); |
2071 | uidList.append( adrr.preferredEmail()); | 2079 | uidList.append( adrr.preferredEmail()); |
2072 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2080 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2073 | return; | 2081 | return; |
2074 | } | 2082 | } |
2075 | 2083 | ||
2076 | } | 2084 | } |
2077 | 2085 | ||
2078 | if ( email == "sendbacklist" ) | 2086 | if ( email == "sendbacklist" ) |
2079 | return; | 2087 | return; |
2080 | if (foundUid.isEmpty()) | 2088 | if (foundUid.isEmpty()) |
2081 | { | 2089 | { |
2082 | //find the uid of the person first | 2090 | //find the uid of the person first |
2083 | Addressee::List namelist; | 2091 | Addressee::List namelist; |
2084 | Addressee::List emaillist; | 2092 | Addressee::List emaillist; |
2085 | 2093 | ||
2086 | if (!name.isEmpty()) | 2094 | if (!name.isEmpty()) |
2087 | namelist = mAddressBook->findByName( name ); | 2095 | namelist = mAddressBook->findByName( name ); |
2088 | 2096 | ||
2089 | if (!email.isEmpty()) | 2097 | if (!email.isEmpty()) |
2090 | emaillist = mAddressBook->findByEmail( email ); | 2098 | emaillist = mAddressBook->findByEmail( email ); |
2091 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2099 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2092 | //check if we have a match in Namelist and Emaillist | 2100 | //check if we have a match in Namelist and Emaillist |
2093 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2101 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2094 | foundUid = emaillist[0].uid(); | 2102 | foundUid = emaillist[0].uid(); |
2095 | } | 2103 | } |
2096 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2104 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2097 | foundUid = namelist[0].uid(); | 2105 | foundUid = namelist[0].uid(); |
2098 | else | 2106 | else |
2099 | { | 2107 | { |
2100 | for (int i = 0; i < namelist.count(); i++) | 2108 | for (int i = 0; i < namelist.count(); i++) |
2101 | { | 2109 | { |
2102 | for (int j = 0; j < emaillist.count(); j++) | 2110 | for (int j = 0; j < emaillist.count(); j++) |
2103 | { | 2111 | { |
2104 | if (namelist[i] == emaillist[j]) | 2112 | if (namelist[i] == emaillist[j]) |
2105 | { | 2113 | { |
2106 | foundUid = namelist[i].uid(); | 2114 | foundUid = namelist[i].uid(); |
2107 | } | 2115 | } |
2108 | } | 2116 | } |
2109 | } | 2117 | } |
2110 | } | 2118 | } |
2111 | } | 2119 | } |
2112 | else | 2120 | else |
2113 | { | 2121 | { |
2114 | foundUid = uid; | 2122 | foundUid = uid; |
2115 | } | 2123 | } |
2116 | 2124 | ||
2117 | if (!foundUid.isEmpty()) | 2125 | if (!foundUid.isEmpty()) |
2118 | { | 2126 | { |
2119 | 2127 | ||
2120 | // raise Ka/Pi if it is in the background | 2128 | // raise Ka/Pi if it is in the background |
2121 | #ifndef DESKTOP_VERSION | 2129 | #ifndef DESKTOP_VERSION |
2122 | #ifndef KORG_NODCOP | 2130 | #ifndef KORG_NODCOP |
2123 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2131 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2124 | #endif | 2132 | #endif |
2125 | #endif | 2133 | #endif |
2126 | 2134 | ||
2127 | mMainWindow->showMaximized(); | 2135 | mMainWindow->showMaximized(); |
2128 | mMainWindow-> raise(); | 2136 | mMainWindow-> raise(); |
2129 | 2137 | ||
2130 | mViewManager->setSelected( "", false); | 2138 | mViewManager->setSelected( "", false); |
2131 | mViewManager->refreshView( "" ); | 2139 | mViewManager->refreshView( "" ); |
2132 | mViewManager->setSelected( foundUid, true ); | 2140 | mViewManager->setSelected( foundUid, true ); |
2133 | mViewManager->refreshView( foundUid ); | 2141 | mViewManager->refreshView( foundUid ); |
2134 | 2142 | ||
2135 | if ( !mMultipleViewsAtOnce ) | 2143 | if ( !mMultipleViewsAtOnce ) |
2136 | { | 2144 | { |
2137 | setDetailsVisible( true ); | 2145 | setDetailsVisible( true ); |
2138 | mActionDetails->setChecked(true); | 2146 | mActionDetails->setChecked(true); |
2139 | } | 2147 | } |
2140 | } | 2148 | } |
2141 | } | 2149 | } |
2142 | 2150 | ||
2143 | 2151 | ||
2144 | void KABCore::faq() | 2152 | void KABCore::faq() |
2145 | { | 2153 | { |
2146 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2154 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2147 | } | 2155 | } |
2148 | 2156 | ||
2149 | 2157 | ||
2150 | 2158 | ||
2151 | 2159 | ||
2152 | #ifndef KAB_EMBEDDED | 2160 | #ifndef KAB_EMBEDDED |
2153 | #include "kabcore.moc" | 2161 | #include "kabcore.moc" |
2154 | #endif //KAB_EMBEDDED | 2162 | #endif //KAB_EMBEDDED |