-rw-r--r-- | bin/kdepim/WhatsNew.txt | 8 | ||||
-rw-r--r-- | bin/kdepim/kaddressbook/icons16/z_menu.png | bin | 0 -> 713 bytes | |||
-rw-r--r-- | bin/kdepim/kaddressbook/icons22/z_menu.png | bin | 0 -> 1017 bytes | |||
-rw-r--r-- | bin/kdepim/korganizer/icons16/z_menu.png | bin | 0 -> 713 bytes | |||
-rw-r--r-- | bin/kdepim/korganizer/iconsmini/z_menu.png | bin | 0 -> 572 bytes | |||
-rw-r--r-- | bin/kdepim/korganizer/z_menu.png | bin | 0 -> 1017 bytes | |||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 7 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 29 | ||||
-rw-r--r-- | pwmanager/pwmanager/listviewpwm.cpp | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/listviewpwm.h | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmview.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.cpp | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.h | 2 |
14 files changed, 48 insertions, 16 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 657d1de..7438f9d 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,1027 +1,1035 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.15 ************ | ||
4 | |||
5 | PwM/Pi: | ||
6 | Added keyboard shorcuts for | ||
7 | - toggling summary view (space bar) | ||
8 | - delete item (delete + backspace key) | ||
9 | - add new item ( i + n key) | ||
10 | |||
3 | ********** VERSION 2.0.14 ************ | 11 | ********** VERSION 2.0.14 ************ |
4 | 12 | ||
5 | Made Passwordmanager PwM/Pi more userfriendly: | 13 | Made Passwordmanager PwM/Pi more userfriendly: |
6 | Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 14 | Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
7 | Fixed bug in KO/Pi todo printing. | 15 | Fixed bug in KO/Pi todo printing. |
8 | Made Qtopia calendar import possible on desktop . | 16 | Made Qtopia calendar import possible on desktop . |
9 | 17 | ||
10 | ********** VERSION 2.0.13 ************ | 18 | ********** VERSION 2.0.13 ************ |
11 | 19 | ||
12 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. | 20 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. |
13 | 21 | ||
14 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". | 22 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". |
15 | 23 | ||
16 | OM/Pi: | 24 | OM/Pi: |
17 | Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. | 25 | Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. |
18 | Added missing German translation. | 26 | Added missing German translation. |
19 | Added warning if path is specified in local folder settings of account config. | 27 | Added warning if path is specified in local folder settings of account config. |
20 | 28 | ||
21 | ********** VERSION 2.0.12 ************ | 29 | ********** VERSION 2.0.12 ************ |
22 | 30 | ||
23 | KO/Pi: | 31 | KO/Pi: |
24 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. | 32 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. |
25 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. | 33 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. |
26 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. | 34 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. |
27 | 35 | ||
28 | Fixed problem in pi-sync mode when wrong password was sent. | 36 | Fixed problem in pi-sync mode when wrong password was sent. |
29 | 37 | ||
30 | OM/Pi: | 38 | OM/Pi: |
31 | Fixed a crash when displaying mails with "Show mail as html" was checked in the config. | 39 | Fixed a crash when displaying mails with "Show mail as html" was checked in the config. |
32 | Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. | 40 | Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. |
33 | 41 | ||
34 | ********** VERSION 2.0.11 ************ | 42 | ********** VERSION 2.0.11 ************ |
35 | 43 | ||
36 | Fixed some problems in pi-sync mode | 44 | Fixed some problems in pi-sync mode |
37 | (e.g. details of events were not synced properly) | 45 | (e.g. details of events were not synced properly) |
38 | 46 | ||
39 | ********** VERSION 2.0.10 ************ | 47 | ********** VERSION 2.0.10 ************ |
40 | 48 | ||
41 | KO/Pi: | 49 | KO/Pi: |
42 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. | 50 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. |
43 | This is fixed. | 51 | This is fixed. |
44 | Changed the search dialog a bit to make it more user friendly. | 52 | Changed the search dialog a bit to make it more user friendly. |
45 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). | 53 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). |
46 | 54 | ||
47 | Added config option to hide the week number in KO/Pi toolbar. | 55 | Added config option to hide the week number in KO/Pi toolbar. |
48 | 56 | ||
49 | ********** VERSION 2.0.9 ************ | 57 | ********** VERSION 2.0.9 ************ |
50 | 58 | ||
51 | Made month view icons for multiday events a bit nicer. | 59 | Made month view icons for multiday events a bit nicer. |
52 | Some minor fixes in KO/Pi | 60 | Some minor fixes in KO/Pi |
53 | (e.g. go to today did not work for new week view properly). | 61 | (e.g. go to today did not work for new week view properly). |
54 | 62 | ||
55 | 63 | ||
56 | ********** VERSION 2.0.8 ************ | 64 | ********** VERSION 2.0.8 ************ |
57 | 65 | ||
58 | Fixed a problem in dependency info in the ipk files for the Zaurus. | 66 | Fixed a problem in dependency info in the ipk files for the Zaurus. |
59 | 67 | ||
60 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. | 68 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. |
61 | 69 | ||
62 | Added a "go today" button to the datepicker. | 70 | Added a "go today" button to the datepicker. |
63 | 71 | ||
64 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) | 72 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) |
65 | and made it configureable to show these values. | 73 | and made it configureable to show these values. |
66 | 74 | ||
67 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. | 75 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. |
68 | 76 | ||
69 | 77 | ||
70 | ********** VERSION 2.0.7 ************ | 78 | ********** VERSION 2.0.7 ************ |
71 | 79 | ||
72 | Added global application font settings | 80 | Added global application font settings |
73 | (for all KDE-Pim/Pi apps) to the general settings. | 81 | (for all KDE-Pim/Pi apps) to the general settings. |
74 | 82 | ||
75 | Fixed a problem in OM/Pi when trying to login to some IMAP servers | 83 | Fixed a problem in OM/Pi when trying to login to some IMAP servers |
76 | (like the IMAP server of Apple: mail.mac.com ) | 84 | (like the IMAP server of Apple: mail.mac.com ) |
77 | 85 | ||
78 | Added recurring todos to KO/Pi. | 86 | Added recurring todos to KO/Pi. |
79 | 87 | ||
80 | 88 | ||
81 | ********** VERSION 2.0.6 ************ | 89 | ********** VERSION 2.0.6 ************ |
82 | 90 | ||
83 | Some bugfixes in the pi-sync mode. | 91 | Some bugfixes in the pi-sync mode. |
84 | Added German translation for pi-sync mode. | 92 | Added German translation for pi-sync mode. |
85 | 93 | ||
86 | KO/Pi: | 94 | KO/Pi: |
87 | Made the todolist using alternate background. | 95 | Made the todolist using alternate background. |
88 | 96 | ||
89 | Other minor fixes in KO/Pi. | 97 | Other minor fixes in KO/Pi. |
90 | 98 | ||
91 | 99 | ||
92 | ********** VERSION 2.0.5 ************ | 100 | ********** VERSION 2.0.5 ************ |
93 | 101 | ||
94 | Bugfixes in KO/Pi. | 102 | Bugfixes in KO/Pi. |
95 | 103 | ||
96 | ********** VERSION 2.0.4 ************ | 104 | ********** VERSION 2.0.4 ************ |
97 | 105 | ||
98 | KO/Pi: | 106 | KO/Pi: |
99 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 107 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
100 | 108 | ||
101 | Added a general "select week number" to the toolbar. | 109 | Added a general "select week number" to the toolbar. |
102 | 110 | ||
103 | Fixed some small problem of the new features introduced in version 2.0.3. | 111 | Fixed some small problem of the new features introduced in version 2.0.3. |
104 | 112 | ||
105 | Made it possible to specify one specific category as category color, | 113 | Made it possible to specify one specific category as category color, |
106 | if more than one categories are selected. | 114 | if more than one categories are selected. |
107 | 115 | ||
108 | Fixed a bug in saving colors for categories with non-ascii characters. | 116 | Fixed a bug in saving colors for categories with non-ascii characters. |
109 | (Like, e.g. German Umlauts). | 117 | (Like, e.g. German Umlauts). |
110 | Propably you have to set your colors again for those categories. | 118 | Propably you have to set your colors again for those categories. |
111 | 119 | ||
112 | 120 | ||
113 | ********** VERSION 2.0.3 ************ | 121 | ********** VERSION 2.0.3 ************ |
114 | 122 | ||
115 | KO/Pi: | 123 | KO/Pi: |
116 | Added feature for changing alarm settings for many items at once: | 124 | Added feature for changing alarm settings for many items at once: |
117 | Open list view (or search dialog), select the desired items and choose in | 125 | Open list view (or search dialog), select the desired items and choose in |
118 | the popup menu: Set alarm for selected... | 126 | the popup menu: Set alarm for selected... |
119 | 127 | ||
120 | Added to the event/todo viewer the option to send an email to | 128 | Added to the event/todo viewer the option to send an email to |
121 | all attendees or all selected (with RSVP) attendees. | 129 | all attendees or all selected (with RSVP) attendees. |
122 | 130 | ||
123 | Made the week-month mode changing in month view faster. | 131 | Made the week-month mode changing in month view faster. |
124 | 132 | ||
125 | Made month view better useable with keyboard. | 133 | Made month view better useable with keyboard. |
126 | Now TAB key jumps to next cell with an event/todo. | 134 | Now TAB key jumps to next cell with an event/todo. |
127 | Scroll in cell with coursor keys, scroll in time (next week) with | 135 | Scroll in cell with coursor keys, scroll in time (next week) with |
128 | Shift/Control + coursorkeys. | 136 | Shift/Control + coursorkeys. |
129 | 137 | ||
130 | Fixed bug that the todo view flat mode was reset after first view update. | 138 | Fixed bug that the todo view flat mode was reset after first view update. |
131 | 139 | ||
132 | If a todo is displayed closed in the todo view, | 140 | If a todo is displayed closed in the todo view, |
133 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | 141 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. |
134 | 142 | ||
135 | Added info about the numbers of years to the caption (title) information about a birthday event. | 143 | Added info about the numbers of years to the caption (title) information about a birthday event. |
136 | 144 | ||
137 | Made completion date in todo editor editable. | 145 | Made completion date in todo editor editable. |
138 | 146 | ||
139 | Added possibility to save/load templates for journals. | 147 | Added possibility to save/load templates for journals. |
140 | (Which is just a simple "save text to file" or "insert text from file". | 148 | (Which is just a simple "save text to file" or "insert text from file". |
141 | 149 | ||
142 | ********** VERSION 2.0.2 ************ | 150 | ********** VERSION 2.0.2 ************ |
143 | 151 | ||
144 | KO/Pi: | 152 | KO/Pi: |
145 | Fixed the layout problem of the day label buttons | 153 | Fixed the layout problem of the day label buttons |
146 | of the agenda view introduced in version 2.0.1. | 154 | of the agenda view introduced in version 2.0.1. |
147 | 155 | ||
148 | Added WhatsThis support for the todo view and the list view. | 156 | Added WhatsThis support for the todo view and the list view. |
149 | 157 | ||
150 | Added a quite useful feature to the montview. | 158 | Added a quite useful feature to the montview. |
151 | Just click on the week numbers on the left. | 159 | Just click on the week numbers on the left. |
152 | And in the top right corner of month view/agenda view | 160 | And in the top right corner of month view/agenda view |
153 | there is now a "week number quick selector". | 161 | there is now a "week number quick selector". |
154 | (Click on the black triangle). | 162 | (Click on the black triangle). |
155 | 163 | ||
156 | Made the quite difficult timezone change in KO/Pi easy. | 164 | Made the quite difficult timezone change in KO/Pi easy. |
157 | 165 | ||
158 | OM/Pi: | 166 | OM/Pi: |
159 | Fixed too small icons on desktop. | 167 | Fixed too small icons on desktop. |
160 | Fixed non visible icons in mainwindow on Z with fastload enabled. | 168 | Fixed non visible icons in mainwindow on Z with fastload enabled. |
161 | Added signature file setting to smtp account config. | 169 | Added signature file setting to smtp account config. |
162 | And the signature can be edited and saved in the edit mail dialog. | 170 | And the signature can be edited and saved in the edit mail dialog. |
163 | That does mean: | 171 | That does mean: |
164 | Simply edit the signature for the selected smtp account in the | 172 | Simply edit the signature for the selected smtp account in the |
165 | edit new mail dialog and press the "save signature" button there. | 173 | edit new mail dialog and press the "save signature" button there. |
166 | Then the signature is saved to the file specified in the smtp account settings. | 174 | Then the signature is saved to the file specified in the smtp account settings. |
167 | If there is no file specified, it is saved automatically to the file | 175 | If there is no file specified, it is saved automatically to the file |
168 | kdepim/apps/kopiemail/<accountname>.sig. | 176 | kdepim/apps/kopiemail/<accountname>.sig. |
169 | 177 | ||
170 | 178 | ||
171 | 179 | ||
172 | ********** VERSION 2.0.1 ************ | 180 | ********** VERSION 2.0.1 ************ |
173 | 181 | ||
174 | Oooops ... I forgot to test on the Zaurus 5500 ... | 182 | Oooops ... I forgot to test on the Zaurus 5500 ... |
175 | 183 | ||
176 | Fixed many problems of new (english) strings (and german translations) | 184 | Fixed many problems of new (english) strings (and german translations) |
177 | introduced in the latest versions, where the text was not fitting on the | 185 | introduced in the latest versions, where the text was not fitting on the |
178 | 240x320 display of the Zaurus 5500. | 186 | 240x320 display of the Zaurus 5500. |
179 | 187 | ||
180 | KO/Pi: | 188 | KO/Pi: |
181 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 189 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
182 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 190 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
183 | 191 | ||
184 | Added items to the todolist popup menu for: | 192 | Added items to the todolist popup menu for: |
185 | Display all opened, all closed or all todos flat. | 193 | Display all opened, all closed or all todos flat. |
186 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 194 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
187 | Made the reparenting of todos on the desktop possible via Drag&Drop. | 195 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
188 | Fixed several bugs in setting the completed datetime for todos. | 196 | Fixed several bugs in setting the completed datetime for todos. |
189 | Added info about completed datetime of todos to the todo viewer. | 197 | Added info about completed datetime of todos to the todo viewer. |
190 | Now displaying a completed todo (with completed datetime set) in the agenda view | 198 | Now displaying a completed todo (with completed datetime set) in the agenda view |
191 | at the time of the completion. Such that now it is possible to see in the agenda view | 199 | at the time of the completion. Such that now it is possible to see in the agenda view |
192 | when what todo was completed. | 200 | when what todo was completed. |
193 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 201 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
194 | Now the behaviour is: | 202 | Now the behaviour is: |
195 | Setting a parent to complete sets all (sub)childs to complete. | 203 | Setting a parent to complete sets all (sub)childs to complete. |
196 | Setting a parent to uncomplete does not change the childs. | 204 | Setting a parent to uncomplete does not change the childs. |
197 | Setting a child to uncomplete sets all parent to uncomplete. | 205 | Setting a child to uncomplete sets all parent to uncomplete. |
198 | Setting a child to complete does not change the parents. | 206 | Setting a child to complete does not change the parents. |
199 | 207 | ||
200 | Smart updating and double buffering of the daymatrix. | 208 | Smart updating and double buffering of the daymatrix. |
201 | Showing holidays in the day matrix. | 209 | Showing holidays in the day matrix. |
202 | Many other small performance updates. | 210 | Many other small performance updates. |
203 | 211 | ||
204 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | 212 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. |
205 | 213 | ||
206 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 214 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
207 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. | 215 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. |
208 | 216 | ||
209 | 217 | ||
210 | ********** VERSION 2.0.0 ************ | 218 | ********** VERSION 2.0.0 ************ |
211 | 219 | ||
212 | Stable release 2.0.0! | 220 | Stable release 2.0.0! |
213 | 221 | ||
214 | KO/Pi: | 222 | KO/Pi: |
215 | Fixed problem in edit dialog recreation at startup. | 223 | Fixed problem in edit dialog recreation at startup. |
216 | Made "toggle view*" menu items enabled context sensitive. | 224 | Made "toggle view*" menu items enabled context sensitive. |
217 | Changed agenda size menu to items 1-10. | 225 | Changed agenda size menu to items 1-10. |
218 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 226 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
219 | Usebility enhancements in the KO/Pi menus. | 227 | Usebility enhancements in the KO/Pi menus. |
220 | Birthday import now adds year to summary. | 228 | Birthday import now adds year to summary. |
221 | What's Next view shows age in years for birthday. | 229 | What's Next view shows age in years for birthday. |
222 | 230 | ||
223 | OM/Pi: | 231 | OM/Pi: |
224 | Added three info lines to display subject, from and to of selected mails. | 232 | Added three info lines to display subject, from and to of selected mails. |
225 | 233 | ||
226 | KA/Pi: | 234 | KA/Pi: |
227 | Fixed jump bar behaviour on Zaurus. | 235 | Fixed jump bar behaviour on Zaurus. |
228 | Now KA/Pi search field supports searching for a range of starting characters. | 236 | Now KA/Pi search field supports searching for a range of starting characters. |
229 | E.g. to search for all contact beginning with b to n, type | 237 | E.g. to search for all contact beginning with b to n, type |
230 | b-n | 238 | b-n |
231 | in the search field. | 239 | in the search field. |
232 | 240 | ||
233 | ********** VERSION 1.9.20 ************ | 241 | ********** VERSION 1.9.20 ************ |
234 | 242 | ||
235 | KO/Pi: | 243 | KO/Pi: |
236 | Added for the "dislplay one day" agenda mode | 244 | Added for the "dislplay one day" agenda mode |
237 | info in the caption and in the day lables: | 245 | info in the caption and in the day lables: |
238 | Now it is displayed, if the selected day is from "day before yesterday" | 246 | Now it is displayed, if the selected day is from "day before yesterday" |
239 | to "day after tomorrow". | 247 | to "day after tomorrow". |
240 | Made it possible to delete a Todo, which has sub-todos. | 248 | Made it possible to delete a Todo, which has sub-todos. |
241 | Fixed two small problems in the todo view. | 249 | Fixed two small problems in the todo view. |
242 | Added missing German translation for filter edit and print dialog. | 250 | Added missing German translation for filter edit and print dialog. |
243 | Made search dialog closeable by cancel key. | 251 | Made search dialog closeable by cancel key. |
244 | 252 | ||
245 | Made it possible to select in the date picker the (ligt grey ) | 253 | Made it possible to select in the date picker the (ligt grey ) |
246 | dates of the prev./next month with the mouse. | 254 | dates of the prev./next month with the mouse. |
247 | 255 | ||
248 | OM/Pi: | 256 | OM/Pi: |
249 | "Delete mail" icon in main window now deletes all selected mails. | 257 | "Delete mail" icon in main window now deletes all selected mails. |
250 | Fixed the problem, that the state flag of imap mails was ignored. | 258 | Fixed the problem, that the state flag of imap mails was ignored. |
251 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 259 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
252 | to indecate that they are already seen. | 260 | to indecate that they are already seen. |
253 | Fixed the problem that the body of some mails was not displayed in the | 261 | Fixed the problem that the body of some mails was not displayed in the |
254 | mail viewer when fetching them from the imap server directly to read them. | 262 | mail viewer when fetching them from the imap server directly to read them. |
255 | Made it (configurable) possible to show the "To:" field in the list view. | 263 | Made it (configurable) possible to show the "To:" field in the list view. |
256 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 264 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
257 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 265 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
258 | local storage folder (specified in account settings) of the account of the mail. | 266 | local storage folder (specified in account settings) of the account of the mail. |
259 | Removed some memory leaks in OM/Pi. | 267 | Removed some memory leaks in OM/Pi. |
260 | 268 | ||
261 | 269 | ||
262 | ********** VERSION 1.9.19 ************ | 270 | ********** VERSION 1.9.19 ************ |
263 | 271 | ||
264 | Added a lot of missing translations to KA/Pi, | 272 | Added a lot of missing translations to KA/Pi, |
265 | Added some missing translations to KO/Pi and OM/Pi. | 273 | Added some missing translations to KO/Pi and OM/Pi. |
266 | 274 | ||
267 | Fixed some minor problems in KA/Pi + KO/Pi. | 275 | Fixed some minor problems in KA/Pi + KO/Pi. |
268 | 276 | ||
269 | Fixed a crash when closing PwM/Pi. | 277 | Fixed a crash when closing PwM/Pi. |
270 | Added German translation for PwM/Pi. | 278 | Added German translation for PwM/Pi. |
271 | 279 | ||
272 | Made view change and Month View update faster in KO/Pi. | 280 | Made view change and Month View update faster in KO/Pi. |
273 | 281 | ||
274 | 282 | ||
275 | ********** VERSION 1.9.18 ************ | 283 | ********** VERSION 1.9.18 ************ |
276 | 284 | ||
277 | FYI: The VERSION 1.9.17 was a testing release only. | 285 | FYI: The VERSION 1.9.17 was a testing release only. |
278 | Please read the changelog of VERSION 1.9.17 as well. | 286 | Please read the changelog of VERSION 1.9.17 as well. |
279 | 287 | ||
280 | Cleaned up the syncing config dialog. | 288 | Cleaned up the syncing config dialog. |
281 | Added sync config options for date range for events. | 289 | Added sync config options for date range for events. |
282 | Added sync config options for filters on incoming data. | 290 | Added sync config options for filters on incoming data. |
283 | Added sync config options for filters on outgoing data. | 291 | Added sync config options for filters on outgoing data. |
284 | Please read the updated SyncHowTo about the new filter settings. | 292 | Please read the updated SyncHowTo about the new filter settings. |
285 | These filter settings make it now possible to sync with shared | 293 | These filter settings make it now possible to sync with shared |
286 | calendars without writing back private or confidential data | 294 | calendars without writing back private or confidential data |
287 | (via the outgoing filters). | 295 | (via the outgoing filters). |
288 | To sync only with particular parts of a shared calendar, | 296 | To sync only with particular parts of a shared calendar, |
289 | the incoming filter settings can be used. | 297 | the incoming filter settings can be used. |
290 | An example can be found in the SyncHowTo. | 298 | An example can be found in the SyncHowTo. |
291 | Same for shared addressbooks. | 299 | Same for shared addressbooks. |
292 | 300 | ||
293 | Added a setting for the global kdepim data storage. | 301 | Added a setting for the global kdepim data storage. |
294 | Usually the data is stored in (yourhomedir/kdepim). | 302 | Usually the data is stored in (yourhomedir/kdepim). |
295 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 303 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
296 | a directory where all the kdepim data is stored. | 304 | a directory where all the kdepim data is stored. |
297 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 305 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
298 | 306 | ||
299 | KO/Pi: | 307 | KO/Pi: |
300 | The timeedit input has a pulldown list for times. | 308 | The timeedit input has a pulldown list for times. |
301 | If opened, this pulldown list should now has the right time highlighted. | 309 | If opened, this pulldown list should now has the right time highlighted. |
302 | Added the possibility to exclude events/todos/journals in a filter. | 310 | Added the possibility to exclude events/todos/journals in a filter. |
303 | You should exclude journals, if you do not want them to sync with a public calendar. | 311 | You should exclude journals, if you do not want them to sync with a public calendar. |
304 | 312 | ||
305 | KA/Pi: | 313 | KA/Pi: |
306 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 314 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
307 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... | 315 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... |
308 | Added printing of card view and details view on desktop. | 316 | Added printing of card view and details view on desktop. |
309 | Printing of list view is not working... | 317 | Printing of list view is not working... |
310 | Added button for removing pictures in contact editor. | 318 | Added button for removing pictures in contact editor. |
311 | Parsing data fix of KA/Pi version 1.9.17. | 319 | Parsing data fix of KA/Pi version 1.9.17. |
312 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 320 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
313 | Fixed some syncing merging problems. | 321 | Fixed some syncing merging problems. |
314 | 322 | ||
315 | 323 | ||
316 | ********** VERSION 1.9.17 ************ | 324 | ********** VERSION 1.9.17 ************ |
317 | 325 | ||
318 | KO/Pi: | 326 | KO/Pi: |
319 | Fixed that tooltips were not updated after moving an item in agenda view. | 327 | Fixed that tooltips were not updated after moving an item in agenda view. |
320 | Fixed a bug in sorting start date for recurring events in list view. | 328 | Fixed a bug in sorting start date for recurring events in list view. |
321 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 329 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
322 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. | 330 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. |
323 | Added more info in the todo viewer: Startdate, parent/sub todos. | 331 | Added more info in the todo viewer: Startdate, parent/sub todos. |
324 | 332 | ||
325 | 333 | ||
326 | KA/Pi: | 334 | KA/Pi: |
327 | All fields search does now actually search all the (possible) fields, | 335 | All fields search does now actually search all the (possible) fields, |
328 | not only those listed in the contact list. | 336 | not only those listed in the contact list. |
329 | Made is possible to inline a picture in a vcard on the Z. | 337 | Made is possible to inline a picture in a vcard on the Z. |
330 | This was only possible on the desktop, now is it possible on the Z as well. | 338 | This was only possible on the desktop, now is it possible on the Z as well. |
331 | Fixed of missing save settings after filter configuration. | 339 | Fixed of missing save settings after filter configuration. |
332 | Made saving of addressbook much faster. | 340 | Made saving of addressbook much faster. |
333 | Fixed extension widget layout problem. | 341 | Fixed extension widget layout problem. |
334 | Fixed saving of default formatted name settings. | 342 | Fixed saving of default formatted name settings. |
335 | Fixed formatted name handling in edit dialog. | 343 | Fixed formatted name handling in edit dialog. |
336 | Added an option for changing formatted names of many contacts | 344 | Added an option for changing formatted names of many contacts |
337 | (menu: File - Change - Set formatted name). | 345 | (menu: File - Change - Set formatted name). |
338 | 346 | ||
339 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 347 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
340 | This is Fixed. | 348 | This is Fixed. |
341 | 349 | ||
342 | KDE-Sync: | 350 | KDE-Sync: |
343 | Now readonly KDE resources are synced as well. | 351 | Now readonly KDE resources are synced as well. |
344 | (They are not changed in KDE itself, of course). | 352 | (They are not changed in KDE itself, of course). |
345 | 353 | ||
346 | 354 | ||
347 | 355 | ||
348 | ********** VERSION 1.9.16 ************ | 356 | ********** VERSION 1.9.16 ************ |
349 | 357 | ||
350 | KO/Pi: | 358 | KO/Pi: |
351 | Fixed search dialog size on Z 6000 (480x640 display). | 359 | Fixed search dialog size on Z 6000 (480x640 display). |
352 | Added setting to hide/show time in agenda items. | 360 | Added setting to hide/show time in agenda items. |
353 | Added setting to hide not running todos in todo view. | 361 | Added setting to hide not running todos in todo view. |
354 | Added columns for start date/time in todo view. | 362 | Added columns for start date/time in todo view. |
355 | Replaced the solid half-hour lines in agenda view by dot lines. | 363 | Replaced the solid half-hour lines in agenda view by dot lines. |
356 | Added possibility of printing the What's Next View on the desktop | 364 | Added possibility of printing the What's Next View on the desktop |
357 | (i.e. Windows and Linux). | 365 | (i.e. Windows and Linux). |
358 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 366 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
359 | Added tooltips in month view.(Tooltips only available on desktop) | 367 | Added tooltips in month view.(Tooltips only available on desktop) |
360 | 368 | ||
361 | Fixed a strange problem in KO/Pi alarm applet. | 369 | Fixed a strange problem in KO/Pi alarm applet. |
362 | Did not find the actual problem, | 370 | Did not find the actual problem, |
363 | such that now Qtopia reboots again if deinstalling the alarm applet. | 371 | such that now Qtopia reboots again if deinstalling the alarm applet. |
364 | But the alarm applet should work again. | 372 | But the alarm applet should work again. |
365 | 373 | ||
366 | KA/Pi: | 374 | KA/Pi: |
367 | Fixed the problem, that internal pictures were not saved. | 375 | Fixed the problem, that internal pictures were not saved. |
368 | 376 | ||
369 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 377 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
370 | 378 | ||
371 | Fixed some minor problems. (Like word wrap in help text windows). | 379 | Fixed some minor problems. (Like word wrap in help text windows). |
372 | 380 | ||
373 | Fixed a compiling problem in microkde/kresources. | 381 | Fixed a compiling problem in microkde/kresources. |
374 | 382 | ||
375 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 383 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
376 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 384 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
377 | such that now syncing KO/Pi with Sharp DTM should work on the | 385 | such that now syncing KO/Pi with Sharp DTM should work on the |
378 | Zaurus C 3000 model. | 386 | Zaurus C 3000 model. |
379 | 387 | ||
380 | ********** VERSION 1.9.15 ************ | 388 | ********** VERSION 1.9.15 ************ |
381 | 389 | ||
382 | Usebilty enhancements in KO/Pi: | 390 | Usebilty enhancements in KO/Pi: |
383 | When clicking on the date in a month view cell, the day view is shown. | 391 | When clicking on the date in a month view cell, the day view is shown. |
384 | Old behaviour was, that the "new event" dialog popped up. | 392 | Old behaviour was, that the "new event" dialog popped up. |
385 | 393 | ||
386 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 394 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
387 | That means, you can restore the latest | 395 | That means, you can restore the latest |
388 | event/todo/journal you have deleted. | 396 | event/todo/journal you have deleted. |
389 | A journal is deleted, if you clear all the text of the journal. | 397 | A journal is deleted, if you clear all the text of the journal. |
390 | 398 | ||
391 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 399 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
392 | 400 | ||
393 | KA/Pi starting in 480x640 resolution: | 401 | KA/Pi starting in 480x640 resolution: |
394 | Hide the filter action in toolbar | 402 | Hide the filter action in toolbar |
395 | and added icons for undo/delete/redo in toolbar. | 403 | and added icons for undo/delete/redo in toolbar. |
396 | 404 | ||
397 | Change in OM/Pi ViewMail dialog: | 405 | Change in OM/Pi ViewMail dialog: |
398 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 406 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
399 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 407 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
400 | 408 | ||
401 | Fixed a crash when deleting mail-accounts in OM/Pi. | 409 | Fixed a crash when deleting mail-accounts in OM/Pi. |
402 | 410 | ||
403 | 411 | ||
404 | ********** VERSION 1.9.14 ************ | 412 | ********** VERSION 1.9.14 ************ |
405 | 413 | ||
406 | Fixed some problems with the dialog sizes when switching | 414 | Fixed some problems with the dialog sizes when switching |
407 | portrait/landscape mode on 640x480 PDA display. | 415 | portrait/landscape mode on 640x480 PDA display. |
408 | 416 | ||
409 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 417 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
410 | 418 | ||
411 | Fixed an ugly bug in KOpieMail: | 419 | Fixed an ugly bug in KOpieMail: |
412 | KOpieMail was not able to write files (mails) to MSDOS file system, | 420 | KOpieMail was not able to write files (mails) to MSDOS file system, |
413 | like on an usual preformatted SD card. That should work now. | 421 | like on an usual preformatted SD card. That should work now. |
414 | To save your mail data on the Sd card do the following: | 422 | To save your mail data on the Sd card do the following: |
415 | Create a dir on the SD card: | 423 | Create a dir on the SD card: |
416 | mkdir /mnt/card/localmail | 424 | mkdir /mnt/card/localmail |
417 | Go to your home dir: | 425 | Go to your home dir: |
418 | cd | 426 | cd |
419 | Go to kopiemail data storage dir: | 427 | Go to kopiemail data storage dir: |
420 | cd kdepim/apps/kopiemail | 428 | cd kdepim/apps/kopiemail |
421 | Create a symlink to the SD card: | 429 | Create a symlink to the SD card: |
422 | ls -s /mnt/card/localmail | 430 | ls -s /mnt/card/localmail |
423 | Now KOpieMail will store all mails on the SD card. | 431 | Now KOpieMail will store all mails on the SD card. |
424 | 432 | ||
425 | KO/Pi Monthview: | 433 | KO/Pi Monthview: |
426 | Now "Go to Today" selects the current month from day 1-end, | 434 | Now "Go to Today" selects the current month from day 1-end, |
427 | not the current date + some days. | 435 | not the current date + some days. |
428 | I.e. "Go to Today" shows now always | 436 | I.e. "Go to Today" shows now always |
429 | the current month with first day of month in the first row. | 437 | the current month with first day of month in the first row. |
430 | 438 | ||
431 | Added missing German translation. | 439 | Added missing German translation. |
432 | 440 | ||
433 | Fixed icons of executeable on Wintendo. | 441 | Fixed icons of executeable on Wintendo. |
434 | 442 | ||
435 | Added a "Show next Mail" button to the OM/Pi | 443 | Added a "Show next Mail" button to the OM/Pi |
436 | mail viewer such that the mail below the current mail | 444 | mail viewer such that the mail below the current mail |
437 | in the mail list view of the current folder | 445 | in the mail list view of the current folder |
438 | can be read with a single click. | 446 | can be read with a single click. |
439 | 447 | ||
440 | 448 | ||
441 | ********** VERSION 1.9.13 ************ | 449 | ********** VERSION 1.9.13 ************ |
442 | 450 | ||
443 | Fixed nasty PwM/Pi file reading bug, when | 451 | Fixed nasty PwM/Pi file reading bug, when |
444 | the used hash algo of file is different then the global | 452 | the used hash algo of file is different then the global |
445 | hash algo. | 453 | hash algo. |
446 | 454 | ||
447 | Added KA/Pi support for opie mailit mailapplication. | 455 | Added KA/Pi support for opie mailit mailapplication. |
448 | 456 | ||
449 | Fixed some bugs in OM/Pi. | 457 | Fixed some bugs in OM/Pi. |
450 | Now character conversion tables are available for the Zaurus | 458 | Now character conversion tables are available for the Zaurus |
451 | to make OM/Pi working properly. | 459 | to make OM/Pi working properly. |
452 | To get the character conversion in OM/Pi working, please download | 460 | To get the character conversion in OM/Pi working, please download |
453 | at the sourceforge project site the package | 461 | at the sourceforge project site the package |
454 | sr-character-conversion_SharpROM_arm.ipk.zip | 462 | sr-character-conversion_SharpROM_arm.ipk.zip |
455 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 463 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
456 | from the section "general files for KDE/Pim" | 464 | from the section "general files for KDE/Pim" |
457 | Instructions how to install this package are in a ReadMe in this file. | 465 | Instructions how to install this package are in a ReadMe in this file. |
458 | 466 | ||
459 | 467 | ||
460 | Fixed the orientation change problem in KA/Pi when switching | 468 | Fixed the orientation change problem in KA/Pi when switching |
461 | portrait/landscape mode. | 469 | portrait/landscape mode. |
462 | 470 | ||
463 | French translation available for KA/Pi and OM/Pi. | 471 | French translation available for KA/Pi and OM/Pi. |
464 | 472 | ||
465 | Fixed some problems with categories in KO/Pi in DTM sync. | 473 | Fixed some problems with categories in KO/Pi in DTM sync. |
466 | 474 | ||
467 | Added selection dialog for export to phone in KA/Pi. | 475 | Added selection dialog for export to phone in KA/Pi. |
468 | 476 | ||
469 | If in KO/Pi is an attendee selected to add to a meeting and this | 477 | If in KO/Pi is an attendee selected to add to a meeting and this |
470 | attendee is already in the list of attendees, this person is not added | 478 | attendee is already in the list of attendees, this person is not added |
471 | again. | 479 | again. |
472 | 480 | ||
473 | Some menu cleanup in KA/Pi. | 481 | Some menu cleanup in KA/Pi. |
474 | 482 | ||
475 | ********** VERSION 1.9.12 ************ | 483 | ********** VERSION 1.9.12 ************ |
476 | 484 | ||
477 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 485 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
478 | 486 | ||
479 | Bugfix: Licence file is now shown again. | 487 | Bugfix: Licence file is now shown again. |
480 | 488 | ||
481 | OM/Pi now supports Unicode (utf8 charset). | 489 | OM/Pi now supports Unicode (utf8 charset). |
482 | Fixed some bugs in OM/Pi. | 490 | Fixed some bugs in OM/Pi. |
483 | 491 | ||
484 | KA/Pi has more German translation. | 492 | KA/Pi has more German translation. |
485 | 493 | ||
486 | 494 | ||
487 | ********** VERSION 1.9.11 ************ | 495 | ********** VERSION 1.9.11 ************ |
488 | 496 | ||
489 | Fixed several problems in PWM/Pi, like | 497 | Fixed several problems in PWM/Pi, like |
490 | asking the user, if unsaved changed are pending | 498 | asking the user, if unsaved changed are pending |
491 | when closing the app. | 499 | when closing the app. |
492 | And PwM/Pi handles now different texts for the | 500 | And PwM/Pi handles now different texts for the |
493 | fields Description, Username, Password, configurable per category. | 501 | fields Description, Username, Password, configurable per category. |
494 | 502 | ||
495 | Fixed a crash in KO/Pi , when importing/loading vcs files | 503 | Fixed a crash in KO/Pi , when importing/loading vcs files |
496 | which have an entry with an attendee with state: | 504 | which have an entry with an attendee with state: |
497 | NEEDS ACTION | 505 | NEEDS ACTION |
498 | 506 | ||
499 | Fixed some problems in the German translation of OM/Pi, | 507 | Fixed some problems in the German translation of OM/Pi, |
500 | which makes some dialogs not fitting on the screen | 508 | which makes some dialogs not fitting on the screen |
501 | of the Z 5500. | 509 | of the Z 5500. |
502 | 510 | ||
503 | Fixed Qtopia crash, when disabling/deinstalling | 511 | Fixed Qtopia crash, when disabling/deinstalling |
504 | KO/Pi alarm applet. | 512 | KO/Pi alarm applet. |
505 | 513 | ||
506 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 514 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
507 | on Linux desktop. | 515 | on Linux desktop. |
508 | 516 | ||
509 | Added feature "remove sync info" to sync menu. | 517 | Added feature "remove sync info" to sync menu. |
510 | 518 | ||
511 | Tweaked the KO/Pi What's next view a bit, added | 519 | Tweaked the KO/Pi What's next view a bit, added |
512 | setting to hide events that are done. | 520 | setting to hide events that are done. |
513 | 521 | ||
514 | Disabled "beam receive enabled" on startup to | 522 | Disabled "beam receive enabled" on startup to |
515 | avoid problems if Fastload is enabled. | 523 | avoid problems if Fastload is enabled. |
516 | Please set "beam receive enabled", | 524 | Please set "beam receive enabled", |
517 | if you want to receive data via IR. | 525 | if you want to receive data via IR. |
518 | 526 | ||
519 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 527 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
520 | on Linux desktop. | 528 | on Linux desktop. |
521 | 529 | ||
522 | Made in KA/Pi scrolling possible, if details view is selected. | 530 | Made in KA/Pi scrolling possible, if details view is selected. |
523 | (The keyboard focus is set automatically to the search line) | 531 | (The keyboard focus is set automatically to the search line) |
524 | 532 | ||
525 | Fixed a bug in DMT sync, that a new entry in DTM was added | 533 | Fixed a bug in DMT sync, that a new entry in DTM was added |
526 | on every sync to Kx/Pi. | 534 | on every sync to Kx/Pi. |
527 | 535 | ||
528 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 536 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
529 | 537 | ||
530 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 538 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
531 | non-latin1 characters. | 539 | non-latin1 characters. |
532 | 540 | ||
533 | Rearranged package contents of Sharp-ipks and made all | 541 | Rearranged package contents of Sharp-ipks and made all |
534 | packages installable on SD again. | 542 | packages installable on SD again. |
535 | 543 | ||
536 | Fixed the writing of addressbook data in DTM sync. | 544 | Fixed the writing of addressbook data in DTM sync. |
537 | Empty fields in KA/Pi were not removed. | 545 | Empty fields in KA/Pi were not removed. |
538 | 546 | ||
539 | Added better category handling in KA/Pi: | 547 | Added better category handling in KA/Pi: |
540 | Added item | 548 | Added item |
541 | Edit Categories and | 549 | Edit Categories and |
542 | Manage new categories | 550 | Manage new categories |
543 | to the settings menu. | 551 | to the settings menu. |
544 | Possible to configure a view to display categories. | 552 | Possible to configure a view to display categories. |
545 | 553 | ||
546 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 554 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
547 | 555 | ||
548 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 556 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
549 | 557 | ||
550 | ... and many other bugfixes. | 558 | ... and many other bugfixes. |
551 | 559 | ||
552 | ********** VERSION 1.9.10 ************ | 560 | ********** VERSION 1.9.10 ************ |
553 | 561 | ||
554 | Many internal small bugfixes. | 562 | Many internal small bugfixes. |
555 | And fix of the "big" bug in KO/Pi, | 563 | And fix of the "big" bug in KO/Pi, |
556 | that after Syncing the appointments had an offset by several hours. | 564 | that after Syncing the appointments had an offset by several hours. |
557 | That was a problem with the internal timezone setting, | 565 | That was a problem with the internal timezone setting, |
558 | introduced by the changed timezone configuration settings. | 566 | introduced by the changed timezone configuration settings. |
559 | 567 | ||
560 | German translation for OM/Pi is now available. | 568 | German translation for OM/Pi is now available. |
561 | 569 | ||
562 | 570 | ||
563 | ********** VERSION 1.9.9 ************ | 571 | ********** VERSION 1.9.9 ************ |
564 | 572 | ||
565 | KDE-Pim/Pi has a new Member! | 573 | KDE-Pim/Pi has a new Member! |
566 | It is called PWM/Pi (Passwordmanager/platform-independent) | 574 | It is called PWM/Pi (Passwordmanager/platform-independent) |
567 | and it is available for the Zaurus. | 575 | and it is available for the Zaurus. |
568 | It is planned, that it will be available later for Windows. | 576 | It is planned, that it will be available later for Windows. |
569 | (And for Linux, of course). | 577 | (And for Linux, of course). |
570 | It is a port of the Passwordmanager of KDE. | 578 | It is a port of the Passwordmanager of KDE. |
571 | It will need the MicroKDElibs to run. | 579 | It will need the MicroKDElibs to run. |
572 | 580 | ||
573 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 581 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
574 | The bigger your addressbook file, the more starting speed | 582 | The bigger your addressbook file, the more starting speed |
575 | will you gain. (relatively) | 583 | will you gain. (relatively) |
576 | 584 | ||
577 | The Qtopia addressbook connector is now platform independend | 585 | The Qtopia addressbook connector is now platform independend |
578 | as well and should work on any platform for importing/exporting | 586 | as well and should work on any platform for importing/exporting |
579 | Qtopia and Opie XML files. | 587 | Qtopia and Opie XML files. |
580 | 588 | ||
581 | Added a +30min feature to the timezone settings to make | 589 | Added a +30min feature to the timezone settings to make |
582 | KDE-Pim/Pi useable in Australia and other parts on the | 590 | KDE-Pim/Pi useable in Australia and other parts on the |
583 | world with strange timezones ;-) | 591 | world with strange timezones ;-) |
584 | 592 | ||
585 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 593 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
586 | 594 | ||
587 | It is now possible to disable the | 595 | It is now possible to disable the |
588 | "receive data via infrared" feature, such that syncing with | 596 | "receive data via infrared" feature, such that syncing with |
589 | Outlook is now possible again with Kx/Pi runing. | 597 | Outlook is now possible again with Kx/Pi runing. |
590 | Please disable it, before syncing Sharp DTM with Outlook. | 598 | Please disable it, before syncing Sharp DTM with Outlook. |
591 | For your convenience, the "receive data via infrared" feature | 599 | For your convenience, the "receive data via infrared" feature |
592 | is disabled automatically, if you sync Kx/Pi with DTM. | 600 | is disabled automatically, if you sync Kx/Pi with DTM. |
593 | You have to enable it again manually after syncing. | 601 | You have to enable it again manually after syncing. |
594 | Enabling this feature makes it impossible to start the | 602 | Enabling this feature makes it impossible to start the |
595 | Sharp DTM apps. If this feature is enabled, you will only get the | 603 | Sharp DTM apps. If this feature is enabled, you will only get the |
596 | alarm notification from KO/Pi and not from the Sharp calendar. | 604 | alarm notification from KO/Pi and not from the Sharp calendar. |
597 | This is very useful if you sync KO/Pi with Sharp DTM, | 605 | This is very useful if you sync KO/Pi with Sharp DTM, |
598 | because after syncing you usually would get notified about | 606 | because after syncing you usually would get notified about |
599 | an alarm by KO/Pi and the Sharp Calendar. | 607 | an alarm by KO/Pi and the Sharp Calendar. |
600 | 608 | ||
601 | Together with the Linux desktop version of KO/Pi | 609 | Together with the Linux desktop version of KO/Pi |
602 | it is now possible to sync KO/Pi on the Zaurus | 610 | it is now possible to sync KO/Pi on the Zaurus |
603 | with the complete KDE-desktop (3.3 or later) | 611 | with the complete KDE-desktop (3.3 or later) |
604 | calendar data easily. | 612 | calendar data easily. |
605 | That makes it possible to sync the Z with one | 613 | That makes it possible to sync the Z with one |
606 | click of a mouse with the KDE-Desktop. | 614 | click of a mouse with the KDE-Desktop. |
607 | This feature it available for all Zaurus platforms KO/Pi | 615 | This feature it available for all Zaurus platforms KO/Pi |
608 | is running on. | 616 | is running on. |
609 | The only thing needed is a running KO/Pi on Linux and | 617 | The only thing needed is a running KO/Pi on Linux and |
610 | a compiled version of the small | 618 | a compiled version of the small |
611 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 619 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
612 | which is in the KDE-Pim/Pi sources available. | 620 | which is in the KDE-Pim/Pi sources available. |
613 | 621 | ||
614 | The "KDE-desktop" syncing feature for KA/Pi will follow | 622 | The "KDE-desktop" syncing feature for KA/Pi will follow |
615 | in the next releases. | 623 | in the next releases. |
616 | 624 | ||
617 | Fixed the vcard export bug, which had the version 1.9.8. | 625 | Fixed the vcard export bug, which had the version 1.9.8. |
618 | 626 | ||
619 | Added missing GERMAN translation to KO/Pi. | 627 | Added missing GERMAN translation to KO/Pi. |
620 | Hi PsionX, could you add the missing french translation?Thx! | 628 | Hi PsionX, could you add the missing french translation?Thx! |
621 | 629 | ||
622 | Translation files for KA/Pi are available as well. | 630 | Translation files for KA/Pi are available as well. |
623 | GERMAN translation will be available in the next release. | 631 | GERMAN translation will be available in the next release. |
624 | PsionX ( yres, you again ;-) ), could you start translating | 632 | PsionX ( yres, you again ;-) ), could you start translating |
625 | KA/Pi? Thx! | 633 | KA/Pi? Thx! |
626 | 634 | ||
627 | You can download the version 1.9.9 at | 635 | You can download the version 1.9.9 at |
628 | 636 | ||
629 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 637 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
630 | 638 | ||
631 | Note: | 639 | Note: |
632 | To run the mail program OM/Pi you need libopenssl. | 640 | To run the mail program OM/Pi you need libopenssl. |
633 | A link to a download loaction is available at | 641 | A link to a download loaction is available at |
634 | ZSI at www.killefiz.de | 642 | ZSI at www.killefiz.de |
635 | 643 | ||
636 | 644 | ||
637 | ********** VERSION 1.9.8 ************ | 645 | ********** VERSION 1.9.8 ************ |
638 | 646 | ||
639 | Fixed character decoding in OM/Pi. | 647 | Fixed character decoding in OM/Pi. |
640 | (e.g. German "Umlaute" were not displayed properly.) | 648 | (e.g. German "Umlaute" were not displayed properly.) |
641 | 649 | ||
642 | Made is possible to reparent todos in KO/Pi. | 650 | Made is possible to reparent todos in KO/Pi. |
643 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | 651 | Use contextmenu or keys (look at Help-Keys + Colors) for that. |
644 | 652 | ||
645 | Added the missing Sync-Howto and WhatsNew to the packages. | 653 | Added the missing Sync-Howto and WhatsNew to the packages. |
646 | 654 | ||
647 | KO/Pi on Linux desktop can now sync with KDE desktop. | 655 | KO/Pi on Linux desktop can now sync with KDE desktop. |
648 | That means: When using KO/Pi on Linux desktop for syncing with | 656 | That means: When using KO/Pi on Linux desktop for syncing with |
649 | KDE desktop and the Zaurus, the Zaurus can be synced now | 657 | KDE desktop and the Zaurus, the Zaurus can be synced now |
650 | with all KDE-Calendar resources, not only with one local file. | 658 | with all KDE-Calendar resources, not only with one local file. |
651 | (That makes it possible to sync the Zaurus with the | 659 | (That makes it possible to sync the Zaurus with the |
652 | calendar data on a Kolab server) | 660 | calendar data on a Kolab server) |
653 | 661 | ||
654 | KA/Pi syncing with KDE desktop will be available in the next version. | 662 | KA/Pi syncing with KDE desktop will be available in the next version. |
655 | 663 | ||
656 | 664 | ||
657 | ********** VERSION 1.9.7 ************ | 665 | ********** VERSION 1.9.7 ************ |
658 | 666 | ||
659 | KO/Pi - KA/Pi on Windows: | 667 | KO/Pi - KA/Pi on Windows: |
660 | Now a directory can be defined by the user, where the | 668 | Now a directory can be defined by the user, where the |
661 | application/config data should be saved. | 669 | application/config data should be saved. |
662 | Define your desired path in the evironment variable | 670 | Define your desired path in the evironment variable |
663 | MICROKDEHOME | 671 | MICROKDEHOME |
664 | before starting KO/Pi or KA/Pi. | 672 | before starting KO/Pi or KA/Pi. |
665 | 673 | ||
666 | An easy Kx/Pi to Kx/Pi syncing is now possible | 674 | An easy Kx/Pi to Kx/Pi syncing is now possible |
667 | (it is called Pi-Sync) via network. | 675 | (it is called Pi-Sync) via network. |
668 | Please look at the Sync Howto. | 676 | Please look at the Sync Howto. |
669 | 677 | ||
670 | Exporting of calendar data and contacts to mobile phones is now possible. | 678 | Exporting of calendar data and contacts to mobile phones is now possible. |
671 | The SyncHowto is updated with information howto | 679 | The SyncHowto is updated with information howto |
672 | access/sync mobile phones. | 680 | access/sync mobile phones. |
673 | Please look at the Sync Howto. | 681 | Please look at the Sync Howto. |
674 | 682 | ||
675 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 683 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
676 | Please disable Fastload for the original contact/calendar applications | 684 | Please disable Fastload for the original contact/calendar applications |
677 | and close them. | 685 | and close them. |
678 | KO/Pi and KA/Pi must be running in order to receive the data. | 686 | KO/Pi and KA/Pi must be running in order to receive the data. |
679 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 687 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
680 | 688 | ||
681 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 689 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
682 | of the other data ( emails/tel.numbers/addresses) | 690 | of the other data ( emails/tel.numbers/addresses) |
683 | 691 | ||
684 | Fixed some syncing problems in KA/Pi. | 692 | Fixed some syncing problems in KA/Pi. |
685 | 693 | ||
686 | Added font settings for the KA/Pi details view. | 694 | Added font settings for the KA/Pi details view. |
687 | Added fields "children's name" and "gender" to KA/Pi. | 695 | Added fields "children's name" and "gender" to KA/Pi. |
688 | 696 | ||
689 | Made searching in KA/Pi better: | 697 | Made searching in KA/Pi better: |
690 | Now the first item in a view is selected after a search automatically and | 698 | Now the first item in a view is selected after a search automatically and |
691 | the views can be scrolled up/down when the search input field has the keyboard focus. | 699 | the views can be scrolled up/down when the search input field has the keyboard focus. |
692 | 700 | ||
693 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 701 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
694 | 702 | ||
695 | 703 | ||
696 | ********** VERSION 1.9.6 ************ | 704 | ********** VERSION 1.9.6 ************ |
697 | 705 | ||
698 | Changes in the external application communication on the Zaurus | 706 | Changes in the external application communication on the Zaurus |
699 | in order to use less RAM when the apps are running. | 707 | in order to use less RAM when the apps are running. |
700 | First syncing of addressbooks (KA/Pi) is possible. | 708 | First syncing of addressbooks (KA/Pi) is possible. |
701 | 709 | ||
702 | 710 | ||
703 | ********** VERSION 1.9.5a ************ | 711 | ********** VERSION 1.9.5a ************ |
704 | 712 | ||
705 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 713 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
706 | Fixed some small bugs. | 714 | Fixed some small bugs. |
707 | KA/Pi shows now the birthday in summary view. | 715 | KA/Pi shows now the birthday in summary view. |
708 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 716 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
709 | for displaying dates. | 717 | for displaying dates. |
710 | 718 | ||
711 | 719 | ||
712 | ********** VERSION 1.9.5 ************ | 720 | ********** VERSION 1.9.5 ************ |
713 | 721 | ||
714 | There is still no Addressbook syncing! | 722 | There is still no Addressbook syncing! |
715 | 723 | ||
716 | New in 1.9.5: | 724 | New in 1.9.5: |
717 | 725 | ||
718 | Many bugfixes. | 726 | Many bugfixes. |
719 | Better searching in KA/Pi. | 727 | Better searching in KA/Pi. |
720 | You can configure in KA/Pi if you want to search only after | 728 | You can configure in KA/Pi if you want to search only after |
721 | <return> key pressed. | 729 | <return> key pressed. |
722 | 730 | ||
723 | Better mail downloading in OM/Pi. | 731 | Better mail downloading in OM/Pi. |
724 | 732 | ||
725 | First experimental alpha version of sync of KO/Pi with mobile phones. | 733 | First experimental alpha version of sync of KO/Pi with mobile phones. |
726 | See gammu documentation for supported phones. | 734 | See gammu documentation for supported phones. |
727 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. | 735 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. |
728 | Quick hint how to use: | 736 | Quick hint how to use: |
729 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 737 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
730 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 738 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
731 | Create syncprofile - mobile device | 739 | Create syncprofile - mobile device |
732 | Remove entry for model. (Leave empty ). | 740 | Remove entry for model. (Leave empty ). |
733 | Enable infrared on Zaurus and your Phone. | 741 | Enable infrared on Zaurus and your Phone. |
734 | Sync. | 742 | Sync. |
735 | To get a more detailed log, start kopi from konsole. | 743 | To get a more detailed log, start kopi from konsole. |
736 | 744 | ||
737 | ********** VERSION 1.9.4 ************ | 745 | ********** VERSION 1.9.4 ************ |
738 | 746 | ||
739 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 747 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
740 | 748 | ||
741 | WARNING: | 749 | WARNING: |
742 | PLEASE BACKUP ALL YOUR DATA! | 750 | PLEASE BACKUP ALL YOUR DATA! |
743 | We have changed a lot and maybe there are some unknown problems. | 751 | We have changed a lot and maybe there are some unknown problems. |
744 | 752 | ||
745 | SYNC HANDLING HAS CHANGED! | 753 | SYNC HANDLING HAS CHANGED! |
746 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 754 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
747 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 755 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
748 | 756 | ||
749 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 757 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
750 | 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. | 758 | 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. |
751 | 759 | ||
752 | As programs are available: | 760 | As programs are available: |
753 | KO/Pi (korganizer ipk) - a calendar program. | 761 | KO/Pi (korganizer ipk) - a calendar program. |
754 | KA/Pi (kaddressbook ipk ) - an addressbook | 762 | KA/Pi (kaddressbook ipk ) - an addressbook |
755 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 763 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
756 | 764 | ||
757 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 765 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
758 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 766 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
759 | 767 | ||
760 | All the applications are installed in a "Pim" TAB. | 768 | All the applications are installed in a "Pim" TAB. |
761 | 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 | 769 | 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 |
762 | 770 | ||
763 | All the application are integrated. | 771 | All the application are integrated. |
764 | 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. | 772 | 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. |
765 | 773 | ||
766 | HINT: | 774 | HINT: |
767 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 775 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
768 | 776 | ||
769 | What's new? | 777 | What's new? |
770 | 778 | ||
771 | SYNC HANDLING HAS CHANGED! | 779 | SYNC HANDLING HAS CHANGED! |
772 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 780 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
773 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 781 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
774 | 782 | ||
775 | New in OM/Pi: | 783 | New in OM/Pi: |
776 | 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. | 784 | 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. |
777 | 785 | ||
778 | New in KO/Pi: | 786 | New in KO/Pi: |
779 | French is now available for KO/Pi. | 787 | French is now available for KO/Pi. |
780 | Choose menu:Actions - Configure:TAB locale | 788 | Choose menu:Actions - Configure:TAB locale |
781 | Syncing has changed. | 789 | Syncing has changed. |
782 | Phone sync available soon. | 790 | Phone sync available soon. |
783 | Not much changes, I cannot remember them ... | 791 | Not much changes, I cannot remember them ... |
784 | 792 | ||
785 | New in KA/Pi: | 793 | New in KA/Pi: |
786 | Beaming possible. | 794 | Beaming possible. |
787 | Sharp DTM readonly access possible( create a new DTM resource ); | 795 | Sharp DTM readonly access possible( create a new DTM resource ); |
788 | Better searching possible. | 796 | Better searching possible. |
789 | Search is performed only after pressing the return key. | 797 | Search is performed only after pressing the return key. |
790 | Use wildcard * to specify parts of a name. | 798 | Use wildcard * to specify parts of a name. |
791 | 799 | ||
792 | 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 * . | 800 | 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 * . |
793 | 801 | ||
794 | A big improvement is the new management of the contact access. | 802 | A big improvement is the new management of the contact access. |
795 | In version 1.9.3, every application was using their own addressbook access data. | 803 | In version 1.9.3, every application was using their own addressbook access data. |
796 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 804 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
797 | That was wasting of memory, if you had several hundreds of contacts. | 805 | That was wasting of memory, if you had several hundreds of contacts. |
798 | 806 | ||
799 | Now only KA/Pi accesses the addressbook. | 807 | Now only KA/Pi accesses the addressbook. |
800 | 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. | 808 | 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. |
801 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 809 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
802 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 810 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
803 | 811 | ||
804 | New in the KO/Pi alarm applet: | 812 | New in the KO/Pi alarm applet: |
805 | Configure your own timer popup menu! | 813 | Configure your own timer popup menu! |
806 | (Text and minutes for timer countdown) | 814 | (Text and minutes for timer countdown) |
807 | Just edit the file | 815 | Just edit the file |
808 | (yourhomedir)/.kopialarmtimerrc | 816 | (yourhomedir)/.kopialarmtimerrc |
809 | and start/stop a timer to get a new menu with the data of this file. | 817 | and start/stop a timer to get a new menu with the data of this file. |
810 | 818 | ||
811 | ********** VERSION 1.9.3 ************ | 819 | ********** VERSION 1.9.3 ************ |
812 | 1) | 820 | 1) |
813 | Now KO/Pi on Windows imports directly the calendar data of | 821 | Now KO/Pi on Windows imports directly the calendar data of |
814 | an installed Outlook. Should work with OL version >= 2000. | 822 | an installed Outlook. Should work with OL version >= 2000. |
815 | 823 | ||
816 | ********** VERSION 1.9.2 ************ | 824 | ********** VERSION 1.9.2 ************ |
817 | 1) | 825 | 1) |
818 | KDE-Pim/Pi has got a new member: | 826 | KDE-Pim/Pi has got a new member: |
819 | KmicroMail (KM/Pi) is a mail program, | 827 | KmicroMail (KM/Pi) is a mail program, |
820 | which can handle IMAP and POP mail access. | 828 | which can handle IMAP and POP mail access. |
821 | It is based on Opie-Mail v3. | 829 | It is based on Opie-Mail v3. |
822 | All dependencies to the Opie libraries ar removed, | 830 | All dependencies to the Opie libraries ar removed, |
823 | such that no additional Opie lib is needed. | 831 | such that no additional Opie lib is needed. |
824 | It is already integrated in KO/Pi and KA/Pi. | 832 | It is already integrated in KO/Pi and KA/Pi. |
825 | It it now available for the Zaurus,probably it | 833 | It it now available for the Zaurus,probably it |
826 | will be available for other platforms later. | 834 | will be available for other platforms later. |
827 | Hint: | 835 | Hint: |
828 | Create your own contact (name + email) | 836 | Create your own contact (name + email) |
829 | in KA/Pi, select this contact and choose menu: | 837 | in KA/Pi, select this contact and choose menu: |
830 | Settings - Set Who Am I. | 838 | Settings - Set Who Am I. |
831 | Now the settings of this contact are used as | 839 | Now the settings of this contact are used as |
832 | the sender data in KM/Pi. | 840 | the sender data in KM/Pi. |
833 | 2) | 841 | 2) |
834 | KDE-Pim/Pi is split up in five different | 842 | KDE-Pim/Pi is split up in five different |
835 | packages now precompiled for Sharp Zaurus: | 843 | packages now precompiled for Sharp Zaurus: |
836 | --kmicrokdelibs_1.9.2_arm.ipk | 844 | --kmicrokdelibs_1.9.2_arm.ipk |
837 | The libs are needed for any | 845 | The libs are needed for any |
838 | of the following programs: | 846 | of the following programs: |
839 | --kaddressbook_1.9.2_arm.ipk | 847 | --kaddressbook_1.9.2_arm.ipk |
840 | --kmicromail_1.9.2_arm.ipk | 848 | --kmicromail_1.9.2_arm.ipk |
841 | --korganizer_1.9.2_arm.ipk | 849 | --korganizer_1.9.2_arm.ipk |
842 | Independ from that, there is the alarm applet | 850 | Independ from that, there is the alarm applet |
843 | available for KO/Pi, which also offers | 851 | available for KO/Pi, which also offers |
844 | quick access for a new mail or | 852 | quick access for a new mail or |
845 | showing the addressbook.: | 853 | showing the addressbook.: |
846 | --korganizer-alarm_1.9.2_arm.ipk | 854 | --korganizer-alarm_1.9.2_arm.ipk |
847 | Independend means, that the alarm applet | 855 | Independend means, that the alarm applet |
848 | does not need any of the libs or programs above to run. | 856 | does not need any of the libs or programs above to run. |
849 | But it would be quite useless without these programs. | 857 | But it would be quite useless without these programs. |
850 | NOTE: | 858 | NOTE: |
851 | If you get a | 859 | If you get a |
852 | "This application depends on other programs" | 860 | "This application depends on other programs" |
853 | during installation of | 861 | during installation of |
854 | --kmicrokdelibs_1.9.2_arm.ipk | 862 | --kmicrokdelibs_1.9.2_arm.ipk |
855 | you probably do not have to care about that. | 863 | you probably do not have to care about that. |
856 | kmicrokdelibs_1.9.2 will come with some | 864 | kmicrokdelibs_1.9.2 will come with some |
857 | resource plugins, which needs additional libraries. | 865 | resource plugins, which needs additional libraries. |
858 | (E.g. libopie1, if you want to use the | 866 | (E.g. libopie1, if you want to use the |
859 | opie resource connector in KA/Pi). | 867 | opie resource connector in KA/Pi). |
860 | If you do not have this libraries installed, | 868 | If you do not have this libraries installed, |
861 | you simply cannot use the resource. | 869 | you simply cannot use the resource. |
862 | To make it clear: | 870 | To make it clear: |
863 | If the libraries are missing, the applications | 871 | If the libraries are missing, the applications |
864 | using kmicrokdelibs will start, | 872 | using kmicrokdelibs will start, |
865 | because the resources are plugins. | 873 | because the resources are plugins. |
866 | 3) | 874 | 3) |
867 | KO/Pi and friends are now installable on SD-Card! | 875 | KO/Pi and friends are now installable on SD-Card! |
868 | It is recommended to install all libs and apps | 876 | It is recommended to install all libs and apps |
869 | on the SD card or all in the internal storage. | 877 | on the SD card or all in the internal storage. |
870 | There may be problems, if this is mixed. | 878 | There may be problems, if this is mixed. |
871 | 4) | 879 | 4) |
872 | Fixed two bugs in the alarm notification on Windows. | 880 | Fixed two bugs in the alarm notification on Windows. |
873 | 5) | 881 | 5) |
874 | Great improvement! | 882 | Great improvement! |
875 | KO/Pi uses now the latest version of libical. | 883 | KO/Pi uses now the latest version of libical. |
876 | Libical is the library which actually reads | 884 | Libical is the library which actually reads |
877 | the calendar files and extract the data from it. | 885 | the calendar files and extract the data from it. |
878 | With the old version, there were problems | 886 | With the old version, there were problems |
879 | (crashes or program hangs) when licical did read | 887 | (crashes or program hangs) when licical did read |
880 | files, which were not stored from KO/Pi. | 888 | files, which were not stored from KO/Pi. |
881 | I do not know, if the new libical works perfect, | 889 | I do not know, if the new libical works perfect, |
882 | but actually it works much better than | 890 | but actually it works much better than |
883 | the old version. | 891 | the old version. |
884 | There are no problems with compatibility with | 892 | There are no problems with compatibility with |
885 | old calendar files of KO/Pi, of course! | 893 | old calendar files of KO/Pi, of course! |
886 | 6) | 894 | 6) |
887 | New in KA/Pi: | 895 | New in KA/Pi: |
888 | Opie addressbook resource connector available! | 896 | Opie addressbook resource connector available! |
889 | You will need libopie1 and the opie addressbook, | 897 | You will need libopie1 and the opie addressbook, |
890 | of course. | 898 | of course. |
891 | With the Opie addressbook resource connector, | 899 | With the Opie addressbook resource connector, |
892 | you can access the Opie addressbook readonly in KA/Pi. | 900 | you can access the Opie addressbook readonly in KA/Pi. |
893 | If you want to edit or import the data into KA/Pi, | 901 | If you want to edit or import the data into KA/Pi, |
894 | do this: | 902 | do this: |
895 | a) Create an Opie resource. | 903 | a) Create an Opie resource. |
896 | (Menu: Settings-Configure Resources). | 904 | (Menu: Settings-Configure Resources). |
897 | After configuration and restarting KA/Pi you should see | 905 | After configuration and restarting KA/Pi you should see |
898 | the Opie contacts in KA/Pi. | 906 | the Opie contacts in KA/Pi. |
899 | b) Select some or all Opie contacts. | 907 | b) Select some or all Opie contacts. |
900 | (NOTE: +++++ | 908 | (NOTE: +++++ |
901 | To know exactly, what contacts are Opie contacts, | 909 | To know exactly, what contacts are Opie contacts, |
902 | do this: Choose menu: | 910 | do this: Choose menu: |
903 | View-Modify View - TAB Fields. | 911 | View-Modify View - TAB Fields. |
904 | Select in the above list "Resource" and click | 912 | Select in the above list "Resource" and click |
905 | down arrow to add it to the "Selected fields". | 913 | down arrow to add it to the "Selected fields". |
906 | Click OK. | 914 | Click OK. |
907 | Now you have a new column "Resource" in your list, | 915 | Now you have a new column "Resource" in your list, |
908 | where you can see, what an Opie resource is. | 916 | where you can see, what an Opie resource is. |
909 | ++++ NOTE end.) | 917 | ++++ NOTE end.) |
910 | Ok, we do have now some Opie contacts seleted. | 918 | Ok, we do have now some Opie contacts seleted. |
911 | (Use SHIFT or CTRL key in order to multiple select). | 919 | (Use SHIFT or CTRL key in order to multiple select). |
912 | c) Choose menu: Edit-Copy. | 920 | c) Choose menu: Edit-Copy. |
913 | d) Choose menu: Edit-Paste. | 921 | d) Choose menu: Edit-Paste. |
914 | e) Select the resource, you want to add the contacts to. | 922 | e) Select the resource, you want to add the contacts to. |
915 | Congrats! Now you have read/write access to the copied | 923 | Congrats! Now you have read/write access to the copied |
916 | opie contacts as "real" KA/Pi contacts. | 924 | opie contacts as "real" KA/Pi contacts. |
917 | 925 | ||
918 | 926 | ||
919 | ********** VERSION 1.9.1 ************ | 927 | ********** VERSION 1.9.1 ************ |
920 | 1) | 928 | 1) |
921 | +++ IMPORTANT 1 +++ | 929 | +++ IMPORTANT 1 +++ |
922 | 930 | ||
923 | The storing place of the default calendar | 931 | The storing place of the default calendar |
924 | file has changed! | 932 | file has changed! |
925 | The default calendar file was | 933 | The default calendar file was |
926 | Applications/korganizer/mycalendar.ics | 934 | Applications/korganizer/mycalendar.ics |
927 | on Zaurus and | 935 | on Zaurus and |
928 | (yourHomeDir)/korganizer/mycalendar.ics | 936 | (yourHomeDir)/korganizer/mycalendar.ics |
929 | on Windows/Linux desktop. Now it is | 937 | on Windows/Linux desktop. Now it is |
930 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics | 938 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics |
931 | on Zaurus, Windows and Linux. | 939 | on Zaurus, Windows and Linux. |
932 | To load the old file, choose menu | 940 | To load the old file, choose menu |
933 | File-Load calendar backup. | 941 | File-Load calendar backup. |
934 | (It should be loaded automatically | 942 | (It should be loaded automatically |
935 | at startup with a warning message displayed). | 943 | at startup with a warning message displayed). |
936 | The place of the configuration file has changed too. | 944 | The place of the configuration file has changed too. |
937 | If you want to use your old KO/Pi config, | 945 | If you want to use your old KO/Pi config, |
938 | copy it to | 946 | copy it to |
939 | (yourHomeDir)/kdepim/config/korganizerrc | 947 | (yourHomeDir)/kdepim/config/korganizerrc |
940 | Please read VERSION 1.9.0 - topic 3) as well! | 948 | Please read VERSION 1.9.0 - topic 3) as well! |
941 | 949 | ||
942 | +++ IMPORTANT 2 +++ | 950 | +++ IMPORTANT 2 +++ |
943 | 951 | ||
944 | Because of the new paths, you will need | 952 | Because of the new paths, you will need |
945 | a new version of the KO/Pi alarm applet | 953 | a new version of the KO/Pi alarm applet |
946 | for Zaurus. | 954 | for Zaurus. |
947 | Use version >= 1.9.1 | 955 | Use version >= 1.9.1 |
948 | 956 | ||
949 | 2) | 957 | 2) |
950 | Now the QWhat'sThis Icon works for items | 958 | Now the QWhat'sThis Icon works for items |
951 | in the month view as well. | 959 | in the month view as well. |
952 | (See VERSION 1.7.8 Topic 1) ). | 960 | (See VERSION 1.7.8 Topic 1) ). |
953 | 3) | 961 | 3) |
954 | You can import birtsdays/anniversaries | 962 | You can import birtsdays/anniversaries |
955 | from KA/Pi into KO/Pi. | 963 | from KA/Pi into KO/Pi. |
956 | Choose menu File-Import birthdays. | 964 | Choose menu File-Import birthdays. |
957 | If you import twice, already imported items | 965 | If you import twice, already imported items |
958 | will not be imported again, if they | 966 | will not be imported again, if they |
959 | have not been changed in KO/Pi. | 967 | have not been changed in KO/Pi. |
960 | 4) | 968 | 4) |
961 | When syncing with sharp DTM, now a progress | 969 | When syncing with sharp DTM, now a progress |
962 | is shown, when the data is written back. | 970 | is shown, when the data is written back. |
963 | If there is much data in KO/Pi and no data | 971 | If there is much data in KO/Pi and no data |
964 | in DTM, that can take a long time. | 972 | in DTM, that can take a long time. |
965 | (But only for the first time ). | 973 | (But only for the first time ). |
966 | 5) | 974 | 5) |
967 | In the search dialog, you can search | 975 | In the search dialog, you can search |
968 | now for the name/email of an attendee | 976 | now for the name/email of an attendee |
969 | of an event/todo. | 977 | of an event/todo. |
970 | To get more space for displaying | 978 | To get more space for displaying |
971 | search results, the buttons | 979 | search results, the buttons |
972 | for "search" and "close" on the | 980 | for "search" and "close" on the |
973 | bottom are removed in the PDA version. | 981 | bottom are removed in the PDA version. |
974 | You have to click OK in the top right | 982 | You have to click OK in the top right |
975 | corner to do a search. | 983 | corner to do a search. |
976 | 6) | 984 | 6) |
977 | Now it is possible to disable the displaying | 985 | Now it is possible to disable the displaying |
978 | of todo items in the Allday part of the Agenda. | 986 | of todo items in the Allday part of the Agenda. |
979 | Choose Menu Action-Configure, | 987 | Choose Menu Action-Configure, |
980 | TAB Todo View, checkbox | 988 | TAB Todo View, checkbox |
981 | "Allday Agenda view shows todos" | 989 | "Allday Agenda view shows todos" |
982 | 7) | 990 | 7) |
983 | If FastLoad is enabled, now the settings and the | 991 | If FastLoad is enabled, now the settings and the |
984 | calendar data are saved, when KO/Pi is closed. | 992 | calendar data are saved, when KO/Pi is closed. |
985 | (If no Fastload is enabled, KO/Pi saves | 993 | (If no Fastload is enabled, KO/Pi saves |
986 | the data as well, of course) | 994 | the data as well, of course) |
987 | 8) | 995 | 8) |
988 | The Agenda View has a minimize-splitter now, | 996 | The Agenda View has a minimize-splitter now, |
989 | such that the height of the allday part can be | 997 | such that the height of the allday part can be |
990 | changed quickly. | 998 | changed quickly. |
991 | 999 | ||
992 | ********** VERSION 1.9.0 ************ | 1000 | ********** VERSION 1.9.0 ************ |
993 | 1) | 1001 | 1) |
994 | KO/Pi is now merged with the new microKDE from KA/Pi. | 1002 | KO/Pi is now merged with the new microKDE from KA/Pi. |
995 | KO/Pi accesses now KA/Pi as the addressbook. | 1003 | KO/Pi accesses now KA/Pi as the addressbook. |
996 | The other ddressbook-plugins are not working any longer. | 1004 | The other ddressbook-plugins are not working any longer. |
997 | (It is planned, that later KA/Pi itself uses these plugins) | 1005 | (It is planned, that later KA/Pi itself uses these plugins) |
998 | New versions of KO/Pi are only available | 1006 | New versions of KO/Pi are only available |
999 | together with KA/Pi as the KDE-Pim/Pi package. | 1007 | together with KA/Pi as the KDE-Pim/Pi package. |
1000 | 2) | 1008 | 2) |
1001 | If you click on an attendee of a meeting in the | 1009 | If you click on an attendee of a meeting in the |
1002 | event viewer, a detailed summary of the | 1010 | event viewer, a detailed summary of the |
1003 | attendee is shown. | 1011 | attendee is shown. |
1004 | 3) | 1012 | 3) |
1005 | The place of the configuration file has changed. | 1013 | The place of the configuration file has changed. |
1006 | If you want to use your old KO/Pi config, copy | 1014 | If you want to use your old KO/Pi config, copy |
1007 | Applications/korganizer/config_korganizerrc | 1015 | Applications/korganizer/config_korganizerrc |
1008 | to | 1016 | to |
1009 | Applications/korganizer/config/korganizerrc | 1017 | Applications/korganizer/config/korganizerrc |
1010 | 1018 | ||
1011 | ********** VERSION 1.7.8 ************ | 1019 | ********** VERSION 1.7.8 ************ |
1012 | 1) | 1020 | 1) |
1013 | Now the QWhat'sThis ist working. | 1021 | Now the QWhat'sThis ist working. |
1014 | Enable the QWhat'sThis icon in the toolbar. | 1022 | Enable the QWhat'sThis icon in the toolbar. |
1015 | (You have to restart to reload the changed toolbar config). | 1023 | (You have to restart to reload the changed toolbar config). |
1016 | Now click on the QWhat'sThis Icon | 1024 | Now click on the QWhat'sThis Icon |
1017 | in the top right corner of KO/Pi. | 1025 | in the top right corner of KO/Pi. |
1018 | Then click on an item in the Agenda View: | 1026 | Then click on an item in the Agenda View: |
1019 | You will get a detailed display of the items content. | 1027 | You will get a detailed display of the items content. |
1020 | 2) | 1028 | 2) |
1021 | Some other very minor changes. | 1029 | Some other very minor changes. |
1022 | But I have forgotten the details ... | 1030 | But I have forgotten the details ... |
1023 | For that reason I start this log here: | 1031 | For that reason I start this log here: |
1024 | To document my changes, when I am doing it. | 1032 | To document my changes, when I am doing it. |
1025 | 1033 | ||
1026 | ********** VERSION 1.7.7 ************ | 1034 | ********** VERSION 1.7.7 ************ |
1027 | Stable Version of KO/Pi | 1035 | Stable Version of KO/Pi |
diff --git a/bin/kdepim/kaddressbook/icons16/z_menu.png b/bin/kdepim/kaddressbook/icons16/z_menu.png new file mode 100644 index 0000000..b32c8e5 --- a/dev/null +++ b/bin/kdepim/kaddressbook/icons16/z_menu.png | |||
Binary files differ | |||
diff --git a/bin/kdepim/kaddressbook/icons22/z_menu.png b/bin/kdepim/kaddressbook/icons22/z_menu.png new file mode 100644 index 0000000..b1866a2 --- a/dev/null +++ b/bin/kdepim/kaddressbook/icons22/z_menu.png | |||
Binary files differ | |||
diff --git a/bin/kdepim/korganizer/icons16/z_menu.png b/bin/kdepim/korganizer/icons16/z_menu.png new file mode 100644 index 0000000..b32c8e5 --- a/dev/null +++ b/bin/kdepim/korganizer/icons16/z_menu.png | |||
Binary files differ | |||
diff --git a/bin/kdepim/korganizer/iconsmini/z_menu.png b/bin/kdepim/korganizer/iconsmini/z_menu.png new file mode 100644 index 0000000..584791a --- a/dev/null +++ b/bin/kdepim/korganizer/iconsmini/z_menu.png | |||
Binary files differ | |||
diff --git a/bin/kdepim/korganizer/z_menu.png b/bin/kdepim/korganizer/z_menu.png new file mode 100644 index 0000000..b1866a2 --- a/dev/null +++ b/bin/kdepim/korganizer/z_menu.png | |||
Binary files differ | |||
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 1b17665..79f897b 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,3330 +1,3330 @@ | |||
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 | Async a special exception, permission is given to link this program | 19 | Async a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /*s | 24 | /*s |
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 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qprogressbar.h> | 42 | #include <qprogressbar.h> |
43 | #include <libkdepim/phoneaccess.h> | 43 | #include <libkdepim/phoneaccess.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qfile.h> | 48 | #include <qfile.h> |
49 | #include <qapplicaton.h> | 49 | #include <qapplicaton.h> |
50 | #include <qprogressbar.h> | 50 | #include <qprogressbar.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qvbox.h> | 53 | #include <qvbox.h> |
54 | #include <kabc/addresseelist.h> | 54 | #include <kabc/addresseelist.h> |
55 | #include <kabc/errorhandler.h> | 55 | #include <kabc/errorhandler.h> |
56 | #include <kabc/resource.h> | 56 | #include <kabc/resource.h> |
57 | #include <kabc/vcardconverter.h> | 57 | #include <kabc/vcardconverter.h> |
58 | #include <kapplication.h> | 58 | #include <kapplication.h> |
59 | #include <kactionclasses.h> | 59 | #include <kactionclasses.h> |
60 | #include <kcmultidialog.h> | 60 | #include <kcmultidialog.h> |
61 | #include <kdebug.h> | 61 | #include <kdebug.h> |
62 | #include <kdeversion.h> | 62 | #include <kdeversion.h> |
63 | #include <kkeydialog.h> | 63 | #include <kkeydialog.h> |
64 | #include <kmessagebox.h> | 64 | #include <kmessagebox.h> |
65 | #include <kprinter.h> | 65 | #include <kprinter.h> |
66 | #include <kprotocolinfo.h> | 66 | #include <kprotocolinfo.h> |
67 | #include <kresources/selectdialog.h> | 67 | #include <kresources/selectdialog.h> |
68 | #include <kstandarddirs.h> | 68 | #include <kstandarddirs.h> |
69 | #include <ktempfile.h> | 69 | #include <ktempfile.h> |
70 | #include <kxmlguiclient.h> | 70 | #include <kxmlguiclient.h> |
71 | #include <kaboutdata.h> | 71 | #include <kaboutdata.h> |
72 | #include <libkdepim/categoryselectdialog.h> | 72 | #include <libkdepim/categoryselectdialog.h> |
73 | 73 | ||
74 | #include "addresseeutil.h" | 74 | #include "addresseeutil.h" |
75 | #include "addresseeeditordialog.h" | 75 | #include "addresseeeditordialog.h" |
76 | #include "extensionmanager.h" | 76 | #include "extensionmanager.h" |
77 | #include "kstdaction.h" | 77 | #include "kstdaction.h" |
78 | #include "kaddressbookservice.h" | 78 | #include "kaddressbookservice.h" |
79 | #include "ldapsearchdialog.h" | 79 | #include "ldapsearchdialog.h" |
80 | #include "printing/printingwizard.h" | 80 | #include "printing/printingwizard.h" |
81 | #else // KAB_EMBEDDED | 81 | #else // KAB_EMBEDDED |
82 | 82 | ||
83 | #include <kapplication.h> | 83 | #include <kapplication.h> |
84 | #include "KDGanttMinimizeSplitter.h" | 84 | #include "KDGanttMinimizeSplitter.h" |
85 | #include "kaddressbookmain.h" | 85 | #include "kaddressbookmain.h" |
86 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
88 | //US | 88 | //US |
89 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | 99 | ||
100 | 100 | ||
101 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
102 | 102 | ||
103 | 103 | ||
104 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 108 | #else |
109 | 109 | ||
110 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
118 | #include "xxportselectdialog.h" | 118 | #include "xxportselectdialog.h" |
119 | 119 | ||
120 | 120 | ||
121 | #include <kresources/selectdialog.h> | 121 | #include <kresources/selectdialog.h> |
122 | #include <kmessagebox.h> | 122 | #include <kmessagebox.h> |
123 | 123 | ||
124 | #include <picture.h> | 124 | #include <picture.h> |
125 | #include <resource.h> | 125 | #include <resource.h> |
126 | 126 | ||
127 | //US#include <qsplitter.h> | 127 | //US#include <qsplitter.h> |
128 | #include <qmap.h> | 128 | #include <qmap.h> |
129 | #include <qdir.h> | 129 | #include <qdir.h> |
130 | #include <qfile.h> | 130 | #include <qfile.h> |
131 | #include <qvbox.h> | 131 | #include <qvbox.h> |
132 | #include <qlayout.h> | 132 | #include <qlayout.h> |
133 | #include <qclipboard.h> | 133 | #include <qclipboard.h> |
134 | #include <qtextstream.h> | 134 | #include <qtextstream.h> |
135 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
136 | #include <qbuttongroup.h> | 136 | #include <qbuttongroup.h> |
137 | 137 | ||
138 | #include <libkdepim/categoryselectdialog.h> | 138 | #include <libkdepim/categoryselectdialog.h> |
139 | #include <libkdepim/categoryeditdialog.h> | 139 | #include <libkdepim/categoryeditdialog.h> |
140 | #include <kabc/vcardconverter.h> | 140 | #include <kabc/vcardconverter.h> |
141 | 141 | ||
142 | 142 | ||
143 | #include "addresseeutil.h" | 143 | #include "addresseeutil.h" |
144 | #include "undocmds.h" | 144 | #include "undocmds.h" |
145 | #include "addresseeeditordialog.h" | 145 | #include "addresseeeditordialog.h" |
146 | #include "viewmanager.h" | 146 | #include "viewmanager.h" |
147 | #include "details/detailsviewcontainer.h" | 147 | #include "details/detailsviewcontainer.h" |
148 | #include "kabprefs.h" | 148 | #include "kabprefs.h" |
149 | #include "xxportmanager.h" | 149 | #include "xxportmanager.h" |
150 | #include "incsearchwidget.h" | 150 | #include "incsearchwidget.h" |
151 | #include "jumpbuttonbar.h" | 151 | #include "jumpbuttonbar.h" |
152 | #include "extensionmanager.h" | 152 | #include "extensionmanager.h" |
153 | #include "addresseeconfig.h" | 153 | #include "addresseeconfig.h" |
154 | #include "nameeditdialog.h" | 154 | #include "nameeditdialog.h" |
155 | #include <kcmultidialog.h> | 155 | #include <kcmultidialog.h> |
156 | 156 | ||
157 | #ifdef _WIN32_ | 157 | #ifdef _WIN32_ |
158 | #ifdef _OL_IMPORT_ | 158 | #ifdef _OL_IMPORT_ |
159 | #include "kaimportoldialog.h" | 159 | #include "kaimportoldialog.h" |
160 | #endif | 160 | #endif |
161 | #else | 161 | #else |
162 | #include <unistd.h> | 162 | #include <unistd.h> |
163 | #endif | 163 | #endif |
164 | // sync includes | 164 | // sync includes |
165 | #include <libkdepim/ksyncprofile.h> | 165 | #include <libkdepim/ksyncprofile.h> |
166 | #include <libkdepim/ksyncprefsdialog.h> | 166 | #include <libkdepim/ksyncprefsdialog.h> |
167 | 167 | ||
168 | 168 | ||
169 | class KABCatPrefs : public QDialog | 169 | class KABCatPrefs : public QDialog |
170 | { | 170 | { |
171 | public: | 171 | public: |
172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
173 | QDialog( parent, name, true ) | 173 | QDialog( parent, name, true ) |
174 | { | 174 | { |
175 | setCaption( i18n("Manage new Categories") ); | 175 | setCaption( i18n("Manage new Categories") ); |
176 | QVBoxLayout* lay = new QVBoxLayout( this ); | 176 | QVBoxLayout* lay = new QVBoxLayout( this ); |
177 | lay->setSpacing( 3 ); | 177 | lay->setSpacing( 3 ); |
178 | lay->setMargin( 3 ); | 178 | lay->setMargin( 3 ); |
179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
180 | lay->addWidget( lab ); | 180 | lay->addWidget( lab ); |
181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
182 | lay->addWidget( format ); | 182 | lay->addWidget( format ); |
183 | format->setExclusive ( true ) ; | 183 | format->setExclusive ( true ) ; |
184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
185 | new QRadioButton(i18n("Remove from addressees"), format ); | 185 | new QRadioButton(i18n("Remove from addressees"), format ); |
186 | addCatBut->setChecked( true ); | 186 | addCatBut->setChecked( true ); |
187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
188 | lay->addWidget( ok ); | 188 | lay->addWidget( ok ); |
189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
190 | lay->addWidget( cancel ); | 190 | lay->addWidget( cancel ); |
191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
193 | resize( 200, 200 ); | 193 | resize( 200, 200 ); |
194 | } | 194 | } |
195 | 195 | ||
196 | bool addCat() { return addCatBut->isChecked(); } | 196 | bool addCat() { return addCatBut->isChecked(); } |
197 | private: | 197 | private: |
198 | QRadioButton* addCatBut; | 198 | QRadioButton* addCatBut; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | class KABFormatPrefs : public QDialog | 201 | class KABFormatPrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Set formatted name") ); | 207 | setCaption( i18n("Set formatted name") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
212 | lay->addWidget( lab ); | 212 | lay->addWidget( lab ); |
213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); |
214 | lay->addWidget( format ); | 214 | lay->addWidget( format ); |
215 | format->setExclusive ( true ) ; | 215 | format->setExclusive ( true ) ; |
216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
219 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 219 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
220 | simple->setChecked( true ); | 220 | simple->setChecked( true ); |
221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
222 | lay->addWidget( setCompany ); | 222 | lay->addWidget( setCompany ); |
223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
224 | lay->addWidget( ok ); | 224 | lay->addWidget( ok ); |
225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
226 | lay->addWidget( cancel ); | 226 | lay->addWidget( cancel ); |
227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
229 | //resize( 200, 200 ); | 229 | //resize( 200, 200 ); |
230 | 230 | ||
231 | } | 231 | } |
232 | public: | 232 | public: |
233 | QRadioButton* simple, *full, *reverse, *company; | 233 | QRadioButton* simple, *full, *reverse, *company; |
234 | QCheckBox* setCompany; | 234 | QCheckBox* setCompany; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | class KAex2phonePrefs : public QDialog | 239 | class KAex2phonePrefs : public QDialog |
240 | { | 240 | { |
241 | public: | 241 | public: |
242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
243 | QDialog( parent, name, true ) | 243 | QDialog( parent, name, true ) |
244 | { | 244 | { |
245 | setCaption( i18n("Export to phone options") ); | 245 | setCaption( i18n("Export to phone options") ); |
246 | QVBoxLayout* lay = new QVBoxLayout( this ); | 246 | QVBoxLayout* lay = new QVBoxLayout( this ); |
247 | lay->setSpacing( 3 ); | 247 | lay->setSpacing( 3 ); |
248 | lay->setMargin( 3 ); | 248 | lay->setMargin( 3 ); |
249 | QLabel *lab; | 249 | QLabel *lab; |
250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
251 | lab->setAlignment (AlignHCenter ); | 251 | lab->setAlignment (AlignHCenter ); |
252 | QHBox* temphb; | 252 | QHBox* temphb; |
253 | temphb = new QHBox( this ); | 253 | temphb = new QHBox( this ); |
254 | new QLabel( i18n("I/O device: "), temphb ); | 254 | new QLabel( i18n("I/O device: "), temphb ); |
255 | mPhoneDevice = new QLineEdit( temphb); | 255 | mPhoneDevice = new QLineEdit( temphb); |
256 | lay->addWidget( temphb ); | 256 | lay->addWidget( temphb ); |
257 | temphb = new QHBox( this ); | 257 | temphb = new QHBox( this ); |
258 | new QLabel( i18n("Connection: "), temphb ); | 258 | new QLabel( i18n("Connection: "), temphb ); |
259 | mPhoneConnection = new QLineEdit( temphb); | 259 | mPhoneConnection = new QLineEdit( temphb); |
260 | lay->addWidget( temphb ); | 260 | lay->addWidget( temphb ); |
261 | temphb = new QHBox( this ); | 261 | temphb = new QHBox( this ); |
262 | new QLabel( i18n("Model(opt.): "), temphb ); | 262 | new QLabel( i18n("Model(opt.): "), temphb ); |
263 | mPhoneModel = new QLineEdit( temphb); | 263 | mPhoneModel = new QLineEdit( temphb); |
264 | lay->addWidget( temphb ); | 264 | lay->addWidget( temphb ); |
265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
266 | // lay->addWidget( mWriteToSim ); | 266 | // lay->addWidget( mWriteToSim ); |
267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
268 | lab->setAlignment (AlignHCenter); | 268 | lab->setAlignment (AlignHCenter); |
269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
270 | lay->addWidget( ok ); | 270 | lay->addWidget( ok ); |
271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
272 | lay->addWidget( cancel ); | 272 | lay->addWidget( cancel ); |
273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
275 | resize( 220, 240 ); | 275 | resize( 220, 240 ); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | public: | 279 | public: |
280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
281 | QCheckBox* mWriteToSim; | 281 | QCheckBox* mWriteToSim; |
282 | }; | 282 | }; |
283 | 283 | ||
284 | 284 | ||
285 | bool pasteWithNewUid = true; | 285 | bool pasteWithNewUid = true; |
286 | 286 | ||
287 | #ifdef KAB_EMBEDDED | 287 | #ifdef KAB_EMBEDDED |
288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
292 | #else //KAB_EMBEDDED | 292 | #else //KAB_EMBEDDED |
293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
296 | mReadWrite( readWrite ), mModified( false ) | 296 | mReadWrite( readWrite ), mModified( false ) |
297 | #endif //KAB_EMBEDDED | 297 | #endif //KAB_EMBEDDED |
298 | { | 298 | { |
299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
300 | // syncManager->setBlockSave(false); | 300 | // syncManager->setBlockSave(false); |
301 | mMiniSplitter = 0; | 301 | mMiniSplitter = 0; |
302 | mExtensionBarSplitter = 0; | 302 | mExtensionBarSplitter = 0; |
303 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 303 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
304 | mAddressBook = KABC::StdAddressBook::self(); | 304 | mAddressBook = KABC::StdAddressBook::self(); |
305 | KABC::StdAddressBook::setAutomaticSave( false ); | 305 | KABC::StdAddressBook::setAutomaticSave( false ); |
306 | 306 | ||
307 | #ifndef KAB_EMBEDDED | 307 | #ifndef KAB_EMBEDDED |
308 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 308 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
309 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
310 | 310 | ||
311 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 311 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
312 | SLOT( addressBookChanged() ) ); | 312 | SLOT( addressBookChanged() ) ); |
313 | 313 | ||
314 | #if 0 | 314 | #if 0 |
315 | // LP moved to addressbook init method | 315 | // LP moved to addressbook init method |
316 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 316 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
317 | "X-Department", "KADDRESSBOOK" ); | 317 | "X-Department", "KADDRESSBOOK" ); |
318 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 318 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
319 | "X-Profession", "KADDRESSBOOK" ); | 319 | "X-Profession", "KADDRESSBOOK" ); |
320 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 320 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
321 | "X-AssistantsName", "KADDRESSBOOK" ); | 321 | "X-AssistantsName", "KADDRESSBOOK" ); |
322 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 322 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
323 | "X-ManagersName", "KADDRESSBOOK" ); | 323 | "X-ManagersName", "KADDRESSBOOK" ); |
324 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 324 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
325 | "X-SpousesName", "KADDRESSBOOK" ); | 325 | "X-SpousesName", "KADDRESSBOOK" ); |
326 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 326 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
327 | "X-Office", "KADDRESSBOOK" ); | 327 | "X-Office", "KADDRESSBOOK" ); |
328 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 328 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
329 | "X-IMAddress", "KADDRESSBOOK" ); | 329 | "X-IMAddress", "KADDRESSBOOK" ); |
330 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 330 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
331 | "X-Anniversary", "KADDRESSBOOK" ); | 331 | "X-Anniversary", "KADDRESSBOOK" ); |
332 | 332 | ||
333 | //US added this field to become compatible with Opie/qtopia addressbook | 333 | //US added this field to become compatible with Opie/qtopia addressbook |
334 | // values can be "female" or "male" or "". An empty field represents undefined. | 334 | // values can be "female" or "male" or "". An empty field represents undefined. |
335 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 335 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
336 | "X-Gender", "KADDRESSBOOK" ); | 336 | "X-Gender", "KADDRESSBOOK" ); |
337 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 337 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
338 | "X-Children", "KADDRESSBOOK" ); | 338 | "X-Children", "KADDRESSBOOK" ); |
339 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 339 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
340 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 340 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
341 | #endif | 341 | #endif |
342 | initGUI(); | 342 | initGUI(); |
343 | 343 | ||
344 | mIncSearchWidget->setFocus(); | 344 | mIncSearchWidget->setFocus(); |
345 | 345 | ||
346 | 346 | ||
347 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 347 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
348 | SLOT( setContactSelected( const QString& ) ) ); | 348 | SLOT( setContactSelected( const QString& ) ) ); |
349 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 349 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
350 | SLOT( executeContact( const QString& ) ) ); | 350 | SLOT( executeContact( const QString& ) ) ); |
351 | 351 | ||
352 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 352 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
353 | SLOT( deleteContacts( ) ) ); | 353 | SLOT( deleteContacts( ) ) ); |
354 | connect( mViewManager, SIGNAL( modified() ), | 354 | connect( mViewManager, SIGNAL( modified() ), |
355 | SLOT( setModified() ) ); | 355 | SLOT( setModified() ) ); |
356 | 356 | ||
357 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 357 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
358 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 358 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
359 | 359 | ||
360 | connect( mXXPortManager, SIGNAL( modified() ), | 360 | connect( mXXPortManager, SIGNAL( modified() ), |
361 | SLOT( setModified() ) ); | 361 | SLOT( setModified() ) ); |
362 | 362 | ||
363 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 363 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
364 | SLOT( incrementalSearch( const QString& ) ) ); | 364 | SLOT( incrementalSearch( const QString& ) ) ); |
365 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 365 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
366 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 366 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
367 | 367 | ||
368 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 368 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
369 | SLOT( sendMail( const QString& ) ) ); | 369 | SLOT( sendMail( const QString& ) ) ); |
370 | 370 | ||
371 | 371 | ||
372 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 372 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
373 | 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&))); | 373 | 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&))); |
374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
375 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 375 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
376 | 376 | ||
377 | 377 | ||
378 | #ifndef KAB_EMBEDDED | 378 | #ifndef KAB_EMBEDDED |
379 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 379 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
380 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 380 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
381 | 381 | ||
382 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 382 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
383 | SLOT( browse( const QString& ) ) ); | 383 | SLOT( browse( const QString& ) ) ); |
384 | 384 | ||
385 | 385 | ||
386 | mAddressBookService = new KAddressBookService( this ); | 386 | mAddressBookService = new KAddressBookService( this ); |
387 | 387 | ||
388 | #endif //KAB_EMBEDDED | 388 | #endif //KAB_EMBEDDED |
389 | 389 | ||
390 | mMessageTimer = new QTimer( this ); | 390 | mMessageTimer = new QTimer( this ); |
391 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 391 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
392 | mEditorDialog = 0; | 392 | mEditorDialog = 0; |
393 | createAddresseeEditorDialog( this ); | 393 | createAddresseeEditorDialog( this ); |
394 | setModified( false ); | 394 | setModified( false ); |
395 | mBRdisabled = false; | 395 | mBRdisabled = false; |
396 | #ifndef DESKTOP_VERSION | 396 | #ifndef DESKTOP_VERSION |
397 | infrared = 0; | 397 | infrared = 0; |
398 | #endif | 398 | #endif |
399 | //toggleBeamReceive( ); | 399 | //toggleBeamReceive( ); |
400 | //mMainWindow->toolBar()->show(); | 400 | //mMainWindow->toolBar()->show(); |
401 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 401 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
402 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 402 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
403 | } | 403 | } |
404 | 404 | ||
405 | void KABCore::updateToolBar() | 405 | void KABCore::updateToolBar() |
406 | { | 406 | { |
407 | static int iii = 0; | 407 | static int iii = 0; |
408 | ++iii; | 408 | ++iii; |
409 | mMainWindow->toolBar()->repaintMe(); | 409 | mMainWindow->toolBar()->repaintMe(); |
410 | if ( iii < 4 ) | 410 | if ( iii < 4 ) |
411 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 411 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
412 | } | 412 | } |
413 | KABCore::~KABCore() | 413 | KABCore::~KABCore() |
414 | { | 414 | { |
415 | // save(); | 415 | // save(); |
416 | //saveSettings(); | 416 | //saveSettings(); |
417 | //KABPrefs::instance()->writeConfig(); | 417 | //KABPrefs::instance()->writeConfig(); |
418 | delete AddresseeConfig::instance(); | 418 | delete AddresseeConfig::instance(); |
419 | mAddressBook = 0; | 419 | mAddressBook = 0; |
420 | KABC::StdAddressBook::close(); | 420 | KABC::StdAddressBook::close(); |
421 | 421 | ||
422 | delete syncManager; | 422 | delete syncManager; |
423 | #ifndef DESKTOP_VERSION | 423 | #ifndef DESKTOP_VERSION |
424 | if ( infrared ) | 424 | if ( infrared ) |
425 | delete infrared; | 425 | delete infrared; |
426 | #endif | 426 | #endif |
427 | } | 427 | } |
428 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 428 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
429 | { | 429 | { |
430 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 430 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
431 | if ( cmsg == "setDocument(QString)" ) { | 431 | if ( cmsg == "setDocument(QString)" ) { |
432 | QDataStream stream( data, IO_ReadOnly ); | 432 | QDataStream stream( data, IO_ReadOnly ); |
433 | QString fileName; | 433 | QString fileName; |
434 | stream >> fileName; | 434 | stream >> fileName; |
435 | recieve( fileName ); | 435 | recieve( fileName ); |
436 | return; | 436 | return; |
437 | } | 437 | } |
438 | } | 438 | } |
439 | void KABCore::toggleBeamReceive( ) | 439 | void KABCore::toggleBeamReceive( ) |
440 | { | 440 | { |
441 | if ( mBRdisabled ) | 441 | if ( mBRdisabled ) |
442 | return; | 442 | return; |
443 | #ifndef DESKTOP_VERSION | 443 | #ifndef DESKTOP_VERSION |
444 | if ( infrared ) { | 444 | if ( infrared ) { |
445 | qDebug("KA: AB disable BeamReceive "); | 445 | qDebug("KA: AB disable BeamReceive "); |
446 | delete infrared; | 446 | delete infrared; |
447 | infrared = 0; | 447 | infrared = 0; |
448 | mActionBR->setChecked(false); | 448 | mActionBR->setChecked(false); |
449 | return; | 449 | return; |
450 | } | 450 | } |
451 | qDebug("KA: AB enable BeamReceive "); | 451 | qDebug("KA: AB enable BeamReceive "); |
452 | mActionBR->setChecked(true); | 452 | mActionBR->setChecked(true); |
453 | 453 | ||
454 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 454 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
455 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 455 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
456 | #endif | 456 | #endif |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | void KABCore::disableBR(bool b) | 460 | void KABCore::disableBR(bool b) |
461 | { | 461 | { |
462 | #ifndef DESKTOP_VERSION | 462 | #ifndef DESKTOP_VERSION |
463 | if ( b ) { | 463 | if ( b ) { |
464 | if ( infrared ) { | 464 | if ( infrared ) { |
465 | toggleBeamReceive( ); | 465 | toggleBeamReceive( ); |
466 | } | 466 | } |
467 | mBRdisabled = true; | 467 | mBRdisabled = true; |
468 | } else { | 468 | } else { |
469 | if ( mBRdisabled ) { | 469 | if ( mBRdisabled ) { |
470 | mBRdisabled = false; | 470 | mBRdisabled = false; |
471 | //toggleBeamReceive( ); | 471 | //toggleBeamReceive( ); |
472 | } | 472 | } |
473 | } | 473 | } |
474 | #endif | 474 | #endif |
475 | 475 | ||
476 | } | 476 | } |
477 | void KABCore::recieve( QString fn ) | 477 | void KABCore::recieve( QString fn ) |
478 | { | 478 | { |
479 | //qDebug("KABCore::recieve "); | 479 | //qDebug("KABCore::recieve "); |
480 | int count = mAddressBook->importFromFile( fn, true ); | 480 | int count = mAddressBook->importFromFile( fn, true ); |
481 | if ( count ) | 481 | if ( count ) |
482 | setModified( true ); | 482 | setModified( true ); |
483 | mViewManager->refreshView(); | 483 | mViewManager->refreshView(); |
484 | message(i18n("%1 contact(s) received!").arg( count )); | 484 | message(i18n("%1 contact(s) received!").arg( count )); |
485 | topLevelWidget()->showMaximized(); | 485 | topLevelWidget()->showMaximized(); |
486 | topLevelWidget()->raise(); | 486 | topLevelWidget()->raise(); |
487 | } | 487 | } |
488 | void KABCore::restoreSettings() | 488 | void KABCore::restoreSettings() |
489 | { | 489 | { |
490 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 490 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
491 | 491 | ||
492 | bool state; | 492 | bool state; |
493 | 493 | ||
494 | if (mMultipleViewsAtOnce) | 494 | if (mMultipleViewsAtOnce) |
495 | state = KABPrefs::instance()->mDetailsPageVisible; | 495 | state = KABPrefs::instance()->mDetailsPageVisible; |
496 | else | 496 | else |
497 | state = false; | 497 | state = false; |
498 | 498 | ||
499 | mActionDetails->setChecked( state ); | 499 | mActionDetails->setChecked( state ); |
500 | setDetailsVisible( state ); | 500 | setDetailsVisible( state ); |
501 | 501 | ||
502 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 502 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
503 | 503 | ||
504 | mActionJumpBar->setChecked( state ); | 504 | mActionJumpBar->setChecked( state ); |
505 | setJumpButtonBarVisible( state ); | 505 | setJumpButtonBarVisible( state ); |
506 | /*US | 506 | /*US |
507 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 507 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
508 | if ( splitterSize.count() == 0 ) { | 508 | if ( splitterSize.count() == 0 ) { |
509 | splitterSize.append( width() / 2 ); | 509 | splitterSize.append( width() / 2 ); |
510 | splitterSize.append( width() / 2 ); | 510 | splitterSize.append( width() / 2 ); |
511 | } | 511 | } |
512 | mMiniSplitter->setSizes( splitterSize ); | 512 | mMiniSplitter->setSizes( splitterSize ); |
513 | if ( mExtensionBarSplitter ) { | 513 | if ( mExtensionBarSplitter ) { |
514 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 514 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
515 | if ( splitterSize.count() == 0 ) { | 515 | if ( splitterSize.count() == 0 ) { |
516 | splitterSize.append( width() / 2 ); | 516 | splitterSize.append( width() / 2 ); |
517 | splitterSize.append( width() / 2 ); | 517 | splitterSize.append( width() / 2 ); |
518 | } | 518 | } |
519 | mExtensionBarSplitter->setSizes( splitterSize ); | 519 | mExtensionBarSplitter->setSizes( splitterSize ); |
520 | 520 | ||
521 | } | 521 | } |
522 | */ | 522 | */ |
523 | mViewManager->restoreSettings(); | 523 | mViewManager->restoreSettings(); |
524 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 524 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
525 | mExtensionManager->restoreSettings(); | 525 | mExtensionManager->restoreSettings(); |
526 | #ifdef DESKTOP_VERSION | 526 | #ifdef DESKTOP_VERSION |
527 | int wid = width(); | 527 | int wid = width(); |
528 | if ( wid < 10 ) | 528 | if ( wid < 10 ) |
529 | wid = 400; | 529 | wid = 400; |
530 | #else | 530 | #else |
531 | int wid = QApplication::desktop()->width(); | 531 | int wid = QApplication::desktop()->width(); |
532 | if ( wid < 640 ) | 532 | if ( wid < 640 ) |
533 | wid = QApplication::desktop()->height(); | 533 | wid = QApplication::desktop()->height(); |
534 | #endif | 534 | #endif |
535 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 535 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
536 | if ( true /*splitterSize.count() == 0*/ ) { | 536 | if ( true /*splitterSize.count() == 0*/ ) { |
537 | splitterSize.append( wid / 2 ); | 537 | splitterSize.append( wid / 2 ); |
538 | splitterSize.append( wid / 2 ); | 538 | splitterSize.append( wid / 2 ); |
539 | } | 539 | } |
540 | mMiniSplitter->setSizes( splitterSize ); | 540 | mMiniSplitter->setSizes( splitterSize ); |
541 | if ( mExtensionBarSplitter ) { | 541 | if ( mExtensionBarSplitter ) { |
542 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 542 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
543 | if ( true /*splitterSize.count() == 0*/ ) { | 543 | if ( true /*splitterSize.count() == 0*/ ) { |
544 | splitterSize.append( wid / 2 ); | 544 | splitterSize.append( wid / 2 ); |
545 | splitterSize.append( wid / 2 ); | 545 | splitterSize.append( wid / 2 ); |
546 | } | 546 | } |
547 | mExtensionBarSplitter->setSizes( splitterSize ); | 547 | mExtensionBarSplitter->setSizes( splitterSize ); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | 551 | ||
552 | } | 552 | } |
553 | 553 | ||
554 | void KABCore::saveSettings() | 554 | void KABCore::saveSettings() |
555 | { | 555 | { |
556 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 556 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
557 | if ( mExtensionBarSplitter ) | 557 | if ( mExtensionBarSplitter ) |
558 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 558 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
559 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 559 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
560 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 560 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
561 | #ifndef KAB_EMBEDDED | 561 | #ifndef KAB_EMBEDDED |
562 | 562 | ||
563 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 563 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
564 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 564 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
565 | #endif //KAB_EMBEDDED | 565 | #endif //KAB_EMBEDDED |
566 | mExtensionManager->saveSettings(); | 566 | mExtensionManager->saveSettings(); |
567 | mViewManager->saveSettings(); | 567 | mViewManager->saveSettings(); |
568 | 568 | ||
569 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 569 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
570 | KABPrefs::instance()->writeConfig(); | 570 | KABPrefs::instance()->writeConfig(); |
571 | qDebug("KA: KABCore::saveSettings() "); | 571 | qDebug("KA: KABCore::saveSettings() "); |
572 | } | 572 | } |
573 | 573 | ||
574 | KABC::AddressBook *KABCore::addressBook() const | 574 | KABC::AddressBook *KABCore::addressBook() const |
575 | { | 575 | { |
576 | return mAddressBook; | 576 | return mAddressBook; |
577 | } | 577 | } |
578 | 578 | ||
579 | KConfig *KABCore::config() | 579 | KConfig *KABCore::config() |
580 | { | 580 | { |
581 | #ifndef KAB_EMBEDDED | 581 | #ifndef KAB_EMBEDDED |
582 | return KABPrefs::instance()->config(); | 582 | return KABPrefs::instance()->config(); |
583 | #else //KAB_EMBEDDED | 583 | #else //KAB_EMBEDDED |
584 | return KABPrefs::instance()->getConfig(); | 584 | return KABPrefs::instance()->getConfig(); |
585 | #endif //KAB_EMBEDDED | 585 | #endif //KAB_EMBEDDED |
586 | } | 586 | } |
587 | 587 | ||
588 | KActionCollection *KABCore::actionCollection() const | 588 | KActionCollection *KABCore::actionCollection() const |
589 | { | 589 | { |
590 | return mGUIClient->actionCollection(); | 590 | return mGUIClient->actionCollection(); |
591 | } | 591 | } |
592 | 592 | ||
593 | KABC::Field *KABCore::currentSearchField() const | 593 | KABC::Field *KABCore::currentSearchField() const |
594 | { | 594 | { |
595 | if (mIncSearchWidget) | 595 | if (mIncSearchWidget) |
596 | return mIncSearchWidget->currentField(); | 596 | return mIncSearchWidget->currentField(); |
597 | else | 597 | else |
598 | return 0; | 598 | return 0; |
599 | } | 599 | } |
600 | 600 | ||
601 | QStringList KABCore::selectedUIDs() const | 601 | QStringList KABCore::selectedUIDs() const |
602 | { | 602 | { |
603 | return mViewManager->selectedUids(); | 603 | return mViewManager->selectedUids(); |
604 | } | 604 | } |
605 | 605 | ||
606 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 606 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
607 | { | 607 | { |
608 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 608 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
609 | 609 | ||
610 | QPtrList<KRES::Resource> kresResources; | 610 | QPtrList<KRES::Resource> kresResources; |
611 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 611 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
612 | KABC::Resource *resource; | 612 | KABC::Resource *resource; |
613 | while ( ( resource = resIt.current() ) != 0 ) { | 613 | while ( ( resource = resIt.current() ) != 0 ) { |
614 | ++resIt; | 614 | ++resIt; |
615 | if ( !resource->readOnly() ) { | 615 | if ( !resource->readOnly() ) { |
616 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 616 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
617 | if ( res ) | 617 | if ( res ) |
618 | kresResources.append( res ); | 618 | kresResources.append( res ); |
619 | } | 619 | } |
620 | } | 620 | } |
621 | 621 | ||
622 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 622 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
623 | return static_cast<KABC::Resource*>( res ); | 623 | return static_cast<KABC::Resource*>( res ); |
624 | } | 624 | } |
625 | 625 | ||
626 | #ifndef KAB_EMBEDDED | 626 | #ifndef KAB_EMBEDDED |
627 | KAboutData *KABCore::createAboutData() | 627 | KAboutData *KABCore::createAboutData() |
628 | #else //KAB_EMBEDDED | 628 | #else //KAB_EMBEDDED |
629 | void KABCore::createAboutData() | 629 | void KABCore::createAboutData() |
630 | #endif //KAB_EMBEDDED | 630 | #endif //KAB_EMBEDDED |
631 | { | 631 | { |
632 | #ifndef KAB_EMBEDDED | 632 | #ifndef KAB_EMBEDDED |
633 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 633 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
634 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 634 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
635 | KAboutData::License_GPL_V2, | 635 | KAboutData::License_GPL_V2, |
636 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 636 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
637 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 637 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
638 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 638 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
639 | about->addAuthor( "Cornelius Schumacher", | 639 | about->addAuthor( "Cornelius Schumacher", |
640 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 640 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
641 | "schumacher@kde.org" ); | 641 | "schumacher@kde.org" ); |
642 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 642 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
643 | "mpilone@slac.com" ); | 643 | "mpilone@slac.com" ); |
644 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 644 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
645 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 645 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
646 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 646 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
647 | "michel@klaralvdalens-datakonsult.se" ); | 647 | "michel@klaralvdalens-datakonsult.se" ); |
648 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 648 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
649 | "hansen@kde.org" ); | 649 | "hansen@kde.org" ); |
650 | 650 | ||
651 | return about; | 651 | return about; |
652 | #endif //KAB_EMBEDDED | 652 | #endif //KAB_EMBEDDED |
653 | 653 | ||
654 | QString version; | 654 | QString version; |
655 | #include <../version> | 655 | #include <../version> |
656 | QMessageBox::about( this, "About KAddressbook/Pi", | 656 | QMessageBox::about( this, "About KAddressbook/Pi", |
657 | "KAddressbook/Platform-independent\n" | 657 | "KAddressbook/Platform-independent\n" |
658 | "(KA/Pi) " +version + " - " + | 658 | "(KA/Pi) " +version + " - " + |
659 | #ifdef DESKTOP_VERSION | 659 | #ifdef DESKTOP_VERSION |
660 | "Desktop Edition\n" | 660 | "Desktop Edition\n" |
661 | #else | 661 | #else |
662 | "PDA-Edition\n" | 662 | "PDA-Edition\n" |
663 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 663 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
664 | #endif | 664 | #endif |
665 | 665 | ||
666 | "(c) 2004 Ulf Schenk\n" | 666 | "(c) 2004 Ulf Schenk\n" |
667 | "(c) 2004 Lutz Rogowski\n" | 667 | "(c) 2004 Lutz Rogowski\n" |
668 | "(c) 1997-2003, The KDE PIM Team\n" | 668 | "(c) 1997-2003, The KDE PIM Team\n" |
669 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 669 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
670 | "Don Sanders Original author\n" | 670 | "Don Sanders Original author\n" |
671 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 671 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
672 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 672 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
673 | "Greg Stern DCOP interface\n" | 673 | "Greg Stern DCOP interface\n" |
674 | "Mark Westcot Contact pinning\n" | 674 | "Mark Westcot Contact pinning\n" |
675 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 675 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
676 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 676 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
677 | #ifdef _WIN32_ | 677 | #ifdef _WIN32_ |
678 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 678 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
679 | #endif | 679 | #endif |
680 | ); | 680 | ); |
681 | } | 681 | } |
682 | 682 | ||
683 | void KABCore::setContactSelected( const QString &uid ) | 683 | void KABCore::setContactSelected( const QString &uid ) |
684 | { | 684 | { |
685 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 685 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
686 | if ( !mDetails->isHidden() ) | 686 | if ( !mDetails->isHidden() ) |
687 | mDetails->setAddressee( addr ); | 687 | mDetails->setAddressee( addr ); |
688 | 688 | ||
689 | if ( !addr.isEmpty() ) { | 689 | if ( !addr.isEmpty() ) { |
690 | emit contactSelected( addr.formattedName() ); | 690 | emit contactSelected( addr.formattedName() ); |
691 | KABC::Picture pic = addr.photo(); | 691 | KABC::Picture pic = addr.photo(); |
692 | if ( pic.isIntern() ) { | 692 | if ( pic.isIntern() ) { |
693 | //US emit contactSelected( pic.data() ); | 693 | //US emit contactSelected( pic.data() ); |
694 | //US instead use: | 694 | //US instead use: |
695 | QPixmap px; | 695 | QPixmap px; |
696 | if (pic.data().isNull() != true) | 696 | if (pic.data().isNull() != true) |
697 | { | 697 | { |
698 | px.convertFromImage(pic.data()); | 698 | px.convertFromImage(pic.data()); |
699 | } | 699 | } |
700 | 700 | ||
701 | emit contactSelected( px ); | 701 | emit contactSelected( px ); |
702 | } | 702 | } |
703 | } | 703 | } |
704 | 704 | ||
705 | 705 | ||
706 | mExtensionManager->setSelectionChanged(); | 706 | mExtensionManager->setSelectionChanged(); |
707 | 707 | ||
708 | // update the actions | 708 | // update the actions |
709 | bool selected = !uid.isEmpty(); | 709 | bool selected = !uid.isEmpty(); |
710 | 710 | ||
711 | if ( mReadWrite ) { | 711 | if ( mReadWrite ) { |
712 | mActionCut->setEnabled( selected ); | 712 | mActionCut->setEnabled( selected ); |
713 | mActionPaste->setEnabled( selected ); | 713 | mActionPaste->setEnabled( selected ); |
714 | } | 714 | } |
715 | 715 | ||
716 | mActionCopy->setEnabled( selected ); | 716 | mActionCopy->setEnabled( selected ); |
717 | mActionDelete->setEnabled( selected ); | 717 | mActionDelete->setEnabled( selected ); |
718 | mActionEditAddressee->setEnabled( selected ); | 718 | mActionEditAddressee->setEnabled( selected ); |
719 | mActionMail->setEnabled( selected ); | 719 | mActionMail->setEnabled( selected ); |
720 | mActionMailVCard->setEnabled( selected ); | 720 | mActionMailVCard->setEnabled( selected ); |
721 | //if (mActionBeam) | 721 | //if (mActionBeam) |
722 | //mActionBeam->setEnabled( selected ); | 722 | //mActionBeam->setEnabled( selected ); |
723 | mActionWhoAmI->setEnabled( selected ); | 723 | mActionWhoAmI->setEnabled( selected ); |
724 | } | 724 | } |
725 | 725 | ||
726 | void KABCore::sendMail() | 726 | void KABCore::sendMail() |
727 | { | 727 | { |
728 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 728 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
729 | } | 729 | } |
730 | 730 | ||
731 | void KABCore::sendMail( const QString& emaillist ) | 731 | void KABCore::sendMail( const QString& emaillist ) |
732 | { | 732 | { |
733 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 733 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
734 | if (emaillist.contains(",") > 0) | 734 | if (emaillist.contains(",") > 0) |
735 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 735 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
736 | else | 736 | else |
737 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 737 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
738 | } | 738 | } |
739 | 739 | ||
740 | 740 | ||
741 | 741 | ||
742 | void KABCore::mailVCard() | 742 | void KABCore::mailVCard() |
743 | { | 743 | { |
744 | QStringList uids = mViewManager->selectedUids(); | 744 | QStringList uids = mViewManager->selectedUids(); |
745 | if ( !uids.isEmpty() ) | 745 | if ( !uids.isEmpty() ) |
746 | mailVCard( uids ); | 746 | mailVCard( uids ); |
747 | } | 747 | } |
748 | 748 | ||
749 | void KABCore::mailVCard( const QStringList& uids ) | 749 | void KABCore::mailVCard( const QStringList& uids ) |
750 | { | 750 | { |
751 | QStringList urls; | 751 | QStringList urls; |
752 | 752 | ||
753 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 753 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
754 | 754 | ||
755 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 755 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
756 | 756 | ||
757 | 757 | ||
758 | 758 | ||
759 | QDir().mkdir( dirName, true ); | 759 | QDir().mkdir( dirName, true ); |
760 | 760 | ||
761 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 761 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
762 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 762 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
763 | 763 | ||
764 | if ( a.isEmpty() ) | 764 | if ( a.isEmpty() ) |
765 | continue; | 765 | continue; |
766 | 766 | ||
767 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 767 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
768 | 768 | ||
769 | QString fileName = dirName + "/" + name; | 769 | QString fileName = dirName + "/" + name; |
770 | 770 | ||
771 | QFile outFile(fileName); | 771 | QFile outFile(fileName); |
772 | 772 | ||
773 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 773 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
774 | KABC::VCardConverter converter; | 774 | KABC::VCardConverter converter; |
775 | QString vcard; | 775 | QString vcard; |
776 | 776 | ||
777 | converter.addresseeToVCard( a, vcard ); | 777 | converter.addresseeToVCard( a, vcard ); |
778 | 778 | ||
779 | QTextStream t( &outFile ); // use a text stream | 779 | QTextStream t( &outFile ); // use a text stream |
780 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 780 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
781 | t << vcard; | 781 | t << vcard; |
782 | 782 | ||
783 | outFile.close(); | 783 | outFile.close(); |
784 | 784 | ||
785 | urls.append( fileName ); | 785 | urls.append( fileName ); |
786 | } | 786 | } |
787 | } | 787 | } |
788 | 788 | ||
789 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 789 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
790 | 790 | ||
791 | 791 | ||
792 | /*US | 792 | /*US |
793 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 793 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
794 | QString::null, // subject | 794 | QString::null, // subject |
795 | QString::null, // body | 795 | QString::null, // body |
796 | QString::null, | 796 | QString::null, |
797 | urls ); // attachments | 797 | urls ); // attachments |
798 | */ | 798 | */ |
799 | 799 | ||
800 | } | 800 | } |
801 | 801 | ||
802 | /** | 802 | /** |
803 | Beams the "WhoAmI contact. | 803 | Beams the "WhoAmI contact. |
804 | */ | 804 | */ |
805 | void KABCore::beamMySelf() | 805 | void KABCore::beamMySelf() |
806 | { | 806 | { |
807 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 807 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
808 | if (!a.isEmpty()) | 808 | if (!a.isEmpty()) |
809 | { | 809 | { |
810 | QStringList uids; | 810 | QStringList uids; |
811 | uids << a.uid(); | 811 | uids << a.uid(); |
812 | 812 | ||
813 | beamVCard(uids); | 813 | beamVCard(uids); |
814 | } else { | 814 | } else { |
815 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 815 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
816 | 816 | ||
817 | 817 | ||
818 | } | 818 | } |
819 | } | 819 | } |
820 | void KABCore::updateMainWindow() | 820 | void KABCore::updateMainWindow() |
821 | { | 821 | { |
822 | 822 | ||
823 | mMainWindow->showMaximized(); | 823 | mMainWindow->showMaximized(); |
824 | mMainWindow->update(); | 824 | mMainWindow->update(); |
825 | } | 825 | } |
826 | void KABCore::resizeEvent(QResizeEvent* e ) | 826 | void KABCore::resizeEvent(QResizeEvent* e ) |
827 | { | 827 | { |
828 | if ( !mMiniSplitter ) | 828 | if ( !mMiniSplitter ) |
829 | return; | 829 | return; |
830 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | 830 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); |
831 | if ( QApplication::desktop()->width() >= 480 ) { | 831 | if ( QApplication::desktop()->width() >= 480 ) { |
832 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 832 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
833 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 833 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
834 | mMiniSplitter->setOrientation( Qt::Horizontal); | 834 | mMiniSplitter->setOrientation( Qt::Horizontal); |
835 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 835 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
836 | if ( QApplication::desktop()->width() <= 640 ) { | 836 | if ( QApplication::desktop()->width() <= 640 ) { |
837 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 837 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
838 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 838 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
839 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 839 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
840 | } | 840 | } |
841 | } | 841 | } |
842 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 842 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
843 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 843 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
844 | mMiniSplitter->setOrientation( Qt::Vertical ); | 844 | mMiniSplitter->setOrientation( Qt::Vertical ); |
845 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 845 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
846 | if ( QApplication::desktop()->width() <= 640 ) { | 846 | if ( QApplication::desktop()->width() <= 640 ) { |
847 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 847 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
848 | mMainWindow->showMinimized(); | 848 | mMainWindow->showMinimized(); |
849 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 849 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
850 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 850 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
851 | } | 851 | } |
852 | } | 852 | } |
853 | } | 853 | } |
854 | } | 854 | } |
855 | 855 | ||
856 | } | 856 | } |
857 | void KABCore::export2phone() | 857 | void KABCore::export2phone() |
858 | { | 858 | { |
859 | 859 | ||
860 | QStringList uids; | 860 | QStringList uids; |
861 | XXPortSelectDialog dlg( this, false, this ); | 861 | XXPortSelectDialog dlg( this, false, this ); |
862 | if ( dlg.exec() ) | 862 | if ( dlg.exec() ) |
863 | uids = dlg.uids(); | 863 | uids = dlg.uids(); |
864 | else | 864 | else |
865 | return; | 865 | return; |
866 | if ( uids.isEmpty() ) | 866 | if ( uids.isEmpty() ) |
867 | return; | 867 | return; |
868 | // qDebug("count %d ", uids.count()); | 868 | // qDebug("count %d ", uids.count()); |
869 | 869 | ||
870 | KAex2phonePrefs ex2phone; | 870 | KAex2phonePrefs ex2phone; |
871 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 871 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
872 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 872 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
873 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 873 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
874 | 874 | ||
875 | if ( !ex2phone.exec() ) { | 875 | if ( !ex2phone.exec() ) { |
876 | return; | 876 | return; |
877 | } | 877 | } |
878 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 878 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
879 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 879 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
880 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 880 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
881 | 881 | ||
882 | 882 | ||
883 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 883 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
884 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 884 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
885 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 885 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
886 | 886 | ||
887 | QString fileName = getPhoneFile(); | 887 | QString fileName = getPhoneFile(); |
888 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 888 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
889 | return; | 889 | return; |
890 | 890 | ||
891 | message(i18n("Exporting to phone...")); | 891 | message(i18n("Exporting to phone...")); |
892 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 892 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
893 | 893 | ||
894 | } | 894 | } |
895 | QString KABCore::getPhoneFile() | 895 | QString KABCore::getPhoneFile() |
896 | { | 896 | { |
897 | #ifdef DESKTOP_VERSION | 897 | #ifdef DESKTOP_VERSION |
898 | return locateLocal("tmp", "phonefile.vcf"); | 898 | return locateLocal("tmp", "phonefile.vcf"); |
899 | #else | 899 | #else |
900 | return "/tmp/phonefile.vcf"; | 900 | return "/tmp/phonefile.vcf"; |
901 | #endif | 901 | #endif |
902 | 902 | ||
903 | } | 903 | } |
904 | void KABCore::writeToPhone( ) | 904 | void KABCore::writeToPhone( ) |
905 | { | 905 | { |
906 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 906 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
907 | message(i18n("Export to phone finished!")); | 907 | message(i18n("Export to phone finished!")); |
908 | else | 908 | else |
909 | qDebug(i18n("KA: Error exporting to phone")); | 909 | qDebug(i18n("KA: Error exporting to phone")); |
910 | } | 910 | } |
911 | void KABCore::beamVCard() | 911 | void KABCore::beamVCard() |
912 | { | 912 | { |
913 | QStringList uids; | 913 | QStringList uids; |
914 | XXPortSelectDialog dlg( this, false, this ); | 914 | XXPortSelectDialog dlg( this, false, this ); |
915 | if ( dlg.exec() ) | 915 | if ( dlg.exec() ) |
916 | uids = dlg.uids(); | 916 | uids = dlg.uids(); |
917 | else | 917 | else |
918 | return; | 918 | return; |
919 | if ( uids.isEmpty() ) | 919 | if ( uids.isEmpty() ) |
920 | return; | 920 | return; |
921 | beamVCard( uids ); | 921 | beamVCard( uids ); |
922 | } | 922 | } |
923 | 923 | ||
924 | 924 | ||
925 | void KABCore::beamVCard(const QStringList& uids) | 925 | void KABCore::beamVCard(const QStringList& uids) |
926 | { | 926 | { |
927 | 927 | ||
928 | // LR: we should use the /tmp dir on the Zaurus, | 928 | // LR: we should use the /tmp dir on the Zaurus, |
929 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 929 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
930 | 930 | ||
931 | #ifdef DESKTOP_VERSION | 931 | #ifdef DESKTOP_VERSION |
932 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 932 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
933 | #else | 933 | #else |
934 | QString fileName = "/tmp/kapibeamfile.vcf"; | 934 | QString fileName = "/tmp/kapibeamfile.vcf"; |
935 | #endif | 935 | #endif |
936 | 936 | ||
937 | KABC::VCardConverter converter; | 937 | KABC::VCardConverter converter; |
938 | QString description; | 938 | QString description; |
939 | QString datastream; | 939 | QString datastream; |
940 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 940 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
941 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 941 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
942 | 942 | ||
943 | if ( a.isEmpty() ) | 943 | if ( a.isEmpty() ) |
944 | continue; | 944 | continue; |
945 | 945 | ||
946 | if (description.isEmpty()) | 946 | if (description.isEmpty()) |
947 | description = a.formattedName(); | 947 | description = a.formattedName(); |
948 | 948 | ||
949 | QString vcard; | 949 | QString vcard; |
950 | converter.addresseeToVCard( a, vcard ); | 950 | converter.addresseeToVCard( a, vcard ); |
951 | int start = 0; | 951 | int start = 0; |
952 | int next; | 952 | int next; |
953 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 953 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
954 | int semi = vcard.find(";", next); | 954 | int semi = vcard.find(";", next); |
955 | int dopp = vcard.find(":", next); | 955 | int dopp = vcard.find(":", next); |
956 | int sep; | 956 | int sep; |
957 | if ( semi < dopp && semi >= 0 ) | 957 | if ( semi < dopp && semi >= 0 ) |
958 | sep = semi ; | 958 | sep = semi ; |
959 | else | 959 | else |
960 | sep = dopp; | 960 | sep = dopp; |
961 | datastream +=vcard.mid( start, next - start); | 961 | datastream +=vcard.mid( start, next - start); |
962 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 962 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
963 | start = sep; | 963 | start = sep; |
964 | } | 964 | } |
965 | datastream += vcard.mid( start,vcard.length() ); | 965 | datastream += vcard.mid( start,vcard.length() ); |
966 | } | 966 | } |
967 | #ifndef DESKTOP_VERSION | 967 | #ifndef DESKTOP_VERSION |
968 | QFile outFile(fileName); | 968 | QFile outFile(fileName); |
969 | if ( outFile.open(IO_WriteOnly) ) { | 969 | if ( outFile.open(IO_WriteOnly) ) { |
970 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 970 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
971 | QTextStream t( &outFile ); // use a text stream | 971 | QTextStream t( &outFile ); // use a text stream |
972 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 972 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
973 | t.setEncoding( QTextStream::Latin1 ); | 973 | t.setEncoding( QTextStream::Latin1 ); |
974 | t <<datastream.latin1(); | 974 | t <<datastream.latin1(); |
975 | outFile.close(); | 975 | outFile.close(); |
976 | Ir *ir = new Ir( this ); | 976 | Ir *ir = new Ir( this ); |
977 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 977 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
978 | ir->send( fileName, description, "text/x-vCard" ); | 978 | ir->send( fileName, description, "text/x-vCard" ); |
979 | } else { | 979 | } else { |
980 | qDebug("KA: Error open temp beam file "); | 980 | qDebug("KA: Error open temp beam file "); |
981 | return; | 981 | return; |
982 | } | 982 | } |
983 | #endif | 983 | #endif |
984 | 984 | ||
985 | } | 985 | } |
986 | 986 | ||
987 | void KABCore::beamDone( Ir *ir ) | 987 | void KABCore::beamDone( Ir *ir ) |
988 | { | 988 | { |
989 | #ifndef DESKTOP_VERSION | 989 | #ifndef DESKTOP_VERSION |
990 | delete ir; | 990 | delete ir; |
991 | #endif | 991 | #endif |
992 | topLevelWidget()->raise(); | 992 | topLevelWidget()->raise(); |
993 | message( i18n("Beaming finished!") ); | 993 | message( i18n("Beaming finished!") ); |
994 | } | 994 | } |
995 | 995 | ||
996 | 996 | ||
997 | void KABCore::browse( const QString& url ) | 997 | void KABCore::browse( const QString& url ) |
998 | { | 998 | { |
999 | #ifndef KAB_EMBEDDED | 999 | #ifndef KAB_EMBEDDED |
1000 | kapp->invokeBrowser( url ); | 1000 | kapp->invokeBrowser( url ); |
1001 | #else //KAB_EMBEDDED | 1001 | #else //KAB_EMBEDDED |
1002 | qDebug("KABCore::browse must be fixed"); | 1002 | qDebug("KABCore::browse must be fixed"); |
1003 | #endif //KAB_EMBEDDED | 1003 | #endif //KAB_EMBEDDED |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | void KABCore::selectAllContacts() | 1006 | void KABCore::selectAllContacts() |
1007 | { | 1007 | { |
1008 | mViewManager->setSelected( QString::null, true ); | 1008 | mViewManager->setSelected( QString::null, true ); |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | void KABCore::deleteContacts() | 1011 | void KABCore::deleteContacts() |
1012 | { | 1012 | { |
1013 | QStringList uidList = mViewManager->selectedUids(); | 1013 | QStringList uidList = mViewManager->selectedUids(); |
1014 | deleteContacts( uidList ); | 1014 | deleteContacts( uidList ); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | void KABCore::deleteContacts( const QStringList &uids ) | 1017 | void KABCore::deleteContacts( const QStringList &uids ) |
1018 | { | 1018 | { |
1019 | if ( uids.count() > 0 ) { | 1019 | if ( uids.count() > 0 ) { |
1020 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 1020 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
1021 | UndoStack::instance()->push( command ); | 1021 | UndoStack::instance()->push( command ); |
1022 | RedoStack::instance()->clear(); | 1022 | RedoStack::instance()->clear(); |
1023 | 1023 | ||
1024 | // now if we deleted anything, refresh | 1024 | // now if we deleted anything, refresh |
1025 | setContactSelected( QString::null ); | 1025 | setContactSelected( QString::null ); |
1026 | setModified( true ); | 1026 | setModified( true ); |
1027 | } | 1027 | } |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | void KABCore::copyContacts() | 1030 | void KABCore::copyContacts() |
1031 | { | 1031 | { |
1032 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1032 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1033 | 1033 | ||
1034 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 1034 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
1035 | 1035 | ||
1036 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 1036 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
1037 | 1037 | ||
1038 | QClipboard *cb = QApplication::clipboard(); | 1038 | QClipboard *cb = QApplication::clipboard(); |
1039 | cb->setText( clipText ); | 1039 | cb->setText( clipText ); |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | void KABCore::cutContacts() | 1042 | void KABCore::cutContacts() |
1043 | { | 1043 | { |
1044 | QStringList uidList = mViewManager->selectedUids(); | 1044 | QStringList uidList = mViewManager->selectedUids(); |
1045 | 1045 | ||
1046 | //US if ( uidList.size() > 0 ) { | 1046 | //US if ( uidList.size() > 0 ) { |
1047 | if ( uidList.count() > 0 ) { | 1047 | if ( uidList.count() > 0 ) { |
1048 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 1048 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
1049 | UndoStack::instance()->push( command ); | 1049 | UndoStack::instance()->push( command ); |
1050 | RedoStack::instance()->clear(); | 1050 | RedoStack::instance()->clear(); |
1051 | 1051 | ||
1052 | setModified( true ); | 1052 | setModified( true ); |
1053 | } | 1053 | } |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | void KABCore::pasteContacts() | 1056 | void KABCore::pasteContacts() |
1057 | { | 1057 | { |
1058 | QClipboard *cb = QApplication::clipboard(); | 1058 | QClipboard *cb = QApplication::clipboard(); |
1059 | 1059 | ||
1060 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1060 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
1061 | 1061 | ||
1062 | pasteContacts( list ); | 1062 | pasteContacts( list ); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1065 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
1066 | { | 1066 | { |
1067 | KABC::Resource *resource = requestResource( this ); | 1067 | KABC::Resource *resource = requestResource( this ); |
1068 | KABC::Addressee::List::Iterator it; | 1068 | KABC::Addressee::List::Iterator it; |
1069 | for ( it = list.begin(); it != list.end(); ++it ) | 1069 | for ( it = list.begin(); it != list.end(); ++it ) |
1070 | (*it).setResource( resource ); | 1070 | (*it).setResource( resource ); |
1071 | 1071 | ||
1072 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1072 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
1073 | UndoStack::instance()->push( command ); | 1073 | UndoStack::instance()->push( command ); |
1074 | RedoStack::instance()->clear(); | 1074 | RedoStack::instance()->clear(); |
1075 | 1075 | ||
1076 | setModified( true ); | 1076 | setModified( true ); |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | void KABCore::setWhoAmI() | 1079 | void KABCore::setWhoAmI() |
1080 | { | 1080 | { |
1081 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1081 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1082 | 1082 | ||
1083 | if ( addrList.count() > 1 ) { | 1083 | if ( addrList.count() > 1 ) { |
1084 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1084 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1085 | return; | 1085 | return; |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1088 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1089 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1089 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1090 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1090 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1091 | } | 1091 | } |
1092 | void KABCore::editCategories() | 1092 | void KABCore::editCategories() |
1093 | { | 1093 | { |
1094 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1094 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1095 | dlg.exec(); | 1095 | dlg.exec(); |
1096 | } | 1096 | } |
1097 | void KABCore::setCategories() | 1097 | void KABCore::setCategories() |
1098 | { | 1098 | { |
1099 | 1099 | ||
1100 | QStringList uids; | 1100 | QStringList uids; |
1101 | XXPortSelectDialog dlgx( this, false, this ); | 1101 | XXPortSelectDialog dlgx( this, false, this ); |
1102 | if ( dlgx.exec() ) | 1102 | if ( dlgx.exec() ) |
1103 | uids = dlgx.uids(); | 1103 | uids = dlgx.uids(); |
1104 | else | 1104 | else |
1105 | return; | 1105 | return; |
1106 | if ( uids.isEmpty() ) | 1106 | if ( uids.isEmpty() ) |
1107 | return; | 1107 | return; |
1108 | // qDebug("count %d ", uids.count()); | 1108 | // qDebug("count %d ", uids.count()); |
1109 | 1109 | ||
1110 | 1110 | ||
1111 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1111 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1112 | if ( !dlg.exec() ) { | 1112 | if ( !dlg.exec() ) { |
1113 | message( i18n("Setting categories cancelled") ); | 1113 | message( i18n("Setting categories cancelled") ); |
1114 | return; | 1114 | return; |
1115 | } | 1115 | } |
1116 | bool merge = false; | 1116 | bool merge = false; |
1117 | QString msg = i18n( "Merge with existing categories?" ); | 1117 | QString msg = i18n( "Merge with existing categories?" ); |
1118 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1118 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1119 | merge = true; | 1119 | merge = true; |
1120 | 1120 | ||
1121 | message( i18n("Setting categories ... please wait!") ); | 1121 | message( i18n("Setting categories ... please wait!") ); |
1122 | QStringList categories = dlg.selectedCategories(); | 1122 | QStringList categories = dlg.selectedCategories(); |
1123 | 1123 | ||
1124 | //QStringList uids = mViewManager->selectedUids(); | 1124 | //QStringList uids = mViewManager->selectedUids(); |
1125 | QStringList::Iterator it; | 1125 | QStringList::Iterator it; |
1126 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1126 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1127 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1127 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1128 | if ( !addr.isEmpty() ) { | 1128 | if ( !addr.isEmpty() ) { |
1129 | if ( !merge ) | 1129 | if ( !merge ) |
1130 | addr.setCategories( categories ); | 1130 | addr.setCategories( categories ); |
1131 | else { | 1131 | else { |
1132 | QStringList addrCategories = addr.categories(); | 1132 | QStringList addrCategories = addr.categories(); |
1133 | QStringList::Iterator catIt; | 1133 | QStringList::Iterator catIt; |
1134 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1134 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1135 | if ( !addrCategories.contains( *catIt ) ) | 1135 | if ( !addrCategories.contains( *catIt ) ) |
1136 | addrCategories.append( *catIt ); | 1136 | addrCategories.append( *catIt ); |
1137 | } | 1137 | } |
1138 | addr.setCategories( addrCategories ); | 1138 | addr.setCategories( addrCategories ); |
1139 | } | 1139 | } |
1140 | mAddressBook->insertAddressee( addr ); | 1140 | mAddressBook->insertAddressee( addr ); |
1141 | } | 1141 | } |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | if ( uids.count() > 0 ) | 1144 | if ( uids.count() > 0 ) |
1145 | setModified( true ); | 1145 | setModified( true ); |
1146 | message( i18n("Setting categories completed!") ); | 1146 | message( i18n("Setting categories completed!") ); |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1149 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1150 | { | 1150 | { |
1151 | mIncSearchWidget->setFields( fields ); | 1151 | mIncSearchWidget->setFields( fields ); |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | void KABCore::incrementalSearch( const QString& text ) | 1154 | void KABCore::incrementalSearch( const QString& text ) |
1155 | { | 1155 | { |
1156 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1156 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | void KABCore::setModified() | 1159 | void KABCore::setModified() |
1160 | { | 1160 | { |
1161 | setModified( true ); | 1161 | setModified( true ); |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | void KABCore::setModifiedWOrefresh() | 1164 | void KABCore::setModifiedWOrefresh() |
1165 | { | 1165 | { |
1166 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1166 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1167 | mModified = true; | 1167 | mModified = true; |
1168 | mActionSave->setEnabled( mModified ); | 1168 | mActionSave->setEnabled( mModified ); |
1169 | 1169 | ||
1170 | 1170 | ||
1171 | } | 1171 | } |
1172 | void KABCore::setModified( bool modified ) | 1172 | void KABCore::setModified( bool modified ) |
1173 | { | 1173 | { |
1174 | mModified = modified; | 1174 | mModified = modified; |
1175 | mActionSave->setEnabled( mModified ); | 1175 | mActionSave->setEnabled( mModified ); |
1176 | 1176 | ||
1177 | if ( modified ) | 1177 | if ( modified ) |
1178 | mJumpButtonBar->recreateButtons(); | 1178 | mJumpButtonBar->recreateButtons(); |
1179 | 1179 | ||
1180 | mViewManager->refreshView(); | 1180 | mViewManager->refreshView(); |
1181 | 1181 | ||
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | bool KABCore::modified() const | 1184 | bool KABCore::modified() const |
1185 | { | 1185 | { |
1186 | return mModified; | 1186 | return mModified; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1189 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1190 | { | 1190 | { |
1191 | addrModified( addr ); | 1191 | addrModified( addr ); |
1192 | #if 0 // debug only | 1192 | #if 0 // debug only |
1193 | KABC::Addressee ad = addr; | 1193 | KABC::Addressee ad = addr; |
1194 | ad.computeCsum( "123"); | 1194 | ad.computeCsum( "123"); |
1195 | #endif | 1195 | #endif |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | 1198 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) |
1199 | { | 1199 | { |
1200 | 1200 | ||
1201 | Command *command = 0; | 1201 | Command *command = 0; |
1202 | QString uid; | 1202 | QString uid; |
1203 | 1203 | ||
1204 | // check if it exists already | 1204 | // check if it exists already |
1205 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1205 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1206 | if ( origAddr.isEmpty() ) | 1206 | if ( origAddr.isEmpty() ) |
1207 | command = new PwNewCommand( mAddressBook, addr ); | 1207 | command = new PwNewCommand( mAddressBook, addr ); |
1208 | else { | 1208 | else { |
1209 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1209 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1210 | uid = addr.uid(); | 1210 | uid = addr.uid(); |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | UndoStack::instance()->push( command ); | 1213 | UndoStack::instance()->push( command ); |
1214 | RedoStack::instance()->clear(); | 1214 | RedoStack::instance()->clear(); |
1215 | if ( updateDetails ) | 1215 | if ( updateDetails ) |
1216 | mDetails->setAddressee( addr ); | 1216 | mDetails->setAddressee( addr ); |
1217 | setModified( true ); | 1217 | setModified( true ); |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | void KABCore::newContact() | 1220 | void KABCore::newContact() |
1221 | { | 1221 | { |
1222 | 1222 | ||
1223 | 1223 | ||
1224 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1224 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1225 | 1225 | ||
1226 | QPtrList<KRES::Resource> kresResources; | 1226 | QPtrList<KRES::Resource> kresResources; |
1227 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1227 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1228 | KABC::Resource *resource; | 1228 | KABC::Resource *resource; |
1229 | while ( ( resource = it.current() ) != 0 ) { | 1229 | while ( ( resource = it.current() ) != 0 ) { |
1230 | ++it; | 1230 | ++it; |
1231 | if ( !resource->readOnly() ) { | 1231 | if ( !resource->readOnly() ) { |
1232 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1232 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1233 | if ( res ) | 1233 | if ( res ) |
1234 | kresResources.append( res ); | 1234 | kresResources.append( res ); |
1235 | } | 1235 | } |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1238 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1239 | resource = static_cast<KABC::Resource*>( res ); | 1239 | resource = static_cast<KABC::Resource*>( res ); |
1240 | 1240 | ||
1241 | if ( resource ) { | 1241 | if ( resource ) { |
1242 | KABC::Addressee addr; | 1242 | KABC::Addressee addr; |
1243 | addr.setResource( resource ); | 1243 | addr.setResource( resource ); |
1244 | mEditorDialog->setAddressee( addr ); | 1244 | mEditorDialog->setAddressee( addr ); |
1245 | KApplication::execDialog ( mEditorDialog ); | 1245 | KApplication::execDialog ( mEditorDialog ); |
1246 | 1246 | ||
1247 | } else | 1247 | } else |
1248 | return; | 1248 | return; |
1249 | 1249 | ||
1250 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1250 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1251 | 1251 | ||
1252 | 1252 | ||
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | void KABCore::addEmail( QString aStr ) | 1255 | void KABCore::addEmail( QString aStr ) |
1256 | { | 1256 | { |
1257 | #ifndef KAB_EMBEDDED | 1257 | #ifndef KAB_EMBEDDED |
1258 | QString fullName, email; | 1258 | QString fullName, email; |
1259 | 1259 | ||
1260 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1260 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1261 | 1261 | ||
1262 | // Try to lookup the addressee matching the email address | 1262 | // Try to lookup the addressee matching the email address |
1263 | bool found = false; | 1263 | bool found = false; |
1264 | QStringList emailList; | 1264 | QStringList emailList; |
1265 | KABC::AddressBook::Iterator it; | 1265 | KABC::AddressBook::Iterator it; |
1266 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1266 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1267 | emailList = (*it).emails(); | 1267 | emailList = (*it).emails(); |
1268 | if ( emailList.contains( email ) > 0 ) { | 1268 | if ( emailList.contains( email ) > 0 ) { |
1269 | found = true; | 1269 | found = true; |
1270 | (*it).setNameFromString( fullName ); | 1270 | (*it).setNameFromString( fullName ); |
1271 | editContact( (*it).uid() ); | 1271 | editContact( (*it).uid() ); |
1272 | } | 1272 | } |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | if ( !found ) { | 1275 | if ( !found ) { |
1276 | KABC::Addressee addr; | 1276 | KABC::Addressee addr; |
1277 | addr.setNameFromString( fullName ); | 1277 | addr.setNameFromString( fullName ); |
1278 | addr.insertEmail( email, true ); | 1278 | addr.insertEmail( email, true ); |
1279 | 1279 | ||
1280 | mAddressBook->insertAddressee( addr ); | 1280 | mAddressBook->insertAddressee( addr ); |
1281 | mViewManager->refreshView( addr.uid() ); | 1281 | mViewManager->refreshView( addr.uid() ); |
1282 | editContact( addr.uid() ); | 1282 | editContact( addr.uid() ); |
1283 | } | 1283 | } |
1284 | #else //KAB_EMBEDDED | 1284 | #else //KAB_EMBEDDED |
1285 | qDebug("KABCore::addEmail finsih method"); | 1285 | qDebug("KABCore::addEmail finsih method"); |
1286 | #endif //KAB_EMBEDDED | 1286 | #endif //KAB_EMBEDDED |
1287 | } | 1287 | } |
1288 | 1288 | ||
1289 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1289 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1290 | { | 1290 | { |
1291 | mXXPortManager->importVCard( url, showPreview ); | 1291 | mXXPortManager->importVCard( url, showPreview ); |
1292 | } | 1292 | } |
1293 | void KABCore::importFromOL() | 1293 | void KABCore::importFromOL() |
1294 | { | 1294 | { |
1295 | #ifdef _OL_IMPORT_ | 1295 | #ifdef _OL_IMPORT_ |
1296 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1296 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1297 | idgl->exec(); | 1297 | idgl->exec(); |
1298 | KABC::Addressee::List list = idgl->getAddressList(); | 1298 | KABC::Addressee::List list = idgl->getAddressList(); |
1299 | if ( list.count() > 0 ) { | 1299 | if ( list.count() > 0 ) { |
1300 | KABC::Addressee::List listNew; | 1300 | KABC::Addressee::List listNew; |
1301 | KABC::Addressee::List listExisting; | 1301 | KABC::Addressee::List listExisting; |
1302 | KABC::Addressee::List::Iterator it; | 1302 | KABC::Addressee::List::Iterator it; |
1303 | KABC::AddressBook::Iterator iter; | 1303 | KABC::AddressBook::Iterator iter; |
1304 | for ( it = list.begin(); it != list.end(); ++it ) { | 1304 | for ( it = list.begin(); it != list.end(); ++it ) { |
1305 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1305 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1306 | listNew.append( (*it) ); | 1306 | listNew.append( (*it) ); |
1307 | else | 1307 | else |
1308 | listExisting.append( (*it) ); | 1308 | listExisting.append( (*it) ); |
1309 | } | 1309 | } |
1310 | if ( listExisting.count() > 0 ) | 1310 | if ( listExisting.count() > 0 ) |
1311 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1311 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1312 | if ( listNew.count() > 0 ) { | 1312 | if ( listNew.count() > 0 ) { |
1313 | pasteWithNewUid = false; | 1313 | pasteWithNewUid = false; |
1314 | pasteContacts( listNew ); | 1314 | pasteContacts( listNew ); |
1315 | pasteWithNewUid = true; | 1315 | pasteWithNewUid = true; |
1316 | } | 1316 | } |
1317 | } | 1317 | } |
1318 | delete idgl; | 1318 | delete idgl; |
1319 | #endif | 1319 | #endif |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1322 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1323 | { | 1323 | { |
1324 | mXXPortManager->importVCard( vCard, showPreview ); | 1324 | mXXPortManager->importVCard( vCard, showPreview ); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | //US added a second method without defaultparameter | 1327 | //US added a second method without defaultparameter |
1328 | void KABCore::editContact2() { | 1328 | void KABCore::editContact2() { |
1329 | editContact( QString::null ); | 1329 | editContact( QString::null ); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | void KABCore::editContact( const QString &uid ) | 1332 | void KABCore::editContact( const QString &uid ) |
1333 | { | 1333 | { |
1334 | 1334 | ||
1335 | if ( mExtensionManager->isQuickEditVisible() ) | 1335 | if ( mExtensionManager->isQuickEditVisible() ) |
1336 | return; | 1336 | return; |
1337 | 1337 | ||
1338 | // First, locate the contact entry | 1338 | // First, locate the contact entry |
1339 | QString localUID = uid; | 1339 | QString localUID = uid; |
1340 | if ( localUID.isNull() ) { | 1340 | if ( localUID.isNull() ) { |
1341 | QStringList uidList = mViewManager->selectedUids(); | 1341 | QStringList uidList = mViewManager->selectedUids(); |
1342 | if ( uidList.count() > 0 ) | 1342 | if ( uidList.count() > 0 ) |
1343 | localUID = *( uidList.at( 0 ) ); | 1343 | localUID = *( uidList.at( 0 ) ); |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1346 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1347 | if ( !addr.isEmpty() ) { | 1347 | if ( !addr.isEmpty() ) { |
1348 | mEditorDialog->setAddressee( addr ); | 1348 | mEditorDialog->setAddressee( addr ); |
1349 | KApplication::execDialog ( mEditorDialog ); | 1349 | KApplication::execDialog ( mEditorDialog ); |
1350 | } | 1350 | } |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | /** | 1353 | /** |
1354 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1354 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1355 | the method will try to find a selected addressee in the view. | 1355 | the method will try to find a selected addressee in the view. |
1356 | */ | 1356 | */ |
1357 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1357 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1358 | { | 1358 | { |
1359 | if ( mMultipleViewsAtOnce ) | 1359 | if ( mMultipleViewsAtOnce ) |
1360 | { | 1360 | { |
1361 | editContact( uid ); | 1361 | editContact( uid ); |
1362 | } | 1362 | } |
1363 | else | 1363 | else |
1364 | { | 1364 | { |
1365 | setDetailsVisible( true ); | 1365 | setDetailsVisible( true ); |
1366 | mActionDetails->setChecked(true); | 1366 | mActionDetails->setChecked(true); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | void KABCore::save() | 1371 | void KABCore::save() |
1372 | { | 1372 | { |
1373 | if (syncManager->blockSave()) | 1373 | if (syncManager->blockSave()) |
1374 | return; | 1374 | return; |
1375 | if ( !mModified ) | 1375 | if ( !mModified ) |
1376 | return; | 1376 | return; |
1377 | 1377 | ||
1378 | syncManager->setBlockSave(true); | 1378 | syncManager->setBlockSave(true); |
1379 | QString text = i18n( "There was an error while attempting to save\n the " | 1379 | QString text = i18n( "There was an error while attempting to save\n the " |
1380 | "address book. Please check that some \nother application is " | 1380 | "address book. Please check that some \nother application is " |
1381 | "not using it. " ); | 1381 | "not using it. " ); |
1382 | message(i18n("Saving ... please wait! "), false); | 1382 | message(i18n("Saving ... please wait! "), false); |
1383 | //qApp->processEvents(); | 1383 | //qApp->processEvents(); |
1384 | #ifndef KAB_EMBEDDED | 1384 | #ifndef KAB_EMBEDDED |
1385 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1385 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1386 | if ( !b || !b->save() ) { | 1386 | if ( !b || !b->save() ) { |
1387 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1387 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1388 | } | 1388 | } |
1389 | #else //KAB_EMBEDDED | 1389 | #else //KAB_EMBEDDED |
1390 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1390 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1391 | if ( !b || !b->save() ) { | 1391 | if ( !b || !b->save() ) { |
1392 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1392 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1393 | } | 1393 | } |
1394 | #endif //KAB_EMBEDDED | 1394 | #endif //KAB_EMBEDDED |
1395 | 1395 | ||
1396 | message(i18n("Addressbook saved!")); | 1396 | message(i18n("Addressbook saved!")); |
1397 | setModified( false ); | 1397 | setModified( false ); |
1398 | syncManager->setBlockSave(false); | 1398 | syncManager->setBlockSave(false); |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | 1401 | ||
1402 | void KABCore::undo() | 1402 | void KABCore::undo() |
1403 | { | 1403 | { |
1404 | UndoStack::instance()->undo(); | 1404 | UndoStack::instance()->undo(); |
1405 | 1405 | ||
1406 | // Refresh the view | 1406 | // Refresh the view |
1407 | mViewManager->refreshView(); | 1407 | mViewManager->refreshView(); |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | void KABCore::redo() | 1410 | void KABCore::redo() |
1411 | { | 1411 | { |
1412 | RedoStack::instance()->redo(); | 1412 | RedoStack::instance()->redo(); |
1413 | 1413 | ||
1414 | // Refresh the view | 1414 | // Refresh the view |
1415 | mViewManager->refreshView(); | 1415 | mViewManager->refreshView(); |
1416 | } | 1416 | } |
1417 | void KABCore::setJumpButtonBar( bool visible ) | 1417 | void KABCore::setJumpButtonBar( bool visible ) |
1418 | { | 1418 | { |
1419 | setJumpButtonBarVisible(visible ); | 1419 | setJumpButtonBarVisible(visible ); |
1420 | saveSettings(); | 1420 | saveSettings(); |
1421 | } | 1421 | } |
1422 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1422 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1423 | { | 1423 | { |
1424 | if (mMultipleViewsAtOnce) | 1424 | if (mMultipleViewsAtOnce) |
1425 | { | 1425 | { |
1426 | if ( visible ) | 1426 | if ( visible ) |
1427 | mJumpButtonBar->show(); | 1427 | mJumpButtonBar->show(); |
1428 | else | 1428 | else |
1429 | mJumpButtonBar->hide(); | 1429 | mJumpButtonBar->hide(); |
1430 | } | 1430 | } |
1431 | else | 1431 | else |
1432 | { | 1432 | { |
1433 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1433 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1434 | if (mViewManager->isVisible()) | 1434 | if (mViewManager->isVisible()) |
1435 | { | 1435 | { |
1436 | if ( visible ) | 1436 | if ( visible ) |
1437 | mJumpButtonBar->show(); | 1437 | mJumpButtonBar->show(); |
1438 | else | 1438 | else |
1439 | mJumpButtonBar->hide(); | 1439 | mJumpButtonBar->hide(); |
1440 | } | 1440 | } |
1441 | else | 1441 | else |
1442 | { | 1442 | { |
1443 | mJumpButtonBar->hide(); | 1443 | mJumpButtonBar->hide(); |
1444 | } | 1444 | } |
1445 | } | 1445 | } |
1446 | } | 1446 | } |
1447 | 1447 | ||
1448 | 1448 | ||
1449 | void KABCore::setDetailsToState() | 1449 | void KABCore::setDetailsToState() |
1450 | { | 1450 | { |
1451 | setDetailsVisible( mActionDetails->isChecked() ); | 1451 | setDetailsVisible( mActionDetails->isChecked() ); |
1452 | } | 1452 | } |
1453 | void KABCore::setDetailsToggle() | 1453 | void KABCore::setDetailsToggle() |
1454 | { | 1454 | { |
1455 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1455 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1456 | setDetailsToState(); | 1456 | setDetailsToState(); |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | 1459 | ||
1460 | 1460 | ||
1461 | void KABCore::setDetailsVisible( bool visible ) | 1461 | void KABCore::setDetailsVisible( bool visible ) |
1462 | { | 1462 | { |
1463 | if (visible && mDetails->isHidden()) | 1463 | if (visible && mDetails->isHidden()) |
1464 | { | 1464 | { |
1465 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1465 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1466 | if ( addrList.count() > 0 ) | 1466 | if ( addrList.count() > 0 ) |
1467 | mDetails->setAddressee( addrList[ 0 ] ); | 1467 | mDetails->setAddressee( addrList[ 0 ] ); |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1470 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1471 | // the listview and the detailview. We do that by changing the splitbar size. | 1471 | // the listview and the detailview. We do that by changing the splitbar size. |
1472 | if (mMultipleViewsAtOnce) | 1472 | if (mMultipleViewsAtOnce) |
1473 | { | 1473 | { |
1474 | if ( visible ) | 1474 | if ( visible ) |
1475 | mDetails->show(); | 1475 | mDetails->show(); |
1476 | else | 1476 | else |
1477 | mDetails->hide(); | 1477 | mDetails->hide(); |
1478 | } | 1478 | } |
1479 | else | 1479 | else |
1480 | { | 1480 | { |
1481 | if ( visible ) { | 1481 | if ( visible ) { |
1482 | mViewManager->hide(); | 1482 | mViewManager->hide(); |
1483 | mDetails->show(); | 1483 | mDetails->show(); |
1484 | mIncSearchWidget->setFocus(); | 1484 | mIncSearchWidget->setFocus(); |
1485 | } | 1485 | } |
1486 | else { | 1486 | else { |
1487 | mViewManager->show(); | 1487 | mViewManager->show(); |
1488 | mDetails->hide(); | 1488 | mDetails->hide(); |
1489 | mViewManager->setFocusAV(); | 1489 | mViewManager->setFocusAV(); |
1490 | } | 1490 | } |
1491 | setJumpButtonBarVisible( !visible ); | 1491 | setJumpButtonBarVisible( !visible ); |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | void KABCore::extensionChanged( int id ) | 1496 | void KABCore::extensionChanged( int id ) |
1497 | { | 1497 | { |
1498 | //change the details view only for non desktop systems | 1498 | //change the details view only for non desktop systems |
1499 | #ifndef DESKTOP_VERSION | 1499 | #ifndef DESKTOP_VERSION |
1500 | 1500 | ||
1501 | if (id == 0) | 1501 | if (id == 0) |
1502 | { | 1502 | { |
1503 | //the user disabled the extension. | 1503 | //the user disabled the extension. |
1504 | 1504 | ||
1505 | if (mMultipleViewsAtOnce) | 1505 | if (mMultipleViewsAtOnce) |
1506 | { // enable detailsview again | 1506 | { // enable detailsview again |
1507 | setDetailsVisible( true ); | 1507 | setDetailsVisible( true ); |
1508 | mActionDetails->setChecked( true ); | 1508 | mActionDetails->setChecked( true ); |
1509 | } | 1509 | } |
1510 | else | 1510 | else |
1511 | { //go back to the listview | 1511 | { //go back to the listview |
1512 | setDetailsVisible( false ); | 1512 | setDetailsVisible( false ); |
1513 | mActionDetails->setChecked( false ); | 1513 | mActionDetails->setChecked( false ); |
1514 | mActionDetails->setEnabled(true); | 1514 | mActionDetails->setEnabled(true); |
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | } | 1517 | } |
1518 | else | 1518 | else |
1519 | { | 1519 | { |
1520 | //the user enabled the extension. | 1520 | //the user enabled the extension. |
1521 | setDetailsVisible( false ); | 1521 | setDetailsVisible( false ); |
1522 | mActionDetails->setChecked( false ); | 1522 | mActionDetails->setChecked( false ); |
1523 | 1523 | ||
1524 | if (!mMultipleViewsAtOnce) | 1524 | if (!mMultipleViewsAtOnce) |
1525 | { | 1525 | { |
1526 | mActionDetails->setEnabled(false); | 1526 | mActionDetails->setEnabled(false); |
1527 | } | 1527 | } |
1528 | 1528 | ||
1529 | mExtensionManager->setSelectionChanged(); | 1529 | mExtensionManager->setSelectionChanged(); |
1530 | 1530 | ||
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | #endif// DESKTOP_VERSION | 1533 | #endif// DESKTOP_VERSION |
1534 | 1534 | ||
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | 1537 | ||
1538 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1538 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1539 | { | 1539 | { |
1540 | 1540 | ||
1541 | if ( list.count() != 0 ) { | 1541 | if ( list.count() != 0 ) { |
1542 | KABC::Addressee::List::ConstIterator it; | 1542 | KABC::Addressee::List::ConstIterator it; |
1543 | for ( it = list.begin(); it != list.end(); ++it ) | 1543 | for ( it = list.begin(); it != list.end(); ++it ) |
1544 | mAddressBook->insertAddressee( *it ); | 1544 | mAddressBook->insertAddressee( *it ); |
1545 | if ( list.count() > 1 ) | 1545 | if ( list.count() > 1 ) |
1546 | setModified(); | 1546 | setModified(); |
1547 | else | 1547 | else |
1548 | setModifiedWOrefresh(); | 1548 | setModifiedWOrefresh(); |
1549 | } | 1549 | } |
1550 | if ( list.count() == 0 ) | 1550 | if ( list.count() == 0 ) |
1551 | mViewManager->refreshView(); | 1551 | mViewManager->refreshView(); |
1552 | else | 1552 | else |
1553 | mViewManager->refreshView( list[ 0 ].uid() ); | 1553 | mViewManager->refreshView( list[ 0 ].uid() ); |
1554 | 1554 | ||
1555 | 1555 | ||
1556 | 1556 | ||
1557 | } | 1557 | } |
1558 | 1558 | ||
1559 | QString KABCore::getNameByPhone( const QString &phone ) | 1559 | QString KABCore::getNameByPhone( const QString &phone ) |
1560 | { | 1560 | { |
1561 | #ifndef KAB_EMBEDDED | 1561 | #ifndef KAB_EMBEDDED |
1562 | QRegExp r( "[/*/-/ ]" ); | 1562 | QRegExp r( "[/*/-/ ]" ); |
1563 | QString localPhone( phone ); | 1563 | QString localPhone( phone ); |
1564 | 1564 | ||
1565 | bool found = false; | 1565 | bool found = false; |
1566 | QString ownerName = ""; | 1566 | QString ownerName = ""; |
1567 | KABC::AddressBook::Iterator iter; | 1567 | KABC::AddressBook::Iterator iter; |
1568 | KABC::PhoneNumber::List::Iterator phoneIter; | 1568 | KABC::PhoneNumber::List::Iterator phoneIter; |
1569 | KABC::PhoneNumber::List phoneList; | 1569 | KABC::PhoneNumber::List phoneList; |
1570 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1570 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1571 | phoneList = (*iter).phoneNumbers(); | 1571 | phoneList = (*iter).phoneNumbers(); |
1572 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1572 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1573 | ++phoneIter) { | 1573 | ++phoneIter) { |
1574 | // Get rid of separator chars so just the numbers are compared. | 1574 | // Get rid of separator chars so just the numbers are compared. |
1575 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1575 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1576 | ownerName = (*iter).formattedName(); | 1576 | ownerName = (*iter).formattedName(); |
1577 | found = true; | 1577 | found = true; |
1578 | } | 1578 | } |
1579 | } | 1579 | } |
1580 | } | 1580 | } |
1581 | 1581 | ||
1582 | return ownerName; | 1582 | return ownerName; |
1583 | #else //KAB_EMBEDDED | 1583 | #else //KAB_EMBEDDED |
1584 | qDebug("KABCore::getNameByPhone finsih method"); | 1584 | qDebug("KABCore::getNameByPhone finsih method"); |
1585 | return ""; | 1585 | return ""; |
1586 | #endif //KAB_EMBEDDED | 1586 | #endif //KAB_EMBEDDED |
1587 | 1587 | ||
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | void KABCore::openConfigDialog() | 1590 | void KABCore::openConfigDialog() |
1591 | { | 1591 | { |
1592 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1592 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1593 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1593 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1594 | ConfigureDialog->addModule(kabcfg ); | 1594 | ConfigureDialog->addModule(kabcfg ); |
1595 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1595 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1596 | ConfigureDialog->addModule(kdelibcfg ); | 1596 | ConfigureDialog->addModule(kdelibcfg ); |
1597 | 1597 | ||
1598 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1598 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1599 | this, SLOT( configurationChanged() ) ); | 1599 | this, SLOT( configurationChanged() ) ); |
1600 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1600 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1601 | this, SLOT( configurationChanged() ) ); | 1601 | this, SLOT( configurationChanged() ) ); |
1602 | saveSettings(); | 1602 | saveSettings(); |
1603 | #ifndef DESKTOP_VERSION | 1603 | #ifndef DESKTOP_VERSION |
1604 | ConfigureDialog->showMaximized(); | 1604 | ConfigureDialog->showMaximized(); |
1605 | #endif | 1605 | #endif |
1606 | if ( ConfigureDialog->exec() ) | 1606 | if ( ConfigureDialog->exec() ) |
1607 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1607 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1608 | delete ConfigureDialog; | 1608 | delete ConfigureDialog; |
1609 | } | 1609 | } |
1610 | 1610 | ||
1611 | void KABCore::openLDAPDialog() | 1611 | void KABCore::openLDAPDialog() |
1612 | { | 1612 | { |
1613 | #ifndef KAB_EMBEDDED | 1613 | #ifndef KAB_EMBEDDED |
1614 | if ( !mLdapSearchDialog ) { | 1614 | if ( !mLdapSearchDialog ) { |
1615 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1615 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1616 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1616 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1617 | SLOT( refreshView() ) ); | 1617 | SLOT( refreshView() ) ); |
1618 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1618 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1619 | SLOT( setModified() ) ); | 1619 | SLOT( setModified() ) ); |
1620 | } else | 1620 | } else |
1621 | mLdapSearchDialog->restoreSettings(); | 1621 | mLdapSearchDialog->restoreSettings(); |
1622 | 1622 | ||
1623 | if ( mLdapSearchDialog->isOK() ) | 1623 | if ( mLdapSearchDialog->isOK() ) |
1624 | mLdapSearchDialog->exec(); | 1624 | mLdapSearchDialog->exec(); |
1625 | #else //KAB_EMBEDDED | 1625 | #else //KAB_EMBEDDED |
1626 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1626 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1627 | #endif //KAB_EMBEDDED | 1627 | #endif //KAB_EMBEDDED |
1628 | } | 1628 | } |
1629 | 1629 | ||
1630 | void KABCore::print() | 1630 | void KABCore::print() |
1631 | { | 1631 | { |
1632 | #ifndef KAB_EMBEDDED | 1632 | #ifndef KAB_EMBEDDED |
1633 | KPrinter printer; | 1633 | KPrinter printer; |
1634 | if ( !printer.setup( this ) ) | 1634 | if ( !printer.setup( this ) ) |
1635 | return; | 1635 | return; |
1636 | 1636 | ||
1637 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1637 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1638 | mViewManager->selectedUids(), this ); | 1638 | mViewManager->selectedUids(), this ); |
1639 | 1639 | ||
1640 | wizard.exec(); | 1640 | wizard.exec(); |
1641 | #else //KAB_EMBEDDED | 1641 | #else //KAB_EMBEDDED |
1642 | qDebug("KABCore::print() finsih method"); | 1642 | qDebug("KABCore::print() finsih method"); |
1643 | #endif //KAB_EMBEDDED | 1643 | #endif //KAB_EMBEDDED |
1644 | 1644 | ||
1645 | } | 1645 | } |
1646 | 1646 | ||
1647 | 1647 | ||
1648 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1648 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1649 | { | 1649 | { |
1650 | if ( mGUIClient ) | 1650 | if ( mGUIClient ) |
1651 | mGUIClient->insertChildClient( client ); | 1651 | mGUIClient->insertChildClient( client ); |
1652 | else | 1652 | else |
1653 | KMessageBox::error( this, "no KXMLGUICLient"); | 1653 | KMessageBox::error( this, "no KXMLGUICLient"); |
1654 | } | 1654 | } |
1655 | 1655 | ||
1656 | 1656 | ||
1657 | void KABCore::configurationChanged() | 1657 | void KABCore::configurationChanged() |
1658 | { | 1658 | { |
1659 | mExtensionManager->reconfigure(); | 1659 | mExtensionManager->reconfigure(); |
1660 | } | 1660 | } |
1661 | 1661 | ||
1662 | void KABCore::addressBookChanged() | 1662 | void KABCore::addressBookChanged() |
1663 | { | 1663 | { |
1664 | /*US | 1664 | /*US |
1665 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1665 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1666 | while ( it.current() ) { | 1666 | while ( it.current() ) { |
1667 | if ( it.current()->dirty() ) { | 1667 | if ( it.current()->dirty() ) { |
1668 | QString text = i18n( "Data has been changed externally. Unsaved " | 1668 | QString text = i18n( "Data has been changed externally. Unsaved " |
1669 | "changes will be lost." ); | 1669 | "changes will be lost." ); |
1670 | KMessageBox::information( this, text ); | 1670 | KMessageBox::information( this, text ); |
1671 | } | 1671 | } |
1672 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1672 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1673 | ++it; | 1673 | ++it; |
1674 | } | 1674 | } |
1675 | */ | 1675 | */ |
1676 | if (mEditorDialog) | 1676 | if (mEditorDialog) |
1677 | { | 1677 | { |
1678 | if (mEditorDialog->dirty()) | 1678 | if (mEditorDialog->dirty()) |
1679 | { | 1679 | { |
1680 | QString text = i18n( "Data has been changed externally. Unsaved " | 1680 | QString text = i18n( "Data has been changed externally. Unsaved " |
1681 | "changes will be lost." ); | 1681 | "changes will be lost." ); |
1682 | KMessageBox::information( this, text ); | 1682 | KMessageBox::information( this, text ); |
1683 | } | 1683 | } |
1684 | QString currentuid = mEditorDialog->addressee().uid(); | 1684 | QString currentuid = mEditorDialog->addressee().uid(); |
1685 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1685 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1686 | } | 1686 | } |
1687 | mViewManager->refreshView(); | 1687 | mViewManager->refreshView(); |
1688 | 1688 | ||
1689 | 1689 | ||
1690 | } | 1690 | } |
1691 | 1691 | ||
1692 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1692 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1693 | const char *name ) | 1693 | const char *name ) |
1694 | { | 1694 | { |
1695 | 1695 | ||
1696 | if ( mEditorDialog == 0 ) { | 1696 | if ( mEditorDialog == 0 ) { |
1697 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1697 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1698 | name ? name : "editorDialog" ); | 1698 | name ? name : "editorDialog" ); |
1699 | 1699 | ||
1700 | 1700 | ||
1701 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1701 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1702 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1702 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1703 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1703 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1704 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1704 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | return mEditorDialog; | 1707 | return mEditorDialog; |
1708 | } | 1708 | } |
1709 | 1709 | ||
1710 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1710 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1711 | { | 1711 | { |
1712 | //mEditorDict.remove( uid ); | 1712 | //mEditorDict.remove( uid ); |
1713 | } | 1713 | } |
1714 | 1714 | ||
1715 | void KABCore::initGUI() | 1715 | void KABCore::initGUI() |
1716 | { | 1716 | { |
1717 | #ifndef KAB_EMBEDDED | 1717 | #ifndef KAB_EMBEDDED |
1718 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1718 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1719 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1719 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1720 | 1720 | ||
1721 | mExtensionBarSplitter = new QSplitter( this ); | 1721 | mExtensionBarSplitter = new QSplitter( this ); |
1722 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1722 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1723 | 1723 | ||
1724 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1724 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1725 | 1725 | ||
1726 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1726 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1727 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1727 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1728 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1728 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1729 | SLOT( incrementalSearch( const QString& ) ) ); | 1729 | SLOT( incrementalSearch( const QString& ) ) ); |
1730 | 1730 | ||
1731 | mViewManager = new ViewManager( this, viewSpace ); | 1731 | mViewManager = new ViewManager( this, viewSpace ); |
1732 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1732 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1733 | 1733 | ||
1734 | mDetails = new ViewContainer( mDetailsSplitter ); | 1734 | mDetails = new ViewContainer( mDetailsSplitter ); |
1735 | 1735 | ||
1736 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1736 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1737 | 1737 | ||
1738 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1738 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1739 | 1739 | ||
1740 | topLayout->addWidget( mExtensionBarSplitter ); | 1740 | topLayout->addWidget( mExtensionBarSplitter ); |
1741 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1741 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1742 | topLayout->addWidget( mJumpButtonBar ); | 1742 | topLayout->addWidget( mJumpButtonBar ); |
1743 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1743 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1744 | 1744 | ||
1745 | mXXPortManager = new XXPortManager( this, this ); | 1745 | mXXPortManager = new XXPortManager( this, this ); |
1746 | 1746 | ||
1747 | #else //KAB_EMBEDDED | 1747 | #else //KAB_EMBEDDED |
1748 | //US initialize viewMenu before settingup viewmanager. | 1748 | //US initialize viewMenu before settingup viewmanager. |
1749 | // Viewmanager needs this menu to plugin submenues. | 1749 | // Viewmanager needs this menu to plugin submenues. |
1750 | viewMenu = new QPopupMenu( this ); | 1750 | viewMenu = new QPopupMenu( this ); |
1751 | settingsMenu = new QPopupMenu( this ); | 1751 | settingsMenu = new QPopupMenu( this ); |
1752 | //filterMenu = new QPopupMenu( this ); | 1752 | //filterMenu = new QPopupMenu( this ); |
1753 | ImportMenu = new QPopupMenu( this ); | 1753 | ImportMenu = new QPopupMenu( this ); |
1754 | ExportMenu = new QPopupMenu( this ); | 1754 | ExportMenu = new QPopupMenu( this ); |
1755 | syncMenu = new QPopupMenu( this ); | 1755 | syncMenu = new QPopupMenu( this ); |
1756 | changeMenu= new QPopupMenu( this ); | 1756 | changeMenu= new QPopupMenu( this ); |
1757 | beamMenu= new QPopupMenu( this ); | 1757 | beamMenu= new QPopupMenu( this ); |
1758 | 1758 | ||
1759 | //US since we have no splitter for the embedded system, setup | 1759 | //US since we have no splitter for the embedded system, setup |
1760 | // a layout with two frames. One left and one right. | 1760 | // a layout with two frames. One left and one right. |
1761 | 1761 | ||
1762 | QBoxLayout *topLayout; | 1762 | QBoxLayout *topLayout; |
1763 | 1763 | ||
1764 | // = new QHBoxLayout( this ); | 1764 | // = new QHBoxLayout( this ); |
1765 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1765 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1766 | 1766 | ||
1767 | // QWidget *mainBox = new QWidget( this ); | 1767 | // QWidget *mainBox = new QWidget( this ); |
1768 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1768 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1769 | 1769 | ||
1770 | #ifdef DESKTOP_VERSION | 1770 | #ifdef DESKTOP_VERSION |
1771 | topLayout = new QHBoxLayout( this ); | 1771 | topLayout = new QHBoxLayout( this ); |
1772 | 1772 | ||
1773 | 1773 | ||
1774 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1774 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1775 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1775 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1776 | 1776 | ||
1777 | topLayout->addWidget(mMiniSplitter ); | 1777 | topLayout->addWidget(mMiniSplitter ); |
1778 | 1778 | ||
1779 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1779 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1780 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1780 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1781 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1781 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1782 | mDetails = new ViewContainer( mMiniSplitter ); | 1782 | mDetails = new ViewContainer( mMiniSplitter ); |
1783 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1783 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1784 | #else | 1784 | #else |
1785 | if ( QApplication::desktop()->width() > 480 ) { | 1785 | if ( QApplication::desktop()->width() > 480 ) { |
1786 | topLayout = new QHBoxLayout( this ); | 1786 | topLayout = new QHBoxLayout( this ); |
1787 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1787 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1788 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1788 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1789 | } else { | 1789 | } else { |
1790 | 1790 | ||
1791 | topLayout = new QHBoxLayout( this ); | 1791 | topLayout = new QHBoxLayout( this ); |
1792 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1792 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1793 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1793 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | topLayout->addWidget(mMiniSplitter ); | 1796 | topLayout->addWidget(mMiniSplitter ); |
1797 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1797 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1798 | mDetails = new ViewContainer( mMiniSplitter ); | 1798 | mDetails = new ViewContainer( mMiniSplitter ); |
1799 | 1799 | ||
1800 | 1800 | ||
1801 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1801 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1802 | #endif | 1802 | #endif |
1803 | //eh->hide(); | 1803 | //eh->hide(); |
1804 | // topLayout->addWidget(mExtensionManager ); | 1804 | // topLayout->addWidget(mExtensionManager ); |
1805 | 1805 | ||
1806 | 1806 | ||
1807 | /*US | 1807 | /*US |
1808 | #ifndef KAB_NOSPLITTER | 1808 | #ifndef KAB_NOSPLITTER |
1809 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1809 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1810 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1810 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1811 | topLayout->setSpacing( 10 ); | 1811 | topLayout->setSpacing( 10 ); |
1812 | 1812 | ||
1813 | mDetailsSplitter = new QSplitter( this ); | 1813 | mDetailsSplitter = new QSplitter( this ); |
1814 | 1814 | ||
1815 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1815 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1816 | 1816 | ||
1817 | mViewManager = new ViewManager( this, viewSpace ); | 1817 | mViewManager = new ViewManager( this, viewSpace ); |
1818 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1818 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1819 | 1819 | ||
1820 | mDetails = new ViewContainer( mDetailsSplitter ); | 1820 | mDetails = new ViewContainer( mDetailsSplitter ); |
1821 | 1821 | ||
1822 | topLayout->addWidget( mDetailsSplitter ); | 1822 | topLayout->addWidget( mDetailsSplitter ); |
1823 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1823 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1824 | #else //KAB_NOSPLITTER | 1824 | #else //KAB_NOSPLITTER |
1825 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1825 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1826 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1826 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1827 | topLayout->setSpacing( 10 ); | 1827 | topLayout->setSpacing( 10 ); |
1828 | 1828 | ||
1829 | // mDetailsSplitter = new QSplitter( this ); | 1829 | // mDetailsSplitter = new QSplitter( this ); |
1830 | 1830 | ||
1831 | QVBox *viewSpace = new QVBox( this ); | 1831 | QVBox *viewSpace = new QVBox( this ); |
1832 | 1832 | ||
1833 | mViewManager = new ViewManager( this, viewSpace ); | 1833 | mViewManager = new ViewManager( this, viewSpace ); |
1834 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1834 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1835 | 1835 | ||
1836 | mDetails = new ViewContainer( this ); | 1836 | mDetails = new ViewContainer( this ); |
1837 | 1837 | ||
1838 | topLayout->addWidget( viewSpace ); | 1838 | topLayout->addWidget( viewSpace ); |
1839 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1839 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1840 | topLayout->addWidget( mDetails ); | 1840 | topLayout->addWidget( mDetails ); |
1841 | #endif //KAB_NOSPLITTER | 1841 | #endif //KAB_NOSPLITTER |
1842 | */ | 1842 | */ |
1843 | 1843 | ||
1844 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1844 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1845 | syncManager->setBlockSave(false); | 1845 | syncManager->setBlockSave(false); |
1846 | 1846 | ||
1847 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1847 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1848 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1848 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1849 | QString sync_file = sentSyncFile(); | 1849 | QString sync_file = sentSyncFile(); |
1850 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1850 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1851 | syncManager->setDefaultFileName( sync_file ); | 1851 | syncManager->setDefaultFileName( sync_file ); |
1852 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1852 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1853 | 1853 | ||
1854 | #endif //KAB_EMBEDDED | 1854 | #endif //KAB_EMBEDDED |
1855 | initActions(); | 1855 | initActions(); |
1856 | 1856 | ||
1857 | #ifdef KAB_EMBEDDED | 1857 | #ifdef KAB_EMBEDDED |
1858 | addActionsManually(); | 1858 | addActionsManually(); |
1859 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1859 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1860 | mXXPortManager = new XXPortManager( this, this ); | 1860 | mXXPortManager = new XXPortManager( this, this ); |
1861 | 1861 | ||
1862 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1862 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1863 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1863 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1864 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1864 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1865 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1865 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1866 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1866 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1867 | // mIncSearchWidget->hide(); | 1867 | // mIncSearchWidget->hide(); |
1868 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1868 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1869 | SLOT( incrementalSearch( const QString& ) ) ); | 1869 | SLOT( incrementalSearch( const QString& ) ) ); |
1870 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1870 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1871 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1871 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1872 | 1872 | ||
1873 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1873 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1874 | 1874 | ||
1875 | topLayout->addWidget( mJumpButtonBar ); | 1875 | topLayout->addWidget( mJumpButtonBar ); |
1876 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1876 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1877 | 1877 | ||
1878 | // mMainWindow->getIconToolBar()->raise(); | 1878 | // mMainWindow->getIconToolBar()->raise(); |
1879 | 1879 | ||
1880 | #endif //KAB_EMBEDDED | 1880 | #endif //KAB_EMBEDDED |
1881 | 1881 | ||
1882 | } | 1882 | } |
1883 | void KABCore::initActions() | 1883 | void KABCore::initActions() |
1884 | { | 1884 | { |
1885 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1885 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1886 | 1886 | ||
1887 | #ifndef KAB_EMBEDDED | 1887 | #ifndef KAB_EMBEDDED |
1888 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1888 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1889 | SLOT( clipboardDataChanged() ) ); | 1889 | SLOT( clipboardDataChanged() ) ); |
1890 | #endif //KAB_EMBEDDED | 1890 | #endif //KAB_EMBEDDED |
1891 | 1891 | ||
1892 | // file menu | 1892 | // file menu |
1893 | 1893 | ||
1894 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1894 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1895 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1895 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1896 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, | 1896 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, |
1897 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | 1897 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); |
1898 | 1898 | ||
1899 | 1899 | ||
1900 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | 1900 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, |
1901 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | 1901 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); |
1902 | 1902 | ||
1903 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1903 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1904 | SLOT( save() ), actionCollection(), "file_sync" ); | 1904 | SLOT( save() ), actionCollection(), "file_sync" ); |
1905 | 1905 | ||
1906 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1906 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1907 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1907 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1908 | 1908 | ||
1909 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1909 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1910 | this, SLOT( mailVCard() ), | 1910 | this, SLOT( mailVCard() ), |
1911 | actionCollection(), "file_mail_vcard"); | 1911 | actionCollection(), "file_mail_vcard"); |
1912 | 1912 | ||
1913 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 1913 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1914 | SLOT( export2phone() ), actionCollection(), | 1914 | SLOT( export2phone() ), actionCollection(), |
1915 | "kaddressbook_ex2phone" ); | 1915 | "kaddressbook_ex2phone" ); |
1916 | 1916 | ||
1917 | mActionBeamVCard = 0; | 1917 | mActionBeamVCard = 0; |
1918 | mActionBeam = 0; | 1918 | mActionBeam = 0; |
1919 | 1919 | ||
1920 | #ifndef DESKTOP_VERSION | 1920 | #ifndef DESKTOP_VERSION |
1921 | if ( Ir::supported() ) { | 1921 | if ( Ir::supported() ) { |
1922 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, | 1922 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
1923 | SLOT( beamVCard() ), actionCollection(), | 1923 | SLOT( beamVCard() ), actionCollection(), |
1924 | "kaddressbook_beam_vcard" ); | 1924 | "kaddressbook_beam_vcard" ); |
1925 | 1925 | ||
1926 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1926 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1927 | SLOT( beamMySelf() ), actionCollection(), | 1927 | SLOT( beamMySelf() ), actionCollection(), |
1928 | "kaddressbook_beam_myself" ); | 1928 | "kaddressbook_beam_myself" ); |
1929 | } | 1929 | } |
1930 | #endif | 1930 | #endif |
1931 | 1931 | ||
1932 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1932 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1933 | this, SLOT( editContact2() ), | 1933 | this, SLOT( editContact2() ), |
1934 | actionCollection(), "file_properties" ); | 1934 | actionCollection(), "file_properties" ); |
1935 | 1935 | ||
1936 | #ifdef KAB_EMBEDDED | 1936 | #ifdef KAB_EMBEDDED |
1937 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1937 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1938 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1938 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1939 | mMainWindow, SLOT( exit() ), | 1939 | mMainWindow, SLOT( exit() ), |
1940 | actionCollection(), "quit" ); | 1940 | actionCollection(), "quit" ); |
1941 | #endif //KAB_EMBEDDED | 1941 | #endif //KAB_EMBEDDED |
1942 | 1942 | ||
1943 | // edit menu | 1943 | // edit menu |
1944 | if ( mIsPart ) { | 1944 | if ( mIsPart ) { |
1945 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1945 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1946 | SLOT( copyContacts() ), actionCollection(), | 1946 | SLOT( copyContacts() ), actionCollection(), |
1947 | "kaddressbook_copy" ); | 1947 | "kaddressbook_copy" ); |
1948 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1948 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1949 | SLOT( cutContacts() ), actionCollection(), | 1949 | SLOT( cutContacts() ), actionCollection(), |
1950 | "kaddressbook_cut" ); | 1950 | "kaddressbook_cut" ); |
1951 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1951 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1952 | SLOT( pasteContacts() ), actionCollection(), | 1952 | SLOT( pasteContacts() ), actionCollection(), |
1953 | "kaddressbook_paste" ); | 1953 | "kaddressbook_paste" ); |
1954 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1954 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1955 | SLOT( selectAllContacts() ), actionCollection(), | 1955 | SLOT( selectAllContacts() ), actionCollection(), |
1956 | "kaddressbook_select_all" ); | 1956 | "kaddressbook_select_all" ); |
1957 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1957 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1958 | SLOT( undo() ), actionCollection(), | 1958 | SLOT( undo() ), actionCollection(), |
1959 | "kaddressbook_undo" ); | 1959 | "kaddressbook_undo" ); |
1960 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1960 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1961 | this, SLOT( redo() ), actionCollection(), | 1961 | this, SLOT( redo() ), actionCollection(), |
1962 | "kaddressbook_redo" ); | 1962 | "kaddressbook_redo" ); |
1963 | } else { | 1963 | } else { |
1964 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1964 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1965 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1965 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1966 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1966 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1967 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1967 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1968 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1968 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1969 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1969 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1970 | } | 1970 | } |
1971 | 1971 | ||
1972 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1972 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1973 | Key_Delete, this, SLOT( deleteContacts() ), | 1973 | Key_Delete, this, SLOT( deleteContacts() ), |
1974 | actionCollection(), "edit_delete" ); | 1974 | actionCollection(), "edit_delete" ); |
1975 | 1975 | ||
1976 | mActionUndo->setEnabled( false ); | 1976 | mActionUndo->setEnabled( false ); |
1977 | mActionRedo->setEnabled( false ); | 1977 | mActionRedo->setEnabled( false ); |
1978 | 1978 | ||
1979 | // settings menu | 1979 | // settings menu |
1980 | #ifdef KAB_EMBEDDED | 1980 | #ifdef KAB_EMBEDDED |
1981 | //US special menuentry to configure the addressbook resources. On KDE | 1981 | //US special menuentry to configure the addressbook resources. On KDE |
1982 | // you do that through the control center !!! | 1982 | // you do that through the control center !!! |
1983 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1983 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1984 | SLOT( configureResources() ), actionCollection(), | 1984 | SLOT( configureResources() ), actionCollection(), |
1985 | "kaddressbook_configure_resources" ); | 1985 | "kaddressbook_configure_resources" ); |
1986 | #endif //KAB_EMBEDDED | 1986 | #endif //KAB_EMBEDDED |
1987 | 1987 | ||
1988 | if ( mIsPart ) { | 1988 | if ( mIsPart ) { |
1989 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1989 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1990 | SLOT( openConfigDialog() ), actionCollection(), | 1990 | SLOT( openConfigDialog() ), actionCollection(), |
1991 | "kaddressbook_configure" ); | 1991 | "kaddressbook_configure" ); |
1992 | 1992 | ||
1993 | //US not implemented yet | 1993 | //US not implemented yet |
1994 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1994 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1995 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 1995 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
1996 | // "kaddressbook_configure_shortcuts" ); | 1996 | // "kaddressbook_configure_shortcuts" ); |
1997 | #ifdef KAB_EMBEDDED | 1997 | #ifdef KAB_EMBEDDED |
1998 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1998 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1999 | mActionConfigureToolbars->setEnabled( false ); | 1999 | mActionConfigureToolbars->setEnabled( false ); |
2000 | #endif //KAB_EMBEDDED | 2000 | #endif //KAB_EMBEDDED |
2001 | 2001 | ||
2002 | } else { | 2002 | } else { |
2003 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 2003 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
2004 | 2004 | ||
2005 | //US not implemented yet | 2005 | //US not implemented yet |
2006 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 2006 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 2009 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
2010 | actionCollection(), "options_show_jump_bar" ); | 2010 | actionCollection(), "options_show_jump_bar" ); |
2011 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); | 2011 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); |
2012 | 2012 | ||
2013 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 2013 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
2014 | actionCollection(), "options_show_details" ); | 2014 | actionCollection(), "options_show_details" ); |
2015 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 2015 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
2016 | 2016 | ||
2017 | 2017 | ||
2018 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 2018 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
2019 | SLOT( toggleBeamReceive() ), actionCollection(), | 2019 | SLOT( toggleBeamReceive() ), actionCollection(), |
2020 | "kaddressbook_beam_rec" ); | 2020 | "kaddressbook_beam_rec" ); |
2021 | 2021 | ||
2022 | 2022 | ||
2023 | // misc | 2023 | // misc |
2024 | // only enable LDAP lookup if we can handle the protocol | 2024 | // only enable LDAP lookup if we can handle the protocol |
2025 | #ifndef KAB_EMBEDDED | 2025 | #ifndef KAB_EMBEDDED |
2026 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 2026 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
2027 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 2027 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
2028 | this, SLOT( openLDAPDialog() ), actionCollection(), | 2028 | this, SLOT( openLDAPDialog() ), actionCollection(), |
2029 | "ldap_lookup" ); | 2029 | "ldap_lookup" ); |
2030 | } | 2030 | } |
2031 | #else //KAB_EMBEDDED | 2031 | #else //KAB_EMBEDDED |
2032 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 2032 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
2033 | #endif //KAB_EMBEDDED | 2033 | #endif //KAB_EMBEDDED |
2034 | 2034 | ||
2035 | 2035 | ||
2036 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 2036 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
2037 | SLOT( setWhoAmI() ), actionCollection(), | 2037 | SLOT( setWhoAmI() ), actionCollection(), |
2038 | "set_personal" ); | 2038 | "set_personal" ); |
2039 | 2039 | ||
2040 | 2040 | ||
2041 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, | 2041 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, |
2042 | SLOT( setCategories() ), actionCollection(), | 2042 | SLOT( setCategories() ), actionCollection(), |
2043 | "edit_set_categories" ); | 2043 | "edit_set_categories" ); |
2044 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, | 2044 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, |
2045 | SLOT( editCategories() ), actionCollection(), | 2045 | SLOT( editCategories() ), actionCollection(), |
2046 | "edit__categories" ); | 2046 | "edit__categories" ); |
2047 | 2047 | ||
2048 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 2048 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
2049 | SLOT( removeVoice() ), actionCollection(), | 2049 | SLOT( removeVoice() ), actionCollection(), |
2050 | "remove_voice" ); | 2050 | "remove_voice" ); |
2051 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, | 2051 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, |
2052 | SLOT( setFormattedName() ), actionCollection(), | 2052 | SLOT( setFormattedName() ), actionCollection(), |
2053 | "set_formatted" ); | 2053 | "set_formatted" ); |
2054 | 2054 | ||
2055 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 2055 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
2056 | SLOT( manageCategories() ), actionCollection(), | 2056 | SLOT( manageCategories() ), actionCollection(), |
2057 | "remove_voice" ); | 2057 | "remove_voice" ); |
2058 | 2058 | ||
2059 | 2059 | ||
2060 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2060 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2061 | SLOT( importFromOL() ), actionCollection(), | 2061 | SLOT( importFromOL() ), actionCollection(), |
2062 | "import_OL" ); | 2062 | "import_OL" ); |
2063 | #ifdef KAB_EMBEDDED | 2063 | #ifdef KAB_EMBEDDED |
2064 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2064 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2065 | this, SLOT( showLicence() ), actionCollection(), | 2065 | this, SLOT( showLicence() ), actionCollection(), |
2066 | "licence_about_data" ); | 2066 | "licence_about_data" ); |
2067 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2067 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2068 | this, SLOT( faq() ), actionCollection(), | 2068 | this, SLOT( faq() ), actionCollection(), |
2069 | "faq_about_data" ); | 2069 | "faq_about_data" ); |
2070 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2070 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2071 | this, SLOT( whatsnew() ), actionCollection(), | 2071 | this, SLOT( whatsnew() ), actionCollection(), |
2072 | "wn" ); | 2072 | "wn" ); |
2073 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2073 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2074 | this, SLOT( synchowto() ), actionCollection(), | 2074 | this, SLOT( synchowto() ), actionCollection(), |
2075 | "sync" ); | 2075 | "sync" ); |
2076 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2076 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2077 | this, SLOT( kdesynchowto() ), actionCollection(), | 2077 | this, SLOT( kdesynchowto() ), actionCollection(), |
2078 | "kdesync" ); | 2078 | "kdesync" ); |
2079 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2079 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2080 | this, SLOT( multisynchowto() ), actionCollection(), | 2080 | this, SLOT( multisynchowto() ), actionCollection(), |
2081 | "multisync" ); | 2081 | "multisync" ); |
2082 | 2082 | ||
2083 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2083 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2084 | this, SLOT( createAboutData() ), actionCollection(), | 2084 | this, SLOT( createAboutData() ), actionCollection(), |
2085 | "kaddressbook_about_data" ); | 2085 | "kaddressbook_about_data" ); |
2086 | #endif //KAB_EMBEDDED | 2086 | #endif //KAB_EMBEDDED |
2087 | 2087 | ||
2088 | clipboardDataChanged(); | 2088 | clipboardDataChanged(); |
2089 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2089 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2090 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2090 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2091 | } | 2091 | } |
2092 | 2092 | ||
2093 | //US we need this function, to plug all actions into the correct menues. | 2093 | //US we need this function, to plug all actions into the correct menues. |
2094 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2094 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2095 | void KABCore::addActionsManually() | 2095 | void KABCore::addActionsManually() |
2096 | { | 2096 | { |
2097 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2097 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2098 | 2098 | ||
2099 | #ifdef KAB_EMBEDDED | 2099 | #ifdef KAB_EMBEDDED |
2100 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2100 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2101 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2101 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2102 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2102 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2103 | 2103 | ||
2104 | KToolBar* tb = mMainWindow->toolBar(); | 2104 | KToolBar* tb = mMainWindow->toolBar(); |
2105 | 2105 | ||
2106 | #ifndef DESKTOP_VERSION | 2106 | #ifndef DESKTOP_VERSION |
2107 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2107 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2108 | #endif | 2108 | #endif |
2109 | QMenuBar* mb = mMainWindow->menuBar(); | 2109 | QMenuBar* mb = mMainWindow->menuBar(); |
2110 | 2110 | ||
2111 | //US setup menubar. | 2111 | //US setup menubar. |
2112 | //Disable the following block if you do not want to have a menubar. | 2112 | //Disable the following block if you do not want to have a menubar. |
2113 | mb->insertItem( i18n("&File"), fileMenu ); | 2113 | mb->insertItem( i18n("&File"), fileMenu ); |
2114 | mb->insertItem( i18n("&Edit"), editMenu ); | 2114 | mb->insertItem( i18n("&Edit"), editMenu ); |
2115 | mb->insertItem( i18n("&View"), viewMenu ); | 2115 | mb->insertItem( i18n("&View"), viewMenu ); |
2116 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2116 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2117 | #ifdef DESKTOP_VERSION | 2117 | #ifdef DESKTOP_VERSION |
2118 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2118 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2119 | #else | 2119 | #else |
2120 | mb->insertItem( i18n("Sync"), syncMenu ); | 2120 | mb->insertItem( i18n("Sync"), syncMenu ); |
2121 | #endif | 2121 | #endif |
2122 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2122 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2123 | mb->insertItem( i18n("&Help"), helpMenu ); | 2123 | mb->insertItem( i18n("&Help"), helpMenu ); |
2124 | mIncSearchWidget = new IncSearchWidget( tb ); | 2124 | mIncSearchWidget = new IncSearchWidget( tb ); |
2125 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2125 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2126 | #ifndef DESKTOP_VERSION | 2126 | #ifndef DESKTOP_VERSION |
2127 | } else { | 2127 | } else { |
2128 | //US setup toolbar | 2128 | //US setup toolbar |
2129 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2129 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2130 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2130 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2131 | menuBarTB->insertItem( "ME", popupBarTB); | 2131 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); |
2132 | tb->insertWidget(-1, 0, menuBarTB); | 2132 | tb->insertWidget(-1, 0, menuBarTB); |
2133 | mIncSearchWidget = new IncSearchWidget( tb ); | 2133 | mIncSearchWidget = new IncSearchWidget( tb ); |
2134 | 2134 | ||
2135 | tb->enableMoving(false); | 2135 | tb->enableMoving(false); |
2136 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2136 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2137 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2137 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2138 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2138 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2139 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2139 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2140 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2140 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2141 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2141 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2142 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2142 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2143 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2143 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2144 | if (QApplication::desktop()->width() > 320 ) { | 2144 | if (QApplication::desktop()->width() > 320 ) { |
2145 | // mViewManager->getFilterAction()->plug ( tb); | 2145 | // mViewManager->getFilterAction()->plug ( tb); |
2146 | } | 2146 | } |
2147 | } | 2147 | } |
2148 | #endif | 2148 | #endif |
2149 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2149 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2150 | 2150 | ||
2151 | 2151 | ||
2152 | 2152 | ||
2153 | //US Now connect the actions with the menue entries. | 2153 | //US Now connect the actions with the menue entries. |
2154 | #ifdef DESKTOP_VERSION | 2154 | #ifdef DESKTOP_VERSION |
2155 | mActionPrint->plug( fileMenu ); | 2155 | mActionPrint->plug( fileMenu ); |
2156 | mActionPrintDetails->plug( fileMenu ); | 2156 | mActionPrintDetails->plug( fileMenu ); |
2157 | fileMenu->insertSeparator(); | 2157 | fileMenu->insertSeparator(); |
2158 | #endif | 2158 | #endif |
2159 | mActionMail->plug( fileMenu ); | 2159 | mActionMail->plug( fileMenu ); |
2160 | fileMenu->insertSeparator(); | 2160 | fileMenu->insertSeparator(); |
2161 | 2161 | ||
2162 | mActionNewContact->plug( fileMenu ); | 2162 | mActionNewContact->plug( fileMenu ); |
2163 | mActionNewContact->plug( tb ); | 2163 | mActionNewContact->plug( tb ); |
2164 | 2164 | ||
2165 | mActionEditAddressee->plug( fileMenu ); | 2165 | mActionEditAddressee->plug( fileMenu ); |
2166 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2166 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2167 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2167 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2168 | mActionEditAddressee->plug( tb ); | 2168 | mActionEditAddressee->plug( tb ); |
2169 | 2169 | ||
2170 | fileMenu->insertSeparator(); | 2170 | fileMenu->insertSeparator(); |
2171 | mActionSave->plug( fileMenu ); | 2171 | mActionSave->plug( fileMenu ); |
2172 | fileMenu->insertItem( "&Import", ImportMenu ); | 2172 | fileMenu->insertItem( "&Import", ImportMenu ); |
2173 | fileMenu->insertItem( "&Export", ExportMenu ); | 2173 | fileMenu->insertItem( "&Export", ExportMenu ); |
2174 | fileMenu->insertItem( i18n("&Change"), changeMenu ); | 2174 | fileMenu->insertItem( i18n("&Change"), changeMenu ); |
2175 | #ifndef DESKTOP_VERSION | 2175 | #ifndef DESKTOP_VERSION |
2176 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2176 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2177 | #endif | 2177 | #endif |
2178 | #if 0 | 2178 | #if 0 |
2179 | // PENDING fix MailVCard | 2179 | // PENDING fix MailVCard |
2180 | fileMenu->insertSeparator(); | 2180 | fileMenu->insertSeparator(); |
2181 | mActionMailVCard->plug( fileMenu ); | 2181 | mActionMailVCard->plug( fileMenu ); |
2182 | #endif | 2182 | #endif |
2183 | #ifndef DESKTOP_VERSION | 2183 | #ifndef DESKTOP_VERSION |
2184 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2184 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2185 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2185 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2186 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2186 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2187 | #endif | 2187 | #endif |
2188 | fileMenu->insertSeparator(); | 2188 | fileMenu->insertSeparator(); |
2189 | mActionQuit->plug( fileMenu ); | 2189 | mActionQuit->plug( fileMenu ); |
2190 | #ifdef _OL_IMPORT_ | 2190 | #ifdef _OL_IMPORT_ |
2191 | mActionImportOL->plug( ImportMenu ); | 2191 | mActionImportOL->plug( ImportMenu ); |
2192 | #endif | 2192 | #endif |
2193 | // edit menu | 2193 | // edit menu |
2194 | mActionUndo->plug( editMenu ); | 2194 | mActionUndo->plug( editMenu ); |
2195 | mActionRedo->plug( editMenu ); | 2195 | mActionRedo->plug( editMenu ); |
2196 | editMenu->insertSeparator(); | 2196 | editMenu->insertSeparator(); |
2197 | mActionCut->plug( editMenu ); | 2197 | mActionCut->plug( editMenu ); |
2198 | mActionCopy->plug( editMenu ); | 2198 | mActionCopy->plug( editMenu ); |
2199 | mActionPaste->plug( editMenu ); | 2199 | mActionPaste->plug( editMenu ); |
2200 | mActionDelete->plug( editMenu ); | 2200 | mActionDelete->plug( editMenu ); |
2201 | editMenu->insertSeparator(); | 2201 | editMenu->insertSeparator(); |
2202 | mActionSelectAll->plug( editMenu ); | 2202 | mActionSelectAll->plug( editMenu ); |
2203 | 2203 | ||
2204 | mActionSetFormattedName->plug( changeMenu ); | 2204 | mActionSetFormattedName->plug( changeMenu ); |
2205 | mActionRemoveVoice->plug( changeMenu ); | 2205 | mActionRemoveVoice->plug( changeMenu ); |
2206 | // settings menu | 2206 | // settings menu |
2207 | //US special menuentry to configure the addressbook resources. On KDE | 2207 | //US special menuentry to configure the addressbook resources. On KDE |
2208 | // you do that through the control center !!! | 2208 | // you do that through the control center !!! |
2209 | mActionConfigResources->plug( settingsMenu ); | 2209 | mActionConfigResources->plug( settingsMenu ); |
2210 | settingsMenu->insertSeparator(); | 2210 | settingsMenu->insertSeparator(); |
2211 | 2211 | ||
2212 | mActionConfigKAddressbook->plug( settingsMenu ); | 2212 | mActionConfigKAddressbook->plug( settingsMenu ); |
2213 | 2213 | ||
2214 | if ( mIsPart ) { | 2214 | if ( mIsPart ) { |
2215 | //US not implemented yet | 2215 | //US not implemented yet |
2216 | //mActionConfigShortcuts->plug( settingsMenu ); | 2216 | //mActionConfigShortcuts->plug( settingsMenu ); |
2217 | //mActionConfigureToolbars->plug( settingsMenu ); | 2217 | //mActionConfigureToolbars->plug( settingsMenu ); |
2218 | 2218 | ||
2219 | } else { | 2219 | } else { |
2220 | //US not implemented yet | 2220 | //US not implemented yet |
2221 | //mActionKeyBindings->plug( settingsMenu ); | 2221 | //mActionKeyBindings->plug( settingsMenu ); |
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | settingsMenu->insertSeparator(); | 2224 | settingsMenu->insertSeparator(); |
2225 | 2225 | ||
2226 | mActionJumpBar->plug( settingsMenu ); | 2226 | mActionJumpBar->plug( settingsMenu ); |
2227 | mActionDetails->plug( settingsMenu ); | 2227 | mActionDetails->plug( settingsMenu ); |
2228 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2228 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2229 | mActionDetails->plug( tb ); | 2229 | mActionDetails->plug( tb ); |
2230 | settingsMenu->insertSeparator(); | 2230 | settingsMenu->insertSeparator(); |
2231 | #ifndef DESKTOP_VERSION | 2231 | #ifndef DESKTOP_VERSION |
2232 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2232 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2233 | settingsMenu->insertSeparator(); | 2233 | settingsMenu->insertSeparator(); |
2234 | #endif | 2234 | #endif |
2235 | 2235 | ||
2236 | mActionWhoAmI->plug( settingsMenu ); | 2236 | mActionWhoAmI->plug( settingsMenu ); |
2237 | mActionEditCategories->plug( settingsMenu ); | 2237 | mActionEditCategories->plug( settingsMenu ); |
2238 | mActionEditCategories->plug( changeMenu ); | 2238 | mActionEditCategories->plug( changeMenu ); |
2239 | mActionCategories->plug( changeMenu ); | 2239 | mActionCategories->plug( changeMenu ); |
2240 | mActionManageCategories->plug( changeMenu ); | 2240 | mActionManageCategories->plug( changeMenu ); |
2241 | 2241 | ||
2242 | mActionCategories->plug( settingsMenu ); | 2242 | mActionCategories->plug( settingsMenu ); |
2243 | mActionManageCategories->plug( settingsMenu ); | 2243 | mActionManageCategories->plug( settingsMenu ); |
2244 | 2244 | ||
2245 | 2245 | ||
2246 | mActionWN->plug( helpMenu ); | 2246 | mActionWN->plug( helpMenu ); |
2247 | mActionSyncHowto->plug( helpMenu ); | 2247 | mActionSyncHowto->plug( helpMenu ); |
2248 | mActionKdeSyncHowto->plug( helpMenu ); | 2248 | mActionKdeSyncHowto->plug( helpMenu ); |
2249 | mActionMultiSyncHowto->plug( helpMenu ); | 2249 | mActionMultiSyncHowto->plug( helpMenu ); |
2250 | mActionFaq->plug( helpMenu ); | 2250 | mActionFaq->plug( helpMenu ); |
2251 | mActionLicence->plug( helpMenu ); | 2251 | mActionLicence->plug( helpMenu ); |
2252 | mActionAboutKAddressbook->plug( helpMenu ); | 2252 | mActionAboutKAddressbook->plug( helpMenu ); |
2253 | 2253 | ||
2254 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2254 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2255 | 2255 | ||
2256 | mActionSave->plug( tb ); | 2256 | mActionSave->plug( tb ); |
2257 | mViewManager->getFilterAction()->plug ( tb); | 2257 | mViewManager->getFilterAction()->plug ( tb); |
2258 | //LR hide filteraction on started in 480x640 | 2258 | //LR hide filteraction on started in 480x640 |
2259 | if (QApplication::desktop()->width() == 480 ) { | 2259 | if (QApplication::desktop()->width() == 480 ) { |
2260 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2260 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2261 | } | 2261 | } |
2262 | mActionUndo->plug( tb ); | 2262 | mActionUndo->plug( tb ); |
2263 | mActionDelete->plug( tb ); | 2263 | mActionDelete->plug( tb ); |
2264 | mActionRedo->plug( tb ); | 2264 | mActionRedo->plug( tb ); |
2265 | } else { | 2265 | } else { |
2266 | mActionSave->plug( tb ); | 2266 | mActionSave->plug( tb ); |
2267 | tb->enableMoving(false); | 2267 | tb->enableMoving(false); |
2268 | } | 2268 | } |
2269 | //mActionQuit->plug ( tb ); | 2269 | //mActionQuit->plug ( tb ); |
2270 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2270 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2271 | 2271 | ||
2272 | //US link the searchwidget first to this. | 2272 | //US link the searchwidget first to this. |
2273 | // The real linkage to the toolbar happens later. | 2273 | // The real linkage to the toolbar happens later. |
2274 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2274 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2275 | //US tb->insertItem( mIncSearchWidget ); | 2275 | //US tb->insertItem( mIncSearchWidget ); |
2276 | /*US | 2276 | /*US |
2277 | mIncSearchWidget = new IncSearchWidget( tb ); | 2277 | mIncSearchWidget = new IncSearchWidget( tb ); |
2278 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2278 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2279 | SLOT( incrementalSearch( const QString& ) ) ); | 2279 | SLOT( incrementalSearch( const QString& ) ) ); |
2280 | 2280 | ||
2281 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2281 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2282 | 2282 | ||
2283 | //US topLayout->addWidget( mJumpButtonBar ); | 2283 | //US topLayout->addWidget( mJumpButtonBar ); |
2284 | this->layout()->add( mJumpButtonBar ); | 2284 | this->layout()->add( mJumpButtonBar ); |
2285 | */ | 2285 | */ |
2286 | 2286 | ||
2287 | #endif //KAB_EMBEDDED | 2287 | #endif //KAB_EMBEDDED |
2288 | 2288 | ||
2289 | mActionExport2phone->plug( ExportMenu ); | 2289 | mActionExport2phone->plug( ExportMenu ); |
2290 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2290 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2291 | syncManager->fillSyncMenu(); | 2291 | syncManager->fillSyncMenu(); |
2292 | 2292 | ||
2293 | } | 2293 | } |
2294 | void KABCore::showLicence() | 2294 | void KABCore::showLicence() |
2295 | { | 2295 | { |
2296 | KApplication::showLicence(); | 2296 | KApplication::showLicence(); |
2297 | } | 2297 | } |
2298 | 2298 | ||
2299 | void KABCore::manageCategories( ) | 2299 | void KABCore::manageCategories( ) |
2300 | { | 2300 | { |
2301 | KABCatPrefs* cp = new KABCatPrefs(); | 2301 | KABCatPrefs* cp = new KABCatPrefs(); |
2302 | cp->show(); | 2302 | cp->show(); |
2303 | int w =cp->sizeHint().width() ; | 2303 | int w =cp->sizeHint().width() ; |
2304 | int h = cp->sizeHint().height() ; | 2304 | int h = cp->sizeHint().height() ; |
2305 | int dw = QApplication::desktop()->width(); | 2305 | int dw = QApplication::desktop()->width(); |
2306 | int dh = QApplication::desktop()->height(); | 2306 | int dh = QApplication::desktop()->height(); |
2307 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2307 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2308 | if ( !cp->exec() ) { | 2308 | if ( !cp->exec() ) { |
2309 | delete cp; | 2309 | delete cp; |
2310 | return; | 2310 | return; |
2311 | } | 2311 | } |
2312 | int count = 0; | 2312 | int count = 0; |
2313 | int cc = 0; | 2313 | int cc = 0; |
2314 | message( i18n("Please wait, processing categories...")); | 2314 | message( i18n("Please wait, processing categories...")); |
2315 | if ( cp->addCat() ) { | 2315 | if ( cp->addCat() ) { |
2316 | KABC::AddressBook::Iterator it; | 2316 | KABC::AddressBook::Iterator it; |
2317 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2317 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2318 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2318 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2319 | ++cc; | 2319 | ++cc; |
2320 | if ( cc %10 == 0) | 2320 | if ( cc %10 == 0) |
2321 | message(i18n("Processing contact #%1").arg(cc)); | 2321 | message(i18n("Processing contact #%1").arg(cc)); |
2322 | QStringList catIncList = (*it).categories(); | 2322 | QStringList catIncList = (*it).categories(); |
2323 | int i; | 2323 | int i; |
2324 | for( i = 0; i< catIncList.count(); ++i ) { | 2324 | for( i = 0; i< catIncList.count(); ++i ) { |
2325 | if ( !catList.contains (catIncList[i])) { | 2325 | if ( !catList.contains (catIncList[i])) { |
2326 | catList.append( catIncList[i] ); | 2326 | catList.append( catIncList[i] ); |
2327 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2327 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2328 | ++count; | 2328 | ++count; |
2329 | } | 2329 | } |
2330 | } | 2330 | } |
2331 | } | 2331 | } |
2332 | catList.sort(); | 2332 | catList.sort(); |
2333 | KABPrefs::instance()->mCustomCategories = catList; | 2333 | KABPrefs::instance()->mCustomCategories = catList; |
2334 | KABPrefs::instance()->writeConfig(); | 2334 | KABPrefs::instance()->writeConfig(); |
2335 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2335 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2336 | } else { | 2336 | } else { |
2337 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2337 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2338 | QStringList catIncList; | 2338 | QStringList catIncList; |
2339 | QStringList newCatList; | 2339 | QStringList newCatList; |
2340 | KABC::AddressBook::Iterator it; | 2340 | KABC::AddressBook::Iterator it; |
2341 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2341 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2342 | ++cc; | 2342 | ++cc; |
2343 | if ( cc %10 == 0) | 2343 | if ( cc %10 == 0) |
2344 | message(i18n("Processing contact #%1").arg(cc)); | 2344 | message(i18n("Processing contact #%1").arg(cc)); |
2345 | QStringList catIncList = (*it).categories(); | 2345 | QStringList catIncList = (*it).categories(); |
2346 | int i; | 2346 | int i; |
2347 | if ( catIncList.count() ) { | 2347 | if ( catIncList.count() ) { |
2348 | newCatList.clear(); | 2348 | newCatList.clear(); |
2349 | for( i = 0; i< catIncList.count(); ++i ) { | 2349 | for( i = 0; i< catIncList.count(); ++i ) { |
2350 | if ( catList.contains (catIncList[i])) { | 2350 | if ( catList.contains (catIncList[i])) { |
2351 | newCatList.append( catIncList[i] ); | 2351 | newCatList.append( catIncList[i] ); |
2352 | } | 2352 | } |
2353 | } | 2353 | } |
2354 | newCatList.sort(); | 2354 | newCatList.sort(); |
2355 | (*it).setCategories( newCatList ); | 2355 | (*it).setCategories( newCatList ); |
2356 | mAddressBook->insertAddressee( (*it) ); | 2356 | mAddressBook->insertAddressee( (*it) ); |
2357 | } | 2357 | } |
2358 | } | 2358 | } |
2359 | setModified( true ); | 2359 | setModified( true ); |
2360 | mViewManager->refreshView(); | 2360 | mViewManager->refreshView(); |
2361 | message( i18n("Removing categories done!")); | 2361 | message( i18n("Removing categories done!")); |
2362 | } | 2362 | } |
2363 | delete cp; | 2363 | delete cp; |
2364 | } | 2364 | } |
2365 | void KABCore::removeVoice() | 2365 | void KABCore::removeVoice() |
2366 | { | 2366 | { |
2367 | 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 ) | 2367 | 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 ) |
2368 | return; | 2368 | return; |
2369 | XXPortSelectDialog dlg( this, false, this ); | 2369 | XXPortSelectDialog dlg( this, false, this ); |
2370 | if ( !dlg.exec() ) | 2370 | if ( !dlg.exec() ) |
2371 | return; | 2371 | return; |
2372 | mAddressBook->setUntagged(); | 2372 | mAddressBook->setUntagged(); |
2373 | dlg.tagSelected(); | 2373 | dlg.tagSelected(); |
2374 | message(i18n("Removing voice..."), false ); | 2374 | message(i18n("Removing voice..."), false ); |
2375 | KABC::AddressBook::Iterator it; | 2375 | KABC::AddressBook::Iterator it; |
2376 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2376 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2377 | if ( (*it).tagged() ) { | 2377 | if ( (*it).tagged() ) { |
2378 | (*it).removeVoice(); | 2378 | (*it).removeVoice(); |
2379 | } | 2379 | } |
2380 | } | 2380 | } |
2381 | message(i18n("Refreshing view...") ); | 2381 | message(i18n("Refreshing view...") ); |
2382 | qApp->processEvents(); | 2382 | qApp->processEvents(); |
2383 | mViewManager->refreshView( "" ); | 2383 | mViewManager->refreshView( "" ); |
2384 | Addressee add; | 2384 | Addressee add; |
2385 | mDetails->setAddressee( add ); | 2385 | mDetails->setAddressee( add ); |
2386 | message(i18n("Remove voice completed!") ); | 2386 | message(i18n("Remove voice completed!") ); |
2387 | 2387 | ||
2388 | 2388 | ||
2389 | 2389 | ||
2390 | } | 2390 | } |
2391 | 2391 | ||
2392 | void KABCore::setFormattedName() | 2392 | void KABCore::setFormattedName() |
2393 | { | 2393 | { |
2394 | KABFormatPrefs setpref; | 2394 | KABFormatPrefs setpref; |
2395 | if ( !setpref.exec() ) { | 2395 | if ( !setpref.exec() ) { |
2396 | return; | 2396 | return; |
2397 | } | 2397 | } |
2398 | XXPortSelectDialog dlg( this, false, this ); | 2398 | XXPortSelectDialog dlg( this, false, this ); |
2399 | if ( !dlg.exec() ) | 2399 | if ( !dlg.exec() ) |
2400 | return; | 2400 | return; |
2401 | mAddressBook->setUntagged(); | 2401 | mAddressBook->setUntagged(); |
2402 | dlg.tagSelected(); | 2402 | dlg.tagSelected(); |
2403 | int count = 0; | 2403 | int count = 0; |
2404 | KABC::AddressBook::Iterator it; | 2404 | KABC::AddressBook::Iterator it; |
2405 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2405 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2406 | if ( (*it).tagged() ) { | 2406 | if ( (*it).tagged() ) { |
2407 | ++count; | 2407 | ++count; |
2408 | if ( count %10 == 0 ) | 2408 | if ( count %10 == 0 ) |
2409 | message(i18n("Changing contact #%1").arg( count ) ); | 2409 | message(i18n("Changing contact #%1").arg( count ) ); |
2410 | qApp->processEvents(); | 2410 | qApp->processEvents(); |
2411 | QString fName; | 2411 | QString fName; |
2412 | if ( setpref.simple->isChecked() ) | 2412 | if ( setpref.simple->isChecked() ) |
2413 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2413 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2414 | else if ( setpref.full->isChecked() ) | 2414 | else if ( setpref.full->isChecked() ) |
2415 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2415 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2416 | else if ( setpref.reverse->isChecked() ) | 2416 | else if ( setpref.reverse->isChecked() ) |
2417 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2417 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2418 | else | 2418 | else |
2419 | fName = (*it).organization(); | 2419 | fName = (*it).organization(); |
2420 | if ( setpref.setCompany->isChecked() ) | 2420 | if ( setpref.setCompany->isChecked() ) |
2421 | if ( fName.isEmpty() || fName =="," ) | 2421 | if ( fName.isEmpty() || fName =="," ) |
2422 | fName = (*it).organization(); | 2422 | fName = (*it).organization(); |
2423 | (*it).setFormattedName( fName ); | 2423 | (*it).setFormattedName( fName ); |
2424 | } | 2424 | } |
2425 | } | 2425 | } |
2426 | message(i18n("Refreshing view...") ); | 2426 | message(i18n("Refreshing view...") ); |
2427 | qApp->processEvents(); | 2427 | qApp->processEvents(); |
2428 | mViewManager->refreshView( "" ); | 2428 | mViewManager->refreshView( "" ); |
2429 | Addressee add; | 2429 | Addressee add; |
2430 | mDetails->setAddressee( add ); | 2430 | mDetails->setAddressee( add ); |
2431 | message(i18n("Setting formatted name completed!") ); | 2431 | message(i18n("Setting formatted name completed!") ); |
2432 | } | 2432 | } |
2433 | 2433 | ||
2434 | void KABCore::clipboardDataChanged() | 2434 | void KABCore::clipboardDataChanged() |
2435 | { | 2435 | { |
2436 | 2436 | ||
2437 | if ( mReadWrite ) | 2437 | if ( mReadWrite ) |
2438 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2438 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2439 | 2439 | ||
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | void KABCore::updateActionMenu() | 2442 | void KABCore::updateActionMenu() |
2443 | { | 2443 | { |
2444 | UndoStack *undo = UndoStack::instance(); | 2444 | UndoStack *undo = UndoStack::instance(); |
2445 | RedoStack *redo = RedoStack::instance(); | 2445 | RedoStack *redo = RedoStack::instance(); |
2446 | 2446 | ||
2447 | if ( undo->isEmpty() ) | 2447 | if ( undo->isEmpty() ) |
2448 | mActionUndo->setText( i18n( "Undo" ) ); | 2448 | mActionUndo->setText( i18n( "Undo" ) ); |
2449 | else | 2449 | else |
2450 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2450 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2451 | 2451 | ||
2452 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2452 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2453 | 2453 | ||
2454 | if ( !redo->top() ) | 2454 | if ( !redo->top() ) |
2455 | mActionRedo->setText( i18n( "Redo" ) ); | 2455 | mActionRedo->setText( i18n( "Redo" ) ); |
2456 | else | 2456 | else |
2457 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2457 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2458 | 2458 | ||
2459 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2459 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | void KABCore::configureKeyBindings() | 2462 | void KABCore::configureKeyBindings() |
2463 | { | 2463 | { |
2464 | #ifndef KAB_EMBEDDED | 2464 | #ifndef KAB_EMBEDDED |
2465 | KKeyDialog::configure( actionCollection(), true ); | 2465 | KKeyDialog::configure( actionCollection(), true ); |
2466 | #else //KAB_EMBEDDED | 2466 | #else //KAB_EMBEDDED |
2467 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2467 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2468 | #endif //KAB_EMBEDDED | 2468 | #endif //KAB_EMBEDDED |
2469 | } | 2469 | } |
2470 | 2470 | ||
2471 | #ifdef KAB_EMBEDDED | 2471 | #ifdef KAB_EMBEDDED |
2472 | void KABCore::configureResources() | 2472 | void KABCore::configureResources() |
2473 | { | 2473 | { |
2474 | KRES::KCMKResources dlg( this, "" , 0 ); | 2474 | KRES::KCMKResources dlg( this, "" , 0 ); |
2475 | 2475 | ||
2476 | if ( !dlg.exec() ) | 2476 | if ( !dlg.exec() ) |
2477 | return; | 2477 | return; |
2478 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2478 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2479 | } | 2479 | } |
2480 | #endif //KAB_EMBEDDED | 2480 | #endif //KAB_EMBEDDED |
2481 | 2481 | ||
2482 | 2482 | ||
2483 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2483 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2484 | * for the attendees list of an event. | 2484 | * for the attendees list of an event. |
2485 | */ | 2485 | */ |
2486 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2486 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2487 | { | 2487 | { |
2488 | QStringList nameList; | 2488 | QStringList nameList; |
2489 | QStringList emailList; | 2489 | QStringList emailList; |
2490 | QStringList uidList; | 2490 | QStringList uidList; |
2491 | 2491 | ||
2492 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2492 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2493 | uint i=0; | 2493 | uint i=0; |
2494 | for (i=0; i < list.count(); i++) | 2494 | for (i=0; i < list.count(); i++) |
2495 | { | 2495 | { |
2496 | nameList.append(list[i].realName()); | 2496 | nameList.append(list[i].realName()); |
2497 | emailList.append(list[i].preferredEmail()); | 2497 | emailList.append(list[i].preferredEmail()); |
2498 | uidList.append(list[i].uid()); | 2498 | uidList.append(list[i].uid()); |
2499 | } | 2499 | } |
2500 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2500 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2501 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2501 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2502 | 2502 | ||
2503 | } | 2503 | } |
2504 | 2504 | ||
2505 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2505 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2506 | * to put them into the calendar. | 2506 | * to put them into the calendar. |
2507 | */ | 2507 | */ |
2508 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2508 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2509 | { | 2509 | { |
2510 | // qDebug("KABCore::requestForBirthdayList"); | 2510 | // qDebug("KABCore::requestForBirthdayList"); |
2511 | QStringList birthdayList; | 2511 | QStringList birthdayList; |
2512 | QStringList anniversaryList; | 2512 | QStringList anniversaryList; |
2513 | QStringList realNameList; | 2513 | QStringList realNameList; |
2514 | QStringList preferredEmailList; | 2514 | QStringList preferredEmailList; |
2515 | QStringList assembledNameList; | 2515 | QStringList assembledNameList; |
2516 | QStringList uidList; | 2516 | QStringList uidList; |
2517 | 2517 | ||
2518 | KABC::AddressBook::Iterator it; | 2518 | KABC::AddressBook::Iterator it; |
2519 | 2519 | ||
2520 | int count = 0; | 2520 | int count = 0; |
2521 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2521 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2522 | ++count; | 2522 | ++count; |
2523 | } | 2523 | } |
2524 | QProgressBar bar(count,0 ); | 2524 | QProgressBar bar(count,0 ); |
2525 | int w = 300; | 2525 | int w = 300; |
2526 | if ( QApplication::desktop()->width() < 320 ) | 2526 | if ( QApplication::desktop()->width() < 320 ) |
2527 | w = 220; | 2527 | w = 220; |
2528 | int h = bar.sizeHint().height() ; | 2528 | int h = bar.sizeHint().height() ; |
2529 | int dw = QApplication::desktop()->width(); | 2529 | int dw = QApplication::desktop()->width(); |
2530 | int dh = QApplication::desktop()->height(); | 2530 | int dh = QApplication::desktop()->height(); |
2531 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2531 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2532 | bar.show(); | 2532 | bar.show(); |
2533 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2533 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2534 | qApp->processEvents(); | 2534 | qApp->processEvents(); |
2535 | 2535 | ||
2536 | QDate bday; | 2536 | QDate bday; |
2537 | QString anni; | 2537 | QString anni; |
2538 | QString formattedbday; | 2538 | QString formattedbday; |
2539 | 2539 | ||
2540 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2540 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2541 | { | 2541 | { |
2542 | if ( ! bar.isVisible() ) | 2542 | if ( ! bar.isVisible() ) |
2543 | return; | 2543 | return; |
2544 | bar.setProgress( count++ ); | 2544 | bar.setProgress( count++ ); |
2545 | qApp->processEvents(); | 2545 | qApp->processEvents(); |
2546 | bday = (*it).birthday().date(); | 2546 | bday = (*it).birthday().date(); |
2547 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2547 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2548 | 2548 | ||
2549 | if ( bday.isValid() || !anni.isEmpty()) | 2549 | if ( bday.isValid() || !anni.isEmpty()) |
2550 | { | 2550 | { |
2551 | if (bday.isValid()) | 2551 | if (bday.isValid()) |
2552 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2552 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2553 | else | 2553 | else |
2554 | formattedbday = "NOTVALID"; | 2554 | formattedbday = "NOTVALID"; |
2555 | if (anni.isEmpty()) | 2555 | if (anni.isEmpty()) |
2556 | anni = "INVALID"; | 2556 | anni = "INVALID"; |
2557 | 2557 | ||
2558 | birthdayList.append(formattedbday); | 2558 | birthdayList.append(formattedbday); |
2559 | anniversaryList.append(anni); //should be ISODate | 2559 | anniversaryList.append(anni); //should be ISODate |
2560 | realNameList.append((*it).realName()); | 2560 | realNameList.append((*it).realName()); |
2561 | preferredEmailList.append((*it).preferredEmail()); | 2561 | preferredEmailList.append((*it).preferredEmail()); |
2562 | assembledNameList.append((*it).assembledName()); | 2562 | assembledNameList.append((*it).assembledName()); |
2563 | uidList.append((*it).uid()); | 2563 | uidList.append((*it).uid()); |
2564 | 2564 | ||
2565 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2565 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2566 | } | 2566 | } |
2567 | } | 2567 | } |
2568 | 2568 | ||
2569 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2569 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2570 | 2570 | ||
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2573 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2574 | */ | 2574 | */ |
2575 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2575 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2576 | { | 2576 | { |
2577 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2577 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2578 | 2578 | ||
2579 | QString foundUid = QString::null; | 2579 | QString foundUid = QString::null; |
2580 | if ( ! uid.isEmpty() ) { | 2580 | if ( ! uid.isEmpty() ) { |
2581 | Addressee adrr = mAddressBook->findByUid( uid ); | 2581 | Addressee adrr = mAddressBook->findByUid( uid ); |
2582 | if ( !adrr.isEmpty() ) { | 2582 | if ( !adrr.isEmpty() ) { |
2583 | foundUid = uid; | 2583 | foundUid = uid; |
2584 | } | 2584 | } |
2585 | if ( email == "sendbacklist" ) { | 2585 | if ( email == "sendbacklist" ) { |
2586 | //qDebug("ssssssssssssssssssssssend "); | 2586 | //qDebug("ssssssssssssssssssssssend "); |
2587 | QStringList nameList; | 2587 | QStringList nameList; |
2588 | QStringList emailList; | 2588 | QStringList emailList; |
2589 | QStringList uidList; | 2589 | QStringList uidList; |
2590 | nameList.append(adrr.realName()); | 2590 | nameList.append(adrr.realName()); |
2591 | emailList = adrr.emails(); | 2591 | emailList = adrr.emails(); |
2592 | uidList.append( adrr.preferredEmail()); | 2592 | uidList.append( adrr.preferredEmail()); |
2593 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2593 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2594 | return; | 2594 | return; |
2595 | } | 2595 | } |
2596 | 2596 | ||
2597 | } | 2597 | } |
2598 | 2598 | ||
2599 | if ( email == "sendbacklist" ) | 2599 | if ( email == "sendbacklist" ) |
2600 | return; | 2600 | return; |
2601 | if (foundUid.isEmpty()) | 2601 | if (foundUid.isEmpty()) |
2602 | { | 2602 | { |
2603 | //find the uid of the person first | 2603 | //find the uid of the person first |
2604 | Addressee::List namelist; | 2604 | Addressee::List namelist; |
2605 | Addressee::List emaillist; | 2605 | Addressee::List emaillist; |
2606 | 2606 | ||
2607 | if (!name.isEmpty()) | 2607 | if (!name.isEmpty()) |
2608 | namelist = mAddressBook->findByName( name ); | 2608 | namelist = mAddressBook->findByName( name ); |
2609 | 2609 | ||
2610 | if (!email.isEmpty()) | 2610 | if (!email.isEmpty()) |
2611 | emaillist = mAddressBook->findByEmail( email ); | 2611 | emaillist = mAddressBook->findByEmail( email ); |
2612 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2612 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2613 | //check if we have a match in Namelist and Emaillist | 2613 | //check if we have a match in Namelist and Emaillist |
2614 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2614 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2615 | foundUid = emaillist[0].uid(); | 2615 | foundUid = emaillist[0].uid(); |
2616 | } | 2616 | } |
2617 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2617 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2618 | foundUid = namelist[0].uid(); | 2618 | foundUid = namelist[0].uid(); |
2619 | else | 2619 | else |
2620 | { | 2620 | { |
2621 | for (int i = 0; i < namelist.count(); i++) | 2621 | for (int i = 0; i < namelist.count(); i++) |
2622 | { | 2622 | { |
2623 | for (int j = 0; j < emaillist.count(); j++) | 2623 | for (int j = 0; j < emaillist.count(); j++) |
2624 | { | 2624 | { |
2625 | if (namelist[i] == emaillist[j]) | 2625 | if (namelist[i] == emaillist[j]) |
2626 | { | 2626 | { |
2627 | foundUid = namelist[i].uid(); | 2627 | foundUid = namelist[i].uid(); |
2628 | } | 2628 | } |
2629 | } | 2629 | } |
2630 | } | 2630 | } |
2631 | } | 2631 | } |
2632 | } | 2632 | } |
2633 | else | 2633 | else |
2634 | { | 2634 | { |
2635 | foundUid = uid; | 2635 | foundUid = uid; |
2636 | } | 2636 | } |
2637 | 2637 | ||
2638 | if (!foundUid.isEmpty()) | 2638 | if (!foundUid.isEmpty()) |
2639 | { | 2639 | { |
2640 | 2640 | ||
2641 | // raise Ka/Pi if it is in the background | 2641 | // raise Ka/Pi if it is in the background |
2642 | #ifndef DESKTOP_VERSION | 2642 | #ifndef DESKTOP_VERSION |
2643 | #ifndef KORG_NODCOP | 2643 | #ifndef KORG_NODCOP |
2644 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2644 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2645 | #endif | 2645 | #endif |
2646 | #endif | 2646 | #endif |
2647 | 2647 | ||
2648 | mMainWindow->showMaximized(); | 2648 | mMainWindow->showMaximized(); |
2649 | mMainWindow-> raise(); | 2649 | mMainWindow-> raise(); |
2650 | 2650 | ||
2651 | mViewManager->setSelected( "", false); | 2651 | mViewManager->setSelected( "", false); |
2652 | mViewManager->refreshView( "" ); | 2652 | mViewManager->refreshView( "" ); |
2653 | mViewManager->setSelected( foundUid, true ); | 2653 | mViewManager->setSelected( foundUid, true ); |
2654 | mViewManager->refreshView( foundUid ); | 2654 | mViewManager->refreshView( foundUid ); |
2655 | 2655 | ||
2656 | if ( !mMultipleViewsAtOnce ) | 2656 | if ( !mMultipleViewsAtOnce ) |
2657 | { | 2657 | { |
2658 | setDetailsVisible( true ); | 2658 | setDetailsVisible( true ); |
2659 | mActionDetails->setChecked(true); | 2659 | mActionDetails->setChecked(true); |
2660 | } | 2660 | } |
2661 | } | 2661 | } |
2662 | } | 2662 | } |
2663 | 2663 | ||
2664 | void KABCore::whatsnew() | 2664 | void KABCore::whatsnew() |
2665 | { | 2665 | { |
2666 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2666 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2667 | } | 2667 | } |
2668 | void KABCore::synchowto() | 2668 | void KABCore::synchowto() |
2669 | { | 2669 | { |
2670 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2670 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2671 | } | 2671 | } |
2672 | void KABCore::kdesynchowto() | 2672 | void KABCore::kdesynchowto() |
2673 | { | 2673 | { |
2674 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2674 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2675 | } | 2675 | } |
2676 | void KABCore::multisynchowto() | 2676 | void KABCore::multisynchowto() |
2677 | { | 2677 | { |
2678 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 2678 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
2679 | } | 2679 | } |
2680 | void KABCore::faq() | 2680 | void KABCore::faq() |
2681 | { | 2681 | { |
2682 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2682 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2683 | } | 2683 | } |
2684 | 2684 | ||
2685 | #include <libkcal/syncdefines.h> | 2685 | #include <libkcal/syncdefines.h> |
2686 | 2686 | ||
2687 | KABC::Addressee KABCore::getLastSyncAddressee() | 2687 | KABC::Addressee KABCore::getLastSyncAddressee() |
2688 | { | 2688 | { |
2689 | Addressee lse; | 2689 | Addressee lse; |
2690 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2690 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2691 | 2691 | ||
2692 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2692 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2693 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2693 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2694 | if (lse.isEmpty()) { | 2694 | if (lse.isEmpty()) { |
2695 | qDebug("KA: Creating new last-syncAddressee "); | 2695 | qDebug("KA: Creating new last-syncAddressee "); |
2696 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2696 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2697 | QString sum = ""; | 2697 | QString sum = ""; |
2698 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2698 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2699 | sum = "E: "; | 2699 | sum = "E: "; |
2700 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2700 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2701 | lse.setRevision( mLastAddressbookSync ); | 2701 | lse.setRevision( mLastAddressbookSync ); |
2702 | lse.setCategories( i18n("SyncEvent") ); | 2702 | lse.setCategories( i18n("SyncEvent") ); |
2703 | mAddressBook->insertAddressee( lse ); | 2703 | mAddressBook->insertAddressee( lse ); |
2704 | } | 2704 | } |
2705 | return lse; | 2705 | return lse; |
2706 | } | 2706 | } |
2707 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2707 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2708 | { | 2708 | { |
2709 | 2709 | ||
2710 | //void setZaurusId(int id); | 2710 | //void setZaurusId(int id); |
2711 | // int zaurusId() const; | 2711 | // int zaurusId() const; |
2712 | // void setZaurusUid(int id); | 2712 | // void setZaurusUid(int id); |
2713 | // int zaurusUid() const; | 2713 | // int zaurusUid() const; |
2714 | // void setZaurusStat(int id); | 2714 | // void setZaurusStat(int id); |
2715 | // int zaurusStat() const; | 2715 | // int zaurusStat() const; |
2716 | // 0 equal | 2716 | // 0 equal |
2717 | // 1 take local | 2717 | // 1 take local |
2718 | // 2 take remote | 2718 | // 2 take remote |
2719 | // 3 cancel | 2719 | // 3 cancel |
2720 | QDateTime lastSync = mLastAddressbookSync; | 2720 | QDateTime lastSync = mLastAddressbookSync; |
2721 | QDateTime localMod = local->revision(); | 2721 | QDateTime localMod = local->revision(); |
2722 | QDateTime remoteMod = remote->revision(); | 2722 | QDateTime remoteMod = remote->revision(); |
2723 | 2723 | ||
2724 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2724 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2725 | 2725 | ||
2726 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2726 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2727 | bool remCh, locCh; | 2727 | bool remCh, locCh; |
2728 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2728 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2729 | //if ( remCh ) | 2729 | //if ( remCh ) |
2730 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2730 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2731 | locCh = ( localMod > mLastAddressbookSync ); | 2731 | locCh = ( localMod > mLastAddressbookSync ); |
2732 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); | 2732 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); |
2733 | if ( !remCh && ! locCh ) { | 2733 | if ( !remCh && ! locCh ) { |
2734 | //qDebug("both not changed "); | 2734 | //qDebug("both not changed "); |
2735 | lastSync = localMod.addDays(1); | 2735 | lastSync = localMod.addDays(1); |
2736 | if ( mode <= SYNC_PREF_ASK ) | 2736 | if ( mode <= SYNC_PREF_ASK ) |
2737 | return 0; | 2737 | return 0; |
2738 | } else { | 2738 | } else { |
2739 | if ( locCh ) { | 2739 | if ( locCh ) { |
2740 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2740 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2741 | lastSync = localMod.addDays( -1 ); | 2741 | lastSync = localMod.addDays( -1 ); |
2742 | if ( !remCh ) | 2742 | if ( !remCh ) |
2743 | remoteMod =( lastSync.addDays( -1 ) ); | 2743 | remoteMod =( lastSync.addDays( -1 ) ); |
2744 | } else { | 2744 | } else { |
2745 | //qDebug(" not loc changed "); | 2745 | //qDebug(" not loc changed "); |
2746 | lastSync = localMod.addDays( 1 ); | 2746 | lastSync = localMod.addDays( 1 ); |
2747 | if ( remCh ) { | 2747 | if ( remCh ) { |
2748 | //qDebug("rem changed "); | 2748 | //qDebug("rem changed "); |
2749 | remoteMod =( lastSync.addDays( 1 ) ); | 2749 | remoteMod =( lastSync.addDays( 1 ) ); |
2750 | } | 2750 | } |
2751 | 2751 | ||
2752 | } | 2752 | } |
2753 | } | 2753 | } |
2754 | full = true; | 2754 | full = true; |
2755 | if ( mode < SYNC_PREF_ASK ) | 2755 | if ( mode < SYNC_PREF_ASK ) |
2756 | mode = SYNC_PREF_ASK; | 2756 | mode = SYNC_PREF_ASK; |
2757 | } else { | 2757 | } else { |
2758 | if ( localMod == remoteMod ) | 2758 | if ( localMod == remoteMod ) |
2759 | return 0; | 2759 | return 0; |
2760 | 2760 | ||
2761 | } | 2761 | } |
2762 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); | 2762 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); |
2763 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); | 2763 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); |
2764 | //full = true; //debug only | 2764 | //full = true; //debug only |
2765 | if ( full ) { | 2765 | if ( full ) { |
2766 | bool equ = ( (*local) == (*remote) ); | 2766 | bool equ = ( (*local) == (*remote) ); |
2767 | if ( equ ) { | 2767 | if ( equ ) { |
2768 | //qDebug("equal "); | 2768 | //qDebug("equal "); |
2769 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2769 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2770 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2770 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2771 | } | 2771 | } |
2772 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2772 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2773 | return 0; | 2773 | return 0; |
2774 | 2774 | ||
2775 | }//else //debug only | 2775 | }//else //debug only |
2776 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 2776 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
2777 | } | 2777 | } |
2778 | int result; | 2778 | int result; |
2779 | bool localIsNew; | 2779 | bool localIsNew; |
2780 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); | 2780 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); |
2781 | 2781 | ||
2782 | if ( full && mode < SYNC_PREF_NEWEST ) | 2782 | if ( full && mode < SYNC_PREF_NEWEST ) |
2783 | mode = SYNC_PREF_ASK; | 2783 | mode = SYNC_PREF_ASK; |
2784 | 2784 | ||
2785 | switch( mode ) { | 2785 | switch( mode ) { |
2786 | case SYNC_PREF_LOCAL: | 2786 | case SYNC_PREF_LOCAL: |
2787 | if ( lastSync > remoteMod ) | 2787 | if ( lastSync > remoteMod ) |
2788 | return 1; | 2788 | return 1; |
2789 | if ( lastSync > localMod ) | 2789 | if ( lastSync > localMod ) |
2790 | return 2; | 2790 | return 2; |
2791 | return 1; | 2791 | return 1; |
2792 | break; | 2792 | break; |
2793 | case SYNC_PREF_REMOTE: | 2793 | case SYNC_PREF_REMOTE: |
2794 | if ( lastSync > remoteMod ) | 2794 | if ( lastSync > remoteMod ) |
2795 | return 1; | 2795 | return 1; |
2796 | if ( lastSync > localMod ) | 2796 | if ( lastSync > localMod ) |
2797 | return 2; | 2797 | return 2; |
2798 | return 2; | 2798 | return 2; |
2799 | break; | 2799 | break; |
2800 | case SYNC_PREF_NEWEST: | 2800 | case SYNC_PREF_NEWEST: |
2801 | if ( localMod > remoteMod ) | 2801 | if ( localMod > remoteMod ) |
2802 | return 1; | 2802 | return 1; |
2803 | else | 2803 | else |
2804 | return 2; | 2804 | return 2; |
2805 | break; | 2805 | break; |
2806 | case SYNC_PREF_ASK: | 2806 | case SYNC_PREF_ASK: |
2807 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 2807 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
2808 | if ( lastSync > remoteMod ) | 2808 | if ( lastSync > remoteMod ) |
2809 | return 1; | 2809 | return 1; |
2810 | if ( lastSync > localMod ) { | 2810 | if ( lastSync > localMod ) { |
2811 | return 2; | 2811 | return 2; |
2812 | } | 2812 | } |
2813 | localIsNew = localMod >= remoteMod; | 2813 | localIsNew = localMod >= remoteMod; |
2814 | //qDebug("conflict! ************************************** "); | 2814 | //qDebug("conflict! ************************************** "); |
2815 | { | 2815 | { |
2816 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2816 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2817 | result = acd.executeD(localIsNew); | 2817 | result = acd.executeD(localIsNew); |
2818 | return result; | 2818 | return result; |
2819 | } | 2819 | } |
2820 | break; | 2820 | break; |
2821 | case SYNC_PREF_FORCE_LOCAL: | 2821 | case SYNC_PREF_FORCE_LOCAL: |
2822 | return 1; | 2822 | return 1; |
2823 | break; | 2823 | break; |
2824 | case SYNC_PREF_FORCE_REMOTE: | 2824 | case SYNC_PREF_FORCE_REMOTE: |
2825 | return 2; | 2825 | return 2; |
2826 | break; | 2826 | break; |
2827 | 2827 | ||
2828 | default: | 2828 | default: |
2829 | // SYNC_PREF_TAKE_BOTH not implemented | 2829 | // SYNC_PREF_TAKE_BOTH not implemented |
2830 | break; | 2830 | break; |
2831 | } | 2831 | } |
2832 | return 0; | 2832 | return 0; |
2833 | } | 2833 | } |
2834 | 2834 | ||
2835 | 2835 | ||
2836 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 2836 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
2837 | { | 2837 | { |
2838 | bool syncOK = true; | 2838 | bool syncOK = true; |
2839 | int addedAddressee = 0; | 2839 | int addedAddressee = 0; |
2840 | int addedAddresseeR = 0; | 2840 | int addedAddresseeR = 0; |
2841 | int deletedAddresseeR = 0; | 2841 | int deletedAddresseeR = 0; |
2842 | int deletedAddresseeL = 0; | 2842 | int deletedAddresseeL = 0; |
2843 | int changedLocal = 0; | 2843 | int changedLocal = 0; |
2844 | int changedRemote = 0; | 2844 | int changedRemote = 0; |
2845 | int filteredIN = 0; | 2845 | int filteredIN = 0; |
2846 | int filteredOUT = 0; | 2846 | int filteredOUT = 0; |
2847 | 2847 | ||
2848 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2848 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2849 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2849 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2850 | 2850 | ||
2851 | //QPtrList<Addressee> el = local->rawAddressees(); | 2851 | //QPtrList<Addressee> el = local->rawAddressees(); |
2852 | Addressee addresseeR; | 2852 | Addressee addresseeR; |
2853 | QString uid; | 2853 | QString uid; |
2854 | int take; | 2854 | int take; |
2855 | Addressee addresseeL; | 2855 | Addressee addresseeL; |
2856 | Addressee addresseeRSync; | 2856 | Addressee addresseeRSync; |
2857 | Addressee addresseeLSync; | 2857 | Addressee addresseeLSync; |
2858 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2858 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2859 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2859 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2860 | bool fullDateRange = false; | 2860 | bool fullDateRange = false; |
2861 | local->resetTempSyncStat(); | 2861 | local->resetTempSyncStat(); |
2862 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2862 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2863 | if ( syncManager->syncWithDesktop() ) { | 2863 | if ( syncManager->syncWithDesktop() ) { |
2864 | // remote->removeSyncInfo( QString());//remove all info | 2864 | // remote->removeSyncInfo( QString());//remove all info |
2865 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 2865 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
2866 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | 2866 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; |
2867 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | 2867 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); |
2868 | } else { | 2868 | } else { |
2869 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); | 2869 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); |
2870 | } | 2870 | } |
2871 | } | 2871 | } |
2872 | QDateTime modifiedCalendar = mLastAddressbookSync; | 2872 | QDateTime modifiedCalendar = mLastAddressbookSync; |
2873 | addresseeLSync = getLastSyncAddressee(); | 2873 | addresseeLSync = getLastSyncAddressee(); |
2874 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2874 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2875 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2875 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2876 | if ( !addresseeR.isEmpty() ) { | 2876 | if ( !addresseeR.isEmpty() ) { |
2877 | addresseeRSync = addresseeR; | 2877 | addresseeRSync = addresseeR; |
2878 | remote->removeAddressee(addresseeR ); | 2878 | remote->removeAddressee(addresseeR ); |
2879 | 2879 | ||
2880 | } else { | 2880 | } else { |
2881 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2881 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2882 | addresseeRSync = addresseeLSync ; | 2882 | addresseeRSync = addresseeLSync ; |
2883 | } else { | 2883 | } else { |
2884 | //qDebug("FULLDATE 1"); | 2884 | //qDebug("FULLDATE 1"); |
2885 | fullDateRange = true; | 2885 | fullDateRange = true; |
2886 | Addressee newAdd; | 2886 | Addressee newAdd; |
2887 | addresseeRSync = newAdd; | 2887 | addresseeRSync = newAdd; |
2888 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2888 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
2889 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 2889 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
2890 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2890 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2891 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 2891 | addresseeRSync.setCategories( i18n("SyncAddressee") ); |
2892 | } | 2892 | } |
2893 | } | 2893 | } |
2894 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 2894 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
2895 | // qDebug("FULLDATE 2"); | 2895 | // qDebug("FULLDATE 2"); |
2896 | fullDateRange = true; | 2896 | fullDateRange = true; |
2897 | } | 2897 | } |
2898 | if ( ! fullDateRange ) { | 2898 | if ( ! fullDateRange ) { |
2899 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 2899 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
2900 | 2900 | ||
2901 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 2901 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
2902 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 2902 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
2903 | fullDateRange = true; | 2903 | fullDateRange = true; |
2904 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 2904 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2905 | } | 2905 | } |
2906 | } | 2906 | } |
2907 | // fullDateRange = true; // debug only! | 2907 | // fullDateRange = true; // debug only! |
2908 | if ( fullDateRange ) | 2908 | if ( fullDateRange ) |
2909 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 2909 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
2910 | else | 2910 | else |
2911 | mLastAddressbookSync = addresseeLSync.revision(); | 2911 | mLastAddressbookSync = addresseeLSync.revision(); |
2912 | // for resyncing if own file has changed | 2912 | // for resyncing if own file has changed |
2913 | // PENDING fixme later when implemented | 2913 | // PENDING fixme later when implemented |
2914 | #if 0 | 2914 | #if 0 |
2915 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 2915 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
2916 | mLastAddressbookSync = loadedFileVersion; | 2916 | mLastAddressbookSync = loadedFileVersion; |
2917 | qDebug("setting mLastAddressbookSync "); | 2917 | qDebug("setting mLastAddressbookSync "); |
2918 | } | 2918 | } |
2919 | #endif | 2919 | #endif |
2920 | 2920 | ||
2921 | 2921 | ||
2922 | // ********** setting filters **************** | 2922 | // ********** setting filters **************** |
2923 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); | 2923 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); |
2924 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); | 2924 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); |
2925 | 2925 | ||
2926 | //qDebug("*************************** "); | 2926 | //qDebug("*************************** "); |
2927 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 2927 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
2928 | QStringList er = remote->uidList(); | 2928 | QStringList er = remote->uidList(); |
2929 | Addressee inR ;//= er.first(); | 2929 | Addressee inR ;//= er.first(); |
2930 | Addressee inL; | 2930 | Addressee inL; |
2931 | 2931 | ||
2932 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 2932 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
2933 | 2933 | ||
2934 | int modulo = (er.count()/10)+1; | 2934 | int modulo = (er.count()/10)+1; |
2935 | int incCounter = 0; | 2935 | int incCounter = 0; |
2936 | while ( incCounter < er.count()) { | 2936 | while ( incCounter < er.count()) { |
2937 | if (syncManager->isProgressBarCanceled()) | 2937 | if (syncManager->isProgressBarCanceled()) |
2938 | return false; | 2938 | return false; |
2939 | if ( incCounter % modulo == 0 ) | 2939 | if ( incCounter % modulo == 0 ) |
2940 | syncManager->showProgressBar(incCounter); | 2940 | syncManager->showProgressBar(incCounter); |
2941 | 2941 | ||
2942 | uid = er[ incCounter ]; | 2942 | uid = er[ incCounter ]; |
2943 | bool skipIncidence = false; | 2943 | bool skipIncidence = false; |
2944 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2944 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2945 | skipIncidence = true; | 2945 | skipIncidence = true; |
2946 | QString idS,OidS; | 2946 | QString idS,OidS; |
2947 | qApp->processEvents(); | 2947 | qApp->processEvents(); |
2948 | if ( !skipIncidence ) { | 2948 | if ( !skipIncidence ) { |
2949 | inL = local->findByUid( uid ); | 2949 | inL = local->findByUid( uid ); |
2950 | inR = remote->findByUid( uid ); | 2950 | inR = remote->findByUid( uid ); |
2951 | //inL.setResource( 0 ); | 2951 | //inL.setResource( 0 ); |
2952 | //inR.setResource( 0 ); | 2952 | //inR.setResource( 0 ); |
2953 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 2953 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
2954 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2954 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2955 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { | 2955 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { |
2956 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2956 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2957 | if ( take == 3 ) | 2957 | if ( take == 3 ) |
2958 | return false; | 2958 | return false; |
2959 | if ( take == 1 ) {// take local ********************** | 2959 | if ( take == 1 ) {// take local ********************** |
2960 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2960 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2961 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2961 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2962 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2962 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2963 | local->insertAddressee( inL, false ); | 2963 | local->insertAddressee( inL, false ); |
2964 | idS = inR.externalUID(); | 2964 | idS = inR.externalUID(); |
2965 | OidS = inR.originalExternalUID(); | 2965 | OidS = inR.originalExternalUID(); |
2966 | } | 2966 | } |
2967 | else | 2967 | else |
2968 | idS = inR.IDStr(); | 2968 | idS = inR.IDStr(); |
2969 | remote->removeAddressee( inR ); | 2969 | remote->removeAddressee( inR ); |
2970 | inR = inL; | 2970 | inR = inL; |
2971 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2971 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2972 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2972 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2973 | inR.setOriginalExternalUID( OidS ); | 2973 | inR.setOriginalExternalUID( OidS ); |
2974 | inR.setExternalUID( idS ); | 2974 | inR.setExternalUID( idS ); |
2975 | if ( syncManager->syncWithDesktop() ) { | 2975 | if ( syncManager->syncWithDesktop() ) { |
2976 | inR.setIDStr("changed" ); | 2976 | inR.setIDStr("changed" ); |
2977 | } | 2977 | } |
2978 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | 2978 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); |
2979 | } else { | 2979 | } else { |
2980 | inR.setIDStr( idS ); | 2980 | inR.setIDStr( idS ); |
2981 | } | 2981 | } |
2982 | inR.setResource( 0 ); | 2982 | inR.setResource( 0 ); |
2983 | remote->insertAddressee( inR , false); | 2983 | remote->insertAddressee( inR , false); |
2984 | ++changedRemote; | 2984 | ++changedRemote; |
2985 | } else { // take == 2 take remote ********************** | 2985 | } else { // take == 2 take remote ********************** |
2986 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2986 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2987 | if ( inR.revision().date().year() < 2004 ) | 2987 | if ( inR.revision().date().year() < 2004 ) |
2988 | inR.setRevision( modifiedCalendar ); | 2988 | inR.setRevision( modifiedCalendar ); |
2989 | } | 2989 | } |
2990 | idS = inL.IDStr(); | 2990 | idS = inL.IDStr(); |
2991 | local->removeAddressee( inL ); | 2991 | local->removeAddressee( inL ); |
2992 | inL = inR; | 2992 | inL = inR; |
2993 | inL.setIDStr( idS ); | 2993 | inL.setIDStr( idS ); |
2994 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2994 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2995 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2995 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2996 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2996 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2997 | } | 2997 | } |
2998 | inL.setResource( 0 ); | 2998 | inL.setResource( 0 ); |
2999 | local->insertAddressee( inL , false ); | 2999 | local->insertAddressee( inL , false ); |
3000 | ++changedLocal; | 3000 | ++changedLocal; |
3001 | } | 3001 | } |
3002 | } | 3002 | } |
3003 | } | 3003 | } |
3004 | } else { // no conflict ********** add or delete remote | 3004 | } else { // no conflict ********** add or delete remote |
3005 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { | 3005 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { |
3006 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3006 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3007 | QString des = addresseeLSync.note(); | 3007 | QString des = addresseeLSync.note(); |
3008 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 3008 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
3009 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 3009 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
3010 | remote->insertAddressee( inR, false ); | 3010 | remote->insertAddressee( inR, false ); |
3011 | ++deletedAddresseeR; | 3011 | ++deletedAddresseeR; |
3012 | } else { | 3012 | } else { |
3013 | inR.setRevision( modifiedCalendar ); | 3013 | inR.setRevision( modifiedCalendar ); |
3014 | remote->insertAddressee( inR, false ); | 3014 | remote->insertAddressee( inR, false ); |
3015 | inL = inR; | 3015 | inL = inR; |
3016 | inL.setIDStr( ":" ); | 3016 | inL.setIDStr( ":" ); |
3017 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3017 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3018 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3018 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3019 | inL.setResource( 0 ); | 3019 | inL.setResource( 0 ); |
3020 | local->insertAddressee( inL , false); | 3020 | local->insertAddressee( inL , false); |
3021 | ++addedAddressee; | 3021 | ++addedAddressee; |
3022 | } | 3022 | } |
3023 | } else { | 3023 | } else { |
3024 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 3024 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
3025 | inR.setRevision( modifiedCalendar ); | 3025 | inR.setRevision( modifiedCalendar ); |
3026 | remote->insertAddressee( inR, false ); | 3026 | remote->insertAddressee( inR, false ); |
3027 | inR.setResource( 0 ); | 3027 | inR.setResource( 0 ); |
3028 | local->insertAddressee( inR, false ); | 3028 | local->insertAddressee( inR, false ); |
3029 | ++addedAddressee; | 3029 | ++addedAddressee; |
3030 | } else { | 3030 | } else { |
3031 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 3031 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
3032 | remote->removeAddressee( inR ); | 3032 | remote->removeAddressee( inR ); |
3033 | ++deletedAddresseeR; | 3033 | ++deletedAddresseeR; |
3034 | } | 3034 | } |
3035 | } | 3035 | } |
3036 | } else { | 3036 | } else { |
3037 | ++filteredIN; | 3037 | ++filteredIN; |
3038 | } | 3038 | } |
3039 | } | 3039 | } |
3040 | } | 3040 | } |
3041 | ++incCounter; | 3041 | ++incCounter; |
3042 | } | 3042 | } |
3043 | er.clear(); | 3043 | er.clear(); |
3044 | QStringList el = local->uidList(); | 3044 | QStringList el = local->uidList(); |
3045 | modulo = (el.count()/10)+1; | 3045 | modulo = (el.count()/10)+1; |
3046 | 3046 | ||
3047 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 3047 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
3048 | incCounter = 0; | 3048 | incCounter = 0; |
3049 | while ( incCounter < el.count()) { | 3049 | while ( incCounter < el.count()) { |
3050 | qApp->processEvents(); | 3050 | qApp->processEvents(); |
3051 | if (syncManager->isProgressBarCanceled()) | 3051 | if (syncManager->isProgressBarCanceled()) |
3052 | return false; | 3052 | return false; |
3053 | if ( incCounter % modulo == 0 ) | 3053 | if ( incCounter % modulo == 0 ) |
3054 | syncManager->showProgressBar(incCounter); | 3054 | syncManager->showProgressBar(incCounter); |
3055 | uid = el[ incCounter ]; | 3055 | uid = el[ incCounter ]; |
3056 | bool skipIncidence = false; | 3056 | bool skipIncidence = false; |
3057 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3057 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
3058 | skipIncidence = true; | 3058 | skipIncidence = true; |
3059 | if ( !skipIncidence ) { | 3059 | if ( !skipIncidence ) { |
3060 | inL = local->findByUid( uid ); | 3060 | inL = local->findByUid( uid ); |
3061 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3061 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3062 | inR = remote->findByUid( uid ); | 3062 | inR = remote->findByUid( uid ); |
3063 | if ( inR.isEmpty() ){ | 3063 | if ( inR.isEmpty() ){ |
3064 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { | 3064 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { |
3065 | // no conflict ********** add or delete local | 3065 | // no conflict ********** add or delete local |
3066 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3066 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3067 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 3067 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
3068 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 3068 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
3069 | local->removeAddressee( inL ); | 3069 | local->removeAddressee( inL ); |
3070 | ++deletedAddresseeL; | 3070 | ++deletedAddresseeL; |
3071 | } else { | 3071 | } else { |
3072 | if ( ! syncManager->mWriteBackExistingOnly ) { | 3072 | if ( ! syncManager->mWriteBackExistingOnly ) { |
3073 | inL.removeID(mCurrentSyncDevice ); | 3073 | inL.removeID(mCurrentSyncDevice ); |
3074 | ++addedAddresseeR; | 3074 | ++addedAddresseeR; |
3075 | inL.setRevision( modifiedCalendar ); | 3075 | inL.setRevision( modifiedCalendar ); |
3076 | local->insertAddressee( inL, false ); | 3076 | local->insertAddressee( inL, false ); |
3077 | inR = inL; | 3077 | inR = inL; |
3078 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 3078 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
3079 | inR.setResource( 0 ); | 3079 | inR.setResource( 0 ); |
3080 | remote->insertAddressee( inR, false ); | 3080 | remote->insertAddressee( inR, false ); |
3081 | } | 3081 | } |
3082 | } | 3082 | } |
3083 | } else { | 3083 | } else { |
3084 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 3084 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
3085 | //qDebug("data %s ", inL.revision().toString().latin1()); | 3085 | //qDebug("data %s ", inL.revision().toString().latin1()); |
3086 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 3086 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
3087 | local->removeAddressee( inL ); | 3087 | local->removeAddressee( inL ); |
3088 | ++deletedAddresseeL; | 3088 | ++deletedAddresseeL; |
3089 | } else { | 3089 | } else { |
3090 | if ( ! syncManager->mWriteBackExistingOnly ) { | 3090 | if ( ! syncManager->mWriteBackExistingOnly ) { |
3091 | ++addedAddresseeR; | 3091 | ++addedAddresseeR; |
3092 | inL.setRevision( modifiedCalendar ); | 3092 | inL.setRevision( modifiedCalendar ); |
3093 | local->insertAddressee( inL, false ); | 3093 | local->insertAddressee( inL, false ); |
3094 | inR = inL; | 3094 | inR = inL; |
3095 | inR.setIDStr( ":" ); | 3095 | inR.setIDStr( ":" ); |
3096 | inR.setResource( 0 ); | 3096 | inR.setResource( 0 ); |
3097 | remote->insertAddressee( inR, false ); | 3097 | remote->insertAddressee( inR, false ); |
3098 | } | 3098 | } |
3099 | } | 3099 | } |
3100 | } | 3100 | } |
3101 | } else { | 3101 | } else { |
3102 | ++filteredOUT; | 3102 | ++filteredOUT; |
3103 | } | 3103 | } |
3104 | } | 3104 | } |
3105 | } | 3105 | } |
3106 | } | 3106 | } |
3107 | ++incCounter; | 3107 | ++incCounter; |
3108 | } | 3108 | } |
3109 | el.clear(); | 3109 | el.clear(); |
3110 | syncManager->hideProgressBar(); | 3110 | syncManager->hideProgressBar(); |
3111 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 3111 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
3112 | // get rid of micro seconds | 3112 | // get rid of micro seconds |
3113 | QTime t = mLastAddressbookSync.time(); | 3113 | QTime t = mLastAddressbookSync.time(); |
3114 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 3114 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
3115 | addresseeLSync.setRevision( mLastAddressbookSync ); | 3115 | addresseeLSync.setRevision( mLastAddressbookSync ); |
3116 | addresseeRSync.setRevision( mLastAddressbookSync ); | 3116 | addresseeRSync.setRevision( mLastAddressbookSync ); |
3117 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 3117 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
3118 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 3118 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
3119 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 3119 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
3120 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 3120 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
3121 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 3121 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
3122 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 3122 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
3123 | addresseeRSync.setNote( "" ) ; | 3123 | addresseeRSync.setNote( "" ) ; |
3124 | addresseeLSync.setNote( "" ); | 3124 | addresseeLSync.setNote( "" ); |
3125 | 3125 | ||
3126 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 3126 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
3127 | remote->insertAddressee( addresseeRSync, false ); | 3127 | remote->insertAddressee( addresseeRSync, false ); |
3128 | local->insertAddressee( addresseeLSync, false ); | 3128 | local->insertAddressee( addresseeLSync, false ); |
3129 | QString mes; | 3129 | QString mes; |
3130 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); | 3130 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); |
3131 | qDebug( mes ); | 3131 | qDebug( mes ); |
3132 | mes = i18n("Local addressbook changed!\n") +mes; | 3132 | mes = i18n("Local addressbook changed!\n") +mes; |
3133 | if ( syncManager->mShowSyncSummary ) { | 3133 | if ( syncManager->mShowSyncSummary ) { |
3134 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 3134 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
3135 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { | 3135 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { |
3136 | qDebug("KA: WB cancelled "); | 3136 | qDebug("KA: WB cancelled "); |
3137 | syncManager->mWriteBackFile = false; | 3137 | syncManager->mWriteBackFile = false; |
3138 | return syncOK; | 3138 | return syncOK; |
3139 | } | 3139 | } |
3140 | } | 3140 | } |
3141 | return syncOK; | 3141 | return syncOK; |
3142 | } | 3142 | } |
3143 | 3143 | ||
3144 | 3144 | ||
3145 | //this is a overwritten callbackmethods from the syncinterface | 3145 | //this is a overwritten callbackmethods from the syncinterface |
3146 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3146 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
3147 | { | 3147 | { |
3148 | 3148 | ||
3149 | //pending prepare addresseeview for output | 3149 | //pending prepare addresseeview for output |
3150 | //pending detect, if remote file has REV field. if not switch to external sync | 3150 | //pending detect, if remote file has REV field. if not switch to external sync |
3151 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3151 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3152 | if ( manager != syncManager ) | 3152 | if ( manager != syncManager ) |
3153 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); | 3153 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); |
3154 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3154 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3155 | 3155 | ||
3156 | AddressBook abLocal(filename,"syncContact"); | 3156 | AddressBook abLocal(filename,"syncContact"); |
3157 | bool syncOK = false; | 3157 | bool syncOK = false; |
3158 | if ( abLocal.load() ) { | 3158 | if ( abLocal.load() ) { |
3159 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); | 3159 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); |
3160 | bool external = false; | 3160 | bool external = false; |
3161 | bool isXML = false; | 3161 | bool isXML = false; |
3162 | if ( filename.right(4) == ".xml") { | 3162 | if ( filename.right(4) == ".xml") { |
3163 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3163 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3164 | isXML = true; | 3164 | isXML = true; |
3165 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3165 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3166 | } else { | 3166 | } else { |
3167 | external = !manager->mIsKapiFile; | 3167 | external = !manager->mIsKapiFile; |
3168 | if ( external ) { | 3168 | if ( external ) { |
3169 | qDebug("KA: Sync::Setting vcf mode to external "); | 3169 | qDebug("KA: Sync::Setting vcf mode to external "); |
3170 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3170 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3171 | AddressBook::Iterator it; | 3171 | AddressBook::Iterator it; |
3172 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3172 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3173 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3173 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3174 | (*it).computeCsum( mCurrentSyncDevice ); | 3174 | (*it).computeCsum( mCurrentSyncDevice ); |
3175 | } | 3175 | } |
3176 | } | 3176 | } |
3177 | } | 3177 | } |
3178 | //AddressBook::Iterator it; | 3178 | //AddressBook::Iterator it; |
3179 | //QStringList vcards; | 3179 | //QStringList vcards; |
3180 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3180 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3181 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3181 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3182 | //} | 3182 | //} |
3183 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3183 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3184 | if ( syncOK ) { | 3184 | if ( syncOK ) { |
3185 | if ( syncManager->mWriteBackFile ) | 3185 | if ( syncManager->mWriteBackFile ) |
3186 | { | 3186 | { |
3187 | if ( external ) | 3187 | if ( external ) |
3188 | abLocal.removeSyncAddressees( !isXML); | 3188 | abLocal.removeSyncAddressees( !isXML); |
3189 | qDebug("KA: Sync::Saving remote AB "); | 3189 | qDebug("KA: Sync::Saving remote AB "); |
3190 | if ( ! abLocal.saveAB()) | 3190 | if ( ! abLocal.saveAB()) |
3191 | qDebug("KA: sync::Error writing back AB to file "); | 3191 | qDebug("KA: sync::Error writing back AB to file "); |
3192 | if ( external ) { | 3192 | if ( external ) { |
3193 | // afterwrite processing | 3193 | // afterwrite processing |
3194 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 3194 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
3195 | } | 3195 | } |
3196 | } | 3196 | } |
3197 | } | 3197 | } |
3198 | setModified(); | 3198 | setModified(); |
3199 | 3199 | ||
3200 | } | 3200 | } |
3201 | abLocal.removeResources(); | 3201 | abLocal.removeResources(); |
3202 | if ( syncOK ) | 3202 | if ( syncOK ) |
3203 | mViewManager->refreshView(); | 3203 | mViewManager->refreshView(); |
3204 | return syncOK; | 3204 | return syncOK; |
3205 | 3205 | ||
3206 | } | 3206 | } |
3207 | void KABCore::removeSyncInfo( QString syncProfile) | 3207 | void KABCore::removeSyncInfo( QString syncProfile) |
3208 | { | 3208 | { |
3209 | qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 3209 | qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
3210 | mAddressBook->removeSyncInfo( syncProfile ); | 3210 | mAddressBook->removeSyncInfo( syncProfile ); |
3211 | setModified(); | 3211 | setModified(); |
3212 | } | 3212 | } |
3213 | 3213 | ||
3214 | 3214 | ||
3215 | //this is a overwritten callbackmethods from the syncinterface | 3215 | //this is a overwritten callbackmethods from the syncinterface |
3216 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 3216 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
3217 | { | 3217 | { |
3218 | if ( resource == "phone" ) | 3218 | if ( resource == "phone" ) |
3219 | return syncPhone(); | 3219 | return syncPhone(); |
3220 | disableBR( true ); | 3220 | disableBR( true ); |
3221 | if ( manager != syncManager ) | 3221 | if ( manager != syncManager ) |
3222 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); | 3222 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); |
3223 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3223 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3224 | 3224 | ||
3225 | AddressBook abLocal( resource,"syncContact"); | 3225 | AddressBook abLocal( resource,"syncContact"); |
3226 | bool syncOK = false; | 3226 | bool syncOK = false; |
3227 | message(i18n("Loading DTM address data..."), false); | 3227 | message(i18n("Loading DTM address data..."), false); |
3228 | if ( abLocal.load() ) { | 3228 | if ( abLocal.load() ) { |
3229 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3229 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3230 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3230 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3231 | message(i18n("Sync preprocessing..."),false); | 3231 | message(i18n("Sync preprocessing..."),false); |
3232 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 3232 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
3233 | message(i18n("Synchronizing..."),false); | 3233 | message(i18n("Synchronizing..."),false); |
3234 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3234 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3235 | if ( syncOK ) { | 3235 | if ( syncOK ) { |
3236 | if ( syncManager->mWriteBackFile ) { | 3236 | if ( syncManager->mWriteBackFile ) { |
3237 | abLocal.removeSyncAddressees( false ); | 3237 | abLocal.removeSyncAddressees( false ); |
3238 | message(i18n("Saving DTM address data..."),false); | 3238 | message(i18n("Saving DTM address data..."),false); |
3239 | abLocal.saveAB(); | 3239 | abLocal.saveAB(); |
3240 | message(i18n("Sync postprocessing..."),false); | 3240 | message(i18n("Sync postprocessing..."),false); |
3241 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3241 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3242 | } | 3242 | } |
3243 | } else | 3243 | } else |
3244 | message( i18n("Sync cancelled or failed.") ); | 3244 | message( i18n("Sync cancelled or failed.") ); |
3245 | setModified(); | 3245 | setModified(); |
3246 | } | 3246 | } |
3247 | abLocal.removeResources(); | 3247 | abLocal.removeResources(); |
3248 | if ( syncOK ) { | 3248 | if ( syncOK ) { |
3249 | mViewManager->refreshView(); | 3249 | mViewManager->refreshView(); |
3250 | message(i18n("DTM syncing finished.")); | 3250 | message(i18n("DTM syncing finished.")); |
3251 | } | 3251 | } |
3252 | disableBR( false ); | 3252 | disableBR( false ); |
3253 | return syncOK; | 3253 | return syncOK; |
3254 | 3254 | ||
3255 | } | 3255 | } |
3256 | void KABCore::message( QString m, bool startTimer) | 3256 | void KABCore::message( QString m, bool startTimer) |
3257 | { | 3257 | { |
3258 | topLevelWidget()->setCaption( m ); | 3258 | topLevelWidget()->setCaption( m ); |
3259 | qApp->processEvents(); | 3259 | qApp->processEvents(); |
3260 | if ( startTimer ) | 3260 | if ( startTimer ) |
3261 | mMessageTimer->start( 15000, true ); | 3261 | mMessageTimer->start( 15000, true ); |
3262 | else | 3262 | else |
3263 | mMessageTimer->stop(); | 3263 | mMessageTimer->stop(); |
3264 | } | 3264 | } |
3265 | bool KABCore::syncPhone() | 3265 | bool KABCore::syncPhone() |
3266 | { | 3266 | { |
3267 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3267 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3268 | QString fileName = getPhoneFile(); | 3268 | QString fileName = getPhoneFile(); |
3269 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 3269 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
3270 | message(i18n("Phone access failed!")); | 3270 | message(i18n("Phone access failed!")); |
3271 | return false; | 3271 | return false; |
3272 | } | 3272 | } |
3273 | AddressBook abLocal( fileName,"syncContact"); | 3273 | AddressBook abLocal( fileName,"syncContact"); |
3274 | bool syncOK = false; | 3274 | bool syncOK = false; |
3275 | { | 3275 | { |
3276 | abLocal.importFromFile( fileName ); | 3276 | abLocal.importFromFile( fileName ); |
3277 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3277 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3278 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3278 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3279 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3279 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3280 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3280 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3281 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3281 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3282 | if ( syncOK ) { | 3282 | if ( syncOK ) { |
3283 | if ( syncManager->mWriteBackFile ) { | 3283 | if ( syncManager->mWriteBackFile ) { |
3284 | abLocal.removeSyncAddressees( true ); | 3284 | abLocal.removeSyncAddressees( true ); |
3285 | abLocal.saveABphone( fileName ); | 3285 | abLocal.saveABphone( fileName ); |
3286 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3286 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3287 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3287 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3288 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3288 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3289 | } | 3289 | } |
3290 | } | 3290 | } |
3291 | setModified(); | 3291 | setModified(); |
3292 | } | 3292 | } |
3293 | abLocal.removeResources(); | 3293 | abLocal.removeResources(); |
3294 | if ( syncOK ) | 3294 | if ( syncOK ) |
3295 | mViewManager->refreshView(); | 3295 | mViewManager->refreshView(); |
3296 | return syncOK; | 3296 | return syncOK; |
3297 | } | 3297 | } |
3298 | void KABCore::getFile( bool success ) | 3298 | void KABCore::getFile( bool success ) |
3299 | { | 3299 | { |
3300 | if ( ! success ) { | 3300 | if ( ! success ) { |
3301 | message( i18n("Error receiving file. Nothing changed!") ); | 3301 | message( i18n("Error receiving file. Nothing changed!") ); |
3302 | return; | 3302 | return; |
3303 | } | 3303 | } |
3304 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3304 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3305 | if ( count ) | 3305 | if ( count ) |
3306 | setModified( true ); | 3306 | setModified( true ); |
3307 | message( i18n("Pi-Sync successful!") ); | 3307 | message( i18n("Pi-Sync successful!") ); |
3308 | mViewManager->refreshView(); | 3308 | mViewManager->refreshView(); |
3309 | } | 3309 | } |
3310 | void KABCore::syncFileRequest() | 3310 | void KABCore::syncFileRequest() |
3311 | { | 3311 | { |
3312 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3312 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3313 | syncManager->slotSyncMenu( 999 ); | 3313 | syncManager->slotSyncMenu( 999 ); |
3314 | } | 3314 | } |
3315 | mAddressBook->export2File( sentSyncFile() ); | 3315 | mAddressBook->export2File( sentSyncFile() ); |
3316 | } | 3316 | } |
3317 | QString KABCore::sentSyncFile() | 3317 | QString KABCore::sentSyncFile() |
3318 | { | 3318 | { |
3319 | #ifdef DESKTOP_VERSION | 3319 | #ifdef DESKTOP_VERSION |
3320 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3320 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3321 | #else | 3321 | #else |
3322 | return QString( "/tmp/copysyncab.vcf" ); | 3322 | return QString( "/tmp/copysyncab.vcf" ); |
3323 | #endif | 3323 | #endif |
3324 | } | 3324 | } |
3325 | 3325 | ||
3326 | void KABCore::setCaptionBack() | 3326 | void KABCore::setCaptionBack() |
3327 | { | 3327 | { |
3328 | mMessageTimer->stop(); | 3328 | mMessageTimer->stop(); |
3329 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 3329 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
3330 | } | 3330 | } |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 70f00c6..6559119 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -1,499 +1,502 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@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 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | #include <qapp.h> | 22 | #include <qapp.h> |
23 | 23 | ||
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include "kotodoviewitem.h" | 25 | #include "kotodoviewitem.h" |
26 | #include "kotodoview.h" | 26 | #include "kotodoview.h" |
27 | #include "koprefs.h" | 27 | #include "koprefs.h" |
28 | 28 | ||
29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) | 29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) |
30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
31 | { | 31 | { |
32 | construct(); | 32 | construct(); |
33 | } | 33 | } |
34 | 34 | ||
35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) | 35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) |
36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
37 | { | 37 | { |
38 | construct(); | 38 | construct(); |
39 | } | 39 | } |
40 | 40 | ||
41 | QString KOTodoViewItem::key(int column,bool) const | 41 | QString KOTodoViewItem::key(int column,bool) const |
42 | { | 42 | { |
43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
44 | if (it == mKeyMap.end()) { | 44 | if (it == mKeyMap.end()) { |
45 | return text(column).lower(); | 45 | return text(column).lower(); |
46 | } else { | 46 | } else { |
47 | return *it; | 47 | return *it; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | void KOTodoViewItem:: setup() | 51 | void KOTodoViewItem:: setup() |
52 | { | 52 | { |
53 | 53 | ||
54 | int h = 20; | 54 | int h = 20; |
55 | if ( listView () ) { | 55 | if ( listView () ) { |
56 | QFontMetrics fm ( listView ()->font () ); | 56 | QFontMetrics fm ( listView ()->font () ); |
57 | h = fm.height(); | 57 | h = fm.height(); |
58 | } | 58 | } |
59 | setHeight( h ); | 59 | setHeight( h ); |
60 | 60 | ||
61 | } | 61 | } |
62 | void KOTodoViewItem::setSortKey(int column,const QString &key) | 62 | void KOTodoViewItem::setSortKey(int column,const QString &key) |
63 | { | 63 | { |
64 | mKeyMap.insert(column,key); | 64 | mKeyMap.insert(column,key); |
65 | } | 65 | } |
66 | 66 | ||
67 | #if QT_VERSION >= 0x030000 | 67 | #if QT_VERSION >= 0x030000 |
68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
69 | int y,int h) | 69 | int y,int h) |
70 | { | 70 | { |
71 | QListViewItem::paintBranches(p,cg,w,y,h); | 71 | QListViewItem::paintBranches(p,cg,w,y,h); |
72 | } | 72 | } |
73 | #else | 73 | #else |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | void KOTodoViewItem::construct() | 76 | void KOTodoViewItem::construct() |
77 | { | 77 | { |
78 | // qDebug("KOTodoViewItem::construct() "); | 78 | // qDebug("KOTodoViewItem::construct() "); |
79 | m_init = true; | 79 | m_init = true; |
80 | QString keyd = "=="; | 80 | QString keyd = "=="; |
81 | QString keyt = "=="; | 81 | QString keyt = "=="; |
82 | QString skeyd = "=="; | 82 | QString skeyd = "=="; |
83 | QString skeyt = "=="; | 83 | QString skeyt = "=="; |
84 | 84 | ||
85 | setOn(mTodo->isCompleted()); | 85 | setOn(mTodo->isCompleted()); |
86 | setText(0,mTodo->summary()); | 86 | setText(0,mTodo->summary()); |
87 | setText(1,QString::number(mTodo->priority())); | 87 | setText(1,QString::number(mTodo->priority())); |
88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
89 | if (mTodo->percentComplete()<100) { | 89 | if (mTodo->percentComplete()<100) { |
90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
91 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 91 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
95 | else setSortKey(2,QString::number(99)); | 95 | else setSortKey(2,QString::number(99)); |
96 | } | 96 | } |
97 | if (mTodo->hasDueDate()) { | 97 | if (mTodo->hasDueDate()) { |
98 | setText(3, mTodo->dtDueDateStr()); | 98 | setText(3, mTodo->dtDueDateStr()); |
99 | QDate d = mTodo->dtDue().date(); | 99 | QDate d = mTodo->dtDue().date(); |
100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
101 | // setSortKey(3,keyd); | 101 | // setSortKey(3,keyd); |
102 | if (mTodo->doesFloat()) { | 102 | if (mTodo->doesFloat()) { |
103 | setText(4,""); | 103 | setText(4,""); |
104 | } | 104 | } |
105 | else { | 105 | else { |
106 | setText(4,mTodo->dtDueTimeStr()); | 106 | setText(4,mTodo->dtDueTimeStr()); |
107 | QTime t = mTodo->dtDue().time(); | 107 | QTime t = mTodo->dtDue().time(); |
108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
109 | //setSortKey(4,keyt); | 109 | //setSortKey(4,keyt); |
110 | } | 110 | } |
111 | } else { | 111 | } else { |
112 | setText(3,""); | 112 | setText(3,""); |
113 | setText(4,""); | 113 | setText(4,""); |
114 | } | 114 | } |
115 | setSortKey(3,keyd); | 115 | setSortKey(3,keyd); |
116 | setSortKey(4,keyt); | 116 | setSortKey(4,keyt); |
117 | 117 | ||
118 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); | 118 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); |
119 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 119 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | if (mTodo->hasStartDate()) { | 123 | if (mTodo->hasStartDate()) { |
124 | setText(5, mTodo->dtStartDateStr()); | 124 | setText(5, mTodo->dtStartDateStr()); |
125 | QDate d = mTodo->dtStart().date(); | 125 | QDate d = mTodo->dtStart().date(); |
126 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 126 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
127 | 127 | ||
128 | if (mTodo->doesFloat()) { | 128 | if (mTodo->doesFloat()) { |
129 | setText(6,""); | 129 | setText(6,""); |
130 | } | 130 | } |
131 | else { | 131 | else { |
132 | setText(6,mTodo->dtStartTimeStr()); | 132 | setText(6,mTodo->dtStartTimeStr()); |
133 | QTime t = mTodo->dtStart().time(); | 133 | QTime t = mTodo->dtStart().time(); |
134 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 134 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
135 | 135 | ||
136 | } | 136 | } |
137 | } else { | 137 | } else { |
138 | setText(5,""); | 138 | setText(5,""); |
139 | setText(6,""); | 139 | setText(6,""); |
140 | } | 140 | } |
141 | setSortKey(5,skeyd); | 141 | setSortKey(5,skeyd); |
142 | setSortKey(6,skeyt); | 142 | setSortKey(6,skeyt); |
143 | 143 | ||
144 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); | 144 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); |
145 | setText(8,mTodo->categoriesStr()); | 145 | setText(8,mTodo->categoriesStr()); |
146 | 146 | ||
147 | #if 0 | 147 | #if 0 |
148 | // Find sort id in description. It's the text behind the last '#' character | 148 | // Find sort id in description. It's the text behind the last '#' character |
149 | // found in the description. White spaces are removed from beginning and end | 149 | // found in the description. White spaces are removed from beginning and end |
150 | // of sort id. | 150 | // of sort id. |
151 | int pos = mTodo->description().findRev('#'); | 151 | int pos = mTodo->description().findRev('#'); |
152 | if (pos < 0) { | 152 | if (pos < 0) { |
153 | setText(6,""); | 153 | setText(6,""); |
154 | } else { | 154 | } else { |
155 | QString str = mTodo->description().mid(pos+1); | 155 | QString str = mTodo->description().mid(pos+1); |
156 | str.stripWhiteSpace(); | 156 | str.stripWhiteSpace(); |
157 | setText(6,str); | 157 | setText(6,str); |
158 | } | 158 | } |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | m_known = false; | 161 | m_known = false; |
162 | m_init = false; | 162 | m_init = false; |
163 | 163 | ||
164 | setMyPixmap(); | 164 | setMyPixmap(); |
165 | 165 | ||
166 | } | 166 | } |
167 | void KOTodoViewItem::setMyPixmap() | 167 | void KOTodoViewItem::setMyPixmap() |
168 | { | 168 | { |
169 | int size = 5; | 169 | int size = 5; |
170 | QPixmap pixi = QPixmap( 1, 1 ); | 170 | QPixmap pixi = QPixmap( 1, 1 ); |
171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
172 | // pixi = SmallIcon("redcross16"); | 172 | // pixi = SmallIcon("redcross16"); |
173 | // } else { | 173 | // } else { |
174 | QPainter p; | 174 | QPainter p; |
175 | 175 | ||
176 | int pixSize = 0; | 176 | int pixSize = 0; |
177 | QPixmap pPix = QPixmap( size, size ); | 177 | QPixmap pPix = QPixmap( size, size ); |
178 | if ( mTodo->description().length() > 0 ) { | 178 | if ( mTodo->description().length() > 0 ) { |
179 | pixi.resize(size, pixSize+size); | 179 | pixi.resize(size, pixSize+size); |
180 | pPix.fill( Qt::darkGreen ); | 180 | pPix.fill( Qt::darkGreen ); |
181 | p.begin( &pixi ); | 181 | p.begin( &pixi ); |
182 | p. drawPixmap ( 0, pixSize, pPix); | 182 | p. drawPixmap ( 0, pixSize, pPix); |
183 | p.end(); | 183 | p.end(); |
184 | pixSize += size; | 184 | pixSize += size; |
185 | } | 185 | } |
186 | if ( mTodo->isAlarmEnabled() ) { | 186 | if ( mTodo->isAlarmEnabled() ) { |
187 | pixi.resize(size, pixSize+size); | 187 | pixi.resize(size, pixSize+size); |
188 | pPix.fill( Qt::red ); | 188 | pPix.fill( Qt::red ); |
189 | p.begin( &pixi ); | 189 | p.begin( &pixi ); |
190 | p. drawPixmap ( 0, pixSize, pPix); | 190 | p. drawPixmap ( 0, pixSize, pPix); |
191 | p.end(); | 191 | p.end(); |
192 | pixSize += size; | 192 | pixSize += size; |
193 | } | 193 | } |
194 | if ( mTodo->doesRecur() ) { | 194 | if ( mTodo->doesRecur() ) { |
195 | pixi.resize(size, pixSize+size); | 195 | pixi.resize(size, pixSize+size); |
196 | pPix.fill( Qt::blue ); | 196 | pPix.fill( Qt::blue ); |
197 | p.begin( &pixi ); | 197 | p.begin( &pixi ); |
198 | p. drawPixmap ( 0, pixSize, pPix); | 198 | p. drawPixmap ( 0, pixSize, pPix); |
199 | p.end(); | 199 | p.end(); |
200 | pixSize += size; | 200 | pixSize += size; |
201 | } | 201 | } |
202 | // } | 202 | // } |
203 | if ( pixi.width() > 1 ) { | 203 | if ( pixi.width() > 1 ) { |
204 | setPixmap ( 0,pixi ) ; | 204 | setPixmap ( 0,pixi ) ; |
205 | } else { | 205 | } else { |
206 | setPixmap ( 0,QPixmap() ) ; | 206 | setPixmap ( 0,QPixmap() ) ; |
207 | } | 207 | } |
208 | } | 208 | } |
209 | void KOTodoViewItem::stateChange(bool state) | 209 | void KOTodoViewItem::stateChange(bool state) |
210 | { | 210 | { |
211 | // qDebug("KOTodoViewItem::stateChange %d ", state); | 211 | // qDebug("KOTodoViewItem::stateChange %d ", state); |
212 | // do not change setting on startup | 212 | // do not change setting on startup |
213 | if ( m_init ) return; | 213 | if ( m_init ) return; |
214 | if (isOn()!=state) { | 214 | if (isOn()!=state) { |
215 | setOn(state); | 215 | setOn(state); |
216 | //qDebug("SETON "); | 216 | //qDebug("SETON "); |
217 | return; | 217 | return; |
218 | } | 218 | } |
219 | if ( mTodo->isCompleted() == state ) { | 219 | if ( mTodo->isCompleted() == state ) { |
220 | //qDebug("STATECHANGE:nothing to do "); | 220 | //qDebug("STATECHANGE:nothing to do "); |
221 | return; | 221 | return; |
222 | } | 222 | } |
223 | QString keyd = "=="; | 223 | QString keyd = "=="; |
224 | QString keyt = "=="; | 224 | QString keyt = "=="; |
225 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); | 225 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); |
226 | if ( mTodo->doesRecur() ){ | 226 | if ( mTodo->doesRecur() ){ |
227 | QDateTime start = mTodo->dtStart(); | 227 | QDateTime start = mTodo->dtStart(); |
228 | mTodo->setCompleted(state); | 228 | mTodo->setCompleted(state); |
229 | if ( start != mTodo->dtStart() ) { | 229 | if ( start != mTodo->dtStart() ) { |
230 | if ( state && !mTodo->isCompleted() ) { | 230 | if ( state && !mTodo->isCompleted() ) { |
231 | setOn( false ); | 231 | setOn( false ); |
232 | state = false; | 232 | state = false; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | } else | 235 | } else |
236 | mTodo->setCompleted(state); | 236 | mTodo->setCompleted(state); |
237 | 237 | ||
238 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); | 238 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
239 | 239 | ||
240 | if (mTodo->hasDueDate()) { | 240 | if (mTodo->hasDueDate()) { |
241 | setText(3, mTodo->dtDueDateStr()); | 241 | setText(3, mTodo->dtDueDateStr()); |
242 | QDate d = mTodo->dtDue().date(); | 242 | QDate d = mTodo->dtDue().date(); |
243 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 243 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
244 | setSortKey(3,keyd); | 244 | setSortKey(3,keyd); |
245 | if (mTodo->doesFloat()) { | 245 | if (mTodo->doesFloat()) { |
246 | setText(4,""); | 246 | setText(4,""); |
247 | } | 247 | } |
248 | else { | 248 | else { |
249 | setText(4,mTodo->dtDueTimeStr()); | 249 | setText(4,mTodo->dtDueTimeStr()); |
250 | QTime t = mTodo->dtDue().time(); | 250 | QTime t = mTodo->dtDue().time(); |
251 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 251 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
252 | setSortKey(4,keyt); | 252 | setSortKey(4,keyt); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | if (mTodo->hasStartDate()) { | 255 | if (mTodo->hasStartDate()) { |
256 | QString skeyt = "=="; | 256 | QString skeyt = "=="; |
257 | QString skeyd = "=="; | 257 | QString skeyd = "=="; |
258 | setText(5, mTodo->dtStartDateStr()); | 258 | setText(5, mTodo->dtStartDateStr()); |
259 | QDate d = mTodo->dtStart().date(); | 259 | QDate d = mTodo->dtStart().date(); |
260 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 260 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
261 | 261 | ||
262 | if (mTodo->doesFloat()) { | 262 | if (mTodo->doesFloat()) { |
263 | setText(6,""); | 263 | setText(6,""); |
264 | } | 264 | } |
265 | else { | 265 | else { |
266 | setText(6,mTodo->dtStartTimeStr()); | 266 | setText(6,mTodo->dtStartTimeStr()); |
267 | QTime t = mTodo->dtStart().time(); | 267 | QTime t = mTodo->dtStart().time(); |
268 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 268 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
269 | 269 | ||
270 | } | 270 | } |
271 | setSortKey(5,skeyd); | 271 | setSortKey(5,skeyd); |
272 | setSortKey(6,skeyt); | 272 | setSortKey(6,skeyt); |
273 | } | 273 | } |
274 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 274 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
275 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 275 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
276 | 276 | ||
277 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 277 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
278 | if (mTodo->percentComplete()<100) { | 278 | if (mTodo->percentComplete()<100) { |
279 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 279 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
280 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 280 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
281 | } | 281 | } |
282 | else { | 282 | else { |
283 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 283 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
284 | else setSortKey(2,QString::number(99)); | 284 | else setSortKey(2,QString::number(99)); |
285 | } | 285 | } |
286 | if ( state ) { | 286 | if ( state ) { |
287 | QListViewItem * myChild = firstChild(); | 287 | QListViewItem * myChild = firstChild(); |
288 | KOTodoViewItem *item; | 288 | KOTodoViewItem *item; |
289 | while( myChild ) { | 289 | while( myChild ) { |
290 | //qDebug("stateCH "); | 290 | //qDebug("stateCH "); |
291 | item = static_cast<KOTodoViewItem*>(myChild); | 291 | item = static_cast<KOTodoViewItem*>(myChild); |
292 | item->stateChange(state); | 292 | item->stateChange(state); |
293 | myChild = myChild->nextSibling(); | 293 | myChild = myChild->nextSibling(); |
294 | } | 294 | } |
295 | } else { | 295 | } else { |
296 | QListViewItem * myChild = parent(); | 296 | QListViewItem * myChild = parent(); |
297 | if ( myChild ) | 297 | if ( myChild ) |
298 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 298 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
299 | } | 299 | } |
300 | mTodoView->modified(true); | 300 | mTodoView->modified(true); |
301 | setMyPixmap(); | 301 | setMyPixmap(); |
302 | mTodoView->setTodoModified( mTodo ); | 302 | mTodoView->setTodoModified( mTodo ); |
303 | } | 303 | } |
304 | 304 | ||
305 | bool KOTodoViewItem::isAlternate() | 305 | bool KOTodoViewItem::isAlternate() |
306 | { | 306 | { |
307 | 307 | ||
308 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 308 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
309 | if (lv && lv->alternateBackground().isValid()) | 309 | if (lv && lv->alternateBackground().isValid()) |
310 | { | 310 | { |
311 | KOTodoViewItem *above = 0; | 311 | KOTodoViewItem *above = 0; |
312 | above = static_cast<KOTodoViewItem *>(itemAbove()); | 312 | above = static_cast<KOTodoViewItem *>(itemAbove()); |
313 | m_known = above ? above->m_known : true; | 313 | m_known = above ? above->m_known : true; |
314 | if (m_known) | 314 | if (m_known) |
315 | { | 315 | { |
316 | m_odd = above ? !above->m_odd : false; | 316 | m_odd = above ? !above->m_odd : false; |
317 | } | 317 | } |
318 | else | 318 | else |
319 | { | 319 | { |
320 | KOTodoViewItem *item; | 320 | KOTodoViewItem *item; |
321 | bool previous = true; | 321 | bool previous = true; |
322 | if (QListViewItem::parent()) | 322 | if (QListViewItem::parent()) |
323 | { | 323 | { |
324 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); | 324 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); |
325 | if (item) | 325 | if (item) |
326 | previous = item->m_odd; | 326 | previous = item->m_odd; |
327 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 327 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
328 | } | 328 | } |
329 | else | 329 | else |
330 | { | 330 | { |
331 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); | 331 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); |
332 | } | 332 | } |
333 | 333 | ||
334 | while(item) | 334 | while(item) |
335 | { | 335 | { |
336 | item->m_odd = previous = !previous; | 336 | item->m_odd = previous = !previous; |
337 | item->m_known = true; | 337 | item->m_known = true; |
338 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); | 338 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | return m_odd; | 341 | return m_odd; |
342 | } | 342 | } |
343 | return false; | 343 | return false; |
344 | } | 344 | } |
345 | 345 | ||
346 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 346 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
347 | { | 347 | { |
348 | QColorGroup _cg = cg; | 348 | QColorGroup _cg = cg; |
349 | QColorGroup::ColorRole role; | 349 | QColorGroup::ColorRole role; |
350 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 350 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
351 | role = QColorGroup::Text; | 351 | role = QColorGroup::Text; |
352 | else | 352 | else |
353 | role = QColorGroup::Base; | 353 | role = QColorGroup::Base; |
354 | //#ifndef KORG_NOLVALTERNATION | 354 | //#ifndef KORG_NOLVALTERNATION |
355 | if (isAlternate()) | 355 | if (isAlternate()) |
356 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 356 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
357 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 357 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
358 | QColor colorToSet; | 358 | QColor colorToSet; |
359 | if ( setColor ) { | 359 | if ( setColor ) { |
360 | QStringList categories = mTodo->categories(); | 360 | QStringList categories = mTodo->categories(); |
361 | QString cat = categories.first(); | 361 | QString cat = categories.first(); |
362 | if ( !cat.isEmpty()) { | 362 | if ( !cat.isEmpty()) { |
363 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 363 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
364 | } else | 364 | } else |
365 | setColor = false; | 365 | setColor = false; |
366 | } | 366 | } |
367 | 367 | bool openMode = !isOpen(); | |
368 | int odue = mTodo->hasDueSubTodo( !isOpen()); | 368 | // maybe we are in flat-display-mode |
369 | if ( !firstChild() ) | ||
370 | openMode = false; | ||
371 | int odue = mTodo->hasDueSubTodo( openMode ); | ||
369 | if (odue == 2) { | 372 | if (odue == 2) { |
370 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 373 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
371 | setColor = true; | 374 | setColor = true; |
372 | } else if ( odue == 1 ) { | 375 | } else if ( odue == 1 ) { |
373 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 376 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
374 | setColor = true; | 377 | setColor = true; |
375 | } | 378 | } |
376 | 379 | ||
377 | 380 | ||
378 | if ( setColor ) { | 381 | if ( setColor ) { |
379 | _cg.setColor(role,colorToSet ); | 382 | _cg.setColor(role,colorToSet ); |
380 | if ( role == QColorGroup::Base) { | 383 | if ( role == QColorGroup::Base) { |
381 | int rgb = colorToSet.red(); | 384 | int rgb = colorToSet.red(); |
382 | rgb += colorToSet.blue()/2; | 385 | rgb += colorToSet.blue()/2; |
383 | rgb += colorToSet.green(); | 386 | rgb += colorToSet.green(); |
384 | if ( rgb < 200 ) | 387 | if ( rgb < 200 ) |
385 | _cg.setColor(QColorGroup::Text,Qt::white ); | 388 | _cg.setColor(QColorGroup::Text,Qt::white ); |
386 | } | 389 | } |
387 | } | 390 | } |
388 | //#endif | 391 | //#endif |
389 | if ( column > 0 ){ | 392 | if ( column > 0 ){ |
390 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 393 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
391 | p->save(); | 394 | p->save(); |
392 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 395 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
393 | 396 | ||
394 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 397 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
395 | // p->setPen(Qt::black ); //border | 398 | // p->setPen(Qt::black ); //border |
396 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 399 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
397 | QColor fc = KOPrefs::instance()->mHighlightColor; | 400 | QColor fc = KOPrefs::instance()->mHighlightColor; |
398 | if ( mTodo->percentComplete() == 100 ) | 401 | if ( mTodo->percentComplete() == 100 ) |
399 | fc = darkGreen; | 402 | fc = darkGreen; |
400 | p->drawRect( 2, 2, width-4, height()-4); | 403 | p->drawRect( 2, 2, width-4, height()-4); |
401 | p->fillRect( 3, 3, progress, height()-6, | 404 | p->fillRect( 3, 3, progress, height()-6, |
402 | fc ); | 405 | fc ); |
403 | p->restore(); | 406 | p->restore(); |
404 | } else { | 407 | } else { |
405 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 408 | QCheckListItem::paintCell(p, _cg, column, width, alignment); |
406 | } | 409 | } |
407 | return; | 410 | return; |
408 | } | 411 | } |
409 | 412 | ||
410 | int align = alignment; | 413 | int align = alignment; |
411 | 414 | ||
412 | if ( !p ) | 415 | if ( !p ) |
413 | return; | 416 | return; |
414 | 417 | ||
415 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 418 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
416 | 419 | ||
417 | QListView *lv = listView(); | 420 | QListView *lv = listView(); |
418 | if ( !lv ) | 421 | if ( !lv ) |
419 | return; | 422 | return; |
420 | int marg = 2;//lv->itemMargin(); | 423 | int marg = 2;//lv->itemMargin(); |
421 | int r = 0; | 424 | int r = 0; |
422 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 425 | QCheckListItem::Type myType = QCheckListItem::CheckBox; |
423 | int BoxSize = 20; | 426 | int BoxSize = 20; |
424 | int boxOffset = 2; | 427 | int boxOffset = 2; |
425 | int xOffset = 2; | 428 | int xOffset = 2; |
426 | if (qApp->desktop()->width() < 300 ) { | 429 | if (qApp->desktop()->width() < 300 ) { |
427 | BoxSize = 14; | 430 | BoxSize = 14; |
428 | boxOffset = -1; | 431 | boxOffset = -1; |
429 | xOffset = 1; | 432 | xOffset = 1; |
430 | // marg = 0; | 433 | // marg = 0; |
431 | } | 434 | } |
432 | if ( height() < BoxSize ) { | 435 | if ( height() < BoxSize ) { |
433 | boxOffset = boxOffset - ((BoxSize - height())/2) ; | 436 | boxOffset = boxOffset - ((BoxSize - height())/2) ; |
434 | // qDebug("boxOffset %d height %d", boxOffset, height() ); | 437 | // qDebug("boxOffset %d height %d", boxOffset, height() ); |
435 | BoxSize = height(); | 438 | BoxSize = height(); |
436 | 439 | ||
437 | } | 440 | } |
438 | //bool winStyle = lv->style() == WindowsStyle; | 441 | //bool winStyle = lv->style() == WindowsStyle; |
439 | 442 | ||
440 | int lineStart = 5; | 443 | int lineStart = 5; |
441 | if ( myType == Controller ) { | 444 | if ( myType == Controller ) { |
442 | if ( !pixmap( 0 ) ) | 445 | if ( !pixmap( 0 ) ) |
443 | r += BoxSize + 4; | 446 | r += BoxSize + 4; |
444 | } else { | 447 | } else { |
445 | ASSERT( lv ); //### | 448 | ASSERT( lv ); //### |
446 | //QFontMetrics fm( lv->font() ); | 449 | //QFontMetrics fm( lv->font() ); |
447 | //int d = fm.height(); | 450 | //int d = fm.height(); |
448 | int x = 0; | 451 | int x = 0; |
449 | int y = (height() - BoxSize) / 2; | 452 | int y = (height() - BoxSize) / 2; |
450 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); | 453 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); |
451 | if ( myType == CheckBox ) { | 454 | if ( myType == CheckBox ) { |
452 | if ( isEnabled() ) | 455 | if ( isEnabled() ) |
453 | p->setPen( QPen( _cg.text(), 1 ) ); | 456 | p->setPen( QPen( _cg.text(), 1 ) ); |
454 | else | 457 | else |
455 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); | 458 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); |
456 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); | 459 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); |
457 | lineStart = x+marg; | 460 | lineStart = x+marg; |
458 | ///////////////////// | 461 | ///////////////////// |
459 | x++; | 462 | x++; |
460 | y++; | 463 | y++; |
461 | if ( isOn() ) { | 464 | if ( isOn() ) { |
462 | QPointArray a( 7*2 ); | 465 | QPointArray a( 7*2 ); |
463 | int i, xx, yy; | 466 | int i, xx, yy; |
464 | xx = x+xOffset+marg+(boxOffset/2); | 467 | xx = x+xOffset+marg+(boxOffset/2); |
465 | yy = y+5+boxOffset; | 468 | yy = y+5+boxOffset; |
466 | for ( i=0; i<3; i++ ) { | 469 | for ( i=0; i<3; i++ ) { |
467 | a.setPoint( 2*i, xx, yy ); | 470 | a.setPoint( 2*i, xx, yy ); |
468 | a.setPoint( 2*i+1, xx, yy+2 ); | 471 | a.setPoint( 2*i+1, xx, yy+2 ); |
469 | // qDebug(" "); | 472 | // qDebug(" "); |
470 | xx++; yy++; | 473 | xx++; yy++; |
471 | } | 474 | } |
472 | yy -= 2; | 475 | yy -= 2; |
473 | for ( i=3; i<7; i++ ) { | 476 | for ( i=3; i<7; i++ ) { |
474 | a.setPoint( 2*i, xx, yy ); | 477 | a.setPoint( 2*i, xx, yy ); |
475 | a.setPoint( 2*i+1, xx, yy+2 ); | 478 | a.setPoint( 2*i+1, xx, yy+2 ); |
476 | xx++; yy--; | 479 | xx++; yy--; |
477 | } | 480 | } |
478 | p->setPen( darkGreen ); | 481 | p->setPen( darkGreen ); |
479 | p->drawLineSegments( a ); | 482 | p->drawLineSegments( a ); |
480 | } | 483 | } |
481 | //////////////////////// | 484 | //////////////////////// |
482 | } | 485 | } |
483 | r += BoxSize + 4; | 486 | r += BoxSize + 4; |
484 | } | 487 | } |
485 | 488 | ||
486 | p->translate( r, 0 ); | 489 | p->translate( r, 0 ); |
487 | p->setPen( QPen( _cg.text() ) ); | 490 | p->setPen( QPen( _cg.text() ) ); |
488 | QListViewItem::paintCell( p, _cg, column, width - r, align ); | 491 | QListViewItem::paintCell( p, _cg, column, width - r, align ); |
489 | if ( mTodo->cancelled () ) { | 492 | if ( mTodo->cancelled () ) { |
490 | p->setPen( black ); | 493 | p->setPen( black ); |
491 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); | 494 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); |
492 | int wid = br.width() +lineStart; | 495 | int wid = br.width() +lineStart; |
493 | if ( wid > width-3 ) | 496 | if ( wid > width-3 ) |
494 | wid = width-3; | 497 | wid = width-3; |
495 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); | 498 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); |
496 | 499 | ||
497 | } | 500 | } |
498 | 501 | ||
499 | } | 502 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 006a8dd..019f41f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2103 +1,2106 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | int globalFlagBlockStartup; | 131 | int globalFlagBlockStartup; |
132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
133 | QMainWindow( parent, name ) | 133 | QMainWindow( parent, name ) |
134 | { | 134 | { |
135 | 135 | ||
136 | mClosed = false; | 136 | mClosed = false; |
137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
138 | QString confFile = locateLocal("config","korganizerrc"); | 138 | QString confFile = locateLocal("config","korganizerrc"); |
139 | QFileInfo finf ( confFile ); | 139 | QFileInfo finf ( confFile ); |
140 | bool showWarning = !finf.exists(); | 140 | bool showWarning = !finf.exists(); |
141 | setIcon(SmallIcon( "ko24" ) ); | 141 | setIcon(SmallIcon( "ko24" ) ); |
142 | mBlockAtStartup = true; | 142 | mBlockAtStartup = true; |
143 | mFlagKeyPressed = false; | 143 | mFlagKeyPressed = false; |
144 | setCaption("KOrganizer/Pi"); | 144 | setCaption("KOrganizer/Pi"); |
145 | KOPrefs *p = KOPrefs::instance(); | 145 | KOPrefs *p = KOPrefs::instance(); |
146 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 146 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
147 | if ( p->mHourSize > 22 ) | 147 | if ( p->mHourSize > 22 ) |
148 | p->mHourSize = 22; | 148 | p->mHourSize = 22; |
149 | QMainWindow::ToolBarDock tbd; | 149 | QMainWindow::ToolBarDock tbd; |
150 | if ( p->mToolBarHor ) { | 150 | if ( p->mToolBarHor ) { |
151 | if ( p->mToolBarUp ) | 151 | if ( p->mToolBarUp ) |
152 | tbd = Bottom; | 152 | tbd = Bottom; |
153 | else | 153 | else |
154 | tbd = Top; | 154 | tbd = Top; |
155 | } | 155 | } |
156 | else { | 156 | else { |
157 | if ( p->mToolBarUp ) | 157 | if ( p->mToolBarUp ) |
158 | tbd = Right; | 158 | tbd = Right; |
159 | else | 159 | else |
160 | tbd = Left; | 160 | tbd = Left; |
161 | } | 161 | } |
162 | if ( KOPrefs::instance()->mUseAppColors ) | 162 | if ( KOPrefs::instance()->mUseAppColors ) |
163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
164 | globalFlagBlockStartup = 1; | 164 | globalFlagBlockStartup = 1; |
165 | iconToolBar = new QPEToolBar( this ); | 165 | iconToolBar = new QPEToolBar( this ); |
166 | addToolBar (iconToolBar , tbd ); | 166 | addToolBar (iconToolBar , tbd ); |
167 | mCalendarModifiedFlag = false; | 167 | mCalendarModifiedFlag = false; |
168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
169 | splash->setAlignment ( AlignCenter ); | 169 | splash->setAlignment ( AlignCenter ); |
170 | setCentralWidget( splash ); | 170 | setCentralWidget( splash ); |
171 | #ifndef DESKTOP_VERSION | 171 | #ifndef DESKTOP_VERSION |
172 | showMaximized(); | 172 | showMaximized(); |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
176 | setDefaultPreferences(); | 176 | setDefaultPreferences(); |
177 | mCalendar = new CalendarLocal(); | 177 | mCalendar = new CalendarLocal(); |
178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
179 | mView->hide(); | 179 | mView->hide(); |
180 | //mView->resize(splash->size() ); | 180 | //mView->resize(splash->size() ); |
181 | initActions(); | 181 | initActions(); |
182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
183 | mSyncManager->setBlockSave(false); | 183 | mSyncManager->setBlockSave(false); |
184 | mView->setSyncManager(mSyncManager); | 184 | mView->setSyncManager(mSyncManager); |
185 | #ifndef DESKTOP_VERSION | 185 | #ifndef DESKTOP_VERSION |
186 | iconToolBar->show(); | 186 | iconToolBar->show(); |
187 | qApp->processEvents(); | 187 | qApp->processEvents(); |
188 | #endif | 188 | #endif |
189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
190 | int vh = height() ; | 190 | int vh = height() ; |
191 | int vw = width(); | 191 | int vw = width(); |
192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
194 | vh -= iconToolBar->height(); | 194 | vh -= iconToolBar->height(); |
195 | } else { | 195 | } else { |
196 | vw -= iconToolBar->height(); | 196 | vw -= iconToolBar->height(); |
197 | } | 197 | } |
198 | //mView->setMaximumSize( splash->size() ); | 198 | //mView->setMaximumSize( splash->size() ); |
199 | //mView->resize( splash->size() ); | 199 | //mView->resize( splash->size() ); |
200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
201 | mView->readSettings(); | 201 | mView->readSettings(); |
202 | bool newFile = false; | 202 | bool newFile = false; |
203 | if( !QFile::exists( defaultFileName() ) ) { | 203 | if( !QFile::exists( defaultFileName() ) ) { |
204 | QFileInfo finfo ( defaultFileName() ); | 204 | QFileInfo finfo ( defaultFileName() ); |
205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
206 | qDebug("oldfile %s ", oldFile.latin1()); | 206 | qDebug("oldfile %s ", oldFile.latin1()); |
207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
208 | finfo.setFile( oldFile ); | 208 | finfo.setFile( oldFile ); |
209 | if (finfo.exists() ) { | 209 | if (finfo.exists() ) { |
210 | KMessageBox::information( this, message); | 210 | KMessageBox::information( this, message); |
211 | mView->openCalendar( oldFile ); | 211 | mView->openCalendar( oldFile ); |
212 | qApp->processEvents(); | 212 | qApp->processEvents(); |
213 | } else { | 213 | } else { |
214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
215 | finfo.setFile( oldFile ); | 215 | finfo.setFile( oldFile ); |
216 | if (finfo.exists() ) { | 216 | if (finfo.exists() ) { |
217 | KMessageBox::information( this, message); | 217 | KMessageBox::information( this, message); |
218 | mView->openCalendar( oldFile ); | 218 | mView->openCalendar( oldFile ); |
219 | qApp->processEvents(); | 219 | qApp->processEvents(); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | mView->saveCalendar( defaultFileName() ); | 222 | mView->saveCalendar( defaultFileName() ); |
223 | newFile = true; | 223 | newFile = true; |
224 | } | 224 | } |
225 | 225 | ||
226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
227 | mView->openCalendar( defaultFileName() ); | 227 | mView->openCalendar( defaultFileName() ); |
228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
230 | 230 | ||
231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
232 | KOPrefs::instance()->setAllDefaults(); | 232 | KOPrefs::instance()->setAllDefaults(); |
233 | int count = mView->addCategories(); | 233 | int count = mView->addCategories(); |
234 | } | 234 | } |
235 | processIncidenceSelection( 0 ); | 235 | processIncidenceSelection( 0 ); |
236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
237 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 237 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
239 | SLOT( slotModifiedChanged( bool ) ) ); | 239 | SLOT( slotModifiedChanged( bool ) ) ); |
240 | 240 | ||
241 | 241 | ||
242 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 242 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
243 | SLOT( disableBR(bool) ) ); | 243 | SLOT( disableBR(bool) ) ); |
244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
245 | mView->setModified( false ); | 245 | mView->setModified( false ); |
246 | mBlockAtStartup = false; | 246 | mBlockAtStartup = false; |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | setCentralWidget( mView ); | 248 | setCentralWidget( mView ); |
249 | globalFlagBlockStartup = 0; | 249 | globalFlagBlockStartup = 0; |
250 | mView->show(); | 250 | mView->show(); |
251 | delete splash; | 251 | delete splash; |
252 | if ( newFile ) | 252 | if ( newFile ) |
253 | mView->updateConfig(); | 253 | mView->updateConfig(); |
254 | // qApp->processEvents(); | 254 | // qApp->processEvents(); |
255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
256 | //fillSyncMenu(); | 256 | //fillSyncMenu(); |
257 | 257 | ||
258 | 258 | ||
259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( sentSyncFile()); | 264 | mSyncManager->setDefaultFileName( sentSyncFile()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 266 | mSyncManager->fillSyncMenu(); |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 271 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 272 | KMessageBox::information( this, |
273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
274 | qApp->processEvents(); | 274 | qApp->processEvents(); |
275 | mView->dialogManager()->showSyncOptions(); | 275 | mView->dialogManager()->showSyncOptions(); |
276 | } | 276 | } |
277 | 277 | ||
278 | //US listen for result adressed from Ka/Pi | 278 | //US listen for result adressed from Ka/Pi |
279 | #ifndef DESKTOP_VERSION | 279 | #ifndef DESKTOP_VERSION |
280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
281 | #endif | 281 | #endif |
282 | #ifndef DESKTOP_VERSION | 282 | #ifndef DESKTOP_VERSION |
283 | infrared = 0; | 283 | infrared = 0; |
284 | #endif | 284 | #endif |
285 | updateWeek( mView->startDate() ); | 285 | updateWeek( mView->startDate() ); |
286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
288 | mBRdisabled = false; | 288 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 289 | //toggleBeamReceive(); |
290 | } | 290 | } |
291 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
292 | { | 292 | { |
293 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
294 | //save toolbar location | 294 | //save toolbar location |
295 | delete mCalendar; | 295 | delete mCalendar; |
296 | delete mSyncManager; | 296 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 298 | if ( infrared ) |
299 | delete infrared; | 299 | delete infrared; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
306 | { | 306 | { |
307 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
308 | if ( b ) { | 308 | if ( b ) { |
309 | if ( infrared ) { | 309 | if ( infrared ) { |
310 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
311 | mBRdisabled = true; | 311 | mBRdisabled = true; |
312 | } | 312 | } |
313 | mBRdisabled = true; | 313 | mBRdisabled = true; |
314 | } else { | 314 | } else { |
315 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
316 | mBRdisabled = false; | 316 | mBRdisabled = false; |
317 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
318 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | #endif | 321 | #endif |
322 | 322 | ||
323 | } | 323 | } |
324 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
325 | { | 325 | { |
326 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
327 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
328 | #endif | 328 | #endif |
329 | return false; | 329 | return false; |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
333 | { | 333 | { |
334 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
335 | return; | 335 | return; |
336 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
337 | if ( infrared ) { | 337 | if ( infrared ) { |
338 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
339 | delete infrared; | 339 | delete infrared; |
340 | infrared = 0; | 340 | infrared = 0; |
341 | brAction->setOn(false); | 341 | brAction->setOn(false); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
345 | brAction->setOn(true); | 345 | brAction->setOn(true); |
346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
351 | { | 351 | { |
352 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
353 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
354 | if ( mClosed ) | 354 | if ( mClosed ) |
355 | mView->goToday(); | 355 | mView->goToday(); |
356 | #endif | 356 | #endif |
357 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
358 | mClosed = false; | 358 | mClosed = false; |
359 | } | 359 | } |
360 | void MainWindow::closeEvent( QCloseEvent* ce ) | 360 | void MainWindow::closeEvent( QCloseEvent* ce ) |
361 | { | 361 | { |
362 | 362 | ||
363 | 363 | ||
364 | 364 | ||
365 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 365 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
366 | saveOnClose(); | 366 | saveOnClose(); |
367 | mClosed = true; | 367 | mClosed = true; |
368 | ce->accept(); | 368 | ce->accept(); |
369 | return; | 369 | return; |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | switch( QMessageBox::information( this, "KO/Pi", | 373 | switch( QMessageBox::information( this, "KO/Pi", |
374 | i18n("Do you really want\nto close KO/Pi?"), | 374 | i18n("Do you really want\nto close KO/Pi?"), |
375 | i18n("Close"), i18n("No"), | 375 | i18n("Close"), i18n("No"), |
376 | 0, 0 ) ) { | 376 | 0, 0 ) ) { |
377 | case 0: | 377 | case 0: |
378 | saveOnClose(); | 378 | saveOnClose(); |
379 | mClosed = true; | 379 | mClosed = true; |
380 | ce->accept(); | 380 | ce->accept(); |
381 | break; | 381 | break; |
382 | case 1: | 382 | case 1: |
383 | ce->ignore(); | 383 | ce->ignore(); |
384 | break; | 384 | break; |
385 | case 2: | 385 | case 2: |
386 | 386 | ||
387 | default: | 387 | default: |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
395 | { | 395 | { |
396 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
398 | //QString datamess; | 398 | //QString datamess; |
399 | //qDebug("message "); | 399 | //qDebug("message "); |
400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
401 | 401 | ||
402 | if ( cmsg == "setDocument(QString)" ) { | 402 | if ( cmsg == "setDocument(QString)" ) { |
403 | QDataStream stream( data, IO_ReadOnly ); | 403 | QDataStream stream( data, IO_ReadOnly ); |
404 | QString fileName; | 404 | QString fileName; |
405 | stream >> fileName; | 405 | stream >> fileName; |
406 | //qDebug("filename %s ", fileName.latin1()); | 406 | //qDebug("filename %s ", fileName.latin1()); |
407 | showMaximized(); | 407 | showMaximized(); |
408 | raise(); | 408 | raise(); |
409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
410 | mSyncManager->slotSyncMenu( 1002 ); | 410 | mSyncManager->slotSyncMenu( 1002 ); |
411 | return; | 411 | return; |
412 | } | 412 | } |
413 | 413 | ||
414 | if ( cmsg == "-writeFile" ) { | 414 | if ( cmsg == "-writeFile" ) { |
415 | // I made from the "-writeFile" an "-writeAlarm" | 415 | // I made from the "-writeFile" an "-writeAlarm" |
416 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
417 | mCalendar->checkAlarmForIncidence( 0, true); | 417 | mCalendar->checkAlarmForIncidence( 0, true); |
418 | showMaximized(); | 418 | showMaximized(); |
419 | raise(); | 419 | raise(); |
420 | return; | 420 | return; |
421 | 421 | ||
422 | } | 422 | } |
423 | if ( cmsg == "-writeFileSilent" ) { | 423 | if ( cmsg == "-writeFileSilent" ) { |
424 | // I made from the "-writeFile" an "-writeAlarm" | 424 | // I made from the "-writeFile" an "-writeAlarm" |
425 | // mView->viewManager()->showWhatsNextView(); | 425 | // mView->viewManager()->showWhatsNextView(); |
426 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
427 | //showMaximized(); | 427 | //showMaximized(); |
428 | //raise(); | 428 | //raise(); |
429 | hide(); | 429 | hide(); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
433 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
434 | 434 | ||
435 | } | 435 | } |
436 | QString msg ; | 436 | QString msg ; |
437 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
438 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
439 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
440 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
441 | msg = allmsg; | 441 | msg = allmsg; |
442 | allmsg = ""; | 442 | allmsg = ""; |
443 | } else{ | 443 | } else{ |
444 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
446 | } | 446 | } |
447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
448 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
449 | mView->newEvent(); | 449 | mView->newEvent(); |
450 | } | 450 | } |
451 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
452 | mView->newTodo(); | 452 | mView->newTodo(); |
453 | 453 | ||
454 | } | 454 | } |
455 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
456 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
457 | } | 457 | } |
458 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
459 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
460 | } | 460 | } |
461 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
462 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
463 | } | 463 | } |
464 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
465 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
466 | } | 466 | } |
467 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
468 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
471 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
472 | } | 472 | } |
473 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
474 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
475 | } | 475 | } |
476 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
477 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
478 | } | 478 | } |
479 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
480 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
481 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |
482 | mView->viewManager()->showJournalView(); | 482 | mView->viewManager()->showJournalView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showKO" ) { | 484 | else if ( msg == "-showKO" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
488 | mView->viewManager()->showWhatsNextView(); | 488 | mView->viewManager()->showWhatsNextView(); |
489 | } | 489 | } |
490 | else if ( msg == "-showNextXView" ) { | 490 | else if ( msg == "-showNextXView" ) { |
491 | mView->viewManager()->showNextXView(); | 491 | mView->viewManager()->showNextXView(); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | } | 495 | } |
496 | 496 | ||
497 | showMaximized(); | 497 | showMaximized(); |
498 | raise(); | 498 | raise(); |
499 | } | 499 | } |
500 | 500 | ||
501 | QPixmap MainWindow::loadPixmap( QString name ) | 501 | QPixmap MainWindow::loadPixmap( QString name ) |
502 | { | 502 | { |
503 | return SmallIcon( name ); | 503 | return SmallIcon( name ); |
504 | 504 | ||
505 | } | 505 | } |
506 | void MainWindow::initActions() | 506 | void MainWindow::initActions() |
507 | { | 507 | { |
508 | //KOPrefs::instance()->mShowFullMenu | 508 | //KOPrefs::instance()->mShowFullMenu |
509 | iconToolBar->clear(); | 509 | iconToolBar->clear(); |
510 | KOPrefs *p = KOPrefs::instance(); | 510 | KOPrefs *p = KOPrefs::instance(); |
511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
512 | 512 | ||
513 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 513 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
514 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 514 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
515 | QPopupMenu *importMenu = new QPopupMenu( this ); | 515 | QPopupMenu *importMenu = new QPopupMenu( this ); |
516 | selectFilterMenu = new QPopupMenu( this ); | 516 | selectFilterMenu = new QPopupMenu( this ); |
517 | selectFilterMenu->setCheckable( true ); | 517 | selectFilterMenu->setCheckable( true ); |
518 | syncMenu = new QPopupMenu( this ); | 518 | syncMenu = new QPopupMenu( this ); |
519 | configureAgendaMenu = new QPopupMenu( this ); | 519 | configureAgendaMenu = new QPopupMenu( this ); |
520 | configureToolBarMenu = new QPopupMenu( this ); | 520 | configureToolBarMenu = new QPopupMenu( this ); |
521 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 521 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
522 | |||
523 | QIconSet icon; | ||
524 | int pixWid = 22, pixHei = 22; | ||
525 | QString pathString = ""; | ||
526 | if ( !p->mToolBarMiniIcons ) { | ||
527 | if ( QApplication::desktop()->width() < 480 ) { | ||
528 | pathString += "icons16/"; | ||
529 | pixWid = 18; pixHei = 16; | ||
530 | } | ||
531 | } else { | ||
532 | pathString += "iconsmini/"; | ||
533 | pixWid = 18; pixHei = 16; | ||
534 | } | ||
522 | if ( KOPrefs::instance()->mShowFullMenu ) { | 535 | if ( KOPrefs::instance()->mShowFullMenu ) { |
523 | QMenuBar *menuBar1; | 536 | QMenuBar *menuBar1; |
524 | menuBar1 = menuBar(); | 537 | menuBar1 = menuBar(); |
525 | menuBar1->insertItem( i18n("File"), importMenu ); | 538 | menuBar1->insertItem( i18n("File"), importMenu ); |
526 | menuBar1->insertItem( i18n("View"), viewMenu ); | 539 | menuBar1->insertItem( i18n("View"), viewMenu ); |
527 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 540 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
528 | #ifdef DESKTOP_VERSION | 541 | #ifdef DESKTOP_VERSION |
529 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 542 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
530 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 543 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
531 | #else | 544 | #else |
532 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 545 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
533 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 546 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
534 | #endif | 547 | #endif |
535 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 548 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
536 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 549 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
537 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 550 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
538 | } else { | 551 | } else { |
539 | QPEMenuBar *menuBar1; | 552 | QPEMenuBar *menuBar1; |
540 | menuBar1 = new QPEMenuBar( iconToolBar ); | 553 | menuBar1 = new QPEMenuBar( iconToolBar ); |
541 | QPopupMenu *menuBar = new QPopupMenu( this ); | 554 | QPopupMenu *menuBar = new QPopupMenu( this ); |
542 | menuBar1->insertItem( i18n("ME"), menuBar); | 555 | icon = loadPixmap( pathString + "z_menu" ); |
556 | menuBar1->insertItem( icon.pixmap(), menuBar); | ||
557 | //menuBar1->insertItem( i18n("ME"), menuBar); | ||
543 | menuBar->insertItem( i18n("File"), importMenu ); | 558 | menuBar->insertItem( i18n("File"), importMenu ); |
544 | menuBar->insertItem( i18n("View"), viewMenu ); | 559 | menuBar->insertItem( i18n("View"), viewMenu ); |
545 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 560 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 561 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 562 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 563 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 564 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
550 | menuBar->insertItem( i18n("Help"), helpMenu ); | 565 | menuBar->insertItem( i18n("Help"), helpMenu ); |
551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 566 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 567 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
553 | } | 568 | } |
554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 569 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 570 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
556 | QIconSet icon; | ||
557 | int pixWid = 22, pixHei = 22; | ||
558 | QString pathString = ""; | ||
559 | if ( !p->mToolBarMiniIcons ) { | ||
560 | if ( QApplication::desktop()->width() < 480 ) { | ||
561 | pathString += "icons16/"; | ||
562 | pixWid = 18; pixHei = 16; | ||
563 | } | ||
564 | } else { | ||
565 | pathString += "iconsmini/"; | ||
566 | pixWid = 18; pixHei = 16; | ||
567 | } | ||
568 | mWeekBgColor = iconToolBar->backgroundColor(); | 571 | mWeekBgColor = iconToolBar->backgroundColor(); |
569 | mWeekPixmap.resize( pixWid , pixHei ); | 572 | mWeekPixmap.resize( pixWid , pixHei ); |
570 | mWeekPixmap.fill( mWeekBgColor ); | 573 | mWeekPixmap.fill( mWeekBgColor ); |
571 | icon = mWeekPixmap; | 574 | icon = mWeekPixmap; |
572 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 575 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
573 | if ( p-> mShowIconWeekNum ) | 576 | if ( p-> mShowIconWeekNum ) |
574 | mWeekAction->addTo( iconToolBar ); | 577 | mWeekAction->addTo( iconToolBar ); |
575 | mWeekFont = font(); | 578 | mWeekFont = font(); |
576 | 579 | ||
577 | int fontPoint = mWeekFont.pointSize(); | 580 | int fontPoint = mWeekFont.pointSize(); |
578 | QFontMetrics f( mWeekFont ); | 581 | QFontMetrics f( mWeekFont ); |
579 | int fontWid = f.width( "30" ); | 582 | int fontWid = f.width( "30" ); |
580 | while ( fontWid > pixWid ) { | 583 | while ( fontWid > pixWid ) { |
581 | --fontPoint; | 584 | --fontPoint; |
582 | mWeekFont.setPointSize( fontPoint ); | 585 | mWeekFont.setPointSize( fontPoint ); |
583 | QFontMetrics f( mWeekFont ); | 586 | QFontMetrics f( mWeekFont ); |
584 | fontWid = f.width( "30" ); | 587 | fontWid = f.width( "30" ); |
585 | qDebug("dec-- "); | 588 | qDebug("dec-- "); |
586 | } | 589 | } |
587 | 590 | ||
588 | connect( mWeekAction, SIGNAL( activated() ), | 591 | connect( mWeekAction, SIGNAL( activated() ), |
589 | this, SLOT( weekAction() ) ); | 592 | this, SLOT( weekAction() ) ); |
590 | 593 | ||
591 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 594 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
592 | 595 | ||
593 | //#endif | 596 | //#endif |
594 | // ****************** | 597 | // ****************** |
595 | QAction *action; | 598 | QAction *action; |
596 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 599 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
597 | configureToolBarMenu->setCheckable( true ); | 600 | configureToolBarMenu->setCheckable( true ); |
598 | 601 | ||
599 | 602 | ||
600 | configureAgendaMenu->setCheckable( true ); | 603 | configureAgendaMenu->setCheckable( true ); |
601 | int iii ; | 604 | int iii ; |
602 | for ( iii = 1;iii<= 10 ;++iii ){ | 605 | for ( iii = 1;iii<= 10 ;++iii ){ |
603 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 606 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
604 | } | 607 | } |
605 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 608 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
606 | 609 | ||
607 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 610 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
608 | this, SLOT( showConfigureAgenda( ) ) ); | 611 | this, SLOT( showConfigureAgenda( ) ) ); |
609 | 612 | ||
610 | icon = loadPixmap( pathString + "configure" ); | 613 | icon = loadPixmap( pathString + "configure" ); |
611 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 614 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
612 | action->addTo( actionMenu ); | 615 | action->addTo( actionMenu ); |
613 | connect( action, SIGNAL( activated() ), | 616 | connect( action, SIGNAL( activated() ), |
614 | mView, SLOT( edit_options() ) ); | 617 | mView, SLOT( edit_options() ) ); |
615 | actionMenu->insertSeparator(); | 618 | actionMenu->insertSeparator(); |
616 | 619 | ||
617 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 620 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
618 | action->addTo( actionMenu ); | 621 | action->addTo( actionMenu ); |
619 | connect( action, SIGNAL( activated() ), | 622 | connect( action, SIGNAL( activated() ), |
620 | mView, SLOT( undo_delete() ) ); | 623 | mView, SLOT( undo_delete() ) ); |
621 | actionMenu->insertSeparator(); | 624 | actionMenu->insertSeparator(); |
622 | 625 | ||
623 | icon = loadPixmap( pathString + "newevent" ); | 626 | icon = loadPixmap( pathString + "newevent" ); |
624 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 627 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
625 | configureToolBarMenu->insertSeparator(); | 628 | configureToolBarMenu->insertSeparator(); |
626 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 629 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
627 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 630 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
628 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 631 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
629 | ne_action->addTo( actionMenu ); | 632 | ne_action->addTo( actionMenu ); |
630 | connect( ne_action, SIGNAL( activated() ), | 633 | connect( ne_action, SIGNAL( activated() ), |
631 | mView, SLOT( newEvent() ) ); | 634 | mView, SLOT( newEvent() ) ); |
632 | icon = loadPixmap( pathString + "newtodo" ); | 635 | icon = loadPixmap( pathString + "newtodo" ); |
633 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 636 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
634 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 637 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
635 | nt_action->addTo( actionMenu ); | 638 | nt_action->addTo( actionMenu ); |
636 | connect( nt_action, SIGNAL( activated() ), | 639 | connect( nt_action, SIGNAL( activated() ), |
637 | mView, SLOT( newTodo() ) ); | 640 | mView, SLOT( newTodo() ) ); |
638 | 641 | ||
639 | icon = loadPixmap( pathString + "today" ); | 642 | icon = loadPixmap( pathString + "today" ); |
640 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 643 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
641 | today_action->addTo( viewMenu ); | 644 | today_action->addTo( viewMenu ); |
642 | connect( today_action, SIGNAL( activated() ), | 645 | connect( today_action, SIGNAL( activated() ), |
643 | mView, SLOT( goToday() ) ); | 646 | mView, SLOT( goToday() ) ); |
644 | viewMenu->insertSeparator(); | 647 | viewMenu->insertSeparator(); |
645 | 648 | ||
646 | icon = loadPixmap( pathString + "navi" ); | 649 | icon = loadPixmap( pathString + "navi" ); |
647 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 650 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
648 | action->addTo( viewMenu ); | 651 | action->addTo( viewMenu ); |
649 | connect( action, SIGNAL( activated() ), | 652 | connect( action, SIGNAL( activated() ), |
650 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 653 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
651 | mToggleNav = action ; | 654 | mToggleNav = action ; |
652 | icon = loadPixmap( pathString + "filter" ); | 655 | icon = loadPixmap( pathString + "filter" ); |
653 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 656 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
654 | action->addTo( viewMenu ); | 657 | action->addTo( viewMenu ); |
655 | connect( action, SIGNAL( activated() ), | 658 | connect( action, SIGNAL( activated() ), |
656 | mView, SLOT( toggleFilter() ) ); | 659 | mView, SLOT( toggleFilter() ) ); |
657 | mToggleFilter = action; | 660 | mToggleFilter = action; |
658 | icon = loadPixmap( pathString + "allday" ); | 661 | icon = loadPixmap( pathString + "allday" ); |
659 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 662 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
660 | action->addTo( viewMenu ); | 663 | action->addTo( viewMenu ); |
661 | connect( action, SIGNAL( activated() ), | 664 | connect( action, SIGNAL( activated() ), |
662 | mView, SLOT( toggleAllDaySize() ) ); | 665 | mView, SLOT( toggleAllDaySize() ) ); |
663 | mToggleAllday = action; | 666 | mToggleAllday = action; |
664 | 667 | ||
665 | 668 | ||
666 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 669 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
667 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 670 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
668 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 671 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
669 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 672 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
670 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 673 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
671 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 674 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
672 | 675 | ||
673 | viewMenu->insertSeparator(); | 676 | viewMenu->insertSeparator(); |
674 | icon = loadPixmap( pathString + "picker" ); | 677 | icon = loadPixmap( pathString + "picker" ); |
675 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 678 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
676 | action->addTo( viewMenu ); | 679 | action->addTo( viewMenu ); |
677 | connect( action, SIGNAL( activated() ), | 680 | connect( action, SIGNAL( activated() ), |
678 | mView, SLOT( showDatePicker() ) ); | 681 | mView, SLOT( showDatePicker() ) ); |
679 | action->addTo( iconToolBar ); | 682 | action->addTo( iconToolBar ); |
680 | viewMenu->insertSeparator(); | 683 | viewMenu->insertSeparator(); |
681 | icon = loadPixmap( pathString + "list" ); | 684 | icon = loadPixmap( pathString + "list" ); |
682 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 685 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
683 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 686 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
684 | showlist_action->addTo( viewMenu ); | 687 | showlist_action->addTo( viewMenu ); |
685 | connect( showlist_action, SIGNAL( activated() ), | 688 | connect( showlist_action, SIGNAL( activated() ), |
686 | mView->viewManager(), SLOT( showListView() ) ); | 689 | mView->viewManager(), SLOT( showListView() ) ); |
687 | 690 | ||
688 | 691 | ||
689 | icon = loadPixmap( pathString + "day" ); | 692 | icon = loadPixmap( pathString + "day" ); |
690 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 693 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
691 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 694 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
692 | day1_action->addTo( viewMenu ); | 695 | day1_action->addTo( viewMenu ); |
693 | // action->addTo( toolBar ); | 696 | // action->addTo( toolBar ); |
694 | connect( day1_action, SIGNAL( activated() ), | 697 | connect( day1_action, SIGNAL( activated() ), |
695 | mView->viewManager(), SLOT( showDayView() ) ); | 698 | mView->viewManager(), SLOT( showDayView() ) ); |
696 | 699 | ||
697 | icon = loadPixmap( pathString + "workweek" ); | 700 | icon = loadPixmap( pathString + "workweek" ); |
698 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 701 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
699 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 702 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
700 | day5_action->addTo( viewMenu ); | 703 | day5_action->addTo( viewMenu ); |
701 | connect( day5_action, SIGNAL( activated() ), | 704 | connect( day5_action, SIGNAL( activated() ), |
702 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 705 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
703 | 706 | ||
704 | icon = loadPixmap( pathString + "week" ); | 707 | icon = loadPixmap( pathString + "week" ); |
705 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 708 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
706 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 709 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
707 | day7_action->addTo( viewMenu ); | 710 | day7_action->addTo( viewMenu ); |
708 | connect( day7_action, SIGNAL( activated() ), | 711 | connect( day7_action, SIGNAL( activated() ), |
709 | mView->viewManager(), SLOT( showWeekView() ) ); | 712 | mView->viewManager(), SLOT( showWeekView() ) ); |
710 | 713 | ||
711 | icon = loadPixmap( pathString + "workweek2" ); | 714 | icon = loadPixmap( pathString + "workweek2" ); |
712 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 715 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
713 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 716 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
714 | day6_action->addTo( viewMenu ); | 717 | day6_action->addTo( viewMenu ); |
715 | connect( day6_action, SIGNAL( activated() ), | 718 | connect( day6_action, SIGNAL( activated() ), |
716 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 719 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
717 | 720 | ||
718 | icon = loadPixmap( pathString + "month" ); | 721 | icon = loadPixmap( pathString + "month" ); |
719 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 722 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
720 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 723 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
721 | month_action->addTo( viewMenu ); | 724 | month_action->addTo( viewMenu ); |
722 | connect( month_action, SIGNAL( activated() ), | 725 | connect( month_action, SIGNAL( activated() ), |
723 | mView->viewManager(), SLOT( showMonthView() ) ); | 726 | mView->viewManager(), SLOT( showMonthView() ) ); |
724 | 727 | ||
725 | icon = loadPixmap( pathString + "todo" ); | 728 | icon = loadPixmap( pathString + "todo" ); |
726 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 729 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
727 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 730 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
728 | todoview_action->addTo( viewMenu ); | 731 | todoview_action->addTo( viewMenu ); |
729 | connect( todoview_action, SIGNAL( activated() ), | 732 | connect( todoview_action, SIGNAL( activated() ), |
730 | mView->viewManager(), SLOT( showTodoView() ) ); | 733 | mView->viewManager(), SLOT( showTodoView() ) ); |
731 | 734 | ||
732 | icon = loadPixmap( pathString + "journal" ); | 735 | icon = loadPixmap( pathString + "journal" ); |
733 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 736 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
734 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 737 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
735 | viewjournal_action->addTo( viewMenu ); | 738 | viewjournal_action->addTo( viewMenu ); |
736 | connect( viewjournal_action, SIGNAL( activated() ), | 739 | connect( viewjournal_action, SIGNAL( activated() ), |
737 | mView->viewManager(), SLOT( showJournalView() ) ); | 740 | mView->viewManager(), SLOT( showJournalView() ) ); |
738 | 741 | ||
739 | icon = loadPixmap( pathString + "xdays" ); | 742 | icon = loadPixmap( pathString + "xdays" ); |
740 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 743 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
741 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 744 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
742 | xdays_action->addTo( viewMenu ); | 745 | xdays_action->addTo( viewMenu ); |
743 | connect( xdays_action, SIGNAL( activated() ), | 746 | connect( xdays_action, SIGNAL( activated() ), |
744 | mView->viewManager(), SLOT( showNextXView() ) ); | 747 | mView->viewManager(), SLOT( showNextXView() ) ); |
745 | 748 | ||
746 | icon = loadPixmap( pathString + "whatsnext" ); | 749 | icon = loadPixmap( pathString + "whatsnext" ); |
747 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 750 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
748 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 751 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
749 | whatsnext_action->addTo( viewMenu ); | 752 | whatsnext_action->addTo( viewMenu ); |
750 | connect( whatsnext_action, SIGNAL( activated() ), | 753 | connect( whatsnext_action, SIGNAL( activated() ), |
751 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 754 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
752 | 755 | ||
753 | #if 0 | 756 | #if 0 |
754 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 757 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
755 | action->addTo( viewMenu ); | 758 | action->addTo( viewMenu ); |
756 | connect( action, SIGNAL( activated() ), | 759 | connect( action, SIGNAL( activated() ), |
757 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 760 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
758 | #endif | 761 | #endif |
759 | 762 | ||
760 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 763 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
761 | this ); | 764 | this ); |
762 | mNewSubTodoAction->addTo( actionMenu ); | 765 | mNewSubTodoAction->addTo( actionMenu ); |
763 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 766 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
764 | mView, SLOT( newSubTodo() ) ); | 767 | mView, SLOT( newSubTodo() ) ); |
765 | 768 | ||
766 | actionMenu->insertSeparator(); | 769 | actionMenu->insertSeparator(); |
767 | 770 | ||
768 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 771 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
769 | mShowAction->addTo( actionMenu ); | 772 | mShowAction->addTo( actionMenu ); |
770 | connect( mShowAction, SIGNAL( activated() ), | 773 | connect( mShowAction, SIGNAL( activated() ), |
771 | mView, SLOT( showIncidence() ) ); | 774 | mView, SLOT( showIncidence() ) ); |
772 | 775 | ||
773 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 776 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
774 | mEditAction->addTo( actionMenu ); | 777 | mEditAction->addTo( actionMenu ); |
775 | connect( mEditAction, SIGNAL( activated() ), | 778 | connect( mEditAction, SIGNAL( activated() ), |
776 | mView, SLOT( editIncidence() ) ); | 779 | mView, SLOT( editIncidence() ) ); |
777 | 780 | ||
778 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 781 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
779 | mDeleteAction->addTo( actionMenu ); | 782 | mDeleteAction->addTo( actionMenu ); |
780 | connect( mDeleteAction, SIGNAL( activated() ), | 783 | connect( mDeleteAction, SIGNAL( activated() ), |
781 | mView, SLOT( deleteIncidence() ) ); | 784 | mView, SLOT( deleteIncidence() ) ); |
782 | 785 | ||
783 | 786 | ||
784 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 787 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
785 | mCloneAction->addTo( actionMenu ); | 788 | mCloneAction->addTo( actionMenu ); |
786 | connect( mCloneAction, SIGNAL( activated() ), | 789 | connect( mCloneAction, SIGNAL( activated() ), |
787 | mView, SLOT( cloneIncidence() ) ); | 790 | mView, SLOT( cloneIncidence() ) ); |
788 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 791 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
789 | mMoveAction->addTo( actionMenu ); | 792 | mMoveAction->addTo( actionMenu ); |
790 | connect( mMoveAction, SIGNAL( activated() ), | 793 | connect( mMoveAction, SIGNAL( activated() ), |
791 | mView, SLOT( moveIncidence() ) ); | 794 | mView, SLOT( moveIncidence() ) ); |
792 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 795 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
793 | mBeamAction->addTo( actionMenu ); | 796 | mBeamAction->addTo( actionMenu ); |
794 | connect( mBeamAction, SIGNAL( activated() ), | 797 | connect( mBeamAction, SIGNAL( activated() ), |
795 | mView, SLOT( beamIncidence() ) ); | 798 | mView, SLOT( beamIncidence() ) ); |
796 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 799 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
797 | mCancelAction->addTo( actionMenu ); | 800 | mCancelAction->addTo( actionMenu ); |
798 | connect( mCancelAction, SIGNAL( activated() ), | 801 | connect( mCancelAction, SIGNAL( activated() ), |
799 | mView, SLOT( toggleCancelIncidence() ) ); | 802 | mView, SLOT( toggleCancelIncidence() ) ); |
800 | 803 | ||
801 | actionMenu->insertSeparator(); | 804 | actionMenu->insertSeparator(); |
802 | 805 | ||
803 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 806 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
804 | this ); | 807 | this ); |
805 | action->addTo( actionMenu ); | 808 | action->addTo( actionMenu ); |
806 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 809 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
807 | 810 | ||
808 | icon = loadPixmap( pathString + "search" ); | 811 | icon = loadPixmap( pathString + "search" ); |
809 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 812 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
810 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 813 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
811 | search_action->addTo( actionMenu ); | 814 | search_action->addTo( actionMenu ); |
812 | connect( search_action, SIGNAL( activated() ), | 815 | connect( search_action, SIGNAL( activated() ), |
813 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 816 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
814 | 817 | ||
815 | 818 | ||
816 | 819 | ||
817 | if ( KOPrefs::instance()->mShowFullMenu ) { | 820 | if ( KOPrefs::instance()->mShowFullMenu ) { |
818 | actionMenu->insertSeparator(); | 821 | actionMenu->insertSeparator(); |
819 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 822 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
820 | 823 | ||
821 | } | 824 | } |
822 | // actionMenu->insertSeparator(); | 825 | // actionMenu->insertSeparator(); |
823 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 826 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
824 | this ); | 827 | this ); |
825 | action->addTo( importMenu ); | 828 | action->addTo( importMenu ); |
826 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 829 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
827 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 830 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
828 | this ); | 831 | this ); |
829 | action->addTo( importMenu ); | 832 | action->addTo( importMenu ); |
830 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 833 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
831 | importMenu->insertSeparator(); | 834 | importMenu->insertSeparator(); |
832 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 835 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
833 | this ); | 836 | this ); |
834 | action->addTo( importMenu ); | 837 | action->addTo( importMenu ); |
835 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 838 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
836 | //#ifndef DESKTOP_VERSION | 839 | //#ifndef DESKTOP_VERSION |
837 | importMenu->insertSeparator(); | 840 | importMenu->insertSeparator(); |
838 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 841 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
839 | this ); | 842 | this ); |
840 | action->addTo( importMenu ); | 843 | action->addTo( importMenu ); |
841 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 844 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
842 | //#else | 845 | //#else |
843 | #ifdef _OL_IMPORT_ | 846 | #ifdef _OL_IMPORT_ |
844 | importMenu->insertSeparator(); | 847 | importMenu->insertSeparator(); |
845 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 848 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
846 | this ); | 849 | this ); |
847 | action->addTo( importMenu ); | 850 | action->addTo( importMenu ); |
848 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 851 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
849 | #endif | 852 | #endif |
850 | //#endif | 853 | //#endif |
851 | 854 | ||
852 | importMenu->insertSeparator(); | 855 | importMenu->insertSeparator(); |
853 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 856 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
854 | this ); | 857 | this ); |
855 | action->addTo( importMenu ); | 858 | action->addTo( importMenu ); |
856 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 859 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
857 | 860 | ||
858 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 861 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
859 | this ); | 862 | this ); |
860 | action->addTo( importMenu ); | 863 | action->addTo( importMenu ); |
861 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 864 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
862 | 865 | ||
863 | importMenu->insertSeparator(); | 866 | importMenu->insertSeparator(); |
864 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 867 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
865 | this ); | 868 | this ); |
866 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 869 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
867 | 870 | ||
868 | 871 | ||
869 | //LR | 872 | //LR |
870 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 873 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
871 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 874 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
872 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 875 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
873 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 876 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
874 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 877 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
875 | 878 | ||
876 | importMenu->insertSeparator(); | 879 | importMenu->insertSeparator(); |
877 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 880 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
878 | this ); | 881 | this ); |
879 | action->addTo( importMenu ); | 882 | action->addTo( importMenu ); |
880 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 883 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
881 | #ifndef DESKTOP_VERSION | 884 | #ifndef DESKTOP_VERSION |
882 | importMenu->insertSeparator(); | 885 | importMenu->insertSeparator(); |
883 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 886 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
884 | this ); | 887 | this ); |
885 | brAction->addTo( importMenu ); | 888 | brAction->addTo( importMenu ); |
886 | brAction->setToggleAction (true ) ; | 889 | brAction->setToggleAction (true ) ; |
887 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 890 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
888 | 891 | ||
889 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 892 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
890 | this ); | 893 | this ); |
891 | action->addTo( importMenu ); | 894 | action->addTo( importMenu ); |
892 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 895 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
893 | 896 | ||
894 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 897 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
895 | this ); | 898 | this ); |
896 | action->addTo( importMenu ); | 899 | action->addTo( importMenu ); |
897 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 900 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
898 | #else | 901 | #else |
899 | importMenu->insertSeparator(); | 902 | importMenu->insertSeparator(); |
900 | icon = loadPixmap( pathString + "print" ); | 903 | icon = loadPixmap( pathString + "print" ); |
901 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 904 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
902 | action->addTo( importMenu ); | 905 | action->addTo( importMenu ); |
903 | connect( action, SIGNAL( activated() ), | 906 | connect( action, SIGNAL( activated() ), |
904 | this, SLOT( printCal() ) ); | 907 | this, SLOT( printCal() ) ); |
905 | 908 | ||
906 | icon = loadPixmap( pathString + "print" ); | 909 | icon = loadPixmap( pathString + "print" ); |
907 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 910 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
908 | action->addTo( importMenu ); | 911 | action->addTo( importMenu ); |
909 | connect( action, SIGNAL( activated() ), | 912 | connect( action, SIGNAL( activated() ), |
910 | this, SLOT( printSel() ) ); | 913 | this, SLOT( printSel() ) ); |
911 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 914 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
912 | action->addTo( importMenu ); | 915 | action->addTo( importMenu ); |
913 | connect( action, SIGNAL( activated() ), | 916 | connect( action, SIGNAL( activated() ), |
914 | mView->viewManager(), SIGNAL( printWNV() ) ); | 917 | mView->viewManager(), SIGNAL( printWNV() ) ); |
915 | #endif | 918 | #endif |
916 | importMenu->insertSeparator(); | 919 | importMenu->insertSeparator(); |
917 | action = new QAction( "beam all", i18n("Save"), 0, | 920 | action = new QAction( "beam all", i18n("Save"), 0, |
918 | this ); | 921 | this ); |
919 | action->addTo( importMenu ); | 922 | action->addTo( importMenu ); |
920 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 923 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
921 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 924 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
922 | this ); | 925 | this ); |
923 | action->addTo( importMenu ); | 926 | action->addTo( importMenu ); |
924 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 927 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
925 | 928 | ||
926 | //menuBar->insertItem( "Configure",configureMenu ); | 929 | //menuBar->insertItem( "Configure",configureMenu ); |
927 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 930 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
928 | icon = loadPixmap( "korganizer/korganizer" ); | 931 | icon = loadPixmap( "korganizer/korganizer" ); |
929 | 932 | ||
930 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 933 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
931 | action->addTo( helpMenu ); | 934 | action->addTo( helpMenu ); |
932 | connect( action, SIGNAL( activated() ), | 935 | connect( action, SIGNAL( activated() ), |
933 | SLOT( whatsNew() ) ); | 936 | SLOT( whatsNew() ) ); |
934 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 937 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
935 | action->addTo( helpMenu ); | 938 | action->addTo( helpMenu ); |
936 | connect( action, SIGNAL( activated() ), | 939 | connect( action, SIGNAL( activated() ), |
937 | SLOT( features() ) ); | 940 | SLOT( features() ) ); |
938 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 941 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
939 | action->addTo( helpMenu ); | 942 | action->addTo( helpMenu ); |
940 | connect( action, SIGNAL( activated() ), | 943 | connect( action, SIGNAL( activated() ), |
941 | SLOT( keyBindings() ) ); | 944 | SLOT( keyBindings() ) ); |
942 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 945 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
943 | action->addTo( helpMenu ); | 946 | action->addTo( helpMenu ); |
944 | connect( action, SIGNAL( activated() ), | 947 | connect( action, SIGNAL( activated() ), |
945 | SLOT( synchowto() ) ); | 948 | SLOT( synchowto() ) ); |
946 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 949 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
947 | action->addTo( helpMenu ); | 950 | action->addTo( helpMenu ); |
948 | connect( action, SIGNAL( activated() ), | 951 | connect( action, SIGNAL( activated() ), |
949 | SLOT( kdesynchowto() ) ); | 952 | SLOT( kdesynchowto() ) ); |
950 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 953 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
951 | action->addTo( helpMenu ); | 954 | action->addTo( helpMenu ); |
952 | connect( action, SIGNAL( activated() ), | 955 | connect( action, SIGNAL( activated() ), |
953 | SLOT( multisynchowto() ) ); | 956 | SLOT( multisynchowto() ) ); |
954 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 957 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
955 | action->addTo( helpMenu ); | 958 | action->addTo( helpMenu ); |
956 | connect( action, SIGNAL( activated() ), | 959 | connect( action, SIGNAL( activated() ), |
957 | SLOT( aboutAutoSaving() ) ); | 960 | SLOT( aboutAutoSaving() ) ); |
958 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 961 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
959 | action->addTo( helpMenu ); | 962 | action->addTo( helpMenu ); |
960 | connect( action, SIGNAL( activated() ), | 963 | connect( action, SIGNAL( activated() ), |
961 | SLOT( aboutKnownBugs() ) ); | 964 | SLOT( aboutKnownBugs() ) ); |
962 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 965 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
963 | action->addTo( helpMenu ); | 966 | action->addTo( helpMenu ); |
964 | connect( action, SIGNAL( activated() ), | 967 | connect( action, SIGNAL( activated() ), |
965 | SLOT( usertrans() ) ); | 968 | SLOT( usertrans() ) ); |
966 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 969 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
967 | action->addTo( helpMenu ); | 970 | action->addTo( helpMenu ); |
968 | connect( action, SIGNAL( activated() ), | 971 | connect( action, SIGNAL( activated() ), |
969 | SLOT( faq() ) ); | 972 | SLOT( faq() ) ); |
970 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 973 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
971 | action->addTo( helpMenu ); | 974 | action->addTo( helpMenu ); |
972 | connect( action, SIGNAL( activated() ), | 975 | connect( action, SIGNAL( activated() ), |
973 | SLOT( licence() ) ); | 976 | SLOT( licence() ) ); |
974 | action = new QAction( "about", i18n("About..."), 0, this ); | 977 | action = new QAction( "about", i18n("About..."), 0, this ); |
975 | action->addTo( helpMenu ); | 978 | action->addTo( helpMenu ); |
976 | connect( action, SIGNAL( activated() ), | 979 | connect( action, SIGNAL( activated() ), |
977 | SLOT( about() ) ); | 980 | SLOT( about() ) ); |
978 | //menuBar->insertSeparator(); | 981 | //menuBar->insertSeparator(); |
979 | 982 | ||
980 | // ****************************************************** | 983 | // ****************************************************** |
981 | // menubar icons | 984 | // menubar icons |
982 | 985 | ||
983 | 986 | ||
984 | iconToolBar->setHorizontalStretchable (true ); | 987 | iconToolBar->setHorizontalStretchable (true ); |
985 | //menuBar->insertItem( iconToolBar ); | 988 | //menuBar->insertItem( iconToolBar ); |
986 | //xdays_action | 989 | //xdays_action |
987 | if (p-> mShowIconNewEvent) | 990 | if (p-> mShowIconNewEvent) |
988 | ne_action->addTo( iconToolBar ); | 991 | ne_action->addTo( iconToolBar ); |
989 | if (p->mShowIconNewTodo ) | 992 | if (p->mShowIconNewTodo ) |
990 | nt_action->addTo( iconToolBar ); | 993 | nt_action->addTo( iconToolBar ); |
991 | if (p-> mShowIconSearch) | 994 | if (p-> mShowIconSearch) |
992 | search_action->addTo( iconToolBar ); | 995 | search_action->addTo( iconToolBar ); |
993 | if (p-> mShowIconNext) | 996 | if (p-> mShowIconNext) |
994 | whatsnext_action->addTo( iconToolBar ); | 997 | whatsnext_action->addTo( iconToolBar ); |
995 | if (p-> mShowIconNextDays) | 998 | if (p-> mShowIconNextDays) |
996 | xdays_action->addTo( iconToolBar ); | 999 | xdays_action->addTo( iconToolBar ); |
997 | if (p-> mShowIconList) | 1000 | if (p-> mShowIconList) |
998 | showlist_action->addTo( iconToolBar ); | 1001 | showlist_action->addTo( iconToolBar ); |
999 | if (p-> mShowIconDay1) | 1002 | if (p-> mShowIconDay1) |
1000 | day1_action->addTo( iconToolBar ); | 1003 | day1_action->addTo( iconToolBar ); |
1001 | if (p-> mShowIconDay5) | 1004 | if (p-> mShowIconDay5) |
1002 | day5_action->addTo( iconToolBar ); | 1005 | day5_action->addTo( iconToolBar ); |
1003 | if (p-> mShowIconDay7) | 1006 | if (p-> mShowIconDay7) |
1004 | day7_action->addTo( iconToolBar ); | 1007 | day7_action->addTo( iconToolBar ); |
1005 | if (p-> mShowIconDay6) | 1008 | if (p-> mShowIconDay6) |
1006 | day6_action->addTo( iconToolBar ); | 1009 | day6_action->addTo( iconToolBar ); |
1007 | if (p-> mShowIconMonth) | 1010 | if (p-> mShowIconMonth) |
1008 | month_action->addTo( iconToolBar ); | 1011 | month_action->addTo( iconToolBar ); |
1009 | if (p-> mShowIconTodoview) | 1012 | if (p-> mShowIconTodoview) |
1010 | todoview_action->addTo( iconToolBar ); | 1013 | todoview_action->addTo( iconToolBar ); |
1011 | if (p-> mShowIconJournal) | 1014 | if (p-> mShowIconJournal) |
1012 | viewjournal_action->addTo( iconToolBar ); | 1015 | viewjournal_action->addTo( iconToolBar ); |
1013 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1016 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1014 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 1017 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
1015 | if (p-> mShowIconBackFast) { | 1018 | if (p-> mShowIconBackFast) { |
1016 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1019 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1017 | connect( action, SIGNAL( activated() ), | 1020 | connect( action, SIGNAL( activated() ), |
1018 | mView, SLOT( goPreviousMonth() ) ); | 1021 | mView, SLOT( goPreviousMonth() ) ); |
1019 | action->addTo( iconToolBar ); | 1022 | action->addTo( iconToolBar ); |
1020 | } | 1023 | } |
1021 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1024 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1022 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 1025 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
1023 | if (p-> mShowIconBack) { | 1026 | if (p-> mShowIconBack) { |
1024 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1027 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1025 | connect( action, SIGNAL( activated() ), | 1028 | connect( action, SIGNAL( activated() ), |
1026 | mView, SLOT( goPrevious() ) ); | 1029 | mView, SLOT( goPrevious() ) ); |
1027 | action->addTo( iconToolBar ); | 1030 | action->addTo( iconToolBar ); |
1028 | } | 1031 | } |
1029 | icon = loadPixmap( pathString + "today" ); | 1032 | icon = loadPixmap( pathString + "today" ); |
1030 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1033 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1031 | if (p-> mShowIconToday) | 1034 | if (p-> mShowIconToday) |
1032 | today_action->addTo( iconToolBar ); | 1035 | today_action->addTo( iconToolBar ); |
1033 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1036 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1034 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1037 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1035 | if (p-> mShowIconForward) { | 1038 | if (p-> mShowIconForward) { |
1036 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1039 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1037 | connect( action, SIGNAL( activated() ), | 1040 | connect( action, SIGNAL( activated() ), |
1038 | mView, SLOT( goNext() ) ); | 1041 | mView, SLOT( goNext() ) ); |
1039 | action->addTo( iconToolBar ); | 1042 | action->addTo( iconToolBar ); |
1040 | } | 1043 | } |
1041 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1044 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1042 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1045 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1043 | if (p-> mShowIconForwardFast) { | 1046 | if (p-> mShowIconForwardFast) { |
1044 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1047 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1045 | connect( action, SIGNAL( activated() ), | 1048 | connect( action, SIGNAL( activated() ), |
1046 | mView, SLOT( goNextMonth() ) ); | 1049 | mView, SLOT( goNextMonth() ) ); |
1047 | action->addTo( iconToolBar ); | 1050 | action->addTo( iconToolBar ); |
1048 | } | 1051 | } |
1049 | 1052 | ||
1050 | 1053 | ||
1051 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 1054 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
1052 | 1055 | ||
1053 | if (p-> mShowIconNewEvent) | 1056 | if (p-> mShowIconNewEvent) |
1054 | configureToolBarMenu->setItemChecked( 10, true ); | 1057 | configureToolBarMenu->setItemChecked( 10, true ); |
1055 | if (p->mShowIconNewTodo ) | 1058 | if (p->mShowIconNewTodo ) |
1056 | configureToolBarMenu->setItemChecked( 20, true ); | 1059 | configureToolBarMenu->setItemChecked( 20, true ); |
1057 | if (p-> mShowIconSearch) | 1060 | if (p-> mShowIconSearch) |
1058 | configureToolBarMenu->setItemChecked( 120, true ); | 1061 | configureToolBarMenu->setItemChecked( 120, true ); |
1059 | if (p-> mShowIconList) | 1062 | if (p-> mShowIconList) |
1060 | configureToolBarMenu->setItemChecked( 30, true ); | 1063 | configureToolBarMenu->setItemChecked( 30, true ); |
1061 | if (p-> mShowIconDay1) | 1064 | if (p-> mShowIconDay1) |
1062 | configureToolBarMenu->setItemChecked( 40, true ); | 1065 | configureToolBarMenu->setItemChecked( 40, true ); |
1063 | if (p-> mShowIconDay5) | 1066 | if (p-> mShowIconDay5) |
1064 | configureToolBarMenu->setItemChecked( 50, true ); | 1067 | configureToolBarMenu->setItemChecked( 50, true ); |
1065 | if (p-> mShowIconDay6) | 1068 | if (p-> mShowIconDay6) |
1066 | configureToolBarMenu->setItemChecked( 75, true ); | 1069 | configureToolBarMenu->setItemChecked( 75, true ); |
1067 | if (p-> mShowIconDay7) | 1070 | if (p-> mShowIconDay7) |
1068 | configureToolBarMenu->setItemChecked( 60, true ); | 1071 | configureToolBarMenu->setItemChecked( 60, true ); |
1069 | if (p-> mShowIconMonth) | 1072 | if (p-> mShowIconMonth) |
1070 | configureToolBarMenu->setItemChecked( 70, true ); | 1073 | configureToolBarMenu->setItemChecked( 70, true ); |
1071 | if (p-> mShowIconTodoview) | 1074 | if (p-> mShowIconTodoview) |
1072 | configureToolBarMenu->setItemChecked( 80, true ); | 1075 | configureToolBarMenu->setItemChecked( 80, true ); |
1073 | if (p-> mShowIconBackFast) | 1076 | if (p-> mShowIconBackFast) |
1074 | configureToolBarMenu->setItemChecked( 200, true ); | 1077 | configureToolBarMenu->setItemChecked( 200, true ); |
1075 | if (p-> mShowIconBack) | 1078 | if (p-> mShowIconBack) |
1076 | configureToolBarMenu->setItemChecked( 210, true ); | 1079 | configureToolBarMenu->setItemChecked( 210, true ); |
1077 | if (p-> mShowIconToday) | 1080 | if (p-> mShowIconToday) |
1078 | configureToolBarMenu->setItemChecked( 130, true ); | 1081 | configureToolBarMenu->setItemChecked( 130, true ); |
1079 | if (p-> mShowIconForward) | 1082 | if (p-> mShowIconForward) |
1080 | configureToolBarMenu->setItemChecked( 220, true ); | 1083 | configureToolBarMenu->setItemChecked( 220, true ); |
1081 | if (p-> mShowIconForwardFast) | 1084 | if (p-> mShowIconForwardFast) |
1082 | configureToolBarMenu->setItemChecked( 230, true ); | 1085 | configureToolBarMenu->setItemChecked( 230, true ); |
1083 | if (p-> mShowIconNextDays) | 1086 | if (p-> mShowIconNextDays) |
1084 | configureToolBarMenu->setItemChecked( 100, true ); | 1087 | configureToolBarMenu->setItemChecked( 100, true ); |
1085 | if (p-> mShowIconNext) | 1088 | if (p-> mShowIconNext) |
1086 | configureToolBarMenu->setItemChecked( 110, true ); | 1089 | configureToolBarMenu->setItemChecked( 110, true ); |
1087 | if (p-> mShowIconJournal) | 1090 | if (p-> mShowIconJournal) |
1088 | configureToolBarMenu->setItemChecked( 90, true ); | 1091 | configureToolBarMenu->setItemChecked( 90, true ); |
1089 | if (p-> mShowIconWhatsThis) | 1092 | if (p-> mShowIconWhatsThis) |
1090 | configureToolBarMenu->setItemChecked( 300, true ); | 1093 | configureToolBarMenu->setItemChecked( 300, true ); |
1091 | if (p-> mShowIconWeekNum) | 1094 | if (p-> mShowIconWeekNum) |
1092 | configureToolBarMenu->setItemChecked( 400, true ); | 1095 | configureToolBarMenu->setItemChecked( 400, true ); |
1093 | QLabel* dummy = new QLabel( iconToolBar ); | 1096 | QLabel* dummy = new QLabel( iconToolBar ); |
1094 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1097 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1095 | if (!p-> mShowIconStretch) | 1098 | if (!p-> mShowIconStretch) |
1096 | iconToolBar->setStretchableWidget ( dummy ) ; | 1099 | iconToolBar->setStretchableWidget ( dummy ) ; |
1097 | else | 1100 | else |
1098 | configureToolBarMenu->setItemChecked( 5, true ); | 1101 | configureToolBarMenu->setItemChecked( 5, true ); |
1099 | if (p-> mShowIconWhatsThis) | 1102 | if (p-> mShowIconWhatsThis) |
1100 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1103 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1101 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1104 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1102 | configureAgenda( p->mHourSize ); | 1105 | configureAgenda( p->mHourSize ); |
1103 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1106 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1104 | } | 1107 | } |
1105 | 1108 | ||
1106 | void MainWindow::exportToPhone( int mode ) | 1109 | void MainWindow::exportToPhone( int mode ) |
1107 | { | 1110 | { |
1108 | 1111 | ||
1109 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1112 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1110 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1113 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1111 | KOex2phonePrefs ex2phone; | 1114 | KOex2phonePrefs ex2phone; |
1112 | 1115 | ||
1113 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1116 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1114 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1117 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1115 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1118 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1116 | if ( mode == 1 ) | 1119 | if ( mode == 1 ) |
1117 | ex2phone.setCaption(i18n("Export complete calendar")); | 1120 | ex2phone.setCaption(i18n("Export complete calendar")); |
1118 | if ( mode == 2 ) | 1121 | if ( mode == 2 ) |
1119 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1122 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1120 | 1123 | ||
1121 | if ( !ex2phone.exec() ) { | 1124 | if ( !ex2phone.exec() ) { |
1122 | return; | 1125 | return; |
1123 | } | 1126 | } |
1124 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1127 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1125 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1128 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1126 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1129 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1127 | 1130 | ||
1128 | int inFuture = 0; | 1131 | int inFuture = 0; |
1129 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1132 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1130 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1133 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1131 | QPtrList<Incidence> delSel; | 1134 | QPtrList<Incidence> delSel; |
1132 | if ( mode == 1 ) | 1135 | if ( mode == 1 ) |
1133 | delSel = mCalendar->rawIncidences(); | 1136 | delSel = mCalendar->rawIncidences(); |
1134 | if ( mode == 2 ) | 1137 | if ( mode == 2 ) |
1135 | delSel = mCalendar->incidences(); | 1138 | delSel = mCalendar->incidences(); |
1136 | CalendarLocal* cal = new CalendarLocal(); | 1139 | CalendarLocal* cal = new CalendarLocal(); |
1137 | cal->setLocalTime(); | 1140 | cal->setLocalTime(); |
1138 | Incidence *incidence = delSel.first(); | 1141 | Incidence *incidence = delSel.first(); |
1139 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1142 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1140 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1143 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1141 | while ( incidence ) { | 1144 | while ( incidence ) { |
1142 | if ( incidence->type() != "Journal" ) { | 1145 | if ( incidence->type() != "Journal" ) { |
1143 | bool add = true; | 1146 | bool add = true; |
1144 | if ( inFuture ) { | 1147 | if ( inFuture ) { |
1145 | QDateTime dt; | 1148 | QDateTime dt; |
1146 | if ( incidence->type() == "Todo" ) { | 1149 | if ( incidence->type() == "Todo" ) { |
1147 | Todo * t = (Todo*)incidence; | 1150 | Todo * t = (Todo*)incidence; |
1148 | if ( t->hasDueDate() ) | 1151 | if ( t->hasDueDate() ) |
1149 | dt = t->dtDue(); | 1152 | dt = t->dtDue(); |
1150 | else | 1153 | else |
1151 | dt = cur.addSecs( 62 ); | 1154 | dt = cur.addSecs( 62 ); |
1152 | } | 1155 | } |
1153 | else { | 1156 | else { |
1154 | bool ok; | 1157 | bool ok; |
1155 | dt = incidence->getNextOccurence( cur, &ok ); | 1158 | dt = incidence->getNextOccurence( cur, &ok ); |
1156 | if ( !ok ) | 1159 | if ( !ok ) |
1157 | dt = cur.addSecs( -62 ); | 1160 | dt = cur.addSecs( -62 ); |
1158 | } | 1161 | } |
1159 | if ( dt < cur || dt > end ) { | 1162 | if ( dt < cur || dt > end ) { |
1160 | add = false; | 1163 | add = false; |
1161 | } | 1164 | } |
1162 | } | 1165 | } |
1163 | if ( add ) { | 1166 | if ( add ) { |
1164 | Incidence *in = incidence->clone(); | 1167 | Incidence *in = incidence->clone(); |
1165 | cal->addIncidence( in ); | 1168 | cal->addIncidence( in ); |
1166 | } | 1169 | } |
1167 | } | 1170 | } |
1168 | incidence = delSel.next(); | 1171 | incidence = delSel.next(); |
1169 | } | 1172 | } |
1170 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1173 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1171 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1174 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1172 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1175 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1173 | 1176 | ||
1174 | setCaption( i18n("Writing to phone...")); | 1177 | setCaption( i18n("Writing to phone...")); |
1175 | if ( PhoneFormat::writeToPhone( cal ) ) | 1178 | if ( PhoneFormat::writeToPhone( cal ) ) |
1176 | setCaption( i18n("Export to phone successful!")); | 1179 | setCaption( i18n("Export to phone successful!")); |
1177 | else | 1180 | else |
1178 | setCaption( i18n("Error exporting to phone!")); | 1181 | setCaption( i18n("Error exporting to phone!")); |
1179 | delete cal; | 1182 | delete cal; |
1180 | } | 1183 | } |
1181 | 1184 | ||
1182 | 1185 | ||
1183 | void MainWindow::setDefaultPreferences() | 1186 | void MainWindow::setDefaultPreferences() |
1184 | { | 1187 | { |
1185 | KOPrefs *p = KOPrefs::instance(); | 1188 | KOPrefs *p = KOPrefs::instance(); |
1186 | 1189 | ||
1187 | p->mCompactDialogs = true; | 1190 | p->mCompactDialogs = true; |
1188 | p->mConfirm = true; | 1191 | p->mConfirm = true; |
1189 | // p->mEnableQuickTodo = false; | 1192 | // p->mEnableQuickTodo = false; |
1190 | 1193 | ||
1191 | } | 1194 | } |
1192 | 1195 | ||
1193 | QString MainWindow::resourcePath() | 1196 | QString MainWindow::resourcePath() |
1194 | { | 1197 | { |
1195 | return KGlobal::iconLoader()->iconPath(); | 1198 | return KGlobal::iconLoader()->iconPath(); |
1196 | } | 1199 | } |
1197 | 1200 | ||
1198 | void MainWindow::displayText( QString text ,QString cap ) | 1201 | void MainWindow::displayText( QString text ,QString cap ) |
1199 | { | 1202 | { |
1200 | QDialog dia( this, "name", true ); ; | 1203 | QDialog dia( this, "name", true ); ; |
1201 | dia.setCaption( cap ); | 1204 | dia.setCaption( cap ); |
1202 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1205 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1203 | lay->setSpacing( 3 ); | 1206 | lay->setSpacing( 3 ); |
1204 | lay->setMargin( 3 ); | 1207 | lay->setMargin( 3 ); |
1205 | QTextBrowser tb ( &dia ); | 1208 | QTextBrowser tb ( &dia ); |
1206 | lay->addWidget( &tb ); | 1209 | lay->addWidget( &tb ); |
1207 | tb.setText( text ); | 1210 | tb.setText( text ); |
1208 | #ifdef DESKTOP_VERSION | 1211 | #ifdef DESKTOP_VERSION |
1209 | dia.resize( 640, 480); | 1212 | dia.resize( 640, 480); |
1210 | #else | 1213 | #else |
1211 | dia.showMaximized(); | 1214 | dia.showMaximized(); |
1212 | #endif | 1215 | #endif |
1213 | dia.exec(); | 1216 | dia.exec(); |
1214 | } | 1217 | } |
1215 | 1218 | ||
1216 | void MainWindow::features() | 1219 | void MainWindow::features() |
1217 | { | 1220 | { |
1218 | 1221 | ||
1219 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1222 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1220 | } | 1223 | } |
1221 | 1224 | ||
1222 | void MainWindow::usertrans() | 1225 | void MainWindow::usertrans() |
1223 | { | 1226 | { |
1224 | 1227 | ||
1225 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1228 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1226 | } | 1229 | } |
1227 | 1230 | ||
1228 | void MainWindow::kdesynchowto() | 1231 | void MainWindow::kdesynchowto() |
1229 | { | 1232 | { |
1230 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1233 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1231 | } | 1234 | } |
1232 | void MainWindow::multisynchowto() | 1235 | void MainWindow::multisynchowto() |
1233 | { | 1236 | { |
1234 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1237 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1235 | } | 1238 | } |
1236 | void MainWindow::synchowto() | 1239 | void MainWindow::synchowto() |
1237 | { | 1240 | { |
1238 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1241 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1239 | } | 1242 | } |
1240 | void MainWindow::faq() | 1243 | void MainWindow::faq() |
1241 | { | 1244 | { |
1242 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1245 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1243 | 1246 | ||
1244 | } | 1247 | } |
1245 | void MainWindow::whatsNew() | 1248 | void MainWindow::whatsNew() |
1246 | { | 1249 | { |
1247 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1250 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1248 | 1251 | ||
1249 | } | 1252 | } |
1250 | void MainWindow::licence() | 1253 | void MainWindow::licence() |
1251 | { | 1254 | { |
1252 | KApplication::showLicence(); | 1255 | KApplication::showLicence(); |
1253 | 1256 | ||
1254 | } | 1257 | } |
1255 | void MainWindow::about() | 1258 | void MainWindow::about() |
1256 | { | 1259 | { |
1257 | QString version; | 1260 | QString version; |
1258 | #include <../version> | 1261 | #include <../version> |
1259 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1262 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1260 | i18n("KOrganizer/Platform-independent\n") + | 1263 | i18n("KOrganizer/Platform-independent\n") + |
1261 | "(KO/Pi) " + version + " - " + | 1264 | "(KO/Pi) " + version + " - " + |
1262 | 1265 | ||
1263 | #ifdef DESKTOP_VERSION | 1266 | #ifdef DESKTOP_VERSION |
1264 | i18n("Desktop Edition\n") + | 1267 | i18n("Desktop Edition\n") + |
1265 | #else | 1268 | #else |
1266 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1269 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1267 | #endif | 1270 | #endif |
1268 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1271 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1269 | } | 1272 | } |
1270 | void MainWindow::keyBindings() | 1273 | void MainWindow::keyBindings() |
1271 | { | 1274 | { |
1272 | QString cap = i18n("KO/Pi Keys + Colors"); | 1275 | QString cap = i18n("KO/Pi Keys + Colors"); |
1273 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1276 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1274 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1277 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1275 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1278 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1276 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1279 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1277 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1280 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1278 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1281 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1279 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1282 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1280 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1283 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1281 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1284 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1282 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1285 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1283 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1286 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1284 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1287 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1285 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1288 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1286 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1289 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1287 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1290 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1288 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1291 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1289 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1292 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1290 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1293 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1291 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1294 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1292 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1295 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1293 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1296 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1294 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1297 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1295 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1298 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1296 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1299 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1297 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1300 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1298 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1301 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1299 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1302 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1300 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1303 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1301 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1304 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1302 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1305 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1303 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1306 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1304 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1307 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1305 | i18n("<p><h3>In list view:</h3></p>\n") + | 1308 | i18n("<p><h3>In list view:</h3></p>\n") + |
1306 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1309 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1307 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1310 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1308 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1311 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1309 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1312 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1310 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1313 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1311 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1314 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1312 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1315 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1313 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1316 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1314 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1317 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1315 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1318 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1316 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1319 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1317 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1320 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1318 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1321 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1319 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1322 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1320 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1323 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1321 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1324 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1322 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1325 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1323 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1326 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1324 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1327 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1325 | displayText( text, cap); | 1328 | displayText( text, cap); |
1326 | } | 1329 | } |
1327 | void MainWindow::aboutAutoSaving() | 1330 | void MainWindow::aboutAutoSaving() |
1328 | { | 1331 | { |
1329 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1332 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1330 | 1333 | ||
1331 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1334 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1332 | 1335 | ||
1333 | } | 1336 | } |
1334 | void MainWindow::aboutKnownBugs() | 1337 | void MainWindow::aboutKnownBugs() |
1335 | { | 1338 | { |
1336 | QMessageBox* msg; | 1339 | QMessageBox* msg; |
1337 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1340 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1338 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1341 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1339 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1342 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1340 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1343 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1341 | i18n("\nor report them in the bugtracker on\n") + | 1344 | i18n("\nor report them in the bugtracker on\n") + |
1342 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1345 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1343 | QMessageBox::NoIcon, | 1346 | QMessageBox::NoIcon, |
1344 | QMessageBox::Ok, | 1347 | QMessageBox::Ok, |
1345 | QMessageBox::NoButton, | 1348 | QMessageBox::NoButton, |
1346 | QMessageBox::NoButton); | 1349 | QMessageBox::NoButton); |
1347 | msg->exec(); | 1350 | msg->exec(); |
1348 | delete msg; | 1351 | delete msg; |
1349 | 1352 | ||
1350 | } | 1353 | } |
1351 | 1354 | ||
1352 | QString MainWindow::defaultFileName() | 1355 | QString MainWindow::defaultFileName() |
1353 | { | 1356 | { |
1354 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1357 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1355 | } | 1358 | } |
1356 | QString MainWindow::syncFileName() | 1359 | QString MainWindow::syncFileName() |
1357 | { | 1360 | { |
1358 | #ifdef DESKTOP_VERSION | 1361 | #ifdef DESKTOP_VERSION |
1359 | return locateLocal( "tmp", "synccalendar.ics" ); | 1362 | return locateLocal( "tmp", "synccalendar.ics" ); |
1360 | #else | 1363 | #else |
1361 | return QString( "/tmp/synccalendar.ics" ); | 1364 | return QString( "/tmp/synccalendar.ics" ); |
1362 | #endif | 1365 | #endif |
1363 | } | 1366 | } |
1364 | void MainWindow::updateWeek(QDate seda) | 1367 | void MainWindow::updateWeek(QDate seda) |
1365 | { | 1368 | { |
1366 | int weekNum = 0; | 1369 | int weekNum = 0; |
1367 | QDate d = QDate ( seda.year(), 1,1); | 1370 | QDate d = QDate ( seda.year(), 1,1); |
1368 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | 1371 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday |
1369 | if ( seda.addDays(6).year() != seda.year() ) { | 1372 | if ( seda.addDays(6).year() != seda.year() ) { |
1370 | if ( seda.year() != d.year() ) { | 1373 | if ( seda.year() != d.year() ) { |
1371 | if ( d.dayOfWeek() > 4 ) | 1374 | if ( d.dayOfWeek() > 4 ) |
1372 | d = QDate ( seda.year(), 1,1); | 1375 | d = QDate ( seda.year(), 1,1); |
1373 | else | 1376 | else |
1374 | weekNum = 1; | 1377 | weekNum = 1; |
1375 | } else { | 1378 | } else { |
1376 | QDate dd( seda.year()+1, 1,1); | 1379 | QDate dd( seda.year()+1, 1,1); |
1377 | if ( dd.dayOfWeek() <= 4 ) | 1380 | if ( dd.dayOfWeek() <= 4 ) |
1378 | weekNum = 1; | 1381 | weekNum = 1; |
1379 | } | 1382 | } |
1380 | } | 1383 | } |
1381 | if ( weekNum == 0 ){ | 1384 | if ( weekNum == 0 ){ |
1382 | int dow = d.dayOfWeek(); | 1385 | int dow = d.dayOfWeek(); |
1383 | if ( dow <= 4 ) | 1386 | if ( dow <= 4 ) |
1384 | d = d.addDays( 1-dow ); | 1387 | d = d.addDays( 1-dow ); |
1385 | else // 5,6,7 | 1388 | else // 5,6,7 |
1386 | d = d.addDays( 8-dow ); | 1389 | d = d.addDays( 8-dow ); |
1387 | // we have the first week of the year.we are on monday | 1390 | // we have the first week of the year.we are on monday |
1388 | weekNum = d.daysTo( seda ) / 7 +1; | 1391 | weekNum = d.daysTo( seda ) / 7 +1; |
1389 | } | 1392 | } |
1390 | 1393 | ||
1391 | mWeekPixmap.fill( mWeekBgColor ); | 1394 | mWeekPixmap.fill( mWeekBgColor ); |
1392 | QPainter p ( &mWeekPixmap ); | 1395 | QPainter p ( &mWeekPixmap ); |
1393 | p.setFont( mWeekFont ); | 1396 | p.setFont( mWeekFont ); |
1394 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1397 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1395 | p.end(); | 1398 | p.end(); |
1396 | QIconSet icon3 ( mWeekPixmap ); | 1399 | QIconSet icon3 ( mWeekPixmap ); |
1397 | mWeekAction->setIconSet ( icon3 ); | 1400 | mWeekAction->setIconSet ( icon3 ); |
1398 | 1401 | ||
1399 | } | 1402 | } |
1400 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1403 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1401 | { | 1404 | { |
1402 | updateWeek( selectedDates.first() ); | 1405 | updateWeek( selectedDates.first() ); |
1403 | } | 1406 | } |
1404 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1407 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1405 | { | 1408 | { |
1406 | 1409 | ||
1407 | if ( !incidence ) { | 1410 | if ( !incidence ) { |
1408 | enableIncidenceActions( false ); | 1411 | enableIncidenceActions( false ); |
1409 | 1412 | ||
1410 | mNewSubTodoAction->setEnabled( false ); | 1413 | mNewSubTodoAction->setEnabled( false ); |
1411 | setCaptionToDates(); | 1414 | setCaptionToDates(); |
1412 | return; | 1415 | return; |
1413 | 1416 | ||
1414 | } | 1417 | } |
1415 | 1418 | ||
1416 | //KGlobal::locale()->formatDateTime(nextA, true); | 1419 | //KGlobal::locale()->formatDateTime(nextA, true); |
1417 | QString startString = ""; | 1420 | QString startString = ""; |
1418 | if ( incidence->type() != "Todo" ) { | 1421 | if ( incidence->type() != "Todo" ) { |
1419 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1422 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1420 | if ( incidence->doesFloat() ) { | 1423 | if ( incidence->doesFloat() ) { |
1421 | startString += ": "+incidence->dtStartDateStr( true ); | 1424 | startString += ": "+incidence->dtStartDateStr( true ); |
1422 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1425 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1423 | 1426 | ||
1424 | } else { | 1427 | } else { |
1425 | startString = ": "+incidence->dtStartStr(true); | 1428 | startString = ": "+incidence->dtStartStr(true); |
1426 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1429 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1427 | 1430 | ||
1428 | } | 1431 | } |
1429 | 1432 | ||
1430 | } else { | 1433 | } else { |
1431 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1434 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1432 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1435 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1433 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1436 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1434 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1437 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1435 | bool ok; | 1438 | bool ok; |
1436 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1439 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1437 | if ( ok ) { | 1440 | if ( ok ) { |
1438 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1441 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1439 | startString += i18n(" (%1 y.)"). arg( years ); | 1442 | startString += i18n(" (%1 y.)"). arg( years ); |
1440 | } | 1443 | } |
1441 | } | 1444 | } |
1442 | else | 1445 | else |
1443 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1446 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1444 | } | 1447 | } |
1445 | 1448 | ||
1446 | } | 1449 | } |
1447 | else | 1450 | else |
1448 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1451 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1449 | if ( !incidence->location().isEmpty() ) | 1452 | if ( !incidence->location().isEmpty() ) |
1450 | startString += " (" +incidence->location()+")"; | 1453 | startString += " (" +incidence->location()+")"; |
1451 | setCaption( incidence->summary()+startString); | 1454 | setCaption( incidence->summary()+startString); |
1452 | 1455 | ||
1453 | enableIncidenceActions( true ); | 1456 | enableIncidenceActions( true ); |
1454 | 1457 | ||
1455 | if ( incidence->type() == "Event" ) { | 1458 | if ( incidence->type() == "Event" ) { |
1456 | mShowAction->setText( i18n("Show Event...") ); | 1459 | mShowAction->setText( i18n("Show Event...") ); |
1457 | mEditAction->setText( i18n("Edit Event...") ); | 1460 | mEditAction->setText( i18n("Edit Event...") ); |
1458 | mDeleteAction->setText( i18n("Delete Event...") ); | 1461 | mDeleteAction->setText( i18n("Delete Event...") ); |
1459 | 1462 | ||
1460 | mNewSubTodoAction->setEnabled( false ); | 1463 | mNewSubTodoAction->setEnabled( false ); |
1461 | } else if ( incidence->type() == "Todo" ) { | 1464 | } else if ( incidence->type() == "Todo" ) { |
1462 | mShowAction->setText( i18n("Show Todo...") ); | 1465 | mShowAction->setText( i18n("Show Todo...") ); |
1463 | mEditAction->setText( i18n("Edit Todo...") ); | 1466 | mEditAction->setText( i18n("Edit Todo...") ); |
1464 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1467 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1465 | 1468 | ||
1466 | mNewSubTodoAction->setEnabled( true ); | 1469 | mNewSubTodoAction->setEnabled( true ); |
1467 | } else { | 1470 | } else { |
1468 | mShowAction->setText( i18n("Show...") ); | 1471 | mShowAction->setText( i18n("Show...") ); |
1469 | mShowAction->setText( i18n("Edit...") ); | 1472 | mShowAction->setText( i18n("Edit...") ); |
1470 | mShowAction->setText( i18n("Delete...") ); | 1473 | mShowAction->setText( i18n("Delete...") ); |
1471 | 1474 | ||
1472 | mNewSubTodoAction->setEnabled( false ); | 1475 | mNewSubTodoAction->setEnabled( false ); |
1473 | } | 1476 | } |
1474 | } | 1477 | } |
1475 | 1478 | ||
1476 | void MainWindow::enableIncidenceActions( bool enabled ) | 1479 | void MainWindow::enableIncidenceActions( bool enabled ) |
1477 | { | 1480 | { |
1478 | mShowAction->setEnabled( enabled ); | 1481 | mShowAction->setEnabled( enabled ); |
1479 | mEditAction->setEnabled( enabled ); | 1482 | mEditAction->setEnabled( enabled ); |
1480 | mDeleteAction->setEnabled( enabled ); | 1483 | mDeleteAction->setEnabled( enabled ); |
1481 | 1484 | ||
1482 | mCloneAction->setEnabled( enabled ); | 1485 | mCloneAction->setEnabled( enabled ); |
1483 | mMoveAction->setEnabled( enabled ); | 1486 | mMoveAction->setEnabled( enabled ); |
1484 | mBeamAction->setEnabled( enabled ); | 1487 | mBeamAction->setEnabled( enabled ); |
1485 | mCancelAction->setEnabled( enabled ); | 1488 | mCancelAction->setEnabled( enabled ); |
1486 | } | 1489 | } |
1487 | 1490 | ||
1488 | void MainWindow::importOL() | 1491 | void MainWindow::importOL() |
1489 | { | 1492 | { |
1490 | #ifdef _OL_IMPORT_ | 1493 | #ifdef _OL_IMPORT_ |
1491 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1494 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1492 | id->exec(); | 1495 | id->exec(); |
1493 | delete id; | 1496 | delete id; |
1494 | mView->updateView(); | 1497 | mView->updateView(); |
1495 | #endif | 1498 | #endif |
1496 | } | 1499 | } |
1497 | void MainWindow::importBday() | 1500 | void MainWindow::importBday() |
1498 | { | 1501 | { |
1499 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1502 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1500 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1503 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1501 | i18n("Import!"), i18n("Cancel"), 0, | 1504 | i18n("Import!"), i18n("Cancel"), 0, |
1502 | 0, 1 ); | 1505 | 0, 1 ); |
1503 | if ( result == 0 ) { | 1506 | if ( result == 0 ) { |
1504 | mView->importBday(); | 1507 | mView->importBday(); |
1505 | 1508 | ||
1506 | } | 1509 | } |
1507 | 1510 | ||
1508 | 1511 | ||
1509 | } | 1512 | } |
1510 | void MainWindow::importQtopia() | 1513 | void MainWindow::importQtopia() |
1511 | { | 1514 | { |
1512 | //#ifndef DESKTOP_VERSION | 1515 | //#ifndef DESKTOP_VERSION |
1513 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1516 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1514 | #ifdef DESKTOP_VERSION | 1517 | #ifdef DESKTOP_VERSION |
1515 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1518 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1516 | #endif | 1519 | #endif |
1517 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1520 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1518 | i18n("Import!"), i18n("Cancel"), 0, | 1521 | i18n("Import!"), i18n("Cancel"), 0, |
1519 | 0, 1 ); | 1522 | 0, 1 ); |
1520 | if ( result == 0 ) { | 1523 | if ( result == 0 ) { |
1521 | #ifndef DESKTOP_VERSION | 1524 | #ifndef DESKTOP_VERSION |
1522 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1525 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1523 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1526 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1524 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1527 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1525 | #else | 1528 | #else |
1526 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1529 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1527 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1530 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1528 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1531 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1529 | #endif | 1532 | #endif |
1530 | mView->importQtopia( categories, datebook, todolist ); | 1533 | mView->importQtopia( categories, datebook, todolist ); |
1531 | } | 1534 | } |
1532 | #if 0 | 1535 | #if 0 |
1533 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1536 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1534 | i18n("Not supported \non desktop!\n"), | 1537 | i18n("Not supported \non desktop!\n"), |
1535 | i18n("Ok"), i18n("Cancel"), 0, | 1538 | i18n("Ok"), i18n("Cancel"), 0, |
1536 | 0, 1 ); | 1539 | 0, 1 ); |
1537 | 1540 | ||
1538 | #endif | 1541 | #endif |
1539 | } | 1542 | } |
1540 | 1543 | ||
1541 | void MainWindow::saveOnClose() | 1544 | void MainWindow::saveOnClose() |
1542 | { | 1545 | { |
1543 | KOPrefs *p = KOPrefs::instance(); | 1546 | KOPrefs *p = KOPrefs::instance(); |
1544 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1547 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1545 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1548 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1546 | iconToolBar->y() > height()/2; | 1549 | iconToolBar->y() > height()/2; |
1547 | mView->writeSettings(); | 1550 | mView->writeSettings(); |
1548 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1551 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1549 | save(); | 1552 | save(); |
1550 | } | 1553 | } |
1551 | void MainWindow::slotModifiedChanged( bool changed ) | 1554 | void MainWindow::slotModifiedChanged( bool changed ) |
1552 | { | 1555 | { |
1553 | if ( mBlockAtStartup ) | 1556 | if ( mBlockAtStartup ) |
1554 | return; | 1557 | return; |
1555 | 1558 | ||
1556 | int msec; | 1559 | int msec; |
1557 | // we store the changes after 1 minute, | 1560 | // we store the changes after 1 minute, |
1558 | // and for safety reasons after 10 minutes again | 1561 | // and for safety reasons after 10 minutes again |
1559 | if ( !mSyncManager->blockSave() ) | 1562 | if ( !mSyncManager->blockSave() ) |
1560 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1563 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1561 | else | 1564 | else |
1562 | msec = 1000 * 600; | 1565 | msec = 1000 * 600; |
1563 | mSaveTimer.start( msec, true ); // 1 minute | 1566 | mSaveTimer.start( msec, true ); // 1 minute |
1564 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1567 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1565 | mCalendarModifiedFlag = true; | 1568 | mCalendarModifiedFlag = true; |
1566 | } | 1569 | } |
1567 | void MainWindow::saveStopTimer() | 1570 | void MainWindow::saveStopTimer() |
1568 | { | 1571 | { |
1569 | mSaveTimer.stop(); | 1572 | mSaveTimer.stop(); |
1570 | if (mSaveTimer.isActive() ) | 1573 | if (mSaveTimer.isActive() ) |
1571 | qDebug("ti active "); | 1574 | qDebug("ti active "); |
1572 | else | 1575 | else |
1573 | qDebug("KO: Save timer stopped"); | 1576 | qDebug("KO: Save timer stopped"); |
1574 | } | 1577 | } |
1575 | void MainWindow::save() | 1578 | void MainWindow::save() |
1576 | { | 1579 | { |
1577 | if ( !mCalendarModifiedFlag ) { | 1580 | if ( !mCalendarModifiedFlag ) { |
1578 | qDebug("KO: Calendar not modified. Nothing saved."); | 1581 | qDebug("KO: Calendar not modified. Nothing saved."); |
1579 | return; | 1582 | return; |
1580 | } | 1583 | } |
1581 | if ( mSyncManager->blockSave() ) | 1584 | if ( mSyncManager->blockSave() ) |
1582 | return; | 1585 | return; |
1583 | mSyncManager->setBlockSave(true); | 1586 | mSyncManager->setBlockSave(true); |
1584 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1587 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1585 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1588 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1586 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1589 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1587 | qDebug("KO: Start saving data to file!"); | 1590 | qDebug("KO: Start saving data to file!"); |
1588 | mView->saveCalendar( defaultFileName() ); | 1591 | mView->saveCalendar( defaultFileName() ); |
1589 | mCalendarModifiedFlag = false; | 1592 | mCalendarModifiedFlag = false; |
1590 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1593 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1591 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1594 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1592 | QString savemes; | 1595 | QString savemes; |
1593 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1596 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1594 | setCaption(savemes); | 1597 | setCaption(savemes); |
1595 | } else | 1598 | } else |
1596 | setCaption(i18n("Saving cancelled!")); | 1599 | setCaption(i18n("Saving cancelled!")); |
1597 | mSyncManager->setBlockSave( false ); | 1600 | mSyncManager->setBlockSave( false ); |
1598 | } | 1601 | } |
1599 | 1602 | ||
1600 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1603 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1601 | { | 1604 | { |
1602 | if ( !e->isAutoRepeat() ) { | 1605 | if ( !e->isAutoRepeat() ) { |
1603 | mFlagKeyPressed = false; | 1606 | mFlagKeyPressed = false; |
1604 | } | 1607 | } |
1605 | } | 1608 | } |
1606 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1609 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1607 | { | 1610 | { |
1608 | qApp->processEvents(); | 1611 | qApp->processEvents(); |
1609 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1612 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1610 | e->ignore(); | 1613 | e->ignore(); |
1611 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1614 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1612 | return; | 1615 | return; |
1613 | } | 1616 | } |
1614 | if (! e->isAutoRepeat() ) | 1617 | if (! e->isAutoRepeat() ) |
1615 | mFlagKeyPressed = true; | 1618 | mFlagKeyPressed = true; |
1616 | KOPrefs *p = KOPrefs::instance(); | 1619 | KOPrefs *p = KOPrefs::instance(); |
1617 | bool showSelectedDates = false; | 1620 | bool showSelectedDates = false; |
1618 | int size; | 1621 | int size; |
1619 | int pro = 0; | 1622 | int pro = 0; |
1620 | //qDebug("MainWindow::keyPressEvent "); | 1623 | //qDebug("MainWindow::keyPressEvent "); |
1621 | switch ( e->key() ) { | 1624 | switch ( e->key() ) { |
1622 | case Qt::Key_Right: | 1625 | case Qt::Key_Right: |
1623 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1626 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1624 | mView->goNextMonth(); | 1627 | mView->goNextMonth(); |
1625 | else | 1628 | else |
1626 | mView->goNext(); | 1629 | mView->goNext(); |
1627 | showSelectedDates = true; | 1630 | showSelectedDates = true; |
1628 | break; | 1631 | break; |
1629 | case Qt::Key_Left: | 1632 | case Qt::Key_Left: |
1630 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1633 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1631 | mView->goPreviousMonth(); | 1634 | mView->goPreviousMonth(); |
1632 | else | 1635 | else |
1633 | mView->goPrevious(); | 1636 | mView->goPrevious(); |
1634 | showSelectedDates = true; | 1637 | showSelectedDates = true; |
1635 | break; | 1638 | break; |
1636 | case Qt::Key_Down: | 1639 | case Qt::Key_Down: |
1637 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1640 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1638 | break; | 1641 | break; |
1639 | case Qt::Key_Up: | 1642 | case Qt::Key_Up: |
1640 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1643 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1641 | break; | 1644 | break; |
1642 | case Qt::Key_K: | 1645 | case Qt::Key_K: |
1643 | mView->viewManager()->showMonthViewWeek(); | 1646 | mView->viewManager()->showMonthViewWeek(); |
1644 | break; | 1647 | break; |
1645 | case Qt::Key_I: | 1648 | case Qt::Key_I: |
1646 | mView->showIncidence(); | 1649 | mView->showIncidence(); |
1647 | break; | 1650 | break; |
1648 | case Qt::Key_Delete: | 1651 | case Qt::Key_Delete: |
1649 | case Qt::Key_Backspace: | 1652 | case Qt::Key_Backspace: |
1650 | mView->deleteIncidence(); | 1653 | mView->deleteIncidence(); |
1651 | break; | 1654 | break; |
1652 | case Qt::Key_D: | 1655 | case Qt::Key_D: |
1653 | mView->viewManager()->showDayView(); | 1656 | mView->viewManager()->showDayView(); |
1654 | showSelectedDates = true; | 1657 | showSelectedDates = true; |
1655 | break; | 1658 | break; |
1656 | case Qt::Key_O: | 1659 | case Qt::Key_O: |
1657 | mView->toggleFilerEnabled( ); | 1660 | mView->toggleFilerEnabled( ); |
1658 | break; | 1661 | break; |
1659 | case Qt::Key_0: | 1662 | case Qt::Key_0: |
1660 | case Qt::Key_1: | 1663 | case Qt::Key_1: |
1661 | case Qt::Key_2: | 1664 | case Qt::Key_2: |
1662 | case Qt::Key_3: | 1665 | case Qt::Key_3: |
1663 | case Qt::Key_4: | 1666 | case Qt::Key_4: |
1664 | case Qt::Key_5: | 1667 | case Qt::Key_5: |
1665 | case Qt::Key_6: | 1668 | case Qt::Key_6: |
1666 | case Qt::Key_7: | 1669 | case Qt::Key_7: |
1667 | case Qt::Key_8: | 1670 | case Qt::Key_8: |
1668 | case Qt::Key_9: | 1671 | case Qt::Key_9: |
1669 | pro = e->key()-48; | 1672 | pro = e->key()-48; |
1670 | if ( pro == 0 ) | 1673 | if ( pro == 0 ) |
1671 | pro = 10; | 1674 | pro = 10; |
1672 | if ( e->state() == Qt::ControlButton) | 1675 | if ( e->state() == Qt::ControlButton) |
1673 | pro += 10; | 1676 | pro += 10; |
1674 | break; | 1677 | break; |
1675 | case Qt::Key_M: | 1678 | case Qt::Key_M: |
1676 | mView->viewManager()->showMonthView(); | 1679 | mView->viewManager()->showMonthView(); |
1677 | showSelectedDates = true; | 1680 | showSelectedDates = true; |
1678 | break; | 1681 | break; |
1679 | case Qt::Key_Insert: | 1682 | case Qt::Key_Insert: |
1680 | mView->newEvent(); | 1683 | mView->newEvent(); |
1681 | break; | 1684 | break; |
1682 | case Qt::Key_S : | 1685 | case Qt::Key_S : |
1683 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1686 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1684 | mView->newSubTodo(); | 1687 | mView->newSubTodo(); |
1685 | else | 1688 | else |
1686 | mView->dialogManager()->showSearchDialog(); | 1689 | mView->dialogManager()->showSearchDialog(); |
1687 | break; | 1690 | break; |
1688 | case Qt::Key_Y : | 1691 | case Qt::Key_Y : |
1689 | case Qt::Key_Z : | 1692 | case Qt::Key_Z : |
1690 | mView->viewManager()->showWorkWeekView(); | 1693 | mView->viewManager()->showWorkWeekView(); |
1691 | showSelectedDates = true; | 1694 | showSelectedDates = true; |
1692 | break; | 1695 | break; |
1693 | case Qt::Key_U : | 1696 | case Qt::Key_U : |
1694 | mView->viewManager()->showWeekView(); | 1697 | mView->viewManager()->showWeekView(); |
1695 | showSelectedDates = true; | 1698 | showSelectedDates = true; |
1696 | break; | 1699 | break; |
1697 | case Qt::Key_H : | 1700 | case Qt::Key_H : |
1698 | keyBindings(); | 1701 | keyBindings(); |
1699 | break; | 1702 | break; |
1700 | case Qt::Key_W: | 1703 | case Qt::Key_W: |
1701 | mView->viewManager()->showWhatsNextView(); | 1704 | mView->viewManager()->showWhatsNextView(); |
1702 | break; | 1705 | break; |
1703 | case Qt::Key_L: | 1706 | case Qt::Key_L: |
1704 | mView->viewManager()->showListView(); | 1707 | mView->viewManager()->showListView(); |
1705 | break; | 1708 | break; |
1706 | case Qt::Key_N: | 1709 | case Qt::Key_N: |
1707 | mView->viewManager()->showNextXView(); | 1710 | mView->viewManager()->showNextXView(); |
1708 | showSelectedDates = true; | 1711 | showSelectedDates = true; |
1709 | break; | 1712 | break; |
1710 | case Qt::Key_V: | 1713 | case Qt::Key_V: |
1711 | mView->viewManager()->showTodoView(); | 1714 | mView->viewManager()->showTodoView(); |
1712 | break; | 1715 | break; |
1713 | case Qt::Key_C: | 1716 | case Qt::Key_C: |
1714 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1717 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1715 | break; | 1718 | break; |
1716 | case Qt::Key_P: | 1719 | case Qt::Key_P: |
1717 | mView->showDatePicker( ); | 1720 | mView->showDatePicker( ); |
1718 | break; | 1721 | break; |
1719 | case Qt::Key_F: | 1722 | case Qt::Key_F: |
1720 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1723 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1721 | mView->editFilters(); | 1724 | mView->editFilters(); |
1722 | else | 1725 | else |
1723 | mView->toggleFilter(); | 1726 | mView->toggleFilter(); |
1724 | break; | 1727 | break; |
1725 | case Qt::Key_X: | 1728 | case Qt::Key_X: |
1726 | mView->toggleDateNavigatorWidget(); | 1729 | mView->toggleDateNavigatorWidget(); |
1727 | break; | 1730 | break; |
1728 | case Qt::Key_Space: | 1731 | case Qt::Key_Space: |
1729 | mView->toggleExpand(); | 1732 | mView->toggleExpand(); |
1730 | break; | 1733 | break; |
1731 | case Qt::Key_A: | 1734 | case Qt::Key_A: |
1732 | mView->toggleAllDaySize(); | 1735 | mView->toggleAllDaySize(); |
1733 | break; | 1736 | break; |
1734 | case Qt::Key_T: | 1737 | case Qt::Key_T: |
1735 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1738 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1736 | mView->newTodo(); | 1739 | mView->newTodo(); |
1737 | else { | 1740 | else { |
1738 | mView->goToday(); | 1741 | mView->goToday(); |
1739 | showSelectedDates = true; | 1742 | showSelectedDates = true; |
1740 | } | 1743 | } |
1741 | break; | 1744 | break; |
1742 | case Qt::Key_J: | 1745 | case Qt::Key_J: |
1743 | mView->viewManager()->showJournalView(); | 1746 | mView->viewManager()->showJournalView(); |
1744 | break; | 1747 | break; |
1745 | case Qt::Key_B: | 1748 | case Qt::Key_B: |
1746 | mView->editIncidenceDescription();; | 1749 | mView->editIncidenceDescription();; |
1747 | break; | 1750 | break; |
1748 | // case Qt::Key_Return: | 1751 | // case Qt::Key_Return: |
1749 | case Qt::Key_E: | 1752 | case Qt::Key_E: |
1750 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1753 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1751 | mView->newEvent(); | 1754 | mView->newEvent(); |
1752 | else | 1755 | else |
1753 | mView->editIncidence(); | 1756 | mView->editIncidence(); |
1754 | break; | 1757 | break; |
1755 | case Qt::Key_Plus: | 1758 | case Qt::Key_Plus: |
1756 | size = p->mHourSize +2; | 1759 | size = p->mHourSize +2; |
1757 | if ( size <= 22 ) | 1760 | if ( size <= 22 ) |
1758 | configureAgenda( size ); | 1761 | configureAgenda( size ); |
1759 | break; | 1762 | break; |
1760 | case Qt::Key_Minus: | 1763 | case Qt::Key_Minus: |
1761 | size = p->mHourSize - 2; | 1764 | size = p->mHourSize - 2; |
1762 | if ( size >= 4 ) | 1765 | if ( size >= 4 ) |
1763 | configureAgenda( size ); | 1766 | configureAgenda( size ); |
1764 | break; | 1767 | break; |
1765 | 1768 | ||
1766 | 1769 | ||
1767 | default: | 1770 | default: |
1768 | e->ignore(); | 1771 | e->ignore(); |
1769 | } | 1772 | } |
1770 | if ( pro > 0 ) { | 1773 | if ( pro > 0 ) { |
1771 | mView->selectFilter( pro-1 ); | 1774 | mView->selectFilter( pro-1 ); |
1772 | } | 1775 | } |
1773 | if ( showSelectedDates ) { | 1776 | if ( showSelectedDates ) { |
1774 | ;// setCaptionToDates(); | 1777 | ;// setCaptionToDates(); |
1775 | } | 1778 | } |
1776 | 1779 | ||
1777 | } | 1780 | } |
1778 | 1781 | ||
1779 | void MainWindow::fillFilterMenu() | 1782 | void MainWindow::fillFilterMenu() |
1780 | { | 1783 | { |
1781 | selectFilterMenu->clear(); | 1784 | selectFilterMenu->clear(); |
1782 | bool disable = false; | 1785 | bool disable = false; |
1783 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1786 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1784 | selectFilterMenu->insertSeparator(); | 1787 | selectFilterMenu->insertSeparator(); |
1785 | if ( mView->filterView()->filtersEnabled() ) { | 1788 | if ( mView->filterView()->filtersEnabled() ) { |
1786 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1789 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1787 | } | 1790 | } |
1788 | else { | 1791 | else { |
1789 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1792 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1790 | disable = true; | 1793 | disable = true; |
1791 | } | 1794 | } |
1792 | selectFilterMenu->insertSeparator(); | 1795 | selectFilterMenu->insertSeparator(); |
1793 | QPtrList<CalFilter> fili = mView->filters(); | 1796 | QPtrList<CalFilter> fili = mView->filters(); |
1794 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1797 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1795 | CalFilter *filter = fili.first(); | 1798 | CalFilter *filter = fili.first(); |
1796 | int iii = 2; | 1799 | int iii = 2; |
1797 | while(filter) { | 1800 | while(filter) { |
1798 | selectFilterMenu->insertItem( filter->name(), iii ); | 1801 | selectFilterMenu->insertItem( filter->name(), iii ); |
1799 | if ( filter == curfilter) | 1802 | if ( filter == curfilter) |
1800 | selectFilterMenu->setItemChecked( iii, true ); | 1803 | selectFilterMenu->setItemChecked( iii, true ); |
1801 | if ( disable ) | 1804 | if ( disable ) |
1802 | selectFilterMenu->setItemEnabled( iii, false ); | 1805 | selectFilterMenu->setItemEnabled( iii, false ); |
1803 | filter = fili.next(); | 1806 | filter = fili.next(); |
1804 | ++iii; | 1807 | ++iii; |
1805 | } | 1808 | } |
1806 | } | 1809 | } |
1807 | void MainWindow::selectFilter( int fil ) | 1810 | void MainWindow::selectFilter( int fil ) |
1808 | { | 1811 | { |
1809 | if ( fil == 0 ) { | 1812 | if ( fil == 0 ) { |
1810 | mView->editFilters( ); | 1813 | mView->editFilters( ); |
1811 | } else if ( fil == 1 ){ | 1814 | } else if ( fil == 1 ){ |
1812 | mView->toggleFilerEnabled( ); | 1815 | mView->toggleFilerEnabled( ); |
1813 | } else { | 1816 | } else { |
1814 | mView->selectFilter( fil-2 ); | 1817 | mView->selectFilter( fil-2 ); |
1815 | } | 1818 | } |
1816 | } | 1819 | } |
1817 | void MainWindow::configureToolBar( int item ) | 1820 | void MainWindow::configureToolBar( int item ) |
1818 | { | 1821 | { |
1819 | 1822 | ||
1820 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1823 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1821 | KOPrefs *p = KOPrefs::instance(); | 1824 | KOPrefs *p = KOPrefs::instance(); |
1822 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1825 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1823 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1826 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1824 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1827 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1825 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1828 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1826 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1829 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1827 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1830 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1828 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1831 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1829 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 1832 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
1830 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1833 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1831 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1834 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1832 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1835 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1833 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1836 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1834 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1837 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1835 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1838 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1836 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1839 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1837 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1840 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1838 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1841 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1839 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1842 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1840 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1843 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1841 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1844 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1842 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 1845 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
1843 | // initActions(); | 1846 | // initActions(); |
1844 | } | 1847 | } |
1845 | 1848 | ||
1846 | void MainWindow::setCaptionToDates() | 1849 | void MainWindow::setCaptionToDates() |
1847 | { | 1850 | { |
1848 | QString selDates; | 1851 | QString selDates; |
1849 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1852 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1850 | if (mView->startDate() < mView->endDate() ) | 1853 | if (mView->startDate() < mView->endDate() ) |
1851 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1854 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1852 | else { | 1855 | else { |
1853 | QString addString; | 1856 | QString addString; |
1854 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1857 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) |
1855 | addString = i18n("Today"); | 1858 | addString = i18n("Today"); |
1856 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1859 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) |
1857 | addString = i18n("Tomorrow"); | 1860 | addString = i18n("Tomorrow"); |
1858 | if ( !addString.isEmpty() ) | 1861 | if ( !addString.isEmpty() ) |
1859 | selDates = addString+", "+selDates ; | 1862 | selDates = addString+", "+selDates ; |
1860 | } | 1863 | } |
1861 | setCaption( i18n("Dates: ") + selDates ); | 1864 | setCaption( i18n("Dates: ") + selDates ); |
1862 | 1865 | ||
1863 | } | 1866 | } |
1864 | void MainWindow::showConfigureAgenda( ) | 1867 | void MainWindow::showConfigureAgenda( ) |
1865 | { | 1868 | { |
1866 | int iii; | 1869 | int iii; |
1867 | for ( iii = 1;iii<= 10 ;++iii ){ | 1870 | for ( iii = 1;iii<= 10 ;++iii ){ |
1868 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 1871 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
1869 | } | 1872 | } |
1870 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 1873 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
1871 | } | 1874 | } |
1872 | void MainWindow::configureAgenda( int item ) | 1875 | void MainWindow::configureAgenda( int item ) |
1873 | { | 1876 | { |
1874 | if ( KOPrefs::instance()->mHourSize == item ) | 1877 | if ( KOPrefs::instance()->mHourSize == item ) |
1875 | return; | 1878 | return; |
1876 | KOPrefs::instance()->mHourSize=item; | 1879 | KOPrefs::instance()->mHourSize=item; |
1877 | mView->viewManager()->agendaView()->updateConfig(); | 1880 | mView->viewManager()->agendaView()->updateConfig(); |
1878 | } | 1881 | } |
1879 | 1882 | ||
1880 | void MainWindow::saveCalendar() | 1883 | void MainWindow::saveCalendar() |
1881 | { | 1884 | { |
1882 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1885 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1883 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1886 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1884 | 1887 | ||
1885 | if ( fn == "" ) | 1888 | if ( fn == "" ) |
1886 | return; | 1889 | return; |
1887 | QFileInfo info; | 1890 | QFileInfo info; |
1888 | info.setFile( fn ); | 1891 | info.setFile( fn ); |
1889 | QString mes; | 1892 | QString mes; |
1890 | bool createbup = true; | 1893 | bool createbup = true; |
1891 | if ( info. exists() ) { | 1894 | if ( info. exists() ) { |
1892 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1895 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1893 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1896 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1894 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1897 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1895 | 0, 1 ); | 1898 | 0, 1 ); |
1896 | if ( result != 0 ) { | 1899 | if ( result != 0 ) { |
1897 | createbup = false; | 1900 | createbup = false; |
1898 | } | 1901 | } |
1899 | } | 1902 | } |
1900 | if ( createbup ) { | 1903 | if ( createbup ) { |
1901 | mView->saveCalendar( fn ); | 1904 | mView->saveCalendar( fn ); |
1902 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1905 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1903 | KOPrefs::instance()->mLastSaveFile = fn; | 1906 | KOPrefs::instance()->mLastSaveFile = fn; |
1904 | setCaption(mes); | 1907 | setCaption(mes); |
1905 | } | 1908 | } |
1906 | } | 1909 | } |
1907 | void MainWindow::loadCalendar() | 1910 | void MainWindow::loadCalendar() |
1908 | { | 1911 | { |
1909 | 1912 | ||
1910 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1913 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1911 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1914 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1912 | 1915 | ||
1913 | if ( fn == "" ) | 1916 | if ( fn == "" ) |
1914 | return; | 1917 | return; |
1915 | QFileInfo info; | 1918 | QFileInfo info; |
1916 | info.setFile( fn ); | 1919 | info.setFile( fn ); |
1917 | QString mess; | 1920 | QString mess; |
1918 | bool loadbup = true; | 1921 | bool loadbup = true; |
1919 | if ( info. exists() ) { | 1922 | if ( info. exists() ) { |
1920 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1923 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1921 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1924 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1922 | mess, | 1925 | mess, |
1923 | i18n("Load!"), i18n("Cancel"), 0, | 1926 | i18n("Load!"), i18n("Cancel"), 0, |
1924 | 0, 1 ); | 1927 | 0, 1 ); |
1925 | if ( result != 0 ) { | 1928 | if ( result != 0 ) { |
1926 | loadbup = false; | 1929 | loadbup = false; |
1927 | } | 1930 | } |
1928 | } else { | 1931 | } else { |
1929 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1932 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1930 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1933 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1931 | 0, 1 ); | 1934 | 0, 1 ); |
1932 | 1935 | ||
1933 | return; | 1936 | return; |
1934 | } | 1937 | } |
1935 | if ( loadbup ) { | 1938 | if ( loadbup ) { |
1936 | mView->openCalendar( fn ); | 1939 | mView->openCalendar( fn ); |
1937 | KOPrefs::instance()->mLastLoadFile = fn; | 1940 | KOPrefs::instance()->mLastLoadFile = fn; |
1938 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1941 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1939 | setCaption(mess); | 1942 | setCaption(mess); |
1940 | } | 1943 | } |
1941 | 1944 | ||
1942 | } | 1945 | } |
1943 | void MainWindow::quickImportIcal() | 1946 | void MainWindow::quickImportIcal() |
1944 | { | 1947 | { |
1945 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1948 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1946 | } | 1949 | } |
1947 | void MainWindow::importFile( QString fn, bool quick ) | 1950 | void MainWindow::importFile( QString fn, bool quick ) |
1948 | { | 1951 | { |
1949 | QFileInfo info; | 1952 | QFileInfo info; |
1950 | info.setFile( fn ); | 1953 | info.setFile( fn ); |
1951 | QString mess; | 1954 | QString mess; |
1952 | bool loadbup = true; | 1955 | bool loadbup = true; |
1953 | if ( !info. exists() ) { | 1956 | if ( !info. exists() ) { |
1954 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1957 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1955 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1958 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1956 | mess ); | 1959 | mess ); |
1957 | return; | 1960 | return; |
1958 | } | 1961 | } |
1959 | int result = 0; | 1962 | int result = 0; |
1960 | if ( !quick ) { | 1963 | if ( !quick ) { |
1961 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1964 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1962 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1965 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1963 | mess, | 1966 | mess, |
1964 | "Import", "Cancel", 0, | 1967 | "Import", "Cancel", 0, |
1965 | 0, 1 ); | 1968 | 0, 1 ); |
1966 | } | 1969 | } |
1967 | if ( result == 0 ) { | 1970 | if ( result == 0 ) { |
1968 | if ( mView->openCalendar( fn, true )) { | 1971 | if ( mView->openCalendar( fn, true )) { |
1969 | KOPrefs::instance()->mLastImportFile = fn; | 1972 | KOPrefs::instance()->mLastImportFile = fn; |
1970 | setCaption(i18n("Imported file successfully")); | 1973 | setCaption(i18n("Imported file successfully")); |
1971 | } else { | 1974 | } else { |
1972 | setCaption(i18n("Error importing file")); | 1975 | setCaption(i18n("Error importing file")); |
1973 | } | 1976 | } |
1974 | } | 1977 | } |
1975 | } | 1978 | } |
1976 | 1979 | ||
1977 | void MainWindow::importIcal() | 1980 | void MainWindow::importIcal() |
1978 | { | 1981 | { |
1979 | 1982 | ||
1980 | QString fn =KOPrefs::instance()->mLastImportFile; | 1983 | QString fn =KOPrefs::instance()->mLastImportFile; |
1981 | 1984 | ||
1982 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1985 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1983 | if ( fn == "" ) | 1986 | if ( fn == "" ) |
1984 | return; | 1987 | return; |
1985 | importFile( fn, true ); | 1988 | importFile( fn, true ); |
1986 | 1989 | ||
1987 | } | 1990 | } |
1988 | 1991 | ||
1989 | void MainWindow::exportVCalendar() | 1992 | void MainWindow::exportVCalendar() |
1990 | { | 1993 | { |
1991 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1994 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1992 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1995 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1993 | if ( fn == "" ) | 1996 | if ( fn == "" ) |
1994 | return; | 1997 | return; |
1995 | QFileInfo info; | 1998 | QFileInfo info; |
1996 | info.setFile( fn ); | 1999 | info.setFile( fn ); |
1997 | QString mes; | 2000 | QString mes; |
1998 | bool createbup = true; | 2001 | bool createbup = true; |
1999 | if ( info. exists() ) { | 2002 | if ( info. exists() ) { |
2000 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2003 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2001 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2004 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2002 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2005 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2003 | 0, 1 ); | 2006 | 0, 1 ); |
2004 | if ( result != 0 ) { | 2007 | if ( result != 0 ) { |
2005 | createbup = false; | 2008 | createbup = false; |
2006 | } | 2009 | } |
2007 | } | 2010 | } |
2008 | if ( createbup ) { | 2011 | if ( createbup ) { |
2009 | if ( mView->exportVCalendar( fn ) ) { | 2012 | if ( mView->exportVCalendar( fn ) ) { |
2010 | KOPrefs::instance()->mLastVcalFile = fn; | 2013 | KOPrefs::instance()->mLastVcalFile = fn; |
2011 | if ( fn.length() > 20 ) | 2014 | if ( fn.length() > 20 ) |
2012 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2015 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2013 | else | 2016 | else |
2014 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2017 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2015 | setCaption(mes); | 2018 | setCaption(mes); |
2016 | } | 2019 | } |
2017 | } | 2020 | } |
2018 | 2021 | ||
2019 | } | 2022 | } |
2020 | QString MainWindow::sentSyncFile() | 2023 | QString MainWindow::sentSyncFile() |
2021 | { | 2024 | { |
2022 | #ifdef DESKTOP_VERSION | 2025 | #ifdef DESKTOP_VERSION |
2023 | return locateLocal( "tmp", "copysynccal.ics" ); | 2026 | return locateLocal( "tmp", "copysynccal.ics" ); |
2024 | #else | 2027 | #else |
2025 | return QString( "/tmp/copysynccal.ics" ); | 2028 | return QString( "/tmp/copysynccal.ics" ); |
2026 | #endif | 2029 | #endif |
2027 | } | 2030 | } |
2028 | 2031 | ||
2029 | void MainWindow::syncFileRequest() | 2032 | void MainWindow::syncFileRequest() |
2030 | { | 2033 | { |
2031 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2034 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2032 | mSyncManager->slotSyncMenu( 999 ); | 2035 | mSyncManager->slotSyncMenu( 999 ); |
2033 | } | 2036 | } |
2034 | 2037 | ||
2035 | setCaption(i18n("Saving Data to temp file ..." )); | 2038 | setCaption(i18n("Saving Data to temp file ..." )); |
2036 | mView->saveCalendar( sentSyncFile() ); | 2039 | mView->saveCalendar( sentSyncFile() ); |
2037 | setCaption(i18n("Data saved to temp file!" )); | 2040 | setCaption(i18n("Data saved to temp file!" )); |
2038 | 2041 | ||
2039 | } | 2042 | } |
2040 | void MainWindow::getFile( bool success ) | 2043 | void MainWindow::getFile( bool success ) |
2041 | { | 2044 | { |
2042 | if ( ! success ) { | 2045 | if ( ! success ) { |
2043 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2046 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2044 | return; | 2047 | return; |
2045 | } | 2048 | } |
2046 | mView->openCalendar( sentSyncFile() ); | 2049 | mView->openCalendar( sentSyncFile() ); |
2047 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2050 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2048 | mSyncManager->slotSyncMenu( 999 ); | 2051 | mSyncManager->slotSyncMenu( 999 ); |
2049 | } | 2052 | } |
2050 | setCaption( i18n("Pi-Sync successful!") ); | 2053 | setCaption( i18n("Pi-Sync successful!") ); |
2051 | } | 2054 | } |
2052 | 2055 | ||
2053 | void MainWindow::printSel( ) | 2056 | void MainWindow::printSel( ) |
2054 | { | 2057 | { |
2055 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2058 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2056 | } | 2059 | } |
2057 | 2060 | ||
2058 | void MainWindow::printCal() | 2061 | void MainWindow::printCal() |
2059 | { | 2062 | { |
2060 | mView->print();//mCp->showDialog(); | 2063 | mView->print();//mCp->showDialog(); |
2061 | } | 2064 | } |
2062 | 2065 | ||
2063 | 2066 | ||
2064 | #include "libkdepim/kdatepicker.h" | 2067 | #include "libkdepim/kdatepicker.h" |
2065 | #include <kdatetbl.h> | 2068 | #include <kdatetbl.h> |
2066 | void MainWindow::weekAction() | 2069 | void MainWindow::weekAction() |
2067 | { | 2070 | { |
2068 | int month; | 2071 | int month; |
2069 | KPopupFrame* popup = new KPopupFrame(this); | 2072 | KPopupFrame* popup = new KPopupFrame(this); |
2070 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2073 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2071 | // ----- | 2074 | // ----- |
2072 | picker->resize(picker->sizeHint()); | 2075 | picker->resize(picker->sizeHint()); |
2073 | popup->setMainWidget(picker); | 2076 | popup->setMainWidget(picker); |
2074 | picker->setFocus(); | 2077 | picker->setFocus(); |
2075 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2078 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2076 | int x = 0; | 2079 | int x = 0; |
2077 | int y = iconToolBar->height(); | 2080 | int y = iconToolBar->height(); |
2078 | int dX = 0; | 2081 | int dX = 0; |
2079 | int dY = 0; | 2082 | int dY = 0; |
2080 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2083 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2081 | if ( iconToolBar->y() > height()/2 ) { | 2084 | if ( iconToolBar->y() > height()/2 ) { |
2082 | dY = picker->sizeHint().height()+8; | 2085 | dY = picker->sizeHint().height()+8; |
2083 | y = 0; | 2086 | y = 0; |
2084 | } | 2087 | } |
2085 | } else { | 2088 | } else { |
2086 | if ( iconToolBar->x() > width()/2 ) { // right side | 2089 | if ( iconToolBar->x() > width()/2 ) { // right side |
2087 | x=0; | 2090 | x=0; |
2088 | dX= picker->sizeHint().width()+8; | 2091 | dX= picker->sizeHint().width()+8; |
2089 | y = 0; | 2092 | y = 0; |
2090 | } else { | 2093 | } else { |
2091 | x= iconToolBar->width(); | 2094 | x= iconToolBar->width(); |
2092 | y = 0; | 2095 | y = 0; |
2093 | } | 2096 | } |
2094 | } | 2097 | } |
2095 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2098 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2096 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2099 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2097 | { | 2100 | { |
2098 | month = picker->getResult(); | 2101 | month = picker->getResult(); |
2099 | emit selectWeek ( month ); | 2102 | emit selectWeek ( month ); |
2100 | //qDebug("weekSelected %d ", month); | 2103 | //qDebug("weekSelected %d ", month); |
2101 | } | 2104 | } |
2102 | delete popup; | 2105 | delete popup; |
2103 | } | 2106 | } |
diff --git a/pwmanager/pwmanager/listviewpwm.cpp b/pwmanager/pwmanager/listviewpwm.cpp index 8d46fff..0df9431 100644 --- a/pwmanager/pwmanager/listviewpwm.cpp +++ b/pwmanager/pwmanager/listviewpwm.cpp | |||
@@ -1,121 +1,129 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "listviewpwm.h" | 20 | #include "listviewpwm.h" |
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | #include "pwmview.h" | 22 | #include "pwmview.h" |
23 | 23 | ||
24 | #include <qpainter.h> | 24 | #include <qpainter.h> |
25 | #include <qpixmap.h> | 25 | #include <qpixmap.h> |
26 | 26 | ||
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | 28 | ||
29 | #ifdef PWM_EMBEDDED | 29 | #ifdef PWM_EMBEDDED |
30 | #include <kglobal.h> | 30 | #include <kglobal.h> |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | ListViewPwM::ListViewPwM(QWidget *parent, const char *name) | 33 | ListViewPwM::ListViewPwM(QWidget *parent, const char *name) |
34 | : KListView(parent, name) | 34 | : KListView(parent, name) |
35 | { | 35 | { |
36 | //setResizeMode(QListView::AllColumns); | 36 | //setResizeMode(QListView::AllColumns); |
37 | setAllColumnsShowFocus (true ); | 37 | setAllColumnsShowFocus (true ); |
38 | } | 38 | } |
39 | 39 | ||
40 | bool ListViewPwM::event(QEvent *e) | 40 | bool ListViewPwM::event(QEvent *e) |
41 | { | 41 | { |
42 | if (e->type() == QEvent::LayoutHint) | 42 | if (e->type() == QEvent::LayoutHint) |
43 | emit layoutChanged(); | 43 | emit layoutChanged(); |
44 | if (e->type() == QEvent::KeyPress) { | 44 | if (e->type() == QEvent::KeyPress) { |
45 | QKeyEvent* ke = (QKeyEvent*) e; | 45 | QKeyEvent* ke = (QKeyEvent*) e; |
46 | if ( ke->key() == Qt::Key_Space) { | 46 | if ( ke->key() == Qt::Key_Space) { |
47 | emit toggleOverview(); | 47 | emit toggleOverview(); |
48 | return true; | 48 | return true; |
49 | } | 49 | } |
50 | if ( ke->key() == Qt::Key_I || ke->key() == Qt::Key_N || ke->key() == Qt::Key_Insert) { | ||
51 | emit insertPW(); | ||
52 | return true; | ||
53 | } | ||
54 | if ( ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace) { | ||
55 | emit deletePW(); | ||
56 | return true; | ||
57 | } | ||
50 | 58 | ||
51 | } | 59 | } |
52 | return KListView::event(e); | 60 | return KListView::event(e); |
53 | } | 61 | } |
54 | 62 | ||
55 | 63 | ||
56 | QPixmap * ListViewItemPwM::onPix = 0; | 64 | QPixmap * ListViewItemPwM::onPix = 0; |
57 | QPixmap * ListViewItemPwM::offPix = 0; | 65 | QPixmap * ListViewItemPwM::offPix = 0; |
58 | 66 | ||
59 | ListViewItemPwM::ListViewItemPwM(QListView *parent) | 67 | ListViewItemPwM::ListViewItemPwM(QListView *parent) |
60 | : QCheckListItem(parent, "", QCheckListItem::CheckBox) | 68 | : QCheckListItem(parent, "", QCheckListItem::CheckBox) |
61 | { | 69 | { |
62 | if (!onPix) { | 70 | if (!onPix) { |
63 | PWM_ASSERT(!offPix); | 71 | PWM_ASSERT(!offPix); |
64 | KIconLoader* picons; | 72 | KIconLoader* picons; |
65 | #ifndef PWM_EMBEDDED | 73 | #ifndef PWM_EMBEDDED |
66 | KIconLoader il; | 74 | KIconLoader il; |
67 | picons = &il; | 75 | picons = &il; |
68 | #else | 76 | #else |
69 | picons = KGlobal::iconLoader(); | 77 | picons = KGlobal::iconLoader(); |
70 | #endif | 78 | #endif |
71 | 79 | ||
72 | KIconLoader il; | 80 | KIconLoader il; |
73 | #ifndef PWM_EMBEDDED | 81 | #ifndef PWM_EMBEDDED |
74 | static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small)); | 82 | static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small)); |
75 | #else | 83 | #else |
76 | static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small)); | 84 | static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small)); |
77 | #endif | 85 | #endif |
78 | onPix = &onP; | 86 | onPix = &onP; |
79 | static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small)); | 87 | static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small)); |
80 | offPix = &offP; | 88 | offPix = &offP; |
81 | } | 89 | } |
82 | } | 90 | } |
83 | 91 | ||
84 | void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, | 92 | void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, |
85 | int column, int width, int align) | 93 | int column, int width, int align) |
86 | { | 94 | { |
87 | // qDebug("ListViewItemPwM::paintCell column=%i", column); | 95 | // qDebug("ListViewItemPwM::paintCell column=%i", column); |
88 | if (!p) | 96 | if (!p) |
89 | return; | 97 | return; |
90 | //US BUG: | 98 | //US BUG: |
91 | if (column != COLUMN_DESC) { | 99 | if (column != COLUMN_DESC) { |
92 | QCheckListItem::paintCell(p, cg, column, width, align); | 100 | QCheckListItem::paintCell(p, cg, column, width, align); |
93 | return; | 101 | return; |
94 | } | 102 | } |
95 | QPixmap *curPix = isOn() ? onPix : offPix; | 103 | QPixmap *curPix = isOn() ? onPix : offPix; |
96 | int pixSpace = curPix->width(); | 104 | int pixSpace = curPix->width(); |
97 | pixSpace += 4; | 105 | pixSpace += 4; |
98 | #ifndef PWM_EMBEDDED | 106 | #ifndef PWM_EMBEDDED |
99 | QRect window(p->viewport()); | 107 | QRect window(p->viewport()); |
100 | // clear the rectangle (we have to clear it first. see QT doc) | 108 | // clear the rectangle (we have to clear it first. see QT doc) |
101 | p->eraseRect(0, 0, pixSpace, window.height()); | 109 | p->eraseRect(0, 0, pixSpace, window.height()); |
102 | // now draw the pixmap | 110 | // now draw the pixmap |
103 | int y = (height() - curPix->height()) / 2; | 111 | int y = (height() - curPix->height()) / 2; |
104 | p->drawPixmap(1, y, *curPix); | 112 | p->drawPixmap(1, y, *curPix); |
105 | window.moveLeft(pixSpace); | 113 | window.moveLeft(pixSpace); |
106 | p->setViewport(window); | 114 | p->setViewport(window); |
107 | #else | 115 | #else |
108 | p->eraseRect(0, 0, pixSpace, height()); | 116 | p->eraseRect(0, 0, pixSpace, height()); |
109 | // now draw the pixmap | 117 | // now draw the pixmap |
110 | int y = (height() - curPix->height()) / 2; | 118 | int y = (height() - curPix->height()) / 2; |
111 | p->drawPixmap(1, y, *curPix); | 119 | p->drawPixmap(1, y, *curPix); |
112 | p->translate( pixSpace, 0 ); | 120 | p->translate( pixSpace, 0 ); |
113 | 121 | ||
114 | #endif | 122 | #endif |
115 | QListViewItem::paintCell(p, cg, column, width - pixSpace, align); | 123 | QListViewItem::paintCell(p, cg, column, width - pixSpace, align); |
116 | 124 | ||
117 | } | 125 | } |
118 | 126 | ||
119 | #ifndef PWM_EMBEDDED | 127 | #ifndef PWM_EMBEDDED |
120 | #include "listviewpwm.moc" | 128 | #include "listviewpwm.moc" |
121 | #endif | 129 | #endif |
diff --git a/pwmanager/pwmanager/listviewpwm.h b/pwmanager/pwmanager/listviewpwm.h index 840ee73..51008b8 100644 --- a/pwmanager/pwmanager/listviewpwm.h +++ b/pwmanager/pwmanager/listviewpwm.h | |||
@@ -1,58 +1,60 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __LISTVIEW_H | 20 | #ifndef __LISTVIEW_H |
21 | #define __LISTVIEW_H | 21 | #define __LISTVIEW_H |
22 | 22 | ||
23 | #include <klistview.h> | 23 | #include <klistview.h> |
24 | 24 | ||
25 | /** PwManager implementation of the list view. | 25 | /** PwManager implementation of the list view. |
26 | * Derived from KListView. | 26 | * Derived from KListView. |
27 | */ | 27 | */ |
28 | class ListViewPwM : public KListView | 28 | class ListViewPwM : public KListView |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | ListViewPwM(QWidget *parent = 0, const char *name = 0); | 32 | ListViewPwM(QWidget *parent = 0, const char *name = 0); |
33 | 33 | ||
34 | signals: | 34 | signals: |
35 | void layoutChanged(); | 35 | void layoutChanged(); |
36 | void toggleOverview(); | 36 | void toggleOverview(); |
37 | void insertPW(); | ||
38 | void deletePW( ); | ||
37 | 39 | ||
38 | protected: | 40 | protected: |
39 | virtual bool event(QEvent *e); | 41 | virtual bool event(QEvent *e); |
40 | }; | 42 | }; |
41 | 43 | ||
42 | class ListViewItemPwM : public QCheckListItem | 44 | class ListViewItemPwM : public QCheckListItem |
43 | { | 45 | { |
44 | public: | 46 | public: |
45 | ListViewItemPwM(QListView *parent); | 47 | ListViewItemPwM(QListView *parent); |
46 | 48 | ||
47 | protected: | 49 | protected: |
48 | void paintCell(QPainter *p, const QColorGroup &cg, | 50 | void paintCell(QPainter *p, const QColorGroup &cg, |
49 | int column, int width, int align); | 51 | int column, int width, int align); |
50 | 52 | ||
51 | protected: | 53 | protected: |
52 | /** pixmap to display for an item with state "on" */ | 54 | /** pixmap to display for an item with state "on" */ |
53 | static QPixmap *onPix; | 55 | static QPixmap *onPix; |
54 | /** pixmap to display for an item with state "off" */ | 56 | /** pixmap to display for an item with state "off" */ |
55 | static QPixmap *offPix; | 57 | static QPixmap *offPix; |
56 | }; | 58 | }; |
57 | 59 | ||
58 | #endif | 60 | #endif |
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp index 0092692..2533487 100644 --- a/pwmanager/pwmanager/pwmview.cpp +++ b/pwmanager/pwmanager/pwmview.cpp | |||
@@ -1,621 +1,623 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwmview.h" | 20 | #include "pwmview.h" |
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | #include "globalstuff.h" | 22 | #include "globalstuff.h" |
23 | #include "pwm.h" | 23 | #include "pwm.h" |
24 | #include "rencatwnd.h" | 24 | #include "rencatwnd.h" |
25 | #ifndef PWM_EMBEDDED | 25 | #ifndef PWM_EMBEDDED |
26 | #include "configuration.h" | 26 | #include "configuration.h" |
27 | #else | 27 | #else |
28 | #include "pwmprefs.h" | 28 | #include "pwmprefs.h" |
29 | #endif | 29 | #endif |
30 | #include "commentbox.h" | 30 | #include "commentbox.h" |
31 | 31 | ||
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qpoint.h> | 36 | #include <qpoint.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | 39 | ||
40 | //US ENH: wouldn't it be a good idea if we could use this consts everywhere else. | 40 | //US ENH: wouldn't it be a good idea if we could use this consts everywhere else. |
41 | //US ENH: for examle in listviewpwm.cpp | 41 | //US ENH: for examle in listviewpwm.cpp |
42 | //US ENH: Because of that I transfer them into the headerfile. | 42 | //US ENH: Because of that I transfer them into the headerfile. |
43 | /* | 43 | /* |
44 | #define COLUMN_DESC 0 | 44 | #define COLUMN_DESC 0 |
45 | #define COLUMN_NAME 1 | 45 | #define COLUMN_NAME 1 |
46 | #define COLUMN_PW 2 | 46 | #define COLUMN_PW 2 |
47 | #define COLUMN_URL 3 | 47 | #define COLUMN_URL 3 |
48 | #define COLUMN_LAUNCHER 4 | 48 | #define COLUMN_LAUNCHER 4 |
49 | */ | 49 | */ |
50 | 50 | ||
51 | PwMView::PwMView(PwM *_mainClass, | 51 | PwMView::PwMView(PwM *_mainClass, |
52 | QWidget *parent, PwMDoc *_doc, | 52 | QWidget *parent, PwMDoc *_doc, |
53 | const char *name) | 53 | const char *name) |
54 | : PwMViewStyle(parent, name) | 54 | : PwMViewStyle(parent, name) |
55 | { | 55 | { |
56 | PWM_ASSERT(_mainClass); | 56 | PWM_ASSERT(_mainClass); |
57 | PWM_ASSERT(parent); | 57 | PWM_ASSERT(parent); |
58 | PWM_ASSERT(_doc); | 58 | PWM_ASSERT(_doc); |
59 | setView(this); | 59 | setView(this); |
60 | doc = _doc; | 60 | doc = _doc; |
61 | doc->setListViewPointer(this); | 61 | doc->setListViewPointer(this); |
62 | mainClass = _mainClass; | 62 | mainClass = _mainClass; |
63 | resize(_mainClass->size()); | 63 | resize(_mainClass->size()); |
64 | initStyle(conf()->confWndMainViewStyle()); | 64 | initStyle(conf()->confWndMainViewStyle()); |
65 | initCtxMenu(); | 65 | initCtxMenu(); |
66 | doc->setCurrentView(this); | 66 | doc->setCurrentView(this); |
67 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); | 67 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); |
68 | connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot())); | 68 | connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot())); |
69 | connect(this, SIGNAL(insertPW()), mainClass, SLOT(addPwd_slot())); | ||
70 | connect(this, SIGNAL(deletePW()), mainClass, SLOT(deletePwd_slot())); | ||
69 | } | 71 | } |
70 | 72 | ||
71 | PwMView::~PwMView() | 73 | PwMView::~PwMView() |
72 | { | 74 | { |
73 | } | 75 | } |
74 | 76 | ||
75 | void PwMView::initCtxMenu() | 77 | void PwMView::initCtxMenu() |
76 | { | 78 | { |
77 | ctxMenu = new QPopupMenu(this); | 79 | ctxMenu = new QPopupMenu(this); |
78 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); | 80 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); |
79 | ctxMenu->insertSeparator(); | 81 | ctxMenu->insertSeparator(); |
80 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); | 82 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); |
81 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); | 83 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); |
82 | ctxMenu->insertSeparator(); | 84 | ctxMenu->insertSeparator(); |
83 | ctxMenu->insertItem(i18n("copy password to clipboard"), | 85 | ctxMenu->insertItem(i18n("copy password to clipboard"), |
84 | this, SLOT(copyPwToClip())); | 86 | this, SLOT(copyPwToClip())); |
85 | ctxMenu->insertItem(i18n("copy username to clipboard"), | 87 | ctxMenu->insertItem(i18n("copy username to clipboard"), |
86 | this, SLOT(copyNameToClip())); | 88 | this, SLOT(copyNameToClip())); |
87 | ctxMenu->insertItem(i18n("copy description to clipboard"), | 89 | ctxMenu->insertItem(i18n("copy description to clipboard"), |
88 | this, SLOT(copyDescToClip())); | 90 | this, SLOT(copyDescToClip())); |
89 | ctxMenu->insertItem(i18n("copy url to clipboard"), | 91 | ctxMenu->insertItem(i18n("copy url to clipboard"), |
90 | this, SLOT(copyUrlToClip())); | 92 | this, SLOT(copyUrlToClip())); |
91 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), | 93 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), |
92 | this, SLOT(copyLauncherToClip())); | 94 | this, SLOT(copyLauncherToClip())); |
93 | ctxMenu->insertItem(i18n("copy comment to clipboard"), | 95 | ctxMenu->insertItem(i18n("copy comment to clipboard"), |
94 | this, SLOT(copyCommentToClip())); | 96 | this, SLOT(copyCommentToClip())); |
95 | ctxMenu->insertSeparator(); | 97 | ctxMenu->insertSeparator(); |
96 | ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, | 98 | ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, |
97 | SLOT(execLauncher_slot())); | 99 | SLOT(execLauncher_slot())); |
98 | ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, | 100 | ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, |
99 | SLOT(goToURL_slot())); | 101 | SLOT(goToURL_slot())); |
100 | } | 102 | } |
101 | 103 | ||
102 | void PwMView::resizeEvent(QResizeEvent *) | 104 | void PwMView::resizeEvent(QResizeEvent *) |
103 | { | 105 | { |
104 | resizeView(size()); | 106 | resizeView(size()); |
105 | } | 107 | } |
106 | 108 | ||
107 | void PwMView::refreshCommentTextEdit(QListViewItem *curItem) | 109 | void PwMView::refreshCommentTextEdit(QListViewItem *curItem) |
108 | { | 110 | { |
109 | PWM_ASSERT(commentBox); | 111 | PWM_ASSERT(commentBox); |
110 | if (!curItem) | 112 | if (!curItem) |
111 | return; | 113 | return; |
112 | string comment; | 114 | string comment; |
113 | PwMerror ret; | 115 | PwMerror ret; |
114 | ret = document()->getCommentByLvp_long(getCurrentCategory(), | 116 | ret = document()->getCommentByLvp_long(getCurrentCategory(), |
115 | lv->childCount() - lv->itemIndex(curItem) - 1, | 117 | lv->childCount() - lv->itemIndex(curItem) - 1, |
116 | &comment); | 118 | &comment); |
117 | if (ret == e_binEntry) { | 119 | if (ret == e_binEntry) { |
118 | commentBox->setContent(i18n("This is a binary entry.\n" | 120 | commentBox->setContent(i18n("This is a binary entry.\n" |
119 | "It is not a normal password-entry, as it contains " | 121 | "It is not a normal password-entry, as it contains " |
120 | "binary data, which PwManager can't display here.")); | 122 | "binary data, which PwManager can't display here.")); |
121 | } else if (ret == e_normalEntry) { | 123 | } else if (ret == e_normalEntry) { |
122 | commentBox->setContent(comment.c_str()); | 124 | commentBox->setContent(comment.c_str()); |
123 | } else { | 125 | } else { |
124 | BUG(); | 126 | BUG(); |
125 | return; | 127 | return; |
126 | } | 128 | } |
127 | lv->ensureItemVisible(curItem); | 129 | lv->ensureItemVisible(curItem); |
128 | } | 130 | } |
129 | 131 | ||
130 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) | 132 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) |
131 | { | 133 | { |
132 | refreshCommentTextEdit(lv->currentItem()); | 134 | refreshCommentTextEdit(lv->currentItem()); |
133 | } | 135 | } |
134 | 136 | ||
135 | bool PwMView::getCurEntryIndex(unsigned int *index) | 137 | bool PwMView::getCurEntryIndex(unsigned int *index) |
136 | { | 138 | { |
137 | QListViewItem *current = lv->currentItem(); | 139 | QListViewItem *current = lv->currentItem(); |
138 | if (!current) | 140 | if (!current) |
139 | return false; | 141 | return false; |
140 | return getDocEntryIndex(index, current); | 142 | return getDocEntryIndex(index, current); |
141 | } | 143 | } |
142 | 144 | ||
143 | bool PwMView::getDocEntryIndex(unsigned int *index, | 145 | bool PwMView::getDocEntryIndex(unsigned int *index, |
144 | const QListViewItem *item) | 146 | const QListViewItem *item) |
145 | { | 147 | { |
146 | vector<unsigned int> foundPositions; | 148 | vector<unsigned int> foundPositions; |
147 | PwMDataItem curItem; | 149 | PwMDataItem curItem; |
148 | curItem.desc = item->text(COLUMN_DESC).latin1(); | 150 | curItem.desc = item->text(COLUMN_DESC).latin1(); |
149 | curItem.name = item->text(COLUMN_NAME).latin1(); | 151 | curItem.name = item->text(COLUMN_NAME).latin1(); |
150 | document()->getCommentByLvp(getCurrentCategory(), | 152 | document()->getCommentByLvp(getCurrentCategory(), |
151 | lv->childCount() - lv->itemIndex(item) - 1, | 153 | lv->childCount() - lv->itemIndex(item) - 1, |
152 | &curItem.comment); | 154 | &curItem.comment); |
153 | curItem.url = item->text(COLUMN_URL).latin1(); | 155 | curItem.url = item->text(COLUMN_URL).latin1(); |
154 | curItem.launcher = item->text(COLUMN_LAUNCHER).latin1(); | 156 | curItem.launcher = item->text(COLUMN_LAUNCHER).latin1(); |
155 | document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC | | 157 | document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC | |
156 | SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL | | 158 | SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL | |
157 | SEARCH_IN_LAUNCHER, | 159 | SEARCH_IN_LAUNCHER, |
158 | &foundPositions, true); | 160 | &foundPositions, true); |
159 | if (foundPositions.size()) { | 161 | if (foundPositions.size()) { |
160 | *index = foundPositions[0]; | 162 | *index = foundPositions[0]; |
161 | return true; | 163 | return true; |
162 | } | 164 | } |
163 | 165 | ||
164 | return false; | 166 | return false; |
165 | } | 167 | } |
166 | 168 | ||
167 | void PwMView::handleToggle(QListViewItem *item) | 169 | void PwMView::handleToggle(QListViewItem *item) |
168 | { | 170 | { |
169 | PWM_ASSERT(doc); | 171 | PWM_ASSERT(doc); |
170 | if (!item) | 172 | if (!item) |
171 | return; | 173 | return; |
172 | QCheckListItem *clItem = (QCheckListItem *)item; | 174 | QCheckListItem *clItem = (QCheckListItem *)item; |
173 | QString curCat(getCurrentCategory()); | 175 | QString curCat(getCurrentCategory()); |
174 | 176 | ||
175 | // find document position of this entry. | 177 | // find document position of this entry. |
176 | unsigned int curEntryDocIndex; | 178 | unsigned int curEntryDocIndex; |
177 | if (!getDocEntryIndex(&curEntryDocIndex, item)) | 179 | if (!getDocEntryIndex(&curEntryDocIndex, item)) |
178 | return; | 180 | return; |
179 | 181 | ||
180 | // hack to refresh the comment, if only one item is present | 182 | // hack to refresh the comment, if only one item is present |
181 | if (lv->childCount() == 1) | 183 | if (lv->childCount() == 1) |
182 | refreshCommentTextEdit(lv->currentItem()); | 184 | refreshCommentTextEdit(lv->currentItem()); |
183 | 185 | ||
184 | if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn()) | 186 | if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn()) |
185 | return; // this is just a click somewhere on the entry | 187 | return; // this is just a click somewhere on the entry |
186 | if (doc->isDeepLocked()) { | 188 | if (doc->isDeepLocked()) { |
187 | PwMerror ret; | 189 | PwMerror ret; |
188 | ret = doc->deepLock(false); | 190 | ret = doc->deepLock(false); |
189 | if (ret != e_success) | 191 | if (ret != e_success) |
190 | clItem->setOn(false); | 192 | clItem->setOn(false); |
191 | return; | 193 | return; |
192 | } | 194 | } |
193 | doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); | 195 | doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); |
194 | } | 196 | } |
195 | 197 | ||
196 | void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int) | 198 | void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int) |
197 | { | 199 | { |
198 | if (!item) | 200 | if (!item) |
199 | return; | 201 | return; |
200 | ctxMenu->move(point); | 202 | ctxMenu->move(point); |
201 | /* don't use ctxMenu->exec() here, as it generates race conditions | 203 | /* don't use ctxMenu->exec() here, as it generates race conditions |
202 | * with the card interface code. Believe it or not. :) | 204 | * with the card interface code. Believe it or not. :) |
203 | */ | 205 | */ |
204 | ctxMenu->show(); | 206 | ctxMenu->show(); |
205 | } | 207 | } |
206 | 208 | ||
207 | void PwMView::updateCategories() | 209 | void PwMView::updateCategories() |
208 | { | 210 | { |
209 | //qDebug("PwMView::updateCategories() "); | 211 | //qDebug("PwMView::updateCategories() "); |
210 | QString oldSel(getCurrentCategory()); | 212 | QString oldSel(getCurrentCategory()); |
211 | delAllCategories(); | 213 | delAllCategories(); |
212 | QStringList catList; | 214 | QStringList catList; |
213 | document()->getCategoryList(&catList); | 215 | document()->getCategoryList(&catList); |
214 | catList.sort(); | 216 | catList.sort(); |
215 | #ifndef PWM_EMBEDDED | 217 | #ifndef PWM_EMBEDDED |
216 | QStringList::iterator i = catList.begin(), | 218 | QStringList::iterator i = catList.begin(), |
217 | end = catList.end(); | 219 | end = catList.end(); |
218 | #else | 220 | #else |
219 | QStringList::Iterator i = catList.begin(), | 221 | QStringList::Iterator i = catList.begin(), |
220 | end = catList.end(); | 222 | end = catList.end(); |
221 | #endif | 223 | #endif |
222 | while (i != end) { | 224 | while (i != end) { |
223 | addCategory(*i); | 225 | addCategory(*i); |
224 | ++i; | 226 | ++i; |
225 | } | 227 | } |
226 | selectCategory(oldSel); | 228 | selectCategory(oldSel); |
227 | } | 229 | } |
228 | 230 | ||
229 | void PwMView::shiftToView() | 231 | void PwMView::shiftToView() |
230 | { | 232 | { |
231 | int cX = lv->contentsX(); | 233 | int cX = lv->contentsX(); |
232 | int cY = lv->contentsY(); | 234 | int cY = lv->contentsY(); |
233 | commentBox->clear(); | 235 | commentBox->clear(); |
234 | 236 | ||
235 | unsigned int catDocIndex; | 237 | unsigned int catDocIndex; |
236 | if (unlikely( | 238 | if (unlikely( |
237 | !(document()->findCategory(getCurrentCategory(), | 239 | !(document()->findCategory(getCurrentCategory(), |
238 | &catDocIndex)))) { | 240 | &catDocIndex)))) { |
239 | BUG(); | 241 | BUG(); |
240 | } | 242 | } |
241 | 243 | ||
242 | // ensure all listViewPos are set | 244 | // ensure all listViewPos are set |
243 | doc->ensureLvp(); | 245 | doc->ensureLvp(); |
244 | 246 | ||
245 | // clear all tmp-data vectors | 247 | // clear all tmp-data vectors |
246 | unsigned int i, entries = doc->numEntries(catDocIndex); | 248 | unsigned int i, entries = doc->numEntries(catDocIndex); |
247 | if (entries) { | 249 | if (entries) { |
248 | mainClass->setVirgin(false); | 250 | mainClass->setVirgin(false); |
249 | } | 251 | } |
250 | vector<PwMDataItem> tmpSorted; | 252 | vector<PwMDataItem> tmpSorted; |
251 | PwMDataItem currItem; | 253 | PwMDataItem currItem; |
252 | currItem.clear(); | 254 | currItem.clear(); |
253 | tmpSorted.insert(tmpSorted.begin(), entries, currItem); | 255 | tmpSorted.insert(tmpSorted.begin(), entries, currItem); |
254 | 256 | ||
255 | // Sort items and store them in tempoary tmpSorted. | 257 | // Sort items and store them in tempoary tmpSorted. |
256 | for (i = 0; i < entries; ++i) { | 258 | for (i = 0; i < entries; ++i) { |
257 | doc->getEntry(catDocIndex, i, &currItem); | 259 | doc->getEntry(catDocIndex, i, &currItem); |
258 | //qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos); | 260 | //qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos); |
259 | tmpSorted[currItem.listViewPos] = currItem; | 261 | tmpSorted[currItem.listViewPos] = currItem; |
260 | } | 262 | } |
261 | 263 | ||
262 | // shift tempoary data to ListView. | 264 | // shift tempoary data to ListView. |
263 | tmpDisableSort(); | 265 | tmpDisableSort(); |
264 | lv->clear(); | 266 | lv->clear(); |
265 | 267 | ||
266 | //US ENH: adjust the headers of the table according the category texts | 268 | //US ENH: adjust the headers of the table according the category texts |
267 | { | 269 | { |
268 | PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex); | 270 | PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex); |
269 | // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str()); | 271 | // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str()); |
270 | lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str()); | 272 | lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str()); |
271 | lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str()); | 273 | lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str()); |
272 | lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); | 274 | lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); |
273 | } | 275 | } |
274 | 276 | ||
275 | QCheckListItem *newItem; | 277 | QCheckListItem *newItem; |
276 | vector<PwMDataItem>::iterator it = tmpSorted.begin(), | 278 | vector<PwMDataItem>::iterator it = tmpSorted.begin(), |
277 | end = tmpSorted.end(); | 279 | end = tmpSorted.end(); |
278 | while (it != end) { | 280 | while (it != end) { |
279 | newItem = new ListViewItemPwM(lv); | 281 | newItem = new ListViewItemPwM(lv); |
280 | newItem->setText(COLUMN_DESC, (*it).desc.c_str()); | 282 | newItem->setText(COLUMN_DESC, (*it).desc.c_str()); |
281 | if ((*it).binary) { | 283 | if ((*it).binary) { |
282 | newItem->setText(COLUMN_NAME, ""); | 284 | newItem->setText(COLUMN_NAME, ""); |
283 | newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>")); | 285 | newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>")); |
284 | newItem->setText(COLUMN_URL, ""); | 286 | newItem->setText(COLUMN_URL, ""); |
285 | newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); | 287 | newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); |
286 | } else { | 288 | } else { |
287 | newItem->setText(COLUMN_NAME, (*it).name.c_str()); | 289 | newItem->setText(COLUMN_NAME, (*it).name.c_str()); |
288 | if ((*it).lockStat) { | 290 | if ((*it).lockStat) { |
289 | newItem->setText(COLUMN_PW, QString((*it).pw.c_str()) | 291 | newItem->setText(COLUMN_PW, QString((*it).pw.c_str()) |
290 | + " " | 292 | + " " |
291 | + i18n("To unlock click the icon on the left.")); | 293 | + i18n("To unlock click the icon on the left.")); |
292 | } else { | 294 | } else { |
293 | newItem->setText(COLUMN_PW, (*it).pw.c_str()); | 295 | newItem->setText(COLUMN_PW, (*it).pw.c_str()); |
294 | } | 296 | } |
295 | newItem->setText(COLUMN_URL, (*it).url.c_str()); | 297 | newItem->setText(COLUMN_URL, (*it).url.c_str()); |
296 | newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); | 298 | newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); |
297 | } | 299 | } |
298 | newItem->setOn(!((*it).lockStat)); | 300 | newItem->setOn(!((*it).lockStat)); |
299 | lv->insertItem(newItem); | 301 | lv->insertItem(newItem); |
300 | ++it; | 302 | ++it; |
301 | } | 303 | } |
302 | tmpReEnableSort(); | 304 | tmpReEnableSort(); |
303 | 305 | ||
304 | if (cY || cX) | 306 | if (cY || cX) |
305 | lv->setContentsPos(cX, cY); | 307 | lv->setContentsPos(cX, cY); |
306 | } | 308 | } |
307 | 309 | ||
308 | void PwMView::reorgLp() | 310 | void PwMView::reorgLp() |
309 | { | 311 | { |
310 | if (!lv->childCount()) | 312 | if (!lv->childCount()) |
311 | return; | 313 | return; |
312 | PWM_ASSERT(doc); | 314 | PWM_ASSERT(doc); |
313 | PWM_ASSERT(!doc->isDocEmpty()); | 315 | PWM_ASSERT(!doc->isDocEmpty()); |
314 | QListViewItem *currItem; | 316 | QListViewItem *currItem; |
315 | vector<unsigned int> foundPos; | 317 | vector<unsigned int> foundPos; |
316 | /* This searchIn _should_ be: | 318 | /* This searchIn _should_ be: |
317 | *const unsigned int searchIn = SEARCH_IN_DESC; | 319 | *const unsigned int searchIn = SEARCH_IN_DESC; |
318 | * But we want backward compatibility (see comment in PwMDoc::addEntry()). | 320 | * But we want backward compatibility (see comment in PwMDoc::addEntry()). |
319 | * So we need to search again, if we don't find the entry. (see below) | 321 | * So we need to search again, if we don't find the entry. (see below) |
320 | */ | 322 | */ |
321 | const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME | | 323 | const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME | |
322 | SEARCH_IN_URL | SEARCH_IN_LAUNCHER; | 324 | SEARCH_IN_URL | SEARCH_IN_LAUNCHER; |
323 | QString curCat(getCurrentCategory()); | 325 | QString curCat(getCurrentCategory()); |
324 | PwMDataItem findThis; | 326 | PwMDataItem findThis; |
325 | unsigned int i, cnt = lv->childCount(); | 327 | unsigned int i, cnt = lv->childCount(); |
326 | for (i = 0; i < cnt; ++i) { | 328 | for (i = 0; i < cnt; ++i) { |
327 | currItem = lv->itemAtIndex(i); | 329 | currItem = lv->itemAtIndex(i); |
328 | findThis.desc = currItem->text(COLUMN_DESC).latin1(); | 330 | findThis.desc = currItem->text(COLUMN_DESC).latin1(); |
329 | findThis.name = currItem->text(COLUMN_NAME).latin1(); | 331 | findThis.name = currItem->text(COLUMN_NAME).latin1(); |
330 | findThis.url = currItem->text(COLUMN_URL).latin1(); | 332 | findThis.url = currItem->text(COLUMN_URL).latin1(); |
331 | findThis.launcher = currItem->text(COLUMN_LAUNCHER).latin1(); | 333 | findThis.launcher = currItem->text(COLUMN_LAUNCHER).latin1(); |
332 | doc->findEntry(curCat, findThis, searchIn, | 334 | doc->findEntry(curCat, findThis, searchIn, |
333 | &foundPos, true); | 335 | &foundPos, true); |
334 | if (!foundPos.size()) { | 336 | if (!foundPos.size()) { |
335 | /* Did not find the entry. We seem to have a binary | 337 | /* Did not find the entry. We seem to have a binary |
336 | * entry here (pray for it!). So search again with | 338 | * entry here (pray for it!). So search again with |
337 | * the "correct" searchIn flags. | 339 | * the "correct" searchIn flags. |
338 | */ | 340 | */ |
339 | const unsigned int searchIn2 = SEARCH_IN_DESC; | 341 | const unsigned int searchIn2 = SEARCH_IN_DESC; |
340 | doc->findEntry(curCat, findThis, searchIn2, | 342 | doc->findEntry(curCat, findThis, searchIn2, |
341 | &foundPos, true); | 343 | &foundPos, true); |
342 | if (unlikely(!foundPos.size())) { | 344 | if (unlikely(!foundPos.size())) { |
343 | BUG(); | 345 | BUG(); |
344 | continue; | 346 | continue; |
345 | } | 347 | } |
346 | /* We assert that it's a binary entry, now. | 348 | /* We assert that it's a binary entry, now. |
347 | * No chance to efficiently verify it here. | 349 | * No chance to efficiently verify it here. |
348 | */ | 350 | */ |
349 | } | 351 | } |
350 | doc->setListViewPos(curCat, foundPos[0], cnt - i - 1); | 352 | doc->setListViewPos(curCat, foundPos[0], cnt - i - 1); |
351 | } | 353 | } |
352 | } | 354 | } |
353 | 355 | ||
354 | void PwMView::selAt(int index) | 356 | void PwMView::selAt(int index) |
355 | { | 357 | { |
356 | QListViewItem *item = lv->itemAtIndex(index); | 358 | QListViewItem *item = lv->itemAtIndex(index); |
357 | if (!item) | 359 | if (!item) |
358 | return; | 360 | return; |
359 | lv->setCurrentItem(item); | 361 | lv->setCurrentItem(item); |
360 | lv->ensureItemVisible(item); | 362 | lv->ensureItemVisible(item); |
361 | } | 363 | } |
362 | 364 | ||
363 | void PwMView::renCatButton_slot() | 365 | void PwMView::renCatButton_slot() |
364 | { | 366 | { |
365 | if (doc->isDeepLocked()) | 367 | if (doc->isDeepLocked()) |
366 | return; | 368 | return; |
367 | RenCatWnd wnd(this); | 369 | RenCatWnd wnd(this); |
368 | if (wnd.exec() == 1) { | 370 | if (wnd.exec() == 1) { |
369 | QString newName(wnd.getNewName()); | 371 | QString newName(wnd.getNewName()); |
370 | if (newName == "") | 372 | if (newName == "") |
371 | return; | 373 | return; |
372 | document()->renameCategory(getCurrentCategory(), | 374 | document()->renameCategory(getCurrentCategory(), |
373 | newName); | 375 | newName); |
374 | } | 376 | } |
375 | } | 377 | } |
376 | 378 | ||
377 | void PwMView::delCatButton_slot() | 379 | void PwMView::delCatButton_slot() |
378 | { | 380 | { |
379 | if (doc->isDeepLocked()) | 381 | if (doc->isDeepLocked()) |
380 | return; | 382 | return; |
381 | if (numCategories() <= 1) { | 383 | if (numCategories() <= 1) { |
382 | mainClass->showStatMsg(i18n("Can't remove the last category.")); | 384 | mainClass->showStatMsg(i18n("Can't remove the last category.")); |
383 | return; | 385 | return; |
384 | } | 386 | } |
385 | if (KMessageBox::questionYesNo(this, | 387 | if (KMessageBox::questionYesNo(this, |
386 | i18n("Do you really want to\n" | 388 | i18n("Do you really want to\n" |
387 | "delete the selected\n" | 389 | "delete the selected\n" |
388 | "category? All password-\n" | 390 | "category? All password-\n" |
389 | "entries will be lost in\n" | 391 | "entries will be lost in\n" |
390 | "this category!\n"), | 392 | "this category!\n"), |
391 | i18n("Delete category?")) | 393 | i18n("Delete category?")) |
392 | == KMessageBox::No) { | 394 | == KMessageBox::No) { |
393 | return; | 395 | return; |
394 | } | 396 | } |
395 | document()->delCategory(getCurrentCategory()); | 397 | document()->delCategory(getCurrentCategory()); |
396 | } | 398 | } |
397 | 399 | ||
398 | void PwMView::copyPwToClip() | 400 | void PwMView::copyPwToClip() |
399 | { | 401 | { |
400 | if (doc->isDeepLocked()) | 402 | if (doc->isDeepLocked()) |
401 | return; | 403 | return; |
402 | unsigned int curIndex = 0; | 404 | unsigned int curIndex = 0; |
403 | if (!getCurEntryIndex(&curIndex)) | 405 | if (!getCurEntryIndex(&curIndex)) |
404 | return; | 406 | return; |
405 | PwMDataItem d; | 407 | PwMDataItem d; |
406 | document()->getDataChangedLock(); | 408 | document()->getDataChangedLock(); |
407 | document()->getEntry(getCurrentCategory(), curIndex, &d, true); | 409 | document()->getEntry(getCurrentCategory(), curIndex, &d, true); |
408 | document()->putDataChangedLock(); | 410 | document()->putDataChangedLock(); |
409 | PwM::copyToClipboard(d.pw.c_str()); | 411 | PwM::copyToClipboard(d.pw.c_str()); |
410 | } | 412 | } |
411 | 413 | ||
412 | void PwMView::copyNameToClip() | 414 | void PwMView::copyNameToClip() |
413 | { | 415 | { |
414 | if (doc->isDeepLocked()) | 416 | if (doc->isDeepLocked()) |
415 | return; | 417 | return; |
416 | unsigned int curIndex = 0; | 418 | unsigned int curIndex = 0; |
417 | if (!getCurEntryIndex(&curIndex)) | 419 | if (!getCurEntryIndex(&curIndex)) |
418 | return; | 420 | return; |
419 | PwMDataItem d; | 421 | PwMDataItem d; |
420 | document()->getEntry(getCurrentCategory(), curIndex, &d); | 422 | document()->getEntry(getCurrentCategory(), curIndex, &d); |
421 | PwM::copyToClipboard(d.name.c_str()); | 423 | PwM::copyToClipboard(d.name.c_str()); |
422 | } | 424 | } |
423 | 425 | ||
424 | void PwMView::copyDescToClip() | 426 | void PwMView::copyDescToClip() |
425 | { | 427 | { |
426 | if (doc->isDeepLocked()) | 428 | if (doc->isDeepLocked()) |
427 | return; | 429 | return; |
428 | unsigned int curIndex = 0; | 430 | unsigned int curIndex = 0; |
429 | if (!getCurEntryIndex(&curIndex)) | 431 | if (!getCurEntryIndex(&curIndex)) |
430 | return; | 432 | return; |
431 | PwMDataItem d; | 433 | PwMDataItem d; |
432 | document()->getEntry(getCurrentCategory(), curIndex, &d); | 434 | document()->getEntry(getCurrentCategory(), curIndex, &d); |
433 | PwM::copyToClipboard(d.desc.c_str()); | 435 | PwM::copyToClipboard(d.desc.c_str()); |
434 | } | 436 | } |
435 | 437 | ||
436 | void PwMView::copyUrlToClip() | 438 | void PwMView::copyUrlToClip() |
437 | { | 439 | { |
438 | if (doc->isDeepLocked()) | 440 | if (doc->isDeepLocked()) |
439 | return; | 441 | return; |
440 | unsigned int curIndex = 0; | 442 | unsigned int curIndex = 0; |
441 | if (!getCurEntryIndex(&curIndex)) | 443 | if (!getCurEntryIndex(&curIndex)) |
442 | return; | 444 | return; |
443 | PwMDataItem d; | 445 | PwMDataItem d; |
444 | document()->getEntry(getCurrentCategory(), curIndex, &d); | 446 | document()->getEntry(getCurrentCategory(), curIndex, &d); |
445 | PwM::copyToClipboard(d.url.c_str()); | 447 | PwM::copyToClipboard(d.url.c_str()); |
446 | } | 448 | } |
447 | 449 | ||
448 | void PwMView::copyLauncherToClip() | 450 | void PwMView::copyLauncherToClip() |
449 | { | 451 | { |
450 | if (doc->isDeepLocked()) | 452 | if (doc->isDeepLocked()) |
451 | return; | 453 | return; |
452 | unsigned int curIndex = 0; | 454 | unsigned int curIndex = 0; |
453 | if (!getCurEntryIndex(&curIndex)) | 455 | if (!getCurEntryIndex(&curIndex)) |
454 | return; | 456 | return; |
455 | PwMDataItem d; | 457 | PwMDataItem d; |
456 | document()->getEntry(getCurrentCategory(), curIndex, &d); | 458 | document()->getEntry(getCurrentCategory(), curIndex, &d); |
457 | PwM::copyToClipboard(d.launcher.c_str()); | 459 | PwM::copyToClipboard(d.launcher.c_str()); |
458 | } | 460 | } |
459 | 461 | ||
460 | void PwMView::copyCommentToClip() | 462 | void PwMView::copyCommentToClip() |
461 | { | 463 | { |
462 | if (doc->isDeepLocked()) | 464 | if (doc->isDeepLocked()) |
463 | return; | 465 | return; |
464 | unsigned int curIndex = 0; | 466 | unsigned int curIndex = 0; |
465 | if (!getCurEntryIndex(&curIndex)) | 467 | if (!getCurEntryIndex(&curIndex)) |
466 | return; | 468 | return; |
467 | PwMDataItem d; | 469 | PwMDataItem d; |
468 | document()->getEntry(getCurrentCategory(), curIndex, &d); | 470 | document()->getEntry(getCurrentCategory(), curIndex, &d); |
469 | PwM::copyToClipboard(d.comment.c_str()); | 471 | PwM::copyToClipboard(d.comment.c_str()); |
470 | } | 472 | } |
471 | 473 | ||
472 | /************************************************************************ | 474 | /************************************************************************ |
473 | * | 475 | * |
474 | * | 476 | * |
475 | * | 477 | * |
476 | ************************************************************************/ | 478 | ************************************************************************/ |
477 | 479 | ||
478 | 480 | ||
479 | PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name ) | 481 | PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name ) |
480 | : QTextBrowser( parent, name ) | 482 | : QTextBrowser( parent, name ) |
481 | 483 | ||
482 | 484 | ||
483 | { | 485 | { |
484 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 486 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
485 | setLinkUnderline( false ); | 487 | setLinkUnderline( false ); |
486 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 488 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
487 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 489 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
488 | 490 | ||
489 | //US QStyleSheet *sheet = styleSheet(); | 491 | //US QStyleSheet *sheet = styleSheet(); |
490 | //US QStyleSheetItem *link = sheet->item( "a" ); | 492 | //US QStyleSheetItem *link = sheet->item( "a" ); |
491 | //US link->setColor( KGlobalSettings::linkColor() ); | 493 | //US link->setColor( KGlobalSettings::linkColor() ); |
492 | 494 | ||
493 | } | 495 | } |
494 | 496 | ||
495 | void PwMDataItemView::setPwMDataItem( const PwMDataItem& a ) | 497 | void PwMDataItemView::setPwMDataItem( const PwMDataItem& a ) |
496 | 498 | ||
497 | { | 499 | { |
498 | mItem = a; | 500 | mItem = a; |
499 | // clear view | 501 | // clear view |
500 | setText( QString::null ); | 502 | setText( QString::null ); |
501 | 503 | ||
502 | 504 | ||
503 | QString dynamicPart; | 505 | QString dynamicPart; |
504 | QString format = "<tr><td align=\"right\"><b>%1</b></td>" | 506 | QString format = "<tr><td align=\"right\"><b>%1</b></td>" |
505 | "<td align=\"left\">%2</td></tr>"; | 507 | "<td align=\"left\">%2</td></tr>"; |
506 | 508 | ||
507 | dynamicPart += format | 509 | dynamicPart += format |
508 | .arg( i18n("LastUpdate") ) | 510 | .arg( i18n("LastUpdate") ) |
509 | .arg( mItem.meta.update.toString().latin1() ); | 511 | .arg( mItem.meta.update.toString().latin1() ); |
510 | 512 | ||
511 | dynamicPart += format | 513 | dynamicPart += format |
512 | .arg( i18n("Description") ) | 514 | .arg( i18n("Description") ) |
513 | .arg( mItem.desc.c_str() ); | 515 | .arg( mItem.desc.c_str() ); |
514 | 516 | ||
515 | dynamicPart += format | 517 | dynamicPart += format |
516 | .arg( i18n("Name") ) | 518 | .arg( i18n("Name") ) |
517 | .arg( mItem.name.c_str() ); | 519 | .arg( mItem.name.c_str() ); |
518 | 520 | ||
519 | dynamicPart += format | 521 | dynamicPart += format |
520 | .arg( i18n("Password") ) | 522 | .arg( i18n("Password") ) |
521 | .arg( mItem.pw.c_str() ); | 523 | .arg( mItem.pw.c_str() ); |
522 | 524 | ||
523 | QString comment(mItem.pw.c_str()); | 525 | QString comment(mItem.pw.c_str()); |
524 | dynamicPart += format | 526 | dynamicPart += format |
525 | .arg( i18n("Comment") ) | 527 | .arg( i18n("Comment") ) |
526 | .arg( comment.replace( QRegExp("\n"), "<br>" ) ); | 528 | .arg( comment.replace( QRegExp("\n"), "<br>" ) ); |
527 | 529 | ||
528 | dynamicPart += format | 530 | dynamicPart += format |
529 | .arg( i18n("URL") ) | 531 | .arg( i18n("URL") ) |
530 | .arg( mItem.url.c_str() ); | 532 | .arg( mItem.url.c_str() ); |
531 | 533 | ||
532 | dynamicPart += format | 534 | dynamicPart += format |
533 | .arg( i18n("Launcher") ) | 535 | .arg( i18n("Launcher") ) |
534 | .arg( mItem.launcher.c_str() ); | 536 | .arg( mItem.launcher.c_str() ); |
535 | 537 | ||
536 | QString mText = "<table><td colspan=\"2\"> </td>"; | 538 | QString mText = "<table><td colspan=\"2\"> </td>"; |
537 | 539 | ||
538 | mText += dynamicPart; | 540 | mText += dynamicPart; |
539 | mText += "</table>"; | 541 | mText += "</table>"; |
540 | 542 | ||
541 | // at last display it... | 543 | // at last display it... |
542 | setText( mText ); | 544 | setText( mText ); |
543 | 545 | ||
544 | } | 546 | } |
545 | 547 | ||
546 | PwMDataItem PwMDataItemView::pwmdataitem() const | 548 | PwMDataItem PwMDataItemView::pwmdataitem() const |
547 | { | 549 | { |
548 | return mItem; | 550 | return mItem; |
549 | } | 551 | } |
550 | 552 | ||
551 | /************************************************************************ | 553 | /************************************************************************ |
552 | * | 554 | * |
553 | * | 555 | * |
554 | * | 556 | * |
555 | ************************************************************************/ | 557 | ************************************************************************/ |
556 | 558 | ||
557 | 559 | ||
558 | PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name ) | 560 | PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name ) |
559 | : KDialogBase(parent, name, true , | 561 | : KDialogBase(parent, name, true , |
560 | i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false) | 562 | i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false) |
561 | { | 563 | { |
562 | findButton( Close )->setText( i18n("Cancel Sync")); | 564 | findButton( Close )->setText( i18n("Cancel Sync")); |
563 | findButton( Ok )->setText( i18n("Remote")); | 565 | findButton( Ok )->setText( i18n("Remote")); |
564 | findButton( User1 )->setText( i18n("Local")); | 566 | findButton( User1 )->setText( i18n("Local")); |
565 | QWidget* topframe = new QWidget( this ); | 567 | QWidget* topframe = new QWidget( this ); |
566 | setMainWidget( topframe ); | 568 | setMainWidget( topframe ); |
567 | QBoxLayout* bl; | 569 | QBoxLayout* bl; |
568 | if ( QApplication::desktop()->width() < 640 ) { | 570 | if ( QApplication::desktop()->width() < 640 ) { |
569 | bl = new QVBoxLayout( topframe ); | 571 | bl = new QVBoxLayout( topframe ); |
570 | } else { | 572 | } else { |
571 | bl = new QHBoxLayout( topframe ); | 573 | bl = new QHBoxLayout( topframe ); |
572 | } | 574 | } |
573 | QVBox* subframe = new QVBox( topframe ); | 575 | QVBox* subframe = new QVBox( topframe ); |
574 | bl->addWidget(subframe ); | 576 | bl->addWidget(subframe ); |
575 | QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); | 577 | QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); |
576 | if ( takeloc ) | 578 | if ( takeloc ) |
577 | lab->setBackgroundColor(Qt::green.light() ); | 579 | lab->setBackgroundColor(Qt::green.light() ); |
578 | PwMDataItemView * av = new PwMDataItemView( subframe ); | 580 | PwMDataItemView * av = new PwMDataItemView( subframe ); |
579 | av->setPwMDataItem( loc ); | 581 | av->setPwMDataItem( loc ); |
580 | subframe = new QVBox( topframe ); | 582 | subframe = new QVBox( topframe ); |
581 | bl->addWidget(subframe ); | 583 | bl->addWidget(subframe ); |
582 | lab = new QLabel( i18n("Remote Entry"), subframe ); | 584 | lab = new QLabel( i18n("Remote Entry"), subframe ); |
583 | if ( !takeloc ) | 585 | if ( !takeloc ) |
584 | lab->setBackgroundColor(Qt::green.light() ); | 586 | lab->setBackgroundColor(Qt::green.light() ); |
585 | av = new PwMDataItemView( subframe ); | 587 | av = new PwMDataItemView( subframe ); |
586 | av->setPwMDataItem( rem ); | 588 | av->setPwMDataItem( rem ); |
587 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); | 589 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); |
588 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); | 590 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); |
589 | #ifndef DESKTOP_VERSION | 591 | #ifndef DESKTOP_VERSION |
590 | showMaximized(); | 592 | showMaximized(); |
591 | #else | 593 | #else |
592 | resize ( 640, 400 ); | 594 | resize ( 640, 400 ); |
593 | #endif | 595 | #endif |
594 | } | 596 | } |
595 | 597 | ||
596 | int PwMDataItemChooser::executeD( bool local ) | 598 | int PwMDataItemChooser::executeD( bool local ) |
597 | { | 599 | { |
598 | mSyncResult = 3; | 600 | mSyncResult = 3; |
599 | if ( local ) | 601 | if ( local ) |
600 | findButton( User1 )->setFocus(); | 602 | findButton( User1 )->setFocus(); |
601 | else | 603 | else |
602 | findButton( Ok )->setFocus(); | 604 | findButton( Ok )->setFocus(); |
603 | exec(); | 605 | exec(); |
604 | return mSyncResult; | 606 | return mSyncResult; |
605 | } | 607 | } |
606 | void PwMDataItemChooser::slot_remote() | 608 | void PwMDataItemChooser::slot_remote() |
607 | { | 609 | { |
608 | mSyncResult = 2; | 610 | mSyncResult = 2; |
609 | accept(); | 611 | accept(); |
610 | } | 612 | } |
611 | void PwMDataItemChooser::slot_local() | 613 | void PwMDataItemChooser::slot_local() |
612 | { | 614 | { |
613 | mSyncResult = 1; | 615 | mSyncResult = 1; |
614 | accept(); | 616 | accept(); |
615 | } | 617 | } |
616 | 618 | ||
617 | 619 | ||
618 | 620 | ||
619 | #ifndef PWM_EMBEDDED | 621 | #ifndef PWM_EMBEDDED |
620 | #include "pwmview.moc" | 622 | #include "pwmview.moc" |
621 | #endif | 623 | #endif |
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp index 5f25880..ee35472 100644 --- a/pwmanager/pwmanager/pwmviewstyle.cpp +++ b/pwmanager/pwmanager/pwmviewstyle.cpp | |||
@@ -1,250 +1,254 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | 12 | ||
13 | /*************************************************************************** | 13 | /*************************************************************************** |
14 | * copyright (C) 2004 by Ulf Schenk | 14 | * copyright (C) 2004 by Ulf Schenk |
15 | * This file is originaly based on version 1.0.1 of pwmanager | 15 | * This file is originaly based on version 1.0.1 of pwmanager |
16 | * and was modified to run on embedded devices that run microkde | 16 | * and was modified to run on embedded devices that run microkde |
17 | * | 17 | * |
18 | * $Id$ | 18 | * $Id$ |
19 | **************************************************************************/ | 19 | **************************************************************************/ |
20 | 20 | ||
21 | #include "pwmviewstyle.h" | 21 | #include "pwmviewstyle.h" |
22 | #include "pwmexception.h" | 22 | #include "pwmexception.h" |
23 | #include "pwmviewstyle_0.h" | 23 | #include "pwmviewstyle_0.h" |
24 | #include "pwmviewstyle_1.h" | 24 | #include "pwmviewstyle_1.h" |
25 | #include "listviewpwm.h" | 25 | #include "listviewpwm.h" |
26 | #include "pwmview.h" | 26 | #include "pwmview.h" |
27 | #include "commentbox.h" | 27 | #include "commentbox.h" |
28 | #ifndef PWM_EMBEDDED | 28 | #ifndef PWM_EMBEDDED |
29 | #include "configuration.h" | 29 | #include "configuration.h" |
30 | #else | 30 | #else |
31 | #include "pwmprefs.h" | 31 | #include "pwmprefs.h" |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) | 34 | PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) |
35 | : QWidget(parent, name) | 35 | : QWidget(parent, name) |
36 | { | 36 | { |
37 | curStyle = style_notset; | 37 | curStyle = style_notset; |
38 | s0 = 0; | 38 | s0 = 0; |
39 | s1 = 0; | 39 | s1 = 0; |
40 | } | 40 | } |
41 | 41 | ||
42 | PwMViewStyle::~PwMViewStyle() | 42 | PwMViewStyle::~PwMViewStyle() |
43 | { | 43 | { |
44 | //US ENH : store the size of the listviewcolumns | 44 | //US ENH : store the size of the listviewcolumns |
45 | switch (curStyle) | 45 | switch (curStyle) |
46 | { | 46 | { |
47 | case style_0: | 47 | case style_0: |
48 | s0->saveSettings(PWMPrefs::instance()); | 48 | s0->saveSettings(PWMPrefs::instance()); |
49 | break; | 49 | break; |
50 | case style_1: | 50 | case style_1: |
51 | s1->saveSettings(PWMPrefs::instance()); | 51 | s1->saveSettings(PWMPrefs::instance()); |
52 | break; | 52 | break; |
53 | default: | 53 | default: |
54 | BUG(); | 54 | BUG(); |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | PWMPrefs::instance()->writeConfig(); | 58 | PWMPrefs::instance()->writeConfig(); |
59 | 59 | ||
60 | delete_ifnot_null(s0); | 60 | delete_ifnot_null(s0); |
61 | delete_ifnot_null(s1); | 61 | delete_ifnot_null(s1); |
62 | } | 62 | } |
63 | 63 | ||
64 | void PwMViewStyle::editPassWord( QListViewItem * i ) | 64 | void PwMViewStyle::editPassWord( QListViewItem * i ) |
65 | { | 65 | { |
66 | if ( !i ) | 66 | if ( !i ) |
67 | return; | 67 | return; |
68 | emit editPW(); | 68 | emit editPW(); |
69 | } | 69 | } |
70 | void PwMViewStyle::initStyle(style_t style) | 70 | void PwMViewStyle::initStyle(style_t style) |
71 | { | 71 | { |
72 | printDebug(string("initializing style ") + tostr(style)); | 72 | printDebug(string("initializing style ") + tostr(style)); |
73 | bool wasMaximized = v->isMaximized(); | 73 | bool wasMaximized = v->isMaximized(); |
74 | if (v->isVisible()) | 74 | if (v->isVisible()) |
75 | v->hide(); | 75 | v->hide(); |
76 | switch (style) { | 76 | switch (style) { |
77 | case style_0: | 77 | case style_0: |
78 | delete_ifnot_null(s0); | 78 | delete_ifnot_null(s0); |
79 | delete_ifnot_null(s1); | 79 | delete_ifnot_null(s1); |
80 | s0 = new PwMViewStyle_0(v); | 80 | s0 = new PwMViewStyle_0(v); |
81 | lv = s0->getLv(); | 81 | lv = s0->getLv(); |
82 | commentBox = s0->getCommentBox(); | 82 | commentBox = s0->getCommentBox(); |
83 | break; | 83 | break; |
84 | case style_1: | 84 | case style_1: |
85 | delete_ifnot_null(s0); | 85 | delete_ifnot_null(s0); |
86 | delete_ifnot_null(s1); | 86 | delete_ifnot_null(s1); |
87 | s1 = new PwMViewStyle_1(v); | 87 | s1 = new PwMViewStyle_1(v); |
88 | lv = s1->getLv(); | 88 | lv = s1->getLv(); |
89 | commentBox = s1->getCommentBox(); | 89 | commentBox = s1->getCommentBox(); |
90 | break; | 90 | break; |
91 | default: | 91 | default: |
92 | BUG(); | 92 | BUG(); |
93 | return; | 93 | return; |
94 | } | 94 | } |
95 | curStyle = style; | 95 | curStyle = style; |
96 | connect(lv, SIGNAL(pressed(QListViewItem *)), | 96 | connect(lv, SIGNAL(pressed(QListViewItem *)), |
97 | v, SLOT(handleToggle(QListViewItem *))); | 97 | v, SLOT(handleToggle(QListViewItem *))); |
98 | connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), | 98 | connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), |
99 | v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); | 99 | v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); |
100 | connect(lv, SIGNAL(clicked(QListViewItem *)), | 100 | connect(lv, SIGNAL(clicked(QListViewItem *)), |
101 | v, SLOT(refreshCommentTextEdit(QListViewItem *))); | 101 | v, SLOT(refreshCommentTextEdit(QListViewItem *))); |
102 | connect(lv, SIGNAL(returnPressed(QListViewItem *)), | 102 | connect(lv, SIGNAL(returnPressed(QListViewItem *)), |
103 | this, SLOT(editPassWord(QListViewItem *))); | 103 | this, SLOT(editPassWord(QListViewItem *))); |
104 | connect(lv, SIGNAL(doubleClicked(QListViewItem *)), | 104 | connect(lv, SIGNAL(doubleClicked(QListViewItem *)), |
105 | this, SLOT(editPassWord(QListViewItem *))); | 105 | this, SLOT(editPassWord(QListViewItem *))); |
106 | connect(lv, SIGNAL(insertPW()), | ||
107 | this, SIGNAL( insertPW() )); | ||
108 | connect(lv, SIGNAL(deletePW()), | ||
109 | this, SIGNAL( deletePW() )); | ||
106 | 110 | ||
107 | lv->addColumn(i18n("Description"), 180); | 111 | lv->addColumn(i18n("Description"), 180); |
108 | lv->addColumn(i18n("Username"), 150); | 112 | lv->addColumn(i18n("Username"), 150); |
109 | lv->addColumn(i18n("Password"), 150); | 113 | lv->addColumn(i18n("Password"), 150); |
110 | lv->addColumn(i18n("URL"), 180); | 114 | lv->addColumn(i18n("URL"), 180); |
111 | lv->addColumn(i18n("Launcher"), 120); | 115 | lv->addColumn(i18n("Launcher"), 120); |
112 | v->tmpReEnableSort(); | 116 | v->tmpReEnableSort(); |
113 | 117 | ||
114 | //US ENH : load the size of the listviewcolumns | 118 | //US ENH : load the size of the listviewcolumns |
115 | switch (curStyle) | 119 | switch (curStyle) |
116 | { | 120 | { |
117 | case style_0: | 121 | case style_0: |
118 | s0->restoreSettings(PWMPrefs::instance()); | 122 | s0->restoreSettings(PWMPrefs::instance()); |
119 | break; | 123 | break; |
120 | case style_1: | 124 | case style_1: |
121 | s1->restoreSettings(PWMPrefs::instance()); | 125 | s1->restoreSettings(PWMPrefs::instance()); |
122 | break; | 126 | break; |
123 | default: | 127 | default: |
124 | BUG(); | 128 | BUG(); |
125 | } | 129 | } |
126 | 130 | ||
127 | resizeView(v->size()); | 131 | resizeView(v->size()); |
128 | v->updateView(); | 132 | v->updateView(); |
129 | if (wasMaximized) { | 133 | if (wasMaximized) { |
130 | v->showMaximized(); | 134 | v->showMaximized(); |
131 | } else { | 135 | } else { |
132 | v->show(); | 136 | v->show(); |
133 | } | 137 | } |
134 | connect(lv, SIGNAL(layoutChanged()), | 138 | connect(lv, SIGNAL(layoutChanged()), |
135 | v, SLOT(reorgLp())); | 139 | v, SLOT(reorgLp())); |
136 | } | 140 | } |
137 | 141 | ||
138 | void PwMViewStyle::resizeView(const QSize &size) | 142 | void PwMViewStyle::resizeView(const QSize &size) |
139 | { | 143 | { |
140 | switch (curStyle) { | 144 | switch (curStyle) { |
141 | case style_0: | 145 | case style_0: |
142 | PWM_ASSERT(s0); | 146 | PWM_ASSERT(s0); |
143 | s0->resize(size); | 147 | s0->resize(size); |
144 | return; | 148 | return; |
145 | case style_1: | 149 | case style_1: |
146 | PWM_ASSERT(s1); | 150 | PWM_ASSERT(s1); |
147 | s1->resize(size); | 151 | s1->resize(size); |
148 | return; | 152 | return; |
149 | default: | 153 | default: |
150 | BUG(); | 154 | BUG(); |
151 | } | 155 | } |
152 | } | 156 | } |
153 | 157 | ||
154 | QString PwMViewStyle::getCurrentCategory() | 158 | QString PwMViewStyle::getCurrentCategory() |
155 | { | 159 | { |
156 | switch (curStyle) { | 160 | switch (curStyle) { |
157 | case style_0: | 161 | case style_0: |
158 | PWM_ASSERT(s0); | 162 | PWM_ASSERT(s0); |
159 | return s0->getCurrentCategory(); | 163 | return s0->getCurrentCategory(); |
160 | case style_1: | 164 | case style_1: |
161 | PWM_ASSERT(s1); | 165 | PWM_ASSERT(s1); |
162 | return s1->getCurrentCategory(); | 166 | return s1->getCurrentCategory(); |
163 | default: | 167 | default: |
164 | BUG(); | 168 | BUG(); |
165 | } | 169 | } |
166 | return ""; | 170 | return ""; |
167 | } | 171 | } |
168 | 172 | ||
169 | void PwMViewStyle::addCategory(const QString &cat) | 173 | void PwMViewStyle::addCategory(const QString &cat) |
170 | { | 174 | { |
171 | switch (curStyle) { | 175 | switch (curStyle) { |
172 | case style_0: | 176 | case style_0: |
173 | PWM_ASSERT(s0); | 177 | PWM_ASSERT(s0); |
174 | s0->addCategory(cat); | 178 | s0->addCategory(cat); |
175 | return; | 179 | return; |
176 | case style_1: | 180 | case style_1: |
177 | PWM_ASSERT(s1); | 181 | PWM_ASSERT(s1); |
178 | s1->addCategory(cat); | 182 | s1->addCategory(cat); |
179 | return; | 183 | return; |
180 | default: | 184 | default: |
181 | BUG(); | 185 | BUG(); |
182 | } | 186 | } |
183 | } | 187 | } |
184 | 188 | ||
185 | void PwMViewStyle::delCategory(const QString &cat) | 189 | void PwMViewStyle::delCategory(const QString &cat) |
186 | { | 190 | { |
187 | switch (curStyle) { | 191 | switch (curStyle) { |
188 | case style_0: | 192 | case style_0: |
189 | PWM_ASSERT(s0); | 193 | PWM_ASSERT(s0); |
190 | s0->delCategory(cat); | 194 | s0->delCategory(cat); |
191 | return; | 195 | return; |
192 | case style_1: | 196 | case style_1: |
193 | PWM_ASSERT(s1); | 197 | PWM_ASSERT(s1); |
194 | s1->delCategory(cat); | 198 | s1->delCategory(cat); |
195 | return; | 199 | return; |
196 | default: | 200 | default: |
197 | BUG(); | 201 | BUG(); |
198 | } | 202 | } |
199 | } | 203 | } |
200 | 204 | ||
201 | void PwMViewStyle::delAllCategories() | 205 | void PwMViewStyle::delAllCategories() |
202 | { | 206 | { |
203 | switch (curStyle) { | 207 | switch (curStyle) { |
204 | case style_0: | 208 | case style_0: |
205 | PWM_ASSERT(s0); | 209 | PWM_ASSERT(s0); |
206 | s0->delAllCategories(); | 210 | s0->delAllCategories(); |
207 | return; | 211 | return; |
208 | case style_1: | 212 | case style_1: |
209 | PWM_ASSERT(s1); | 213 | PWM_ASSERT(s1); |
210 | s1->delAllCategories(); | 214 | s1->delAllCategories(); |
211 | return; | 215 | return; |
212 | default: | 216 | default: |
213 | BUG(); | 217 | BUG(); |
214 | } | 218 | } |
215 | } | 219 | } |
216 | 220 | ||
217 | void PwMViewStyle::selectCategory(const QString &cat) | 221 | void PwMViewStyle::selectCategory(const QString &cat) |
218 | { | 222 | { |
219 | switch (curStyle) { | 223 | switch (curStyle) { |
220 | case style_0: | 224 | case style_0: |
221 | PWM_ASSERT(s0); | 225 | PWM_ASSERT(s0); |
222 | s0->selectCategory(cat); | 226 | s0->selectCategory(cat); |
223 | return; | 227 | return; |
224 | case style_1: | 228 | case style_1: |
225 | PWM_ASSERT(s1); | 229 | PWM_ASSERT(s1); |
226 | s1->selectCategory(cat); | 230 | s1->selectCategory(cat); |
227 | return; | 231 | return; |
228 | default: | 232 | default: |
229 | BUG(); | 233 | BUG(); |
230 | } | 234 | } |
231 | } | 235 | } |
232 | 236 | ||
233 | int PwMViewStyle::numCategories() | 237 | int PwMViewStyle::numCategories() |
234 | { | 238 | { |
235 | switch (curStyle) { | 239 | switch (curStyle) { |
236 | case style_0: | 240 | case style_0: |
237 | PWM_ASSERT(s0); | 241 | PWM_ASSERT(s0); |
238 | return s0->numCategories(); | 242 | return s0->numCategories(); |
239 | case style_1: | 243 | case style_1: |
240 | PWM_ASSERT(s1); | 244 | PWM_ASSERT(s1); |
241 | return s1->numCategories(); | 245 | return s1->numCategories(); |
242 | default: | 246 | default: |
243 | BUG(); | 247 | BUG(); |
244 | } | 248 | } |
245 | return 0; | 249 | return 0; |
246 | } | 250 | } |
247 | 251 | ||
248 | #ifndef PWM_EMBEDDED | 252 | #ifndef PWM_EMBEDDED |
249 | #include "pwmviewstyle.moc" | 253 | #include "pwmviewstyle.moc" |
250 | #endif | 254 | #endif |
diff --git a/pwmanager/pwmanager/pwmviewstyle.h b/pwmanager/pwmanager/pwmviewstyle.h index 5656cbc..6c2d81c 100644 --- a/pwmanager/pwmanager/pwmviewstyle.h +++ b/pwmanager/pwmanager/pwmviewstyle.h | |||
@@ -1,113 +1,115 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | 12 | ||
13 | /*************************************************************************** | 13 | /*************************************************************************** |
14 | * copyright (C) 2004 by Ulf Schenk | 14 | * copyright (C) 2004 by Ulf Schenk |
15 | * This file is originaly based on version 1.0.1 of pwmanager | 15 | * This file is originaly based on version 1.0.1 of pwmanager |
16 | * and was modified to run on embedded devices that run microkde | 16 | * and was modified to run on embedded devices that run microkde |
17 | * | 17 | * |
18 | * $Id$ | 18 | * $Id$ |
19 | **************************************************************************/ | 19 | **************************************************************************/ |
20 | 20 | ||
21 | #ifndef PWMVIEWSTYLE_H | 21 | #ifndef PWMVIEWSTYLE_H |
22 | #define PWMVIEWSTYLE_H | 22 | #define PWMVIEWSTYLE_H |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qsplitter.h> | 25 | #include <qsplitter.h> |
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
30 | #ifndef PWM_EMBEDDED | 30 | #ifndef PWM_EMBEDDED |
31 | #include <qtextedit.h> | 31 | #include <qtextedit.h> |
32 | #else | 32 | #else |
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | #include <qsize.h> | 39 | #include <qsize.h> |
40 | 40 | ||
41 | class ListViewPwM; | 41 | class ListViewPwM; |
42 | class PwMViewStyle_0; | 42 | class PwMViewStyle_0; |
43 | class PwMViewStyle_1; | 43 | class PwMViewStyle_1; |
44 | class PwMView; | 44 | class PwMView; |
45 | class QListViewItem; | 45 | class QListViewItem; |
46 | class CommentBox; | 46 | class CommentBox; |
47 | 47 | ||
48 | class PwMViewStyle : public QWidget | 48 | class PwMViewStyle : public QWidget |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | enum style_t | 53 | enum style_t |
54 | { | 54 | { |
55 | style_notset= -1, | 55 | style_notset= -1, |
56 | style_0 = 0, | 56 | style_0 = 0, |
57 | style_1 = 1 | 57 | style_1 = 1 |
58 | }; | 58 | }; |
59 | 59 | ||
60 | public: | 60 | public: |
61 | PwMViewStyle(QWidget *parent = 0, const char *name = 0); | 61 | PwMViewStyle(QWidget *parent = 0, const char *name = 0); |
62 | ~PwMViewStyle(); | 62 | ~PwMViewStyle(); |
63 | 63 | ||
64 | /** initialize a new style */ | 64 | /** initialize a new style */ |
65 | void initStyle(style_t style); | 65 | void initStyle(style_t style); |
66 | void initStyle(int style) | 66 | void initStyle(int style) |
67 | { initStyle(static_cast<style_t>(style)); } | 67 | { initStyle(static_cast<style_t>(style)); } |
68 | /** returns the currently used style */ | 68 | /** returns the currently used style */ |
69 | style_t getCurStyle() | 69 | style_t getCurStyle() |
70 | { return curStyle; } | 70 | { return curStyle; } |
71 | void setView(PwMView *view) | 71 | void setView(PwMView *view) |
72 | { v = view; } | 72 | { v = view; } |
73 | 73 | ||
74 | /** returns the currently selected category */ | 74 | /** returns the currently selected category */ |
75 | QString getCurrentCategory(); | 75 | QString getCurrentCategory(); |
76 | 76 | ||
77 | protected: | 77 | protected: |
78 | /** add Category to the view */ | 78 | /** add Category to the view */ |
79 | void addCategory(const QString &cat); | 79 | void addCategory(const QString &cat); |
80 | /** delete Category from view */ | 80 | /** delete Category from view */ |
81 | void delCategory(const QString &cat); | 81 | void delCategory(const QString &cat); |
82 | /** delete all categories from view */ | 82 | /** delete all categories from view */ |
83 | void delAllCategories(); | 83 | void delAllCategories(); |
84 | /** select the specified category */ | 84 | /** select the specified category */ |
85 | void selectCategory(const QString &cat); | 85 | void selectCategory(const QString &cat); |
86 | /** returns the number of categories in this view. | 86 | /** returns the number of categories in this view. |
87 | * This value dosn't say anything about the number of | 87 | * This value dosn't say anything about the number of |
88 | * categories in the document. | 88 | * categories in the document. |
89 | */ | 89 | */ |
90 | int numCategories(); | 90 | int numCategories(); |
91 | /** resize the view */ | 91 | /** resize the view */ |
92 | void resizeView(const QSize &size); | 92 | void resizeView(const QSize &size); |
93 | ListViewPwM *lv; | 93 | ListViewPwM *lv; |
94 | CommentBox *commentBox; | 94 | CommentBox *commentBox; |
95 | 95 | ||
96 | protected slots: | 96 | protected slots: |
97 | void editPassWord( QListViewItem * ); | 97 | void editPassWord( QListViewItem * ); |
98 | 98 | ||
99 | private: | 99 | private: |
100 | /** which style has the view? | 100 | /** which style has the view? |
101 | * KListBox on the left, | 101 | * KListBox on the left, |
102 | * or QComboBox on the top? | 102 | * or QComboBox on the top? |
103 | */ | 103 | */ |
104 | style_t curStyle; | 104 | style_t curStyle; |
105 | 105 | ||
106 | PwMViewStyle_0 *s0; | 106 | PwMViewStyle_0 *s0; |
107 | PwMViewStyle_1 *s1; | 107 | PwMViewStyle_1 *s1; |
108 | PwMView *v; | 108 | PwMView *v; |
109 | signals: | 109 | signals: |
110 | void editPW(); | 110 | void editPW(); |
111 | void insertPW(); | ||
112 | void deletePW(); | ||
111 | 113 | ||
112 | }; | 114 | }; |
113 | #endif | 115 | #endif |